Re: [FFmpeg-devel] [PATCH v3 1/2] swscale/x86/output.asm: add x86-optimized planer gbr yuv2anyX functions
will apply soon ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] DNN data layout CHW or HWC and data normalization or denormalization?
Do anyone know fastest way to divide the chw array of pixel data for frame? 1 January 2022, 04:48:03, by "Guo, Yejun" : -Original Message- From: ffmpeg-devel On Behalf Of Alex Sent: 2022年1月1日 3:16 To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] DNN data layout CHW or HWC and data normalization or denormalization? Hi! Can any one tell me is it layout of DNNData->data are chw or hwc or nchw or nhwc? And how to perform convertion from hwc to chw and reverse? How to normalize and denormalize data (-1..0..1 <=> 0...255) ? Just NHWC is supported now, and patches are welcome. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 0/4] avdevice/dshow fixups
These four patches fix three small new issues i found looking through the dshow code (needd cleanup not being done), and fix a regression introduced by my recent patches due to which devices that seem to not behave according to spec but worked fine before my patches could no longer be used. Diederick Niehorster (4): avdevice/dshow: tv_tuner_audio_dialog cleanup missing avdevice/dshow: proper cleanup of queried media types avdevice/dshow: only set pin format if wanted avdevice/dshow: ensure pin's default format is set libavdevice/dshow.c | 93 ++-- libavdevice/dshow_crossbar.c | 4 ++ 2 files changed, 61 insertions(+), 36 deletions(-) -- 2.28.0.windows.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/4] avdevice/dshow: tv_tuner_audio_dialog cleanup missing
Cleanup was missing for when the show_analog_tv_tuner_audio_dialog is true. Signed-off-by: Diederick Niehorster --- libavdevice/dshow_crossbar.c | 4 1 file changed, 4 insertions(+) diff --git a/libavdevice/dshow_crossbar.c b/libavdevice/dshow_crossbar.c index 2438683cde..961defe690 100644 --- a/libavdevice/dshow_crossbar.c +++ b/libavdevice/dshow_crossbar.c @@ -204,5 +204,9 @@ end: IAMTVTuner_Release(tv_tuner_filter); if (tv_tuner_base_filter) IBaseFilter_Release(tv_tuner_base_filter); +if (tv_audio_filter) +IAMAudioInputMixer_Release(tv_audio_filter); +if (tv_audio_base_filter) +IBaseFilter_Release(tv_audio_base_filter); return hr; } -- 2.28.0.windows.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/4] avdevice/dshow: proper cleanup of queried media types
Signed-off-by: Diederick Niehorster --- libavdevice/dshow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c index 30f1be1ead..4b6887881d 100644 --- a/libavdevice/dshow.c +++ b/libavdevice/dshow.c @@ -953,7 +953,7 @@ dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype, av_log(avctx, AV_LOG_INFO, "(%s)", chroma ? chroma : "unknown"); av_log(avctx, AV_LOG_INFO, "\n"); -continue; +goto next; } if (requested_video_codec_id != AV_CODEC_ID_RAWVIDEO) { if (requested_video_codec_id != fmt_info->codec_id) @@ -1038,6 +1038,7 @@ next: if (type && type->pbFormat) CoTaskMemFree(type->pbFormat); CoTaskMemFree(type); +type = NULL; } // previously found a matching VIDEOINFOHEADER format and stored // it for safe keeping. Searching further for a matching -- 2.28.0.windows.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/4] avdevice/dshow: only set pin format if wanted
Signed-off-by: Diederick Niehorster --- libavdevice/dshow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c index 4b6887881d..f2d95fa470 100644 --- a/libavdevice/dshow.c +++ b/libavdevice/dshow.c @@ -1046,7 +1046,7 @@ next: // format based on the VIDEOINFOHEADER format. // NB: this never applies to an audio format because // previous_match_type always NULL in that case -if (!format_set && previous_match_type) { +if (pformat_set && !format_set && previous_match_type) { if (IAMStreamConfig_SetFormat(config, previous_match_type) == S_OK) format_set = 1; } -- 2.28.0.windows.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 4/4] avdevice/dshow: ensure pin's default format is set
Fixes regression in a1c4929f: there apparently are devices out there that expose a pin default format that has parameters outside the capabilities of any of the formats exposed on the pin (sic?). The VirtualCam plugin (v 2.0.5) of OBS-Studio (v 27.1.3) is such a device. Now when a default format was found, but not selected when iterating all formats, fall back to directly setting the default format. Signed-off-by: Diederick Niehorster --- libavdevice/dshow.c | 88 +++-- 1 file changed, 54 insertions(+), 34 deletions(-) diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c index f2d95fa470..a435ae1807 100644 --- a/libavdevice/dshow.c +++ b/libavdevice/dshow.c @@ -758,6 +758,31 @@ static struct dshow_format_info *dshow_get_format_info(AM_MEDIA_TYPE *type) return fmt_info; } +static void dshow_get_default_format(IPin *pin, IAMStreamConfig *config, enum dshowDeviceType devtype, AM_MEDIA_TYPE **type) +{ +HRESULT hr; + +if ((hr = IAMStreamConfig_GetFormat(config, type)) != S_OK) { +if (hr == E_NOTIMPL || !IsEqualGUID(&(*type)->majortype, devtype == VideoDevice ? &MEDIATYPE_Video : &MEDIATYPE_Audio)) { +// default not available or of wrong type, +// fall back to iterating exposed formats +// until one of the right type is found +IEnumMediaTypes* types = NULL; +if (IPin_EnumMediaTypes(pin, &types) != S_OK) +return; +IEnumMediaTypes_Reset(types); +while (IEnumMediaTypes_Next(types, 1, type, NULL) == S_OK) { +if (IsEqualGUID(&(*type)->majortype, devtype == VideoDevice ? &MEDIATYPE_Video : &MEDIATYPE_Audio)) { +break; +} +CoTaskMemFree(*type); +*type = NULL; +} +IEnumMediaTypes_Release(types); +} +} +} + /** * Cycle through available formats available from the specified pin, * try to set parameters specified through AVOptions, or the pin's @@ -813,32 +838,11 @@ dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype, use_default = !dshow_should_set_format(avctx, devtype); if (use_default && pformat_set) { -HRESULT hr; - // get default -if ((hr = IAMStreamConfig_GetFormat(config, &type)) != S_OK) { -if (hr == E_NOTIMPL || !IsEqualGUID(&type->majortype, devtype==VideoDevice ? &MEDIATYPE_Video : &MEDIATYPE_Audio)) { -// default not available or of wrong type, -// fall back to iterating exposed formats -// until one of the right type is found -IEnumMediaTypes *types = NULL; -if (IPin_EnumMediaTypes(pin, &types) != S_OK) -goto end; -IEnumMediaTypes_Reset(types); -while (IEnumMediaTypes_Next(types, 1, &type, NULL) == S_OK) { -if (IsEqualGUID(&type->majortype, devtype==VideoDevice ? &MEDIATYPE_Video : &MEDIATYPE_Audio)) { -break; -} -CoTaskMemFree(type); -type = NULL; -} -IEnumMediaTypes_Release(types); -} - -if (!type) -// this pin does not expose any formats of the expected type -goto end; -} +dshow_get_default_format(pin, config, devtype, &type); +if (!type) +// this pin does not expose any formats of the expected type +goto end; if (type) { // interrogate default format, so we know what to search for below @@ -1040,15 +1044,31 @@ next: CoTaskMemFree(type); type = NULL; } -// previously found a matching VIDEOINFOHEADER format and stored -// it for safe keeping. Searching further for a matching -// VIDEOINFOHEADER2 format yielded nothing. So set the pin's -// format based on the VIDEOINFOHEADER format. -// NB: this never applies to an audio format because -// previous_match_type always NULL in that case -if (pformat_set && !format_set && previous_match_type) { -if (IAMStreamConfig_SetFormat(config, previous_match_type) == S_OK) -format_set = 1; + +// set the pin's format, if wanted +if (pformat_set && !format_set) { +if (previous_match_type) { +// previously found a matching VIDEOINFOHEADER format and stored +// it for safe keeping. Searching further for a matching +// VIDEOINFOHEADER2 format yielded nothing. So set the pin's +// format based on the VIDEOINFOHEADER format. +// NB: this never applies to an audio format because +// previous_match_type always NULL in that case +if (IAMStreamConfig_SetFormat(config, previous_match_type) == S_OK) +format_set = 1; +} +else if (
[FFmpeg-devel] [PATCH v2] fate: Add regression tests for AVDOVIDecoderConfigurationRecord side data
Signed-off-by: quietvoid --- Files are available here (in a zip): https://0x0.st/osvi.zip Alternatively: https://drive.google.com/drive/folders/1NDhtSoJ-mP5Yi62V6j1wjjPJNq84nP3J They're all blank frames encoded with x265, remuxed with FFmpeg after the mov box is added by dlb_mp4base. MP4 files should be moved to fate-suite/mov. MPEGTS file into fate-suite/mpegts. --- tests/fate/mov.mak | 16 +++ tests/fate/mpegts.mak | 2 + tests/ref/fate/mov-dovi-config-profile5| 13 ++ tests/ref/fate/mov-dovi-config-profile7| 15 +++ tests/ref/fate/mov-dovi-config-profile81 | 13 ++ tests/ref/fate/mov-dovi-config-profile84 | 22 ++ tests/ref/fate/mov-dovi-write-config | 49 ++ tests/ref/fate/mpegts-dovi-config-profile7 | 15 +++ 8 files changed, 145 insertions(+) create mode 100644 tests/ref/fate/mov-dovi-config-profile5 create mode 100644 tests/ref/fate/mov-dovi-config-profile7 create mode 100644 tests/ref/fate/mov-dovi-config-profile81 create mode 100644 tests/ref/fate/mov-dovi-config-profile84 create mode 100644 tests/ref/fate/mov-dovi-write-config create mode 100644 tests/ref/fate/mpegts-dovi-config-profile7 diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak index e956380909..26f62bf156 100644 --- a/tests/fate/mov.mak +++ b/tests/fate/mov.mak @@ -30,6 +30,10 @@ FATE_MOV_FFPROBE = fate-mov-neg-firstpts-discard \ fate-mov-guess-delay-3 \ fate-mov-mp4-with-mov-in24-ver \ fate-mov-mp4-extended-atom \ + fate-mov-dovi-config-profile5 \ + fate-mov-dovi-config-profile7 \ + fate-mov-dovi-config-profile81 \ + fate-mov-dovi-config-profile84 \ FATE_MOV_FASTSTART = fate-mov-faststart-4gb-overflow \ @@ -126,6 +130,12 @@ fate-mov-mp4-with-mov-in24-ver: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entr fate-mov-mp4-extended-atom: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_packets -print_format compact -select_streams v $(TARGET_SAMPLES)/mov/extended_atom_size_probe +# ffprobe tests for AVDOVIDecoderConfigurationRecord parsing in mov +fate-mov-dovi-config-profile5: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream_side_data_list -select_streams v -v 0 $(TARGET_SAMPLES)/mov/dovi-p5.mp4 +fate-mov-dovi-config-profile7: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream_side_data_list -select_streams v -v 0 $(TARGET_SAMPLES)/mov/dovi-p7.mp4 +fate-mov-dovi-config-profile81: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream_side_data_list -select_streams v -v 0 $(TARGET_SAMPLES)/mov/dovi-p81.mp4 +fate-mov-dovi-config-profile84: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream_side_data_list -select_streams v -v 0 $(TARGET_SAMPLES)/hevc/dv84.mov + FATE_MOV_FFMPEG_FFPROBE-$(call ALLYES, FILE_PROTOCOL MOV_DEMUXER MJPEG_DECODER \ SCALE_FILTER PNG_ENCODER PNG_DECODER \ MP4_MUXER FRAMECRC_MUXER PIPE_PROTOCOL) \ @@ -145,6 +155,12 @@ FATE_MOV_FFMPEG_FFPROBE-$(call ALLYES, FILE_PROTOCOL PIPE_PROTOCOL \ += fate-mov-mp4-disposition-mpegts-remux fate-mov-mp4-disposition-mpegts-remux: CMD = transcode mpegts $(TARGET_SAMPLES)/mpegts/pmtchange.ts mp4 "-map 0:1 -map 0:2 -c copy -disposition:a:0 +hearing_impaired" "-map 0 -c copy" "" "-of json -show_entries stream_disposition:stream=index" +FATE_MOV_FFMPEG_FFPROBE-$(call ALLYES, FILE_PROTOCOL PIPE_PROTOCOL \ + MPEGTS_DEMUXER MOV_DEMUXER \ + MP4_MUXER FRAMECRC_MUXER) \ + += fate-mov-dovi-write-config +fate-mov-dovi-write-config: CMD = transcode mpegts $(TARGET_SAMPLES)/mpegts/dovi-p7.ts mp4 "-map 0:0 -map 0:1 -c copy -strict unofficial" "-map 0 -c copy" "" "-show_entries stream_side_data_list -select_streams v -v 0" + FATE_SAMPLES_FFMPEG_FFPROBE += $(FATE_MOV_FFMPEG_FFPROBE-yes) fate-mov: $(FATE_MOV) $(FATE_MOV_FFPROBE) $(FATE_MOV_FASTSTART) $(FATE_MOV_FFMPEG_FFPROBE-yes) diff --git a/tests/fate/mpegts.mak b/tests/fate/mpegts.mak index bbcbfc47b2..1ee44ff2a0 100644 --- a/tests/fate/mpegts.mak +++ b/tests/fate/mpegts.mak @@ -19,6 +19,8 @@ FATE_MPEGTS_PROBE-$(call DEMDEC, MPEGTS) += fate-mpegts-probe-pmt-merge fate-mpegts-probe-pmt-merge: SRC = $(TARGET_SAMPLES)/mpegts/pmtchange.ts fate-mpegts-probe-pmt-merge: CMD = run $(PROBE_CODEC_NAME_COMMAND) -merge_pmt_versions 1 -i "$(SRC)" +FATE_MPEGTS_PROBE-$(call DEMDEC, MPEGTS) += fate-mpegts-dovi-config-profile7 +fate-mpegts-dovi-config-profile7: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream_side_data_list -select_streams v -v 0 $(TARGET_SAMPLES)/mpegts/dovi-p7.ts FATE_SAMPLES_FFPROBE += $(FATE_MPEGTS_PROBE-yes) diff --git a/tests/ref/fate/mov-dovi-config-profile5 b/tests/ref/fate/mov-dovi-config-profil
[FFmpeg-devel] [PATCH v12 0/5] Add support for Matroska BlockAdditionMapping elements
This patch set adds support for reading/writing the Matroska BlockAdditionMapping elements, as well as for reading/writing dvcC/dvvC blocks in Matroska. Created utility functions to read/write Dolby Vision boxes for ISOM. This was done to avoid duplicating the code, as the Matroska blocks and MOV boxes follow the same specification, defined by Dolby. Refactored the reading/writing in mov/movenc to use the new dovi_isom functions. v11: https://ffmpeg.org/pipermail/ffmpeg-devel/2022-January/290611.html Changes since v11: - mov/movenc: Added dovi_isom linked object in Makefile for MOV DEMUXER/MUXER. - fate/matroska: Fixed ffprobe test set name and requirements. As suggested here: https://ffmpeg.org/pipermail/ffmpeg-devel/2022-January/290621.html quietvoid (5): avformat/dovi_isom: Implement Dolby Vision configuration parsing/writing avformat/matroska{dec, enc}: Parse BlockAdditionMapping elements avformat/mov: Refactor mov_read_dvcc_dvvc to use ff_isom_parse_dvcc_dvvc avformat/movenc: Refactor mov_write_dvcc_dvvc_tag to use ff_isom_put_dvcc_dvvc fate/matroska: Add tests for reading/writing BlockAdditionMapping elements libavformat/Makefile | 9 +- libavformat/dovi_isom.c | 118 ++ libavformat/dovi_isom.h | 35 +++ libavformat/matroska.h | 9 + libavformat/matroskadec.c| 58 - libavformat/matroskaenc.c| 37 +++ libavformat/mov.c| 50 + libavformat/movenc.c | 24 +- tests/fate/matroska.mak | 9 + tests/ref/fate/matroska-dovi-config-profile5 | 13 ++ tests/ref/fate/matroska-dovi-write-config| 223 +++ 11 files changed, 519 insertions(+), 66 deletions(-) create mode 100644 libavformat/dovi_isom.c create mode 100644 libavformat/dovi_isom.h create mode 100644 tests/ref/fate/matroska-dovi-config-profile5 create mode 100644 tests/ref/fate/matroska-dovi-write-config -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v12 1/5] avformat/dovi_isom: Implement Dolby Vision configuration parsing/writing
Both parse/write implementations are based on mov/movenc. This only adds support for the "Dolby Vision configuration box". Other configuration boxes, such as "Dolby Vision enhancement layer configuration box" are not supported. The new functions will be used to implement parsing/writing the DOVI config for Matroska, as well as to refactor both mov/movenc to use dovi_isom functions. Signed-off-by: quietvoid --- libavformat/dovi_isom.c | 118 libavformat/dovi_isom.h | 35 2 files changed, 153 insertions(+) create mode 100644 libavformat/dovi_isom.c create mode 100644 libavformat/dovi_isom.h diff --git a/libavformat/dovi_isom.c b/libavformat/dovi_isom.c new file mode 100644 index 00..76681b9451 --- /dev/null +++ b/libavformat/dovi_isom.c @@ -0,0 +1,118 @@ +/* + * DOVI ISO Media common code + * + * Copyright (c) 2020 Vacing Fang + * Copyright (c) 2021 quietvoid + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/dovi_meta.h" + +#include "libavcodec/put_bits.h" + +#include "avformat.h" +#include "dovi_isom.h" + +int ff_isom_parse_dvcc_dvvc(AVFormatContext *s, AVStream *st, const uint8_t *buf_ptr, uint64_t size) +{ +uint32_t buf; +AVDOVIDecoderConfigurationRecord *dovi; +size_t dovi_size; +int ret; + +if (size > (1 << 30) || size < 4) +return AVERROR_INVALIDDATA; + +dovi = av_dovi_alloc(&dovi_size); +if (!dovi) +return AVERROR(ENOMEM); + +dovi->dv_version_major = *buf_ptr++;// 8 bits +dovi->dv_version_minor = *buf_ptr++;// 8 bits + +buf = *buf_ptr++ << 8; +buf |= *buf_ptr++; + +dovi->dv_profile= (buf >> 9) & 0x7f;// 7 bits +dovi->dv_level = (buf >> 3) & 0x3f;// 6 bits +dovi->rpu_present_flag = (buf >> 2) & 0x01;// 1 bit +dovi->el_present_flag = (buf >> 1) & 0x01;// 1 bit +dovi->bl_present_flag = buf & 0x01;// 1 bit + +// Has enough remaining data +if (size >= 5) { +dovi->dv_bl_signal_compatibility_id = ((*buf_ptr++) >> 4) & 0x0f; // 4 bits +} else { +// 0 stands for None +// Dolby Vision V1.2.93 profiles and levels +dovi->dv_bl_signal_compatibility_id = 0; +} + +ret = av_stream_add_side_data(st, AV_PKT_DATA_DOVI_CONF, + (uint8_t *)dovi, dovi_size); +if (ret < 0) { +av_free(dovi); +return ret; +} + +av_log(s, AV_LOG_TRACE, "DOVI in dvcC/dvvC/dvwC box, version: %d.%d, profile: %d, level: %d, " + "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d\n", + dovi->dv_version_major, dovi->dv_version_minor, + dovi->dv_profile, dovi->dv_level, + dovi->rpu_present_flag, + dovi->el_present_flag, + dovi->bl_present_flag, + dovi->dv_bl_signal_compatibility_id); + +return 0; +} + +void ff_isom_put_dvcc_dvvc(AVFormatContext *s, uint8_t out[ISOM_DVCC_DVVC_SIZE], + AVDOVIDecoderConfigurationRecord *dovi) +{ +PutBitContext pb; + +init_put_bits(&pb, out, ISOM_DVCC_DVVC_SIZE); + +put_bits(&pb, 8, dovi->dv_version_major); +put_bits(&pb, 8, dovi->dv_version_minor); +put_bits(&pb, 7, dovi->dv_profile & 0x7f); +put_bits(&pb, 6, dovi->dv_level & 0x3f); +put_bits(&pb, 1, !!dovi->rpu_present_flag); +put_bits(&pb, 1, !!dovi->el_present_flag); +put_bits(&pb, 1, !!dovi->bl_present_flag); +put_bits(&pb, 4, dovi->dv_bl_signal_compatibility_id & 0x0f); + +put_bits(&pb, 28, 0); /* reserved */ +put_bits32(&pb, 0); /* reserved */ +put_bits32(&pb, 0); /* reserved */ +put_bits32(&pb, 0); /* reserved */ +put_bits32(&pb, 0); /* reserved */ + +flush_put_bits(&pb); + +av_log(s, AV_LOG_DEBUG, "DOVI in %s box, version: %d.%d, profile: %d, level: %d, " + "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d\n", + dovi->dv_profile > 10 ? "dvwC" : (dovi->dv_profile > 7 ? "dvvC" : "dvcC"), + dovi->dv_version_major, dovi->dv_version_minor, + dovi->dv_profile, dovi->dv_level, + dovi->rpu_present_flag, + dovi->el_present_flag, + dovi->bl_present_flag, +
[FFmpeg-devel] [PATCH v12 2/5] avformat/matroska{dec, enc}: Parse BlockAdditionMapping elements
Adds handling of dvcC/dvvC block addition mappings. The parsing creates AVDOVIDecoderConfigurationRecord side data. The configuration block is written when muxing into Matroska, if DOVI side data is present for the track. Most of the Matroska element parsing is based on Plex's FFmpeg source code. Signed-off-by: quietvoid --- libavformat/Makefile | 4 +-- libavformat/matroska.h| 9 ++ libavformat/matroskadec.c | 58 +-- libavformat/matroskaenc.c | 37 + 4 files changed, 104 insertions(+), 4 deletions(-) diff --git a/libavformat/Makefile b/libavformat/Makefile index e31b248ac0..4464c2b049 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -316,11 +316,11 @@ OBJS-$(CONFIG_M4V_MUXER) += rawenc.o OBJS-$(CONFIG_MATROSKA_DEMUXER) += matroskadec.o matroska.o \ flac_picture.o isom_tags.o rmsipr.o \ oggparsevorbis.o vorbiscomment.o \ -qtpalette.o replaygain.o +qtpalette.o replaygain.o dovi_isom.o OBJS-$(CONFIG_MATROSKA_MUXER)+= matroskaenc.o matroska.o \ av1.o avc.o hevc.o isom_tags.o \ flacenc_header.o avlanguage.o \ -vorbiscomment.o wv.o +vorbiscomment.o wv.o dovi_isom.o OBJS-$(CONFIG_MCA_DEMUXER) += mca.o OBJS-$(CONFIG_MCC_DEMUXER) += mccdec.o subtitles.o OBJS-$(CONFIG_MD5_MUXER) += hashenc.o diff --git a/libavformat/matroska.h b/libavformat/matroska.h index 2d04a6838b..16491aae22 100644 --- a/libavformat/matroska.h +++ b/libavformat/matroska.h @@ -111,6 +111,7 @@ #define MATROSKA_ID_TRACKCONTENTENCODING 0x6240 #define MATROSKA_ID_TRACKTIMECODESCALE 0x23314F #define MATROSKA_ID_TRACKMAXBLKADDID 0x55EE +#define MATROSKA_ID_TRACKBLKADDMAPPING 0x41E4 /* IDs in the trackvideo master */ #define MATROSKA_ID_VIDEOFRAMERATE 0x2383E3 @@ -189,6 +190,12 @@ #define MATROSKA_ID_ENCODINGSIGKEYID 0x47E4 #define MATROSKA_ID_ENCODINGSIGNATURE 0x47E3 +/* IDs in the block addition mapping master */ +#define MATROSKA_ID_BLKADDIDVALUE 0x41F0 +#define MATROSKA_ID_BLKADDIDNAME 0x41A4 +#define MATROSKA_ID_BLKADDIDTYPE 0x41E7 +#define MATROSKA_ID_BLKADDIDEXTRADATA 0x41ED + /* ID in the cues master */ #define MATROSKA_ID_POINTENTRY 0xBB @@ -385,4 +392,6 @@ extern const char * const ff_matroska_video_stereo_plane[MATROSKA_VIDEO_STEREO_P int ff_mkv_stereo3d_conv(AVStream *st, MatroskaVideoStereoModeType stereo_mode); +#define DVCC_DVVC_BLOCK_TYPE_NAME "Dolby Vision configuration" + #endif /* AVFORMAT_MATROSKA_H */ diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index a4bbbe954e..6ce553205d 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -53,6 +53,7 @@ #include "avformat.h" #include "avio_internal.h" +#include "dovi_isom.h" #include "internal.h" #include "isom.h" #include "matroska.h" @@ -239,6 +240,13 @@ typedef struct MatroskaTrackOperation { EbmlList combine_planes; } MatroskaTrackOperation; +typedef struct MatroskaBlockAdditionMapping { +uint64_t value; +char *name; +uint64_t type; +EbmlBin extradata; +} MatroskaBlockAdditionMapping; + typedef struct MatroskaTrack { uint64_t num; uint64_t uid; @@ -269,6 +277,7 @@ typedef struct MatroskaTrack { int ms_compat; int needs_decoding; uint64_t max_block_additional_id; +EbmlList block_addition_mappings; uint32_t palette[AVPALETTE_COUNT]; int has_palette; @@ -419,8 +428,8 @@ typedef struct MatroskaDemuxContext { // incomplete type (6.7.2 in C90, 6.9.2 in C99). // Removing the sizes breaks MSVC. static EbmlSyntax ebml_syntax[3], matroska_segment[9], matroska_track_video_color[15], matroska_track_video[19], - matroska_track[32], matroska_track_encoding[6], matroska_track_encodings[2], - matroska_track_combine_planes[2], matroska_track_operation[2], matroska_tracks[2], + matroska_track[33], matroska_track_encoding[6], matroska_track_encodings[2], + matroska_track_combine_planes[2], matroska_track_operation[2], matroska_block_addition_mapping[5], matroska_tracks[2], matroska_attachments[2], matroska_chapter_entry[9], matroska_chapter[6], matroska_chapters[2], matroska_index_entry[3], matroska_index[2], matroska_tag[3], matroska_tags[2], matroska_seekhead[2], matroska_blockadditions[2], matroska_blockgroup[8], matroska_cluster_parsing[8]; @@ -570,6 +579,14 @@ static EbmlSyntax matroska_track_operation[] = { CHILD_OF(matroska_track) }; +static EbmlSyntax matroska_block_addition_mapping[] = { +
[FFmpeg-devel] [PATCH v12 3/5] avformat/mov: Refactor mov_read_dvcc_dvvc to use ff_isom_parse_dvcc_dvvc
To avoid duplicating code. The implementation in dovi_isom is identical. Signed-off-by: quietvoid --- libavformat/Makefile | 2 +- libavformat/mov.c| 50 +++- 2 files changed, 8 insertions(+), 44 deletions(-) diff --git a/libavformat/Makefile b/libavformat/Makefile index 4464c2b049..cd9810ba01 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -339,7 +339,7 @@ OBJS-$(CONFIG_MMF_MUXER) += mmf.o rawenc.o OBJS-$(CONFIG_MODS_DEMUXER) += mods.o OBJS-$(CONFIG_MOFLEX_DEMUXER)+= moflex.o OBJS-$(CONFIG_MOV_DEMUXER) += mov.o mov_chan.o mov_esds.o \ -qtpalette.o replaygain.o +qtpalette.o replaygain.o dovi_isom.o OBJS-$(CONFIG_MOV_MUXER) += movenc.o av1.o avc.o hevc.o vpcc.o \ movenchint.o mov_chan.o rtp.o \ movenccenc.o movenc_ttml.o rawutils.o diff --git a/libavformat/mov.c b/libavformat/mov.c index 351ecde770..ad5ab6b491 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -55,6 +55,7 @@ #include "avformat.h" #include "internal.h" #include "avio_internal.h" +#include "dovi_isom.h" #include "riff.h" #include "isom.h" #include "libavcodec/get_bits.h" @@ -7062,58 +7063,21 @@ static int mov_read_dmlp(MOVContext *c, AVIOContext *pb, MOVAtom atom) static int mov_read_dvcc_dvvc(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; -uint32_t buf; -AVDOVIDecoderConfigurationRecord *dovi; -size_t dovi_size; +uint8_t buf[ISOM_DVCC_DVVC_SIZE]; int ret; +int64_t read_size = atom.size; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; -if ((uint64_t)atom.size > (1<<30) || atom.size < 4) -return AVERROR_INVALIDDATA; - -dovi = av_dovi_alloc(&dovi_size); -if (!dovi) -return AVERROR(ENOMEM); - -dovi->dv_version_major = avio_r8(pb); -dovi->dv_version_minor = avio_r8(pb); - -buf = avio_rb16(pb); -dovi->dv_profile= (buf >> 9) & 0x7f;// 7 bits -dovi->dv_level = (buf >> 3) & 0x3f;// 6 bits -dovi->rpu_present_flag = (buf >> 2) & 0x01;// 1 bit -dovi->el_present_flag = (buf >> 1) & 0x01;// 1 bit -dovi->bl_present_flag = buf & 0x01;// 1 bit -if (atom.size >= 24) { // 4 + 4 + 4 * 4 -buf = avio_r8(pb); -dovi->dv_bl_signal_compatibility_id = (buf >> 4) & 0x0f; // 4 bits -} else { -// 0 stands for None -// Dolby Vision V1.2.93 profiles and levels -dovi->dv_bl_signal_compatibility_id = 0; -} +// At most 24 bytes +read_size = FFMIN(read_size, ISOM_DVCC_DVVC_SIZE); -ret = av_stream_add_side_data(st, AV_PKT_DATA_DOVI_CONF, - (uint8_t *)dovi, dovi_size); -if (ret < 0) { -av_free(dovi); +if ((ret = ffio_read_size(pb, buf, read_size)) < 0) return ret; -} -av_log(c, AV_LOG_TRACE, "DOVI in dvcC/dvvC/dvwC box, version: %d.%d, profile: %d, level: %d, " - "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d\n", - dovi->dv_version_major, dovi->dv_version_minor, - dovi->dv_profile, dovi->dv_level, - dovi->rpu_present_flag, - dovi->el_present_flag, - dovi->bl_present_flag, - dovi->dv_bl_signal_compatibility_id -); - -return 0; +return ff_isom_parse_dvcc_dvvc(c->fc, st, buf, read_size); } static int mov_read_kind(MOVContext *c, AVIOContext *pb, MOVAtom atom) -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v12 4/5] avformat/movenc: Refactor mov_write_dvcc_dvvc_tag to use ff_isom_put_dvcc_dvvc
Improves code legibility by not using bit shifts. Also avoids duplicating the dvcC/dvvC ISOM box writing code. Signed-off-by: quietvoid --- libavformat/Makefile | 3 ++- libavformat/movenc.c | 24 +++- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/libavformat/Makefile b/libavformat/Makefile index cd9810ba01..a9afb9c042 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -342,7 +342,8 @@ OBJS-$(CONFIG_MOV_DEMUXER) += mov.o mov_chan.o mov_esds.o \ qtpalette.o replaygain.o dovi_isom.o OBJS-$(CONFIG_MOV_MUXER) += movenc.o av1.o avc.o hevc.o vpcc.o \ movenchint.o mov_chan.o rtp.o \ -movenccenc.o movenc_ttml.o rawutils.o +movenccenc.o movenc_ttml.o rawutils.o \ +dovi_isom.o OBJS-$(CONFIG_MP2_MUXER) += rawenc.o OBJS-$(CONFIG_MP3_DEMUXER) += mp3dec.o replaygain.o OBJS-$(CONFIG_MP3_MUXER) += mp3enc.o rawenc.o id3v2enc.o diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 0f912dd012..f1fe43a79f 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -27,6 +27,7 @@ #include "movenc.h" #include "avformat.h" #include "avio_internal.h" +#include "dovi_isom.h" #include "riff.h" #include "avio.h" #include "isom.h" @@ -1911,6 +1912,8 @@ static int mov_write_sv3d_tag(AVFormatContext *s, AVIOContext *pb, AVSphericalMa static int mov_write_dvcc_dvvc_tag(AVFormatContext *s, AVIOContext *pb, AVDOVIDecoderConfigurationRecord *dovi) { +uint8_t buf[ISOM_DVCC_DVVC_SIZE]; + avio_wb32(pb, 32); /* size = 8 + 24 */ if (dovi->dv_profile > 10) ffio_wfourcc(pb, "dvwC"); @@ -1918,23 +1921,10 @@ static int mov_write_dvcc_dvvc_tag(AVFormatContext *s, AVIOContext *pb, AVDOVIDe ffio_wfourcc(pb, "dvvC"); else ffio_wfourcc(pb, "dvcC"); -avio_w8(pb, dovi->dv_version_major); -avio_w8(pb, dovi->dv_version_minor); -avio_wb16(pb, (dovi->dv_profile << 9) | (dovi->dv_level << 3) | - (dovi->rpu_present_flag << 2) | (dovi->el_present_flag << 1) | - dovi->bl_present_flag); -avio_wb32(pb, (dovi->dv_bl_signal_compatibility_id << 28) | 0); - -ffio_fill(pb, 0, 4 * 4); /* reserved */ -av_log(s, AV_LOG_DEBUG, "DOVI in %s box, version: %d.%d, profile: %d, level: %d, " - "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d\n", - dovi->dv_profile > 10 ? "dvwC" : (dovi->dv_profile > 7 ? "dvvC" : "dvcC"), - dovi->dv_version_major, dovi->dv_version_minor, - dovi->dv_profile, dovi->dv_level, - dovi->rpu_present_flag, - dovi->el_present_flag, - dovi->bl_present_flag, - dovi->dv_bl_signal_compatibility_id); + +ff_isom_put_dvcc_dvvc(s, buf, dovi); +avio_write(pb, buf, sizeof(buf)); + return 32; /* 8 + 24 */ } -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v12 5/5] fate/matroska: Add tests for reading/writing BlockAdditionMapping elements
Tests the parsing and writing of AVDOVIDecoderConfigurationRecord, when it is present as a Dolby Vision configuration block addition mapping. Signed-off-by: quietvoid --- The required regression test file is available here: https://0x0.st/-hWK.mkv Should be moved to fate-suite/mkv/dovi-p5.mkv It is a blank frame encoded with x265. --- tests/fate/matroska.mak | 9 + tests/ref/fate/matroska-dovi-config-profile5 | 13 ++ tests/ref/fate/matroska-dovi-write-config| 223 +++ 3 files changed, 245 insertions(+) create mode 100644 tests/ref/fate/matroska-dovi-config-profile5 create mode 100644 tests/ref/fate/matroska-dovi-write-config diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak index e117a0f6a6..5a86d0fc45 100644 --- a/tests/fate/matroska.mak +++ b/tests/fate/matroska.mak @@ -138,6 +138,15 @@ FATE_MATROSKA_FFMPEG_FFPROBE-$(call ALLYES, FILE_PROTOCOL WEBVTT_DEMUXER \ += fate-webm-webvtt-remux fate-webm-webvtt-remux: CMD = transcode webvtt $(TARGET_SAMPLES)/sub/WebVTT_capability_tester.vtt webm "-map 0 -map 0 -map 0 -map 0 -c:s copy -disposition:0 original+descriptions+hearing_impaired -disposition:1 lyrics+default+metadata -disposition:2 comment+forced -disposition:3 karaoke+captions+dub" "-map 0:0 -map 0:1 -c copy" "" "-show_entries stream_disposition:stream=index,codec_name:packet=stream_index,pts:packet_side_data_list -show_data_hash CRC32" +FATE_MATROSKA_FFPROBE-$(CONFIG_MATROSKA_DEMUXER) += fate-matroska-dovi-config-profile5 +fate-matroska-dovi-config-profile5: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream_side_data_list -select_streams v -v 0 $(TARGET_SAMPLES)/mkv/dovi-p5.mkv + +FATE_MATROSKA_FFMPEG_FFPROBE-$(call ALLYES, FILE_PROTOCOL PIPE_PROTOCOL \ +MOV_DEMUXER MATROSKA_DEMUXER \ +MATROSKA_MUXER FRAMECRC_MUXER) \ + += fate-matroska-dovi-write-config +fate-matroska-dovi-write-config: CMD = transcode mov $(TARGET_SAMPLES)/hevc/dv84.mov matroska "-c:v copy" "-map 0 -c copy" "" "-show_entries stream_side_data_list -select_streams v -v 0" + FATE_SAMPLES_AVCONV += $(FATE_MATROSKA-yes) FATE_SAMPLES_FFPROBE += $(FATE_MATROSKA_FFPROBE-yes) FATE_SAMPLES_FFMPEG_FFPROBE += $(FATE_MATROSKA_FFMPEG_FFPROBE-yes) diff --git a/tests/ref/fate/matroska-dovi-config-profile5 b/tests/ref/fate/matroska-dovi-config-profile5 new file mode 100644 index 00..a27976b71a --- /dev/null +++ b/tests/ref/fate/matroska-dovi-config-profile5 @@ -0,0 +1,13 @@ +[STREAM] +[SIDE_DATA] +side_data_type=DOVI configuration record +dv_version_major=1 +dv_version_minor=0 +dv_profile=5 +dv_level=4 +rpu_present_flag=1 +el_present_flag=0 +bl_present_flag=1 +dv_bl_signal_compatibility_id=0 +[/SIDE_DATA] +[/STREAM] diff --git a/tests/ref/fate/matroska-dovi-write-config b/tests/ref/fate/matroska-dovi-write-config new file mode 100644 index 00..a253db9f00 --- /dev/null +++ b/tests/ref/fate/matroska-dovi-write-config @@ -0,0 +1,223 @@ +47d2c151ff02720fff7bd37b3028097e *tests/data/fate/matroska-dovi-write-config.matroska +3618445 tests/data/fate/matroska-dovi-write-config.matroska +#extradata 0: 551, 0xa18acf66 +#tb 0: 1/1000 +#media_type 0: video +#codec_id 0: hevc +#dimensions 0: 1920x1080 +#sar 0: 0/1 +#tb 1: 1/1000 +#media_type 1: audio +#codec_id 1: ac3 +#sample_rate 1: 44100 +#channel_layout 1: 3 +#channel_layout_name 1: stereo +0,-67, 0, 33,63375, 0xc76606ab, S=1,8 +0,-34,133, 33,46706, 0x0e08a7e5, F=0x0 +0, 0, 73, 33,29766, 0x753c031a, F=0x0 +1, 0, 0, 34, 834, 0x6740ac04 +1, 35, 35, 34, 836, 0xe29a9a24 +0, 39, 39, 33,19409, 0x4b948b6c, F=0x0 +1, 70, 70, 34, 836, 0xf7329e5f +0, 73,106, 33,21086, 0x1b9412ce, F=0x0 +1,105,105, 34, 836, 0x9622a243 +0,106,273, 33,62043, 0xc2356b56, F=0x0 +0,133,206, 33,36175, 0x0a7df38c, F=0x0 +1,140,140, 34, 836, 0xb2d497c5 +0,173,173, 33,16028, 0xa57fcbe9, F=0x0 +1,174,174, 34, 836, 0x17c8980e +0,206,239, 33,15428, 0x9a91f357, F=0x0 +1,209,209, 34, 836, 0xfe288a7d +0,239,406, 33,66072, 0xa542b6d7, F=0x0 +1,244,244, 34, 836, 0x539e82b1 +0,273,339, 33,34985, 0xbfd8ff45, F=0x0 +1,279,279, 34, 836, 0x166291cb +0,306,306, 33,16036, 0xfc39c6ea, F=0x0 +1,314,314, 34, 836, 0x30127c33 +0,339,373, 33,19893, 0x7e746f4e, F=0x0 +1,348,348,
Re: [FFmpeg-devel] [PATCH v11 5/5] fate/matroska: Add tests for reading/writing BlockAdditionMapping elements
On Sat, Jan 1, 2022 at 2:57 AM Andreas Rheinhardt wrote: > > quietvoid: > > Tests the parsing and writing of AVDOVIDecoderConfigurationRecord, > > when it is present as a Dolby Vision configuration block addition mapping. > > > > Signed-off-by: quietvoid > > --- > > The required regression test file is available here: https://0x0.st/-hWK.mkv > > Should be moved to fate-suite/mkv/dovi-p5.mkv > > > > It is a blank frame encoded with x265. > > --- > > tests/fate/matroska.mak | 9 + > > tests/ref/fate/matroska-dovi-config-profile5 | 13 ++ > > tests/ref/fate/matroska-dovi-write-config| 223 +++ > > 3 files changed, 245 insertions(+) > > create mode 100644 tests/ref/fate/matroska-dovi-config-profile5 > > create mode 100644 tests/ref/fate/matroska-dovi-write-config > > > > diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak > > index e117a0f6a6..ec2a0607b2 100644 > > --- a/tests/fate/matroska.mak > > +++ b/tests/fate/matroska.mak > > @@ -138,6 +138,15 @@ FATE_MATROSKA_FFMPEG_FFPROBE-$(call ALLYES, > > FILE_PROTOCOL WEBVTT_DEMUXER \ > > += fate-webm-webvtt-remux > > fate-webm-webvtt-remux: CMD = transcode webvtt > > $(TARGET_SAMPLES)/sub/WebVTT_capability_tester.vtt webm "-map 0 -map 0 -map > > 0 -map 0 -c:s copy -disposition:0 original+descriptions+hearing_impaired > > -disposition:1 lyrics+default+metadata -disposition:2 comment+forced > > -disposition:3 karaoke+captions+dub" "-map 0:0 -map 0:1 -c copy" "" > > "-show_entries > > stream_disposition:stream=index,codec_name:packet=stream_index,pts:packet_side_data_list > > -show_data_hash CRC32" > > > > +FATE_MATROSKA_FFMPEG_FFPROBE-$(call ALLYES, MATROSKA_DEMUXER) += > > fate-matroska-dovi-config-profile5 > > This should be FATE_MATROSKA_FFPROBE, not FATE_MATROSKA_FFMPEG_FFPROBE. > And actually, you need the file protocol; if you don't check for it, > you can just use FATE_MATROSKA_FFPROBE-$(CONFIG_MATROSKA_DEMUXER). > > > +fate-matroska-dovi-config-profile5: CMD = run ffprobe$(PROGSSUF)$(EXESUF) > > -show_entries stream_side_data_list -select_streams v -v 0 > > $(TARGET_SAMPLES)/mkv/dovi-p5.mkv > > + > > +FATE_MATROSKA_FFMPEG_FFPROBE-$(call ALLYES, FILE_PROTOCOL PIPE_PROTOCOL \ > > +MOV_DEMUXER MATROSKA_MUXER \ > > +FRAMECRC_MUXER) \ > > You will need the MATROSKA_DEMUXER, too; after all, the created file is > read and demuxed. Thanks again. Fixed along with the other comments (for the other patches). v12: https://ffmpeg.org/pipermail/ffmpeg-devel/2022-January/290630.html > > + += fate-matroska-dovi-write-config > > +fate-matroska-dovi-write-config: CMD = transcode mov > > $(TARGET_SAMPLES)/hevc/dv84.mov matroska "-c:v copy" "-map 0 -c copy" "" > > "-show_entries stream_side_data_list -select_streams v -v 0" > > + > > FATE_SAMPLES_AVCONV += $(FATE_MATROSKA-yes) > > FATE_SAMPLES_FFPROBE += $(FATE_MATROSKA_FFPROBE-yes) > > FATE_SAMPLES_FFMPEG_FFPROBE += $(FATE_MATROSKA_FFMPEG_FFPROBE-yes) > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec/speexdec: Consider mode in frame size check
On Sun, Dec 26, 2021 at 02:37:23PM +0100, Michael Niedermayer wrote: > No speex samples with non default frame sizes are known (to me) > the official speexenc seems to only generate the 3 default ones. > Thus it may be that the fuzzer samples where the first non default > values encountered by the decoder. > Possibly the "<" should be "!=" > > If someone has a valid speex file with non default frame sizes that > would be interesting! > > Fixes: out of array access > Fixes: > 42821/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SPEEX_fuzzer-5640695772217344 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/speexdec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you fake or manipulate statistics in a paper in physics you will never get a job again. If you fake or manipulate statistics in a paper in medicin you will get a job for life at the pharma industry. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/2] avformat/imfdec: do not use filesize when reading XML file
Signed-off-by: Marton Balint --- libavformat/imfdec.c | 15 --- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c index f17064cfcd..ef1e7cf206 100644 --- a/libavformat/imfdec.c +++ b/libavformat/imfdec.c @@ -73,8 +73,6 @@ #include #include -#define MAX_BPRINT_READ_SIZE (UINT_MAX - 1) -#define DEFAULT_ASSETMAP_SIZE 8 * 1024 #define AVRATIONAL_FORMAT "%d/%d" #define AVRATIONAL_ARG(rational) rational.num, rational.den @@ -279,7 +277,6 @@ static int parse_assetmap(AVFormatContext *s, const char *url) const char *base_url; char *tmp_str = NULL; int ret; -int64_t filesize; av_log(s, AV_LOG_DEBUG, "Asset Map URL: %s\n", url); @@ -289,13 +286,10 @@ static int parse_assetmap(AVFormatContext *s, const char *url) if (ret < 0) return ret; -filesize = avio_size(in); -filesize = filesize > 0 ? filesize : DEFAULT_ASSETMAP_SIZE; +av_bprint_init(&buf, 0, INT_MAX); // xmlReadMemory uses integer length -av_bprint_init(&buf, filesize + 1, AV_BPRINT_SIZE_UNLIMITED); - -ret = avio_read_to_bprint(in, &buf, MAX_BPRINT_READ_SIZE); -if (ret < 0 || !avio_feof(in) || buf.len == 0) { +ret = avio_read_to_bprint(in, &buf, SIZE_MAX); +if (ret < 0 || !avio_feof(in)) { av_log(s, AV_LOG_ERROR, "Unable to read to asset map '%s'\n", url); if (ret == 0) ret = AVERROR_INVALIDDATA; @@ -311,8 +305,7 @@ static int parse_assetmap(AVFormatContext *s, const char *url) } base_url = av_dirname(tmp_str); -filesize = buf.len; -doc = xmlReadMemory(buf.str, filesize, url, NULL, 0); +doc = xmlReadMemory(buf.str, buf.len, url, NULL, 0); ret = parse_imf_asset_map_from_xml_dom(s, doc, &c->asset_locator_map, base_url); if (!ret) -- 2.31.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/2] avformat/dashdec: do not use filesize when reading XML file
Signed-off-by: Marton Balint --- libavformat/dashdec.c | 20 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 797fe74157..0d21989e42 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -30,8 +30,6 @@ #include "dash.h" #define INITIAL_BUFFER_SIZE 32768 -#define MAX_BPRINT_READ_SIZE (UINT_MAX - 1) -#define DEFAULT_MANIFEST_SIZE 8 * 1024 struct fragment { int64_t url_offset; @@ -1195,7 +1193,6 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in) DASHContext *c = s->priv_data; int ret = 0; int close_in = 0; -int64_t filesize = 0; AVBPrint buf; AVDictionary *opts = NULL; xmlDoc *doc = NULL; @@ -1226,26 +1223,17 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in) if (av_opt_get(in, "location", AV_OPT_SEARCH_CHILDREN, (uint8_t**)&c->base_url) < 0) c->base_url = av_strdup(url); -filesize = avio_size(in); -filesize = filesize > 0 ? filesize : DEFAULT_MANIFEST_SIZE; +av_bprint_init(&buf, 0, INT_MAX); // xmlReadMemory uses integer bufsize -if (filesize > MAX_BPRINT_READ_SIZE) { -av_log(s, AV_LOG_ERROR, "Manifest too large: %"PRId64"\n", filesize); -return AVERROR_INVALIDDATA; -} - -av_bprint_init(&buf, filesize + 1, AV_BPRINT_SIZE_UNLIMITED); - -if ((ret = avio_read_to_bprint(in, &buf, MAX_BPRINT_READ_SIZE)) < 0 || -!avio_feof(in) || -(filesize = buf.len) == 0) { +if ((ret = avio_read_to_bprint(in, &buf, SIZE_MAX)) < 0 || +!avio_feof(in)) { av_log(s, AV_LOG_ERROR, "Unable to read to manifest '%s'\n", url); if (ret == 0) ret = AVERROR_INVALIDDATA; } else { LIBXML_TEST_VERSION -doc = xmlReadMemory(buf.str, filesize, c->base_url, NULL, 0); +doc = xmlReadMemory(buf.str, buf.len, c->base_url, NULL, 0); root_element = xmlDocGetRootElement(doc); node = root_element; -- 2.31.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/mxfdec: support MCA audio information
From: Marc-Antoine Arnaud Channel reordering is removed from this patch because the new channel layout API will support it properly. Signed-off-by: Marton Balint --- libavformat/mxf.h| 3 + libavformat/mxfdec.c | 286 ++- 2 files changed, 283 insertions(+), 6 deletions(-) diff --git a/libavformat/mxf.h b/libavformat/mxf.h index fe9c52732c..d53a16df51 100644 --- a/libavformat/mxf.h +++ b/libavformat/mxf.h @@ -50,6 +50,9 @@ enum MXFMetadataSetType { TaggedValue, TapeDescriptor, AVCSubDescriptor, +AudioChannelLabelSubDescriptor, +SoundfieldGroupLabelSubDescriptor, +GroupOfSoundfieldGroupsLabelSubDescriptor, }; enum MXFFrameLayout { diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 1d50198279..26b5531720 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -51,11 +51,14 @@ #include "libavutil/mastering_display_metadata.h" #include "libavutil/mathematics.h" #include "libavcodec/bytestream.h" +#include "libavcodec/internal.h" +#include "libavutil/channel_layout.h" #include "libavutil/intreadwrite.h" #include "libavutil/parseutils.h" #include "libavutil/timecode.h" #include "libavutil/opt.h" #include "avformat.h" +#include "avlanguage.h" #include "internal.h" #include "mxf.h" @@ -177,6 +180,8 @@ typedef struct { int body_sid; MXFWrappingScheme wrapping; int edit_units_per_packet; /* how many edit units to read at a time (PCM, ClipWrapped) */ +int require_reordering; +int channel_ordering[FF_SANE_NB_CHANNELS]; } MXFTrack; typedef struct MXFDescriptor { @@ -205,6 +210,8 @@ typedef struct MXFDescriptor { unsigned int vert_subsampling; UID *file_descriptors_refs; int file_descriptors_count; +UID *sub_descriptors_refs; +int sub_descriptors_count; int linked_track_id; uint8_t *extradata; int extradata_size; @@ -217,6 +224,18 @@ typedef struct MXFDescriptor { size_t coll_size; } MXFDescriptor; +typedef struct MXFMCASubDescriptor { +MXFMetadataSet meta; +UID uid; +UID mca_link_id; +UID soundfield_group_link_id; +UID *group_of_soundfield_groups_link_id_refs; +int group_of_soundfield_groups_link_id_count; +UID mca_label_dictionary_id; +int mca_channel_id; +char *language; +} MXFMCASubDescriptor; + typedef struct MXFIndexTableSegment { MXFMetadataSet meta; int edit_unit_byte_count; @@ -311,6 +330,7 @@ static const uint8_t mxf_system_item_key_cp[] = { 0x06,0x0e,0x2b,0x static const uint8_t mxf_system_item_key_gc[] = { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x03,0x01,0x14 }; static const uint8_t mxf_klv_key[] = { 0x06,0x0e,0x2b,0x34 }; static const uint8_t mxf_apple_coll_prefix[] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01 }; + /* complete keys to match */ static const uint8_t mxf_crypto_source_container_ul[] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 }; static const uint8_t mxf_encrypted_triplet_key[] = { 0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 }; @@ -323,6 +343,17 @@ static const uint8_t mxf_indirect_value_utf16be[] = { 0x42,0x01,0x10,0x static const uint8_t mxf_apple_coll_max_cll[] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x01 }; static const uint8_t mxf_apple_coll_max_fall[] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x02 }; +static const uint8_t mxf_mca_label_dictionary_id[] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x01,0x00,0x00,0x00 }; +static const uint8_t mxf_mca_tag_symbol[] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x02,0x00,0x00,0x00 }; +static const uint8_t mxf_mca_tag_name[]= { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x03,0x00,0x00,0x00 }; +static const uint8_t mxf_group_of_soundfield_groups_link_id[] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x04,0x00,0x00,0x00 }; +static const uint8_t mxf_mca_link_id[] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x05,0x00,0x00,0x00 }; +static const uint8_t mxf_mca_channel_id[] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x04,0x0a,0x00,0x00,0x00,0x00 }; +static const uint8_t mxf_soundfield_group_link_id[]= { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x06,0x00,0x00,0x00 }; +static const uint8_t mxf_mca_rfc5646_spoken_language[] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0d,0x03,0x01,0x01,0x02,0x03,0x15,0x00,0x00 }; + +static const uint8_t mxf_sub_descriptor[] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x04,0x06,0x10,0x00,0x00 }; + static c
Re: [FFmpeg-devel] [PATCH 1/2] avformat/mxf: support MCA audio information
On Wed, 22 Dec 2021, Pierre-Anthony Lemieux wrote: On Wed, Dec 22, 2021 at 4:38 AM Tomas Härdin wrote: tis 2021-12-21 klockan 21:24 +0100 skrev Marton Balint: > > > It is not matter of performance, we should not introduce a hack such > as > reordering PCM channels in a demuxer if there is a better solution on > the > horizon. Yes, it feels like channel reordering should be a framework-level feature and not a per-demuxer feature. What about a roadmap where the channel-reordering-in-MXF patch is scheduled to be merged after some reasonable time (1 month?) if the channel API has not landed by then? This would allow contributors and users to plan ahead. I am not sure, if 1 month is enough for things to settle. Anyway, I have sent a patch which has MCA info but without reordering. We could merge that now, and later, when the API is in place, add support for non-native channel ordering. Regards, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/mxfdec: support MCA audio information
Minor suggestion below. In addition, will sample file(s) be added to FATE? Below are two examples: http://ffmpeg-imf-samples-public.s3.us-west-1.amazonaws.com/callout_51_l_r_c_lfe_ls_rs.mxf http://ffmpeg-imf-samples-public.s3.us-west-1.amazonaws.com/callout_51_l_c_r_ls_rs_lfe.mxf On Sat, Jan 1, 2022 at 11:27 AM Marton Balint wrote: > > From: Marc-Antoine Arnaud > > Channel reordering is removed from this patch because the new channel layout > API will support it properly. > > Signed-off-by: Marton Balint > --- > libavformat/mxf.h| 3 + > libavformat/mxfdec.c | 286 ++- > 2 files changed, 283 insertions(+), 6 deletions(-) > > diff --git a/libavformat/mxf.h b/libavformat/mxf.h > index fe9c52732c..d53a16df51 100644 > --- a/libavformat/mxf.h > +++ b/libavformat/mxf.h > @@ -50,6 +50,9 @@ enum MXFMetadataSetType { > TaggedValue, > TapeDescriptor, > AVCSubDescriptor, > +AudioChannelLabelSubDescriptor, > +SoundfieldGroupLabelSubDescriptor, > +GroupOfSoundfieldGroupsLabelSubDescriptor, > }; > > enum MXFFrameLayout { > diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c > index 1d50198279..26b5531720 100644 > --- a/libavformat/mxfdec.c > +++ b/libavformat/mxfdec.c > @@ -51,11 +51,14 @@ > #include "libavutil/mastering_display_metadata.h" > #include "libavutil/mathematics.h" > #include "libavcodec/bytestream.h" > +#include "libavcodec/internal.h" > +#include "libavutil/channel_layout.h" > #include "libavutil/intreadwrite.h" > #include "libavutil/parseutils.h" > #include "libavutil/timecode.h" > #include "libavutil/opt.h" > #include "avformat.h" > +#include "avlanguage.h" > #include "internal.h" > #include "mxf.h" > > @@ -177,6 +180,8 @@ typedef struct { > int body_sid; > MXFWrappingScheme wrapping; > int edit_units_per_packet; /* how many edit units to read at a time > (PCM, ClipWrapped) */ > +int require_reordering; > +int channel_ordering[FF_SANE_NB_CHANNELS]; > } MXFTrack; > > typedef struct MXFDescriptor { > @@ -205,6 +210,8 @@ typedef struct MXFDescriptor { > unsigned int vert_subsampling; > UID *file_descriptors_refs; > int file_descriptors_count; > +UID *sub_descriptors_refs; > +int sub_descriptors_count; > int linked_track_id; > uint8_t *extradata; > int extradata_size; > @@ -217,6 +224,18 @@ typedef struct MXFDescriptor { > size_t coll_size; > } MXFDescriptor; > > +typedef struct MXFMCASubDescriptor { > +MXFMetadataSet meta; > +UID uid; > +UID mca_link_id; > +UID soundfield_group_link_id; > +UID *group_of_soundfield_groups_link_id_refs; > +int group_of_soundfield_groups_link_id_count; > +UID mca_label_dictionary_id; > +int mca_channel_id; > +char *language; > +} MXFMCASubDescriptor; > + > typedef struct MXFIndexTableSegment { > MXFMetadataSet meta; > int edit_unit_byte_count; > @@ -311,6 +330,7 @@ static const uint8_t mxf_system_item_key_cp[] > = { 0x06,0x0e,0x2b,0x > static const uint8_t mxf_system_item_key_gc[] = { > 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x03,0x01,0x14 }; > static const uint8_t mxf_klv_key[] = { > 0x06,0x0e,0x2b,0x34 }; > static const uint8_t mxf_apple_coll_prefix[] = { > 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01 }; > + > /* complete keys to match */ > static const uint8_t mxf_crypto_source_container_ul[] = { > 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 > }; > static const uint8_t mxf_encrypted_triplet_key[] = { > 0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 > }; > @@ -323,6 +343,17 @@ static const uint8_t mxf_indirect_value_utf16be[] > = { 0x42,0x01,0x10,0x > static const uint8_t mxf_apple_coll_max_cll[] = { > 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x01 > }; > static const uint8_t mxf_apple_coll_max_fall[] = { > 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x0e,0x20,0x04,0x01,0x05,0x03,0x01,0x02 > }; > > +static const uint8_t mxf_mca_label_dictionary_id[] = { > 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x01,0x00,0x00,0x00 > }; > +static const uint8_t mxf_mca_tag_symbol[] = { > 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x02,0x00,0x00,0x00 > }; > +static const uint8_t mxf_mca_tag_name[]= { > 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x03,0x00,0x00,0x00 > }; > +static const uint8_t mxf_group_of_soundfield_groups_link_id[] = { > 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x04,0x00,0x00,0x00 > }; > +static const uint8_t mxf_mca_link_id[] = { > 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x01,0x03,0x07,0x01,0x05,0x00,0x00,0x00 > }; > +static const uint8_t mxf_mca_channe
Re: [FFmpeg-devel] [PATCH 1/2] avformat/mxf: support MCA audio information
On Sat, Jan 1, 2022 at 11:32 AM Marton Balint wrote: > > > > On Wed, 22 Dec 2021, Pierre-Anthony Lemieux wrote: > > > On Wed, Dec 22, 2021 at 4:38 AM Tomas Härdin wrote: > >> > >> tis 2021-12-21 klockan 21:24 +0100 skrev Marton Balint: > >> > > >> > > >> > It is not matter of performance, we should not introduce a hack such > >> > as > >> > reordering PCM channels in a demuxer if there is a better solution on > >> > the > >> > horizon. > > > > Yes, it feels like channel reordering should be a framework-level > > feature and not a per-demuxer feature. > > > > What about a roadmap where the channel-reordering-in-MXF patch is > > scheduled to be merged after some reasonable time (1 month?) if the > > channel API has not landed by then? This would allow contributors and > > users to plan ahead. > > I am not sure, if 1 month is enough for things to settle. > > Anyway, I have sent a patch which has MCA info but without reordering. We > could merge that now, and later, when the API is in place, add support for > non-native channel ordering. Sounds good to me. I have made two minor suggestions on the proposed patch. > > Regards, > Marton > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/2] avformat/rtpenc_rfc4175: support for interlace format
From: Limin Wang Below is step for how to test in your local machine: wget --no-check-certificate https://samples.ffmpeg.org/MPEG2/interlaced/burosch1.mpg 1. test interlace: ffmpeg -re -i ./burosch1.mpg -c:v bitpacked -pix_fmt yuv422p10 -f rtp rtp://239.255.0.1:6000 copy and create sdp file test.sdp ffplay -buffer_size 671088640 -protocol_whitelist "file,http,https,rtp,udp,tcp,tls" test.sdp 2. test progressive: ffmpeg -re -i ./burosch1.mpg -vf yadif -c:v bitpacked -pix_fmt yuv422p10 -f rtp rtp://239.255.0.1:6000 copy and create sdp file test.sdp ffplay -buffer_size 671088640 -protocol_whitelist "file,http,https,rtp,udp,tcp,tls" test.sdp Signed-off-by: Limin Wang --- If someone have other interface source from hardware, please help to test. libavformat/rtpenc.c | 9 +++-- libavformat/rtpenc.h | 2 +- libavformat/rtpenc_rfc4175.c | 31 +-- libavformat/sdp.c| 5 - 4 files changed, 33 insertions(+), 14 deletions(-) diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c index 17f5d9d..6be67b5 100644 --- a/libavformat/rtpenc.c +++ b/libavformat/rtpenc.c @@ -622,9 +622,14 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt) ff_rtp_send_jpeg(s1, pkt->data, size); break; case AV_CODEC_ID_BITPACKED: -case AV_CODEC_ID_RAWVIDEO: -ff_rtp_send_raw_rfc4175 (s1, pkt->data, size); +case AV_CODEC_ID_RAWVIDEO: { +int interlaced = st->codecpar->field_order != AV_FIELD_PROGRESSIVE; + +ff_rtp_send_raw_rfc4175(s1, pkt->data, size, interlaced, 0); +if (interlaced) +ff_rtp_send_raw_rfc4175(s1, pkt->data, size, interlaced, 1); break; +} case AV_CODEC_ID_OPUS: if (size > s->max_payload_size) { av_log(s1, AV_LOG_ERROR, diff --git a/libavformat/rtpenc.h b/libavformat/rtpenc.h index 70ea85b..9c8ad14 100644 --- a/libavformat/rtpenc.h +++ b/libavformat/rtpenc.h @@ -95,7 +95,7 @@ void ff_rtp_send_vc2hq(AVFormatContext *s1, const uint8_t *buf, int size, int in void ff_rtp_send_vp8(AVFormatContext *s1, const uint8_t *buff, int size); void ff_rtp_send_vp9(AVFormatContext *s1, const uint8_t *buff, int size); void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buff, int size); -void ff_rtp_send_raw_rfc4175(AVFormatContext *s1, const uint8_t *buf, int size); +void ff_rtp_send_raw_rfc4175(AVFormatContext *s1, const uint8_t *buf, int size, int interlaced, int field); const uint8_t *ff_h263_find_resync_marker_reverse(const uint8_t *av_restrict start, const uint8_t *av_restrict end); diff --git a/libavformat/rtpenc_rfc4175.c b/libavformat/rtpenc_rfc4175.c index ea4c370..257d072 100644 --- a/libavformat/rtpenc_rfc4175.c +++ b/libavformat/rtpenc_rfc4175.c @@ -21,36 +21,40 @@ #include "avformat.h" #include "rtpenc.h" -void ff_rtp_send_raw_rfc4175(AVFormatContext *s1, const uint8_t *buf, int size) +void ff_rtp_send_raw_rfc4175(AVFormatContext *s1, const uint8_t *buf, int size, int interlaced, int field) { RTPMuxContext *s = s1->priv_data; int width = s1->streams[0]->codecpar->width; int height = s1->streams[0]->codecpar->height; int xinc, yinc, pgroup; -int field = 0; int i = 0; int offset = 0; s->timestamp = s->cur_timestamp; switch (s1->streams[0]->codecpar->format) { case AV_PIX_FMT_UYVY422: -xinc = yinc = 2; +xinc = 2; +yinc = 1 << interlaced; pgroup = 4; break; case AV_PIX_FMT_YUV422P10: -xinc = yinc = 2; +xinc = 2; +yinc = 1 << interlaced; pgroup = 5; break; case AV_PIX_FMT_YUV420P: -xinc = yinc = 4; +xinc = 4; +yinc = 1 << interlaced; pgroup = 6; break; case AV_PIX_FMT_RGB24: -xinc = yinc = 1; +xinc = 1; +yinc = 1 << interlaced; pgroup = 3; break; case AV_PIX_FMT_BGR24: -xinc = yinc = 1; +xinc = 1; +yinc = 1 << interlaced; pgroup = 3; break; default: @@ -72,7 +76,9 @@ void ff_rtp_send_raw_rfc4175(AVFormatContext *s1, const uint8_t *buf, int size) headers = dest; do { -pixels = width * xinc - offset; +int l_line; + +pixels = width - offset; length = (pixels * pgroup) / xinc; left -= head_size; @@ -90,8 +96,9 @@ void ff_rtp_send_raw_rfc4175(AVFormatContext *s1, const uint8_t *buf, int size) *dest++ = length & 0xff; /* Line No */ -*dest++ = ((i >> 8) & 0x7f) | ((field << 7) & 0x80); -*dest++ = i & 0xff; +l_line = i >> interlaced; +*dest++ = ((l_line >> 8) & 0x7f) | ((field << 7) & 0x80); +
[FFmpeg-devel] [PATCH 1/2] avformat/rtpdec_rfc4175: support for interlace format
From: Limin Wang Signed-off-by: Limin Wang --- FYI, other patches have submit to support for the interface format few years ago: https://patchwork.ffmpeg.org/project/ffmpeg/patch/1531259521-19421-2-git-send-email-patrick.kerou...@savoirfairelinux.com/ I proposal to process the interlace format from packet level. libavformat/rtpdec_rfc4175.c | 25 + 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index a66e00d..e0a708e 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -33,6 +33,8 @@ struct PayloadContext { int depth; int width; int height; +int interlaced; +int field; uint8_t *frame; unsigned int frame_size; @@ -104,6 +106,11 @@ static int rfc4175_parse_format(AVStream *stream, PayloadContext *data) stream->codecpar->bits_per_coded_sample = av_get_bits_per_pixel(desc); data->frame_size = data->width * data->height * data->pgroup / data->xinc; +if (data->interlaced) +stream->codecpar->field_order = AV_FIELD_TT; +else +stream->codecpar->field_order = AV_FIELD_PROGRESSIVE; + if (data->framerate.den > 0) { stream->avg_frame_rate = data->framerate; stream->codecpar->bit_rate = data->frame_size * av_q2d(data->framerate) * 8; @@ -124,6 +131,8 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, AVStream *stream, data->sampling = av_strdup(value); else if (!strncmp(attr, "depth", 5)) data->depth = atoi(value); +else if (!strncmp(attr, "interlace", 9)) +data->interlaced = 1; else if (!strncmp(attr, "exactframerate", 14)) { if (av_parse_video_rate(&data->framerate, value) < 0) return AVERROR(EINVAL); @@ -195,15 +204,18 @@ static int rfc4175_parse_sdp_line(AVFormatContext *s, int st_index, static int rfc4175_finalize_packet(PayloadContext *data, AVPacket *pkt, int stream_index) { -int ret; +int ret = 0; pkt->stream_index = stream_index; +if (!data->interlaced || data->field) { ret = av_packet_from_data(pkt, data->frame, data->frame_size); if (ret < 0) { av_freep(&data->frame); } - data->frame = NULL; +} + +data->field = 0; return ret; } @@ -213,7 +225,7 @@ static int rfc4175_handle_packet(AVFormatContext *ctx, PayloadContext *data, const uint8_t * buf, int len, uint16_t seq, int flags) { -int length, line, offset, cont; +int length, line, offset, cont, field; const uint8_t *headers = buf + 2; /* skip extended seqnum */ const uint8_t *payload = buf + 2; int payload_len = len - 2; @@ -266,10 +278,12 @@ static int rfc4175_handle_packet(AVFormatContext *ctx, PayloadContext *data, return AVERROR_INVALIDDATA; length = (headers[0] << 8) | headers[1]; +field = (headers[2] & 0x80) >> 7; line = ((headers[2] & 0x7f) << 8) | headers[3]; offset = ((headers[4] & 0x7f) << 8) | headers[5]; cont = headers[4] & 0x80; headers += 6; +data->field = field; if (!data->pgroup || length % data->pgroup) return AVERROR_INVALIDDATA; @@ -277,9 +291,12 @@ static int rfc4175_handle_packet(AVFormatContext *ctx, PayloadContext *data, if (length > payload_len) length = payload_len; +if (data->interlaced) +line = 2 * line + field; + /* prevent ill-formed packets to write after buffer's end */ copy_offset = (line * data->width + offset) * data->pgroup / data->xinc; -if (copy_offset + length > data->frame_size) +if (copy_offset + length > data->frame_size || !data->frame) return AVERROR_INVALIDDATA; dest = data->frame + copy_offset; -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/mxfdec: support MCA audio information
On Sat, 1 Jan 2022, Pierre-Anthony Lemieux wrote: Minor suggestion below. In addition, will sample file(s) be added to FATE? Below are two examples: http://ffmpeg-imf-samples-public.s3.us-west-1.amazonaws.com/callout_51_l_r_c_lfe_ls_rs.mxf http://ffmpeg-imf-samples-public.s3.us-west-1.amazonaws.com/callout_51_l_c_r_ls_rs_lfe.mxf Good idea, can someone with access please upload these to the fate mxf folder? [...] I suggest adding the following audio channels, which are specified in SMPTE ST 2067-8 [1] and have a direct mapping to ffmpeg audio channels: urn:smpte:ul:060e2b34.0401010d.03020120.0300 (Left Total) -> AV_CH_STEREO_LEFT urn:smpte:ul:060e2b34.0401010d.03020120.0400 (RightTotal) -> AV_CH_STEREO_RIGHT [1] https://registry.smpte-ra.org/view/published/labels_view.html Unfortunately this is a Dolby encoded stereo mix, not an ordinary LeftOnly / RightOnly mix. So I am not how this should be signalled. Regards, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/mxfdec: support MCA audio information
Pierre-Anthony Lemieux: > Minor suggestion below. > > In addition, will sample file(s) be added to FATE? Below are two examples: > > http://ffmpeg-imf-samples-public.s3.us-west-1.amazonaws.com/callout_51_l_r_c_lfe_ls_rs.mxf > http://ffmpeg-imf-samples-public.s3.us-west-1.amazonaws.com/callout_51_l_c_r_ls_rs_lfe.mxf > These files are 1.62MiB each, having 49 packets of lossless audio. Would it decrease coverage if this were reduced? After all, the amount of audio should not matter for channel reorderings. - Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/mxfdec: support MCA audio information
On Sat, Jan 1, 2022 at 5:35 PM Andreas Rheinhardt wrote: > > Pierre-Anthony Lemieux: > > Minor suggestion below. > > > > In addition, will sample file(s) be added to FATE? Below are two examples: > > > > http://ffmpeg-imf-samples-public.s3.us-west-1.amazonaws.com/callout_51_l_r_c_lfe_ls_rs.mxf > > http://ffmpeg-imf-samples-public.s3.us-west-1.amazonaws.com/callout_51_l_c_r_ls_rs_lfe.mxf > > > > These files are 1.62MiB each, having 49 packets of lossless audio. Would > it decrease coverage if this were reduced? After all, the amount of > audio should not matter for channel reorderings. Each channel contains a synthesized human voice that announces the name of the channel, so that a reviewer can, by simple inspection, confirm the expected channel order. This will be particularly useful when automatic channel reordering is performed. The contents of each channel could be changed to a single tone with each channel assigned a different tone, e.g. 1 to 6 kHz. This might make the files shorter. > > - Andreas > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/mxfdec: support MCA audio information
On Sat, Jan 1, 2022 at 5:11 PM Marton Balint wrote: > > > > On Sat, 1 Jan 2022, Pierre-Anthony Lemieux wrote: > > > Minor suggestion below. > > > > In addition, will sample file(s) be added to FATE? Below are two examples: > > > > http://ffmpeg-imf-samples-public.s3.us-west-1.amazonaws.com/callout_51_l_r_c_lfe_ls_rs.mxf > > http://ffmpeg-imf-samples-public.s3.us-west-1.amazonaws.com/callout_51_l_c_r_ls_rs_lfe.mxf > > Good idea, can someone with access please upload these to the fate mxf > folder? > > [...] > > > I suggest adding the following audio channels, which are specified in > > SMPTE ST 2067-8 [1] and have a direct mapping to ffmpeg audio > > channels:AV_CH_STEREO_LEFT > > > > urn:smpte:ul:060e2b34.0401010d.03020120.0300 (Left Total) -> > > AV_CH_STEREO_LEFT > > urn:smpte:ul:060e2b34.0401010d.03020120.0400 (RightTotal) -> > > AV_CH_STEREO_RIGHT > > > > [1] https://registry.smpte-ra.org/view/published/labels_view.html > > Unfortunately this is a Dolby encoded stereo mix, not an ordinary LeftOnly > / RightOnly mix. So I am not how this should be signalled. My interpretation below. In "mov_chan.c", AV_CH_LAYOUT_STEREO_DOWNMIX means MOV_CH_LAYOUT_MATRIXSTEREO [1], which is defined in Core Audio [2]. LtRt, i.e. matrix-encoded audio, is not generally Dolby-specific [3]. [1] https://github.com/FFmpeg/FFmpeg/blob/d6b2357eddca392ee137cb2a92ff178a0a7d0cce/libavformat/mov_chan.c#L168 [2] https://developer.apple.com/documentation/coreaudiotypes/1572101-audio_channel_layout_tags/kaudiochannellayouttag_matrixstereo?changes=_8_7&language=objc [3] https://en.wikipedia.org/wiki/Matrix_decoder > > Regards, > Marton > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avfilter/vpp_qsv: fix regression on older api versions (e.g. 1.11)
From: softworkz Commit 8b83dad82512a6948b63408f964463b063ad24c9 introduced a regression in a way that scaling via vpp_qsv didn't work any longer for devices with an MSDK runtime version lower than 1.19. This is true for older CPUs which are stuck at 1.11. The commit added checks for the compile-sdk version but it didn't test for the runtime version. Signed-off-by: softworkz --- avfilter/vpp_qsv: fix regression on older api versions (e.g. 1.11) Fix a recently introduced regression when using QSV VPP. Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-15%2Fsoftworkz%2Fqsv_vpp_regression-v1 Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-15/softworkz/qsv_vpp_regression-v1 Pull-Request: https://github.com/ffstaging/FFmpeg/pull/15 libavfilter/vf_vpp_qsv.c | 32 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index ab58a5777e..09590157e3 100644 --- a/libavfilter/vf_vpp_qsv.c +++ b/libavfilter/vf_vpp_qsv.c @@ -139,8 +139,9 @@ static const AVOption options[] = { { "height", "Output video height", OFFSET(oh), AV_OPT_TYPE_STRING, { .str="w*ch/cw" }, 0, 255, .flags = FLAGS }, { "format", "Output pixel format", OFFSET(output_format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS }, { "async_depth", "Internal parallelization depth, the higher the value the higher the latency.", OFFSET(async_depth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, .flags = FLAGS }, +#ifdef QSV_HAVE_SCALING_CONFIG { "scale_mode", "scale mode: 0=auto, 1=low power, 2=high quality", OFFSET(scale_mode), AV_OPT_TYPE_INT, { .i64 = MFX_SCALING_MODE_DEFAULT }, MFX_SCALING_MODE_DEFAULT, MFX_SCALING_MODE_QUALITY, .flags = FLAGS, "scale mode" }, - +#endif { NULL } }; @@ -304,6 +305,7 @@ static int config_output(AVFilterLink *outlink) QSVVPPParam param = { NULL }; QSVVPPCrop crop = { 0 }; mfxExtBuffer*ext_buf[ENH_FILTERS_COUNT]; +mfxVersion mfx_version; AVFilterLink*inlink = ctx->inputs[0]; enum AVPixelFormat in_format; @@ -317,6 +319,11 @@ static int config_output(AVFilterLink *outlink) param.ext_buf = ext_buf; param.async_depth = vpp->async_depth; +if (MFXQueryVersion(vpp->qsv->session, &mfx_version) < 0) { +av_log(ctx, AV_LOG_ERROR, "Failed to query mfx version.\n"); +return AVERROR(EINVAL); +} + if (inlink->format == AV_PIX_FMT_QSV) { if (!inlink->hw_frames_ctx || !inlink->hw_frames_ctx->data) return AVERROR(EINVAL); @@ -467,19 +474,20 @@ static int config_output(AVFilterLink *outlink) #endif } -if (inlink->w != outlink->w || inlink->h != outlink->h) { #ifdef QSV_HAVE_SCALING_CONFIG -memset(&vpp->scale_conf, 0, sizeof(mfxExtVPPScaling)); -vpp->scale_conf.Header.BufferId= MFX_EXTBUFF_VPP_SCALING; -vpp->scale_conf.Header.BufferSz= sizeof(mfxExtVPPScaling); -vpp->scale_conf.ScalingMode= vpp->scale_mode; - -param.ext_buf[param.num_ext_buf++] = (mfxExtBuffer*)&vpp->scale_conf; -#else -av_log(ctx, AV_LOG_WARNING, "The QSV VPP Scale option is " -"not supported with this MSDK version.\n"); -#endif +if (inlink->w != outlink->w || inlink->h != outlink->h) { +if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 19)) { +memset(&vpp->scale_conf, 0, sizeof(mfxExtVPPScaling)); +vpp->scale_conf.Header.BufferId= MFX_EXTBUFF_VPP_SCALING; +vpp->scale_conf.Header.BufferSz= sizeof(mfxExtVPPScaling); +vpp->scale_conf.ScalingMode= vpp->scale_mode; + +param.ext_buf[param.num_ext_buf++] = (mfxExtBuffer*)&vpp->scale_conf; +} else +av_log(ctx, AV_LOG_WARNING, "The QSV VPP Scale option is " +"not supported with this MSDK version.\n"); } +#endif if (vpp->use_frc || vpp->use_crop || vpp->deinterlace || vpp->denoise || vpp->detail || vpp->procamp || vpp->rotate || vpp->hflip || base-commit: d6b2357eddca392ee137cb2a92ff178a0a7d0cce -- ffmpeg-codebot ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] GitHub Integration
> -Original Message- > From: ffmpeg-devel On Behalf Of Soft Works > Sent: Tuesday, December 28, 2021 10:58 PM > To: FFmpeg development discussions and patches > Subject: Re: [FFmpeg-devel] GitHub Integration > > One component of the GitHub "Bridge" is a mirror of the ffmpeg-devel > mailing list as a Git repository which provides a web interfaces, can be > cloned via Git and can also be accessed from Atom feed readers. > This allows to follow the mailing list without subscribing. The web UI > might not be everybody's taste, though. It's the same that is used for > Linux kernel mailing lists (https://lore.kernel.org/git/). > I had to set this up as it's a requirement for the GitHub "Bridge", but > maybe it's useful for someone in other ways: > > https://master.gitmailbox.com/ffmpegdev/ I have just ACTIVATED patch submission via GitHub and submitted the first patch through this method. Pull requests can be created in this repository (for now): https://github.com/ffstaging/FFmpeg What's not nice is that the submitted e-mail shows "ffmpegagent" as sender and patchwork is showing it under that name as well. We'll need to see how this can be improved. Happy new year! softworkz ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2] avfilter/vpp_qsv: fix regression on older api versions (e.g. 1.11)
From: softworkz Commit 8b83dad82512a6948b63408f964463b063ad24c9 introduced a regression in a way that scaling via vpp_qsv doesn't work any longer for devices with an MSDK runtime version lower than 1.19. This is true for older CPUs which are stuck at 1.11. The commit added checks for the compile-sdk version but it didn't test for the runtime version. Signed-off-by: softworkz --- avfilter/vpp_qsv: fix regression on older api versions (e.g. 1.11) Fix a recently introduced regression when using QSV VPP. v2: Fixed commit message wrapping Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-15%2Fsoftworkz%2Fqsv_vpp_regression-v2 Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-15/softworkz/qsv_vpp_regression-v2 Pull-Request: https://github.com/ffstaging/FFmpeg/pull/15 Range-diff vs v1: 1: eea966f702 ! 1: ccede9d840 avfilter/vpp_qsv: fix regression on older api versions (e.g. 1.11) @@ Metadata ## Commit message ## avfilter/vpp_qsv: fix regression on older api versions (e.g. 1.11) -Commit 8b83dad82512a6948b63408f964463b063ad24c9 introduced a regression in a way -that scaling via vpp_qsv didn't work any longer for devices with an MSDK runtime -version lower than 1.19. This is true for older CPUs which are stuck at 1.11. -The commit added checks for the compile-sdk version but it didn't test for the -runtime version. +Commit 8b83dad82512a6948b63408f964463b063ad24c9 introduced a +regression in a way that scaling via vpp_qsv doesn't work any longer +for devices with an MSDK runtime version lower than 1.19. This is true +for older CPUs which are stuck at 1.11. +The commit added checks for the compile-sdk version but it didn't test +for the runtime version. Signed-off-by: softworkz libavfilter/vf_vpp_qsv.c | 32 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c index ab58a5777e..09590157e3 100644 --- a/libavfilter/vf_vpp_qsv.c +++ b/libavfilter/vf_vpp_qsv.c @@ -139,8 +139,9 @@ static const AVOption options[] = { { "height", "Output video height", OFFSET(oh), AV_OPT_TYPE_STRING, { .str="w*ch/cw" }, 0, 255, .flags = FLAGS }, { "format", "Output pixel format", OFFSET(output_format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS }, { "async_depth", "Internal parallelization depth, the higher the value the higher the latency.", OFFSET(async_depth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, .flags = FLAGS }, +#ifdef QSV_HAVE_SCALING_CONFIG { "scale_mode", "scale mode: 0=auto, 1=low power, 2=high quality", OFFSET(scale_mode), AV_OPT_TYPE_INT, { .i64 = MFX_SCALING_MODE_DEFAULT }, MFX_SCALING_MODE_DEFAULT, MFX_SCALING_MODE_QUALITY, .flags = FLAGS, "scale mode" }, - +#endif { NULL } }; @@ -304,6 +305,7 @@ static int config_output(AVFilterLink *outlink) QSVVPPParam param = { NULL }; QSVVPPCrop crop = { 0 }; mfxExtBuffer*ext_buf[ENH_FILTERS_COUNT]; +mfxVersion mfx_version; AVFilterLink*inlink = ctx->inputs[0]; enum AVPixelFormat in_format; @@ -317,6 +319,11 @@ static int config_output(AVFilterLink *outlink) param.ext_buf = ext_buf; param.async_depth = vpp->async_depth; +if (MFXQueryVersion(vpp->qsv->session, &mfx_version) < 0) { +av_log(ctx, AV_LOG_ERROR, "Failed to query mfx version.\n"); +return AVERROR(EINVAL); +} + if (inlink->format == AV_PIX_FMT_QSV) { if (!inlink->hw_frames_ctx || !inlink->hw_frames_ctx->data) return AVERROR(EINVAL); @@ -467,19 +474,20 @@ static int config_output(AVFilterLink *outlink) #endif } -if (inlink->w != outlink->w || inlink->h != outlink->h) { #ifdef QSV_HAVE_SCALING_CONFIG -memset(&vpp->scale_conf, 0, sizeof(mfxExtVPPScaling)); -vpp->scale_conf.Header.BufferId= MFX_EXTBUFF_VPP_SCALING; -vpp->scale_conf.Header.BufferSz= sizeof(mfxExtVPPScaling); -vpp->scale_conf.ScalingMode= vpp->scale_mode; - -param.ext_buf[param.num_ext_buf++] = (mfxExtBuffer*)&vpp->scale_conf; -#else -av_log(ctx, AV_LOG_WARNING, "The QSV VPP Scale option is " -"not supported with this MSDK version.\n"); -#endif +if (inlink->w != outlink->w || inlink->h != outlink->h) { +if (QSV_RUNTIME_VERSION_ATLEAST(mfx_version, 1, 19)) { +memset(&vpp->scale_conf, 0, sizeof(mfxExtVPPScaling)); +vpp->scale_conf.Header.BufferId= MFX_EXTBUFF_VPP_SCALING; +vpp->scale_conf.Header.BufferSz= sizeof(mfxExtVPPScaling); +vpp->scale_conf.ScalingMode= vpp->scale_mode; + +param.ext_buf[param.num_ext_buf++] = (mfxExtBuffer*)&vpp->scale_conf; +} else +av_log
Re: [FFmpeg-devel] [PATCH v9 4/6] lavc: Implement Dolby Vision RPU parsing
Niklas Haas: > From: Niklas Haas > > Based on a mixture of guesswork, partial documentation in patents, and > reverse engineering of real-world samples. Confirmed working for all the > samples I've thrown at it. > > Contains some annoying machinery to persist these values in between > frames, which is needed in theory even though I've never actually seen a > sample that relies on it in practice. May or may not work. > > Since the distinction matters greatly for parsing the color matrix > values, this includes a small helper function to guess the right profile > from the RPU itself in case the user has forgotten to forward the dovi > configuration record to the decoder. (Which in practice, only ffmpeg.c > and ffplay do..) > > Notable omissions / deviations: > - CRC32 verification. This is based on the MPEG2 CRC32 type, which does > not seem to be implemented in lavu. (And I don't care enough to do so) > - Linear interpolation support. Nothing documents this (beyond its > existence) and no samples use it, so impossible to implement. > - All of the extension metadata blocks, but these contain values that > seem largely congruent with ST2094, HDR10, or other existing forms of > side data, so I will defer parsing/attaching them to a future commit. > - The patent describes a mechanism for predicting coefficients from > previous RPUs, but the bit for the flag whether to use the > prediction deltas or signal entirely new coefficients does not seem to > be present in actual RPUs, so we ignore this subsystem entirely. > - In the patent's spec, the NLQ subsystem also loops over > num_nlq_pivots, but even in the patent the number is hard-coded to one > iteration rather than signalled. So we only store one set of coefs. > > Heavily influenced by https://github.com/quietvoid/dovi_tool > Documentation drawn from US Patent 10,701,399 B2 and ETSI GS CCM 001 > > Signed-off-by: Niklas Haas > --- > configure | 2 + > libavcodec/Makefile | 1 + > libavcodec/dovi_rpu.c | 430 ++ > libavcodec/dovi_rpu.h | 71 +++ > 4 files changed, 504 insertions(+) > create mode 100644 libavcodec/dovi_rpu.c > create mode 100644 libavcodec/dovi_rpu.h > > diff --git a/configure b/configure > index 0ccd3bda11..68658a847f 100755 > --- a/configure > +++ b/configure > @@ -2434,6 +2434,7 @@ CONFIG_EXTRA=" > cbs_vp9 > dirac_parse > dnn > +dovi_rpu > dvprofile > exif > faandct > @@ -2706,6 +2707,7 @@ cbs_mpeg2_select="cbs" > cbs_vp9_select="cbs" > dct_select="rdft" > dirac_parse_select="golomb" > +dovi_rpu_select="golomb" > dnn_suggest="libtensorflow libopenvino" > dnn_deps="avformat swscale" > error_resilience_select="me_cmp" > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > index fb90ecea84..7364c7a91f 100644 > --- a/libavcodec/Makefile > +++ b/libavcodec/Makefile > @@ -77,6 +77,7 @@ OBJS-$(CONFIG_CBS_MPEG2) += cbs_mpeg2.o > OBJS-$(CONFIG_CBS_VP9) += cbs_vp9.o > OBJS-$(CONFIG_CRYSTALHD) += crystalhd.o > OBJS-$(CONFIG_DCT) += dct.o dct32_fixed.o dct32_float.o > +OBJS-$(CONFIG_DOVI_RPU)+= dovi_rpu.o > OBJS-$(CONFIG_ERROR_RESILIENCE)+= error_resilience.o > OBJS-$(CONFIG_EXIF)+= exif.o tiff_common.o > OBJS-$(CONFIG_FAANDCT) += faandct.o > diff --git a/libavcodec/dovi_rpu.c b/libavcodec/dovi_rpu.c > new file mode 100644 > index 00..fc2e1fb2a1 > --- /dev/null > +++ b/libavcodec/dovi_rpu.c > @@ -0,0 +1,430 @@ > +/* > + * Dolby Vision RPU decoder > + * > + * Copyright (C) 2021 Jan Ekström > + * Copyright (C) 2021 Niklas Haas > + * > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with FFmpeg; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 > USA > + */ > + > +#include "libavutil/buffer.h" > + > +#include "dovi_rpu.h" > +#include "golomb.h" > +#include "get_bits.h" > + > +enum { > +RPU_COEFF_FIXED = 0, > +RPU_COEFF_FLOAT = 1, > +}; > + > +/** > + * Private contents of vdr_ref. > + */ > +typedef struct DOVIVdrRef { > +AVDOVIDataMapping mapping; > +AVDOVIColorMetadata color; > +} DOVIVdrRef; > + > +void ff_dovi_ctx_unref(DOVIContext *s) > +{ > +for (int i = 0; i < FF_ARRAY_ELEMS(s->vdr_ref); i+
Re: [FFmpeg-devel] [PATCH v9 6/6] lavc/hevcdec: Parse DOVI RPU NALs
Niklas Haas: > From: Niklas Haas > > And expose the parsed values as frame side data. Update FATE results to > match. > > It's worth documenting that this relies on the dovi configuration record > being present on the first AVPacket fed to the decoder, which in > practice is the case if if the API user has called something like > av_format_inject_global_side_data, which is unfortunately not the > default. > > This commit is not the time and place to change that behavior, though. > > Signed-off-by: Niklas Haas > --- > configure | 2 +- > libavcodec/hevcdec.c | 63 +-- > libavcodec/hevcdec.h | 3 + > tests/ref/fate/hevc-dv-rpu | 224 + > 4 files changed, 283 insertions(+), 9 deletions(-) > > diff --git a/configure b/configure > index 68658a847f..7803aa47af 100755 > --- a/configure > +++ b/configure > @@ -2826,7 +2826,7 @@ h264_decoder_suggest="error_resilience" > hap_decoder_select="snappy texturedsp" > hap_encoder_deps="libsnappy" > hap_encoder_select="texturedspenc" > -hevc_decoder_select="atsc_a53 bswapdsp cabac golomb hevcparse videodsp" > +hevc_decoder_select="atsc_a53 bswapdsp cabac dovi_rpu golomb hevcparse > videodsp" > huffyuv_decoder_select="bswapdsp huffyuvdsp llviddsp" > huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llvidencdsp" > hymt_decoder_select="huffyuv_decoder" > diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c > index 46d9edf8eb..298d89fea6 100644 > --- a/libavcodec/hevcdec.c > +++ b/libavcodec/hevcdec.c > @@ -2723,6 +2723,7 @@ error: > static int set_side_data(HEVCContext *s) > { > AVFrame *out = s->ref->frame; > +int ret; > > if (s->sei.frame_packing.present && > s->sei.frame_packing.arrangement_type >= 3 && > @@ -2967,6 +2968,9 @@ static int set_side_data(HEVCContext *s) > s->rpu_buf = NULL; > } > > +if ((ret = ff_dovi_attach_side_data(&s->dovi_ctx, out)) < 0) > +return ret; > + > return 0; > } > > @@ -3298,16 +3302,24 @@ static int decode_nal_units(HEVCContext *s, const > uint8_t *buf, int length) > if (s->pkt.nb_nals > 1 && s->pkt.nals[s->pkt.nb_nals - 1].type == > HEVC_NAL_UNSPEC62 && > s->pkt.nals[s->pkt.nb_nals - 1].size > 2 && > !s->pkt.nals[s->pkt.nb_nals - 1].nuh_layer_id > && !s->pkt.nals[s->pkt.nb_nals - 1].temporal_id) { > +H2645NAL *nal = &s->pkt.nals[s->pkt.nb_nals - 1]; > if (s->rpu_buf) { > av_buffer_unref(&s->rpu_buf); > av_log(s->avctx, AV_LOG_WARNING, "Multiple Dolby Vision RPUs > found in one AU. Skipping previous.\n"); > } > > -s->rpu_buf = av_buffer_alloc(s->pkt.nals[s->pkt.nb_nals - > 1].raw_size - 2); > +s->rpu_buf = av_buffer_alloc(nal->raw_size - 2); > if (!s->rpu_buf) > return AVERROR(ENOMEM); > +memcpy(s->rpu_buf->data, nal->raw_data + 2, nal->raw_size - 2); > > -memcpy(s->rpu_buf->data, s->pkt.nals[s->pkt.nb_nals - 1].raw_data + > 2, s->pkt.nals[s->pkt.nb_nals - 1].raw_size - 2); > +s->dovi_ctx.config = s->dovi_cfg ? (void *) s->dovi_cfg->data : NULL; > +ret = ff_dovi_rpu_parse(&s->dovi_ctx, nal->data + 2, nal->size - 2); > +if (ret < 0) { > +av_buffer_unref(&s->rpu_buf); > +av_log(s->avctx, AV_LOG_WARNING, "Error parsing DOVI NAL > unit.\n"); > +/* ignore */ > +} > } > > /* decode the NAL units */ > @@ -3440,8 +3452,8 @@ static int hevc_decode_frame(AVCodecContext *avctx, > void *data, int *got_output, > AVPacket *avpkt) > { > int ret; > -size_t new_extradata_size; > -uint8_t *new_extradata; > +uint8_t *sd; > +size_t sd_size; > HEVCContext *s = avctx->priv_data; > > if (!avpkt->size) { > @@ -3453,14 +3465,37 @@ static int hevc_decode_frame(AVCodecContext *avctx, > void *data, int *got_output, > return 0; > } > > -new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, > -&new_extradata_size); > -if (new_extradata && new_extradata_size > 0) { > -ret = hevc_decode_extradata(s, new_extradata, new_extradata_size, 0); > +sd = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &sd_size); > +if (sd && sd_size > 0) { > +ret = hevc_decode_extradata(s, sd, sd_size, 0); > if (ret < 0) > return ret; > } > > +sd = av_packet_get_side_data(avpkt, AV_PKT_DATA_DOVI_CONF, &sd_size); > +if (sd && sd_size > 0) { > +if (s->dovi_cfg) { > +/* Reuse existing buffer */ > +if ((ret = av_buffer_make_writable(&s->dovi_cfg)) < 0) > +return ret; > +} else { > +/* Allocate new buffer */ > +AVDOVIDecoderConfigurationRecord *cfg; > +size_t cfg_size; > +cfg = av_dovi_alloc(&cfg_size); >