[FFmpeg-cvslog] lavu/frame: add side data descriptors
ffmpeg | branch: master | Anton Khirnov | Sat Mar 23 13:41:20 2024 +0100| [2621be35397291c03c9a48c28e9283404899868a] | committer: Anton Khirnov lavu/frame: add side data descriptors They allow exporting extended information about side data types. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2621be35397291c03c9a48c28e9283404899868a --- doc/APIchanges | 4 +++ libavutil/frame.c | 70 ++--- libavutil/frame.h | 37 libavutil/version.h | 2 +- 4 files changed, 82 insertions(+), 31 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 44858b283e..aa102b4925 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-03-27 - xx - lavu 59.10.100 - frame.h + Add AVSideDataDescriptor, enum AVSideDataProps, and + av_frame_side_data_desc(). + 8< - FFmpeg 7.0 was cut here 8< - 2024-03-25 - 5df901ffa56 - lavu 59.7.100 - timestamp.h diff --git a/libavutil/frame.c b/libavutil/frame.c index d7a32cdc92..ef1613c344 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -28,6 +28,36 @@ #include "samplefmt.h" #include "hwcontext.h" +static const AVSideDataDescriptor sd_props[] = { +[AV_FRAME_DATA_PANSCAN] = { "AVPanScan" }, +[AV_FRAME_DATA_A53_CC] = { "ATSC A53 Part 4 Closed Captions" }, +[AV_FRAME_DATA_MATRIXENCODING] = { "AVMatrixEncoding" }, +[AV_FRAME_DATA_DOWNMIX_INFO]= { "Metadata relevant to a downmix procedure" }, +[AV_FRAME_DATA_AFD] = { "Active format description" }, +[AV_FRAME_DATA_MOTION_VECTORS] = { "Motion vectors" }, +[AV_FRAME_DATA_SKIP_SAMPLES]= { "Skip samples" }, +[AV_FRAME_DATA_GOP_TIMECODE]= { "GOP timecode" }, +[AV_FRAME_DATA_S12M_TIMECODE] = { "SMPTE 12-1 timecode" }, +[AV_FRAME_DATA_DYNAMIC_HDR_PLUS]= { "HDR Dynamic Metadata SMPTE2094-40 (HDR10+)" }, +[AV_FRAME_DATA_DYNAMIC_HDR_VIVID] = { "HDR Dynamic Metadata CUVA 005.1 2021 (Vivid)" }, +[AV_FRAME_DATA_REGIONS_OF_INTEREST] = { "Regions Of Interest" }, +[AV_FRAME_DATA_VIDEO_ENC_PARAMS]= { "Video encoding parameters" }, +[AV_FRAME_DATA_FILM_GRAIN_PARAMS] = { "Film grain parameters" }, +[AV_FRAME_DATA_DETECTION_BBOXES]= { "Bounding boxes for object detection and classification" }, +[AV_FRAME_DATA_DOVI_RPU_BUFFER] = { "Dolby Vision RPU Data" }, +[AV_FRAME_DATA_DOVI_METADATA] = { "Dolby Vision Metadata" }, +[AV_FRAME_DATA_STEREO3D]= { "Stereo 3D", AV_SIDE_DATA_PROP_GLOBAL }, +[AV_FRAME_DATA_REPLAYGAIN] = { "AVReplayGain", AV_SIDE_DATA_PROP_GLOBAL }, +[AV_FRAME_DATA_DISPLAYMATRIX] = { "3x3 displaymatrix", AV_SIDE_DATA_PROP_GLOBAL }, +[AV_FRAME_DATA_AUDIO_SERVICE_TYPE] = { "Audio service type", AV_SIDE_DATA_PROP_GLOBAL }, +[AV_FRAME_DATA_MASTERING_DISPLAY_METADATA] = { "Mastering display metadata", AV_SIDE_DATA_PROP_GLOBAL }, +[AV_FRAME_DATA_CONTENT_LIGHT_LEVEL] = { "Content light level metadata", AV_SIDE_DATA_PROP_GLOBAL }, +[AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT] = { "Ambient viewing environment", AV_SIDE_DATA_PROP_GLOBAL }, +[AV_FRAME_DATA_SPHERICAL] = { "Spherical Mapping", AV_SIDE_DATA_PROP_GLOBAL }, +[AV_FRAME_DATA_ICC_PROFILE] = { "ICC profile", AV_SIDE_DATA_PROP_GLOBAL }, +[AV_FRAME_DATA_SEI_UNREGISTERED]= { "H.26[45] User Data Unregistered SEI message", AV_SIDE_DATA_PROP_MULTI }, +}; + static void get_frame_defaults(AVFrame *frame) { memset(frame, 0, sizeof(*frame)); @@ -896,40 +926,20 @@ void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type) remove_side_data(&frame->side_data, &frame->nb_side_data, type); } -const char *av_frame_side_data_name(enum AVFrameSideDataType type) +const AVSideDataDescriptor *av_frame_side_data_desc(enum AVFrameSideDataType type) { -switch(type) { -case AV_FRAME_DATA_PANSCAN: return "AVPanScan"; -case AV_FRAME_DATA_A53_CC: return "ATSC A53 Part 4 Closed Captions"; -case AV_FRAME_DATA_STEREO3D:return "Stereo 3D"; -case AV_FRAME_DATA_MATRIXENCODING: return "AVMatrixEncoding"; -case AV_FRAME_DATA_DOWNMIX_INFO:return "Metadata relevant to a downmix procedure"; -case AV_FRAME_DATA_REPLAYGAIN: return "AVReplayGain"; -case AV_FRAME_D
[FFmpeg-cvslog] fftools/ffmpeg_enc: move decoded_side_data setup out of video-only block
ffmpeg | branch: master | Anton Khirnov | Sat Mar 23 13:53:27 2024 +0100| [6f2cb0923c5a14a6bc2a616ac253ad0d872afd25] | committer: Anton Khirnov fftools/ffmpeg_enc: move decoded_side_data setup out of video-only block Nothing about this code is video-specific. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6f2cb0923c5a14a6bc2a616ac253ad0d872afd25 --- fftools/ffmpeg_enc.c | 41 + 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c index bcd88c7d3e..9397818acb 100644 --- a/fftools/ffmpeg_enc.c +++ b/fftools/ffmpeg_enc.c @@ -187,6 +187,27 @@ int enc_open(void *opaque, const AVFrame *frame) if (frame) { av_assert0(frame->opaque_ref); fd = (FrameData*)frame->opaque_ref->data; + +for (int i = 0; i < frame->nb_side_data; i++) { +const AVSideDataDescriptor *desc = av_frame_side_data_desc(frame->side_data[i]->type); + +if (!(desc->props & AV_SIDE_DATA_PROP_GLOBAL)) +continue; + +ret = av_frame_side_data_clone(&enc_ctx->decoded_side_data, + &enc_ctx->nb_decoded_side_data, + frame->side_data[i], + AV_FRAME_SIDE_DATA_FLAG_UNIQUE); +if (ret < 0) { +av_frame_side_data_free( +&enc_ctx->decoded_side_data, +&enc_ctx->nb_decoded_side_data); +av_log(NULL, AV_LOG_ERROR, +"failed to configure video encoder: %s!\n", +av_err2str(ret)); +return ret; +} +} } ret = set_encoder_id(of, ost); @@ -246,26 +267,6 @@ int enc_open(void *opaque, const AVFrame *frame) enc_ctx->colorspace = frame->colorspace; enc_ctx->chroma_sample_location = frame->chroma_location; -for (int i = 0; i < frame->nb_side_data; i++) { -const AVSideDataDescriptor *desc = av_frame_side_data_desc(frame->side_data[i]->type); - -if (!(desc->props & AV_SIDE_DATA_PROP_GLOBAL)) -continue; - -ret = av_frame_side_data_clone( -&enc_ctx->decoded_side_data, &enc_ctx->nb_decoded_side_data, -frame->side_data[i], AV_FRAME_SIDE_DATA_FLAG_UNIQUE); -if (ret < 0) { -av_frame_side_data_free( -&enc_ctx->decoded_side_data, -&enc_ctx->nb_decoded_side_data); -av_log(NULL, AV_LOG_ERROR, -"failed to configure video encoder: %s!\n", -av_err2str(ret)); -return ret; -} -} - if (enc_ctx->flags & (AV_CODEC_FLAG_INTERLACED_DCT | AV_CODEC_FLAG_INTERLACED_ME) || (frame->flags & AV_FRAME_FLAG_INTERLACED) #if FFMPEG_OPT_TOP ___ 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] fftools/ffmpeg_enc: simplify error handling for decoded_side_data setup
ffmpeg | branch: master | Anton Khirnov | Sat Mar 23 13:58:25 2024 +0100| [8fc1e1358b074d2e3655177faee8cde5857d59af] | committer: Anton Khirnov fftools/ffmpeg_enc: simplify error handling for decoded_side_data setup There is no need to free the already-added items, they will be freed alongside the codec context. There is also little point in an error message, as the only reason this can fail is malloc failure. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8fc1e1358b074d2e3655177faee8cde5857d59af --- fftools/ffmpeg_enc.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c index 9397818acb..260af435e9 100644 --- a/fftools/ffmpeg_enc.c +++ b/fftools/ffmpeg_enc.c @@ -198,15 +198,8 @@ int enc_open(void *opaque, const AVFrame *frame) &enc_ctx->nb_decoded_side_data, frame->side_data[i], AV_FRAME_SIDE_DATA_FLAG_UNIQUE); -if (ret < 0) { -av_frame_side_data_free( -&enc_ctx->decoded_side_data, -&enc_ctx->nb_decoded_side_data); -av_log(NULL, AV_LOG_ERROR, -"failed to configure video encoder: %s!\n", -av_err2str(ret)); +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] fftools/ffmpeg_enc: only promote first frame side data to global when meaningful
ffmpeg | branch: master | Anton Khirnov | Sat Mar 23 13:50:46 2024 +0100| [fabf148578c0d628a9207de3b60aba57ac1c4bc3] | committer: Anton Khirnov fftools/ffmpeg_enc: only promote first frame side data to global when meaningful Skip those side data types that do not make sense as global side data. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fabf148578c0d628a9207de3b60aba57ac1c4bc3 --- fftools/ffmpeg_enc.c | 5 + 1 file changed, 5 insertions(+) diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c index 5f7fcf8a5f..bcd88c7d3e 100644 --- a/fftools/ffmpeg_enc.c +++ b/fftools/ffmpeg_enc.c @@ -247,6 +247,11 @@ int enc_open(void *opaque, const AVFrame *frame) enc_ctx->chroma_sample_location = frame->chroma_location; for (int i = 0; i < frame->nb_side_data; i++) { +const AVSideDataDescriptor *desc = av_frame_side_data_desc(frame->side_data[i]->type); + +if (!(desc->props & AV_SIDE_DATA_PROP_GLOBAL)) +continue; + ret = av_frame_side_data_clone( &enc_ctx->decoded_side_data, &enc_ctx->nb_decoded_side_data, frame->side_data[i], AV_FRAME_SIDE_DATA_FLAG_UNIQUE); ___ 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] tests: Remove fate-libx265-hdr10
ffmpeg | branch: master | Zhao Zhili | Fri Mar 22 20:43:43 2024 +0800| [edb1f1bc09c7dd89d35da670d8b1f4366003df59] | committer: Zhao Zhili tests: Remove fate-libx265-hdr10 The test depends on the compile option of x265. It failed when HIGH_BIT_DEPTH isn't enabled. It also failed when asan is enabled because of memory issue inside of x265, which I don't think can be fixed within FFmpeg. Signed-off-by: Zhao Zhili > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=edb1f1bc09c7dd89d35da670d8b1f4366003df59 --- tests/fate/enc_external.mak | 5 - tests/ref/fate/libx265-hdr10 | 16 2 files changed, 21 deletions(-) diff --git a/tests/fate/enc_external.mak b/tests/fate/enc_external.mak index 30021efbcd..4095a4b51a 100644 --- a/tests/fate/enc_external.mak +++ b/tests/fate/enc_external.mak @@ -12,10 +12,5 @@ FATE_ENC_EXTERNAL-$(call ENCDEC, LIBX264 HEVC, MOV, LIBX264_HDR10 HEVC_DEMUXER H fate-libx264-hdr10: CMD = enc_external $(TARGET_SAMPLES)/hevc/hdr10_plus_h265_sample.hevc \ mp4 "-c:v libx264" "-show_frames -show_entries frame=side_data_list -of flat" -# test for x265 MDCV and CLL passthrough during encoding -FATE_ENC_EXTERNAL-$(call ENCDEC, LIBX265 HEVC, MOV, HEVC_DEMUXER) += fate-libx265-hdr10 -fate-libx265-hdr10: CMD = enc_external $(TARGET_SAMPLES)/hevc/hdr10_plus_h265_sample.hevc \ -mp4 "-c:v libx265" "-show_frames -show_entries frame=side_data_list -of flat" - FATE_SAMPLES_FFMPEG_FFPROBE += $(FATE_ENC_EXTERNAL-yes) fate-enc-external: $(FATE_ENC_EXTERNAL-yes) diff --git a/tests/ref/fate/libx265-hdr10 b/tests/ref/fate/libx265-hdr10 deleted file mode 100644 index 571c837cac..00 --- a/tests/ref/fate/libx265-hdr10 +++ /dev/null @@ -1,16 +0,0 @@ -frames.frame.0.side_data_list.side_data.0.side_data_type="H.26[45] User Data Unregistered SEI message" -frames.frame.0.side_data_list.side_data.1.side_data_type="H.26[45] User Data Unregistered SEI message" -frames.frame.0.side_data_list.side_data.2.side_data_type="Mastering display metadata" -frames.frame.0.side_data_list.side_data.2.red_x="13250/5" -frames.frame.0.side_data_list.side_data.2.red_y="34500/5" -frames.frame.0.side_data_list.side_data.2.green_x="7500/5" -frames.frame.0.side_data_list.side_data.2.green_y="3000/5" -frames.frame.0.side_data_list.side_data.2.blue_x="34000/5" -frames.frame.0.side_data_list.side_data.2.blue_y="16000/5" -frames.frame.0.side_data_list.side_data.2.white_point_x="15635/5" -frames.frame.0.side_data_list.side_data.2.white_point_y="16450/5" -frames.frame.0.side_data_list.side_data.2.min_luminance="50/1" -frames.frame.0.side_data_list.side_data.2.max_luminance="1000/1" -frames.frame.0.side_data_list.side_data.3.side_data_type="Content light level metadata" -frames.frame.0.side_data_list.side_data.3.max_content=1000 -frames.frame.0.side_data_list.side_data.3.max_average=200 ___ 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/h264_mp4toannexb: Fix heap buffer overflow
ffmpeg | branch: master | Zhao Zhili | Mon Mar 25 16:09:00 2024 +0800| [89e9486bc3da83ae031313c4b0224a7b46e83ab6] | committer: Zhao Zhili avcodec/h264_mp4toannexb: Fix heap buffer overflow Fixes: out of array write Fixes: 64407/clusterfuzz-testcase-minimized-ffmpeg_BSF_H264_MP4TOANNEXB_fuzzer-4966763443650560 mp4toannexb_filter counts the number of bytes needed in the first pass and allocate the memory, then do memcpy in the second pass. Update sps/pps size in the loop makes the count invalid in the case of SPS/PPS occur after IDR slice. This patch process in-band SPS/PPS before the two pass loops. Signed-off-by: Zhao Zhili > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=89e9486bc3da83ae031313c4b0224a7b46e83ab6 --- libavcodec/bsf/h264_mp4toannexb.c | 59 ++- 1 file changed, 46 insertions(+), 13 deletions(-) diff --git a/libavcodec/bsf/h264_mp4toannexb.c b/libavcodec/bsf/h264_mp4toannexb.c index 120241c892..92af6a6881 100644 --- a/libavcodec/bsf/h264_mp4toannexb.c +++ b/libavcodec/bsf/h264_mp4toannexb.c @@ -208,6 +208,49 @@ static int h264_mp4toannexb_save_ps(uint8_t **dst, int *dst_size, return 0; } +static int h264_mp4toannexb_filter_ps(H264BSFContext *s, + const uint8_t *buf, + const uint8_t *buf_end) +{ +int sps_count = 0; +int pps_count = 0; +uint8_t unit_type; + +do { +uint32_t nal_size = 0; + +/* possible overread ok due to padding */ +for (int i = 0; i < s->length_size; i++) +nal_size = (nal_size << 8) | buf[i]; + +buf += s->length_size; + +/* This check requires the cast as the right side might + * otherwise be promoted to an unsigned value. */ +if ((int64_t)nal_size > buf_end - buf) +return AVERROR_INVALIDDATA; + +if (!nal_size) +continue; + +unit_type = *buf & 0x1f; + +if (unit_type == H264_NAL_SPS) { +h264_mp4toannexb_save_ps(&s->sps, &s->sps_size, &s->sps_buf_size, buf, + nal_size, !sps_count); +sps_count++; +} else if (unit_type == H264_NAL_PPS) { +h264_mp4toannexb_save_ps(&s->pps, &s->pps_size, &s->pps_buf_size, buf, + nal_size, !pps_count); +pps_count++; +} + +buf += nal_size; +} while (buf < buf_end); + +return 0; +} + static int h264_mp4toannexb_init(AVBSFContext *ctx) { int extra_size = ctx->par_in->extradata_size; @@ -263,14 +306,14 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *opkt) } buf_end = in->data + in->size; +ret = h264_mp4toannexb_filter_ps(s, in->data, buf_end); +if (ret < 0) +goto fail; #define LOG_ONCE(...) \ if (j) \ av_log(__VA_ARGS__) for (int j = 0; j < 2; j++) { -int sps_count = 0; -int pps_count = 0; - buf = in->data; new_idr = s->new_idr; sps_seen = s->idr_sps_seen; @@ -301,18 +344,8 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *opkt) if (unit_type == H264_NAL_SPS) { sps_seen = new_idr = 1; -if (!j) { -h264_mp4toannexb_save_ps(&s->sps, &s->sps_size, &s->sps_buf_size, - buf, nal_size, !sps_count); -sps_count++; -} } else if (unit_type == H264_NAL_PPS) { pps_seen = new_idr = 1; -if (!j) { -h264_mp4toannexb_save_ps(&s->pps, &s->pps_size, &s->pps_buf_size, - buf, nal_size, !pps_count); -pps_count++; -} /* if SPS has not been seen yet, prepend the AVCC one to PPS */ if (!sps_seen) { if (!s->sps_size) { ___ 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/h264_mp4toannexb: Fix heap buffer overflow
ffmpeg | branch: release/7.0 | Zhao Zhili | Mon Mar 25 16:09:00 2024 +0800| [304208d40c9ad7ac1687a96734ec97cfb5791b2a] | committer: Zhao Zhili avcodec/h264_mp4toannexb: Fix heap buffer overflow Fixes: out of array write Fixes: 64407/clusterfuzz-testcase-minimized-ffmpeg_BSF_H264_MP4TOANNEXB_fuzzer-4966763443650560 mp4toannexb_filter counts the number of bytes needed in the first pass and allocate the memory, then do memcpy in the second pass. Update sps/pps size in the loop makes the count invalid in the case of SPS/PPS occur after IDR slice. This patch process in-band SPS/PPS before the two pass loops. Signed-off-by: Zhao Zhili (cherry picked from commit 89e9486bc3da83ae031313c4b0224a7b46e83ab6) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=304208d40c9ad7ac1687a96734ec97cfb5791b2a --- libavcodec/bsf/h264_mp4toannexb.c | 59 ++- 1 file changed, 46 insertions(+), 13 deletions(-) diff --git a/libavcodec/bsf/h264_mp4toannexb.c b/libavcodec/bsf/h264_mp4toannexb.c index 120241c892..92af6a6881 100644 --- a/libavcodec/bsf/h264_mp4toannexb.c +++ b/libavcodec/bsf/h264_mp4toannexb.c @@ -208,6 +208,49 @@ static int h264_mp4toannexb_save_ps(uint8_t **dst, int *dst_size, return 0; } +static int h264_mp4toannexb_filter_ps(H264BSFContext *s, + const uint8_t *buf, + const uint8_t *buf_end) +{ +int sps_count = 0; +int pps_count = 0; +uint8_t unit_type; + +do { +uint32_t nal_size = 0; + +/* possible overread ok due to padding */ +for (int i = 0; i < s->length_size; i++) +nal_size = (nal_size << 8) | buf[i]; + +buf += s->length_size; + +/* This check requires the cast as the right side might + * otherwise be promoted to an unsigned value. */ +if ((int64_t)nal_size > buf_end - buf) +return AVERROR_INVALIDDATA; + +if (!nal_size) +continue; + +unit_type = *buf & 0x1f; + +if (unit_type == H264_NAL_SPS) { +h264_mp4toannexb_save_ps(&s->sps, &s->sps_size, &s->sps_buf_size, buf, + nal_size, !sps_count); +sps_count++; +} else if (unit_type == H264_NAL_PPS) { +h264_mp4toannexb_save_ps(&s->pps, &s->pps_size, &s->pps_buf_size, buf, + nal_size, !pps_count); +pps_count++; +} + +buf += nal_size; +} while (buf < buf_end); + +return 0; +} + static int h264_mp4toannexb_init(AVBSFContext *ctx) { int extra_size = ctx->par_in->extradata_size; @@ -263,14 +306,14 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *opkt) } buf_end = in->data + in->size; +ret = h264_mp4toannexb_filter_ps(s, in->data, buf_end); +if (ret < 0) +goto fail; #define LOG_ONCE(...) \ if (j) \ av_log(__VA_ARGS__) for (int j = 0; j < 2; j++) { -int sps_count = 0; -int pps_count = 0; - buf = in->data; new_idr = s->new_idr; sps_seen = s->idr_sps_seen; @@ -301,18 +344,8 @@ static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *opkt) if (unit_type == H264_NAL_SPS) { sps_seen = new_idr = 1; -if (!j) { -h264_mp4toannexb_save_ps(&s->sps, &s->sps_size, &s->sps_buf_size, - buf, nal_size, !sps_count); -sps_count++; -} } else if (unit_type == H264_NAL_PPS) { pps_seen = new_idr = 1; -if (!j) { -h264_mp4toannexb_save_ps(&s->pps, &s->pps_size, &s->pps_buf_size, - buf, nal_size, !pps_count); -pps_count++; -} /* if SPS has not been seen yet, prepend the AVCC one to PPS */ if (!sps_seen) { if (!s->sps_size) { ___ 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] tests: Remove fate-libx265-hdr10
ffmpeg | branch: release/7.0 | Zhao Zhili | Fri Mar 22 20:43:43 2024 +0800| [6ceda546298145225345d7c40074ec934a0a05fc] | committer: Zhao Zhili tests: Remove fate-libx265-hdr10 The test depends on the compile option of x265. It failed when HIGH_BIT_DEPTH isn't enabled. It also failed when asan is enabled because of memory issue inside of x265, which I don't think can be fixed within FFmpeg. Signed-off-by: Zhao Zhili (cherry picked from commit edb1f1bc09c7dd89d35da670d8b1f4366003df59) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6ceda546298145225345d7c40074ec934a0a05fc --- tests/fate/enc_external.mak | 5 - tests/ref/fate/libx265-hdr10 | 16 2 files changed, 21 deletions(-) diff --git a/tests/fate/enc_external.mak b/tests/fate/enc_external.mak index 30021efbcd..4095a4b51a 100644 --- a/tests/fate/enc_external.mak +++ b/tests/fate/enc_external.mak @@ -12,10 +12,5 @@ FATE_ENC_EXTERNAL-$(call ENCDEC, LIBX264 HEVC, MOV, LIBX264_HDR10 HEVC_DEMUXER H fate-libx264-hdr10: CMD = enc_external $(TARGET_SAMPLES)/hevc/hdr10_plus_h265_sample.hevc \ mp4 "-c:v libx264" "-show_frames -show_entries frame=side_data_list -of flat" -# test for x265 MDCV and CLL passthrough during encoding -FATE_ENC_EXTERNAL-$(call ENCDEC, LIBX265 HEVC, MOV, HEVC_DEMUXER) += fate-libx265-hdr10 -fate-libx265-hdr10: CMD = enc_external $(TARGET_SAMPLES)/hevc/hdr10_plus_h265_sample.hevc \ -mp4 "-c:v libx265" "-show_frames -show_entries frame=side_data_list -of flat" - FATE_SAMPLES_FFMPEG_FFPROBE += $(FATE_ENC_EXTERNAL-yes) fate-enc-external: $(FATE_ENC_EXTERNAL-yes) diff --git a/tests/ref/fate/libx265-hdr10 b/tests/ref/fate/libx265-hdr10 deleted file mode 100644 index 571c837cac..00 --- a/tests/ref/fate/libx265-hdr10 +++ /dev/null @@ -1,16 +0,0 @@ -frames.frame.0.side_data_list.side_data.0.side_data_type="H.26[45] User Data Unregistered SEI message" -frames.frame.0.side_data_list.side_data.1.side_data_type="H.26[45] User Data Unregistered SEI message" -frames.frame.0.side_data_list.side_data.2.side_data_type="Mastering display metadata" -frames.frame.0.side_data_list.side_data.2.red_x="13250/5" -frames.frame.0.side_data_list.side_data.2.red_y="34500/5" -frames.frame.0.side_data_list.side_data.2.green_x="7500/5" -frames.frame.0.side_data_list.side_data.2.green_y="3000/5" -frames.frame.0.side_data_list.side_data.2.blue_x="34000/5" -frames.frame.0.side_data_list.side_data.2.blue_y="16000/5" -frames.frame.0.side_data_list.side_data.2.white_point_x="15635/5" -frames.frame.0.side_data_list.side_data.2.white_point_y="16450/5" -frames.frame.0.side_data_list.side_data.2.min_luminance="50/1" -frames.frame.0.side_data_list.side_data.2.max_luminance="1000/1" -frames.frame.0.side_data_list.side_data.3.side_data_type="Content light level metadata" -frames.frame.0.side_data_list.side_data.3.max_content=1000 -frames.frame.0.side_data_list.side_data.3.max_average=200 ___ 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/examples: Always use <> includes
ffmpeg | branch: master | Andreas Rheinhardt | Sun Mar 24 20:02:53 2024 +0100| [9223c92c889c37981ff1d1caaa99791182deebb7] | committer: Andreas Rheinhardt doc/examples: Always use <> includes Reviewed-by: Stefano Sabatini Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9223c92c889c37981ff1d1caaa99791182deebb7 --- doc/examples/filter_audio.c | 18 +- doc/examples/qsv_decode.c| 16 doc/examples/transcode_aac.c | 20 ++-- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/doc/examples/filter_audio.c b/doc/examples/filter_audio.c index 9e4039b900..8b237e2adf 100644 --- a/doc/examples/filter_audio.c +++ b/doc/examples/filter_audio.c @@ -41,15 +41,15 @@ #include #include -#include "libavutil/channel_layout.h" -#include "libavutil/md5.h" -#include "libavutil/mem.h" -#include "libavutil/opt.h" -#include "libavutil/samplefmt.h" - -#include "libavfilter/avfilter.h" -#include "libavfilter/buffersink.h" -#include "libavfilter/buffersrc.h" +#include +#include +#include +#include +#include + +#include +#include +#include #define INPUT_SAMPLERATE 48000 #define INPUT_FORMAT AV_SAMPLE_FMT_FLTP diff --git a/doc/examples/qsv_decode.c b/doc/examples/qsv_decode.c index 901eac3b27..5a6f3625aa 100644 --- a/doc/examples/qsv_decode.c +++ b/doc/examples/qsv_decode.c @@ -30,16 +30,16 @@ #include -#include "libavformat/avformat.h" -#include "libavformat/avio.h" +#include +#include -#include "libavcodec/avcodec.h" +#include -#include "libavutil/buffer.h" -#include "libavutil/error.h" -#include "libavutil/hwcontext.h" -#include "libavutil/hwcontext_qsv.h" -#include "libavutil/mem.h" +#include +#include +#include +#include +#include static int get_format(AVCodecContext *avctx, const enum AVPixelFormat *pix_fmts) { diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c index cf6edc9890..84caf612ac 100644 --- a/doc/examples/transcode_aac.c +++ b/doc/examples/transcode_aac.c @@ -29,19 +29,19 @@ #include -#include "libavformat/avformat.h" -#include "libavformat/avio.h" +#include +#include -#include "libavcodec/avcodec.h" +#include -#include "libavutil/audio_fifo.h" -#include "libavutil/avassert.h" -#include "libavutil/avstring.h" -#include "libavutil/channel_layout.h" -#include "libavutil/frame.h" -#include "libavutil/opt.h" +#include +#include +#include +#include +#include +#include -#include "libswresample/swresample.h" +#include /* The output bit rate in bit/s */ #define OUTPUT_BIT_RATE 96000 ___ 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/fifo, file: Remove unused headers
ffmpeg | branch: master | Andreas Rheinhardt | Sun Mar 24 22:25:58 2024 +0100| [8ca57fcf9ed327a6c2d9c5345be9b7e0724ca048] | committer: Andreas Rheinhardt avutil/fifo, file: Remove unused headers Forgotten in 4105899245d79976b4a1a230455066417f3f194d, 4c92fc02f850f4f813e8cef8f8f8ed37d498e090. Reviewed-by: Stefano Sabatini Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8ca57fcf9ed327a6c2d9c5345be9b7e0724ca048 --- libavutil/fifo.h | 4 libavutil/file.h | 1 - 2 files changed, 5 deletions(-) diff --git a/libavutil/fifo.h b/libavutil/fifo.h index 048298214a..f2206c35f5 100644 --- a/libavutil/fifo.h +++ b/libavutil/fifo.h @@ -26,10 +26,6 @@ #define AVUTIL_FIFO_H #include -#include - -#include "attributes.h" -#include "version.h" /** * @defgroup lavu_fifo AVFifo diff --git a/libavutil/file.h b/libavutil/file.h index b5a762c28f..fced170108 100644 --- a/libavutil/file.h +++ b/libavutil/file.h @@ -22,7 +22,6 @@ #include #include -#include "version.h" #include "attributes.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] avformat/mov: don't abort on duplicate Mastering Display Metadata boxes
ffmpeg | branch: master | James Almer | Tue Mar 26 21:11:20 2024 -0300| [189c32f53659b8f9dc402765905fc12a321ab1ac] | committer: James Almer avformat/mov: don't abort on duplicate Mastering Display Metadata boxes The VP9 spec defines a SmDm box for this information, and the ISOBMFF spec defines a mdvc one. If both are present, just ignore one of them. This is in line with clli and CoLL boxes. Fixes ticket #10711. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=189c32f53659b8f9dc402765905fc12a321ab1ac --- libavformat/mov.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index e7aa8d1833..5463f36770 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -6140,8 +6140,10 @@ static int mov_read_smdm(MOVContext *c, AVIOContext *pb, MOVAtom atom) av_log(c->fc, AV_LOG_WARNING, "Unsupported Mastering Display Metadata box version %d\n", version); return 0; } -if (sc->mastering) -return AVERROR_INVALIDDATA; +if (sc->mastering) { +av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display Metadata\n"); +return 0; +} avio_skip(pb, 3); /* flags */ @@ -6178,11 +6180,16 @@ static int mov_read_mdcv(MOVContext *c, AVIOContext *pb, MOVAtom atom) sc = c->fc->streams[c->fc->nb_streams - 1]->priv_data; -if (atom.size < 24 || sc->mastering) { +if (atom.size < 24) { av_log(c->fc, AV_LOG_ERROR, "Invalid Mastering Display Color Volume box\n"); return AVERROR_INVALIDDATA; } +if (sc->mastering) { +av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display Color Volume\n"); +return 0; +} + sc->mastering = av_mastering_display_metadata_alloc(); if (!sc->mastering) return AVERROR(ENOMEM); ___ 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/mov: don't abort on duplicate Mastering Display Metadata boxes
ffmpeg | branch: release/7.0 | James Almer | Tue Mar 26 21:11:20 2024 -0300| [9cfb29baa2c5fed75107bd9e3a3a3afabf2db3f4] | committer: James Almer avformat/mov: don't abort on duplicate Mastering Display Metadata boxes The VP9 spec defines a SmDm box for this information, and the ISOBMFF spec defines a mdvc one. If both are present, just ignore one of them. This is in line with clli and CoLL boxes. Fixes ticket #10711. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9cfb29baa2c5fed75107bd9e3a3a3afabf2db3f4 --- libavformat/mov.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index e7aa8d1833..5463f36770 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -6140,8 +6140,10 @@ static int mov_read_smdm(MOVContext *c, AVIOContext *pb, MOVAtom atom) av_log(c->fc, AV_LOG_WARNING, "Unsupported Mastering Display Metadata box version %d\n", version); return 0; } -if (sc->mastering) -return AVERROR_INVALIDDATA; +if (sc->mastering) { +av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display Metadata\n"); +return 0; +} avio_skip(pb, 3); /* flags */ @@ -6178,11 +6180,16 @@ static int mov_read_mdcv(MOVContext *c, AVIOContext *pb, MOVAtom atom) sc = c->fc->streams[c->fc->nb_streams - 1]->priv_data; -if (atom.size < 24 || sc->mastering) { +if (atom.size < 24) { av_log(c->fc, AV_LOG_ERROR, "Invalid Mastering Display Color Volume box\n"); return AVERROR_INVALIDDATA; } +if (sc->mastering) { +av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display Color Volume\n"); +return 0; +} + sc->mastering = av_mastering_display_metadata_alloc(); if (!sc->mastering) return AVERROR(ENOMEM); ___ 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/mov: don't abort on duplicate Mastering Display Metadata boxes
ffmpeg | branch: release/6.1 | James Almer | Tue Mar 26 21:11:20 2024 -0300| [f309408874a5d6ccc77063631fa78b8fb59937a0] | committer: James Almer avformat/mov: don't abort on duplicate Mastering Display Metadata boxes The VP9 spec defines a SmDm box for this information, and the ISOBMFF spec defines a mdvc one. If both are present, just ignore one of them. This is in line with clli and CoLL boxes. Fixes ticket #10711. Signed-off-by: James Almer (cherry picked from commit 189c32f53659b8f9dc402765905fc12a321ab1ac) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f309408874a5d6ccc77063631fa78b8fb59937a0 --- libavformat/mov.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 606fe22f71..9c535da082 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -5916,8 +5916,10 @@ static int mov_read_smdm(MOVContext *c, AVIOContext *pb, MOVAtom atom) av_log(c->fc, AV_LOG_WARNING, "Unsupported Mastering Display Metadata box version %d\n", version); return 0; } -if (sc->mastering) -return AVERROR_INVALIDDATA; +if (sc->mastering) { +av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display Metadata\n"); +return 0; +} avio_skip(pb, 3); /* flags */ @@ -5954,11 +5956,16 @@ static int mov_read_mdcv(MOVContext *c, AVIOContext *pb, MOVAtom atom) sc = c->fc->streams[c->fc->nb_streams - 1]->priv_data; -if (atom.size < 24 || sc->mastering) { +if (atom.size < 24) { av_log(c->fc, AV_LOG_ERROR, "Invalid Mastering Display Color Volume box\n"); return AVERROR_INVALIDDATA; } +if (sc->mastering) { +av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display Color Volume\n"); +return 0; +} + sc->mastering = av_mastering_display_metadata_alloc(); if (!sc->mastering) return AVERROR(ENOMEM); ___ 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/mov: don't abort on duplicate Mastering Display Metadata boxes
ffmpeg | branch: release/6.0 | James Almer | Tue Mar 26 21:11:20 2024 -0300| [59918c65ade229608f98418437e80337dfce713e] | committer: James Almer avformat/mov: don't abort on duplicate Mastering Display Metadata boxes The VP9 spec defines a SmDm box for this information, and the ISOBMFF spec defines a mdvc one. If both are present, just ignore one of them. This is in line with clli and CoLL boxes. Fixes ticket #10711. Signed-off-by: James Almer (cherry picked from commit 189c32f53659b8f9dc402765905fc12a321ab1ac) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=59918c65ade229608f98418437e80337dfce713e --- libavformat/mov.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 3aea3e6093..17d9068890 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -5750,8 +5750,10 @@ static int mov_read_smdm(MOVContext *c, AVIOContext *pb, MOVAtom atom) av_log(c->fc, AV_LOG_WARNING, "Unsupported Mastering Display Metadata box version %d\n", version); return 0; } -if (sc->mastering) -return AVERROR_INVALIDDATA; +if (sc->mastering) { +av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display Metadata\n"); +return 0; +} avio_skip(pb, 3); /* flags */ @@ -5788,11 +5790,16 @@ static int mov_read_mdcv(MOVContext *c, AVIOContext *pb, MOVAtom atom) sc = c->fc->streams[c->fc->nb_streams - 1]->priv_data; -if (atom.size < 24 || sc->mastering) { +if (atom.size < 24) { av_log(c->fc, AV_LOG_ERROR, "Invalid Mastering Display Color Volume box\n"); return AVERROR_INVALIDDATA; } +if (sc->mastering) { +av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display Color Volume\n"); +return 0; +} + sc->mastering = av_mastering_display_metadata_alloc(); if (!sc->mastering) return AVERROR(ENOMEM); ___ 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/mov: don't abort on duplicate Mastering Display Metadata boxes
ffmpeg | branch: release/5.1 | James Almer | Tue Mar 26 21:11:20 2024 -0300| [4ee74fc46d14dbacbdc8d4a13a2dfc61a2b7df35] | committer: James Almer avformat/mov: don't abort on duplicate Mastering Display Metadata boxes The VP9 spec defines a SmDm box for this information, and the ISOBMFF spec defines a mdvc one. If both are present, just ignore one of them. This is in line with clli and CoLL boxes. Fixes ticket #10711. Signed-off-by: James Almer (cherry picked from commit 189c32f53659b8f9dc402765905fc12a321ab1ac) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4ee74fc46d14dbacbdc8d4a13a2dfc61a2b7df35 --- libavformat/mov.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index ee4b62aa0c..acde75d9ff 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -5622,8 +5622,10 @@ static int mov_read_smdm(MOVContext *c, AVIOContext *pb, MOVAtom atom) av_log(c->fc, AV_LOG_WARNING, "Unsupported Mastering Display Metadata box version %d\n", version); return 0; } -if (sc->mastering) -return AVERROR_INVALIDDATA; +if (sc->mastering) { +av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display Metadata\n"); +return 0; +} avio_skip(pb, 3); /* flags */ @@ -5660,11 +5662,16 @@ static int mov_read_mdcv(MOVContext *c, AVIOContext *pb, MOVAtom atom) sc = c->fc->streams[c->fc->nb_streams - 1]->priv_data; -if (atom.size < 24 || sc->mastering) { +if (atom.size < 24) { av_log(c->fc, AV_LOG_ERROR, "Invalid Mastering Display Color Volume box\n"); return AVERROR_INVALIDDATA; } +if (sc->mastering) { +av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display Color Volume\n"); +return 0; +} + sc->mastering = av_mastering_display_metadata_alloc(); if (!sc->mastering) return AVERROR(ENOMEM); ___ 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/mov: don't abort on duplicate Mastering Display Metadata boxes
ffmpeg | branch: release/5.0 | James Almer | Tue Mar 26 21:11:20 2024 -0300| [09f9f1d7ee1379324480f7acf6bc3a761c7f2fd5] | committer: James Almer avformat/mov: don't abort on duplicate Mastering Display Metadata boxes The VP9 spec defines a SmDm box for this information, and the ISOBMFF spec defines a mdvc one. If both are present, just ignore one of them. This is in line with clli and CoLL boxes. Fixes ticket #10711. Signed-off-by: James Almer (cherry picked from commit 189c32f53659b8f9dc402765905fc12a321ab1ac) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=09f9f1d7ee1379324480f7acf6bc3a761c7f2fd5 --- libavformat/mov.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 4dc95c96a3..4ba73315d3 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -5423,8 +5423,10 @@ static int mov_read_smdm(MOVContext *c, AVIOContext *pb, MOVAtom atom) av_log(c->fc, AV_LOG_WARNING, "Unsupported Mastering Display Metadata box version %d\n", version); return 0; } -if (sc->mastering) -return AVERROR_INVALIDDATA; +if (sc->mastering) { +av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display Metadata\n"); +return 0; +} avio_skip(pb, 3); /* flags */ @@ -5461,11 +5463,16 @@ static int mov_read_mdcv(MOVContext *c, AVIOContext *pb, MOVAtom atom) sc = c->fc->streams[c->fc->nb_streams - 1]->priv_data; -if (atom.size < 24 || sc->mastering) { +if (atom.size < 24) { av_log(c->fc, AV_LOG_ERROR, "Invalid Mastering Display Color Volume box\n"); return AVERROR_INVALIDDATA; } +if (sc->mastering) { +av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display Color Volume\n"); +return 0; +} + sc->mastering = av_mastering_display_metadata_alloc(); if (!sc->mastering) return AVERROR(ENOMEM); ___ 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/mov: don't abort on duplicate Mastering Display Metadata boxes
ffmpeg | branch: release/4.4 | James Almer | Tue Mar 26 21:11:20 2024 -0300| [c2f678c307d27fd40cb54f685d48f18473ba1825] | committer: James Almer avformat/mov: don't abort on duplicate Mastering Display Metadata boxes The VP9 spec defines a SmDm box for this information, and the ISOBMFF spec defines a mdvc one. If both are present, just ignore one of them. This is in line with clli and CoLL boxes. Fixes ticket #10711. Signed-off-by: James Almer (cherry picked from commit 189c32f53659b8f9dc402765905fc12a321ab1ac) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c2f678c307d27fd40cb54f685d48f18473ba1825 --- libavformat/mov.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 3f41706004..569a1c58c7 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -5464,8 +5464,10 @@ static int mov_read_smdm(MOVContext *c, AVIOContext *pb, MOVAtom atom) av_log(c->fc, AV_LOG_WARNING, "Unsupported Mastering Display Metadata box version %d\n", version); return 0; } -if (sc->mastering) -return AVERROR_INVALIDDATA; +if (sc->mastering) { +av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display Metadata\n"); +return 0; +} avio_skip(pb, 3); /* flags */ @@ -5502,11 +5504,16 @@ static int mov_read_mdcv(MOVContext *c, AVIOContext *pb, MOVAtom atom) sc = c->fc->streams[c->fc->nb_streams - 1]->priv_data; -if (atom.size < 24 || sc->mastering) { +if (atom.size < 24) { av_log(c->fc, AV_LOG_ERROR, "Invalid Mastering Display Color Volume box\n"); return AVERROR_INVALIDDATA; } +if (sc->mastering) { +av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display Color Volume\n"); +return 0; +} + sc->mastering = av_mastering_display_metadata_alloc(); if (!sc->mastering) return AVERROR(ENOMEM); ___ 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/mov: don't abort on duplicate Mastering Display Metadata boxes
ffmpeg | branch: release/4.3 | James Almer | Tue Mar 26 21:11:20 2024 -0300| [4d2cc90fa42afe388ea11139e1697e98a7eeba6f] | committer: James Almer avformat/mov: don't abort on duplicate Mastering Display Metadata boxes The VP9 spec defines a SmDm box for this information, and the ISOBMFF spec defines a mdvc one. If both are present, just ignore one of them. This is in line with clli and CoLL boxes. Fixes ticket #10711. Signed-off-by: James Almer (cherry picked from commit 189c32f53659b8f9dc402765905fc12a321ab1ac) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4d2cc90fa42afe388ea11139e1697e98a7eeba6f --- libavformat/mov.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 64e4225212..87adb32309 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -5417,8 +5417,10 @@ static int mov_read_smdm(MOVContext *c, AVIOContext *pb, MOVAtom atom) av_log(c->fc, AV_LOG_WARNING, "Unsupported Mastering Display Metadata box version %d\n", version); return 0; } -if (sc->mastering) -return AVERROR_INVALIDDATA; +if (sc->mastering) { +av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display Metadata\n"); +return 0; +} avio_skip(pb, 3); /* flags */ @@ -5455,11 +5457,16 @@ static int mov_read_mdcv(MOVContext *c, AVIOContext *pb, MOVAtom atom) sc = c->fc->streams[c->fc->nb_streams - 1]->priv_data; -if (atom.size < 24 || sc->mastering) { +if (atom.size < 24) { av_log(c->fc, AV_LOG_ERROR, "Invalid Mastering Display Color Volume box\n"); return AVERROR_INVALIDDATA; } +if (sc->mastering) { +av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display Color Volume\n"); +return 0; +} + sc->mastering = av_mastering_display_metadata_alloc(); if (!sc->mastering) return AVERROR(ENOMEM); ___ 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/mov: don't abort on duplicate Mastering Display Metadata boxes
ffmpeg | branch: release/4.2 | James Almer | Tue Mar 26 21:11:20 2024 -0300| [ddb0efbbc101f503e5f39d2133f361b4298a90c9] | committer: James Almer avformat/mov: don't abort on duplicate Mastering Display Metadata boxes The VP9 spec defines a SmDm box for this information, and the ISOBMFF spec defines a mdvc one. If both are present, just ignore one of them. This is in line with clli and CoLL boxes. Fixes ticket #10711. Signed-off-by: James Almer (cherry picked from commit 189c32f53659b8f9dc402765905fc12a321ab1ac) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ddb0efbbc101f503e5f39d2133f361b4298a90c9 --- libavformat/mov.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index fd82ca460b..53bcbd6dc0 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -5352,8 +5352,10 @@ static int mov_read_smdm(MOVContext *c, AVIOContext *pb, MOVAtom atom) av_log(c->fc, AV_LOG_WARNING, "Unsupported Mastering Display Metadata box version %d\n", version); return 0; } -if (sc->mastering) -return AVERROR_INVALIDDATA; +if (sc->mastering) { +av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display Metadata\n"); +return 0; +} avio_skip(pb, 3); /* flags */ @@ -5390,11 +5392,16 @@ static int mov_read_mdcv(MOVContext *c, AVIOContext *pb, MOVAtom atom) sc = c->fc->streams[c->fc->nb_streams - 1]->priv_data; -if (atom.size < 24 || sc->mastering) { +if (atom.size < 24) { av_log(c->fc, AV_LOG_ERROR, "Invalid Mastering Display Color Volume box\n"); return AVERROR_INVALIDDATA; } +if (sc->mastering) { +av_log(c->fc, AV_LOG_WARNING, "Ignoring duplicate Mastering Display Color Volume\n"); +return 0; +} + sc->mastering = av_mastering_display_metadata_alloc(); if (!sc->mastering) return AVERROR(ENOMEM); ___ 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: properly reduce YUV colorspace format lists
ffmpeg | branch: master | Niklas Haas | Mon Mar 25 16:07:23 2024 +0100| [b89ee2653919c14193f646ba03b2bf1d13c9aa2d] | 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. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b89ee2653919c14193f646ba03b2bf1d13c9aa2d --- 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_fmts(graph); ___ ffmpeg-cvslog
[FFmpeg-cvslog] fftools/ffmpeg_sched: Explicitly return 0 on sch_enc_send() success
ffmpeg | branch: master | Andreas Rheinhardt | Mon Mar 25 02:15:34 2024 +0100| [432e287e27efa3e9bb19f85cbd3d617e6f33c220] | committer: Andreas Rheinhardt fftools/ffmpeg_sched: Explicitly return 0 on sch_enc_send() success Do not return the return value of the last enc_send_to_dst() call, as this would treat the last call differently from the earlier calls; furthermore, sch_enc_send() explicitly documents to always return 0 on success. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=432e287e27efa3e9bb19f85cbd3d617e6f33c220 --- fftools/ffmpeg_sched.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fftools/ffmpeg_sched.c b/fftools/ffmpeg_sched.c index ec88017e21..30b2355eb6 100644 --- a/fftools/ffmpeg_sched.c +++ b/fftools/ffmpeg_sched.c @@ -2344,15 +2344,13 @@ int sch_enc_send(Scheduler *sch, unsigned enc_idx, AVPacket *pkt) ret = enc_send_to_dst(sch, enc->dst[i], finished, to_send); if (ret < 0) { av_packet_unref(to_send); -if (ret == AVERROR_EOF) { -ret = 0; +if (ret == AVERROR_EOF) continue; -} return ret; } } -return ret; +return 0; } static int enc_done(Scheduler *sch, unsigned enc_idx) ___ 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/wmaprodec: Explicitly return 0 on success
ffmpeg | branch: master | Andreas Rheinhardt | Mon Mar 25 02:23:06 2024 +0100| [641850f67f173985708049c0451dd04e5e14c98a] | committer: Andreas Rheinhardt avcodec/wmaprodec: Explicitly return 0 on success Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=641850f67f173985708049c0451dd04e5e14c98a --- libavcodec/wmaprodec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index 65b269adda..e3dee9039c 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -2023,7 +2023,7 @@ static av_cold int xma_decode_init(AVCodecContext *avctx) return AVERROR(ENOMEM); } -return ret; +return 0; } static av_cold int xma_decode_end(AVCodecContext *avctx) ___ 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/bfi: Remove unused AVCodecContext* from context
ffmpeg | branch: master | Andreas Rheinhardt | Mon Mar 25 02:25:53 2024 +0100| [0b212f359571c7e967c292c399ebfad8d3c6c642] | committer: Andreas Rheinhardt avcodec/bfi: Remove unused AVCodecContext* from context Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0b212f359571c7e967c292c399ebfad8d3c6c642 --- libavcodec/bfi.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/bfi.c b/libavcodec/bfi.c index 901669a3a9..c925efd562 100644 --- a/libavcodec/bfi.c +++ b/libavcodec/bfi.c @@ -33,7 +33,6 @@ #include "decode.h" typedef struct BFIContext { -AVCodecContext *avctx; uint8_t *dst; uint32_t pal[256]; } BFIContext; ___ 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/mjpegenc: Inline chroma subsampling
ffmpeg | branch: master | Andreas Rheinhardt | Mon Mar 25 02:36:54 2024 +0100| [8013574e9b4a52c28f896655bae235244d139801] | committer: Andreas Rheinhardt avcodec/mjpegenc: Inline chroma subsampling Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8013574e9b4a52c28f896655bae235244d139801 --- libavcodec/mjpegenc.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c index 521c9e8aff..c8cb2207e3 100644 --- a/libavcodec/mjpegenc.c +++ b/libavcodec/mjpegenc.c @@ -32,8 +32,6 @@ #include "config_components.h" -#include "libavutil/pixdesc.h" - #include "avcodec.h" #include "codec_internal.h" #include "jpegtables.h" @@ -595,9 +593,7 @@ static int amv_encode_picture(AVCodecContext *avctx, AVPacket *pkt, MpegEncContext *s = avctx->priv_data; AVFrame *pic; int i, ret; -int chroma_h_shift, chroma_v_shift; - -av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &chroma_h_shift, &chroma_v_shift); +int chroma_v_shift = 1; /* AMV is 420-only */ if ((avctx->height & 15) && avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) { av_log(avctx, AV_LOG_ERROR, ___ 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/ratecontrol: Avoid function pointer casts
ffmpeg | branch: master | Andreas Rheinhardt | Mon Mar 25 02:24:22 2024 +0100| [6edd83c0e2f9fc4b483c497485423281b376a7f5] | committer: Andreas Rheinhardt avcodec/ratecontrol: Avoid function pointer casts It is undefined behaviour to call a function with a different signature for the call than the actual function signature; there are no exceptions for void* and RateControlEntry*. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6edd83c0e2f9fc4b483c497485423281b376a7f5 --- libavcodec/ratecontrol.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c index 55ce054735..031da7a4f6 100644 --- a/libavcodec/ratecontrol.c +++ b/libavcodec/ratecontrol.c @@ -78,6 +78,11 @@ static inline double qp2bits(RateControlEntry *rce, double qp) return rce->qscale * (double)(rce->i_tex_bits + rce->p_tex_bits + 1) / qp; } +static double qp2bits_cb(void *rce, double qp) +{ +return qp2bits(rce, qp); +} + static inline double bits2qp(RateControlEntry *rce, double bits) { if (bits < 0.9) { @@ -86,6 +91,11 @@ static inline double bits2qp(RateControlEntry *rce, double bits) return rce->qscale * (double)(rce->i_tex_bits + rce->p_tex_bits + 1) / bits; } +static double bits2qp_cb(void *rce, double qp) +{ +return bits2qp(rce, qp); +} + static double get_diff_limited_q(MpegEncContext *s, RateControlEntry *rce, double q) { RateControlContext *rcc = &s->rc_context; @@ -506,8 +516,8 @@ av_cold int ff_rate_control_init(MpegEncContext *s) NULL }; static double (* const func1[])(void *, double) = { -(double (*)(void *, double)) bits2qp, -(double (*)(void *, double)) qp2bits, +bits2qp_cb, +qp2bits_cb, NULL }; static const char * const func1_names[] = { ___ 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/magicyuvenc: Don't call functions twice due to macro
ffmpeg | branch: master | Andreas Rheinhardt | Mon Mar 25 02:44:11 2024 +0100| [33b1c7ebbfc47b5755366a3b657edf0a6b9b7baa] | committer: Andreas Rheinhardt avcodec/magicyuvenc: Don't call functions twice due to macro Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=33b1c7ebbfc47b5755366a3b657edf0a6b9b7baa --- libavcodec/magicyuvenc.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libavcodec/magicyuvenc.c b/libavcodec/magicyuvenc.c index 1c3ab56460..77e068496e 100644 --- a/libavcodec/magicyuvenc.c +++ b/libavcodec/magicyuvenc.c @@ -211,10 +211,13 @@ static av_cold int magy_encode_init(AVCodecContext *avctx) return AVERROR(ENOMEM); if (s->correlate) { -s->decorrelate_buf[0] = av_calloc(2U * (s->nb_slices * s->slice_height), FFALIGN(avctx->width, av_cpu_max_align())); +size_t max_align = av_cpu_max_align(); +size_t aligned_width = FFALIGN(avctx->width, max_align); +s->decorrelate_buf[0] = av_calloc(2U * (s->nb_slices * s->slice_height), + aligned_width); if (!s->decorrelate_buf[0]) return AVERROR(ENOMEM); -s->decorrelate_buf[1] = s->decorrelate_buf[0] + (s->nb_slices * s->slice_height) * FFALIGN(avctx->width, av_cpu_max_align()); +s->decorrelate_buf[1] = s->decorrelate_buf[0] + (s->nb_slices * s->slice_height) * aligned_width; } s->bitslice_size = avctx->width * s->slice_height + 2; @@ -493,7 +496,8 @@ static int encode_slice(AVCodecContext *avctx, void *tdata, static int predict_slice(AVCodecContext *avctx, void *tdata, int n, int threadnr) { -const int aligned_width = FFALIGN(avctx->width, av_cpu_max_align()); +size_t max_align = av_cpu_max_align(); +const int aligned_width = FFALIGN(avctx->width, max_align); MagicYUVContext *s = avctx->priv_data; const int slice_height = s->slice_height; const int last_height = FFMIN(slice_height, avctx->height - n * slice_height); ___ 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/opt: Don't cast when the result might be misaligned
ffmpeg | branch: master | Andreas Rheinhardt | Mon Mar 25 14:54:35 2024 +0100| [c85477f78d7916b663bd09169c7ce8d4d345bca3] | committer: Andreas Rheinhardt avutil/opt: Don't cast when the result might be misaligned A pointer conversion is UB if the resulting pointer is not correctly aligned for the resultant type, even if no load/store is ever performed through that pointer (C11 6.3.2.3 (7)). This may happen in opt_copy_elem(), because the pointers are converted even when they belong to a type that does not guarantee sufficient alignment. Fix this by deferring the cast after having checked the type. Also make the casts -Wcast-qual safe and avoid an indirection for src. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c85477f78d7916b663bd09169c7ce8d4d345bca3 --- libavutil/opt.c | 29 +++-- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/libavutil/opt.c b/libavutil/opt.c index 00e11d1341..5feb5b2cb7 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -2028,18 +2028,19 @@ void *av_opt_ptr(const AVClass *class, void *obj, const char *name) static int opt_copy_elem(void *logctx, enum AVOptionType type, void *dst, const void *src) { -uint8_t **dst8 = (uint8_t **)dst; -const uint8_t **src8 = (const uint8_t **)src; - if (type == AV_OPT_TYPE_STRING) { -if (*dst8 != *src8) -av_freep(dst8); -if (*src8) { -*dst8 = av_strdup(*src8); -if (!*dst8) +const char *src_str = *(const char *const *)src; +char **dstp = (char **)dst; +if (*dstp != src_str) +av_freep(dstp); +if (src_str) { +*dstp = av_strdup(src_str); +if (!*dstp) return AVERROR(ENOMEM); } } else if (type == AV_OPT_TYPE_BINARY) { +const uint8_t *const *src8 = (const uint8_t *const *)src; +uint8_t **dst8 = (uint8_t **)dst; int len = *(const int *)(src8 + 1); if (*dst8 != *src8) av_freep(dst8); @@ -2052,12 +2053,12 @@ static int opt_copy_elem(void *logctx, enum AVOptionType type, } else if (type == AV_OPT_TYPE_CONST) { // do nothing } else if (type == AV_OPT_TYPE_DICT) { -AVDictionary **sdict = (AVDictionary **)src; -AVDictionary **ddict = (AVDictionary **)dst; -if (*sdict != *ddict) -av_dict_free(ddict); -*ddict = NULL; -return av_dict_copy(ddict, *sdict, 0); +const AVDictionary *sdict = *(const AVDictionary * const *)src; +AVDictionary **ddictp = (AVDictionary **)dst; +if (sdict != *ddictp) +av_dict_free(ddictp); +*ddictp = NULL; +return av_dict_copy(ddictp, sdict, 0); } else if (type == AV_OPT_TYPE_CHLAYOUT) { if (dst != src) return av_channel_layout_copy(dst, src); ___ 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/tests/.gitignore: Add side_data_array
ffmpeg | branch: master | Andreas Rheinhardt | Wed Mar 27 17:36:57 2024 +0100| [b9297128f5f66bb9e6d2e755e4b82818bc1ada32] | committer: Andreas Rheinhardt avutil/tests/.gitignore: Add side_data_array Reviewed-by: James Almer Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b9297128f5f66bb9e6d2e755e4b82818bc1ada32 --- libavutil/tests/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/libavutil/tests/.gitignore b/libavutil/tests/.gitignore index 87895912f5..951cafb2d7 100644 --- a/libavutil/tests/.gitignore +++ b/libavutil/tests/.gitignore @@ -44,6 +44,7 @@ /ripemd /sha /sha512 +/side_data_array /softfloat /tea /tree ___ 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/opt: Avoid av_strdup(NULL)
ffmpeg | branch: master | Andreas Rheinhardt | Mon Mar 25 13:34:42 2024 +0100| [aa7d6520e6335f9ed45ca2bf0fbf932fb4b2dea6] | committer: Andreas Rheinhardt avutil/opt: Avoid av_strdup(NULL) It is not documented to be safe and in any case it is nonsense: Currently av_strdup(NULL) returns NULL and in order to distinguish this from a genuine allocation failure, opt_copy_elem() checked afterwards whether src was actually NULL. But then one can simply check in advance whether one should call av_strdup() at all. set_string() was even worse and returned ENOMEM in case the value to be duplicated is NULL; this only worked because av_opt_set_defaults2() does not check the return value at all (given that it can't propagate it). These two places account for 389114 of 390356 av_strdup(NULL) calls during one FATE run. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=aa7d6520e6335f9ed45ca2bf0fbf932fb4b2dea6 --- libavutil/opt.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libavutil/opt.c b/libavutil/opt.c index 685206f416..00e11d1341 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -309,6 +309,8 @@ static int set_string_binary(void *obj, const AVOption *o, const char *val, uint static int set_string(void *obj, const AVOption *o, const char *val, uint8_t **dst) { av_freep(dst); +if (!val) +return 0; *dst = av_strdup(val); return *dst ? 0 : AVERROR(ENOMEM); } @@ -2032,9 +2034,11 @@ static int opt_copy_elem(void *logctx, enum AVOptionType type, if (type == AV_OPT_TYPE_STRING) { if (*dst8 != *src8) av_freep(dst8); -*dst8 = av_strdup(*src8); -if (*src8 && !*dst8) -return AVERROR(ENOMEM); +if (*src8) { +*dst8 = av_strdup(*src8); +if (!*dst8) +return AVERROR(ENOMEM); +} } else if (type == AV_OPT_TYPE_BINARY) { int len = *(const int *)(src8 + 1); if (*dst8 != *src8) ___ 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/profiles: Don't include avcodec.h
ffmpeg | branch: master | Andreas Rheinhardt | Mon Mar 25 02:50:29 2024 +0100| [686d33a6b039e7abd6de6182449d49132ce157a1] | committer: Andreas Rheinhardt avcodec/profiles: Don't include avcodec.h Forgotten in 8238bc0b5e3dba271217b1223a901b3f9713dc6e. Signed-off-by: Andreas Rheinhardt > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=686d33a6b039e7abd6de6182449d49132ce157a1 --- libavcodec/profiles.c | 3 ++- libavcodec/profiles.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/profiles.c b/libavcodec/profiles.c index 5bb8f150e6..052b77926e 100644 --- a/libavcodec/profiles.c +++ b/libavcodec/profiles.c @@ -18,7 +18,8 @@ #include "config.h" -#include "avcodec.h" +#include "codec.h" +#include "defs.h" #include "profiles.h" #if !CONFIG_SMALL diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h index ffc8710ef2..842201718b 100644 --- a/libavcodec/profiles.h +++ b/libavcodec/profiles.h @@ -19,7 +19,8 @@ #ifndef AVCODEC_PROFILES_H #define AVCODEC_PROFILES_H -#include "avcodec.h" +#include "codec.h" +#include "defs.h" #include "libavutil/opt.h" #define FF_AVCTX_PROFILE_OPTION(name, description, type, value) \ ___ 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".