[FFmpeg-devel] [PATCH] avcodec/vulkan: Add support for generating GLSL strings from comp shaders
--- libavcodec/Makefile | 7 +++ 1 file changed, 7 insertions(+) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 4eed81ed03..734ab14596 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1371,3 +1371,10 @@ $(SUBDIR)pcm.o: $(SUBDIR)pcm_tables.h $(SUBDIR)qdm2.o: $(SUBDIR)qdm2_tables.h $(SUBDIR)sinewin.o: $(SUBDIR)sinewin_tables.h endif + +clean:: + $(RM) $(CLEANSUFFIXES:%=libavcodec/vulkan/%) +VULKAN = $(subst $(SRC_PATH)/,,$(wildcard $(SRC_PATH)/libavcodec/vulkan/*.comp)) +.SECONDARY: $(VULKAN:.comp=.c) +libavcodec/vulkan/%.c: $(SRC_PATH)/libavcodec/vulkan/%.comp + $(M)$(SRC_PATH)/tools/source2c $< $@ \ No newline at end of file -- 2.46.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2] avcodec/hevc/ps: add a range check for sps_max_sub_layers
It can't be higher than vps_max_sub_layers. Do this while keeping the workaround for qsvenc_hevc calling ff_hevc_parse_sps() without a vps_list, as in some cases it needs to parse an sps to generate a fake vps derived from it. Signed-off-by: James Almer --- libavcodec/hevc/ps.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libavcodec/hevc/ps.c b/libavcodec/hevc/ps.c index 993c60144f..c773d7d221 100644 --- a/libavcodec/hevc/ps.c +++ b/libavcodec/hevc/ps.c @@ -1158,6 +1158,7 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, HEVCWindow *ow; int ret = 0; int bit_depth_chroma, num_comps, multi_layer_ext; +int vps_max_sub_layers; int i; // Coded parameters @@ -1181,8 +1182,12 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, return AVERROR(EINVAL); sps->max_sub_layers = sps->vps->vps_max_sub_layers; -} -if (sps->max_sub_layers > HEVC_MAX_SUB_LAYERS) { +vps_max_sub_layers = sps->vps->vps_max_sub_layers; +} else +vps_max_sub_layers = sps->vps ? sps->vps->vps_max_sub_layers + : FFMIN(sps->max_sub_layers, HEVC_MAX_SUB_LAYERS); + +if (sps->max_sub_layers > vps_max_sub_layers) { av_log(avctx, AV_LOG_ERROR, "sps_max_sub_layers out of range: %d\n", sps->max_sub_layers); return AVERROR_INVALIDDATA; -- 2.46.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2] aacenc_pred: prevent UB in ff_aac_adjust_common_pred()
On 05/10/2024 20:58, Sean McGovern wrote: --- libavcodec/aacenc_pred.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libavcodec/aacenc_pred.c b/libavcodec/aacenc_pred.c index a486c44d42..a6dfaa25fb 100644 --- a/libavcodec/aacenc_pred.c +++ b/libavcodec/aacenc_pred.c @@ -153,9 +153,7 @@ void ff_aac_adjust_common_pred(AACEncContext *s, ChannelElement *cpe) int start, w, w2, g, i, count = 0; SingleChannelElement *sce0 = &cpe->ch[0]; SingleChannelElement *sce1 = &cpe->ch[1]; -const int pmax0 = FFMIN(sce0->ics.max_sfb, ff_aac_pred_sfb_max[s->samplerate_index]); -const int pmax1 = FFMIN(sce1->ics.max_sfb, ff_aac_pred_sfb_max[s->samplerate_index]); -const int pmax = FFMIN(pmax0, pmax1); +const int pmax = FFMIN(sce1->ics.max_sfb, ff_aac_pred_sfb_max[s->samplerate_index]); if (!cpe->common_window || sce0->ics.window_sequence[0] == EIGHT_SHORT_SEQUENCE || @@ -164,7 +162,7 @@ void ff_aac_adjust_common_pred(AACEncContext *s, ChannelElement *cpe) for (w = 0; w < sce0->ics.num_windows; w += sce0->ics.group_len[w]) { start = 0; -for (g = 0; g < sce0->ics.num_swb; g++) { +for (g = 0; g < pmax; g++) { int sfb = w*16+g; int sum = sce0->ics.prediction_used[sfb] + sce1->ics.prediction_used[sfb]; float ener0 = 0.0f, ener1 = 0.0f, ener01 = 0.0f; I'm not sure I see the UB here? OpenPGP_0xA2FEA5F03F034464.asc Description: OpenPGP public key OpenPGP_signature.asc Description: OpenPGP digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2] aacenc_pred: prevent UB in ff_aac_adjust_common_pred()
--- libavcodec/aacenc_pred.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libavcodec/aacenc_pred.c b/libavcodec/aacenc_pred.c index a486c44d42..a6dfaa25fb 100644 --- a/libavcodec/aacenc_pred.c +++ b/libavcodec/aacenc_pred.c @@ -153,9 +153,7 @@ void ff_aac_adjust_common_pred(AACEncContext *s, ChannelElement *cpe) int start, w, w2, g, i, count = 0; SingleChannelElement *sce0 = &cpe->ch[0]; SingleChannelElement *sce1 = &cpe->ch[1]; -const int pmax0 = FFMIN(sce0->ics.max_sfb, ff_aac_pred_sfb_max[s->samplerate_index]); -const int pmax1 = FFMIN(sce1->ics.max_sfb, ff_aac_pred_sfb_max[s->samplerate_index]); -const int pmax = FFMIN(pmax0, pmax1); +const int pmax = FFMIN(sce1->ics.max_sfb, ff_aac_pred_sfb_max[s->samplerate_index]); if (!cpe->common_window || sce0->ics.window_sequence[0] == EIGHT_SHORT_SEQUENCE || @@ -164,7 +162,7 @@ void ff_aac_adjust_common_pred(AACEncContext *s, ChannelElement *cpe) for (w = 0; w < sce0->ics.num_windows; w += sce0->ics.group_len[w]) { start = 0; -for (g = 0; g < sce0->ics.num_swb; g++) { +for (g = 0; g < pmax; g++) { int sfb = w*16+g; int sum = sce0->ics.prediction_used[sfb] + sce1->ics.prediction_used[sfb]; float ener0 = 0.0f, ener1 = 0.0f, ener01 = 0.0f; -- 2.39.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 02/12] tests/swscale: fix minor typos
From: Niklas Haas Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas --- libswscale/tests/swscale.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libswscale/tests/swscale.c b/libswscale/tests/swscale.c index cf8d04de89..8e57c0a7cf 100644 --- a/libswscale/tests/swscale.c +++ b/libswscale/tests/swscale.c @@ -445,14 +445,14 @@ int main(int argc, char **argv) " -ref \n" " Uses file as reference to compae tests againsts. Tests that have become worse will contain the string worse or WORSE\n" " -p \n" -" The percentage of tests or comparissions to perform. Doing all tests will take long and generate over a hundread MB text output\n" +" The percentage of tests or comparisons to perform. Doing all tests will take long and generate over a hundred MB text output\n" " It is often convenient to perform a random subset\n" " -dst \n" " Only test the specified destination pixel format\n" " -src \n" " Only test the specified source pixel format\n" " -cpuflags \n" -" Uses the specified cpuflags in teh tests\n" +" Uses the specified cpuflags in the tests\n" ); goto error; } -- 2.46.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 01/12] avfilter/src_movie: configure correct YUV attributes
From: Niklas Haas Missed by the YUV negotiation series. --- libavfilter/src_movie.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c index 65091b65f0..d2aa572d12 100644 --- a/libavfilter/src_movie.c +++ b/libavfilter/src_movie.c @@ -430,6 +430,12 @@ static int movie_query_formats(const AVFilterContext *ctx, list[0] = c->format; if ((ret = ff_formats_ref(ff_make_format_list(list), &cfg->formats)) < 0) return ret; +list[0] = c->color_space; +if ((ret = ff_formats_ref(ff_make_format_list(list), &cfg->color_spaces)) < 0) +return ret; +list[0] = c->color_range; +if ((ret = ff_formats_ref(ff_make_format_list(list), &cfg->color_ranges)) < 0) +return ret; break; case AVMEDIA_TYPE_AUDIO: list[0] = c->format; -- 2.46.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 09/12] swscale/internal: constify SwsFunc
From: Niklas Haas I want to move away from having random leaf processing functions mutate plane pointers, and while we're at it, we might as well make the strides and tables const as well. Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas --- libswscale/aarch64/swscale_unscaled.c | 34 ++-- libswscale/alphablend.c | 6 +- libswscale/arm/swscale_unscaled.c | 26 +-- libswscale/bayer_template.c | 4 +- libswscale/loongarch/yuv2rgb_lasx.c | 12 +- libswscale/loongarch/yuv2rgb_lsx.c| 12 +- libswscale/ppc/yuv2rgb_altivec.c | 12 +- libswscale/rgb2rgb.c | 2 +- libswscale/rgb2rgb.h | 4 +- libswscale/rgb2rgb_template.c | 2 +- libswscale/swscale_internal.h | 12 +- libswscale/swscale_unscaled.c | 242 +- libswscale/x86/yuv2rgb.c | 54 +++--- libswscale/yuv2rgb.c | 6 +- 14 files changed, 220 insertions(+), 208 deletions(-) diff --git a/libswscale/aarch64/swscale_unscaled.c b/libswscale/aarch64/swscale_unscaled.c index 9dfccc0fdb..294411a726 100644 --- a/libswscale/aarch64/swscale_unscaled.c +++ b/libswscale/aarch64/swscale_unscaled.c @@ -37,9 +37,10 @@ int ff_##ifmt##_to_##ofmt##_neon(int w, int h, int y_offset, \ int y_coeff); \ \ -static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t *src[], \ - int srcStride[], int srcSliceY, int srcSliceH, \ - uint8_t *dst[], int dstStride[]) { \ +static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t *const src[], \ + const int srcStride[], int srcSliceY,\ + int srcSliceH, uint8_t *const dst[], \ + const int dstStride[]) { \ const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \ \ return ff_##ifmt##_to_##ofmt##_neon(c->srcW, srcSliceH, \ @@ -64,9 +65,10 @@ int ff_##ifmt##_to_##ofmt##_neon(int w, int h, uint8_t *dst1, int linesize1, \ uint8_t *dst2, int linesize2); \ \ -static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t *src[], \ - int srcStride[], int srcSliceY, int srcSliceH, \ - uint8_t *dst[], int dstStride[]) { \ +static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t *const src[], \ + const int srcStride[], int srcSliceY,\ + int srcSliceH, uint8_t *const dst[], \ + const int dstStride[]) { \ const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \ \ return ff_##ifmt##_to_##ofmt##_neon(c->srcW, srcSliceH, \ @@ -100,9 +102,10 @@ int ff_##ifmt##_to_##ofmt##_neon(int w, int h, int y_offset, \ int y_coeff); \ \ -static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t *src[], \ - int srcStride[], int srcSliceY, int srcSliceH, \ - uint8_t *dst[], int dstStride[]) { \ +static int ifmt##_to_##ofmt##_neon_wrapper(SwsContext *c, const uint8_t *const src[], \ + const int srcStride[], int srcSliceY,\ + int srcSliceH, uint8_t *const dst[], \ + const int dstStride[]) { \ const int16_t yuv2rgb_table[] = { YUV_TO_RGB_TABLE }; \
[FFmpeg-devel] [PATCH 06/12] swscale/internal: expose low level swscale() internally
From: Niklas Haas And give it const parameters while we're at it, because this function does not mutate its parameters. Used as an intermediate entry point for the new swscale context. Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas --- libswscale/slice.c| 3 ++- libswscale/swscale.c | 11 +-- libswscale/swscale_internal.h | 8 +++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/libswscale/slice.c b/libswscale/slice.c index 1cc3f6c405..119bfbdb8d 100644 --- a/libswscale/slice.c +++ b/libswscale/slice.c @@ -145,7 +145,8 @@ int ff_rotate_slice(SwsSlice *s, int lum, int chr) return 0; } -int ff_init_slice_from_src(SwsSlice * s, uint8_t *src[4], int stride[4], int srcW, int lumY, int lumH, int chrY, int chrH, int relative) +int ff_init_slice_from_src(SwsSlice * s, uint8_t *const src[4], const int stride[4], + int srcW, int lumY, int lumH, int chrY, int chrH, int relative) { int i = 0; diff --git a/libswscale/swscale.c b/libswscale/swscale.c index b9ec976be0..4ba35a61e1 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -233,10 +233,9 @@ static void lumRangeFromJpeg16_c(int16_t *_dst, int width) if (DEBUG_SWSCALE_BUFFERS) \ av_log(c, AV_LOG_DEBUG, __VA_ARGS__) -static int swscale(SwsContext *c, const uint8_t *src[], - int srcStride[], int srcSliceY, int srcSliceH, - uint8_t *dst[], int dstStride[], - int dstSliceY, int dstSliceH) +int ff_swscale(SwsContext *c, const uint8_t *src[], int srcStride[], + int srcSliceY, int srcSliceH, uint8_t *dst[], + const int dstStride[], int dstSliceY, int dstSliceH) { const int scale_dst = dstSliceY > 0 || dstSliceH < c->dstH; @@ -1053,8 +1052,8 @@ static int scale_internal(SwsContext *c, if (scale_dst) dst2[0] += dstSliceY * dstStride2[0]; } else { -ret = swscale(c, src2, srcStride2, srcSliceY_internal, srcSliceH, - dst2, dstStride2, dstSliceY, dstSliceH); +ret = ff_swscale(c, src2, srcStride2, srcSliceY_internal, srcSliceH, + dst2, dstStride2, dstSliceY, dstSliceH); } if (c->dstXYZ && !(c->srcXYZ && c->srcW==c->dstW && c->srcH==c->dstH)) { diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 17440c99c4..33f9404b34 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -1100,7 +1100,8 @@ typedef struct SwsFilterDescriptor // warp input lines in the form (src + width*i + j) to slice format (line[i][j]) // relative=true means first line src[x][0] otherwise first line is src[x][lum/crh Y] -int ff_init_slice_from_src(SwsSlice * s, uint8_t *src[4], int stride[4], int srcW, int lumY, int lumH, int chrY, int chrH, int relative); +int ff_init_slice_from_src(SwsSlice * s, uint8_t *const src[4], const int stride[4], + int srcW, int lumY, int lumH, int chrY, int chrH, int relative); // Initialize scaler filter descriptor chain int ff_init_filters(SwsContext *c); @@ -1144,6 +1145,11 @@ void ff_init_vscale_pfn(SwsContext *c, yuv2planar1_fn yuv2plane1, yuv2planarX_fn void ff_sws_slice_worker(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads); +int ff_swscale(SwsContext *c, const uint8_t *src[], int srcStride[], + int srcSliceY, int srcSliceH, uint8_t *dst[], + const int dstStride[], int dstSliceY, int dstSliceH); + + //number of extra lines to process #define MAX_LINES_AHEAD 4 -- 2.46.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 08/12] swscale/internal: turn cascaded_tmp into an array
From: Niklas Haas Slightly more convenient to access from the new wrapping code. Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas --- libswscale/swscale.c | 20 ++-- libswscale/swscale_internal.h | 6 ++ libswscale/utils.c| 16 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index e9323efb87..fa7f220f0b 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -842,26 +842,26 @@ static int scale_gamma(SwsContext *c, { int ret = scale_internal(c->cascaded_context[0], srcSlice, srcStride, srcSliceY, srcSliceH, - c->cascaded_tmp, c->cascaded_tmpStride, 0, c->srcH); + c->cascaded_tmp[0], c->cascaded_tmpStride[0], 0, c->srcH); if (ret < 0) return ret; if (c->cascaded_context[2]) -ret = scale_internal(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp, - c->cascaded_tmpStride, srcSliceY, srcSliceH, - c->cascaded1_tmp, c->cascaded1_tmpStride, 0, c->dstH); +ret = scale_internal(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp[0], + c->cascaded_tmpStride[0], srcSliceY, srcSliceH, + c->cascaded_tmp[1], c->cascaded_tmpStride[1], 0, c->dstH); else -ret = scale_internal(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp, - c->cascaded_tmpStride, srcSliceY, srcSliceH, +ret = scale_internal(c->cascaded_context[1], (const uint8_t * const *)c->cascaded_tmp[0], + c->cascaded_tmpStride[0], srcSliceY, srcSliceH, dstSlice, dstStride, dstSliceY, dstSliceH); if (ret < 0) return ret; if (c->cascaded_context[2]) { -ret = scale_internal(c->cascaded_context[2], (const uint8_t * const *)c->cascaded1_tmp, - c->cascaded1_tmpStride, c->cascaded_context[1]->dstY - ret, +ret = scale_internal(c->cascaded_context[2], (const uint8_t * const *)c->cascaded_tmp[1], + c->cascaded_tmpStride[1], c->cascaded_context[1]->dstY - ret, c->cascaded_context[1]->dstY, dstSlice, dstStride, dstSliceY, dstSliceH); } @@ -876,12 +876,12 @@ static int scale_cascaded(SwsContext *c, { int ret = scale_internal(c->cascaded_context[0], srcSlice, srcStride, srcSliceY, srcSliceH, - c->cascaded_tmp, c->cascaded_tmpStride, + c->cascaded_tmp[0], c->cascaded_tmpStride[0], 0, c->cascaded_context[0]->dstH); if (ret < 0) return ret; ret = scale_internal(c->cascaded_context[1], - (const uint8_t * const * )c->cascaded_tmp, c->cascaded_tmpStride, + (const uint8_t * const * )c->cascaded_tmp[0], c->cascaded_tmpStride[0], 0, c->cascaded_context[0]->dstH, dstSlice, dstStride, dstSliceY, dstSliceH); return ret; diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index d2dd3b63bd..07b58bfd0e 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -351,10 +351,8 @@ typedef struct SwsContext { * downscaling factor that needs to be supported in one scaler. */ struct SwsContext *cascaded_context[3]; -int cascaded_tmpStride[4]; -uint8_t *cascaded_tmp[4]; -int cascaded1_tmpStride[4]; -uint8_t *cascaded1_tmp[4]; +int cascaded_tmpStride[2][4]; +uint8_t *cascaded_tmp[2][4]; int cascaded_mainindex; double gamma_value; diff --git a/libswscale/utils.c b/libswscale/utils.c index c3154d82c1..642e34c46c 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -1133,7 +1133,7 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], tmp_height = srcH; } -ret = av_image_alloc(c->cascaded_tmp, c->cascaded_tmpStride, +ret = av_image_alloc(c->cascaded_tmp[0], c->cascaded_tmpStride[0], tmp_width, tmp_height, tmp_format, 64); if (ret < 0) return ret; @@ -1613,7 +1613,7 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter, SwsContext *c2; c->cascaded_context[0] = NULL; -ret = av_image_alloc(c->cascaded_tmp, c->cascaded_tmpStride, +ret = av_image_alloc(c->cascaded_tmp[0], c->cascaded_tmpStride[0], srcW, srcH, tmpFmt, 64); if (ret < 0) return ret; @@ -1651,7 +1651,7 @@ static av_cold int sws_init_single_context(Sws
[FFmpeg-devel] [PATCH 07/12] swscale/internal: expose ff_update_palette() internally
From: Niklas Haas Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas --- libswscale/swscale.c | 4 ++-- libswscale/swscale_internal.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 4ba35a61e1..e9323efb87 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -753,7 +753,7 @@ void ff_rgb48Toxyz12(const SwsContext *c, uint8_t *dst, int dst_stride, } } -static void update_palette(SwsContext *c, const uint32_t *pal) +void ff_update_palette(SwsContext *c, const uint32_t *pal) { for (int i = 0; i < 256; i++) { int r, g, b, y, u, v, a = 0xff; @@ -951,7 +951,7 @@ static int scale_internal(SwsContext *c, memset(c->dither_error[i], 0, sizeof(c->dither_error[0][0]) * (c->dstW+2)); if (usePal(c->srcFormat)) -update_palette(c, (const uint32_t *)srcSlice[1]); +ff_update_palette(c, (const uint32_t *)srcSlice[1]); memcpy(src2, srcSlice, sizeof(src2)); memcpy(dst2, dstSlice, sizeof(dst2)); diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 33f9404b34..d2dd3b63bd 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -694,6 +694,8 @@ void ff_yuv2rgb_init_tables_ppc(SwsContext *c, const int inv_table[4], void ff_updateMMXDitherTables(SwsContext *c, int dstY); +void ff_update_palette(SwsContext *c, const uint32_t *pal); + av_cold void ff_sws_init_range_convert(SwsContext *c); av_cold void ff_sws_init_range_convert_aarch64(SwsContext *c); av_cold void ff_sws_init_range_convert_loongarch(SwsContext *c); -- 2.46.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 05/12] swscale/internal: fix and expose xyz12Torgb48 and rgb48Toxyz12
From: Niklas Haas In the process of refactoring the signature to be more generically useful, this fixes an 11-year-old bug where the functions (incorrectly) did nothing when the stride was negative, since the stride was being used as the loop bounds for x. Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas --- libswscale/swscale.c| 98 +++-- libswscale/swscale_internal.h | 6 ++ tests/ref/fate/filter-pixfmts-vflip | 4 +- 3 files changed, 60 insertions(+), 48 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 8b6a3a84b4..b9ec976be0 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -636,29 +636,31 @@ static int check_image_pointers(const uint8_t * const data[4], enum AVPixelForma return 1; } -static void xyz12Torgb48(struct SwsContext *c, uint16_t *dst, - const uint16_t *src, int stride, int h) +void ff_xyz12Torgb48(const SwsContext *c, uint8_t *dst, int dst_stride, + const uint8_t *src, int src_stride, int w, int h) { -int xp,yp; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat); -for (yp=0; ypflags & AV_PIX_FMT_FLAG_BE) { -x = AV_RB16(src + xp + 0); -y = AV_RB16(src + xp + 1); -z = AV_RB16(src + xp + 2); +x = AV_RB16(src16 + xp + 0); +y = AV_RB16(src16 + xp + 1); +z = AV_RB16(src16 + xp + 2); } else { -x = AV_RL16(src + xp + 0); -y = AV_RL16(src + xp + 1); -z = AV_RL16(src + xp + 2); +x = AV_RL16(src16 + xp + 0); +y = AV_RL16(src16 + xp + 1); +z = AV_RL16(src16 + xp + 2); } -x = c->xyzgamma[x>>4]; -y = c->xyzgamma[y>>4]; -z = c->xyzgamma[z>>4]; +x = c->xyzgamma[x >> 4]; +y = c->xyzgamma[y >> 4]; +z = c->xyzgamma[z >> 4]; // convert from XYZlinear to sRGBlinear r = c->xyz2rgb_matrix[0][0] * x + @@ -678,38 +680,41 @@ static void xyz12Torgb48(struct SwsContext *c, uint16_t *dst, // convert from sRGBlinear to RGB and scale from 12bit to 16bit if (desc->flags & AV_PIX_FMT_FLAG_BE) { -AV_WB16(dst + xp + 0, c->rgbgamma[r] << 4); -AV_WB16(dst + xp + 1, c->rgbgamma[g] << 4); -AV_WB16(dst + xp + 2, c->rgbgamma[b] << 4); +AV_WB16(dst16 + xp + 0, c->rgbgamma[r] << 4); +AV_WB16(dst16 + xp + 1, c->rgbgamma[g] << 4); +AV_WB16(dst16 + xp + 2, c->rgbgamma[b] << 4); } else { -AV_WL16(dst + xp + 0, c->rgbgamma[r] << 4); -AV_WL16(dst + xp + 1, c->rgbgamma[g] << 4); -AV_WL16(dst + xp + 2, c->rgbgamma[b] << 4); +AV_WL16(dst16 + xp + 0, c->rgbgamma[r] << 4); +AV_WL16(dst16 + xp + 1, c->rgbgamma[g] << 4); +AV_WL16(dst16 + xp + 2, c->rgbgamma[b] << 4); } } -src += stride; -dst += stride; + +src += src_stride; +dst += dst_stride; } } -static void rgb48Toxyz12(struct SwsContext *c, uint16_t *dst, - const uint16_t *src, int stride, int h) +void ff_rgb48Toxyz12(const SwsContext *c, uint8_t *dst, int dst_stride, + const uint8_t *src, int src_stride, int w, int h) { -int xp,yp; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->dstFormat); -for (yp=0; ypflags & AV_PIX_FMT_FLAG_BE) { -r = AV_RB16(src + xp + 0); -g = AV_RB16(src + xp + 1); -b = AV_RB16(src + xp + 2); +r = AV_RB16(src16 + xp + 0); +g = AV_RB16(src16 + xp + 1); +b = AV_RB16(src16 + xp + 2); } else { -r = AV_RL16(src + xp + 0); -g = AV_RL16(src + xp + 1); -b = AV_RL16(src + xp + 2); +r = AV_RL16(src16 + xp + 0); +g = AV_RL16(src16 + xp + 1); +b = AV_RL16(src16 + xp + 2); } r = c->rgbgammainv[r>>4]; @@ -734,17 +739,18 @@ static void rgb48Toxyz12(struct SwsContext *c, uint16_t *dst, // convert from XYZlinear to X'Y'Z' and scale from 12bit to 16bit if (desc->flags & AV_PIX_FMT_FLAG_BE) { -AV_WB16(dst + xp + 0, c->xyzgammainv[x] << 4); -AV_WB16(dst + xp + 1, c->xyzgammainv[y] << 4); -AV_WB16(dst + xp + 2, c->xyzgammainv[z] << 4); +AV_WB16(dst16 + xp + 0, c->xyzgammainv[x] << 4); +AV_WB16(dst16 + xp + 1, c->xyzgammainv[y] << 4); +AV_WB16(dst16 + xp + 2, c->xyzgammainv[z] << 4); } else { -AV_WL16(dst + xp + 0, c->xyzgammainv[x] << 4); -
[FFmpeg-devel] [PATCH 03/12] swscale/internal: rename NB_SWS_DITHER for consistency
From: Niklas Haas Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas --- libswscale/options.c | 2 +- libswscale/swscale_internal.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libswscale/options.c b/libswscale/options.c index 53c4f0651b..6337a9f28d 100644 --- a/libswscale/options.c +++ b/libswscale/options.c @@ -67,7 +67,7 @@ static const AVOption swscale_options[] = { { "dst_v_chr_pos", "destination vertical chroma position in luma grid/256" , OFFSET(dst_v_chr_pos), AV_OPT_TYPE_INT, { .i64 = -513 }, -513, 1024, VE }, { "dst_h_chr_pos", "destination horizontal chroma position in luma grid/256", OFFSET(dst_h_chr_pos), AV_OPT_TYPE_INT, { .i64 = -513 }, -513, 1024, VE }, -{ "sws_dither", "set dithering algorithm", OFFSET(dither), AV_OPT_TYPE_INT,{ .i64 = SWS_DITHER_AUTO}, 0, NB_SWS_DITHER, VE, .unit = "sws_dither" }, +{ "sws_dither", "set dithering algorithm", OFFSET(dither), AV_OPT_TYPE_INT,{ .i64 = SWS_DITHER_AUTO}, 0, SWS_DITHER_NB, VE, .unit = "sws_dither" }, { "auto","leave choice to sws", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_DITHER_AUTO}, INT_MIN, INT_MAX, VE, .unit = "sws_dither" }, { "bayer", "bayer dither", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_DITHER_BAYER }, INT_MIN, INT_MAX, VE, .unit = "sws_dither" }, { "ed", "error diffusion", 0, AV_OPT_TYPE_CONST, { .i64 = SWS_DITHER_ED }, INT_MIN, INT_MAX, VE, .unit = "sws_dither" }, diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 50127d288f..57e7515582 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -73,7 +73,7 @@ typedef enum SwsDither { SWS_DITHER_ED, SWS_DITHER_A_DITHER, SWS_DITHER_X_DITHER, -NB_SWS_DITHER, +SWS_DITHER_NB, } SwsDither; typedef enum SwsAlphaBlend { -- 2.46.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 04/12] swscale/internal: swap SWS_DITHER_NONE and SWS_DITHER_AUTO
From: Niklas Haas This is done for consistency with the other public enums which will be added in the upcoming swscale API refactor. I went through the code and checked carefully that the value of `dither` is never implicitly compared against zero, so this change should not break anything. Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas --- libswscale/swscale_internal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 57e7515582..963879cf9a 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -67,8 +67,8 @@ struct SwsContext; typedef enum SwsDither { -SWS_DITHER_NONE = 0, -SWS_DITHER_AUTO, +SWS_DITHER_AUTO = 0, +SWS_DITHER_NONE, SWS_DITHER_BAYER, SWS_DITHER_ED, SWS_DITHER_A_DITHER, -- 2.46.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 12/12] swscale/input: parametrize ff_sws_init_input_funcs() pointers
From: Niklas Haas Following the precedent set by ff_sws_init_output_funcs(). Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas --- libswscale/input.c| 388 +- libswscale/swscale.c | 3 +- libswscale/swscale_internal.h | 8 +- 3 files changed, 206 insertions(+), 193 deletions(-) diff --git a/libswscale/input.c b/libswscale/input.c index d171394bb2..2a7a6c91dd 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -1285,86 +1285,92 @@ static void rgbaf16##endian_name##ToA_c(uint8_t *_dst, const uint8_t *_src, cons rgbaf16_funcs_endian(le, 0) rgbaf16_funcs_endian(be, 1) -av_cold void ff_sws_init_input_funcs(SwsContext *c) +av_cold void ff_sws_init_input_funcs(SwsContext *c, + planar1_YV12_fn *lumToYV12, + planar1_YV12_fn *alpToYV12, + planar2_YV12_fn *chrToYV12, + planarX_YV12_fn *readLumPlanar, + planarX_YV12_fn *readAlpPlanar, + planarX2_YV12_fn *readChrPlanar) { enum AVPixelFormat srcFormat = c->srcFormat; -c->chrToYV12 = NULL; +*chrToYV12 = NULL; switch (srcFormat) { case AV_PIX_FMT_YUYV422: -c->chrToYV12 = yuy2ToUV_c; +*chrToYV12 = yuy2ToUV_c; break; case AV_PIX_FMT_YVYU422: -c->chrToYV12 = yvy2ToUV_c; +*chrToYV12 = yvy2ToUV_c; break; case AV_PIX_FMT_UYVY422: -c->chrToYV12 = uyvyToUV_c; +*chrToYV12 = uyvyToUV_c; break; case AV_PIX_FMT_NV12: case AV_PIX_FMT_NV16: case AV_PIX_FMT_NV24: -c->chrToYV12 = nv12ToUV_c; +*chrToYV12 = nv12ToUV_c; break; case AV_PIX_FMT_NV21: case AV_PIX_FMT_NV42: -c->chrToYV12 = nv21ToUV_c; +*chrToYV12 = nv21ToUV_c; break; case AV_PIX_FMT_RGB8: case AV_PIX_FMT_BGR8: case AV_PIX_FMT_PAL8: case AV_PIX_FMT_BGR4_BYTE: case AV_PIX_FMT_RGB4_BYTE: -c->chrToYV12 = palToUV_c; +*chrToYV12 = palToUV_c; break; case AV_PIX_FMT_GBRP9LE: -c->readChrPlanar = planar_rgb9le_to_uv; +*readChrPlanar = planar_rgb9le_to_uv; break; case AV_PIX_FMT_GBRAP10LE: case AV_PIX_FMT_GBRP10LE: -c->readChrPlanar = planar_rgb10le_to_uv; +*readChrPlanar = planar_rgb10le_to_uv; break; case AV_PIX_FMT_GBRAP12LE: case AV_PIX_FMT_GBRP12LE: -c->readChrPlanar = planar_rgb12le_to_uv; +*readChrPlanar = planar_rgb12le_to_uv; break; case AV_PIX_FMT_GBRAP14LE: case AV_PIX_FMT_GBRP14LE: -c->readChrPlanar = planar_rgb14le_to_uv; +*readChrPlanar = planar_rgb14le_to_uv; break; case AV_PIX_FMT_GBRAP16LE: case AV_PIX_FMT_GBRP16LE: -c->readChrPlanar = planar_rgb16le_to_uv; +*readChrPlanar = planar_rgb16le_to_uv; break; case AV_PIX_FMT_GBRAPF32LE: case AV_PIX_FMT_GBRPF32LE: -c->readChrPlanar = planar_rgbf32le_to_uv; +*readChrPlanar = planar_rgbf32le_to_uv; break; case AV_PIX_FMT_GBRP9BE: -c->readChrPlanar = planar_rgb9be_to_uv; +*readChrPlanar = planar_rgb9be_to_uv; break; case AV_PIX_FMT_GBRAP10BE: case AV_PIX_FMT_GBRP10BE: -c->readChrPlanar = planar_rgb10be_to_uv; +*readChrPlanar = planar_rgb10be_to_uv; break; case AV_PIX_FMT_GBRAP12BE: case AV_PIX_FMT_GBRP12BE: -c->readChrPlanar = planar_rgb12be_to_uv; +*readChrPlanar = planar_rgb12be_to_uv; break; case AV_PIX_FMT_GBRAP14BE: case AV_PIX_FMT_GBRP14BE: -c->readChrPlanar = planar_rgb14be_to_uv; +*readChrPlanar = planar_rgb14be_to_uv; break; case AV_PIX_FMT_GBRAP16BE: case AV_PIX_FMT_GBRP16BE: -c->readChrPlanar = planar_rgb16be_to_uv; +*readChrPlanar = planar_rgb16be_to_uv; break; case AV_PIX_FMT_GBRAPF32BE: case AV_PIX_FMT_GBRPF32BE: -c->readChrPlanar = planar_rgbf32be_to_uv; +*readChrPlanar = planar_rgbf32be_to_uv; break; case AV_PIX_FMT_GBRAP: case AV_PIX_FMT_GBRP: -c->readChrPlanar = planar_rgb_to_uv; +*readChrPlanar = planar_rgb_to_uv; break; #if HAVE_BIGENDIAN case AV_PIX_FMT_YUV420P9LE: @@ -1396,7 +1402,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_YUVA420P16LE: case AV_PIX_FMT_YUVA422P16LE: case AV_PIX_FMT_YUVA444P16LE: -c->chrToYV12 = bswap16UV_c; +*chrToYV12 = bswap16UV_c; break; #else case AV_PIX_FMT_YUV420P9BE: @@ -1428,314 +1434,314 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_YUVA420P16BE: case AV_PIX_FMT_YUVA422P16BE: case AV_PIX_FMT_YUVA444P16BE: -c->chrToYV12 = bswap16UV_c; +
[FFmpeg-devel] [PATCH 11/12] swscale/internal: add typedefs for input reading functions
From: Niklas Haas Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas --- libswscale/swscale_internal.h | 47 +++ 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 0e9d37b5b0..e87b073d57 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -292,6 +292,31 @@ typedef void (*yuv2anyX_fn)(struct SwsContext *c, const int16_t *lumFilter, const int16_t **alpSrc, uint8_t **dest, int dstW, int y); +/** + * Unscaled conversion of luma/alpha plane to YV12 for horizontal scaler. + */ +typedef void (*planar1_YV12_fn)(uint8_t *dst, const uint8_t *src, const uint8_t *src2, +const uint8_t *src3, int width, uint32_t *pal, +void *opaque); + +/** + * Unscaled conversion of chroma plane to YV12 for horizontal scaler. + */ +typedef void (*planar2_YV12_fn)(uint8_t *dst, uint8_t *dst2, const uint8_t *src, +const uint8_t *src2, const uint8_t *src3, +int width, uint32_t *pal, void *opaque); + +/** + * Unscaled conversion of arbitrary planar data (e.g. RGBA) to YV12, through + * conversion using the given color matrix. + */ +typedef void (*planarX_YV12_fn)(uint8_t *dst, const uint8_t *src[4], int width, +int32_t *rgb2yuv, void *opaque); + +typedef void (*planarX2_YV12_fn)(uint8_t *dst, uint8_t *dst2, + const uint8_t *src[4], int width, + int32_t *rgb2yuv, void *opaque); + struct SwsSlice; struct SwsFilterDescriptor; @@ -561,28 +586,18 @@ struct SwsContext { /// Opaque data pointer passed to all input functions. void *input_opaque; -/// Unscaled conversion of luma plane to YV12 for horizontal scaler. -void (*lumToYV12)(uint8_t *dst, const uint8_t *src, const uint8_t *src2, const uint8_t *src3, - int width, uint32_t *pal, void *opq); -/// Unscaled conversion of alpha plane to YV12 for horizontal scaler. -void (*alpToYV12)(uint8_t *dst, const uint8_t *src, const uint8_t *src2, const uint8_t *src3, - int width, uint32_t *pal, void *opq); -/// Unscaled conversion of chroma planes to YV12 for horizontal scaler. -void (*chrToYV12)(uint8_t *dstU, uint8_t *dstV, - const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, - int width, uint32_t *pal, void *opq); +planar1_YV12_fn lumToYV12; +planar1_YV12_fn alpToYV12; +planar2_YV12_fn chrToYV12; /** * Functions to read planar input, such as planar RGB, and convert * internally to Y/UV/A. */ /** @{ */ -void (*readLumPlanar)(uint8_t *dst, const uint8_t *src[4], int width, int32_t *rgb2yuv, - void *opq); -void (*readChrPlanar)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src[4], - int width, int32_t *rgb2yuv, void *opq); -void (*readAlpPlanar)(uint8_t *dst, const uint8_t *src[4], int width, int32_t *rgb2yuv, - void *opq); +planarX_YV12_fn readLumPlanar; +planarX_YV12_fn readAlpPlanar; +planarX2_YV12_fn readChrPlanar; /** @} */ /** -- 2.46.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 10/12] swscale/internal: forward typedef SwsContext
From: Niklas Haas Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas --- libswscale/swscale_internal.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 7b7dfafac1..0e9d37b5b0 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -64,7 +64,7 @@ #define RETCODE_USE_CASCADE -12345 -struct SwsContext; +typedef struct SwsContext SwsContext; typedef enum SwsDither { SWS_DITHER_AUTO = 0, @@ -96,7 +96,7 @@ typedef struct RangeList { int ff_range_add(RangeList *r, unsigned int start, unsigned int len); -typedef int (*SwsFunc)(struct SwsContext *c, const uint8_t *const src[], +typedef int (*SwsFunc)(SwsContext *c, const uint8_t *const src[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[]); @@ -296,7 +296,7 @@ struct SwsSlice; struct SwsFilterDescriptor; /* This struct should be aligned on at least a 32-byte boundary. */ -typedef struct SwsContext { +struct SwsContext { /** * info on struct for av_log */ @@ -680,7 +680,7 @@ typedef struct SwsContext { atomic_int data_unaligned_warned; Half2FloatTables *h2f_tables; -} SwsContext; +}; //FIXME check init (where 0) SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c); -- 2.46.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avcodec/hevc/ps: add a range check for sps_max_sub_layers
It can't be higher than vps_max_sub_layers. Signed-off-by: James Almer --- libavcodec/hevc/ps.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libavcodec/hevc/ps.c b/libavcodec/hevc/ps.c index 993c60144f..bd01f63956 100644 --- a/libavcodec/hevc/ps.c +++ b/libavcodec/hevc/ps.c @@ -1172,17 +1172,16 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, } sps->vps = ff_refstruct_ref_c(vps_list[sps->vps_id]); } +if (!sps->vps) +return AVERROR(EINVAL); sps->max_sub_layers = get_bits(gb, 3) + 1; multi_layer_ext = nuh_layer_id > 0 && sps->max_sub_layers == HEVC_MAX_SUB_LAYERS + 1; -if (multi_layer_ext) { -if (!sps->vps) -return AVERROR(EINVAL); - +if (multi_layer_ext) sps->max_sub_layers = sps->vps->vps_max_sub_layers; -} -if (sps->max_sub_layers > HEVC_MAX_SUB_LAYERS) { + +if (sps->max_sub_layers > sps->vps->vps_max_sub_layers) { av_log(avctx, AV_LOG_ERROR, "sps_max_sub_layers out of range: %d\n", sps->max_sub_layers); return AVERROR_INVALIDDATA; -- 2.46.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec/libx265: unbreak build for X265_BUILD >= 213
On 2024-10-05 06:21 pm, James Almer wrote: On 10/5/2024 1:44 AM, Gyan Doshi wrote: Earlier, x265 made an API change to support alpha and other multiple layer pictures. We added guards to accommodate that in 1f801dfdb5 They have now reverted that API change in https://bitbucket.org/multicoreware/x265_git/commits/78e5b703b1 And they did it after they tagged a release... Updated our wrapper guards to unbreak build again. --- libavcodec/libx265.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index 513f473307..63cc497f83 100644 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@ -661,7 +661,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, { libx265Context *ctx = avctx->priv_data; x265_picture x265pic; -#if X265_BUILD >= 210 +#if (X265_BUILD >= 210) && (X265_BUILD < 213) x265_picture x265pic_layers_out[MAX_SCALABLE_LAYERS]; x265_picture* x265pic_lyrptr_out[MAX_SCALABLE_LAYERS]; #else @@ -805,7 +805,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, #endif } -#if X265_BUILD >= 210 +#if (X265_BUILD >= 210) && (X265_BUILD < 213) for (i = 0; i < MAX_SCALABLE_LAYERS; i++) x265pic_lyrptr_out[i] = &x265pic_layers_out[i]; @@ -844,7 +844,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, pkt->flags |= AV_PKT_FLAG_KEY; } -#if X265_BUILD >= 210 +#if (X265_BUILD >= 210) && (X265_BUILD < 213) x265pic_out = x265pic_lyrptr_out[0]; #else x265pic_out = &x265pic_solo_out; Ok. Please backport to release/7.1 too. Thanks. Pushed to master and 7.1 as 099f88b8641dfc299f3896d17d9addc5b9ae7799 63f5c007a7da69248f664c988398204c21eac7cf Regards, Gyan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] update release number
Shouldn't the number in RELEASE reflect the present release version? Martin --- RELEASE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASE b/RELEASE index 72ec89d..9fa1d2c 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -7.0.git +7.1.git -- 2.45.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] RFC - Uncompressed MP4
Martin, thanks again, I find your comments very helpful. I will do some more research to determine what the best CLI arguments would be. On Fri, Oct 4, 2024 at 7:55 PM martin schitter wrote: > > > On 04.10.24 18:10, Devon Sookhoo wrote: > > I thought the option "-c:v rawvideo" was the way to go because it's > used > > to generate an uncompressed avi file: > > $ ffmpeg -i input.mp4 -c:v rawvideo out.avi > > For the older simpler file formats, where only a rather small set of > supported image format configurations were available, this kind of > handling may indeed have worked sufficient. But even under this rather > limited circumstances, you always had to take care of the actually used > pixel format and very often set/correct/enforce it explicitly. > > In principle you could adapt such a combination of -c:v rawvideo and > -pix_fmt for this kind of mp4 content as well, but I doubt that it will > work satisfactorily in practice. The range of possible configuration > variants is huge and not all of them correspond in a strict one-to-one > relation already defined ffmpeg pixel formats. > > A more format specific video codec specifier (= -c:v ...) and suitable > options for all the format specific export configuration parameters > looks much more useful to me -- but I may be wrong. > > martin > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec/libx265: unbreak build for X265_BUILD >= 213
On 10/5/2024 1:44 AM, Gyan Doshi wrote: Earlier, x265 made an API change to support alpha and other multiple layer pictures. We added guards to accommodate that in 1f801dfdb5 They have now reverted that API change in https://bitbucket.org/multicoreware/x265_git/commits/78e5b703b1 And they did it after they tagged a release... Updated our wrapper guards to unbreak build again. --- libavcodec/libx265.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index 513f473307..63cc497f83 100644 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@ -661,7 +661,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, { libx265Context *ctx = avctx->priv_data; x265_picture x265pic; -#if X265_BUILD >= 210 +#if (X265_BUILD >= 210) && (X265_BUILD < 213) x265_picture x265pic_layers_out[MAX_SCALABLE_LAYERS]; x265_picture* x265pic_lyrptr_out[MAX_SCALABLE_LAYERS]; #else @@ -805,7 +805,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, #endif } -#if X265_BUILD >= 210 +#if (X265_BUILD >= 210) && (X265_BUILD < 213) for (i = 0; i < MAX_SCALABLE_LAYERS; i++) x265pic_lyrptr_out[i] = &x265pic_layers_out[i]; @@ -844,7 +844,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt, pkt->flags |= AV_PKT_FLAG_KEY; } -#if X265_BUILD >= 210 +#if (X265_BUILD >= 210) && (X265_BUILD < 213) x265pic_out = x265pic_lyrptr_out[0]; #else x265pic_out = &x265pic_solo_out; Ok. Please backport to release/7.1 too. OpenPGP_signature.asc Description: OpenPGP digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] lavu/common: Fix AV_CEIL_RSHIFT for unsigned LHS
The first branch of this ternary expression was intended to avoid having two shift operations in the case the RHS is not known at compile time. It only works if the LHS has a signed type however, otherwise the result is invalid. We could alternatively have different versions of AV_CEIL_RSHIFT for different sizes of operand, then cast the LHS to the relevant signed type. Signed-off-by: Frank Plowman --- libavutil/common.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavutil/common.h b/libavutil/common.h index 3b830daf30..ec38752b64 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -57,8 +57,7 @@ /* assume b>0 */ #define ROUNDED_DIV(a,b) (((a)>=0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) /* Fast a/(1<=0 and b>=0 */ -#define AV_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \ - : ((a) + (1<<(b)) - 1) >> (b)) +#define AV_CEIL_RSHIFT(a,b) (((a) + (1<<(b)) - 1) >> (b)) /* Backwards compat. */ #define FF_CEIL_RSHIFT AV_CEIL_RSHIFT -- 2.46.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] lavc/vvc: Validate subpartitioning structure
H.266 (V3) section 6.3.3 dictates that the division of the picture into subpictures must be exhaustive and mutually exclusive, i.e. that each CTU "belongs to" one and only one subpicture. In most cases this is guaranteed by the syntax, but in the case sps_subpic_same_size_flag=0, we must check this is true ourselves. Signed-off-by: Frank Plowman --- libavcodec/cbs_h266_syntax_template.c | 46 +-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index b4165b43b3..822ee26f46 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -1191,7 +1191,7 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw, win_left_edge_ctus > current->sps_subpic_ctu_top_left_x[i] ? win_left_edge_ctus - current->sps_subpic_ctu_top_left_x[i] : 0, - MAX_UINT_BITS(wlen), 1, i); + tmp_width_val - current->sps_subpic_ctu_top_left_x[i] - 1, 1, i); } else { infer(sps_subpic_width_minus1[i], tmp_width_val - @@ -1208,7 +1208,7 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw, win_top_edge_ctus > current->sps_subpic_ctu_top_left_y[i] ? win_top_edge_ctus - current->sps_subpic_ctu_top_left_y[i] : 0, - MAX_UINT_BITS(hlen), 1, i); + tmp_height_val - current->sps_subpic_ctu_top_left_y[i] - 1, 1, i); } else { infer(sps_subpic_height_minus1[i], tmp_height_val - @@ -1242,6 +1242,48 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw, infer(sps_loop_filter_across_subpic_enabled_flag[i], 0); } } +// If the subpic partitioning structure is signalled explicitly, +// validate it constitutes an exhaustive and mutually exclusive +// coverage of the picture, per 6.3.3. If the partitioning is not +// provided explicitly, then it is ensured by the syntax and we need +// not check. +if (!current->sps_subpic_same_size_flag) { +char *ctu_in_subpic = av_mallocz(tmp_width_val * tmp_height_val); +if (!ctu_in_subpic) +return AVERROR(ENOMEM); +for (i = 0; i <= current->sps_num_subpics_minus1; i++) { +const unsigned x0 = current->sps_subpic_ctu_top_left_x[i]; +const unsigned y0 = current->sps_subpic_ctu_top_left_y[i]; +const unsigned w = current->sps_subpic_width_minus1[i] + 1; +const unsigned h = current->sps_subpic_height_minus1[i] + 1; +av_assert0(x0 + w - 1 < tmp_width_val); +av_assert0(y0 + h - 1 < tmp_height_val); +for (unsigned x = x0; x < x0 + w; x++) { +for (unsigned y = y0; y < y0 + h; y++) { +const unsigned idx = y * tmp_width_val + x; +if (ctu_in_subpic[idx]) { +av_log(ctx->log_ctx, AV_LOG_ERROR, + "Subpictures overlap.\n"); +av_freep(&ctu_in_subpic); +return AVERROR_INVALIDDATA; +} +ctu_in_subpic[idx] = 1; +} +} +} +for (unsigned x = 0; x < tmp_width_val; x++) { +for (unsigned y = 0; y < tmp_height_val; y++) { +const unsigned idx = y * tmp_width_val + x; +if (!ctu_in_subpic[idx]) { +av_log(ctx->log_ctx, AV_LOG_ERROR, + "Subpictures do not cover the entire picture.\n"); +av_freep(&ctu_in_subpic); +return AVERROR_INVALIDDATA; +} +} +} +av_freep(&ctu_in_subpic); +} } else { infer(sps_subpic_ctu_top_left_x[0], 0); infer(sps_subpic_ctu_top_left_y[0], 0); -- 2.46.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2] aacenc_pred: prevent UB in ff_aac_adjust_common_pred()
Hi On Sat, Oct 5, 2024, 19:15 Lynne via ffmpeg-devel wrote: > On 05/10/2024 20:58, Sean McGovern wrote: > > --- > > libavcodec/aacenc_pred.c | 6 ++ > > 1 file changed, 2 insertions(+), 4 deletions(-) > > > > diff --git a/libavcodec/aacenc_pred.c b/libavcodec/aacenc_pred.c > > index a486c44d42..a6dfaa25fb 100644 > > --- a/libavcodec/aacenc_pred.c > > +++ b/libavcodec/aacenc_pred.c > > @@ -153,9 +153,7 @@ void ff_aac_adjust_common_pred(AACEncContext *s, > ChannelElement *cpe) > > int start, w, w2, g, i, count = 0; > > SingleChannelElement *sce0 = &cpe->ch[0]; > > SingleChannelElement *sce1 = &cpe->ch[1]; > > -const int pmax0 = FFMIN(sce0->ics.max_sfb, > ff_aac_pred_sfb_max[s->samplerate_index]); > > -const int pmax1 = FFMIN(sce1->ics.max_sfb, > ff_aac_pred_sfb_max[s->samplerate_index]); > > -const int pmax = FFMIN(pmax0, pmax1); > > +const int pmax = FFMIN(sce1->ics.max_sfb, > ff_aac_pred_sfb_max[s->samplerate_index]); > > > > if (!cpe->common_window || > > sce0->ics.window_sequence[0] == EIGHT_SHORT_SEQUENCE || > > @@ -164,7 +162,7 @@ void ff_aac_adjust_common_pred(AACEncContext *s, > ChannelElement *cpe) > > > > for (w = 0; w < sce0->ics.num_windows; w += > sce0->ics.group_len[w]) { > > start = 0; > > -for (g = 0; g < sce0->ics.num_swb; g++) { > > +for (g = 0; g < pmax; g++) { > > int sfb = w*16+g; > > int sum = sce0->ics.prediction_used[sfb] + > sce1->ics.prediction_used[sfb]; > > float ener0 = 0.0f, ener1 = 0.0f, ener01 = 0.0f; > > I'm not sure I see the UB here? > It corrects the issue noted by both the x86_64 and PPC64 UBsan FATE nodes. ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/5] configure: drop yasm support
On 03/10/2024 15:40, Lynne wrote: We started defauling to nasm 8 years ago. We are still compatible with yasm 0.8.0, released in 2009. **15 years ago**. The time has more than come to remove support for it. Maintaining compatibility started cutting into writing new code long ago. We still can't have 2-argument instructions, preprocessor booleans, and all AVX2 code must still be wrapped in ifdefs. Newly added code often breaks this. --- Changelog| 1 + configure| 20 ++-- doc/developer.texi | 2 +- doc/optimization.txt | 4 ++-- doc/platform.texi| 4 ++-- 5 files changed, 8 insertions(+), 23 deletions(-) diff --git a/Changelog b/Changelog index b82b948074..7963e093dd 100644 --- a/Changelog +++ b/Changelog @@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest within each release, releases are sorted from youngest to oldest. version : +- yasm support dropped, users need to use nasm version 7.1: - Raw Captions with Time (RCWT) closed caption demuxer diff --git a/configure b/configure index 0247ea08d6..79ce2ba083 100755 --- a/configure +++ b/configure @@ -4415,16 +4415,6 @@ for opt do test $action = enable && warn_if_gets_disabled $list $action $list ;; ---enable-yasm|--disable-yasm) -warn "The ${opt} option is only provided for compatibility and will be\n"\ - "removed in the future. Use --enable-x86asm / --disable-x86asm instead." -test $opt = --enable-yasm && x86asm=yes || x86asm=no -;; ---yasmexe=*) -warn "The --yasmexe option is only provided for compatibility and will be\n"\ - "removed in the future. Use --x86asmexe instead." -x86asmexe="$optval" -;; --enable-?*|--disable-?*) eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g') if is_in $option $COMPONENT_LIST; then @@ -6449,22 +6439,16 @@ EOF x86asm_debug="-g -F dwarf" X86ASMDEP= X86ASM_DEPFLAGS='-MD $(@:.o=.d)' -elif test_cmd $x86asmexe_probe --version; then -x86asmexe=$x86asmexe_probe -x86asm_type=yasm -x86asm_debug="-g dwarf2" -X86ASMDEP='$(DEPX86ASM) $(X86ASMFLAGS) -M $(X86ASM_O) $< > $(@:.o=.d)' -X86ASM_DEPFLAGS= fi check_x86asm x86asm "movbe ecx, [5]" } if ! disabled_any asm mmx x86asm; then disable x86asm -for program in $x86asmexe nasm yasm; do +for program in $x86asmexe nasm; do probe_x86asm $program && break done -disabled x86asm && die "nasm/yasm not found or too old. Use --disable-x86asm for a crippled build." +disabled x86asm && die "nasm not found or too old. Use --disable-x86asm for a crippled build." X86ASMFLAGS="-f $objformat" test -n "$extern_prefix" && append X86ASMFLAGS "-DPREFIX" case "$objformat" in diff --git a/doc/developer.texi b/doc/developer.texi index 41b21938ef..16e8f9d6e4 100644 --- a/doc/developer.texi +++ b/doc/developer.texi @@ -825,7 +825,7 @@ filters, bitstream filters, parsers. If its not possible to do that, add an explanation why to your patchset, its ok to not test if theres a reason. @item -If you added YASM code please check that things still work with --disable-yasm. +If you added NASM code please check that things still work with --disable-nasm. @item Test your code with valgrind and or Address Sanitizer to ensure it's free diff --git a/doc/optimization.txt b/doc/optimization.txt index 3ed29fe38c..40480e4fa9 100644 --- a/doc/optimization.txt +++ b/doc/optimization.txt @@ -188,7 +188,7 @@ Code that depends on data in registries being untouched, should be written as a single __asm__() statement. Ideally, a single function contains only one __asm__() block. -Use external asm (nasm/yasm) or inline asm (__asm__()), do not use intrinsics. +Use external asm (nasm) or inline asm (__asm__()), do not use intrinsics. The latter requires a good optimizing compiler which gcc is not. When debugging a x86 external asm compilation issue, if lost in the macro @@ -199,7 +199,7 @@ actual lines causing issues. Inline asm vs. external asm --- Both inline asm (__asm__("..") in a .c file, handled by a compiler such as gcc) -and external asm (.s or .asm files, handled by an assembler such as nasm/yasm) +and external asm (.s or .asm files, handled by an assembler such as nasm) are accepted in FFmpeg. Which one to use differs per specific case. - if your code is intended to be inlined in a C function, inline asm is always diff --git a/doc/platform.texi b/doc/platform.texi index 764911d230..d9ee436a9f 100644 --- a/doc/platform.texi +++ b/doc/platform.texi @@ -158,7 +158,7 @@ You will need the following prerequisites: To set up a