[FFmpeg-cvslog] avcodec/jpeg2000htdec: Check magp before using it in a shift
ffmpeg | branch: release/7.0 | Michael Niedermayer | Wed Mar 20 03:27:13 2024 +0100| [cc9d291fb00369b5692bd9afe94ca19d35643c22] | committer: Michael Niedermayer avcodec/jpeg2000htdec: Check magp before using it in a shift Fixes: shift exponent -1 is negative Fixes: 65378/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_fuzzer-5457678193197056 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 19ad05e9e0f045b13de8de7300ca3bd34ea8ca53) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cc9d291fb00369b5692bd9afe94ca19d35643c22 --- libavcodec/jpeg2000dec.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index 1afc6b1e2d..4d28be3656 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -1885,7 +1885,7 @@ static inline void roi_scale_cblk(Jpeg2000Cblk *cblk, } } -static inline void tile_codeblocks(const Jpeg2000DecoderContext *s, Jpeg2000Tile *tile) +static inline int tile_codeblocks(const Jpeg2000DecoderContext *s, Jpeg2000Tile *tile) { Jpeg2000T1Context t1; @@ -1910,6 +1910,8 @@ static inline void tile_codeblocks(const Jpeg2000DecoderContext *s, Jpeg2000Tile int nb_precincts, precno; Jpeg2000Band *band = rlevel->band + bandno; int cblkno = 0, bandpos; +/* See Rec. ITU-T T.800, Equation E-2 */ +int magp = quantsty->expn[subbandno] + quantsty->nguardbits - 1; bandpos = bandno + (reslevelno > 0); @@ -1917,6 +1919,11 @@ static inline void tile_codeblocks(const Jpeg2000DecoderContext *s, Jpeg2000Tile band->coord[1][0] == band->coord[1][1]) continue; +if ((codsty->cblk_style & JPEG2000_CTSY_HTJ2K_F) && magp >= 31) { +avpriv_request_sample(s->avctx, "JPEG2000_CTSY_HTJ2K_F and magp >= 31"); +return AVERROR_PATCHWELCOME; +} + nb_precincts = rlevel->num_precincts_x * rlevel->num_precincts_y; /* Loop on precincts */ for (precno = 0; precno < nb_precincts; precno++) { @@ -1927,8 +1934,6 @@ static inline void tile_codeblocks(const Jpeg2000DecoderContext *s, Jpeg2000Tile cblkno < prec->nb_codeblocks_width * prec->nb_codeblocks_height; cblkno++) { int x, y, ret; -/* See Rec. ITU-T T.800, Equation E-2 */ -int magp = quantsty->expn[subbandno] + quantsty->nguardbits - 1; Jpeg2000Cblk *cblk = prec->cblk + cblkno; @@ -1968,6 +1973,7 @@ static inline void tile_codeblocks(const Jpeg2000DecoderContext *s, Jpeg2000Tile ff_dwt_decode(&comp->dwt, codsty->transform == FF_DWT97 ? (void*)comp->f_data : (void*)comp->i_data); } /*end comp */ +return 0; } #define WRITE_FRAME(D, PIXEL) \ @@ -2044,7 +2050,9 @@ static int jpeg2000_decode_tile(AVCodecContext *avctx, void *td, AVFrame *picture = td; Jpeg2000Tile *tile = s->tile + jobnr; -tile_codeblocks(s, tile); +int ret = tile_codeblocks(s, tile); +if (ret < 0) +return ret; /* inverse MCT transformation */ if (tile->codsty[0].mct) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/jpeg2000htdec: warn about non zero roi shift
ffmpeg | branch: release/7.0 | Michael Niedermayer | Fri Mar 29 02:51:29 2024 +0100| [7e899776ec6dc1bed09e623f405029b65113b4db] | committer: Michael Niedermayer avcodec/jpeg2000htdec: warn about non zero roi shift Suggested-by: Tomas Härdin Signed-off-by: Michael Niedermayer (cherry picked from commit 7b7eea8e63f761a0d0611d15c24170e40c62402c) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7e899776ec6dc1bed09e623f405029b65113b4db --- libavcodec/jpeg2000htdec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/jpeg2000htdec.c b/libavcodec/jpeg2000htdec.c index 6b9898d3ff..4f0b10b429 100644 --- a/libavcodec/jpeg2000htdec.c +++ b/libavcodec/jpeg2000htdec.c @@ -1198,6 +1198,9 @@ ff_jpeg2000_decode_htj2k(const Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c av_assert0(width * height <= 4096); av_assert0(width * height > 0); +if (roi_shift) +avpriv_report_missing_feature(s->avctx, "ROI shift"); + memset(t1->data, 0, t1->stride * height * sizeof(*t1->data)); memset(t1->flags, 0, t1->stride * (height + 2) * sizeof(*t1->flags)); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/mxfdec: Check first case of offset_temp computation for overflow
ffmpeg | branch: release/7.0 | Michael Niedermayer | Fri Mar 29 03:35:18 2024 +0100| [1a9da17c5ac3350636749617b6f763ed2c5732fe] | committer: Michael Niedermayer avformat/mxfdec: Check first case of offset_temp computation for overflow This is kind of ugly Fixes: signed integer overflow: 255 * 1157565362826411919 cannot be represented in type 'long' Fixes: 67313/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-6250434245230592 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit d6ed6f6e8dffcf777c336869f56002da588e2de8) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1a9da17c5ac3350636749617b6f763ed2c5732fe --- libavformat/mxfdec.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index c9af462855..51a7136555 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -1891,9 +1891,13 @@ static int mxf_edit_unit_absolute_offset(MXFContext *mxf, MXFIndexTable *index_t if (edit_unit < s->index_start_position + s->index_duration) { int64_t index = edit_unit - s->index_start_position; -if (s->edit_unit_byte_count) +if (s->edit_unit_byte_count) { +if (index > INT64_MAX / s->edit_unit_byte_count || +s->edit_unit_byte_count * index > INT64_MAX - offset_temp) +return AVERROR_INVALIDDATA; + offset_temp += s->edit_unit_byte_count * index; -else { +} else { if (s->nb_index_entries == 2 * s->index_duration + 1) index *= 2; /* Avid index */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/iamf_reader: Check len before summing
ffmpeg | branch: release/7.0 | Michael Niedermayer | Mon Mar 25 03:38:27 2024 +0100| [d4bb784274b32f4a2219204276274e73008391bf] | committer: Michael Niedermayer avformat/iamf_reader: Check len before summing Fixes: integer overflow Fixes: 67275/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-5438920751906816 Fixes: 67688/clusterfuzz-testcase-minimized-ffmpeg_dem_IAMF_fuzzer-5970342318243840 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit f26ee6e0667d050b684668ad0e792e70fcf88b78) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d4bb784274b32f4a2219204276274e73008391bf --- libavformat/iamf_reader.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/iamf_reader.c b/libavformat/iamf_reader.c index 270cfac389..f3ff4170c6 100644 --- a/libavformat/iamf_reader.c +++ b/libavformat/iamf_reader.c @@ -283,9 +283,9 @@ int ff_iamf_read_packet(AVFormatContext *s, IAMFDemuxContext *c, len = ff_iamf_parse_obu_header(header, size, &obu_size, &start_pos, &type, &skip_samples, &discard_padding); -if (len < 0 || obu_size > max_size) { +if (len < 0 || obu_size > max_size || len > INT_MAX - read) { av_log(s, AV_LOG_ERROR, "Failed to read obu\n"); -return len; +return len < 0 ? len : AVERROR_INVALIDDATA; } avio_seek(pb, -(size - start_pos), SEEK_CUR); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/vf_signature: Dont crash on no frames
ffmpeg | branch: release/7.0 | Michael Niedermayer | Mon Feb 12 19:40:07 2024 +0100| [7570390be6343e4186273e59eaa96ef1415d6eeb] | committer: Michael Niedermayer avfilter/vf_signature: Dont crash on no frames Signed-off-by: Michael Niedermayer (cherry picked from commit 3d5f03bbc8bba2929cc09b07d2731ae5d392e772) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7570390be6343e4186273e59eaa96ef1415d6eeb --- libavfilter/vf_signature.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c index 758b6e5101..3858fe3070 100644 --- a/libavfilter/vf_signature.c +++ b/libavfilter/vf_signature.c @@ -379,6 +379,9 @@ static int xml_export(AVFilterContext *ctx, StreamContext *sc, const char* filen FILE* f; unsigned int pot3[5] = { 3*3*3*3, 3*3*3, 3*3, 3, 1 }; +if (!sc->coarseend->last) +return AVERROR(EINVAL); // No frames ? + f = avpriv_fopen_utf8(filename, "w"); if (!f) { int err = AVERROR(EINVAL); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/movenc: Check that cts fits in 32bit
ffmpeg | branch: release/7.0 | Michael Niedermayer | Sat Mar 30 19:51:43 2024 +0100| [003e006ccbe3c415f6e4f72d34e34de39ada403c] | committer: Michael Niedermayer avformat/movenc: Check that cts fits in 32bit Fixes: Assertion av_rescale_rnd(start_dts, mov->movie_timescale, track->timescale, AV_ROUND_DOWN) <= 0 failed at libavformat/movenc.c:3694 Fixes: poc2 Found-by: Wang Dawei and Zhou Geng, from Zhongguancun Laboratory Signed-off-by: Michael Niedermayer (cherry picked from commit d88c284c18bf6cd3dd24a7c86b5e496dd3037405) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=003e006ccbe3c415f6e4f72d34e34de39ada403c --- libavformat/movenc.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index b97c479cc4..e40948edb8 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -6195,6 +6195,12 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) if (ret < 0) return ret; +if (pkt->pts != AV_NOPTS_VALUE && +(uint64_t)pkt->dts - pkt->pts != (int32_t)((uint64_t)pkt->dts - pkt->pts)) { +av_log(s, AV_LOG_WARNING, "pts/dts pair unsupported\n"); +return AVERROR_PATCHWELCOME; +} + if (mov->flags & FF_MOV_FLAG_FRAGMENT || mov->mode == MODE_AVIF) { int ret; if (mov->moov_written || mov->flags & FF_MOV_FLAG_EMPTY_MOOV) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/vvc/vvcdec: Do not submit frames without VVCFrameThread
ffmpeg | branch: release/7.0 | Michael Niedermayer | Fri Jan 26 19:58:56 2024 +0100| [e37d66a72edb6d3efae31f4757c6a08f33e642df] | committer: Michael Niedermayer avcodec/vvc/vvcdec: Do not submit frames without VVCFrameThread Such frames will crash when pthread functions are called on the NULL pointer Fixes: member access within null pointer of type 'VVCFrameThread' (aka 'struct VVCFrameThread') Fixes: 65160/clusterfuzz-testcase-minimized-ffmpeg_BSF_VVC_METADATA_fuzzer-4665241535119360 (partly) Fixes: 65636/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VVC_fuzzer-5394745824182272 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 84ce5ced3163975b5ba9ffbf4c4709114b9e8669) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e37d66a72edb6d3efae31f4757c6a08f33e642df --- libavcodec/vvc/vvcdec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/vvc/vvcdec.c b/libavcodec/vvc/vvcdec.c index d5704aca25..e72bb48a50 100644 --- a/libavcodec/vvc/vvcdec.c +++ b/libavcodec/vvc/vvcdec.c @@ -939,6 +939,9 @@ static int vvc_decode_frame(AVCodecContext *avctx, AVFrame *output, if (ret < 0) return ret; +if (!fc->ft) +return avpkt->size; + ret = submit_frame(s, fc, output, got_output); if (ret < 0) return ret; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/aiffdec: Check for previously set channels
ffmpeg | branch: release/7.0 | Michael Niedermayer | Fri Mar 22 23:07:01 2024 +0100| [8194f34b5d4fb098ff88b213a0148b748209ad99] | committer: Michael Niedermayer avformat/aiffdec: Check for previously set channels Fixes: out of array access (av_channel_layout_copy()) Fixes: 67087/clusterfuzz-testcase-minimized-ffmpeg_dem_AIFF_fuzzer-4920720268263424 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 23b29f72eeb2ff6f2176ee74b9abe78aec4cd1f4) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8194f34b5d4fb098ff88b213a0148b748209ad99 --- libavformat/aiffdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index 9318943f96..fc01ffcbf1 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -106,6 +106,8 @@ static int get_aiff_header(AVFormatContext *s, int64_t size, size++; par->codec_type = AVMEDIA_TYPE_AUDIO; channels = avio_rb16(pb); +if (par->ch_layout.nb_channels && par->ch_layout.nb_channels != channels) +return AVERROR_INVALIDDATA; par->ch_layout.nb_channels = channels; num_frames = avio_rb32(pb); par->bits_per_coded_sample = avio_rb16(pb); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/mpegts: Reset local nb_prg on add_program() failure
ffmpeg | branch: release/7.0 | Michael Niedermayer | Tue Feb 27 02:07:28 2024 +0100| [cbbe688434e2aac4685e36036e413c026053ef47] | committer: Michael Niedermayer avformat/mpegts: Reset local nb_prg on add_program() failure add_program() will deallocate the whole array on failure so we must clear nb_prgs Fixes: null pointer dereference Fixes: crash-35a3b39ddcc5babeeb005b7399a3a1217c8781bc Found-by: Catena cyber Signed-off-by: Michael Niedermayer (cherry picked from commit cb9752d897de17212a7a3ce54ad3e16b377b22c0) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cbbe688434e2aac4685e36036e413c026053ef47 --- libavformat/mpegts.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index de7a3c8b45..320926248b 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -2605,7 +2605,8 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len FFSWAP(struct Program, ts->prg[nb_prg], ts->prg[prg_idx]); if (prg_idx >= nb_prg) nb_prg++; -} +} else +nb_prg = 0; } } ts->nb_prg = nb_prg; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/apedec: Use NABS to avoid undefined negation
ffmpeg | branch: release/7.0 | Michael Niedermayer | Mon Apr 1 22:11:54 2024 +0200| [5469ba6d74dfe34a526edda814e6ac5a922e833c] | committer: Michael Niedermayer avcodec/apedec: Use NABS to avoid undefined negation Fixes: negation of -2147483648 cannot be represented in type 'int32_t' (aka 'int'); cast to an unsigned type to negate this value to itself Fixes: 67738/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APE_fuzzer-5444313212321792 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 1887ff250cfd1e69c08bca21cc53e30a39e26818) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5469ba6d74dfe34a526edda814e6ac5a922e833c --- libavcodec/apedec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c index 0f48bdff77..7d96182d0c 100644 --- a/libavcodec/apedec.c +++ b/libavcodec/apedec.c @@ -1286,7 +1286,7 @@ static void predictor_decode_stereo_3950(APEContext *ctx, int count) int32_t left = a1 - (unsigned)(a0 / 2); int32_t right = left + (unsigned)a0; -if (FFMAX(FFABS(left), FFABS(right)) > (1<<23)) { +if (FFMIN(FFNABS(left), FFNABS(right)) < -(1<<23)) { ctx->interim_mode = !interim_mode; av_log(ctx->avctx, AV_LOG_VERBOSE, "Interim mode: %d\n", ctx->interim_mode); break; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/mxfdec: Make edit_unit_byte_count unsigned
ffmpeg | branch: release/7.0 | Michael Niedermayer | Mon Apr 1 18:29:46 2024 +0200| [54a7f22ee8ccff2231494d0508ec3cb65907818f] | committer: Michael Niedermayer avformat/mxfdec: Make edit_unit_byte_count unsigned Suggested-by: Marton Balint Signed-off-by: Michael Niedermayer (cherry picked from commit f30fe5e8d002e15f07eaacf720c5654097cb62df) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=54a7f22ee8ccff2231494d0508ec3cb65907818f --- libavformat/mxfdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 51a7136555..94806ccb87 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -250,7 +250,7 @@ typedef struct MXFFFV1SubDescriptor { typedef struct MXFIndexTableSegment { MXFMetadataSet meta; -int edit_unit_byte_count; +unsigned edit_unit_byte_count; int index_sid; int body_sid; AVRational index_edit_rate; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/exr: Check for remaining bits in huf_unpack_enc_table()
ffmpeg | branch: release/7.0 | Michael Niedermayer | Mon Apr 1 02:15:07 2024 +0200| [8146cab801963ae948af31a682dc9a6562fb31f8] | committer: Michael Niedermayer avcodec/exr: Check for remaining bits in huf_unpack_enc_table() Fixes: Timeout Fixes: 67645/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-6308760977997824 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 589fa8a027f3b1707d78d7c45335acc498a5e887) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8146cab801963ae948af31a682dc9a6562fb31f8 --- libavcodec/exr.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 5711fbbdcd..f4d974d09e 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -334,7 +334,10 @@ static int huf_unpack_enc_table(GetByteContext *gb, return ret; for (; im <= iM; im++) { -uint64_t l = freq[im] = get_bits(&gbit, 6); +uint64_t l; +if (get_bits_left(&gbit) < 6) +return AVERROR_INVALIDDATA; +l = freq[im] = get_bits(&gbit, 6); if (l == LONG_ZEROCODE_RUN) { int zerun = get_bits(&gbit, 8) + SHORTEST_LONG_RUN; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/exr: Dont use 64bits to hold 6bits
ffmpeg | branch: release/7.0 | Michael Niedermayer | Mon Apr 1 02:18:57 2024 +0200| [87e5bc918a4e25455860a730aa6986d3f18dc5ca] | committer: Michael Niedermayer avcodec/exr: Dont use 64bits to hold 6bits Signed-off-by: Michael Niedermayer (cherry picked from commit e3984de6ffd6068efcfb5c576f1ec788211608fe) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=87e5bc918a4e25455860a730aa6986d3f18dc5ca --- libavcodec/exr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/exr.c b/libavcodec/exr.c index f4d974d09e..e680f9b9e0 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -334,7 +334,7 @@ static int huf_unpack_enc_table(GetByteContext *gb, return ret; for (; im <= iM; im++) { -uint64_t l; +int l; if (get_bits_left(&gbit) < 6) return AVERROR_INVALIDDATA; l = freq[im] = get_bits(&gbit, 6); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] configure: Separate subsystem for Immersive Audio Model
ffmpeg | branch: master | Eugene Zemtsov | Tue Apr 2 21:01:56 2024 -0700| [591e27d1e7b21b66f81c53f381356c5e6f1f0451] | committer: James Almer configure: Separate subsystem for Immersive Audio Model This change allows users to build libavfomat without support for Immersive Audio Model by specifying --disable-iamf. It helps to save on binary size in cases where it's important. Co-authored-by: James Almer Signed-off-by: Eugene Zemtsov Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=591e27d1e7b21b66f81c53f381356c5e6f1f0451 --- configure| 13 + libavformat/mov.c| 15 ++- libavformat/movenc.c | 18 ++ 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/configure b/configure index 2d46ef0b9c..1c5b4f3fa4 100755 --- a/configure +++ b/configure @@ -140,6 +140,7 @@ Component options: --disable-error-resilience disable error resilience code --disable-lspdisable LSP code --disable-faan disable floating point AAN (I)DCT code + --disable-iamf disable support for Immersive Audio Model --disable-pixelutils disable pixel utils in libavutil Individual component options: @@ -2070,6 +2071,7 @@ SUBSYSTEM_LIST=" error_resilience faan fast_unaligned +iamf lsp pixelutils network @@ -2851,6 +2853,8 @@ h264_sei_select="atsc_a53 golomb" hevcparse_select="golomb" hevc_sei_select="atsc_a53 golomb" frame_thread_encoder_deps="encoders threads" +iamfdec_deps="iamf" +iamfenc_deps="iamf" inflate_wrapper_deps="zlib" intrax8_select="blockdsp wmv2dsp" iso_media_select="mpeg4audio" @@ -3590,8 +3594,8 @@ gxf_muxer_select="pcm_rechunk_bsf" hds_muxer_select="flv_muxer" hls_demuxer_select="aac_demuxer ac3_demuxer adts_header ac3_parser eac3_demuxer mov_demuxer mpegts_demuxer" hls_muxer_select="mov_muxer mpegts_muxer" -iamf_demuxer_select="iamfdec" -iamf_muxer_select="iamfenc" +iamf_demuxer_deps="iamfdec" +iamf_muxer_deps="iamfenc" image2_alias_pix_demuxer_select="image2_demuxer" image2_brender_pix_demuxer_select="image2_demuxer" imf_demuxer_deps="libxml2" @@ -3606,9 +3610,9 @@ matroska_demuxer_suggest="bzlib zlib" matroska_muxer_select="mpeg4audio riffenc aac_adtstoasc_bsf pgs_frame_merge_bsf vp9_superframe_bsf" mlp_demuxer_select="mlp_parser" mmf_muxer_select="riffenc" -mov_demuxer_select="iso_media riffdec iamfdec" +mov_demuxer_select="iso_media riffdec" mov_demuxer_suggest="zlib" -mov_muxer_select="iso_media riffenc rtpenc_chain vp9_superframe_bsf aac_adtstoasc_bsf ac3_parser iamfenc" +mov_muxer_select="iso_media riffenc rtpenc_chain vp9_superframe_bsf aac_adtstoasc_bsf ac3_parser" mp3_demuxer_select="mpegaudio_parser" mp3_muxer_select="mpegaudioheader" mp4_muxer_select="mov_muxer" @@ -4079,6 +4083,7 @@ enable asm enable debug enable doc enable faan faandct faanidct +enable iamf iamfdec iamfenc enable large_tests enable optimizations enable ptx_compression diff --git a/libavformat/mov.c b/libavformat/mov.c index b96a02b0d9..0c892b56c8 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -863,6 +863,7 @@ static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; } +#if CONFIG_IAMFDEC static int mov_read_iacb(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; @@ -1042,6 +1043,7 @@ fail: return ret; } +#endif static int mov_read_dec3(MOVContext *c, AVIOContext *pb, MOVAtom atom) { @@ -4810,6 +4812,7 @@ static void fix_timescale(MOVContext *c, MOVStreamContext *sc) } } +#if CONFIG_IAMFDEC static int mov_update_iamf_streams(MOVContext *c, const AVStream *st) { const MOVStreamContext *sc = st->priv_data; @@ -4853,6 +4856,7 @@ static int mov_update_iamf_streams(MOVContext *c, const AVStream *st) return 0; } +#endif static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom) { @@ -4917,11 +4921,13 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom) mov_build_index(c, st); +#if CONFIG_IAMFDEC if (sc->iamf) { ret = mov_update_iamf_streams(c, st); if (ret < 0) return ret; } +#endif if (sc->dref_id-1 < sc->drefs_count && sc->drefs[sc->dref_id-1].path) { MOVDref *dref = &sc->drefs[sc->dref_id - 1]; @@ -8573,7 +8579,9 @@ static const MOVParseTableEntry mov_default_parse_table[] = { { MKTAG('i','p','r','p'), mov_read_iprp }, { MKTAG('i','i','n','f'), mov_read_iinf }, { MKTAG('a','m','v','e'), mov_read_amve }, /* ambient viewing environment box */ +#if CONFIG_IAMFDEC { MKTAG('i','a','c','b'), mov_read_iacb }, +#endif { 0, NULL } }; @@ -9045,8 +9053,10 @@ static void mov_free_stream_context(AVFormatContext *s, AVStream *st) av_freep(&sc->coll); av_freep(&sc->ambient); +#if CONFIG_IAMFDEC if (sc->iamf) ff_iamf_read_deinit(sc->iamf); +#endif av_freep(&sc->iamf); } @@ -9951,6 +9961,7 @@ static int m
[FFmpeg-cvslog] avfilter: properly reduce YUV colorspace format lists
ffmpeg | branch: release/7.0 | Niklas Haas | Mon Mar 25 16:07:23 2024 +0100| [5cd6683ddc52c8b7f95b295feded4acbd3ba130c] | committer: Niklas Haas avfilter: properly reduce YUV colorspace format lists Doing this with REDUCE_FORMATS() instead of swap_color_*() is not only shorter, but more importantly comes with the benefit of being done inside a loop, allowing us to correctly propagate complex graphs involving multiple conversion filters (e.g. -vf scale,zscale). The latter family of swapping functions is only used to settle the best *remaining* entry if no exact match was found, and as such was never the correct solution to YUV colorspaces, which only care about exact matches. (cherry picked from commit b89ee2653919c14193f646ba03b2bf1d13c9aa2d) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5cd6683ddc52c8b7f95b295feded4acbd3ba130c --- libavfilter/avfiltergraph.c | 84 +++-- 1 file changed, 4 insertions(+), 80 deletions(-) diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index bb5399c55e..12ff7d6ffb 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -794,6 +794,10 @@ static int reduce_formats_on_filter(AVFilterContext *filter) nb_formats, ff_add_format); REDUCE_FORMATS(int, AVFilterFormats,samplerates, formats, nb_formats, ff_add_format); +REDUCE_FORMATS(int, AVFilterFormats,color_spaces,formats, + nb_formats, ff_add_format); +REDUCE_FORMATS(int, AVFilterFormats,color_ranges,formats, + nb_formats, ff_add_format); /* reduce channel layouts */ for (i = 0; i < filter->nb_inputs; i++) { @@ -906,82 +910,6 @@ static void swap_samplerates(AVFilterGraph *graph) swap_samplerates_on_filter(graph->filters[i]); } -static void swap_color_spaces_on_filter(AVFilterContext *filter) -{ -AVFilterLink *link = NULL; -enum AVColorSpace csp; -int i; - -for (i = 0; i < filter->nb_inputs; i++) { -link = filter->inputs[i]; -if (link->type == AVMEDIA_TYPE_VIDEO && -link->outcfg.color_spaces->nb_formats == 1) -break; -} -if (i == filter->nb_inputs) -return; - -csp = link->outcfg.color_spaces->formats[0]; - -for (i = 0; i < filter->nb_outputs; i++) { -AVFilterLink *outlink = filter->outputs[i]; -if (outlink->type != AVMEDIA_TYPE_VIDEO) -continue; -/* there is no meaningful 'score' between different yuv matrices, - * so just prioritize an exact match if it exists */ -for (int j = 0; j < outlink->incfg.color_spaces->nb_formats; j++) { -if (csp == outlink->incfg.color_spaces->formats[j]) { -FFSWAP(int, outlink->incfg.color_spaces->formats[0], - outlink->incfg.color_spaces->formats[j]); -break; -} -} -} -} - -static void swap_color_spaces(AVFilterGraph *graph) -{ -for (int i = 0; i < graph->nb_filters; i++) -swap_color_spaces_on_filter(graph->filters[i]); -} - -static void swap_color_ranges_on_filter(AVFilterContext *filter) -{ -AVFilterLink *link = NULL; -enum AVColorRange range; -int i; - -for (i = 0; i < filter->nb_inputs; i++) { -link = filter->inputs[i]; -if (link->type == AVMEDIA_TYPE_VIDEO && -link->outcfg.color_ranges->nb_formats == 1) -break; -} -if (i == filter->nb_inputs) -return; - -range = link->outcfg.color_ranges->formats[0]; - -for (i = 0; i < filter->nb_outputs; i++) { -AVFilterLink *outlink = filter->outputs[i]; -if (outlink->type != AVMEDIA_TYPE_VIDEO) -continue; -for (int j = 0; j < outlink->incfg.color_ranges->nb_formats; j++) { -if (range == outlink->incfg.color_ranges->formats[j]) { -FFSWAP(int, outlink->incfg.color_ranges->formats[0], - outlink->incfg.color_ranges->formats[j]); -break; -} -} -} -} - -static void swap_color_ranges(AVFilterGraph *graph) -{ -for (int i = 0; i < graph->nb_filters; i++) -swap_color_ranges_on_filter(graph->filters[i]); -} - #define CH_CENTER_PAIR (AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER) #define CH_FRONT_PAIR (AV_CH_FRONT_LEFT | AV_CH_FRONT_RIGHT) #define CH_STEREO_PAIR (AV_CH_STEREO_LEFT | AV_CH_STEREO_RIGHT) @@ -1258,10 +1186,6 @@ static int graph_config_formats(AVFilterGraph *graph, void *log_ctx) if ((ret = reduce_formats(graph)) < 0) return ret; -/* for video filters, ensure that the best colorspace metadata is selected */ -swap_color_spaces(graph); -swap_color_ranges(graph); - /* for audio filters, ensure the best format, sample rate and channel layout * is selected */ swap_sample_
[FFmpeg-cvslog] avutil/dovi_meta: add AVDOVIDataMapping.nlq_pivots
ffmpeg | branch: master | quietvoid | Sat Aug 6 09:42:59 2022 -0400| [78076ede2960debdba4e12aca594897ab11e5417] | committer: Niklas Haas avutil/dovi_meta: add AVDOVIDataMapping.nlq_pivots The NLQ pivots are not documented but should be present in the header for profile 7 RPU format. It has been verified using Dolby's verification toolkit. Signed-off-by: quietvoid Signed-off-by: Niklas Haas > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=78076ede2960debdba4e12aca594897ab11e5417 --- doc/APIchanges| 3 +++ libavcodec/dovi_rpu.c | 9 - libavutil/dovi_meta.h | 1 + libavutil/version.h | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index e7677658b1..6ce69fbabc 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07 API changes, most recent first: +2024-04-xx - xx - lavu 59.11.100 - dovi_meta.h + Add AVDOVIDataMapping.nlq_pivots. + 2024-03-29 - xx - lavf 61.3.100 - avformat.h Add AVFormatContext.duration_probesize. diff --git a/libavcodec/dovi_rpu.c b/libavcodec/dovi_rpu.c index ccd5216500..0502f0e7f2 100644 --- a/libavcodec/dovi_rpu.c +++ b/libavcodec/dovi_rpu.c @@ -110,7 +110,7 @@ int ff_dovi_attach_side_data(DOVIContext *s, AVFrame *frame) /* Copy only the parts of these structs known to us at compiler-time. */ #define COPY(t, a, b, last) memcpy(a, b, offsetof(t, last) + sizeof((b)->last)) COPY(AVDOVIRpuDataHeader, av_dovi_get_header(dovi), &s->header, disable_residual_flag); -COPY(AVDOVIDataMapping, av_dovi_get_mapping(dovi), s->mapping, nlq[2].linear_deadzone_threshold); +COPY(AVDOVIDataMapping, av_dovi_get_mapping(dovi), s->mapping, nlq_pivots); COPY(AVDOVIColorMetadata, av_dovi_get_color(dovi), s->color, source_diagonal); return 0; } @@ -347,7 +347,14 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size) } if (use_nlq) { +int nlq_pivot = 0; vdr->mapping.nlq_method_idc = get_bits(gb, 3); + +for (int i = 0; i < 2; i++) { +nlq_pivot += get_bits(gb, hdr->bl_bit_depth); +vdr->mapping.nlq_pivots[i] = av_clip_uint16(nlq_pivot); +} + /** * The patent mentions another legal value, NLQ_MU_LAW, but it's * not documented anywhere how to parse or apply that type of NLQ. diff --git a/libavutil/dovi_meta.h b/libavutil/dovi_meta.h index 3d11e02bff..46b13b3399 100644 --- a/libavutil/dovi_meta.h +++ b/libavutil/dovi_meta.h @@ -147,6 +147,7 @@ typedef struct AVDOVIDataMapping { uint32_t num_x_partitions; uint32_t num_y_partitions; AVDOVINLQParams nlq[3]; /* per component */ +uint16_t nlq_pivots[2]; } AVDOVIDataMapping; /** diff --git a/libavutil/version.h b/libavutil/version.h index 8774ed4d1a..d0cc34f43a 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 59 -#define LIBAVUTIL_VERSION_MINOR 10 +#define LIBAVUTIL_VERSION_MINOR 11 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avutil/dovi_meta: add dolby vision extension blocks
ffmpeg | branch: master | Niklas Haas | Sat Mar 23 13:14:04 2024 +0100| [4f55e16f2bc1b861ecc6ce29f151beac357f181c] | committer: Niklas Haas avutil/dovi_meta: add dolby vision extension blocks As well as accessors plus a function for allocating this struct with extension blocks, Definitions generously taken from quietvoid/dovi_tool, which is assembled as a collection of various patent fragments, as well as output by the official Dolby Vision bitstream verifier tool. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4f55e16f2bc1b861ecc6ce29f151beac357f181c --- doc/APIchanges| 5 ++ libavutil/dovi_meta.c | 22 ++-- libavutil/dovi_meta.h | 146 ++ libavutil/version.h | 2 +- 4 files changed, 171 insertions(+), 4 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 6ce69fbabc..7eda1321cb 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,11 @@ The last version increases of all libraries were on 2024-03-07 API changes, most recent first: +2024-04-xx - xx - lavu 59.12.100 - dovi_meta.h + Add AVDOVIMetadata.ext_block_{offset,size}, AVDOVIMetadata.num_ext_blocks, + AVDOVIDmData and AVDOVIDmLevel{1..6,8..11,254..255}, av_dovi_get_ext() + and av_dovi_find_level(). + 2024-04-xx - xx - lavu 59.11.100 - dovi_meta.h Add AVDOVIDataMapping.nlq_pivots. diff --git a/libavutil/dovi_meta.c b/libavutil/dovi_meta.c index 9c50da561e..dfa4a438ed 100644 --- a/libavutil/dovi_meta.c +++ b/libavutil/dovi_meta.c @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + #include "dovi_meta.h" #include "mem.h" @@ -39,6 +41,7 @@ typedef struct AVDOVIMetadataInternal { AVDOVIRpuDataHeader header; AVDOVIDataMapping mapping; AVDOVIColorMetadata color; +AVDOVIDmData ext_blocks[AV_DOVI_MAX_EXT_BLOCKS]; } AVDOVIMetadataInternal; AVDOVIMetadata *av_dovi_metadata_alloc(size_t *size) @@ -51,10 +54,23 @@ AVDOVIMetadata *av_dovi_metadata_alloc(size_t *size) *size = sizeof(*dovi); dovi->metadata = (struct AVDOVIMetadata) { -.header_offset = offsetof(AVDOVIMetadataInternal, header), -.mapping_offset = offsetof(AVDOVIMetadataInternal, mapping), -.color_offset = offsetof(AVDOVIMetadataInternal, color), +.header_offset = offsetof(AVDOVIMetadataInternal, header), +.mapping_offset = offsetof(AVDOVIMetadataInternal, mapping), +.color_offset = offsetof(AVDOVIMetadataInternal, color), +.ext_block_offset = offsetof(AVDOVIMetadataInternal, ext_blocks), +.ext_block_size = sizeof(AVDOVIDmData), }; return &dovi->metadata; } + +AVDOVIDmData *av_dovi_find_level(const AVDOVIMetadata *data, uint8_t level) +{ +for (int i = 0; i < data->num_ext_blocks; i++) { +AVDOVIDmData *ext = av_dovi_get_ext(data, i); +if (ext->level == level) +return ext; +} + +return NULL; +} diff --git a/libavutil/dovi_meta.h b/libavutil/dovi_meta.h index 46b13b3399..e10332f8d7 100644 --- a/libavutil/dovi_meta.h +++ b/libavutil/dovi_meta.h @@ -29,7 +29,9 @@ #include #include + #include "rational.h" +#include "csp.h" /* * DOVI configuration @@ -187,6 +189,130 @@ typedef struct AVDOVIColorMetadata { uint16_t source_diagonal; } AVDOVIColorMetadata; +typedef struct AVDOVIDmLevel1 { +/* Per-frame brightness metadata */ +uint16_t min_pq; +uint16_t max_pq; +uint16_t avg_pq; +} AVDOVIDmLevel1; + +typedef struct AVDOVIDmLevel2 { +/* Usually derived from level 8 (at different levels) */ +uint16_t target_max_pq; +uint16_t trim_slope; +uint16_t trim_offset; +uint16_t trim_power; +uint16_t trim_chroma_weight; +uint16_t trim_saturation_gain; +int16_t ms_weight; +} AVDOVIDmLevel2; + +typedef struct AVDOVIDmLevel3 { +uint16_t min_pq_offset; +uint16_t max_pq_offset; +uint16_t avg_pq_offset; +} AVDOVIDmLevel3; + +typedef struct AVDOVIDmLevel4 { +uint16_t anchor_pq; +uint16_t anchor_power; +} AVDOVIDmLevel4; + +typedef struct AVDOVIDmLevel5 { +/* Active area definition */ +uint16_t left_offset; +uint16_t right_offset; +uint16_t top_offset; +uint16_t bottom_offset; +} AVDOVIDmLevel5; + +typedef struct AVDOVIDmLevel6 { +/* Static HDR10 metadata */ +uint16_t max_luminance; +uint16_t min_luminance; +uint16_t max_cll; +uint16_t max_fall; +} AVDOVIDmLevel6; + +typedef struct AVDOVIDmLevel8 { +/* Extended version of level 2 */ +uint8_t target_display_index; +uint16_t trim_slope; +uint16_t trim_offset; +uint16_t trim_power; +uint16_t trim_chroma_weight; +uint16_t trim_saturation_gain; +uint16_t ms_weight; +uint16_t target_mid_contrast; +uint16_t clip_trim; +uint8_t saturation_vector_field[6]; +uint8_t hue_vector_field[6]; +} AVDOVIDmLevel8; + +typedef struct AVDOVIDmLevel9 { +
[FFmpeg-cvslog] avcodec/dovi_rpu: switch to AVERROR_INVALIDDATA
ffmpeg | branch: master | Niklas Haas | Sat Mar 23 20:04:05 2024 +0100| [0473270a34e4159cd03a5cb12994be8c767e11bf] | committer: Niklas Haas avcodec/dovi_rpu: switch to AVERROR_INVALIDDATA Instead of AVERROR(EINVAL) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0473270a34e4159cd03a5cb12994be8c767e11bf --- libavcodec/dovi_rpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/dovi_rpu.c b/libavcodec/dovi_rpu.c index 0502f0e7f2..5f2f79f0f6 100644 --- a/libavcodec/dovi_rpu.c +++ b/libavcodec/dovi_rpu.c @@ -484,5 +484,5 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size) fail: ff_dovi_ctx_unref(s); /* don't leak potentially invalid state */ -return AVERROR(EINVAL); +return AVERROR_INVALIDDATA; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/dovi_rpu: strip container in separate step
ffmpeg | branch: master | Niklas Haas | Sat Mar 23 15:59:44 2024 +0100| [a6c624f8f76446918a2e03404ec251f0cea98604] | committer: Niklas Haas avcodec/dovi_rpu: strip container in separate step This ensures that `gb` in the following section is fully byte-aligned, points at the start of the actual RPU, and ends on the CRC terminator. This is important for both calculation of the CRC, as well as dovi extension block parsing (which aligns to byte boundaries in various places). > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a6c624f8f76446918a2e03404ec251f0cea98604 --- libavcodec/dovi_rpu.c | 48 +++- libavcodec/dovi_rpu.h | 2 ++ 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/libavcodec/dovi_rpu.c b/libavcodec/dovi_rpu.c index 5f2f79f0f6..be8118b4cf 100644 --- a/libavcodec/dovi_rpu.c +++ b/libavcodec/dovi_rpu.c @@ -24,6 +24,7 @@ #include "libavutil/buffer.h" #include "libavutil/mem.h" +#include "avcodec.h" #include "dovi_rpu.h" #include "golomb.h" #include "get_bits.h" @@ -46,6 +47,7 @@ void ff_dovi_ctx_unref(DOVIContext *s) { for (int i = 0; i < FF_ARRAY_ELEMS(s->vdr); i++) ff_refstruct_unref(&s->vdr[i]); +av_free(s->rpu_buf); *s = (DOVIContext) { .logctx = s->logctx, @@ -60,6 +62,9 @@ void ff_dovi_ctx_flush(DOVIContext *s) *s = (DOVIContext) { .logctx = s->logctx, .dv_profile = s->dv_profile, +/* preserve temporary buffer */ +.rpu_buf = s->rpu_buf, +.rpu_buf_sz = s->rpu_buf_sz, }; } @@ -203,17 +208,17 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size) DOVIVdr *vdr; int ret; -uint8_t nal_prefix; uint8_t rpu_type; uint8_t vdr_seq_info_present; uint8_t vdr_dm_metadata_present; uint8_t use_prev_vdr_rpu; uint8_t use_nlq; uint8_t profile; -if ((ret = init_get_bits8(gb, rpu, rpu_size)) < 0) -return ret; -/* Container header */ +if (rpu_size < 5) +goto fail; + +/* Container */ if (s->dv_profile == 10 /* dav1.10 */) { /* DV inside AV1 re-uses an EMDF container skeleton, but with fixed * values - so we can effectively treat this as a magic byte sequence. @@ -230,18 +235,43 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size) * discard_unknown_payload : f(1) = 1 */ const unsigned header_magic = 0x01be6841u; -unsigned header, emdf_payload_size; -header = get_bits_long(gb, 27); -VALIDATE(header, header_magic, header_magic); +unsigned emdf_header, emdf_payload_size, emdf_protection; +if ((ret = init_get_bits8(gb, rpu, rpu_size)) < 0) +return ret; +emdf_header = get_bits_long(gb, 27); +VALIDATE(emdf_header, header_magic, header_magic); emdf_payload_size = get_variable_bits(gb, 8); VALIDATE(emdf_payload_size, 6, 512); if (emdf_payload_size * 8 > get_bits_left(gb)) return AVERROR_INVALIDDATA; + +/* The payload is not byte-aligned (off by *one* bit, curse Dolby), + * so copy into a fresh buffer to preserve byte alignment of the + * RPU struct */ +av_fast_padded_malloc(&s->rpu_buf, &s->rpu_buf_sz, emdf_payload_size); +if (!s->rpu_buf) +return AVERROR(ENOMEM); +for (int i = 0; i < emdf_payload_size; i++) +s->rpu_buf[i] = get_bits(gb, 8); +rpu = s->rpu_buf; +rpu_size = emdf_payload_size; + +/* Validate EMDF footer */ +emdf_protection = get_bits(gb, 5 + 12); +VALIDATE(emdf_protection, 0x400, 0x400); } else { -nal_prefix = get_bits(gb, 8); -VALIDATE(nal_prefix, 25, 25); +/* NAL RBSP with prefix and trailing zeroes */ +VALIDATE(rpu[0], 25, 25); /* NAL prefix */ +rpu++; +rpu_size--; +/* Strip trailing padding bytes */ +while (rpu_size && rpu[rpu_size - 1] == 0) +rpu_size--; } +if ((ret = init_get_bits8(gb, rpu, rpu_size)) < 0) +return ret; + /* RPU header */ rpu_type = get_bits(gb, 6); if (rpu_type != 2) { diff --git a/libavcodec/dovi_rpu.h b/libavcodec/dovi_rpu.h index 51c5fdbb87..755171c923 100644 --- a/libavcodec/dovi_rpu.h +++ b/libavcodec/dovi_rpu.h @@ -48,6 +48,8 @@ typedef struct DOVIContext { * Private fields internal to dovi_rpu.c */ struct DOVIVdr *vdr[DOVI_MAX_DM_ID+1]; ///< RefStruct references +uint8_t *rpu_buf; ///< temporary buffer +unsigned rpu_buf_sz; uint8_t dv_profile; } DOVIContext; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/dovi_rpu: verify RPU data CRC32
ffmpeg | branch: master | Niklas Haas | Sat Mar 23 16:29:12 2024 +0100| [b90c18b38c223e52b852e7156dd5bf1f59200ee7] | committer: Niklas Haas avcodec/dovi_rpu: verify RPU data CRC32 The Dolby Vision RPU contains a CRC32 to validate the payload against. The implementation is CRC32/MPEG-2. The CRC is only verified with the AV_EF_CRCCHECK flag. Co-authored-by: quietvoid > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b90c18b38c223e52b852e7156dd5bf1f59200ee7 --- libavcodec/av1dec.c | 3 ++- libavcodec/dovi_rpu.c | 18 -- libavcodec/dovi_rpu.h | 3 ++- libavcodec/hevcdec.c | 3 ++- libavcodec/libdav1d.c | 3 ++- 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index e5088fc7b5..824725c031 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -1002,7 +1002,8 @@ static int export_itut_t35(AVCodecContext *avctx, AVFrame *frame, provider_oriented_code != 0x800) break; -ret = ff_dovi_rpu_parse(&s->dovi, gb.buffer, gb.buffer_end - gb.buffer); +ret = ff_dovi_rpu_parse(&s->dovi, gb.buffer, gb.buffer_end - gb.buffer, +avctx->err_recognition); if (ret < 0) { av_log(avctx, AV_LOG_WARNING, "Error parsing DOVI OBU.\n"); break; // ignore diff --git a/libavcodec/dovi_rpu.c b/libavcodec/dovi_rpu.c index be8118b4cf..85aded52bd 100644 --- a/libavcodec/dovi_rpu.c +++ b/libavcodec/dovi_rpu.c @@ -23,6 +23,7 @@ #include "libavutil/buffer.h" #include "libavutil/mem.h" +#include "libavutil/crc.h" #include "avcodec.h" #include "dovi_rpu.h" @@ -201,7 +202,8 @@ static inline unsigned get_variable_bits(GetBitContext *gb, int n) } \ } while (0) -int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size) +int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size, + int err_recognition) { AVDOVIRpuDataHeader *hdr = &s->header; GetBitContext *gb = &(GetBitContext){0}; @@ -269,6 +271,19 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size) rpu_size--; } +if (!rpu_size || rpu[rpu_size - 1] != 0x80) +goto fail; + +if (err_recognition & AV_EF_CRCCHECK) { +uint32_t crc = av_bswap32(av_crc(av_crc_get_table(AV_CRC_32_IEEE), + -1, rpu, rpu_size - 1)); /* exclude 0x80 */ +if (crc) { +av_log(s->logctx, AV_LOG_ERROR, "RPU CRC mismatch: %X\n", crc); +if (err_recognition & AV_EF_EXPLODE) +goto fail; +} +} + if ((ret = init_get_bits8(gb, rpu, rpu_size)) < 0) return ret; @@ -509,7 +524,6 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size) color->source_diagonal = get_bits(gb, 10); } -/* FIXME: verify CRC32, requires implementation of AV_CRC_32_MPEG_2 */ return 0; fail: diff --git a/libavcodec/dovi_rpu.h b/libavcodec/dovi_rpu.h index 755171c923..8dcc65bb40 100644 --- a/libavcodec/dovi_rpu.h +++ b/libavcodec/dovi_rpu.h @@ -79,7 +79,8 @@ void ff_dovi_update_cfg(DOVIContext *s, const AVDOVIDecoderConfigurationRecord * * * Returns 0 or an error code. */ -int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size); +int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size, + int err_recognition); /** * Attach the decoded AVDOVIMetadata as side data to an AVFrame. diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 752459af2d..727b02f0f4 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -3208,7 +3208,8 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length) return AVERROR(ENOMEM); memcpy(s->rpu_buf->data, nal->raw_data + 2, nal->raw_size - 2); -ret = ff_dovi_rpu_parse(&s->dovi_ctx, nal->data + 2, nal->size - 2); +ret = ff_dovi_rpu_parse(&s->dovi_ctx, nal->data + 2, nal->size - 2, +s->avctx->err_recognition); if (ret < 0) { av_buffer_unref(&s->rpu_buf); av_log(s->avctx, AV_LOG_WARNING, "Error parsing DOVI NAL unit.\n"); diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c index ddcd0708b4..f022a4ad05 100644 --- a/libavcodec/libdav1d.c +++ b/libavcodec/libdav1d.c @@ -567,7 +567,8 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) provider_oriented_code != 0x800) break; -res = ff_dovi_rpu_parse(&dav1d->dovi, gb.buffer, gb.buffer_end - gb.buffer); +res = ff_dovi_rpu_parse(&dav1d->dovi, gb.buffer, gb.buffer_end - gb.buffer, +c->err_recognition); if (res < 0) { av_log(c, AV_LOG_WARNING, "Error pars
[FFmpeg-cvslog] avcodec/dovi_rpu: add ext_blocks array to DOVIContext
ffmpeg | branch: master | Niklas Haas | Sat Mar 23 16:52:41 2024 +0100| [3a1916c38aa44374fbcc24ec647d0beaf6152deb] | committer: Niklas Haas avcodec/dovi_rpu: add ext_blocks array to DOVIContext > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3a1916c38aa44374fbcc24ec647d0beaf6152deb --- libavcodec/dovi_rpu.c | 3 +++ libavcodec/dovi_rpu.h | 6 ++ 2 files changed, 9 insertions(+) diff --git a/libavcodec/dovi_rpu.c b/libavcodec/dovi_rpu.c index 85aded52bd..ce9be19ed0 100644 --- a/libavcodec/dovi_rpu.c +++ b/libavcodec/dovi_rpu.c @@ -48,6 +48,7 @@ void ff_dovi_ctx_unref(DOVIContext *s) { for (int i = 0; i < FF_ARRAY_ELEMS(s->vdr); i++) ff_refstruct_unref(&s->vdr[i]); +ff_refstruct_unref(&s->ext_blocks); av_free(s->rpu_buf); *s = (DOVIContext) { @@ -59,6 +60,7 @@ void ff_dovi_ctx_flush(DOVIContext *s) { for (int i = 0; i < FF_ARRAY_ELEMS(s->vdr); i++) ff_refstruct_unref(&s->vdr[i]); +ff_refstruct_unref(&s->ext_blocks); *s = (DOVIContext) { .logctx = s->logctx, @@ -77,6 +79,7 @@ void ff_dovi_ctx_replace(DOVIContext *s, const DOVIContext *s0) s->dv_profile = s0->dv_profile; for (int i = 0; i <= DOVI_MAX_DM_ID; i++) ff_refstruct_replace(&s->vdr[i], s0->vdr[i]); +ff_refstruct_replace(&s->ext_blocks, s0->ext_blocks); } void ff_dovi_update_cfg(DOVIContext *s, const AVDOVIDecoderConfigurationRecord *cfg) diff --git a/libavcodec/dovi_rpu.h b/libavcodec/dovi_rpu.h index 8dcc65bb40..9f26f332ce 100644 --- a/libavcodec/dovi_rpu.h +++ b/libavcodec/dovi_rpu.h @@ -44,6 +44,12 @@ typedef struct DOVIContext { const AVDOVIDataMapping *mapping; const AVDOVIColorMetadata *color; +/** + * Currently active extension blocks, updates on every ff_dovi_rpu_parse() + */ +AVDOVIDmData *ext_blocks; +int num_ext_blocks; + /** * Private fields internal to dovi_rpu.c */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/dovi_rpu: parse extension blocks
ffmpeg | branch: master | Niklas Haas | Sat Mar 23 16:53:33 2024 +0100| [f46fff27d00c47164f1157d7f14205e846e74021] | committer: Niklas Haas avcodec/dovi_rpu: parse extension blocks We split the inner loop between v1 and v2 extension blocks to print a warning where an extension block was encountered in an unexpected context. Co-authored-by: quietvoid > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f46fff27d00c47164f1157d7f14205e846e74021 --- libavcodec/dovi_rpu.c | 178 ++ 1 file changed, 178 insertions(+) diff --git a/libavcodec/dovi_rpu.c b/libavcodec/dovi_rpu.c index ce9be19ed0..499d8bab4f 100644 --- a/libavcodec/dovi_rpu.c +++ b/libavcodec/dovi_rpu.c @@ -205,6 +205,170 @@ static inline unsigned get_variable_bits(GetBitContext *gb, int n) } \ } while (0) +static void parse_ext_v1(DOVIContext *s, GetBitContext *gb, AVDOVIDmData *dm) +{ +switch (dm->level) { +case 1: +dm->l1.min_pq = get_bits(gb, 12); +dm->l1.max_pq = get_bits(gb, 12); +dm->l1.avg_pq = get_bits(gb, 12); +break; +case 2: +dm->l2.target_max_pq = get_bits(gb, 12); +dm->l2.trim_slope = get_bits(gb, 12); +dm->l2.trim_offset = get_bits(gb, 12); +dm->l2.trim_power = get_bits(gb, 12); +dm->l2.trim_chroma_weight = get_bits(gb, 12); +dm->l2.trim_saturation_gain = get_bits(gb, 12); +dm->l2.ms_weight = get_bits(gb, 13) - 8192; +break; +case 4: +dm->l4.anchor_pq = get_bits(gb, 12); +dm->l4.anchor_power = get_bits(gb, 12); +break; +case 5: +dm->l5.left_offset = get_bits(gb, 13); +dm->l5.right_offset = get_bits(gb, 13); +dm->l5.top_offset = get_bits(gb, 13); +dm->l5.bottom_offset = get_bits(gb, 13); +break; +case 6: +dm->l6.max_luminance = get_bits(gb, 16); +dm->l6.min_luminance = get_bits(gb, 16); +dm->l6.max_cll = get_bits(gb, 16); +dm->l6.max_fall = get_bits(gb, 16); +break; +case 255: +dm->l255.dm_run_mode = get_bits(gb, 8); +dm->l255.dm_run_version = get_bits(gb, 8); +for (int i = 0; i < 4; i++) +dm->l255.dm_debug[i] = get_bits(gb, 8); +break; +default: +av_log(s->logctx, AV_LOG_WARNING, + "Unknown Dolby Vision DM v1 level: %u\n", dm->level); +} +} + +static AVCIExy get_cie_xy(GetBitContext *gb) +{ +AVCIExy xy; +const int denom = 32767; +xy.x = av_make_q(get_sbits(gb, 16), denom); +xy.y = av_make_q(get_sbits(gb, 16), denom); +return xy; +} + +static void parse_ext_v2(DOVIContext *s, GetBitContext *gb, AVDOVIDmData *dm, + int ext_block_length) +{ +switch (dm->level) { +case 3: +dm->l3.min_pq_offset = get_bits(gb, 12); +dm->l3.max_pq_offset = get_bits(gb, 12); +dm->l3.avg_pq_offset = get_bits(gb, 12); +break; +case 8: +dm->l8.target_display_index = get_bits(gb, 8); +dm->l8.trim_slope = get_bits(gb, 12); +dm->l8.trim_offset = get_bits(gb, 12); +dm->l8.trim_power = get_bits(gb, 12); +dm->l8.trim_chroma_weight = get_bits(gb, 12); +dm->l8.trim_saturation_gain = get_bits(gb, 12); +dm->l8.ms_weight = get_bits(gb, 12) - 8192; +if (ext_block_length < 12) +break; +dm->l8.target_mid_contrast = get_bits(gb, 12); +if (ext_block_length < 13) +break; +dm->l8.clip_trim = get_bits(gb, 12); +if (ext_block_length < 19) +break; +for (int i = 0; i < 6; i++) +dm->l8.saturation_vector_field[i] = get_bits(gb, 8); +if (ext_block_length < 25) +break; +for (int i = 0; i < 6; i++) +dm->l8.hue_vector_field[i] = get_bits(gb, 8); +break; +case 9: +dm->l9.source_primary_index = get_bits(gb, 8); +if (ext_block_length < 17) +break; +dm->l9.source_display_primaries.prim.r = get_cie_xy(gb); +dm->l9.source_display_primaries.prim.g = get_cie_xy(gb); +dm->l9.source_display_primaries.prim.b = get_cie_xy(gb); +dm->l9.source_display_primaries.wp = get_cie_xy(gb); +break; +case 10: +dm->l10.target_display_index = get_bits(gb, 8); +dm->l10.target_max_pq = get_bits(gb, 12); +dm->l10.target_min_pq = get_bits(gb, 12); +dm->l10.target_primary_index = get_bits(gb, 8); +if (ext_block_length < 21) +break; +dm->l10.target_display_primaries.prim.r = get_cie_xy(gb); +dm->l10.target_display_primaries.prim.g = get_cie_xy(gb); +dm->l10.target_display_primaries.prim.b = get_cie_xy(gb); +dm->l10.target_display_primaries.wp = get_cie_xy(gb); +break; +case 11: +dm->l11.content_type = get_bits(gb, 8);
[FFmpeg-cvslog] avcodec/dovi_rpu: attach ext blocks to frames
ffmpeg | branch: master | Niklas Haas | Sat Mar 23 16:53:14 2024 +0100| [9073f49e6e0403a6709d0daa93e9b978c3c15a2b] | committer: Niklas Haas avcodec/dovi_rpu: attach ext blocks to frames > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9073f49e6e0403a6709d0daa93e9b978c3c15a2b --- libavcodec/dovi_rpu.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/dovi_rpu.c b/libavcodec/dovi_rpu.c index 499d8bab4f..9f7a6b0066 100644 --- a/libavcodec/dovi_rpu.c +++ b/libavcodec/dovi_rpu.c @@ -95,7 +95,7 @@ int ff_dovi_attach_side_data(DOVIContext *s, AVFrame *frame) AVFrameSideData *sd; AVBufferRef *buf; AVDOVIMetadata *dovi; -size_t dovi_size; +size_t dovi_size, ext_sz; if (!s->mapping || !s->color) return 0; /* incomplete dovi metadata */ @@ -121,6 +121,10 @@ int ff_dovi_attach_side_data(DOVIContext *s, AVFrame *frame) COPY(AVDOVIRpuDataHeader, av_dovi_get_header(dovi), &s->header, disable_residual_flag); COPY(AVDOVIDataMapping, av_dovi_get_mapping(dovi), s->mapping, nlq_pivots); COPY(AVDOVIColorMetadata, av_dovi_get_color(dovi), s->color, source_diagonal); +ext_sz = FFMIN(sizeof(AVDOVIDmData), dovi->ext_block_size); +for (int i = 0; i < s->num_ext_blocks; i++) +memcpy(av_dovi_get_ext(dovi, i), &s->ext_blocks[i], ext_sz); +dovi->num_ext_blocks = s->num_ext_blocks; return 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fate/libswscale: Disable ffmpeg-dependent tests without ffmpeg
ffmpeg | branch: master | Andreas Rheinhardt | Sat Mar 30 22:05:20 2024 +0100| [7eff280599ec82ed7986b618e740a33edd0ca905] | committer: Andreas Rheinhardt fate/libswscale: Disable ffmpeg-dependent tests without ffmpeg Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7eff280599ec82ed7986b618e740a33edd0ca905 --- tests/fate/libswscale.mak | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/fate/libswscale.mak b/tests/fate/libswscale.mak index f8572f9c37..4c29220e6f 100644 --- a/tests/fate/libswscale.mak +++ b/tests/fate/libswscale.mak @@ -17,17 +17,15 @@ $(SWS_SLICE_TEST-yes): tools/scale_slice_test$(EXESUF) $(SWS_SLICE_TEST-yes): REF = /dev/null FATE_LIBSWSCALE_SAMPLES += $(SWS_SLICE_TEST-yes) -FATE_LIBSWSCALE-$(CONFIG_RAWVIDEO_DEMUXER) += fate-sws-yuv-colorspace +FATE_LIBSWSCALE_FFMPEG-$(call FRAMECRC, RAWVIDEO, RAWVIDEO, SCALE_FILTER) += fate-sws-yuv-colorspace \ + fate-sws-yuv-range fate-sws-yuv-colorspace: tests/data/vsynth1.yuv -fate-sws-yuv-colorspace: ffmpeg$(PROGSSUF)$(EXESUF) fate-sws-yuv-colorspace: CMD = framecrc \ -f rawvideo -s 352x288 -pix_fmt yuv420p -i $(TARGET_PATH)/tests/data/vsynth1.yuv \ -frames 1 \ -vf scale=in_color_matrix=bt709:in_range=limited:out_color_matrix=bt601:out_range=full:flags=+accurate_rnd+bitexact -FATE_LIBSWSCALE-$(CONFIG_RAWVIDEO_DEMUXER) += fate-sws-yuv-range fate-sws-yuv-range: tests/data/vsynth1.yuv -fate-sws-yuv-range: ffmpeg$(PROGSSUF)$(EXESUF) fate-sws-yuv-range: CMD = framecrc \ -f rawvideo -s 352x288 -pix_fmt yuv420p -i $(TARGET_PATH)/tests/data/vsynth1.yuv \ -frames 1 \ @@ -36,5 +34,6 @@ fate-sws-yuv-range: CMD = framecrc \ FATE_LIBSWSCALE += $(FATE_LIBSWSCALE-yes) FATE_LIBSWSCALE_SAMPLES += $(FATE_LIBSWSCALE_SAMPLES-yes) FATE-$(CONFIG_SWSCALE) += $(FATE_LIBSWSCALE) +FATE_FFMPEG += $(FATE_LIBSWSCALE_FFMPEG-yes) FATE_EXTERN-$(CONFIG_SWSCALE) += $(FATE_LIBSWSCALE_SAMPLES) -fate-libswscale: $(FATE_LIBSWSCALE) $(FATE_LIBSWSCALE_SAMPLES) +fate-libswscale: $(FATE_LIBSWSCALE) $(FATE_LIBSWSCALE_SAMPLES) $(FATE_LIBSWSCALE_FFMPEG-yes) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fate/lavf-container: Check earlier for presence of ffmpeg cli
ffmpeg | branch: master | Andreas Rheinhardt | Sat Mar 30 23:37:45 2024 +0100| [2cd397d90d702c5aa96cb2e72d245b5cf1a660d2] | committer: Andreas Rheinhardt fate/lavf-container: Check earlier for presence of ffmpeg cli Several other tests (e.g. concatdec) examine FATE_LAVF_CONTAINER in order to enable or disable tests that depend on samples created by the lavf-container tests; right now this procedure did not account for CONFIG_FFMPEG. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2cd397d90d702c5aa96cb2e72d245b5cf1a660d2 --- tests/fate/lavf-container.mak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fate/lavf-container.mak b/tests/fate/lavf-container.mak index 7a925117c3..d89174d221 100644 --- a/tests/fate/lavf-container.mak +++ b/tests/fate/lavf-container.mak @@ -30,7 +30,7 @@ FATE_LAVF_CONTAINER_SCALE := dv dv_pal dv_ntsc flm gxf gxf_pal gxf_ntsc \ FATE_LAVF_CONTAINER-$(!CONFIG_SCALE_FILTER) := $(filter-out $(FATE_LAVF_CONTAINER_SCALE),$(FATE_LAVF_CONTAINER-yes)) FATE_LAVF_CONTAINER = $(FATE_LAVF_CONTAINER-yes:%=fate-lavf-%) -FATE_LAVF_CONTAINER := $(if $(call ENCDEC2, RAWVIDEO PGMYUV, PCM_S16LE, CRC IMAGE2, PCM_S16LE_DEMUXER PIPE_PROTOCOL), $(FATE_LAVF_CONTAINER)) +FATE_LAVF_CONTAINER := $(if $(call ENCDEC2, RAWVIDEO PGMYUV, PCM_S16LE, CRC IMAGE2, PCM_S16LE_DEMUXER PIPE_PROTOCOL FFMPEG), $(FATE_LAVF_CONTAINER)) $(FATE_LAVF_CONTAINER): CMD = lavf_container $(FATE_LAVF_CONTAINER): REF = $(SRC_PATH)/tests/ref/lavf/$(@:fate-lavf-%=%) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fate/api: Fix requirements of fate-api-seek
ffmpeg | branch: master | Andreas Rheinhardt | Sat Mar 30 23:46:28 2024 +0100| [b351cbb314164f848adcd0588455e0473542c501] | committer: Andreas Rheinhardt fate/api: Fix requirements of fate-api-seek It relies on the fate-lavf-flv test. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b351cbb314164f848adcd0588455e0473542c501 --- tests/fate/api.mak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fate/api.mak b/tests/fate/api.mak index 688fc0f9b3..d2868e57ac 100644 --- a/tests/fate/api.mak +++ b/tests/fate/api.mak @@ -16,7 +16,7 @@ FATE_API_SAMPLES_LIBAVFORMAT-$(call DEMDEC, H264, H264) += fate-api-h264-slice fate-api-h264-slice: $(APITESTSDIR)/api-h264-slice-test$(EXESUF) fate-api-h264-slice: CMD = run $(APITESTSDIR)/api-h264-slice-test$(EXESUF) 2 $(TARGET_SAMPLES)/h264/crew_cif.nal -FATE_API_LIBAVFORMAT-$(call DEMDEC, FLV, FLV) += fate-api-seek +FATE_API_LIBAVFORMAT-yes += $(if $(findstring fate-lavf-flv,$(FATE_LAVF_CONTAINER)),fate-api-seek) fate-api-seek: $(APITESTSDIR)/api-seek-test$(EXESUF) fate-lavf-flv fate-lavf-flv: KEEP_FILES ?= 1 fate-api-seek: CMD = run $(APITESTSDIR)/api-seek-test$(EXESUF) $(TARGET_PATH)/tests/data/lavf/lavf.flv 0 720 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] fate/ffprobe: Fix test requirements
ffmpeg | branch: master | Andreas Rheinhardt | Sat Mar 30 23:48:14 2024 +0100| [07c734b2b2ffadf96f5e12fe7899b40ccd58a3f2] | committer: Andreas Rheinhardt fate/ffprobe: Fix test requirements The ffprobe-test file is generated via ffmpeg and several filters; the requirements for them were missing. Also deduplicate this while just at it. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=07c734b2b2ffadf96f5e12fe7899b40ccd58a3f2 --- tests/Makefile | 1 + tests/fate/ffprobe.mak | 40 +--- 2 files changed, 10 insertions(+), 31 deletions(-) diff --git a/tests/Makefile b/tests/Makefile index ed6b1801a8..9b70145015 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -253,6 +253,7 @@ include $(SRC_PATH)/tests/fate/xvid.mak FATE_FFMPEG += $(FATE_FFMPEG-yes) $(FATE_AVCONV) $(FATE_AVCONV-yes) FATE-$(CONFIG_FFMPEG) += $(FATE_FFMPEG) +FATE_FFPROBE += $(FATE_FFPROBE-yes) FATE-$(CONFIG_FFPROBE) += $(FATE_FFPROBE) FATE-$(call ALLYES, FFMPEG FFPROBE) += $(FATE_FFMPEG_FFPROBE) diff --git a/tests/fate/ffprobe.mak b/tests/fate/ffprobe.mak index f30cc2d4ba..23c6d3550d 100644 --- a/tests/fate/ffprobe.mak +++ b/tests/fate/ffprobe.mak @@ -10,41 +10,19 @@ tests/data/ffprobe-test.nut: ffmpeg$(PROGSSUF)$(EXESUF) tests/test_copy.ffmeta | FFPROBE_TEST_FILE=tests/data/ffprobe-test.nut FFPROBE_COMMAND=ffprobe$(PROGSSUF)$(EXESUF) -show_streams -show_packets -show_format -show_frames -bitexact $(TARGET_PATH)/$(FFPROBE_TEST_FILE) -print_filename $(FFPROBE_TEST_FILE) -FATE_FFPROBE-$(call ALLYES, AVDEVICE ARESAMPLE_FILTER) += fate-ffprobe_compact -fate-ffprobe_compact: $(FFPROBE_TEST_FILE) -fate-ffprobe_compact: CMD = run $(FFPROBE_COMMAND) -of compact +FFPROBE_OUTPUT_MODES_TESTS = $(addprefix fate-ffprobe_, compact csv default flat ini json xml) +$(FFPROBE_OUTPUT_MODES_TESTS): $(FFPROBE_TEST_FILE) +$(FFPROBE_OUTPUT_MODES_TESTS): CMD = run $(FFPROBE_COMMAND) -of $(@:fate-ffprobe_%=%) +FFPROBE_TEST_FILE_TESTS-yes += $(FFPROBE_OUTPUT_MODES_TESTS) -FATE_FFPROBE-$(call ALLYES, AVDEVICE ARESAMPLE_FILTER) += fate-ffprobe_csv -fate-ffprobe_csv: $(FFPROBE_TEST_FILE) -fate-ffprobe_csv: CMD = run $(FFPROBE_COMMAND) -of csv - -FATE_FFPROBE-$(call ALLYES, AVDEVICE ARESAMPLE_FILTER) += fate-ffprobe_default -fate-ffprobe_default: $(FFPROBE_TEST_FILE) -fate-ffprobe_default: CMD = run $(FFPROBE_COMMAND) -of default - -FATE_FFPROBE-$(call ALLYES, AVDEVICE ARESAMPLE_FILTER) += fate-ffprobe_flat -fate-ffprobe_flat: $(FFPROBE_TEST_FILE) -fate-ffprobe_flat: CMD = run $(FFPROBE_COMMAND) -of flat - -FATE_FFPROBE-$(call ALLYES, AVDEVICE ARESAMPLE_FILTER) += fate-ffprobe_ini -fate-ffprobe_ini: $(FFPROBE_TEST_FILE) -fate-ffprobe_ini: CMD = run $(FFPROBE_COMMAND) -of ini - -FATE_FFPROBE-$(call ALLYES, AVDEVICE ARESAMPLE_FILTER) += fate-ffprobe_json -fate-ffprobe_json: $(FFPROBE_TEST_FILE) -fate-ffprobe_json: CMD = run $(FFPROBE_COMMAND) -of json - -FATE_FFPROBE-$(call ALLYES, AVDEVICE ARESAMPLE_FILTER) += fate-ffprobe_xml -fate-ffprobe_xml: $(FFPROBE_TEST_FILE) -fate-ffprobe_xml: CMD = run $(FFPROBE_COMMAND) -of xml - -FATE_FFPROBE_SCHEMA-$(call ALLYES, AVDEVICE ARESAMPLE_FILTER) += fate-ffprobe_xsd +FFPROBE_TEST_FILE_TESTS-$(HAVE_XMLLINT) += fate-ffprobe_xsd fate-ffprobe_xsd: $(FFPROBE_TEST_FILE) fate-ffprobe_xsd: CMD = run $(FFPROBE_COMMAND) -noprivate -of xml=q=1:x=1 | \ xmllint --schema $(SRC_PATH)/doc/ffprobe.xsd - -FATE_FFPROBE-$(HAVE_XMLLINT) += $(FATE_FFPROBE_SCHEMA-yes) -FATE_FFPROBE += $(FATE_FFPROBE-yes) +FATE_FFPROBE-$(call FILTERDEMDECENCMUX, AEVALSRC TESTSRC ARESAMPLE, FFMETADATA, WRAPPED_AVFRAME, RAWVIDEO, NUT, \ +FFMPEG LAVFI_INDEV PCM_F64BE_DECODER PCM_F64LE_DECODER PCM_S16LE_ENCODER) \ ++= $(FFPROBE_TEST_FILE_TESTS-yes) -fate-ffprobe: $(FATE_FFPROBE) +fate-ffprobe: $(FATE_FFPROBE-yes) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled
ffmpeg | branch: master | Andreas Rheinhardt | Tue Mar 26 17:31:06 2024 +0100| [a5fcd978011e618e059d889fd82bad0161e5ab05] | committer: Andreas Rheinhardt avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled Reviewed-by: James Zern Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a5fcd978011e618e059d889fd82bad0161e5ab05 --- libavcodec/libvpxenc.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 635cdf7a0e..bcbdc4981e 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -49,6 +49,9 @@ #include "libavutil/opt.h" #include "libavutil/pixdesc.h" +#define IS_VP9(avctx) (CONFIG_LIBVPX_VP9_ENCODER && avctx->codec_id == AV_CODEC_ID_VP9) +#define IS_VP8(avctx) (CONFIG_LIBVPX_VP8_ENCODER && avctx->codec_id == AV_CODEC_ID_VP8) + /** * Portion of struct vpx_codec_cx_pkt from vpx_encoder.h. * One encoded frame returned from the library. @@ -359,8 +362,7 @@ static int frame_data_submit(AVCodecContext *avctx, AVFifo *fifo, FrameData fd = { .pts = frame->pts }; int ret; -#if CONFIG_LIBVPX_VP9_ENCODER -if (avctx->codec_id == AV_CODEC_ID_VP9 && +if (IS_VP9(avctx) && // Keep HDR10+ if it has bit depth higher than 8 and // it has PQ trc (SMPTE2084). enccfg->g_bit_depth > 8 && avctx->color_trc == AVCOL_TRC_SMPTE2084) { @@ -372,7 +374,6 @@ static int frame_data_submit(AVCodecContext *avctx, AVFifo *fifo, return AVERROR(ENOMEM); } } -#endif fd.duration = frame->duration; fd.frame_opaque = frame->opaque; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/vf_swapuv: Remove empty options and AVClass
ffmpeg | branch: master | Andreas Rheinhardt | Sat Sep 11 14:15:51 2021 +0200| [6260d4f770e06a646c33a63d1250dbfc289dc2a1] | committer: Andreas Rheinhardt avfilter/vf_swapuv: Remove empty options and AVClass This filter only had an AVClass and empty options because up until recently, avfilter_init_str() errored out when options were provided for a filter without an AVClass. But setting (generic) options is necessary to take advantage of timeline support. So with avfilter_init_str() fixed, the AVClass and the options can be removed. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6260d4f770e06a646c33a63d1250dbfc289dc2a1 --- libavfilter/vf_swapuv.c | 13 - 1 file changed, 13 deletions(-) diff --git a/libavfilter/vf_swapuv.c b/libavfilter/vf_swapuv.c index df04631d20..7965dc5dd1 100644 --- a/libavfilter/vf_swapuv.c +++ b/libavfilter/vf_swapuv.c @@ -23,23 +23,12 @@ * swap UV filter */ -#include "libavutil/opt.h" #include "libavutil/pixdesc.h" #include "avfilter.h" #include "formats.h" #include "internal.h" #include "video.h" -typedef struct SwapUVContext { -const AVClass *class; -} SwapUVContext; - -static const AVOption swapuv_options[] = { -{ NULL } -}; - -AVFILTER_DEFINE_CLASS(swapuv); - static void do_swap(AVFrame *frame) { FFSWAP(uint8_t*, frame->data[1], frame->data[2]); @@ -104,8 +93,6 @@ static const AVFilterPad swapuv_inputs[] = { const AVFilter ff_vf_swapuv = { .name = "swapuv", .description = NULL_IF_CONFIG_SMALL("Swap U and V components."), -.priv_size = sizeof(SwapUVContext), -.priv_class= &swapuv_class, FILTER_INPUTS(swapuv_inputs), FILTER_OUTPUTS(ff_video_default_filterpad), FILTER_QUERY_FUNC(query_formats), ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/proresdec2: Rename to proresdec
ffmpeg | branch: master | Andreas Rheinhardt | Sat Mar 30 05:31:35 2024 +0100| [e123295cc8701564e2c710ee95520b2fee7b57c9] | committer: Andreas Rheinhardt avcodec/proresdec2: Rename to proresdec Once upon a time, there used to be a LGPL and a GPL ProRes decoder in FFmpeg; the current decoder evolved from the second of these. But given that it is now the only ProRes decoder we have, it's file should simply be named proresdec.c (which also brings it in line with its header). Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e123295cc8701564e2c710ee95520b2fee7b57c9 --- libavcodec/Makefile | 2 +- libavcodec/{proresdec2.c => proresdec.c} | 0 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index eef936944d..8c8c2ce659 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -608,7 +608,7 @@ OBJS-$(CONFIG_PNG_DECODER) += png.o pngdec.o pngdsp.o OBJS-$(CONFIG_PNG_ENCODER) += png.o pngenc.o OBJS-$(CONFIG_PPM_DECODER) += pnmdec.o pnm.o OBJS-$(CONFIG_PPM_ENCODER) += pnmenc.o -OBJS-$(CONFIG_PRORES_DECODER) += proresdec2.o proresdsp.o proresdata.o +OBJS-$(CONFIG_PRORES_DECODER) += proresdec.o proresdsp.o proresdata.o OBJS-$(CONFIG_PRORES_ENCODER) += proresenc_anatoliy.o proresdata.o OBJS-$(CONFIG_PRORES_AW_ENCODER) += proresenc_anatoliy.o proresdata.o OBJS-$(CONFIG_PRORES_KS_ENCODER) += proresenc_kostya.o proresdata.o diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec.c similarity index 100% rename from libavcodec/proresdec2.c rename to libavcodec/proresdec.c ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/avfilter: Use AV_DICT_DONT_STRDUP_(KEY|VAL) when possible
ffmpeg | branch: master | Andreas Rheinhardt | Sat Sep 11 02:54:22 2021 +0200| [c96d0a0b850f7068cb1de2206dae02bf44514e57] | committer: Andreas Rheinhardt avfilter/avfilter: Use AV_DICT_DONT_STRDUP_(KEY|VAL) when possible Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c96d0a0b850f7068cb1de2206dae02bf44514e57 --- libavfilter/avfilter.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 856862a393..508fe1b26b 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -844,6 +844,7 @@ int ff_filter_opt_parse(void *logctx, const AVClass *priv_class, while (*args) { const char *shorthand = NULL; +int additional_flags = 0; if (priv_class) o = av_opt_next(&priv_class, o); @@ -869,7 +870,7 @@ int ff_filter_opt_parse(void *logctx, const AVClass *priv_class, args++; if (parsed_key) { key = parsed_key; - +additional_flags = AV_DICT_DONT_STRDUP_KEY; /* discard all remaining shorthand */ if (priv_class) while ((o = av_opt_next(&priv_class, o))); @@ -879,10 +880,8 @@ int ff_filter_opt_parse(void *logctx, const AVClass *priv_class, av_log(logctx, AV_LOG_DEBUG, "Setting '%s' to value '%s'\n", key, value); -av_dict_set(options, key, value, AV_DICT_MULTIKEY); - -av_free(value); -av_free(parsed_key); +av_dict_set(options, key, value, +additional_flags | AV_DICT_DONT_STRDUP_VAL | AV_DICT_MULTIKEY); } return 0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/avfilter: Honour the short options documentation
ffmpeg | branch: master | Andreas Rheinhardt | Sat Sep 11 13:07:00 2021 +0200| [0c800c0b48f94edfa82e4bd4579ef3f27fdc49c2] | committer: Andreas Rheinhardt avfilter/avfilter: Honour the short options documentation The documentation for filter arguments states that short options must precede long options (i.e. those of the form key=value). Yet if process_options() encounters arguments not abiding by this, it simply treats short options after a long option as if it were parsing short options for the first time. In particular, it overwrites options already set earlier, possibly via other short options. This is not how it is intended (as a comment in the code indicates). This commit modifies the code to reject further shorthand options after a long option has been encountered. After all, avfilter_init_str() errors out upon unrecognized options, so it is intended to be picky. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0c800c0b48f94edfa82e4bd4579ef3f27fdc49c2 --- libavfilter/avfilter.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 508fe1b26b..21d6832deb 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -846,9 +846,7 @@ int ff_filter_opt_parse(void *logctx, const AVClass *priv_class, const char *shorthand = NULL; int additional_flags = 0; -if (priv_class) -o = av_opt_next(&priv_class, o); -if (o) { +if (priv_class && (o = av_opt_next(&priv_class, o))) { if (o->type == AV_OPT_TYPE_CONST || o->offset == offset) continue; offset = o->offset; @@ -871,9 +869,7 @@ int ff_filter_opt_parse(void *logctx, const AVClass *priv_class, if (parsed_key) { key = parsed_key; additional_flags = AV_DICT_DONT_STRDUP_KEY; -/* discard all remaining shorthand */ -if (priv_class) -while ((o = av_opt_next(&priv_class, o))); +priv_class = NULL; /* reject all remaining shorthand */ } else { key = shorthand; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/vf_vflip: Remove empty options and AVClass
ffmpeg | branch: master | Andreas Rheinhardt | Sat Sep 11 14:15:51 2021 +0200| [99a200cad8b6c6853c17f8af1e8fe7498bc9c07a] | committer: Andreas Rheinhardt avfilter/vf_vflip: Remove empty options and AVClass This filter only had an AVClass and empty options because up until recently, avfilter_init_str() errored out when options were provided for a filter without an AVClass. But setting (generic) options is necessary to take advantage of timeline support. So with avfilter_init_str() fixed, the AVClass and the options can be removed. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=99a200cad8b6c6853c17f8af1e8fe7498bc9c07a --- libavfilter/vf_vflip.c | 9 - 1 file changed, 9 deletions(-) diff --git a/libavfilter/vf_vflip.c b/libavfilter/vf_vflip.c index 8d6724ed37..d72605bef0 100644 --- a/libavfilter/vf_vflip.c +++ b/libavfilter/vf_vflip.c @@ -24,24 +24,16 @@ */ #include "libavutil/internal.h" -#include "libavutil/opt.h" #include "libavutil/pixdesc.h" #include "avfilter.h" #include "internal.h" #include "video.h" typedef struct FlipContext { -const AVClass *class; int vsub; ///< vertical chroma subsampling int bayer; } FlipContext; -static const AVOption vflip_options[] = { -{ NULL } -}; - -AVFILTER_DEFINE_CLASS(vflip); - static int config_input(AVFilterLink *link) { FlipContext *flip = link->dst->priv; @@ -139,7 +131,6 @@ const AVFilter ff_vf_vflip = { .name= "vflip", .description = NULL_IF_CONFIG_SMALL("Flip the input video vertically."), .priv_size = sizeof(FlipContext), -.priv_class = &vflip_class, FILTER_INPUTS(avfilter_vf_vflip_inputs), FILTER_OUTPUTS(ff_video_default_filterpad), .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/tiff: Don't cast const away via bsearch
ffmpeg | branch: master | Andreas Rheinhardt | Sun Mar 31 01:14:20 2024 +0100| [abcb4b44f5d141b26f1b3104ae1c6dfdac33786d] | committer: Andreas Rheinhardt avcodec/tiff: Don't cast const away via bsearch Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=abcb4b44f5d141b26f1b3104ae1c6dfdac33786d --- libavcodec/tiff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 1b934457b5..19301d9e49 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -176,7 +176,7 @@ static int cmp_id_key(const void *id, const void *k) static const char *search_keyval(const TiffGeoTagKeyName *keys, int n, int id) { -TiffGeoTagKeyName *r = bsearch(&id, keys, n, sizeof(keys[0]), cmp_id_key); +const TiffGeoTagKeyName *r = bsearch(&id, keys, n, sizeof(keys[0]), cmp_id_key); if(r) return r->name; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/vf_grayworld: Remove empty options and AVClass
ffmpeg | branch: master | Andreas Rheinhardt | Sat Sep 11 14:15:51 2021 +0200| [8d3fdb42c03084f84101edad9f49cc3e01e1d2da] | committer: Andreas Rheinhardt avfilter/vf_grayworld: Remove empty options and AVClass This filter only had an AVClass and empty options because up until recently, avfilter_init_str() errored out when options were provided for a filter without an AVClass. But setting (generic) options is necessary to take advantage of timeline support. So with avfilter_init_str() fixed, the AVClass and the options can be removed. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8d3fdb42c03084f84101edad9f49cc3e01e1d2da --- libavfilter/vf_grayworld.c | 11 --- 1 file changed, 11 deletions(-) diff --git a/libavfilter/vf_grayworld.c b/libavfilter/vf_grayworld.c index 61ed832253..0b6d673168 100644 --- a/libavfilter/vf_grayworld.c +++ b/libavfilter/vf_grayworld.c @@ -27,7 +27,6 @@ #include "libavutil/imgutils.h" #include "libavutil/mem.h" -#include "libavutil/opt.h" #include "avfilter.h" #include "internal.h" @@ -41,20 +40,11 @@ typedef struct ThreadData { } ThreadData; typedef struct GrayWorldContext { -const AVClass *class; float *tmpplab; int *line_count_pels; float *line_sum; } GrayWorldContext; -#define OFFSET(x) offsetof(GrayWorldContext, x) -#define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_RUNTIME_PARAM -static const AVOption grayworld_options[] = { -{ NULL } -}; - -AVFILTER_DEFINE_CLASS(grayworld); - static void apply_matrix(const float matrix[3][3], const float input[3], float output[3]) { output[0] = matrix[0][0] * input[0] + matrix[0][1] * input[1] + matrix[0][2] * input[2]; @@ -311,7 +301,6 @@ const AVFilter ff_vf_grayworld = { .name = "grayworld", .description = NULL_IF_CONFIG_SMALL("Adjust white balance using LAB gray world algorithm"), .priv_size = sizeof(GrayWorldContext), -.priv_class= &grayworld_class, FILTER_INPUTS(grayworld_inputs), FILTER_OUTPUTS(ff_video_default_filterpad), FILTER_PIXFMTS(AV_PIX_FMT_GBRPF32, AV_PIX_FMT_GBRAPF32), ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/vf_hflip: Remove empty options and AVClass
ffmpeg | branch: master | Andreas Rheinhardt | Sat Sep 11 14:15:51 2021 +0200| [de288e406ab2290477d753be3b584f86003125be] | committer: Andreas Rheinhardt avfilter/vf_hflip: Remove empty options and AVClass This filter only had an AVClass and empty options because up until recently, avfilter_init_str() errored out when options were provided for a filter without an AVClass. But setting (generic) options is necessary to take advantage of timeline support. So with avfilter_init_str() fixed, the AVClass and the options can be removed. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=de288e406ab2290477d753be3b584f86003125be --- libavfilter/hflip.h | 3 +-- libavfilter/vf_hflip.c | 8 libavfilter/vf_hflip_init.h | 1 + 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/libavfilter/hflip.h b/libavfilter/hflip.h index 8532dc0f46..0d8b1025f3 100644 --- a/libavfilter/hflip.h +++ b/libavfilter/hflip.h @@ -22,10 +22,9 @@ #ifndef AVFILTER_HFLIP_H #define AVFILTER_HFLIP_H -#include "avfilter.h" +#include typedef struct FlipContext { -const AVClass *class; int max_step[4];///< max pixel step for each plane, expressed as a number of bytes int bayer_plus1;///< 1 .. not a Bayer input format, 2 .. Bayer input format int planewidth[4]; ///< width of each plane diff --git a/libavfilter/vf_hflip.c b/libavfilter/vf_hflip.c index 09f4e08ea3..9f5958a392 100644 --- a/libavfilter/vf_hflip.c +++ b/libavfilter/vf_hflip.c @@ -26,7 +26,6 @@ #include -#include "libavutil/opt.h" #include "avfilter.h" #include "formats.h" #include "hflip.h" @@ -38,12 +37,6 @@ #include "libavutil/intreadwrite.h" #include "libavutil/imgutils.h" -static const AVOption hflip_options[] = { -{ NULL } -}; - -AVFILTER_DEFINE_CLASS(hflip); - static int query_formats(AVFilterContext *ctx) { AVFilterFormats *pix_fmts = NULL; @@ -155,7 +148,6 @@ const AVFilter ff_vf_hflip = { .name = "hflip", .description = NULL_IF_CONFIG_SMALL("Horizontally flip the input video."), .priv_size = sizeof(FlipContext), -.priv_class= &hflip_class, FILTER_INPUTS(avfilter_vf_hflip_inputs), FILTER_OUTPUTS(ff_video_default_filterpad), FILTER_QUERY_FUNC(query_formats), diff --git a/libavfilter/vf_hflip_init.h b/libavfilter/vf_hflip_init.h index d0319f463d..5c1d69b2b6 100644 --- a/libavfilter/vf_hflip_init.h +++ b/libavfilter/vf_hflip_init.h @@ -26,6 +26,7 @@ #include "config.h" #include "libavutil/attributes.h" +#include "libavutil/error.h" #include "libavutil/intreadwrite.h" #include "hflip.h" ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/avfilter: Don't use av_uninit
ffmpeg | branch: master | Andreas Rheinhardt | Sun Mar 31 06:38:50 2024 +0200| [7895d1860f157e8a52a8e23f062fc7518cbed911] | committer: Andreas Rheinhardt avfilter/avfilter: Don't use av_uninit GCC 9-13 do not emit warnings for this at all optimization levels even when -Wmaybe-uninitialized is not disabled. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7895d1860f157e8a52a8e23f062fc7518cbed911 --- libavfilter/avfilter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 21d6832deb..7f94e71fbc 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -835,14 +835,14 @@ int ff_filter_opt_parse(void *logctx, const AVClass *priv_class, { const AVOption *o = NULL; int ret; -char *av_uninit(parsed_key), *av_uninit(value); -const char *key; int offset= -1; if (!args) return 0; while (*args) { +char *parsed_key, *value; +const char *key; const char *shorthand = NULL; int additional_flags = 0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] configure: Add missing libdav1d/av1 decoders->dovi_rpu dependency
ffmpeg | branch: master | Andreas Rheinhardt | Wed Apr 3 19:59:20 2024 +0200| [924402f783d7d056eefa5c065504fbae2731235b] | committer: Andreas Rheinhardt configure: Add missing libdav1d/av1 decoders->dovi_rpu dependency Reviewed-by: James Almer Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=924402f783d7d056eefa5c065504fbae2731235b --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 1c5b4f3fa4..71386c3920 100755 --- a/configure +++ b/configure @@ -2898,7 +2898,7 @@ asv1_encoder_select="aandcttables bswapdsp fdctdsp pixblockdsp" asv2_decoder_select="blockdsp bswapdsp idctdsp" asv2_encoder_select="aandcttables bswapdsp fdctdsp pixblockdsp" atrac1_decoder_select="sinewin" -av1_decoder_select="cbs_av1 atsc_a53" +av1_decoder_select="atsc_a53 cbs_av1 dovi_rpu" bink_decoder_select="blockdsp hpeldsp" binkaudio_dct_decoder_select="wma_freqs" binkaudio_rdft_decoder_select="wma_freqs" @@ -3487,7 +3487,7 @@ libcelt_decoder_deps="libcelt" libcodec2_decoder_deps="libcodec2" libcodec2_encoder_deps="libcodec2" libdav1d_decoder_deps="libdav1d" -libdav1d_decoder_select="atsc_a53" +libdav1d_decoder_select="atsc_a53 dovi_rpu" libdavs2_decoder_deps="libdavs2" libdavs2_decoder_select="avs2_parser" libfdk_aac_decoder_deps="libfdk_aac" ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] configure: Add missing libdav1d/av1 decoders->dovi_rpu dependency
ffmpeg | branch: release/7.0 | Andreas Rheinhardt | Wed Apr 3 19:59:20 2024 +0200| [fd8fb39af984b575efdb6ddf28ec1e3d1f855ad1] | committer: Andreas Rheinhardt configure: Add missing libdav1d/av1 decoders->dovi_rpu dependency Reviewed-by: James Almer Signed-off-by: Andreas Rheinhardt (cherry picked from commit 924402f783d7d056eefa5c065504fbae2731235b) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fd8fb39af984b575efdb6ddf28ec1e3d1f855ad1 --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 2a1d22310b..69db402b9a 100755 --- a/configure +++ b/configure @@ -2894,7 +2894,7 @@ asv1_encoder_select="aandcttables bswapdsp fdctdsp pixblockdsp" asv2_decoder_select="blockdsp bswapdsp idctdsp" asv2_encoder_select="aandcttables bswapdsp fdctdsp pixblockdsp" atrac1_decoder_select="sinewin" -av1_decoder_select="cbs_av1 atsc_a53" +av1_decoder_select="atsc_a53 cbs_av1 dovi_rpu" bink_decoder_select="blockdsp hpeldsp" binkaudio_dct_decoder_select="wma_freqs" binkaudio_rdft_decoder_select="wma_freqs" @@ -3483,7 +3483,7 @@ libcelt_decoder_deps="libcelt" libcodec2_decoder_deps="libcodec2" libcodec2_encoder_deps="libcodec2" libdav1d_decoder_deps="libdav1d" -libdav1d_decoder_select="atsc_a53" +libdav1d_decoder_select="atsc_a53 dovi_rpu" libdavs2_decoder_deps="libdavs2" libdavs2_decoder_select="avs2_parser" libfdk_aac_decoder_deps="libfdk_aac" ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/options_table: map IPT-C2, YCgCo-R variants in colorspace
ffmpeg | branch: master | Jan Ekström | Fri Mar 29 00:52:53 2024 +0200| [06c53efd233340762535957ad765ed4d9aafcddd] | committer: Jan Ekström avcodec/options_table: map IPT-C2, YCgCo-R variants in colorspace > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=06c53efd233340762535957ad765ed4d9aafcddd --- libavcodec/options_table.h | 3 +++ libavcodec/version.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index 7a2ef3474e..7a70fa7b6c 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -331,8 +331,11 @@ static const AVOption avcodec_options[] = { {"chroma-derived-nc", "Chroma-derived NCL", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_CHROMA_DERIVED_NCL }, INT_MIN, INT_MAX, V|E|D, .unit = "colorspace_type"}, {"chroma-derived-c", "Chroma-derived CL", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_CHROMA_DERIVED_CL }, INT_MIN, INT_MAX, V|E|D, .unit = "colorspace_type"}, {"ictcp", "ICtCp", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_ICTCP }, INT_MIN, INT_MAX, V|E|D, .unit = "colorspace_type"}, +{"ipt-c2","IPT-C2", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_IPT_C2 }, INT_MIN, INT_MAX, V|E|D, .unit = "colorspace_type"}, {"unspecified", "Unspecified",0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_UNSPECIFIED },INT_MIN, INT_MAX, V|E|D, .unit = "colorspace_type"}, {"ycocg", "YCGCO", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_YCGCO }, INT_MIN, INT_MAX, V|E|D, .unit = "colorspace_type"}, +{"ycgco-re", "YCgCo-R, even add.", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_YCGCO_RE }, INT_MIN, INT_MAX, V|E|D, .unit = "colorspace_type"}, +{"ycgco-ro", "YCgCo-R, odd add.", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_YCGCO_RO }, INT_MIN, INT_MAX, V|E|D, .unit = "colorspace_type"}, {"bt2020_ncl","BT.2020 NCL",0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_BT2020_NCL }, INT_MIN, INT_MAX, V|E|D, .unit = "colorspace_type"}, {"bt2020_cl", "BT.2020 CL", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_BT2020_CL }, INT_MIN, INT_MAX, V|E|D, .unit = "colorspace_type"}, {"color_range", "color range", OFFSET(color_range), AV_OPT_TYPE_INT, {.i64 = AVCOL_RANGE_UNSPECIFIED }, 0, INT_MAX, V|E|D, .unit = "color_range_type"}, diff --git a/libavcodec/version.h b/libavcodec/version.h index 7aa95fc3f1..84a1c02ce4 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -30,7 +30,7 @@ #include "version_major.h" #define LIBAVCODEC_VERSION_MINOR 5 -#define LIBAVCODEC_VERSION_MICRO 100 +#define LIBAVCODEC_VERSION_MICRO 101 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avutil/pix{desc,fmt}: add new matrix coefficients from H.273 v3
ffmpeg | branch: master | Jan Ekström | Fri Mar 29 00:42:10 2024 +0200| [29561c8e2d4ccecaa93afcaed73678e3f6011b0a] | committer: Jan Ekström avutil/pix{desc,fmt}: add new matrix coefficients from H.273 v3 * SMPTE ST 2128 IPT-C2 defines the coefficients utilized in DoVi Profile 5. Profile 5 can thus now be represented in VUI as {AVCOL_RANGE_JPEG, AVCOL_PRI_BT2020, AVCOL_TRC_SMPTE2084, AVCOL_SPC_IPT_C2, AVCHROMA_LOC_LEFT} (although other chroma sample locations are allowed). AVCOL_TRC_SMPTE2084 should in this case be interpreted as 'PQ with reshaping'. * YCgCo-Re and YCgCo-Ro define the bitexact YCgCo-R, where the number of bits added to a source RGB bit depth is 2 (i.e., even) and 1 (i.e., odd), respectively. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=29561c8e2d4ccecaa93afcaed73678e3f6011b0a --- doc/APIchanges | 4 libavutil/pixdesc.c | 3 +++ libavutil/pixfmt.h | 3 +++ libavutil/version.h | 2 +- 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 7eda1321cb..0a39b6d7ab 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,10 @@ The last version increases of all libraries were on 2024-03-07 API changes, most recent first: +2024-04-03 - xx - lavu 59.13.100 - pixfmt.h + Add AVCOL_SPC_IPT_C2, AVCOL_SPC_YCGCO_RE and AVCOL_SPC_YCGCO_RO + to map new matrix coefficients defined by H.273 v3. + 2024-04-xx - xx - lavu 59.12.100 - dovi_meta.h Add AVDOVIMetadata.ext_block_{offset,size}, AVDOVIMetadata.num_ext_blocks, AVDOVIDmData and AVDOVIDmLevel{1..6,8..11,254..255}, av_dovi_get_ext() diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 9c708520b1..1c0bcf2232 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -2854,6 +2854,9 @@ static const char * const color_space_names[] = { [AVCOL_SPC_CHROMA_DERIVED_NCL] = "chroma-derived-nc", [AVCOL_SPC_CHROMA_DERIVED_CL] = "chroma-derived-c", [AVCOL_SPC_ICTCP] = "ictcp", +[AVCOL_SPC_IPT_C2] = "ipt-c2", +[AVCOL_SPC_YCGCO_RE] = "ycgco-re", +[AVCOL_SPC_YCGCO_RO] = "ycgco-ro", }; static const char * const chroma_location_names[] = { diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index 4aa20e4e58..a7f50e1690 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -623,6 +623,9 @@ enum AVColorSpace { AVCOL_SPC_CHROMA_DERIVED_NCL = 12, ///< Chromaticity-derived non-constant luminance system AVCOL_SPC_CHROMA_DERIVED_CL = 13, ///< Chromaticity-derived constant luminance system AVCOL_SPC_ICTCP = 14, ///< ITU-R BT.2100-0, ICtCp +AVCOL_SPC_IPT_C2 = 15, ///< SMPTE ST 2128, IPT-C2 +AVCOL_SPC_YCGCO_RE= 16, ///< YCgCo-R, even addition of bits +AVCOL_SPC_YCGCO_RO= 17, ///< YCgCo-R, odd addition of bits AVCOL_SPC_NB///< Not part of ABI }; diff --git a/libavutil/version.h b/libavutil/version.h index 1ed4090e96..da1a833255 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 59 -#define LIBAVUTIL_VERSION_MINOR 12 +#define LIBAVUTIL_VERSION_MINOR 13 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avfilter/{buffersrc,vf_setparams}: map IPT-C2, YCgCo-R variants
ffmpeg | branch: master | Jan Ekström | Fri Mar 29 00:58:53 2024 +0200| [23d1b50175a6d07a0e2301ead347e4812c8c5dc8] | committer: Jan Ekström avfilter/{buffersrc,vf_setparams}: map IPT-C2, YCgCo-R variants > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=23d1b50175a6d07a0e2301ead347e4812c8c5dc8 --- libavfilter/buffersrc.c| 3 +++ libavfilter/version.h | 2 +- libavfilter/vf_setparams.c | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c index 130751775a..bfe459c8aa 100644 --- a/libavfilter/buffersrc.c +++ b/libavfilter/buffersrc.c @@ -335,12 +335,15 @@ static const AVOption buffer_options[] = { { "smpte170m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_SMPTE170M}, INT_MIN, INT_MAX, V, .unit = "colorspace"}, { "smpte240m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_SMPTE240M}, INT_MIN, INT_MAX, V, .unit = "colorspace"}, { "ycgco", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_YCGCO}, INT_MIN, INT_MAX, V, .unit = "colorspace"}, +{ "ycgco-re",NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_YCGCO_RE}, INT_MIN, INT_MAX, V, .unit = "colorspace"}, +{ "ycgco-ro",NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_YCGCO_RO}, INT_MIN, INT_MAX, V, .unit = "colorspace"}, { "bt2020nc",NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_BT2020_NCL},INT_MIN, INT_MAX, V, .unit = "colorspace"}, { "bt2020c", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_BT2020_CL}, INT_MIN, INT_MAX, V, .unit = "colorspace"}, { "smpte2085", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_SMPTE2085}, INT_MIN, INT_MAX, V, .unit = "colorspace"}, { "chroma-derived-nc", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_CHROMA_DERIVED_NCL},INT_MIN, INT_MAX, V, .unit = "colorspace"}, { "chroma-derived-c", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_CHROMA_DERIVED_CL}, INT_MIN, INT_MAX, V, .unit = "colorspace"}, { "ictcp", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_ICTCP}, INT_MIN, INT_MAX, V, .unit = "colorspace"}, +{ "ipt-c2", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_IPT_C2}, INT_MIN, INT_MAX, V, .unit = "colorspace"}, { "range", "select color range", OFFSET(color_range), AV_OPT_TYPE_INT, {.i64=AVCOL_RANGE_UNSPECIFIED}, 0, AVCOL_RANGE_NB-1, V, .unit = "range"}, { "unspecified", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_UNSPECIFIED}, 0, 0, V, .unit = "range"}, { "unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_RANGE_UNSPECIFIED}, 0, 0, V, .unit = "range"}, diff --git a/libavfilter/version.h b/libavfilter/version.h index bece922c7f..408c700767 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -32,7 +32,7 @@ #include "version_major.h" #define LIBAVFILTER_VERSION_MINOR 2 -#define LIBAVFILTER_VERSION_MICRO 100 +#define LIBAVFILTER_VERSION_MICRO 101 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ diff --git a/libavfilter/vf_setparams.c b/libavfilter/vf_setparams.c index c96f4d314b..b7da8eb54b 100644 --- a/libavfilter/vf_setparams.c +++ b/libavfilter/vf_setparams.c @@ -110,12 +110,15 @@ static const AVOption setparams_options[] = { {"smpte170m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_SMPTE170M}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, {"smpte240m", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_SMPTE240M}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, {"ycgco", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_YCGCO}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, +{"ycgco-re", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_YCGCO_RE}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, +{"ycgco-ro", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_YCGCO_RO}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, {"bt2020nc", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_BT2020_NCL},INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, {"bt2020c",NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_BT2020_CL}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, {"smpte2085", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_SMPTE2085}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, {"chroma-derived-nc", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_CHROMA_DERIVED_NCL},INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, {"chroma-derived-c", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_CHROMA_DERIVED_CL}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, {"ictcp", NULL, 0, AV_OPT_TYPE_CONST, {.i64=AVCOL_SPC_ICTCP}, INT_MIN, INT_MAX, FLAGS, .unit = "colorspace"}, +
[FFmpeg-cvslog] avcodec/libx265: do not arbitrarily limit color values
ffmpeg | branch: master | Jan Ekström | Fri Mar 29 01:03:02 2024 +0200| [16128f3c5595012719db7ae7851964d5a961c160] | committer: Jan Ekström avcodec/libx265: do not arbitrarily limit color values Newer specifications such as H.273 have, and probably will further in the future add new values to these, so - instead of trying to update these limits - we should simply check if the values are not set to the value of "unspecified". This should allow newer avutil values such as IPT-C2 or YCgCo-R variants be passed to x265 itself, which apparently does its own validation further down the line. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=16128f3c5595012719db7ae7851964d5a961c160 --- libavcodec/libx265.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index 40ddce6030..0645cd2045 100644 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@ -316,12 +316,9 @@ FF_ENABLE_DEPRECATION_WARNINGS avctx->pix_fmt == AV_PIX_FMT_YUVJ422P || avctx->pix_fmt == AV_PIX_FMT_YUVJ444P; -if ((avctx->color_primaries <= AVCOL_PRI_SMPTE432 && - avctx->color_primaries != AVCOL_PRI_UNSPECIFIED) || -(avctx->color_trc <= AVCOL_TRC_ARIB_STD_B67 && - avctx->color_trc != AVCOL_TRC_UNSPECIFIED) || -(avctx->colorspace <= AVCOL_SPC_ICTCP && - avctx->colorspace != AVCOL_SPC_UNSPECIFIED)) { +if (avctx->color_primaries != AVCOL_PRI_UNSPECIFIED || +avctx->color_trc != AVCOL_TRC_UNSPECIFIED || +avctx->colorspace != AVCOL_SPC_UNSPECIFIED) { ctx->params->vui.bEnableColorDescriptionPresentFlag = 1; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] doc/developer: (security) researchers should be credited
ffmpeg | branch: master | Michael Niedermayer | Wed Apr 3 02:13:05 2024 +0200| [5a5422196d0283918a1aa996a81bd51522f34fda] | committer: Michael Niedermayer doc/developer: (security) researchers should be credited Reviewed-by: Tomas Härdin Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5a5422196d0283918a1aa996a81bd51522f34fda --- doc/developer.texi | 4 1 file changed, 4 insertions(+) diff --git a/doc/developer.texi b/doc/developer.texi index c86bb5820c..63835dfa06 100644 --- a/doc/developer.texi +++ b/doc/developer.texi @@ -390,6 +390,10 @@ If you apply a patch, send an answer to ffmpeg-devel (or wherever you got the patch from) saying that you applied the patch. +@subheading Credit any researchers +If a commit/patch fixes an issues found by some researcher, always credit the +researcher in the commit message for finding/reporting the issue. + @subheading Always wait long enough before pushing changes Do NOT commit to code actively maintained by others without permission. Send a patch to ffmpeg-devel. If no one answers within a reasonable ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] configure: Fix iamfdec dependencies
ffmpeg | branch: master | Andreas Rheinhardt | Wed Apr 3 21:34:54 2024 +0200| [9c4558b5963bbc47a03bb8f99d0a99d03c5fd734] | committer: Andreas Rheinhardt configure: Fix iamfdec dependencies Reviewed-by: James Almer Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9c4558b5963bbc47a03bb8f99d0a99d03c5fd734 --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 71386c3920..a393f6ea65 100755 --- a/configure +++ b/configure @@ -2854,6 +2854,7 @@ hevcparse_select="golomb" hevc_sei_select="atsc_a53 golomb" frame_thread_encoder_deps="encoders threads" iamfdec_deps="iamf" +iamfdec_select="iso_media mpeg4audio" iamfenc_deps="iamf" inflate_wrapper_deps="zlib" intrax8_select="blockdsp wmv2dsp" ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] configure: Only enable iamfdec, iamfenc when needed
ffmpeg | branch: master | Andreas Rheinhardt | Wed Apr 3 21:43:37 2024 +0200| [3fe28831edfe9cd58492abdca9564e444514678b] | committer: Andreas Rheinhardt configure: Only enable iamfdec, iamfenc when needed Since 591e27d1e7b21b66f81c53f381356c5e6f1f0451 they would always be compiled even when nothing uses them; for shared builds the default linker behaviour is to include them even when not needed. Reviewed-by: James Almer Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3fe28831edfe9cd58492abdca9564e444514678b --- configure | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/configure b/configure index a393f6ea65..29cc8773fd 100755 --- a/configure +++ b/configure @@ -3595,8 +3595,8 @@ gxf_muxer_select="pcm_rechunk_bsf" hds_muxer_select="flv_muxer" hls_demuxer_select="aac_demuxer ac3_demuxer adts_header ac3_parser eac3_demuxer mov_demuxer mpegts_demuxer" hls_muxer_select="mov_muxer mpegts_muxer" -iamf_demuxer_deps="iamfdec" -iamf_muxer_deps="iamfenc" +iamf_demuxer_select="iamfdec" +iamf_muxer_select="iamfenc" image2_alias_pix_demuxer_select="image2_demuxer" image2_brender_pix_demuxer_select="image2_demuxer" imf_demuxer_deps="libxml2" @@ -3612,8 +3612,9 @@ matroska_muxer_select="mpeg4audio riffenc aac_adtstoasc_bsf pgs_frame_merge_bsf mlp_demuxer_select="mlp_parser" mmf_muxer_select="riffenc" mov_demuxer_select="iso_media riffdec" -mov_demuxer_suggest="zlib" +mov_demuxer_suggest="iamfdec zlib" mov_muxer_select="iso_media riffenc rtpenc_chain vp9_superframe_bsf aac_adtstoasc_bsf ac3_parser" +mov_muxer_suggest="iamfenc" mp3_demuxer_select="mpegaudio_parser" mp3_muxer_select="mpegaudioheader" mp4_muxer_select="mov_muxer" @@ -4084,7 +4085,7 @@ enable asm enable debug enable doc enable faan faandct faanidct -enable iamf iamfdec iamfenc +enable iamf enable large_tests enable optimizations enable ptx_compression ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] configure: Fix iamfdec dependencies
ffmpeg | branch: release/7.0 | Andreas Rheinhardt | Wed Apr 3 21:34:54 2024 +0200| [aeff85620ac618df15e414d3a757ba9ad0076e8d] | committer: Andreas Rheinhardt configure: Fix iamfdec dependencies Reviewed-by: James Almer Signed-off-by: Andreas Rheinhardt (cherry picked from commit 9c4558b5963bbc47a03bb8f99d0a99d03c5fd734) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=aeff85620ac618df15e414d3a757ba9ad0076e8d --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 69db402b9a..4f5353f84b 100755 --- a/configure +++ b/configure @@ -2851,6 +2851,7 @@ h264_sei_select="atsc_a53 golomb" hevcparse_select="golomb" hevc_sei_select="atsc_a53 golomb" frame_thread_encoder_deps="encoders threads" +iamfdec_select="iso_media mpeg4audio" inflate_wrapper_deps="zlib" intrax8_select="blockdsp wmv2dsp" iso_media_select="mpeg4audio" ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/x86/mathops: clip constants used with shift instructions within inline assembly
ffmpeg | branch: release/4.3 | Rémi Denis-Courmont | Sun Jul 16 18:18:02 2023 +0300| [93ecf0893407ce3a996086847d36adcbe7afd960] | committer: James Almer avcodec/x86/mathops: clip constants used with shift instructions within inline assembly Fixes assembling with binutil as >= 2.41 Signed-off-by: James Almer (cherry picked from commit effadce6c756247ea8bae32dc13bb3e6f464f0eb) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=93ecf0893407ce3a996086847d36adcbe7afd960 --- libavcodec/x86/mathops.h | 26 +++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h index 6298f5ed19..ca7e2dffc1 100644 --- a/libavcodec/x86/mathops.h +++ b/libavcodec/x86/mathops.h @@ -35,12 +35,20 @@ static av_always_inline av_const int MULL(int a, int b, unsigned shift) { int rt, dummy; +if (__builtin_constant_p(shift)) __asm__ ( "imull %3 \n\t" "shrdl %4, %%edx, %%eax \n\t" :"=a"(rt), "=d"(dummy) -:"a"(a), "rm"(b), "ci"((uint8_t)shift) +:"a"(a), "rm"(b), "i"(shift & 0x1F) ); +else +__asm__ ( +"imull %3 \n\t" +"shrdl %4, %%edx, %%eax \n\t" +:"=a"(rt), "=d"(dummy) +:"a"(a), "rm"(b), "c"((uint8_t)shift) +); return rt; } @@ -113,19 +121,31 @@ __asm__ volatile(\ // avoid +32 for shift optimization (gcc should do that ...) #define NEG_SSR32 NEG_SSR32 static inline int32_t NEG_SSR32( int32_t a, int8_t s){ +if (__builtin_constant_p(s)) __asm__ ("sarl %1, %0\n\t" : "+r" (a) - : "ic" ((uint8_t)(-s)) + : "i" (-s & 0x1F) ); +else +__asm__ ("sarl %1, %0\n\t" + : "+r" (a) + : "c" ((uint8_t)(-s)) +); return a; } #define NEG_USR32 NEG_USR32 static inline uint32_t NEG_USR32(uint32_t a, int8_t s){ +if (__builtin_constant_p(s)) __asm__ ("shrl %1, %0\n\t" : "+r" (a) - : "ic" ((uint8_t)(-s)) + : "i" (-s & 0x1F) ); +else +__asm__ ("shrl %1, %0\n\t" + : "+r" (a) + : "c" ((uint8_t)(-s)) +); return a; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/pthread_frame: avoid leaving stale hwaccel state in worker threads
ffmpeg | branch: release/4.3 | Anton Khirnov | Fri Sep 2 22:21:27 2022 +0200| [031c9601d06759a748adc077f73e3005b5571be1] | committer: James Almer lavc/pthread_frame: avoid leaving stale hwaccel state in worker threads This state is not refcounted, so make sure it always has a well-defined owner. Remove the block added in 091341f2ab5bd35ca1a2aae90503adc74f8d3523, as this commit also solves that issue in a more general way. (cherry picked from commit cc867f2c09d2b69cee8a0eccd62aff002cbbfe11) Signed-off-by: Anton Khirnov (cherry picked from commit 35aa7e70e7ec350319e7634a30d8d8aa1e6ecdda) Signed-off-by: Anton Khirnov (cherry picked from commit 3bc28e9d1ab33627cea3c632dd6b0c33e22e93ba) Signed-off-by: Anton Khirnov (cherry picked from commit d4b7b3c03ee2baf0166ce49dff17ec9beff684db) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=031c9601d06759a748adc077f73e3005b5571be1 --- libavcodec/pthread_frame.c | 46 +++--- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c index 601f170447..f232e59b62 100644 --- a/libavcodec/pthread_frame.c +++ b/libavcodec/pthread_frame.c @@ -135,6 +135,12 @@ typedef struct FrameThreadContext { * Set for the first N packets, where N is the number of threads. * While it is set, ff_thread_en/decode_frame won't return any results. */ + +/* hwaccel state is temporarily stored here in order to transfer its ownership + * to the next decoding thread without the need for extra synchronization */ +const AVHWAccel *stash_hwaccel; +void*stash_hwaccel_context; +void*stash_hwaccel_priv; } FrameThreadContext; #define THREAD_SAFE_CALLBACKS(avctx) \ @@ -211,9 +217,17 @@ static attribute_align_arg void *frame_worker_thread(void *arg) ff_thread_finish_setup(avctx); if (p->hwaccel_serializing) { +/* wipe hwaccel state to avoid stale pointers lying around; + * the state was transferred to FrameThreadContext in + * ff_thread_finish_setup(), so nothing is leaked */ +avctx->hwaccel = NULL; +avctx->hwaccel_context = NULL; +avctx->internal->hwaccel_priv_data = NULL; + p->hwaccel_serializing = 0; pthread_mutex_unlock(&p->parent->hwaccel_mutex); } +av_assert0(!avctx->hwaccel); if (p->async_serializing) { p->async_serializing = 0; @@ -275,14 +289,10 @@ static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src, dst->color_range = src->color_range; dst->chroma_sample_location = src->chroma_sample_location; -dst->hwaccel = src->hwaccel; -dst->hwaccel_context = src->hwaccel_context; - dst->channels = src->channels; dst->sample_rate= src->sample_rate; dst->sample_fmt = src->sample_fmt; dst->channel_layout = src->channel_layout; -dst->internal->hwaccel_priv_data = src->internal->hwaccel_priv_data; if (!!dst->hw_frames_ctx != !!src->hw_frames_ctx || (dst->hw_frames_ctx && dst->hw_frames_ctx->data != src->hw_frames_ctx->data)) { @@ -426,6 +436,12 @@ static int submit_packet(PerThreadContext *p, AVCodecContext *user_avctx, pthread_mutex_unlock(&p->mutex); return err; } + +/* transfer hwaccel state stashed from previous thread, if any */ +av_assert0(!p->avctx->hwaccel); +FFSWAP(const AVHWAccel*, p->avctx->hwaccel, fctx->stash_hwaccel); +FFSWAP(void*,p->avctx->hwaccel_context, fctx->stash_hwaccel_context); +FFSWAP(void*,p->avctx->internal->hwaccel_priv_data, fctx->stash_hwaccel_priv); } av_packet_unref(&p->avpkt); @@ -627,6 +643,14 @@ void ff_thread_finish_setup(AVCodecContext *avctx) { async_lock(p->parent); } +/* save hwaccel state for passing to the next thread; + * this is done here so that this worker thread can wipe its own hwaccel + * state after decoding, without requiring synchronization */ +av_assert0(!p->parent->stash_hwaccel); +p->parent->stash_hwaccel = avctx->hwaccel; +p->parent->stash_hwaccel_context = avctx->hwaccel_context; +p->parent->stash_hwaccel_priv= avctx->internal->hwaccel_priv_data; + pthread_mutex_lock(&p->progress_mutex); if(atomic_load(&p->state) == STATE_SETUP_FINISHED){ av_log(avctx, AV_LOG_WARNING, "Multiple ff_thread_finish_setup() calls\n"); @@ -668,13 +692,6 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count) park_frame_worker_threads(fctx, thread_count); -if (fctx->prev_thread && avctx->internal->hwaccel_priv_data !=
[FFmpeg-cvslog] avcodec/x86/mathops: clip constants used with shift instructions within inline assembly
ffmpeg | branch: release/4.2 | Rémi Denis-Courmont | Sun Jul 16 18:18:02 2023 +0300| [4cfb8dbe10fb914976b1f2f2f7f4e524fccd3f45] | committer: James Almer avcodec/x86/mathops: clip constants used with shift instructions within inline assembly Fixes assembling with binutil as >= 2.41 Signed-off-by: James Almer (cherry picked from commit effadce6c756247ea8bae32dc13bb3e6f464f0eb) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4cfb8dbe10fb914976b1f2f2f7f4e524fccd3f45 --- libavcodec/x86/mathops.h | 26 +++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h index 6298f5ed19..ca7e2dffc1 100644 --- a/libavcodec/x86/mathops.h +++ b/libavcodec/x86/mathops.h @@ -35,12 +35,20 @@ static av_always_inline av_const int MULL(int a, int b, unsigned shift) { int rt, dummy; +if (__builtin_constant_p(shift)) __asm__ ( "imull %3 \n\t" "shrdl %4, %%edx, %%eax \n\t" :"=a"(rt), "=d"(dummy) -:"a"(a), "rm"(b), "ci"((uint8_t)shift) +:"a"(a), "rm"(b), "i"(shift & 0x1F) ); +else +__asm__ ( +"imull %3 \n\t" +"shrdl %4, %%edx, %%eax \n\t" +:"=a"(rt), "=d"(dummy) +:"a"(a), "rm"(b), "c"((uint8_t)shift) +); return rt; } @@ -113,19 +121,31 @@ __asm__ volatile(\ // avoid +32 for shift optimization (gcc should do that ...) #define NEG_SSR32 NEG_SSR32 static inline int32_t NEG_SSR32( int32_t a, int8_t s){ +if (__builtin_constant_p(s)) __asm__ ("sarl %1, %0\n\t" : "+r" (a) - : "ic" ((uint8_t)(-s)) + : "i" (-s & 0x1F) ); +else +__asm__ ("sarl %1, %0\n\t" + : "+r" (a) + : "c" ((uint8_t)(-s)) +); return a; } #define NEG_USR32 NEG_USR32 static inline uint32_t NEG_USR32(uint32_t a, int8_t s){ +if (__builtin_constant_p(s)) __asm__ ("shrl %1, %0\n\t" : "+r" (a) - : "ic" ((uint8_t)(-s)) + : "i" (-s & 0x1F) ); +else +__asm__ ("shrl %1, %0\n\t" + : "+r" (a) + : "c" ((uint8_t)(-s)) +); return a; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/x86/mathops: clip constants used with shift instructions within inline assembly
ffmpeg | branch: release/4.1 | Rémi Denis-Courmont | Sun Jul 16 18:18:02 2023 +0300| [7ef6f317f8f90eb34d97e016af02905898827dc4] | committer: James Almer avcodec/x86/mathops: clip constants used with shift instructions within inline assembly Fixes assembling with binutil as >= 2.41 Signed-off-by: James Almer (cherry picked from commit effadce6c756247ea8bae32dc13bb3e6f464f0eb) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7ef6f317f8f90eb34d97e016af02905898827dc4 --- libavcodec/x86/mathops.h | 26 +++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h index 6298f5ed19..ca7e2dffc1 100644 --- a/libavcodec/x86/mathops.h +++ b/libavcodec/x86/mathops.h @@ -35,12 +35,20 @@ static av_always_inline av_const int MULL(int a, int b, unsigned shift) { int rt, dummy; +if (__builtin_constant_p(shift)) __asm__ ( "imull %3 \n\t" "shrdl %4, %%edx, %%eax \n\t" :"=a"(rt), "=d"(dummy) -:"a"(a), "rm"(b), "ci"((uint8_t)shift) +:"a"(a), "rm"(b), "i"(shift & 0x1F) ); +else +__asm__ ( +"imull %3 \n\t" +"shrdl %4, %%edx, %%eax \n\t" +:"=a"(rt), "=d"(dummy) +:"a"(a), "rm"(b), "c"((uint8_t)shift) +); return rt; } @@ -113,19 +121,31 @@ __asm__ volatile(\ // avoid +32 for shift optimization (gcc should do that ...) #define NEG_SSR32 NEG_SSR32 static inline int32_t NEG_SSR32( int32_t a, int8_t s){ +if (__builtin_constant_p(s)) __asm__ ("sarl %1, %0\n\t" : "+r" (a) - : "ic" ((uint8_t)(-s)) + : "i" (-s & 0x1F) ); +else +__asm__ ("sarl %1, %0\n\t" + : "+r" (a) + : "c" ((uint8_t)(-s)) +); return a; } #define NEG_USR32 NEG_USR32 static inline uint32_t NEG_USR32(uint32_t a, int8_t s){ +if (__builtin_constant_p(s)) __asm__ ("shrl %1, %0\n\t" : "+r" (a) - : "ic" ((uint8_t)(-s)) + : "i" (-s & 0x1F) ); +else +__asm__ ("shrl %1, %0\n\t" + : "+r" (a) + : "c" ((uint8_t)(-s)) +); return a; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/vvc/vvc_inter_template: Fix left shift of negative number
ffmpeg | branch: master | Andreas Rheinhardt | Thu Apr 4 04:00:20 2024 +0200| [9309b5bc64a9c18eb5973953532ef6029be384de] | committer: Nuo Mi avcodec/vvc/vvc_inter_template: Fix left shift of negative number Affected the vvc-conformance-WP_A_3 FATE test. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9309b5bc64a9c18eb5973953532ef6029be384de --- libavcodec/vvc/vvc_inter_template.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vvc/vvc_inter_template.c b/libavcodec/vvc/vvc_inter_template.c index e5cff079fb..e2fbfd4fc0 100644 --- a/libavcodec/vvc/vvc_inter_template.c +++ b/libavcodec/vvc/vvc_inter_template.c @@ -46,7 +46,7 @@ static void FUNC(w_avg)(uint8_t *_dst, const ptrdiff_t _dst_stride, pixel *dst = (pixel*)_dst; const ptrdiff_t dst_stride = _dst_stride / sizeof(pixel); const int shift = denom + FFMAX(3, 15 - BIT_DEPTH); -const int offset= (((o0 + o1) << (BIT_DEPTH - 8)) + 1) << (shift - 1); +const int offset= ((o0 + o1) * (1 << (BIT_DEPTH - 8)) + 1) * (1 << (shift - 1)); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".