ffmpeg-devel
Threads by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
January 2022
- 93 participants
- 351 discussions
23 May '22
Signed-off-by: softworkz <softworkz(a)hotmail.com>
---
V3: Split commits, add version bump, use flag param
doc/APIchanges | 3 +++
libavutil/frame.c | 58 ++++++++++++++++++++++++++-------------------
libavutil/frame.h | 16 +++++++++++++
libavutil/version.h | 4 ++--
4 files changed, 54 insertions(+), 27 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index bc9f4e38da..409f66ec4d 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,9 @@ libavutil: 2021-04-27
API changes, most recent first:
+2021-12-02 - xxxxxxxxxx - lavu 57.10.100 - frame.h
+ Add av_frame_copy_side_data() and AV_FRAME_COPY_PROPS_FORCECOPY flag.
+
2021-11-22 - xxxxxxxxxx - lavu 57.9.100 - pixfmt.h
Add AV_PIX_FMT_P210, AV_PIX_FMT_P410, AV_PIX_FMT_P216, and AV_PIX_FMT_P416.
diff --git a/libavutil/frame.c b/libavutil/frame.c
index d4d3ad6988..f5177c2667 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -256,6 +256,36 @@ int av_frame_get_buffer(AVFrame *frame, int align)
return AVERROR(EINVAL);
}
+int av_frame_copy_side_data(AVFrame* dst, const AVFrame* src, int flags)
+{
+ for (unsigned i = 0; i < src->nb_side_data; i++) {
+ const AVFrameSideData *sd_src = src->side_data[i];
+ AVFrameSideData *sd_dst;
+ if ( sd_src->type == AV_FRAME_DATA_PANSCAN
+ && (src->width != dst->width || src->height != dst->height))
+ continue;
+ if (flags & AV_FRAME_COPY_PROPS_FORCECOPY) {
+ sd_dst = av_frame_new_side_data(dst, sd_src->type,
+ sd_src->size);
+ if (!sd_dst) {
+ wipe_side_data(dst);
+ return AVERROR(ENOMEM);
+ }
+ memcpy(sd_dst->data, sd_src->data, sd_src->size);
+ } else {
+ AVBufferRef *ref = av_buffer_ref(sd_src->buf);
+ sd_dst = av_frame_new_side_data_from_buf(dst, sd_src->type, ref);
+ if (!sd_dst) {
+ av_buffer_unref(&ref);
+ wipe_side_data(dst);
+ return AVERROR(ENOMEM);
+ }
+ }
+ av_dict_copy(&sd_dst->metadata, sd_src->metadata, 0);
+ }
+ return 0;
+}
+
static int frame_copy_props(AVFrame *dst, const AVFrame *src, int force_copy)
{
int ret, i;
@@ -293,31 +323,9 @@ static int frame_copy_props(AVFrame *dst, const AVFrame *src, int force_copy)
av_dict_copy(&dst->metadata, src->metadata, 0);
- for (i = 0; i < src->nb_side_data; i++) {
- const AVFrameSideData *sd_src = src->side_data[i];
- AVFrameSideData *sd_dst;
- if ( sd_src->type == AV_FRAME_DATA_PANSCAN
- && (src->width != dst->width || src->height != dst->height))
- continue;
- if (force_copy) {
- sd_dst = av_frame_new_side_data(dst, sd_src->type,
- sd_src->size);
- if (!sd_dst) {
- wipe_side_data(dst);
- return AVERROR(ENOMEM);
- }
- memcpy(sd_dst->data, sd_src->data, sd_src->size);
- } else {
- AVBufferRef *ref = av_buffer_ref(sd_src->buf);
- sd_dst = av_frame_new_side_data_from_buf(dst, sd_src->type, ref);
- if (!sd_dst) {
- av_buffer_unref(&ref);
- wipe_side_data(dst);
- return AVERROR(ENOMEM);
- }
- }
- av_dict_copy(&sd_dst->metadata, sd_src->metadata, 0);
- }
+ if (ret = av_frame_copy_side_data(dst, src,
+ force_copy ? AV_FRAME_COPY_PROPS_FORCECOPY : 0) < 0)
+ return ret;
ret = av_buffer_replace(&dst->opaque_ref, src->opaque_ref);
ret |= av_buffer_replace(&dst->private_ref, src->private_ref);
diff --git a/libavutil/frame.h b/libavutil/frame.h
index 753234792e..58da8c4cc3 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -812,6 +812,22 @@ int av_frame_copy(AVFrame *dst, const AVFrame *src);
*/
int av_frame_copy_props(AVFrame *dst, const AVFrame *src);
+/**
+ * Copy actual data buffers instead of references.
+ */
+#define AV_FRAME_COPY_PROPS_FORCECOPY 1
+
+/**
+ * Copy only side-data from src to dst.
+ *
+ * @param dst a frame to which the side data should be copied.
+ * @param src a frame from which to copy the side data.
+ * @param flags flags of type AV_FRAME_COPY_PROPS_*, controlling copy behavior.
+ *
+ * @return >= 0 on success, a negative AVERROR on error.
+ */
+int av_frame_copy_side_data(AVFrame* dst, const AVFrame* src, int flags);
+
/**
* Get the buffer reference a given data plane is stored in.
*
diff --git a/libavutil/version.h b/libavutil/version.h
index a2615cd299..0acb88cf40 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,8 +79,8 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 57
-#define LIBAVUTIL_VERSION_MINOR 9
-#define LIBAVUTIL_VERSION_MICRO 101
+#define LIBAVUTIL_VERSION_MINOR 10
+#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \
--
2.30.2.windows.1
5
8
[RFC] QSV: Introduce min Compile-SDK Version and check for Runtime-Versions instead
by Soft Works 22 May '22
by Soft Works 22 May '22
22 May '22
Hi,
this is a follow-up to my recently submitted patch:
“avfilter/vpp_qsv: fix regression on older api versions (e.g. 1.11)”
That patch only fixes the one important regression from multiple issues which
have been introduced by recent changes. Those changes have gone in a less
than ideal direction, because they have introduced checks based on the version
of the MSDK which ffmpeg is being compiled against, but they didn’t add
checks for the runtime libmfx/MSDK versions – and this causes failures,
sometimes even for functionality which has worked before (=>regressions).
Background
- the compile-sdk version determines which features can be used
but only when
- the runtime SDK version supports it
and
- the hardware (GPU gen) supports it
- ALL compile-sdk versions can interface with ALL runtime MSDK
versions (basically), no matter whether runtime version is newer or
older
- At least on Windows, some hw is stuck at a certain runtime version,
e.g.: there are new drivers for Broadwell, but the MSDK runtime
is always 1.11
Conclusion
Adding checks for the runtime MSDK versions is required wherever a feature
might not be supported by older MSDK runtimes - I think that's an obvious
necessity.
Question
Having both - run-time and compile-time checks all over the code is adding
a lot of complexity and makes it difficult to maintain and work with.
Hence, I'm wondering whether we couldn't/shouldn't introduce a minimum
MSDK compile-time version, for example 1.22, or even later?
This would allow simplification of the QSV code in many places where run-time
version checks are actually needed instead.
Over time, there have been better and worse MSDK versions, and there
should still be enough room for choosing, but I don't think there's any
reason why somebody would still want to compile against some really old
(e.g. < 1.22) MSDK version.
Please share your thoughts on this subject..
softworkz
2
5
First version, including the bump notes, is here:
https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2021-April/278670.html
Most patches from the first version were already applied. And as mentioned in
the discussion there, this set here removes all the deprecated API one by one
before the actual major bump commit.
This is done to simplify bisecting for potential issues that can be tracked
back to one specific removal, instead of to a commit that bumped versions and
disabled everything simultaneously.
Andreas Rheinhardt (80):
avcodec: Remove AVCodec, AVParser and AVBitStreamFilter next API
avformat: Remove next API for AV(In|Out)putFormat
avcodec, avformat: Remove old BSF API
avcodec: Remove sidedata-only-packet cruft
avcodec, avformat: Remove AVPacket.convergence_duration
avcodec: Remove deprecated AVPacket API
avcodec: Remove deprecated stat-bits fields
avcodec: Remove deprecated coder type options
avcodec: Remove deprecated API to split/merge side-data
avcodec: Remove private options from AVCodecContext
avcodec: Remove unneeded getters and setters
avcodec: Remove deprecated av_codec_get_tag_string
avcodec: Remove lock manager API
avcodec: Remove remnants of user-visiable HW acceleration API
avcodec: Remove deprecated avcodec_get_chroma_sub_sample
avcodec/bitstream: Remove avpriv PutBits API functions
avcodec/mpeg4audio: Remove avpriv_mpeg4audio_get_config
avcodec/codec2utils: Remove legacy avpriv functions
avcodec/mpegvideo_enc: Remove deprecated RTP-callback
avcodec: Remove deprecated ASS with inline timing
avcodec/(movtext|srt|ttml|webvtt)enc: Reindent after previous commit
avcodec: Remove deprecated avcodec_get_context_defaults3
avcodec/options: Remove deprecated avcodec_copy_context
avcodec/vdpau: Remove deprecated av_vdpau_get_profile
avcodec: Remove deprecated AVPicture API
avcodec/imgconvert: Remove deprecated parts of pixel format API
avcodec: Remove deprecated VBV delay field
avcodec: Remove deprecated old aliases for NVENC encoders
avcodec/vaapi: Remove old and deprecated VAAPI context and header
avcodec/mpegvideo: Remove deprecated rc_strategy option
avcodec/parser: Remove deprecated av_parser_change
avcodec: Switch AVCPBProperties to 64bits
avformat: Constify the API wrt AV(In|Out)putFormat
avformat: Remove FFserver leftovers
avformat: Remove deprecated old open callbacks
avformat: Remove getters and setters
avformat: Remove deprecated filename field from AVFormatContext
avformat/avformat: Remove outdated private fields
avformat/http: Remove deprecated "user-agent" option
avformat/hlsenc: Remove deprecated wrap option
avformat/hlsenc: Remove deprecated localtime options
avformat: Remove remnants of side data merging
avformat/mov, movenc: Enc exporting rotation via metadata
avformat/aviobuf: End grace period of allowing 0 from read_packet
avformat/rtsp: Remove deprecated old options, rename stimeout->timeout
avformat/dashenc: Remove deprecated min_seg_duration option
avformat: Remove deprecated AVFMT_FLAG_MP4A_LATM flag, latm option
avformat: Remove deprecated av_demuxer_open()
avformat: Switch AVChapter.id to 64bits
avfilter/avfilter: Remove compatibility code for old filter options
avfilter: Remove deprecated resample_lavr_opts
avfilter: Remove deprecated avfilter_link_get_channels
avfilter: Remove avfilter_next/avfilter_register API
avfilter/avfilter: Remove deprecated avfilter_link_set_closed()
avfilter/formats: Remove avfilter_make_format64_list()
avfilter/transform: Stop exporting internal functions
avfilter/Makefile: Don't compile transform.c unconditionally
libswscale: Remove unused deprecated functions, make used ones static
avcodec: Remove deprecated AVCodecContext.coded_frame
avcodec: Remove deprecated old encode/decode APIs
avutil/pixfmt: Remove deprecated VAAPI pixel formats
avutil/frame: Remove AVFrame QP table API
avutil/pixdesc: Remove deprecated off-by-one fields from pix fmt descs
avutil/frame: Remove deprecated AVFrame.error
avutil/frame: Remove deprecated AVFrame.pkt_pts field
avutil: Switch crypto APIs to size_t
avutil/frame: Remove deprecated getters and setters
avutil/pixdesc: Remove deprecated AV_PIX_FMT_FLAG_PSEUDOPAL
avutil/buffer: Switch AVBuffer API to size_t
avutil/cpu: Remove deprecated functions
libavresample: Remove deprecated library
avformat/avformat: Constify AVFormatContext.*_codec pointers
avcodec/codec, allcodecs: Constify the AVCodec API
avformat/avformat, utils: Make av_find_best_stream const-correct
avdevice/avdevice: Constify avdevice_list_input_sources/output_sinks
avdevice/avdevice: Constify av_*_device_next API
avcodec: Constify AVCodecs
avcodec: Constify AVCodecParserContext.parser
avcodec: Constify all the AVCodecParsers
avcodec: Move all AVCodecParser.split functions to
remove_extradata_bsf
Anton Khirnov (2):
Disable vf_uspp/mcdeint.
Bump major versions of all libraries.
James Almer (5):
avformat: remove deprecated AVStream.codec
avutil: remove deprecated AVClass.child_class_next
avfilter/buffersrc: postpone removal of sws_param
avcodec: postpone removal of deprecated codec caps
avcodec: postpone removal of deprecated libopenh264 wrapper options
Makefile | 1 -
configure | 30 +-
doc/APIchanges | 33 +
doc/codecs.texi | 123 --
doc/formats.texi | 2 -
doc/muxers.texi | 17 -
doc/protocols.texi | 15 +-
ffbuild/common.mak | 2 +-
fftools/cmdutils.c | 20 +-
fftools/ffmpeg_filter.c | 2 -
fftools/ffmpeg_opt.c | 29 +-
fftools/ffplay.c | 7 +-
fftools/ffprobe.c | 4 +-
libavcodec/012v.c | 2 +-
libavcodec/4xm.c | 2 +-
libavcodec/8bps.c | 2 +-
libavcodec/8svx.c | 4 +-
libavcodec/Makefile | 15 +-
libavcodec/a64multienc.c | 4 +-
libavcodec/aac_parser.c | 2 +-
libavcodec/aacdec.c | 4 +-
libavcodec/aacdec_fixed.c | 2 +-
libavcodec/aacdec_template.c | 4 +-
libavcodec/aacenc.c | 2 +-
libavcodec/aarch64/neontest.c | 35 -
libavcodec/aasc.c | 2 +-
libavcodec/ac3_parser.c | 2 +-
libavcodec/ac3dec_fixed.c | 2 +-
libavcodec/ac3dec_float.c | 4 +-
libavcodec/ac3enc_fixed.c | 2 +-
libavcodec/ac3enc_float.c | 2 +-
libavcodec/adpcm.c | 2 +-
libavcodec/adpcmenc.c | 2 +-
libavcodec/adx_parser.c | 2 +-
libavcodec/adxdec.c | 4 +-
libavcodec/adxenc.c | 2 +-
libavcodec/agm.c | 2 +-
libavcodec/aic.c | 2 +-
libavcodec/alac.c | 2 +-
libavcodec/alacenc.c | 28 +-
libavcodec/aliaspixdec.c | 2 +-
libavcodec/aliaspixenc.c | 9 +-
libavcodec/allcodecs.c | 1626 ++++++++++----------
libavcodec/alsdec.c | 2 +-
libavcodec/amfenc_h264.c | 2 +-
libavcodec/amfenc_hevc.c | 2 +-
libavcodec/amrnbdec.c | 2 +-
libavcodec/amrwbdec.c | 2 +-
libavcodec/anm.c | 2 +-
libavcodec/ansi.c | 2 +-
libavcodec/apedec.c | 2 +-
libavcodec/aptxdec.c | 4 +-
libavcodec/aptxenc.c | 4 +-
libavcodec/arbc.c | 2 +-
libavcodec/argo.c | 2 +-
libavcodec/arm/neontest.c | 35 -
libavcodec/assdec.c | 4 +-
libavcodec/assenc.c | 43 +-
libavcodec/asvdec.c | 4 +-
libavcodec/asvenc.c | 4 +-
libavcodec/atrac1.c | 2 +-
libavcodec/atrac3.c | 4 +-
libavcodec/atrac3plusdec.c | 4 +-
libavcodec/atrac9dec.c | 2 +-
libavcodec/audiotoolboxdec.c | 9 +-
libavcodec/audiotoolboxenc.c | 2 +-
libavcodec/aura.c | 2 +-
libavcodec/av1_parser.c | 27 +-
libavcodec/av1dec.c | 2 +-
libavcodec/avcodec.c | 47 -
libavcodec/avcodec.h | 855 +---------
libavcodec/avpacket.c | 249 +--
libavcodec/avpicture.c | 82 -
libavcodec/avrndec.c | 2 +-
libavcodec/avs.c | 2 +-
libavcodec/avs2_parser.c | 3 +-
libavcodec/avs3_parser.c | 3 +-
libavcodec/avuidec.c | 2 +-
libavcodec/avuienc.c | 2 +-
libavcodec/bethsoftvideo.c | 2 +-
libavcodec/bfi.c | 2 +-
libavcodec/bink.c | 2 +-
libavcodec/binkaudio.c | 4 +-
libavcodec/bintext.c | 6 +-
libavcodec/bitpacked.c | 2 +-
libavcodec/bitstream.c | 11 -
libavcodec/bitstream_filter.c | 185 ---
libavcodec/bitstream_filters.c | 28 -
libavcodec/bmp.c | 2 +-
libavcodec/bmp_parser.c | 2 +-
libavcodec/bmpenc.c | 8 +-
libavcodec/bmvaudio.c | 2 +-
libavcodec/bmvvideo.c | 2 +-
libavcodec/brenderpix.c | 2 +-
libavcodec/bsf.c | 3 -
libavcodec/bsf_internal.h | 4 -
libavcodec/c93.c | 2 +-
libavcodec/cavs_parser.c | 3 +-
libavcodec/cavsdec.c | 2 +-
libavcodec/cbs_bsf.c | 2 +-
libavcodec/ccaption_dec.c | 2 +-
libavcodec/cdgraphics.c | 2 +-
libavcodec/cdtoons.c | 2 +-
libavcodec/cdxl.c | 2 +-
libavcodec/cfhd.c | 2 +-
libavcodec/cfhdenc.c | 2 +-
libavcodec/cinepak.c | 2 +-
libavcodec/cinepakenc.c | 2 +-
libavcodec/clearvideo.c | 2 +-
libavcodec/cljrdec.c | 2 +-
libavcodec/cljrenc.c | 2 +-
libavcodec/cllc.c | 2 +-
libavcodec/cngdec.c | 2 +-
libavcodec/cngenc.c | 2 +-
libavcodec/codec.h | 11 +-
libavcodec/codec2utils.c | 82 -
libavcodec/codec2utils.h | 18 -
libavcodec/cook.c | 2 +-
libavcodec/cook_parser.c | 2 +-
libavcodec/cpia.c | 2 +-
libavcodec/cri.c | 2 +-
libavcodec/cri_parser.c | 2 +-
libavcodec/crystalhd.c | 7 +-
libavcodec/cscd.c | 2 +-
libavcodec/cuviddec.c | 7 +-
libavcodec/cyuv.c | 4 +-
libavcodec/dca_parser.c | 2 +-
libavcodec/dcadec.c | 2 +-
libavcodec/dcaenc.c | 2 +-
libavcodec/dds.c | 2 +-
libavcodec/decode.c | 268 +---
libavcodec/dfa.c | 2 +-
libavcodec/dirac_parser.c | 2 +-
libavcodec/diracdec.c | 2 +-
libavcodec/dnxhd_parser.c | 2 +-
libavcodec/dnxhddec.c | 2 +-
libavcodec/dnxhdenc.c | 19 +-
libavcodec/dolby_e.c | 2 +-
libavcodec/dolby_e_parser.c | 2 +-
libavcodec/dpcm.c | 2 +-
libavcodec/dpx.c | 2 +-
libavcodec/dpx_parser.c | 2 +-
libavcodec/dpxenc.c | 2 +-
libavcodec/dsddec.c | 2 +-
libavcodec/dsicinaudio.c | 2 +-
libavcodec/dsicinvideo.c | 2 +-
libavcodec/dss_sp.c | 2 +-
libavcodec/dstdec.c | 2 +-
libavcodec/dvaudio_parser.c | 2 +-
libavcodec/dvaudiodec.c | 2 +-
libavcodec/dvbsub_parser.c | 2 +-
libavcodec/dvbsubdec.c | 14 +-
libavcodec/dvbsubenc.c | 2 +-
libavcodec/dvd_nav_parser.c | 2 +-
libavcodec/dvdec.c | 2 +-
libavcodec/dvdsub_parser.c | 2 +-
libavcodec/dvdsubdec.c | 20 +-
libavcodec/dvdsubenc.c | 16 +-
libavcodec/dvenc.c | 8 +-
libavcodec/dxa.c | 2 +-
libavcodec/dxtory.c | 2 +-
libavcodec/dxv.c | 2 +-
libavcodec/eac3enc.c | 2 +-
libavcodec/eacmv.c | 2 +-
libavcodec/eamad.c | 2 +-
libavcodec/eatgq.c | 2 +-
libavcodec/eatgv.c | 2 +-
libavcodec/eatqi.c | 2 +-
libavcodec/encode.c | 119 --
libavcodec/escape124.c | 2 +-
libavcodec/escape130.c | 2 +-
libavcodec/evrcdec.c | 2 +-
libavcodec/exr.c | 2 +-
libavcodec/exrenc.c | 2 +-
libavcodec/fastaudio.c | 2 +-
libavcodec/ffv1dec.c | 5 +-
libavcodec/ffv1enc.c | 46 +-
libavcodec/ffwavesynth.c | 2 +-
libavcodec/fic.c | 2 +-
libavcodec/fitsdec.c | 2 +-
libavcodec/fitsenc.c | 2 +-
libavcodec/flac_parser.c | 2 +-
libavcodec/flacdec.c | 2 +-
libavcodec/flacenc.c | 44 +-
libavcodec/flashsv.c | 4 +-
libavcodec/flashsv2enc.c | 2 +-
libavcodec/flashsvenc.c | 15 +-
libavcodec/flicvideo.c | 2 +-
libavcodec/flvdec.c | 2 +-
libavcodec/flvenc.c | 2 +-
libavcodec/fmvc.c | 2 +-
libavcodec/fraps.c | 2 +-
libavcodec/frwu.c | 2 +-
libavcodec/g2meet.c | 2 +-
libavcodec/g722dec.c | 2 +-
libavcodec/g722enc.c | 2 +-
libavcodec/g723_1_parser.c | 2 +-
libavcodec/g723_1dec.c | 2 +-
libavcodec/g723_1enc.c | 2 +-
libavcodec/g726.c | 8 +-
libavcodec/g729_parser.c | 2 +-
libavcodec/g729dec.c | 4 +-
libavcodec/gdv.c | 2 +-
libavcodec/gif.c | 2 +-
libavcodec/gif_parser.c | 2 +-
libavcodec/gifdec.c | 7 +-
libavcodec/gsm_parser.c | 2 +-
libavcodec/gsmdec.c | 4 +-
libavcodec/h261_parser.c | 2 +-
libavcodec/h261dec.c | 2 +-
libavcodec/h261enc.c | 2 +-
libavcodec/h263_parser.c | 2 +-
libavcodec/h263dec.c | 4 +-
libavcodec/h264_metadata_bsf.c | 2 +-
libavcodec/h264_parser.c | 40 +-
libavcodec/h264dec.c | 4 +-
libavcodec/hapdec.c | 2 +-
libavcodec/hapenc.c | 2 +-
libavcodec/hcadec.c | 2 +-
libavcodec/hcom.c | 2 +-
libavcodec/hevc_parser.c | 36 +-
libavcodec/hevcdec.c | 4 +-
libavcodec/hnm4video.c | 2 +-
libavcodec/hq_hqa.c | 2 +-
libavcodec/hqx.c | 2 +-
libavcodec/huffyuvdec.c | 6 +-
libavcodec/huffyuvenc.c | 37 +-
libavcodec/idcinvideo.c | 2 +-
libavcodec/iff.c | 2 +-
libavcodec/ilbcdec.c | 2 +-
libavcodec/imc.c | 4 +-
libavcodec/imgconvert.c | 188 +--
libavcodec/imm4.c | 2 +-
libavcodec/imm5.c | 2 +-
libavcodec/imx.c | 2 +-
libavcodec/indeo2.c | 2 +-
libavcodec/indeo3.c | 2 +-
libavcodec/indeo4.c | 2 +-
libavcodec/indeo5.c | 2 +-
libavcodec/intelh263dec.c | 2 +-
libavcodec/internal.h | 16 -
libavcodec/interplayacm.c | 2 +-
libavcodec/interplayvideo.c | 2 +-
libavcodec/ipu_parser.c | 2 +-
libavcodec/j2kenc.c | 9 +-
libavcodec/jacosubdec.c | 2 +-
libavcodec/jpeg2000_parser.c | 2 +-
libavcodec/jpeg2000dec.c | 2 +-
libavcodec/jpeglsdec.c | 2 +-
libavcodec/jpeglsenc.c | 22 +-
libavcodec/jvdec.c | 2 +-
libavcodec/kgv1dec.c | 2 +-
libavcodec/kmvc.c | 2 +-
libavcodec/lagarith.c | 2 +-
libavcodec/latm_parser.c | 2 +-
libavcodec/lcldec.c | 4 +-
libavcodec/lclenc.c | 9 +-
libavcodec/libaomdec.c | 2 +-
libavcodec/libaribb24.c | 2 +-
libavcodec/libcelt_dec.c | 2 +-
libavcodec/libcodec2.c | 4 +-
libavcodec/libdav1d.c | 7 +-
libavcodec/libdavs2.c | 2 +-
libavcodec/libfdk-aacdec.c | 2 +-
libavcodec/libfdk-aacenc.c | 2 +-
libavcodec/libgsmdec.c | 4 +-
libavcodec/libgsmenc.c | 4 +-
libavcodec/libilbc.c | 4 +-
libavcodec/libkvazaar.c | 13 +-
libavcodec/libmp3lame.c | 2 +-
libavcodec/libopencore-amr.c | 6 +-
libavcodec/libopenh264dec.c | 7 +-
libavcodec/libopenh264enc.c | 12 +-
libavcodec/libopenjpegdec.c | 2 +-
libavcodec/libopenjpegenc.c | 2 +-
libavcodec/libopusdec.c | 2 +-
libavcodec/libopusenc.c | 2 +-
libavcodec/librav1e.c | 2 +-
libavcodec/librsvgdec.c | 2 +-
libavcodec/libshine.c | 2 +-
libavcodec/libspeexdec.c | 2 +-
libavcodec/libspeexenc.c | 2 +-
libavcodec/libsvtav1.c | 2 +-
libavcodec/libtheoraenc.c | 7 +-
libavcodec/libtwolame.c | 2 +-
libavcodec/libuavs3d.c | 2 +-
libavcodec/libvo-amrwbenc.c | 2 +-
libavcodec/libvorbisdec.c | 2 +-
libavcodec/libvorbisenc.c | 2 +-
libavcodec/libvpxdec.c | 4 +-
libavcodec/libvpxenc.c | 38 +-
libavcodec/libwebpenc.c | 2 +-
libavcodec/libwebpenc_animencoder.c | 2 +-
libavcodec/libx264.c | 60 +-
libavcodec/libx265.c | 6 -
libavcodec/libxavs.c | 51 +-
libavcodec/libxavs2.c | 2 +-
libavcodec/libxvid.c | 27 +-
libavcodec/libzvbi-teletextdec.c | 11 +-
libavcodec/ljpegenc.c | 23 +-
libavcodec/loco.c | 2 +-
libavcodec/lscrdec.c | 2 +-
libavcodec/m101.c | 2 +-
libavcodec/mace.c | 4 +-
libavcodec/magicyuv.c | 2 +-
libavcodec/magicyuvenc.c | 2 +-
libavcodec/mdec.c | 2 +-
libavcodec/mediacodecdec.c | 2 +-
libavcodec/mediacodecdec_common.c | 10 -
libavcodec/metasound.c | 2 +-
libavcodec/mfenc.c | 2 +-
libavcodec/microdvddec.c | 2 +-
libavcodec/midivid.c | 2 +-
libavcodec/mimic.c | 2 +-
libavcodec/mjpeg_parser.c | 2 +-
libavcodec/mjpegbdec.c | 2 +-
libavcodec/mjpegdec.c | 6 +-
libavcodec/mjpegenc.c | 4 +-
libavcodec/mlp_parser.c | 2 +-
libavcodec/mlpdec.c | 4 +-
libavcodec/mlpenc.c | 4 +-
libavcodec/mmaldec.c | 7 +-
libavcodec/mmvideo.c | 2 +-
libavcodec/mobiclip.c | 2 +-
libavcodec/motionpixels.c | 2 +-
libavcodec/movtextdec.c | 2 +-
libavcodec/movtextenc.c | 27 +-
libavcodec/mpc7.c | 2 +-
libavcodec/mpc8.c | 2 +-
libavcodec/mpeg12dec.c | 15 +-
libavcodec/mpeg12enc.c | 15 +-
libavcodec/mpeg4audio.c | 18 -
libavcodec/mpeg4audio.h | 13 -
libavcodec/mpeg4video_parser.c | 3 +-
libavcodec/mpeg4videodec.c | 2 +-
libavcodec/mpeg4videoenc.c | 2 +-
libavcodec/mpegaudio_parser.c | 2 +-
libavcodec/mpegaudiodec_fixed.c | 10 +-
libavcodec/mpegaudiodec_float.c | 10 +-
libavcodec/mpegaudioenc_fixed.c | 2 +-
libavcodec/mpegaudioenc_float.c | 2 +-
libavcodec/mpegvideo.h | 14 +-
libavcodec/mpegvideo_enc.c | 141 +-
libavcodec/mpegvideo_parser.c | 20 +-
libavcodec/mpl2dec.c | 2 +-
libavcodec/mscc.c | 9 +-
libavcodec/msmpeg4dec.c | 8 +-
libavcodec/msp2dec.c | 2 +-
libavcodec/msrle.c | 2 +-
libavcodec/mss1.c | 2 +-
libavcodec/mss2.c | 2 +-
libavcodec/mss3.c | 2 +-
libavcodec/mss4.c | 2 +-
libavcodec/msvideo1.c | 2 +-
libavcodec/msvideo1enc.c | 2 +-
libavcodec/mv30.c | 2 +-
libavcodec/mvcdec.c | 4 +-
libavcodec/mvha.c | 2 +-
libavcodec/mwsc.c | 2 +-
libavcodec/mxpegdec.c | 2 +-
libavcodec/nellymoserdec.c | 2 +-
libavcodec/nellymoserenc.c | 2 +-
libavcodec/notchlc.c | 2 +-
libavcodec/nuv.c | 2 +-
libavcodec/nvdec.c | 4 +-
libavcodec/nvenc.c | 6 -
libavcodec/nvenc_h264.c | 71 +-
libavcodec/nvenc_hevc.c | 39 +-
libavcodec/omx.c | 4 +-
libavcodec/on2avc.c | 2 +-
libavcodec/options.c | 134 --
libavcodec/options_table.h | 79 -
libavcodec/opus_parser.c | 2 +-
libavcodec/opusdec.c | 2 +-
libavcodec/opusenc.c | 2 +-
libavcodec/packet.h | 81 -
libavcodec/pafaudio.c | 2 +-
libavcodec/pafvideo.c | 2 +-
libavcodec/pamenc.c | 15 +-
libavcodec/parser.c | 57 +-
libavcodec/parsers.c | 139 +-
libavcodec/pcm-bluray.c | 2 +-
libavcodec/pcm-dvd.c | 2 +-
libavcodec/pcm-dvdenc.c | 2 +-
libavcodec/pcm.c | 4 +-
libavcodec/pcx.c | 2 +-
libavcodec/pcxenc.c | 15 +-
libavcodec/pgssubdec.c | 16 +-
libavcodec/pgxdec.c | 2 +-
libavcodec/photocd.c | 2 +-
libavcodec/pictordec.c | 2 +-
libavcodec/pixlet.c | 2 +-
libavcodec/png_parser.c | 2 +-
libavcodec/pngdec.c | 4 +-
libavcodec/pngenc.c | 20 +-
libavcodec/pnm_parser.c | 2 +-
libavcodec/pnmdec.c | 12 +-
libavcodec/pnmenc.c | 27 +-
libavcodec/proresdec2.c | 2 +-
libavcodec/proresenc_anatoliy.c | 4 +-
libavcodec/proresenc_kostya.c | 8 +-
libavcodec/prosumer.c | 2 +-
libavcodec/psd.c | 2 +-
libavcodec/pthread_frame.c | 5 -
libavcodec/ptx.c | 2 +-
libavcodec/put_bits.h | 10 -
libavcodec/qcelpdec.c | 2 +-
libavcodec/qdm2.c | 2 +-
libavcodec/qdmc.c | 2 +-
libavcodec/qdrw.c | 2 +-
libavcodec/qpeg.c | 2 +-
libavcodec/qsvdec.c | 7 +-
libavcodec/qsvenc.c | 18 -
libavcodec/qsvenc_h264.c | 8 +-
libavcodec/qsvenc_hevc.c | 5 +-
libavcodec/qsvenc_jpeg.c | 2 +-
libavcodec/qsvenc_mpeg2.c | 5 +-
libavcodec/qsvenc_vp9.c | 2 +-
libavcodec/qtrle.c | 2 +-
libavcodec/qtrleenc.c | 9 +-
libavcodec/r210dec.c | 6 +-
libavcodec/r210enc.c | 6 +-
libavcodec/ra144dec.c | 2 +-
libavcodec/ra144enc.c | 2 +-
libavcodec/ra288.c | 2 +-
libavcodec/ralf.c | 2 +-
libavcodec/rasc.c | 2 +-
libavcodec/rawdec.c | 19 +-
libavcodec/rawenc.c | 7 +-
libavcodec/realtextdec.c | 2 +-
libavcodec/remove_extradata_bsf.c | 201 ++-
libavcodec/rkmppdec.c | 2 +-
libavcodec/rl2.c | 2 +-
libavcodec/roqaudioenc.c | 2 +-
libavcodec/roqvideodec.c | 2 +-
libavcodec/roqvideoenc.c | 2 +-
libavcodec/rpza.c | 2 +-
libavcodec/rpzaenc.c | 2 +-
libavcodec/rscc.c | 2 +-
libavcodec/rv10.c | 4 +-
libavcodec/rv10enc.c | 2 +-
libavcodec/rv20enc.c | 2 +-
libavcodec/rv30.c | 2 +-
libavcodec/rv34_parser.c | 4 +-
libavcodec/rv40.c | 2 +-
libavcodec/s302m.c | 2 +-
libavcodec/s302menc.c | 2 +-
libavcodec/samidec.c | 2 +-
libavcodec/sanm.c | 2 +-
libavcodec/sbc_parser.c | 2 +-
libavcodec/sbcdec.c | 2 +-
libavcodec/sbcenc.c | 2 +-
libavcodec/scpr.c | 2 +-
libavcodec/screenpresso.c | 2 +-
libavcodec/sga.c | 2 +-
libavcodec/sgidec.c | 2 +-
libavcodec/sgienc.c | 16 +-
libavcodec/sgirledec.c | 2 +-
libavcodec/sheervideo.c | 2 +-
libavcodec/shorten.c | 2 +-
libavcodec/sipr.c | 2 +-
libavcodec/sipr_parser.c | 2 +-
libavcodec/siren.c | 2 +-
libavcodec/smacker.c | 4 +-
libavcodec/smc.c | 2 +-
libavcodec/snowdec.c | 2 +-
libavcodec/snowenc.c | 49 +-
libavcodec/sonic.c | 6 +-
libavcodec/sp5xdec.c | 4 +-
libavcodec/speedhq.c | 2 +-
libavcodec/speedhqenc.c | 2 +-
libavcodec/srtdec.c | 6 +-
libavcodec/srtenc.c | 37 +-
libavcodec/subviewerdec.c | 2 +-
libavcodec/sunrast.c | 2 +-
libavcodec/sunrastenc.c | 28 +-
libavcodec/svq1dec.c | 2 +-
libavcodec/svq1enc.c | 9 +-
libavcodec/svq3.c | 2 +-
libavcodec/tak_parser.c | 2 +-
libavcodec/takdec.c | 2 +-
libavcodec/targa.c | 2 +-
libavcodec/targa_y216dec.c | 2 +-
libavcodec/targaenc.c | 16 +-
libavcodec/tdsc.c | 2 +-
libavcodec/tests/.gitignore | 1 -
libavcodec/tests/imgconvert.c | 46 -
libavcodec/textdec.c | 10 +-
libavcodec/thread.h | 4 +-
libavcodec/tiertexseqv.c | 2 +-
libavcodec/tiff.c | 2 +-
libavcodec/tiffenc.c | 8 +-
libavcodec/tmv.c | 2 +-
libavcodec/truemotion1.c | 2 +-
libavcodec/truemotion2.c | 2 +-
libavcodec/truemotion2rt.c | 2 +-
libavcodec/truespeech.c | 2 +-
libavcodec/tscc.c | 2 +-
libavcodec/tscc2.c | 2 +-
libavcodec/tta.c | 2 +-
libavcodec/ttaenc.c | 2 +-
libavcodec/ttmlenc.c | 70 +-
libavcodec/twinvqdec.c | 2 +-
libavcodec/txd.c | 2 +-
libavcodec/ulti.c | 2 +-
libavcodec/utils.c | 51 -
libavcodec/utvideodec.c | 2 +-
libavcodec/utvideoenc.c | 39 +-
libavcodec/v210dec.c | 2 +-
libavcodec/v210enc.c | 8 +-
libavcodec/v210x.c | 2 +-
libavcodec/v308dec.c | 2 +-
libavcodec/v308enc.c | 2 +-
libavcodec/v408dec.c | 4 +-
libavcodec/v408enc.c | 4 +-
libavcodec/v410dec.c | 2 +-
libavcodec/v410enc.c | 9 +-
libavcodec/v4l2_m2m_dec.c | 2 +-
libavcodec/v4l2_m2m_enc.c | 2 +-
libavcodec/vaapi.h | 86 --
libavcodec/vaapi_decode.c | 53 -
libavcodec/vaapi_decode.h | 13 -
libavcodec/vaapi_encode.c | 2 +-
libavcodec/vaapi_encode_h264.c | 2 +-
libavcodec/vaapi_encode_h265.c | 2 +-
libavcodec/vaapi_encode_mjpeg.c | 2 +-
libavcodec/vaapi_encode_mpeg2.c | 2 +-
libavcodec/vaapi_encode_vp8.c | 2 +-
libavcodec/vaapi_encode_vp9.c | 2 +-
libavcodec/vb.c | 2 +-
libavcodec/vble.c | 2 +-
libavcodec/vc1_parser.c | 21 +-
libavcodec/vc1dec.c | 8 +-
libavcodec/vc2enc.c | 2 +-
libavcodec/vcr1.c | 2 +-
libavcodec/vdpau.c | 49 -
libavcodec/vdpau.h | 19 -
libavcodec/version.h | 102 +-
libavcodec/videotoolboxenc.c | 4 +-
libavcodec/vima.c | 2 +-
libavcodec/vmdaudio.c | 2 +-
libavcodec/vmdvideo.c | 2 +-
libavcodec/vmnc.c | 2 +-
libavcodec/vorbis_parser.c | 2 +-
libavcodec/vorbisdec.c | 2 +-
libavcodec/vorbisenc.c | 2 +-
libavcodec/vp3.c | 6 +-
libavcodec/vp3_parser.c | 2 +-
libavcodec/vp5.c | 2 +-
libavcodec/vp6.c | 6 +-
libavcodec/vp8.c | 4 +-
libavcodec/vp8_parser.c | 2 +-
libavcodec/vp9.c | 7 +-
libavcodec/vp9_parser.c | 2 +-
libavcodec/vqavideo.c | 2 +-
libavcodec/wavpack.c | 2 +-
libavcodec/wavpackenc.c | 2 +-
libavcodec/wcmv.c | 2 +-
libavcodec/webp.c | 2 +-
libavcodec/webp_parser.c | 2 +-
libavcodec/webvttdec.c | 2 +-
libavcodec/webvttenc.c | 28 +-
libavcodec/wmadec.c | 4 +-
libavcodec/wmaenc.c | 4 +-
libavcodec/wmalosslessdec.c | 2 +-
libavcodec/wmaprodec.c | 6 +-
libavcodec/wmavoice.c | 2 +-
libavcodec/wmv2dec.c | 2 +-
libavcodec/wmv2enc.c | 2 +-
libavcodec/wnv1.c | 2 +-
libavcodec/wrapped_avframe.c | 4 +-
libavcodec/ws-snd1.c | 2 +-
libavcodec/x86/w64xmmtest.c | 35 -
libavcodec/xan.c | 2 +-
libavcodec/xbm_parser.c | 2 +-
libavcodec/xbmdec.c | 2 +-
libavcodec/xbmenc.c | 2 +-
libavcodec/xfacedec.c | 2 +-
libavcodec/xfaceenc.c | 2 +-
libavcodec/xl.c | 2 +-
libavcodec/xma_parser.c | 2 +-
libavcodec/xpmdec.c | 2 +-
libavcodec/xsubdec.c | 16 +-
libavcodec/xsubenc.c | 15 +-
libavcodec/xwddec.c | 2 +-
libavcodec/xwdenc.c | 2 +-
libavcodec/xxan.c | 2 +-
libavcodec/y41pdec.c | 2 +-
libavcodec/y41penc.c | 2 +-
libavcodec/ylc.c | 2 +-
libavcodec/yop.c | 2 +-
libavcodec/yuv4dec.c | 2 +-
libavcodec/yuv4enc.c | 2 +-
libavcodec/zerocodec.c | 2 +-
libavcodec/zmbv.c | 2 +-
libavcodec/zmbvenc.c | 8 +-
libavdevice/alldevices.c | 16 +-
libavdevice/avdevice.c | 4 +-
libavdevice/avdevice.h | 12 +-
libavdevice/decklink_dec.cpp | 4 +-
libavdevice/decklink_enc.cpp | 2 +-
libavdevice/internal.h | 2 +-
libavdevice/lavfi.c | 2 +-
libavdevice/utils.c | 2 +-
libavdevice/v4l2.c | 15 -
libavdevice/version.h | 4 +-
libavdevice/xcbgrab.c | 2 +-
libavfilter/Makefile | 6 +-
libavfilter/af_aresample.c | 10 -
libavfilter/af_ashowinfo.c | 3 +-
libavfilter/af_resample.c | 369 -----
libavfilter/allfilters.c | 39 -
libavfilter/avfilter.c | 122 +-
libavfilter/avfilter.h | 55 -
libavfilter/avfiltergraph.c | 3 -
libavfilter/drawutils.c | 2 +-
libavfilter/f_sidedata.c | 34 -
libavfilter/formats.c | 7 -
libavfilter/formats.h | 4 -
libavfilter/framepool.c | 10 +-
libavfilter/framepool.h | 4 +-
libavfilter/framesync.h | 4 -
libavfilter/lavfutils.c | 2 +-
libavfilter/src_movie.c | 2 +-
libavfilter/transform.c | 23 +-
libavfilter/transform.h | 29 +-
libavfilter/version.h | 21 +-
libavfilter/vf_crop.c | 2 +-
libavfilter/vf_deshake.c | 5 +-
libavfilter/vf_pixdesctest.c | 3 +-
libavfilter/vf_scale.c | 16 +-
libavfilter/vf_showinfo.c | 10 +-
libavfilter/vf_spp.c | 10 -
libavfilter/vf_swapuv.c | 6 -
libavfilter/vf_untile.c | 2 +-
libavformat/adtsenc.c | 2 +-
libavformat/allformats.c | 98 --
libavformat/apngenc.c | 2 +-
libavformat/avformat.h | 302 +---
libavformat/avidec.c | 2 +-
libavformat/avio.c | 3 -
libavformat/aviobuf.c | 17 -
libavformat/concatdec.c | 2 +-
libavformat/dashdec.c | 2 +-
libavformat/dashenc.c | 16 +-
libavformat/dump.c | 32 +-
libavformat/fifo.c | 4 +-
libavformat/flacenc.c | 2 +-
libavformat/flvenc.c | 2 +-
libavformat/format.c | 33 +-
libavformat/framecrcenc.c | 6 +-
libavformat/hashenc.c | 7 +-
libavformat/hdsenc.c | 2 +-
libavformat/hls.c | 2 +-
libavformat/hlsenc.c | 36 +-
libavformat/http.c | 3 -
libavformat/img2dec.c | 2 +-
libavformat/internal.h | 4 -
libavformat/isom.c | 12 +-
libavformat/latmenc.c | 2 +-
libavformat/matroskadec.c | 8 -
libavformat/matroskaenc.c | 18 +-
libavformat/mov.c | 34 +-
libavformat/movenc.c | 63 +-
libavformat/mp3enc.c | 4 +-
libavformat/mpeg.c | 2 +-
libavformat/mpegtsenc.c | 4 +-
libavformat/mux.c | 40 +-
libavformat/oggdec.h | 2 +-
libavformat/options.c | 45 -
libavformat/options_table.h | 6 -
libavformat/protocols.c | 21 -
libavformat/rtpdec_asf.c | 2 +-
libavformat/rtpenc.c | 2 +-
libavformat/rtpenc_chain.c | 2 +-
libavformat/rtpenc_mpegts.c | 4 +-
libavformat/rtsp.c | 8 -
libavformat/sapdec.c | 2 +-
libavformat/sdp.c | 18 -
libavformat/segment.c | 10 +-
libavformat/smoothstreamingenc.c | 2 +-
libavformat/srtenc.c | 9 +-
libavformat/url.h | 4 -
libavformat/utils.c | 328 +---
libavformat/version.h | 58 +-
libavformat/webm_chunk.c | 2 +-
libavformat/webvttdec.c | 2 +-
libavformat/webvttenc.c | 2 +-
libavformat/yuv4mpegenc.c | 7 -
libavresample/Makefile | 19 -
libavresample/aarch64/Makefile | 7 -
libavresample/aarch64/asm-offsets.h | 28 -
libavresample/aarch64/audio_convert_init.c | 49 -
libavresample/aarch64/audio_convert_neon.S | 363 -----
libavresample/aarch64/neontest.c | 31 -
libavresample/aarch64/resample_init.c | 71 -
libavresample/aarch64/resample_neon.S | 233 ---
libavresample/arm/Makefile | 7 -
libavresample/arm/asm-offsets.h | 29 -
libavresample/arm/audio_convert_init.c | 49 -
libavresample/arm/audio_convert_neon.S | 363 -----
libavresample/arm/neontest.c | 31 -
libavresample/arm/resample_init.c | 74 -
libavresample/arm/resample_neon.S | 358 -----
libavresample/audio_convert.c | 416 -----
libavresample/audio_convert.h | 103 --
libavresample/audio_data.c | 381 -----
libavresample/audio_data.h | 178 ---
libavresample/audio_mix.c | 742 ---------
libavresample/audio_mix.h | 94 --
libavresample/audio_mix_matrix.c | 294 ----
libavresample/avresample.h | 595 -------
libavresample/avresampleres.rc | 55 -
libavresample/dither.c | 440 ------
libavresample/dither.h | 93 --
libavresample/internal.h | 116 --
libavresample/libavresample.v | 6 -
libavresample/options.c | 113 --
libavresample/resample.c | 446 ------
libavresample/resample.h | 96 --
libavresample/resample_template.c | 118 --
libavresample/tests/.gitignore | 1 -
libavresample/tests/avresample.c | 342 ----
libavresample/utils.c | 793 ----------
libavresample/version.h | 50 -
libavresample/x86/Makefile | 9 -
libavresample/x86/audio_convert.asm | 1261 ---------------
libavresample/x86/audio_convert_init.c | 265 ----
libavresample/x86/audio_mix.asm | 511 ------
libavresample/x86/audio_mix_init.c | 215 ---
libavresample/x86/dither.asm | 117 --
libavresample/x86/dither_init.c | 60 -
libavresample/x86/util.asm | 41 -
libavresample/x86/w64xmmtest.c | 31 -
libavutil/adler32.c | 5 -
libavutil/adler32.h | 9 -
libavutil/buffer.c | 14 +-
libavutil/buffer.h | 29 -
libavutil/buffer_internal.h | 8 +-
libavutil/cpu.c | 92 --
libavutil/cpu.h | 24 -
libavutil/detection_bbox.c | 4 -
libavutil/frame.c | 131 +-
libavutil/frame.h | 116 --
libavutil/hash.c | 4 -
libavutil/hash.h | 4 -
libavutil/hmac.c | 4 -
libavutil/hwcontext_cuda.c | 2 +-
libavutil/hwcontext_d3d11va.c | 2 +-
libavutil/hwcontext_dxva2.c | 2 +-
libavutil/hwcontext_opencl.c | 2 +-
libavutil/hwcontext_qsv.c | 2 +-
libavutil/hwcontext_vaapi.c | 2 +-
libavutil/hwcontext_vdpau.c | 2 +-
libavutil/hwcontext_vulkan.c | 2 +-
libavutil/imgutils.c | 15 +-
libavutil/internal.h | 16 -
libavutil/log.h | 13 -
libavutil/md5.c | 15 +-
libavutil/md5.h | 8 -
libavutil/murmur3.c | 4 -
libavutil/murmur3.h | 4 -
libavutil/opt.c | 19 -
libavutil/opt.h | 13 -
libavutil/pixdesc.c | 1090 +++++++------
libavutil/pixdesc.h | 31 -
libavutil/pixfmt.h | 10 -
libavutil/ripemd.c | 23 +-
libavutil/ripemd.h | 4 -
libavutil/sha.c | 23 +-
libavutil/sha.h | 4 -
libavutil/sha512.c | 23 +-
libavutil/sha512.h | 4 -
libavutil/version.h | 37 +-
libavutil/video_enc_params.c | 4 -
libpostproc/version.h | 4 +-
libswresample/version.h | 4 +-
libswscale/swscale.h | 11 -
libswscale/utils.c | 96 --
libswscale/version.h | 8 +-
tests/Makefile | 1 -
tests/fate.sh | 1 -
tests/fate/libavresample.mak | 68 -
tests/ref/fate/imgutils | 10 +-
tests/ref/fate/mov-zombie | 2 +-
tests/ref/fate/mxf-d10-user-comments | 2 +-
tests/ref/fate/ts-demux | 2 +-
tools/gen-rc | 1 -
tools/target_dec_fuzzer.c | 10 +-
789 files changed, 2609 insertions(+), 19463 deletions(-)
delete mode 100644 libavcodec/avpicture.c
delete mode 100644 libavcodec/bitstream_filter.c
delete mode 100644 libavcodec/codec2utils.c
delete mode 100644 libavcodec/tests/imgconvert.c
delete mode 100644 libavcodec/vaapi.h
delete mode 100644 libavfilter/af_resample.c
delete mode 100644 libavresample/Makefile
delete mode 100644 libavresample/aarch64/Makefile
delete mode 100644 libavresample/aarch64/asm-offsets.h
delete mode 100644 libavresample/aarch64/audio_convert_init.c
delete mode 100644 libavresample/aarch64/audio_convert_neon.S
delete mode 100644 libavresample/aarch64/neontest.c
delete mode 100644 libavresample/aarch64/resample_init.c
delete mode 100644 libavresample/aarch64/resample_neon.S
delete mode 100644 libavresample/arm/Makefile
delete mode 100644 libavresample/arm/asm-offsets.h
delete mode 100644 libavresample/arm/audio_convert_init.c
delete mode 100644 libavresample/arm/audio_convert_neon.S
delete mode 100644 libavresample/arm/neontest.c
delete mode 100644 libavresample/arm/resample_init.c
delete mode 100644 libavresample/arm/resample_neon.S
delete mode 100644 libavresample/audio_convert.c
delete mode 100644 libavresample/audio_convert.h
delete mode 100644 libavresample/audio_data.c
delete mode 100644 libavresample/audio_data.h
delete mode 100644 libavresample/audio_mix.c
delete mode 100644 libavresample/audio_mix.h
delete mode 100644 libavresample/audio_mix_matrix.c
delete mode 100644 libavresample/avresample.h
delete mode 100644 libavresample/avresampleres.rc
delete mode 100644 libavresample/dither.c
delete mode 100644 libavresample/dither.h
delete mode 100644 libavresample/internal.h
delete mode 100644 libavresample/libavresample.v
delete mode 100644 libavresample/options.c
delete mode 100644 libavresample/resample.c
delete mode 100644 libavresample/resample.h
delete mode 100644 libavresample/resample_template.c
delete mode 100644 libavresample/tests/.gitignore
delete mode 100644 libavresample/tests/avresample.c
delete mode 100644 libavresample/utils.c
delete mode 100644 libavresample/version.h
delete mode 100644 libavresample/x86/Makefile
delete mode 100644 libavresample/x86/audio_convert.asm
delete mode 100644 libavresample/x86/audio_convert_init.c
delete mode 100644 libavresample/x86/audio_mix.asm
delete mode 100644 libavresample/x86/audio_mix_init.c
delete mode 100644 libavresample/x86/dither.asm
delete mode 100644 libavresample/x86/dither_init.c
delete mode 100644 libavresample/x86/util.asm
delete mode 100644 libavresample/x86/w64xmmtest.c
delete mode 100644 tests/fate/libavresample.mak
--
2.31.1
7
120
From: bnnm <bananaman255(a)gmail.com>
Fixes trac issue #7473.
Removes encoder delay (skip samples) and writes remaining frame samples after EOF to get correct sample count.
Output is now accurate vs players that use Microsoft's codecs (Windows Media Format Runtime).
Tested vs encode>decode WMAv2 with MS's codecs and most sample rate/bit rate/channel/mode combinations in ASF/XWMA.
WMAv1 appears to use the same delay, from FFmpeg samples.
Signed-off-by: bnnm <bananaman255(a)gmail.com>
Signed-off-by: Paul B Mahol <onemda(a)gmail.com>
---
libavcodec/wma.h | 2 ++
libavcodec/wmadec.c | 22 ++++++++++++++++++++--
tests/fate/wma.mak | 8 ++++----
tests/ref/fate/flcl1905 | 3 +--
4 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/libavcodec/wma.h b/libavcodec/wma.h
index aea7ba28ab..80e52687fd 100644
--- a/libavcodec/wma.h
+++ b/libavcodec/wma.h
@@ -135,6 +135,8 @@ typedef struct WMACodecContext {
float lsp_pow_m_table2[(1 << LSP_POW_BITS)];
AVFloatDSPContext *fdsp;
+ int eof_done; /* decode flag to output remaining samples after EOF */
+
#ifdef TRACE
int frame_count;
#endif /* TRACE */
diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c
index cc67244344..9955aaa7d6 100644
--- a/libavcodec/wmadec.c
+++ b/libavcodec/wmadec.c
@@ -135,6 +135,8 @@ static av_cold int wma_decode_init(AVCodecContext *avctx)
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
+ avctx->internal->skip_samples = s->frame_len * 2;
+
return 0;
}
@@ -829,7 +831,20 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data,
ff_tlog(avctx, "***decode_superframe:\n");
if (buf_size == 0) {
+ if (s->eof_done)
+ return 0;
+
+ frame->nb_samples = s->frame_len;
+ if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
+ return ret;
+
+ for (i = 0; i < s->avctx->channels; i++)
+ memcpy(frame->extended_data[i], &s->frame_out[i][0],
+ frame->nb_samples * sizeof(s->frame_out[i][0]));
+
s->last_superframe_len = 0;
+ s->eof_done = 1;
+ *got_frame_ptr = 1;
return 0;
}
if (buf_size < avctx->block_align) {
@@ -975,6 +990,9 @@ static av_cold void flush(AVCodecContext *avctx)
s->last_bitoffset =
s->last_superframe_len = 0;
+
+ s->eof_done = 0;
+ avctx->internal->skip_samples = s->frame_len * 2;
}
#if CONFIG_WMAV1_DECODER
@@ -988,7 +1006,7 @@ const AVCodec ff_wmav1_decoder = {
.close = ff_wma_end,
.decode = wma_decode_superframe,
.flush = flush,
- .capabilities = AV_CODEC_CAP_DR1,
+ .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE },
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
@@ -1005,7 +1023,7 @@ const AVCodec ff_wmav2_decoder = {
.close = ff_wma_end,
.decode = wma_decode_superframe,
.flush = flush,
- .capabilities = AV_CODEC_CAP_DR1,
+ .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE },
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
diff --git a/tests/fate/wma.mak b/tests/fate/wma.mak
index bc530998e8..c13874ebfc 100644
--- a/tests/fate/wma.mak
+++ b/tests/fate/wma.mak
@@ -40,14 +40,14 @@ fate-wmavoice: $(FATE_WMAVOICE-yes)
FATE_WMA_ENCODE-$(call ENCDEC, WMAV1, ASF) += fate-wmav1-encode
fate-wmav1-encode: CMD = enc_dec_pcm asf wav s16le $(subst $(SAMPLES),$(TARGET_SAMPLES),$(REF)) -c:a wmav1 -b:a 128k
-fate-wmav1-encode: CMP_SHIFT = -8192
-fate-wmav1-encode: CMP_TARGET = 291.06
+fate-wmav1-encode: CMP_SHIFT = 8192
+fate-wmav1-encode: CMP_TARGET = 299.99
fate-wmav1-encode: SIZE_TOLERANCE = 4632
FATE_WMA_ENCODE-$(call ENCDEC, WMAV2, ASF) += fate-wmav2-encode
fate-wmav2-encode: CMD = enc_dec_pcm asf wav s16le $(subst $(SAMPLES),$(TARGET_SAMPLES),$(REF)) -c:a wmav2 -b:a 128k
-fate-wmav2-encode: CMP_SHIFT = -8192
-fate-wmav2-encode: CMP_TARGET = 258.32
+fate-wmav2-encode: CMP_SHIFT = 8192
+fate-wmav2-encode: CMP_TARGET = 267.92
fate-wmav2-encode: SIZE_TOLERANCE = 4632
$(FATE_WMA_ENCODE-yes): CMP = stddev
diff --git a/tests/ref/fate/flcl1905 b/tests/ref/fate/flcl1905
index 5f5245ebcf..d702139db8 100644
--- a/tests/ref/fate/flcl1905
+++ b/tests/ref/fate/flcl1905
@@ -1,6 +1,4 @@
packet|codec_type=audio|stream_index=0|pts=0|pts_time=0.000000|dts=0|dts_time=0.000000|duration=22528|duration_time=0.510839|size=4092|pos=56|flags=K_
-frame|media_type=audio|stream_index=0|key_frame=1|pts=0|pts_time=0.000000|pkt_dts=0|pkt_dts_time=0.000000|best_effort_timestamp=0|best_effort_timestamp_time=0.000000|pkt_duration=22528|pkt_duration_time=0.510839|pkt_pos=56|pkt_size=4092|sample_fmt=fltp|nb_samples=2048|channels=2|channel_layout=unknown
-frame|media_type=audio|stream_index=0|key_frame=1|pts=N/A|pts_time=N/A|pkt_dts=N/A|pkt_dts_time=N/A|best_effort_timestamp=N/A|best_effort_timestamp_time=N/A|pkt_duration=22528|pkt_duration_time=0.510839|pkt_pos=56|pkt_size=3720|sample_fmt=fltp|nb_samples=2048|channels=2|channel_layout=unknown
frame|media_type=audio|stream_index=0|key_frame=1|pts=N/A|pts_time=N/A|pkt_dts=N/A|pkt_dts_time=N/A|best_effort_timestamp=N/A|best_effort_timestamp_time=N/A|pkt_duration=22528|pkt_duration_time=0.510839|pkt_pos=56|pkt_size=3348|sample_fmt=fltp|nb_samples=2048|channels=2|channel_layout=unknown
frame|media_type=audio|stream_index=0|key_frame=1|pts=N/A|pts_time=N/A|pkt_dts=N/A|pkt_dts_time=N/A|best_effort_timestamp=N/A|best_effort_timestamp_time=N/A|pkt_duration=22528|pkt_duration_time=0.510839|pkt_pos=56|pkt_size=2976|sample_fmt=fltp|nb_samples=2048|channels=2|channel_layout=unknown
frame|media_type=audio|stream_index=0|key_frame=1|pts=N/A|pts_time=N/A|pkt_dts=N/A|pkt_dts_time=N/A|best_effort_timestamp=N/A|best_effort_timestamp_time=N/A|pkt_duration=22528|pkt_duration_time=0.510839|pkt_pos=56|pkt_size=2604|sample_fmt=fltp|nb_samples=2048|channels=2|channel_layout=unknown
@@ -191,3 +189,4 @@ frame|media_type=audio|stream_index=0|key_frame=1|pts=N/A|pts_time=N/A|pkt_dts=N
frame|media_type=audio|stream_index=0|key_frame=1|pts=N/A|pts_time=N/A|pkt_dts=N/A|pkt_dts_time=N/A|best_effort_timestamp=N/A|best_effort_timestamp_time=N/A|pkt_duration=22528|pkt_duration_time=0.510839|pkt_pos=61436|pkt_size=744|sample_fmt=fltp|nb_samples=2048|channels=2|channel_layout=unknown
frame|media_type=audio|stream_index=0|key_frame=1|pts=N/A|pts_time=N/A|pkt_dts=N/A|pkt_dts_time=N/A|best_effort_timestamp=N/A|best_effort_timestamp_time=N/A|pkt_duration=22528|pkt_duration_time=0.510839|pkt_pos=61436|pkt_size=372|sample_fmt=fltp|nb_samples=2048|channels=2|channel_layout=unknown
packet|codec_type=audio|stream_index=0|pts=360448|pts_time=8.173424|dts=360448|dts_time=8.173424|duration=44|duration_time=0.000998|size=8|pos=65528|flags=K_
+frame|media_type=audio|stream_index=0|key_frame=1|pts=N/A|pts_time=N/A|pkt_dts=N/A|pkt_dts_time=N/A|best_effort_timestamp=N/A|best_effort_timestamp_time=N/A|pkt_duration=N/A|pkt_duration_time=N/A|pkt_pos=N/A|pkt_size=0|sample_fmt=fltp|nb_samples=2048|channels=2|channel_layout=unknown
--
2.17.1
2
2
[PATCH 1/2] lafi/vf_edgedetect: Move some common functions into seperate file
by Thilo Borgmann 25 Apr '22
by Thilo Borgmann 25 Apr '22
25 Apr '22
Hi,
v2, common functions moved into lavfi/edge_common.{c,h}. Also moved gaussian_blur() into the same.
-Thilo
3
13
24 Apr '22
Monterey needs mBytesPerFrame and mBytesPerPacket to be set, and I'm
surprised this didn't break any previous system versions.
Fixes bug #9564: Cannot decode xHE-AAC with audiotoolbox (aac_at) on
Mac OS Monterey. Fixes likely bug that none of the AudioToolbox
decoders work on Monterey.
Signed-off-by: Christopher Snowhill <kode54(a)gmail.com>
---
libavcodec/audiotoolboxdec.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libavcodec/audiotoolboxdec.c b/libavcodec/audiotoolboxdec.c
index 9939fef218..4abcb63a03 100644
--- a/libavcodec/audiotoolboxdec.c
+++ b/libavcodec/audiotoolboxdec.c
@@ -370,6 +370,11 @@ static av_cold int ffat_create_decoder(AVCodecContext *avctx,
avctx->sample_rate = out_format.mSampleRate = in_format.mSampleRate;
avctx->channels = out_format.mChannelsPerFrame = in_format.mChannelsPerFrame;
+ out_format.mBytesPerFrame =
+ out_format.mChannelsPerFrame * (out_format.mBitsPerChannel / 8);
+ out_format.mBytesPerPacket =
+ out_format.mBytesPerFrame * out_format.mFramesPerPacket;
+
if (avctx->codec_id == AV_CODEC_ID_ADPCM_IMA_QT)
in_format.mFramesPerPacket = 64;
--
2.32.0 (Apple Git-132)
2
1
18 Apr '22
---
v4: break when error occured in fread, fix infinite loop introduced by v3
v3: check EOF by "eof = !data_size && feof(f);"
doc/examples/decode_video.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/doc/examples/decode_video.c b/doc/examples/decode_video.c
index 18ee90a6c0..7238e38103 100644
--- a/doc/examples/decode_video.c
+++ b/doc/examples/decode_video.c
@@ -92,6 +92,7 @@ int main(int argc, char **argv)
uint8_t *data;
size_t data_size;
int ret;
+ int eof;
AVPacket *pkt;
if (argc <= 2) {
@@ -150,15 +151,16 @@ int main(int argc, char **argv)
exit(1);
}
- while (!feof(f)) {
+ do {
/* read raw data from the input file */
data_size = fread(inbuf, 1, INBUF_SIZE, f);
- if (!data_size)
+ if (ferror(f))
break;
+ eof = !data_size;
/* use the parser to split the data into frames */
data = inbuf;
- while (data_size > 0) {
+ while (data_size > 0 || eof) {
ret = av_parser_parse2(parser, c, &pkt->data, &pkt->size,
data, data_size, AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0);
if (ret < 0) {
@@ -170,8 +172,10 @@ int main(int argc, char **argv)
if (pkt->size)
decode(c, frame, pkt, outfilename);
+ else if (eof)
+ break;
}
- }
+ } while (!eof);
/* flush the decoder */
decode(c, frame, NULL, outfilename);
--
2.31.1
2
2
17 Apr '22
From: Gyan Doshi <ffmpeg(a)gyani.pro>
The fate test file can be found here: https://drive.google.com/file/d/1jGW3f94rglLfr5WGmMQe3SEnp1YkbMRy/view?usp=…
The video file needs to be copied to fate-suite/mkv/
---
libavcodec/dynamic_hdr10_plus.c | 273 +++++++++++++++++---
libavcodec/dynamic_hdr10_plus.h | 35 ++-
libavformat/matroska.h | 5 +
libavformat/matroskadec.c | 30 ++-
libavformat/matroskaenc.c | 47 ++--
tests/fate/matroska.mak | 6 +
tests/ref/fate/matroska-hdr10-plus-metadata | 150 +++++++++++
7 files changed, 484 insertions(+), 62 deletions(-)
create mode 100644 tests/ref/fate/matroska-hdr10-plus-metadata
diff --git a/libavcodec/dynamic_hdr10_plus.c b/libavcodec/dynamic_hdr10_plus.c
index a602e606ed..df7828a476 100644
--- a/libavcodec/dynamic_hdr10_plus.c
+++ b/libavcodec/dynamic_hdr10_plus.c
@@ -18,6 +18,12 @@
#include "dynamic_hdr10_plus.h"
#include "get_bits.h"
+#include "put_bits.h"
+
+static const uint8_t usa_country_code = 0xB5;
+static const uint16_t smpte_provider_code = 0x003C;
+static const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
+static const uint16_t smpte2094_40_application_identifier = 0x04;
static const int64_t luminance_den = 1;
static const int32_t peak_luminance_den = 15;
@@ -27,8 +33,8 @@ static const int32_t knee_point_den = 4095;
static const int32_t bezier_anchor_den = 1023;
static const int32_t saturation_weight_den = 8;
-int ff_parse_itu_t_t35_to_dynamic_hdr10_plus(AVDynamicHDRPlus *s, const uint8_t *data,
- int size)
+int ff_parse_itu_t_t35_to_dynamic_hdr10_plus(AVDynamicHDRPlus* s, const uint8_t* data,
+ int size)
{
GetBitContext gbc, *gb = &gbc;
int ret;
@@ -40,7 +46,9 @@ int ff_parse_itu_t_t35_to_dynamic_hdr10_plus(AVDynamicHDRPlus *s, const uint8_t
if (ret < 0)
return ret;
- s->application_version = get_bits(gb, 8);
+ if (get_bits_left(gb) < 8)
+ return AVERROR_INVALIDDATA;
+ s->application_version = get_bits(gb, 8);
if (get_bits_left(gb) < 2)
return AVERROR_INVALIDDATA;
@@ -56,15 +64,11 @@ int ff_parse_itu_t_t35_to_dynamic_hdr10_plus(AVDynamicHDRPlus *s, const uint8_t
for (int w = 1; w < s->num_windows; w++) {
// The corners are set to absolute coordinates here. They should be
// converted to the relative coordinates (in [0, 1]) in the decoder.
- AVHDRPlusColorTransformParams *params = &s->params[w];
- params->window_upper_left_corner_x =
- (AVRational){get_bits(gb, 16), 1};
- params->window_upper_left_corner_y =
- (AVRational){get_bits(gb, 16), 1};
- params->window_lower_right_corner_x =
- (AVRational){get_bits(gb, 16), 1};
- params->window_lower_right_corner_y =
- (AVRational){get_bits(gb, 16), 1};
+ AVHDRPlusColorTransformParams* params = &s->params[w];
+ params->window_upper_left_corner_x = (AVRational) { get_bits(gb, 16), 1 };
+ params->window_upper_left_corner_y = (AVRational) { get_bits(gb, 16), 1 };
+ params->window_lower_right_corner_x = (AVRational) { get_bits(gb, 16), 1 };
+ params->window_lower_right_corner_y = (AVRational) { get_bits(gb, 16), 1 };
params->center_of_ellipse_x = get_bits(gb, 16);
params->center_of_ellipse_y = get_bits(gb, 16);
@@ -78,8 +82,7 @@ int ff_parse_itu_t_t35_to_dynamic_hdr10_plus(AVDynamicHDRPlus *s, const uint8_t
if (get_bits_left(gb) < 28)
return AVERROR(EINVAL);
- s->targeted_system_display_maximum_luminance =
- (AVRational){get_bits_long(gb, 27), luminance_den};
+ s->targeted_system_display_maximum_luminance = (AVRational) { get_bits_long(gb, 27), luminance_den };
s->targeted_system_display_actual_peak_luminance_flag = get_bits1(gb);
if (s->targeted_system_display_actual_peak_luminance_flag) {
@@ -99,38 +102,33 @@ int ff_parse_itu_t_t35_to_dynamic_hdr10_plus(AVDynamicHDRPlus *s, const uint8_t
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
- s->targeted_system_display_actual_peak_luminance[i][j] =
- (AVRational){get_bits(gb, 4), peak_luminance_den};
+ s->targeted_system_display_actual_peak_luminance[i][j] = (AVRational) { get_bits(gb, 4), peak_luminance_den };
}
}
}
for (int w = 0; w < s->num_windows; w++) {
- AVHDRPlusColorTransformParams *params = &s->params[w];
+ AVHDRPlusColorTransformParams* params = &s->params[w];
if (get_bits_left(gb) < (3 * 17 + 17 + 4))
return AVERROR(EINVAL);
for (int i = 0; i < 3; i++) {
- params->maxscl[i] =
- (AVRational){get_bits(gb, 17), rgb_den};
+ params->maxscl[i] = (AVRational) { get_bits(gb, 17), rgb_den };
}
- params->average_maxrgb =
- (AVRational){get_bits(gb, 17), rgb_den};
+ params->average_maxrgb = (AVRational) { get_bits(gb, 17), rgb_den };
params->num_distribution_maxrgb_percentiles = get_bits(gb, 4);
- if (get_bits_left(gb) <
- (params->num_distribution_maxrgb_percentiles * 24))
+ if (get_bits_left(gb) < (params->num_distribution_maxrgb_percentiles * 24))
return AVERROR(EINVAL);
for (int i = 0; i < params->num_distribution_maxrgb_percentiles; i++) {
params->distribution_maxrgb[i].percentage = get_bits(gb, 7);
- params->distribution_maxrgb[i].percentile =
- (AVRational){get_bits(gb, 17), rgb_den};
+ params->distribution_maxrgb[i].percentile = (AVRational) { get_bits(gb, 17), rgb_den };
}
if (get_bits_left(gb) < 10)
return AVERROR(EINVAL);
- params->fraction_bright_pixels = (AVRational){get_bits(gb, 10), fraction_pixel_den};
+ params->fraction_bright_pixels = (AVRational) { get_bits(gb, 10), fraction_pixel_den };
}
if (get_bits_left(gb) < 1)
return AVERROR(EINVAL);
@@ -152,14 +150,13 @@ int ff_parse_itu_t_t35_to_dynamic_hdr10_plus(AVDynamicHDRPlus *s, const uint8_t
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
- s->mastering_display_actual_peak_luminance[i][j] =
- (AVRational){get_bits(gb, 4), peak_luminance_den};
+ s->mastering_display_actual_peak_luminance[i][j] = (AVRational) { get_bits(gb, 4), peak_luminance_den };
}
}
}
for (int w = 0; w < s->num_windows; w++) {
- AVHDRPlusColorTransformParams *params = &s->params[w];
+ AVHDRPlusColorTransformParams* params = &s->params[w];
if (get_bits_left(gb) < 1)
return AVERROR(EINVAL);
@@ -168,18 +165,15 @@ int ff_parse_itu_t_t35_to_dynamic_hdr10_plus(AVDynamicHDRPlus *s, const uint8_t
if (get_bits_left(gb) < 28)
return AVERROR(EINVAL);
- params->knee_point_x =
- (AVRational){get_bits(gb, 12), knee_point_den};
- params->knee_point_y =
- (AVRational){get_bits(gb, 12), knee_point_den};
+ params->knee_point_x = (AVRational) { get_bits(gb, 12), knee_point_den };
+ params->knee_point_y = (AVRational) { get_bits(gb, 12), knee_point_den };
params->num_bezier_curve_anchors = get_bits(gb, 4);
if (get_bits_left(gb) < (params->num_bezier_curve_anchors * 10))
return AVERROR(EINVAL);
for (int i = 0; i < params->num_bezier_curve_anchors; i++) {
- params->bezier_curve_anchors[i] =
- (AVRational){get_bits(gb, 10), bezier_anchor_den};
+ params->bezier_curve_anchors[i] = (AVRational) { get_bits(gb, 10), bezier_anchor_den };
}
}
@@ -189,10 +183,215 @@ int ff_parse_itu_t_t35_to_dynamic_hdr10_plus(AVDynamicHDRPlus *s, const uint8_t
if (params->color_saturation_mapping_flag) {
if (get_bits_left(gb) < 6)
return AVERROR(EINVAL);
- params->color_saturation_weight =
- (AVRational){get_bits(gb, 6), saturation_weight_den};
+ params->color_saturation_weight = (AVRational) { get_bits(gb, 6), saturation_weight_den };
}
}
return 0;
}
+
+int ff_parse_full_itu_t_t35_to_dynamic_hdr10_plus(AVDynamicHDRPlus* s, const uint8_t* data,
+ int size)
+{
+ uint8_t country_code;
+ uint16_t provider_code;
+ uint16_t provider_oriented_code;
+ uint8_t application_identifier;
+ GetBitContext gbc, *gb = &gbc;
+ int ret, offset;
+
+ if (!s)
+ return AVERROR(ENOMEM);
+
+ if (size < 7)
+ return AVERROR_INVALIDDATA;
+
+ ret = init_get_bits8(gb, data, size);
+ if (ret < 0)
+ return ret;
+
+ country_code = get_bits(gb, 8);
+ provider_code = get_bits(gb, 16);
+
+ if (country_code != usa_country_code ||
+ provider_code != smpte_provider_code)
+ return AVERROR_INVALIDDATA;
+
+ // A/341 Amendment – 2094-40
+ provider_oriented_code = get_bits(gb, 16);
+ application_identifier = get_bits(gb, 8);
+ if (provider_oriented_code != smpte2094_40_provider_oriented_code ||
+ application_identifier != smpte2094_40_application_identifier)
+ return AVERROR_INVALIDDATA;
+
+ offset = get_bits_count(gb) / 8;
+
+ return ff_parse_itu_t_t35_to_dynamic_hdr10_plus(s, gb->buffer + offset, size - offset);
+}
+
+int ff_itu_t_t35_buffer_size(const AVDynamicHDRPlus* s)
+{
+ int bit_count = 0;
+ int w, size;
+
+ if (!s)
+ return 0;
+
+ // 7 bytes for country code, provider code, and user identifier.
+ bit_count += 56;
+
+ if (s->num_windows < 1 || s->num_windows > 3)
+ return 0;
+ // Count bits for window params.
+ bit_count += 2 + ((19 * 8 + 1) * (s->num_windows - 1));
+
+ bit_count += 28;
+ if (s->targeted_system_display_actual_peak_luminance_flag) {
+ int rows, cols;
+ rows = s->num_rows_targeted_system_display_actual_peak_luminance;
+ cols = s->num_cols_targeted_system_display_actual_peak_luminance;
+ if (((rows < 2) || (rows > 25)) || ((cols < 2) || (cols > 25)))
+ return 0;
+
+ bit_count += (10 + rows * cols * 4);
+ }
+ for (w = 0; w < s->num_windows; w++) {
+ bit_count += (3 * 17 + 17 + 4 + 10) + (s->params[w].num_distribution_maxrgb_percentiles * 24);
+ }
+ bit_count++;
+
+ if (s->mastering_display_actual_peak_luminance_flag) {
+ int rows, cols;
+ rows = s->num_rows_mastering_display_actual_peak_luminance;
+ cols = s->num_cols_mastering_display_actual_peak_luminance;
+ if (((rows < 2) || (rows > 25)) || ((cols < 2) || (cols > 25)))
+ return 0;
+
+ bit_count += (10 + rows * cols * 4);
+ }
+
+ for (w = 0; w < s->num_windows; w++) {
+ bit_count++;
+ if (s->params[w].tone_mapping_flag)
+ bit_count += (28 + s->params[w].num_bezier_curve_anchors * 10);
+
+ bit_count++;
+ if (s->params[w].color_saturation_mapping_flag)
+ bit_count += 6;
+ }
+ size = bit_count / 8;
+ if (bit_count % 8 != 0)
+ size++;
+ return size;
+}
+
+int ff_write_dynamic_hdr10_plus_to_full_itu_t_t35(const AVDynamicHDRPlus* s, uint8_t** data, size_t* size)
+{
+ int w, i, j;
+ PutBitContext pbc, *pb = &pbc;
+
+ if (!s || !size)
+ return AVERROR(EINVAL);
+
+ *size = ff_itu_t_t35_buffer_size(s);
+ if (*size <= 0)
+ return AVERROR(EINVAL);
+ *data = av_mallocz(*size);
+ init_put_bits(pb, *data, *size);
+ if (put_bits_left(pb) < *size) {
+ av_freep(data);
+ return AVERROR(EINVAL);
+ }
+ put_bits(pb, 8, usa_country_code);
+
+ put_bits(pb, 16, smpte_provider_code);
+ put_bits(pb, 16, smpte2094_40_provider_oriented_code);
+ put_bits(pb, 8, smpte2094_40_application_identifier);
+ put_bits(pb, 8, s->application_version);
+
+ put_bits(pb, 2, s->num_windows);
+
+ for (w = 1; w < s->num_windows; w++) {
+ put_bits(pb, 16, s->params[w].window_upper_left_corner_x.num / s->params[w].window_upper_left_corner_x.den);
+ put_bits(pb, 16, s->params[w].window_upper_left_corner_y.num / s->params[w].window_upper_left_corner_y.den);
+ put_bits(pb, 16, s->params[w].window_lower_right_corner_x.num / s->params[w].window_lower_right_corner_x.den);
+ put_bits(pb, 16, s->params[w].window_lower_right_corner_y.num / s->params[w].window_lower_right_corner_y.den);
+ put_bits(pb, 16, s->params[w].center_of_ellipse_x);
+ put_bits(pb, 16, s->params[w].center_of_ellipse_y);
+ put_bits(pb, 8, s->params[w].rotation_angle);
+ put_bits(pb, 16, s->params[w].semimajor_axis_internal_ellipse);
+ put_bits(pb, 16, s->params[w].semimajor_axis_external_ellipse);
+ put_bits(pb, 16, s->params[w].semiminor_axis_external_ellipse);
+ put_bits(pb, 1, s->params[w].overlap_process_option);
+ }
+ put_bits(pb, 27,
+ s->targeted_system_display_maximum_luminance.num * luminance_den / s->targeted_system_display_maximum_luminance.den);
+ put_bits(pb, 1, s->targeted_system_display_actual_peak_luminance_flag);
+ if (s->targeted_system_display_actual_peak_luminance_flag) {
+ int rows, cols;
+ rows = s->num_rows_targeted_system_display_actual_peak_luminance;
+ cols = s->num_cols_targeted_system_display_actual_peak_luminance;
+ put_bits(pb, 5, rows);
+ put_bits(pb, 5, cols);
+ for (i = 0; i < rows; i++) {
+ for (j = 0; j < cols; j++) {
+ put_bits(
+ pb, 4,
+ s->targeted_system_display_actual_peak_luminance[i][j].num * peak_luminance_den / s->targeted_system_display_actual_peak_luminance[i][j].den);
+ }
+ }
+ }
+ for (w = 0; w < s->num_windows; w++) {
+ for (i = 0; i < 3; i++) {
+ put_bits(pb, 17,
+ s->params[w].maxscl[i].num * rgb_den / s->params[w].maxscl[i].den);
+ }
+ put_bits(pb, 17,
+ s->params[w].average_maxrgb.num * rgb_den / s->params[w].average_maxrgb.den);
+ put_bits(pb, 4, s->params[w].num_distribution_maxrgb_percentiles);
+
+ for (i = 0; i < s->params[w].num_distribution_maxrgb_percentiles; i++) {
+ put_bits(pb, 7, s->params[w].distribution_maxrgb[i].percentage);
+ put_bits(pb, 17,
+ s->params[w].distribution_maxrgb[i].percentile.num * rgb_den / s->params[w].distribution_maxrgb[i].percentile.den);
+ }
+ put_bits(pb, 10,
+ s->params[w].fraction_bright_pixels.num * fraction_pixel_den / s->params[w].fraction_bright_pixels.den);
+ }
+ put_bits(pb, 1, s->mastering_display_actual_peak_luminance_flag);
+ if (s->mastering_display_actual_peak_luminance_flag) {
+ int rows, cols;
+ rows = s->num_rows_mastering_display_actual_peak_luminance;
+ cols = s->num_cols_mastering_display_actual_peak_luminance;
+ put_bits(pb, 5, rows);
+ put_bits(pb, 5, cols);
+ for (i = 0; i < rows; i++) {
+ for (j = 0; j < cols; j++) {
+ put_bits(
+ pb, 4,
+ s->mastering_display_actual_peak_luminance[i][j].num * peak_luminance_den / s->mastering_display_actual_peak_luminance[i][j].den);
+ }
+ }
+ }
+
+ for (w = 0; w < s->num_windows; w++) {
+ put_bits(pb, 1, s->params[w].tone_mapping_flag);
+ if (s->params[w].tone_mapping_flag) {
+ put_bits(pb, 12,
+ s->params[w].knee_point_x.num * knee_point_den / s->params[w].knee_point_x.den);
+ put_bits(pb, 12,
+ s->params[w].knee_point_y.num * knee_point_den / s->params[w].knee_point_y.den);
+ put_bits(pb, 4, s->params[w].num_bezier_curve_anchors);
+ for (i = 0; i < s->params[w].num_bezier_curve_anchors; i++) {
+ put_bits(pb, 10,
+ s->params[w].bezier_curve_anchors[i].num * bezier_anchor_den / s->params[w].bezier_curve_anchors[i].den);
+ }
+ }
+ put_bits(pb, 1, s->params[w].color_saturation_mapping_flag);
+ if (s->params[w].color_saturation_mapping_flag)
+ put_bits(pb, 6,
+ s->params[w].color_saturation_weight.num * saturation_weight_den / s->params[w].color_saturation_weight.den);
+ }
+ flush_put_bits(pb);
+ return 0;
+}
diff --git a/libavcodec/dynamic_hdr10_plus.h b/libavcodec/dynamic_hdr10_plus.h
index cd7acf0432..dafe548d2d 100644
--- a/libavcodec/dynamic_hdr10_plus.h
+++ b/libavcodec/dynamic_hdr10_plus.h
@@ -29,7 +29,38 @@
*
* @return 0 if succeed. Otherwise, returns the appropriate AVERROR.
*/
-int ff_parse_itu_t_t35_to_dynamic_hdr10_plus(AVDynamicHDRPlus *s, const uint8_t *data,
- int size);
+int ff_parse_itu_t_t35_to_dynamic_hdr10_plus(AVDynamicHDRPlus* s, const uint8_t* data,
+ int size);
+
+/**
+ * Parse the user data registered ITU-T T.35 with header to AVDynamicHDRPlus. At first check
+ * the header if the provider code is SMPTE-2094-40. Then will parse the data to AVDynamicHDRPlus.
+ * @param s A pointer containing the decoded AVDynamicHDRPlus structure.
+ * @param data The byte array containing the raw ITU-T T.35 data with header.
+ * @param size Size of the data array in bytes.
+ *
+ * @return 0 if succeed. Otherwise, returns the appropriate AVERROR.
+ */
+int ff_parse_full_itu_t_t35_to_dynamic_hdr10_plus(AVDynamicHDRPlus* s, const uint8_t* data,
+ int size);
+
+/**
+ * Get the size of buffer required to save the encoded bit stream of
+ * AVDynamicHDRPlus in the form of the user data registered ITU-T T.35.
+ * @param s The AVDynamicHDRPlus structure.
+ *
+ * @return The size of bit stream required for encoding. 0 if the data is invalid.
+ */
+int ff_itu_t_t35_buffer_size(const AVDynamicHDRPlus* s);
+
+/**
+ * Encode and write AVDynamicHDRPlus to the user data registered ITU-T T.3 with header (containing the provider code).
+ * @param s A pointer containing the AVDynamicHDRPlus structure.
+ * @param data The byte array containing the raw ITU-T T.35 data with header.
+ * @param size The size of the raw ITU-T T.35 data.
+ *
+ * @return 0 if succeed. Otherwise, returns the appropriate AVERROR.
+ */
+int ff_write_dynamic_hdr10_plus_to_full_itu_t_t35(const AVDynamicHDRPlus* s, uint8_t** data, size_t* size);
#endif /* AVCODEC_DYNAMIC_HDR10_PLUS_H */
diff --git a/libavformat/matroska.h b/libavformat/matroska.h
index 2d04a6838b..37c60cccf7 100644
--- a/libavformat/matroska.h
+++ b/libavformat/matroska.h
@@ -351,6 +351,11 @@ typedef enum {
MATROSKA_VIDEO_PROJECTION_TYPE_MESH = 3,
} MatroskaVideoProjectionType;
+typedef enum {
+ MATROSKA_BLOCK_ADD_ID_DEFAULT = 0,
+ MATROSKA_BLOCK_ADD_ID_DYNAMIC_HDR10_PLUS = 4,
+} MatroskaBlockAddID;
+
/*
* Matroska Codec IDs, strings
*/
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index fdfcc86aeb..e8860cc214 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -46,6 +46,7 @@
#include "libavutil/spherical.h"
#include "libavcodec/bytestream.h"
+#include "libavcodec/dynamic_hdr10_plus.h"
#include "libavcodec/flac.h"
#include "libavcodec/mpeg4audio.h"
#include "libavcodec/packet_internal.h"
@@ -3528,15 +3529,28 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska,
pkt->stream_index = st->index;
if (additional_size > 0) {
- uint8_t *side_data = av_packet_new_side_data(pkt,
- AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
- additional_size + 8);
- if (!side_data) {
- av_packet_unref(pkt);
- return AVERROR(ENOMEM);
+ if (additional_id == MATROSKA_BLOCK_ADD_ID_DYNAMIC_HDR10_PLUS) {
+ AVDynamicHDRPlus hdr10_plus;
+ if (!ff_parse_full_itu_t_t35_to_dynamic_hdr10_plus(&hdr10_plus, additional, additional_size)) {
+ uint8_t *side_data = av_packet_new_side_data(pkt, AV_PKT_DATA_DYNAMIC_HDR10_PLUS, sizeof(hdr10_plus));
+ if (!side_data) {
+ av_packet_unref(pkt);
+ av_free(pkt);
+ return AVERROR(ENOMEM);
+ }
+ memcpy(side_data, (uint8_t*)(&hdr10_plus), sizeof(hdr10_plus));
+ }
+ } else {
+ uint8_t *side_data = av_packet_new_side_data(pkt,
+ AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
+ additional_size + 8);
+ if (!side_data) {
+ av_packet_unref(pkt);
+ return AVERROR(ENOMEM);
+ }
+ AV_WB64(side_data, additional_id);
+ memcpy(side_data + 8, additional, additional_size);
}
- AV_WB64(side_data, additional_id);
- memcpy(side_data + 8, additional, additional_size);
}
if (discard_padding) {
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 899a3388cd..832d837ed7 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -51,6 +51,7 @@
#include "libavutil/samplefmt.h"
#include "libavutil/stereo3d.h"
+#include "libavcodec/dynamic_hdr10_plus.h"
#include "libavcodec/xiph.h"
#include "libavcodec/mpeg4audio.h"
@@ -2029,14 +2030,15 @@ static int mkv_write_block(AVFormatContext *s, AVIOContext *pb,
MatroskaMuxContext *mkv = s->priv_data;
AVCodecParameters *par = s->streams[pkt->stream_index]->codecpar;
mkv_track *track = &mkv->tracks[pkt->stream_index];
- uint8_t *data = NULL, *side_data = NULL;
- size_t side_data_size;
+ uint8_t *data = NULL, *side_data = NULL, *hdr10_plus_itu_t_t35 = NULL;
+ size_t side_data_size, hdr10_plus_itu_t_t35_size = 0;
int err = 0, offset = 0, size = pkt->size;
int64_t ts = track->write_dts ? pkt->dts : pkt->pts;
uint64_t additional_id;
int64_t discard_padding = 0;
unsigned track_number = track->track_num;
ebml_master block_group, block_additions, block_more;
+ int use_blockgroup = 0;
ts += track->ts_offset;
@@ -2084,13 +2086,18 @@ static int mkv_write_block(AVFormatContext *s, AVIOContext *pb,
(AVRational){1, par->sample_rate},
(AVRational){1, 1000000000});
}
-
side_data = av_packet_get_side_data(pkt,
+ AV_PKT_DATA_DYNAMIC_HDR10_PLUS,
+ &side_data_size);
+ if (side_data && side_data_size > 0)
+ ff_write_dynamic_hdr10_plus_to_full_itu_t_t35((AVDynamicHDRPlus*)side_data, &hdr10_plus_itu_t_t35, &hdr10_plus_itu_t_t35_size);
+
+ side_data = av_packet_get_side_data(pkt,
AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
&side_data_size);
if (side_data) {
- // Only the Codec-specific BlockMore (id == 1) is currently supported.
- if (side_data_size < 8 || (additional_id = AV_RB64(side_data)) != 1) {
+ // Only the Codec-specific BlockMore (id == 1) and HDR10+ BlockMore (id == 4) are currently supported.
+ if (side_data_size < 8 || (additional_id = AV_RB64(side_data)) != 1 || !hdr10_plus_itu_t_t35_size) {
side_data_size = 0;
} else {
side_data += 8;
@@ -2098,7 +2105,8 @@ static int mkv_write_block(AVFormatContext *s, AVIOContext *pb,
}
}
- if (side_data_size || discard_padding) {
+ use_blockgroup = hdr10_plus_itu_t_t35_size || side_data_size || discard_padding;
+ if (use_blockgroup) {
block_group = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, 0);
blockid = MATROSKA_ID_BLOCK;
}
@@ -2119,18 +2127,27 @@ static int mkv_write_block(AVFormatContext *s, AVIOContext *pb,
if (discard_padding)
put_ebml_sint(pb, MATROSKA_ID_DISCARDPADDING, discard_padding);
- if (side_data_size) {
+ if (side_data_size || hdr10_plus_itu_t_t35_size) {
block_additions = start_ebml_master(pb, MATROSKA_ID_BLOCKADDITIONS, 0);
- block_more = start_ebml_master(pb, MATROSKA_ID_BLOCKMORE, 0);
- /* Until dbc50f8a our demuxer used a wrong default value
- * of BlockAddID, so we write it unconditionally. */
- put_ebml_uint (pb, MATROSKA_ID_BLOCKADDID, additional_id);
- put_ebml_binary(pb, MATROSKA_ID_BLOCKADDITIONAL,
- side_data, side_data_size);
- end_ebml_master(pb, block_more);
+ if (side_data_size) {
+ block_more = start_ebml_master(pb, MATROSKA_ID_BLOCKMORE, 0);
+ /* Until dbc50f8a our demuxer used a wrong default value
+ * of BlockAddID, so we write it unconditionally. */
+ put_ebml_uint (pb, MATROSKA_ID_BLOCKADDID, additional_id);
+ put_ebml_binary(pb, MATROSKA_ID_BLOCKADDITIONAL,
+ side_data, side_data_size);
+ end_ebml_master(pb, block_more);
+ }
+ if(hdr10_plus_itu_t_t35_size) {
+ block_more = start_ebml_master(pb, MATROSKA_ID_BLOCKMORE, 0);
+ put_ebml_uint(pb, MATROSKA_ID_BLOCKADDID, MATROSKA_BLOCK_ADD_ID_DYNAMIC_HDR10_PLUS);
+ put_ebml_binary(pb, MATROSKA_ID_BLOCKADDITIONAL,
+ hdr10_plus_itu_t_t35, hdr10_plus_itu_t_t35_size);
+ end_ebml_master(pb, block_more);
+ }
end_ebml_master(pb, block_additions);
}
- if (side_data_size || discard_padding)
+ if (use_blockgroup)
end_ebml_master(pb, block_group);
return 0;
diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
index b57765280a..f27b731fa1 100644
--- a/tests/fate/matroska.mak
+++ b/tests/fate/matroska.mak
@@ -75,6 +75,12 @@ FATE_MATROSKA_FFMPEG_FFPROBE-$(call ALLYES, MATROSKA_DEMUXER MATROSKA_MUXER \
+= fate-matroska-spherical-mono-remux
fate-matroska-spherical-mono-remux: CMD = transcode matroska $(TARGET_SAMPLES)/mkv/spherical.mkv matroska "-map 0 -map 0 -c copy -disposition:0 -default+forced -disposition:1 -default -default_mode passthrough -color_primaries:1 bt709 -color_trc:1 smpte170m -colorspace:1 bt2020c -color_range:1 pc" "-map 0 -c copy -t 0" "" "-show_entries stream_side_data_list:stream_disposition=default,forced:stream=color_range,color_space,color_primaries,color_transfer"
+# The input file of the following test contains HDR10+ metadata and so this
+# test tests correct encoding and decoding HDR10+ for VP9/MKV.
+FATE_MATROSKA_FFMPEG_FFPROBE-$(call ALLYES, MATROSKA_DEMUXER MATROSKA_MUXER) \
+ += fate-matroska-hdr10-plus-metadata
+fate-matroska-hdr10-plus-metadata: CMD = transcode matroska $(TARGET_SAMPLES)/mkv/hdr10_plus_vp9_sample.mkv matroska "-map 0 -map 0 -c copy -pixel_format yuv420p10le" "" "" "-show_frames"
+
# The input file of the following test contains Content Light Level as well as
# Mastering Display Metadata and so this test tests correct muxing and demuxing
# of these. It furthermore also tests that this data is correctly propagated
diff --git a/tests/ref/fate/matroska-hdr10-plus-metadata b/tests/ref/fate/matroska-hdr10-plus-metadata
new file mode 100644
index 0000000000..cbcfc0f41f
--- /dev/null
+++ b/tests/ref/fate/matroska-hdr10-plus-metadata
@@ -0,0 +1,150 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 1280x720
+#sar 0: 1/1
+0, 0, 0, 1, 2764800, 0xf2617bf2
+[FRAME]
+media_type=video
+stream_index=0
+key_frame=1
+pkt_pts=0
+pkt_pts_time=0.000000
+pkt_dts=0
+pkt_dts_time=0.000000
+best_effort_timestamp=0
+best_effort_timestamp_time=0.000000
+pkt_duration=40
+pkt_duration_time=0.040000
+pkt_pos=582
+pkt_size=13350
+width=1280
+height=720
+pix_fmt=yuv420p10le
+sample_aspect_ratio=1:1
+pict_type=I
+coded_picture_number=0
+display_picture_number=0
+interlaced_frame=0
+top_field_first=0
+repeat_pict=0
+color_range=tv
+color_space=unknown
+color_primaries=unknown
+color_transfer=unknown
+chroma_location=unspecified
+[SIDE_DATA]
+side_data_type=HDR Dynamic Metadata SMPTE2094-40 (HDR10+)
+application version=1
+num_windows=1
+targeted_system_display_maximum_luminance=400/1
+maxscl=3340/100000
+maxscl=2870/100000
+maxscl=2720/100000
+average_maxrgb=510/100000
+num_distribution_maxrgb_percentiles=9
+distribution_maxrgb_percentage=1
+distribution_maxrgb_percentile=30/100000
+distribution_maxrgb_percentage=5
+distribution_maxrgb_percentile=2940/100000
+distribution_maxrgb_percentage=10
+distribution_maxrgb_percentile=255/100000
+distribution_maxrgb_percentage=25
+distribution_maxrgb_percentile=70/100000
+distribution_maxrgb_percentage=50
+distribution_maxrgb_percentile=1340/100000
+distribution_maxrgb_percentage=75
+distribution_maxrgb_percentile=1600/100000
+distribution_maxrgb_percentage=90
+distribution_maxrgb_percentile=1850/100000
+distribution_maxrgb_percentage=95
+distribution_maxrgb_percentile=1950/100000
+distribution_maxrgb_percentage=99
+distribution_maxrgb_percentile=2940/100000
+fraction_bright_pixels=1/1000
+knee_point_x=0/4095
+knee_point_y=0/4095
+num_bezier_curve_anchors=9
+bezier_curve_anchors=102/1023
+bezier_curve_anchors=205/1023
+bezier_curve_anchors=307/1023
+bezier_curve_anchors=410/1023
+bezier_curve_anchors=512/1023
+bezier_curve_anchors=614/1023
+bezier_curve_anchors=717/1023
+bezier_curve_anchors=819/1023
+bezier_curve_anchors=922/1023
+[/SIDE_DATA]
+[/FRAME]
+[FRAME]
+media_type=video
+stream_index=1
+key_frame=1
+pkt_pts=0
+pkt_pts_time=0.000000
+pkt_dts=0
+pkt_dts_time=0.000000
+best_effort_timestamp=0
+best_effort_timestamp_time=0.000000
+pkt_duration=40
+pkt_duration_time=0.040000
+pkt_pos=14051
+pkt_size=13350
+width=1280
+height=720
+pix_fmt=yuv420p10le
+sample_aspect_ratio=1:1
+pict_type=I
+coded_picture_number=0
+display_picture_number=0
+interlaced_frame=0
+top_field_first=0
+repeat_pict=0
+color_range=tv
+color_space=unknown
+color_primaries=unknown
+color_transfer=unknown
+chroma_location=unspecified
+[SIDE_DATA]
+side_data_type=HDR Dynamic Metadata SMPTE2094-40 (HDR10+)
+application version=1
+num_windows=1
+targeted_system_display_maximum_luminance=400/1
+maxscl=3340/100000
+maxscl=2870/100000
+maxscl=2720/100000
+average_maxrgb=510/100000
+num_distribution_maxrgb_percentiles=9
+distribution_maxrgb_percentage=1
+distribution_maxrgb_percentile=30/100000
+distribution_maxrgb_percentage=5
+distribution_maxrgb_percentile=2940/100000
+distribution_maxrgb_percentage=10
+distribution_maxrgb_percentile=255/100000
+distribution_maxrgb_percentage=25
+distribution_maxrgb_percentile=70/100000
+distribution_maxrgb_percentage=50
+distribution_maxrgb_percentile=1340/100000
+distribution_maxrgb_percentage=75
+distribution_maxrgb_percentile=1600/100000
+distribution_maxrgb_percentage=90
+distribution_maxrgb_percentile=1850/100000
+distribution_maxrgb_percentage=95
+distribution_maxrgb_percentile=1950/100000
+distribution_maxrgb_percentage=99
+distribution_maxrgb_percentile=2940/100000
+fraction_bright_pixels=1/1000
+knee_point_x=0/4095
+knee_point_y=0/4095
+num_bezier_curve_anchors=9
+bezier_curve_anchors=102/1023
+bezier_curve_anchors=205/1023
+bezier_curve_anchors=307/1023
+bezier_curve_anchors=410/1023
+bezier_curve_anchors=512/1023
+bezier_curve_anchors=614/1023
+bezier_curve_anchors=717/1023
+bezier_curve_anchors=819/1023
+bezier_curve_anchors=922/1023
+[/SIDE_DATA]
+[/FRAME]
--
2.33.0.rc1.237.g0d66db33f3-goog
3
6
[PATCH] avcodec: Pass the HDR10+ metadata to the packet side data in VP9 encoder
by Mohammad Izadi 13 Apr '22
by Mohammad Izadi 13 Apr '22
13 Apr '22
HDR10+ metadata is stored in the bit stream for HEVC. The story is different for VP9 and cannot store the metadata in the bit stream. HDR10+ should be passed to packet side data an stored in the container (mkv) for VP9.
This CL is taking HDR10+ from AVFrame side data in libvpxenc and is passing it to the AVPacket side data.
---
doc/APIchanges | 2 +
libavcodec/avpacket.c | 1 +
libavcodec/decode.c | 1 +
libavcodec/libvpxenc.c | 98 ++++++++++++++++++++++++++++++++++++++++++
libavcodec/packet.h | 8 ++++
libavcodec/version.h | 4 +-
6 files changed, 112 insertions(+), 2 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index c46f4d5304..60995579e5 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,8 @@ libavutil: 2021-04-27
API changes, most recent first:
+2021-05-25 - 8c88a66d3c - lavc 59.2.100 - packet.h
+ Add AV_PKT_DATA_DYNAMIC_HDR10_PLUS
2021-04-27 - cb3ac722f4 - lavc 59.0.100 - avcodec.h
Constified AVCodecParserContext.parser.
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 7383d12d3e..800bee3489 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -289,6 +289,7 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type)
case AV_PKT_DATA_ICC_PROFILE: return "ICC Profile";
case AV_PKT_DATA_DOVI_CONF: return "DOVI configuration record";
case AV_PKT_DATA_S12M_TIMECODE: return "SMPTE ST 12-1:2014 timecode";
+ case AV_PKT_DATA_DYNAMIC_HDR10_PLUS: return "HDR10+ Dynamic Metadata (SMPTE 2094-40)";
}
return NULL;
}
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 75bc7ad98e..40f688e40c 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1488,6 +1488,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
{ AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC },
{ AV_PKT_DATA_ICC_PROFILE, AV_FRAME_DATA_ICC_PROFILE },
{ AV_PKT_DATA_S12M_TIMECODE, AV_FRAME_DATA_S12M_TIMECODE },
+ { AV_PKT_DATA_DYNAMIC_HDR10_PLUS, AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
};
if (IS_EMPTY(pkt) && av_fifo_size(avctx->internal->pkt_props) >= sizeof(*pkt))
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 66bad444d0..cf7e25a4bc 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -64,6 +64,11 @@ struct FrameListData {
struct FrameListData *next;
};
+typedef struct FrameHDR10Plus {
+ int64_t pts;
+ AVBufferRef *hdr10_plus;
+} FrameHDR10Plus;
+
typedef struct VPxEncoderContext {
AVClass *class;
struct vpx_codec_ctx encoder;
@@ -121,6 +126,8 @@ typedef struct VPxEncoderContext {
int tune_content;
int corpus_complexity;
int tpl_model;
+ int discard_hdr10_plus;
+ AVFifoBuffer *hdr10_plus_fifo;
/**
* If the driver does not support ROI then warn the first time we
* encounter a frame with ROI side data.
@@ -316,6 +323,55 @@ static av_cold void free_frame_list(struct FrameListData *list)
}
}
+static av_cold int add_hdr10_plus(AVFifoBuffer *fifo, struct FrameHDR10Plus *data)
+{
+ int err = av_fifo_grow(fifo, sizeof(*data));
+ if (err < 0)
+ return err;
+ av_fifo_generic_write(fifo, data, sizeof(*data), NULL);
+ return 0;
+}
+
+static av_cold void free_hdr10_plus(struct FrameHDR10Plus *p)
+{
+ if (!p)
+ return;
+ av_buffer_unref(&p->hdr10_plus);
+ av_free(p);
+}
+
+static av_cold void free_hdr10_plus_fifo(AVFifoBuffer **fifo)
+{
+ FrameHDR10Plus *frame_hdr10_plus = NULL;
+ while (av_fifo_size(*fifo) >= sizeof(FrameHDR10Plus)) {
+ av_fifo_generic_read(*fifo, frame_hdr10_plus, sizeof(FrameHDR10Plus), NULL);
+ free_hdr10_plus(frame_hdr10_plus);
+ }
+ av_fifo_freep(fifo);
+}
+
+static int copy_hdr10_plus_to_pkt(AVFifoBuffer *fifo, AVPacket *pkt)
+{
+ FrameHDR10Plus *frame_hdr10_plus;
+ uint8_t *data;
+ if (av_fifo_size(fifo) < 1)
+ return 0;
+
+ av_fifo_generic_read(fifo, frame_hdr10_plus, sizeof(*frame_hdr10_plus), NULL);
+ if (!frame_hdr10_plus || !pkt || !frame_hdr10_plus->hdr10_plus || frame_hdr10_plus->pts != pkt->pts)
+ return 0;
+
+ data = av_packet_new_side_data(pkt, AV_PKT_DATA_DYNAMIC_HDR10_PLUS, frame_hdr10_plus->hdr10_plus->size);
+ if (!data) {
+ free_hdr10_plus(frame_hdr10_plus);
+ return AVERROR(ENOMEM);
+ }
+ memcpy(data, frame_hdr10_plus->hdr10_plus->data, frame_hdr10_plus->hdr10_plus->size);
+ free_hdr10_plus(frame_hdr10_plus);
+
+ return 0;
+}
+
static av_cold int codecctl_int(AVCodecContext *avctx,
enum vp8e_enc_control_id id, int val)
{
@@ -384,6 +440,7 @@ static av_cold int vpx_free(AVCodecContext *avctx)
av_freep(&ctx->twopass_stats.buf);
av_freep(&avctx->stats_out);
free_frame_list(ctx->coded_frame_list);
+ free_hdr10_plus_fifo(&ctx->hdr10_plus_fifo);
return 0;
}
@@ -835,6 +892,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
#endif
AVDictionaryEntry* en = NULL;
+ ctx->discard_hdr10_plus = 1;
av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str());
av_log(avctx, AV_LOG_VERBOSE, "%s\n", vpx_codec_build_config());
@@ -851,6 +909,14 @@ static av_cold int vpx_init(AVCodecContext *avctx,
if (avctx->codec_id == AV_CODEC_ID_VP9) {
if (set_pix_fmt(avctx, codec_caps, &enccfg, &flags, &img_fmt))
return AVERROR(EINVAL);
+ // Keep HDR10+ if it has bit depth higher than 8 and
+ // it has PQ trc (SMPTE2084).
+ if (enccfg.g_bit_depth > 8 && avctx->color_trc == AVCOL_TRC_SMPTE2084) {
+ ctx->discard_hdr10_plus = 0;
+ ctx->hdr10_plus_fifo = av_fifo_alloc(sizeof(FrameHDR10Plus));
+ if (!ctx->hdr10_plus_fifo)
+ return AVERROR(ENOMEM);
+ }
}
#endif
@@ -1211,6 +1277,15 @@ static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame,
AV_WB64(side_data, 1);
memcpy(side_data + 8, cx_frame->buf_alpha, cx_frame->sz_alpha);
}
+ if (cx_frame->frame_number != -1) {
+ VPxContext *ctx = avctx->priv_data;
+ if (!ctx->discard_hdr10_plus) {
+ int err = copy_hdr10_plus_to_pkt(ctx->hdr10_plus_fifo, pkt);
+ if (err < 0)
+ return err;
+ }
+ }
+
return pkt->size;
}
@@ -1618,6 +1693,29 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt,
vp9_encode_set_roi(avctx, frame->width, frame->height, sd);
}
}
+
+ if (!ctx->discard_hdr10_plus) {
+ AVFrameSideData *hdr10_plus_metadata;
+ // Add HDR10+ metadata to queue.
+ hdr10_plus_metadata = av_frame_get_side_data(frame, AV_FRAME_DATA_DYNAMIC_HDR_PLUS);
+ if (hdr10_plus_metadata) {
+ int err;
+ struct FrameHDR10Plus *data = av_malloc(sizeof(*data));
+ if (!data)
+ return AVERROR(ENOMEM);
+ data->pts = frame->pts;
+ data->hdr10_plus = av_buffer_ref(hdr10_plus_metadata->buf);
+ if (!data->hdr10_plus) {
+ av_freep(&data);
+ return AVERROR(ENOMEM);
+ }
+ err = add_hdr10_plus(ctx->hdr10_plus_fifo, data);
+ if (err < 0) {
+ av_freep(&data);
+ return err;
+ }
+ }
+ }
}
// this is for encoding with preset temporal layering patterns defined in
diff --git a/libavcodec/packet.h b/libavcodec/packet.h
index fad8341c12..a9d3a9b596 100644
--- a/libavcodec/packet.h
+++ b/libavcodec/packet.h
@@ -290,6 +290,14 @@ enum AVPacketSideDataType {
*/
AV_PKT_DATA_S12M_TIMECODE,
+ /**
+ * HDR10+ dynamic metadata associated with a video frame. The metadata is in
+ * the form of the AVDynamicHDRPlus struct and contains
+ * information for color volume transform - application 4 of
+ * SMPTE 2094-40:2016 standard.
+ */
+ AV_PKT_DATA_DYNAMIC_HDR10_PLUS,
+
/**
* The number of side data types.
* This is not part of the public API/ABI in the sense that it may
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 5b1e9e77f3..1288cecebe 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,8 +28,8 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 59
-#define LIBAVCODEC_VERSION_MINOR 1
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MINOR 2
+#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
--
2.32.0.rc1.229.g3e70b5a671-goog
4
28
[PATCH 1/3] lavc/encode: factor audio/video-specific parts out of ff_encode_preinit()
by Anton Khirnov 13 Apr '22
by Anton Khirnov 13 Apr '22
13 Apr '22
---
libavcodec/encode.c | 127 ++++++++++++++++++++++++++------------------
1 file changed, 75 insertions(+), 52 deletions(-)
diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index 618be0573d..6543dda5bd 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -406,15 +406,67 @@ int attribute_align_arg avcodec_receive_packet(AVCodecContext *avctx, AVPacket *
return 0;
}
-int ff_encode_preinit(AVCodecContext *avctx)
+static int encode_preinit_video(AVCodecContext *avctx)
{
+ const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(avctx->pix_fmt);
int i;
- if (avctx->time_base.num <= 0 || avctx->time_base.den <= 0) {
- av_log(avctx, AV_LOG_ERROR, "The encoder timebase is not set.\n");
- return AVERROR(EINVAL);
+ if (avctx->codec->pix_fmts) {
+ for (i = 0; avctx->codec->pix_fmts[i] != AV_PIX_FMT_NONE; i++)
+ if (avctx->pix_fmt == avctx->codec->pix_fmts[i])
+ break;
+ if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_NONE) {
+ char buf[128];
+ snprintf(buf, sizeof(buf), "%d", avctx->pix_fmt);
+ av_log(avctx, AV_LOG_ERROR, "Specified pixel format %s is invalid or not supported\n",
+ (char *)av_x_if_null(av_get_pix_fmt_name(avctx->pix_fmt), buf));
+ return AVERROR(EINVAL);
+ }
+ if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ420P ||
+ avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ411P ||
+ avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ422P ||
+ avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ440P ||
+ avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ444P)
+ avctx->color_range = AVCOL_RANGE_JPEG;
+ }
+
+ if ( avctx->bits_per_raw_sample < 0
+ || (avctx->bits_per_raw_sample > 8 && pixdesc->comp[0].depth <= 8)) {
+ av_log(avctx, AV_LOG_WARNING, "Specified bit depth %d not possible with the specified pixel formats depth %d\n",
+ avctx->bits_per_raw_sample, pixdesc->comp[0].depth);
+ avctx->bits_per_raw_sample = pixdesc->comp[0].depth;
+ }
+ if (avctx->width <= 0 || avctx->height <= 0) {
+ av_log(avctx, AV_LOG_ERROR, "dimensions not set\n");
+ return AVERROR(EINVAL);
+ }
+
+ if (avctx->hw_frames_ctx) {
+ AVHWFramesContext *frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
+ if (frames_ctx->format != avctx->pix_fmt) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Mismatching AVCodecContext.pix_fmt and AVHWFramesContext.format\n");
+ return AVERROR(EINVAL);
+ }
+ if (avctx->sw_pix_fmt != AV_PIX_FMT_NONE &&
+ avctx->sw_pix_fmt != frames_ctx->sw_format) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Mismatching AVCodecContext.sw_pix_fmt (%s) "
+ "and AVHWFramesContext.sw_format (%s)\n",
+ av_get_pix_fmt_name(avctx->sw_pix_fmt),
+ av_get_pix_fmt_name(frames_ctx->sw_format));
+ return AVERROR(EINVAL);
+ }
+ avctx->sw_pix_fmt = frames_ctx->sw_format;
}
+ return 0;
+}
+
+static int encode_preinit_audio(AVCodecContext *avctx)
+{
+ int i;
+
if (avctx->codec->sample_fmts) {
for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) {
if (avctx->sample_fmt == avctx->codec->sample_fmts[i])
@@ -434,24 +486,6 @@ int ff_encode_preinit(AVCodecContext *avctx)
return AVERROR(EINVAL);
}
}
- if (avctx->codec->pix_fmts) {
- for (i = 0; avctx->codec->pix_fmts[i] != AV_PIX_FMT_NONE; i++)
- if (avctx->pix_fmt == avctx->codec->pix_fmts[i])
- break;
- if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_NONE) {
- char buf[128];
- snprintf(buf, sizeof(buf), "%d", avctx->pix_fmt);
- av_log(avctx, AV_LOG_ERROR, "Specified pixel format %s is invalid or not supported\n",
- (char *)av_x_if_null(av_get_pix_fmt_name(avctx->pix_fmt), buf));
- return AVERROR(EINVAL);
- }
- if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ420P ||
- avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ411P ||
- avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ422P ||
- avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ440P ||
- avctx->codec->pix_fmts[i] == AV_PIX_FMT_YUVJ444P)
- avctx->color_range = AVCOL_RANGE_JPEG;
- }
if (avctx->codec->supported_samplerates) {
for (i = 0; avctx->codec->supported_samplerates[i] != 0; i++)
if (avctx->sample_rate == avctx->codec->supported_samplerates[i])
@@ -500,19 +534,26 @@ int ff_encode_preinit(AVCodecContext *avctx)
avctx->channels);
return AVERROR(EINVAL);
}
- if(avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
- const AVPixFmtDescriptor *pixdesc = av_pix_fmt_desc_get(avctx->pix_fmt);
- if ( avctx->bits_per_raw_sample < 0
- || (avctx->bits_per_raw_sample > 8 && pixdesc->comp[0].depth <= 8)) {
- av_log(avctx, AV_LOG_WARNING, "Specified bit depth %d not possible with the specified pixel formats depth %d\n",
- avctx->bits_per_raw_sample, pixdesc->comp[0].depth);
- avctx->bits_per_raw_sample = pixdesc->comp[0].depth;
- }
- if (avctx->width <= 0 || avctx->height <= 0) {
- av_log(avctx, AV_LOG_ERROR, "dimensions not set\n");
- return AVERROR(EINVAL);
- }
+
+ return 0;
+}
+
+int ff_encode_preinit(AVCodecContext *avctx)
+{
+ int ret = 0;
+
+ if (avctx->time_base.num <= 0 || avctx->time_base.den <= 0) {
+ av_log(avctx, AV_LOG_ERROR, "The encoder timebase is not set.\n");
+ return AVERROR(EINVAL);
}
+
+ switch (avctx->codec_type) {
+ case AVMEDIA_TYPE_VIDEO: ret = encode_preinit_video(avctx); break;
+ case AVMEDIA_TYPE_AUDIO: ret = encode_preinit_audio(avctx); break;
+ }
+ if (ret < 0)
+ return ret;
+
if ( (avctx->codec_type == AVMEDIA_TYPE_VIDEO || avctx->codec_type == AVMEDIA_TYPE_AUDIO)
&& avctx->bit_rate>0 && avctx->bit_rate<1000) {
av_log(avctx, AV_LOG_WARNING, "Bitrate %"PRId64" is extremely low, maybe you mean %"PRId64"k\n", avctx->bit_rate, avctx->bit_rate);
@@ -531,24 +572,6 @@ int ff_encode_preinit(AVCodecContext *avctx)
return AVERROR(EINVAL);
}
- if (avctx->hw_frames_ctx) {
- AVHWFramesContext *frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
- if (frames_ctx->format != avctx->pix_fmt) {
- av_log(avctx, AV_LOG_ERROR,
- "Mismatching AVCodecContext.pix_fmt and AVHWFramesContext.format\n");
- return AVERROR(EINVAL);
- }
- if (avctx->sw_pix_fmt != AV_PIX_FMT_NONE &&
- avctx->sw_pix_fmt != frames_ctx->sw_format) {
- av_log(avctx, AV_LOG_ERROR,
- "Mismatching AVCodecContext.sw_pix_fmt (%s) "
- "and AVHWFramesContext.sw_format (%s)\n",
- av_get_pix_fmt_name(avctx->sw_pix_fmt),
- av_get_pix_fmt_name(frames_ctx->sw_format));
- return AVERROR(EINVAL);
- }
- avctx->sw_pix_fmt = frames_ctx->sw_format;
- }
if (avctx->codec_descriptor->props & AV_CODEC_PROP_INTRA_ONLY)
avctx->internal->intra_only_flag = AV_PKT_FLAG_KEY;
--
2.33.0
3
11