The branch, master has been updated
via 78a16e42bdb7faa6d5180b7ecf34c8f8ad0dc2c5 (commit)
via 009e4a1c209236605275e283af3aed3db28e6be2 (commit)
via 9b709532d599fec8d322caba2217a5649c6204e9 (commit)
from 95850f339e96ac4ea82dd32cecc2c8795edcb47e (commit)
- Log -----------------------------------------------------------------
commit 78a16e42bdb7faa6d5180b7ecf34c8f8ad0dc2c5
Author: James Almer <[email protected]>
AuthorDate: Sun Oct 5 13:07:13 2025 -0300
Commit: James Almer <[email protected]>
CommitDate: Sun Oct 5 13:22:23 2025 -0300
avcodec/av1dec: don't overwrite container level color information if none
is coded in the bitstream
Signed-off-by: James Almer <[email protected]>
diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index b0c4efab8a..37349f4add 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -774,11 +774,13 @@ static int set_context_with_sequence(AVCodecContext
*avctx,
avctx->profile = seq->seq_profile;
avctx->level = seq->seq_level_idx[0];
- avctx->color_range =
- seq->color_config.color_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
- avctx->color_primaries = seq->color_config.color_primaries;
- avctx->colorspace = seq->color_config.matrix_coefficients;
- avctx->color_trc = seq->color_config.transfer_characteristics;
+ if (seq->color_config.color_description_present_flag) {
+ avctx->color_range =
+ seq->color_config.color_range ? AVCOL_RANGE_JPEG :
AVCOL_RANGE_MPEG;
+ avctx->color_primaries = seq->color_config.color_primaries;
+ avctx->colorspace = seq->color_config.matrix_coefficients;
+ avctx->color_trc = seq->color_config.transfer_characteristics;
+ }
switch (seq->color_config.chroma_sample_position) {
case AV1_CSP_VERTICAL:
commit 009e4a1c209236605275e283af3aed3db28e6be2
Author: James Almer <[email protected]>
AuthorDate: Sun Sep 28 20:42:16 2025 -0300
Commit: James Almer <[email protected]>
CommitDate: Sun Oct 5 13:22:23 2025 -0300
avcodec/libdav1d: also consider user defined color information when
selectiog pix_fmt
Fixes issue #20624.
Signed-off-by: James Almer <[email protected]>
diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
index 01fe2c415f..7f63bb1b15 100644
--- a/libavcodec/libdav1d.c
+++ b/libavcodec/libdav1d.c
@@ -143,15 +143,17 @@ static void libdav1d_init_params(AVCodecContext *c, const
Dav1dSequenceHeader *s
c->chroma_sample_location = AVCHROMA_LOC_TOPLEFT;
break;
}
- c->colorspace = (enum AVColorSpace) seq->mtrx;
- c->color_primaries = (enum AVColorPrimaries) seq->pri;
- c->color_trc = (enum AVColorTransferCharacteristic) seq->trc;
- c->color_range = seq->color_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
+ if (seq->color_description_present) {
+ c->colorspace = (enum AVColorSpace) seq->mtrx;
+ c->color_primaries = (enum AVColorPrimaries) seq->pri;
+ c->color_trc = (enum AVColorTransferCharacteristic) seq->trc;
+ c->color_range = seq->color_range ? AVCOL_RANGE_JPEG :
AVCOL_RANGE_MPEG;
+ }
if (seq->layout == DAV1D_PIXEL_LAYOUT_I444 &&
- seq->mtrx == DAV1D_MC_IDENTITY &&
- seq->pri == DAV1D_COLOR_PRI_BT709 &&
- seq->trc == DAV1D_TRC_SRGB)
+ c->colorspace == AVCOL_SPC_RGB &&
+ c->color_primaries == AVCOL_PRI_BT709 &&
+ c->color_trc == AVCOL_TRC_IEC61966_2_1)
c->pix_fmt = pix_fmt_rgb[seq->hbd];
else
c->pix_fmt = pix_fmt[seq->layout][seq->hbd];
commit 9b709532d599fec8d322caba2217a5649c6204e9
Author: James Almer <[email protected]>
AuthorDate: Tue Aug 5 14:49:03 2025 -0300
Commit: James Almer <[email protected]>
CommitDate: Sun Oct 5 13:22:17 2025 -0300
avformat/demux: don't overwrite container level color information if set
If the information is coded at the container level, then that's what should
be
exported. The user will still have access to values coded at the bitstream
level by firing a decoder.
Fixes issue #20121
Signed-off-by: James Almer <[email protected]>
diff --git a/libavformat/demux.c b/libavformat/demux.c
index cc0d57ae97..374a84cda5 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -2509,6 +2509,47 @@ static int extract_extradata(FFFormatContext *si,
AVStream *st, const AVPacket *
return 0;
}
+static int parameters_from_context(AVFormatContext *ic, AVCodecParameters *par,
+ const AVCodecContext *avctx)
+{
+ AVCodecParameters *par_tmp;
+ int ret;
+
+ par_tmp = avcodec_parameters_alloc();
+ if (!par_tmp)
+ return AVERROR(ENOMEM);
+
+ ret = avcodec_parameters_copy(par_tmp, par);
+ if (ret < 0)
+ goto fail;
+
+ ret = avcodec_parameters_from_context(par, avctx);
+ if (ret < 0)
+ goto fail;
+
+ /* Restore some values if they are signaled at the container level
+ * given they may have been replaced by codec level values as read
+ * internally by avformat_find_stream_info().
+ */
+ if (par_tmp->color_range != AVCOL_RANGE_UNSPECIFIED)
+ par->color_range = par_tmp->color_range;
+ if (par_tmp->color_primaries != AVCOL_PRI_UNSPECIFIED ||
+ par_tmp->color_trc != AVCOL_TRC_UNSPECIFIED ||
+ par_tmp->color_space != AVCOL_SPC_UNSPECIFIED) {
+ par->color_primaries = par_tmp->color_primaries;
+ par->color_trc = par_tmp->color_trc;
+ par->color_space = par_tmp->color_space;
+ }
+ if (par_tmp->chroma_location != AVCHROMA_LOC_UNSPECIFIED)
+ par->chroma_location = par_tmp->chroma_location;
+
+ ret = 0;
+fail:
+ avcodec_parameters_free(&par_tmp);
+
+ return ret;
+}
+
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
{
FFFormatContext *const si = ffformatcontext(ic);
@@ -3034,7 +3075,7 @@ int avformat_find_stream_info(AVFormatContext *ic,
AVDictionary **options)
FFStream *const sti = ffstream(st);
if (sti->avctx_inited) {
- ret = avcodec_parameters_from_context(st->codecpar, sti->avctx);
+ ret = parameters_from_context(ic, st->codecpar, sti->avctx);
if (ret < 0)
goto find_stream_info_err;
diff --git a/libavformat/version.h b/libavformat/version.h
index 4bde82abb4..35996a14ba 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@
#include "version_major.h"
#define LIBAVFORMAT_VERSION_MINOR 6
-#define LIBAVFORMAT_VERSION_MICRO 100
+#define LIBAVFORMAT_VERSION_MICRO 101
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
diff --git a/tests/ref/fate/enhanced-flv-multitrack
b/tests/ref/fate/enhanced-flv-multitrack
index d6c838eba9..e3c5836bfa 100644
--- a/tests/ref/fate/enhanced-flv-multitrack
+++ b/tests/ref/fate/enhanced-flv-multitrack
@@ -1,6 +1,6 @@
#extradata 0: 46, 0x6fed1203
#extradata 1: 26, 0x5e13070a
-#extradata 2: 12, 0x044800b1
+#extradata 2: 12, 0x044200af
#extradata 3: 27, 0x5f3604aa
#extradata 4: 17, 0x1d8a047e
#extradata 5: 34, 0x2b7301d1
-----------------------------------------------------------------------
Summary of changes:
libavcodec/av1dec.c | 12 ++++++----
libavcodec/libdav1d.c | 16 +++++++------
libavformat/demux.c | 43 +++++++++++++++++++++++++++++++++-
libavformat/version.h | 2 +-
tests/ref/fate/enhanced-flv-multitrack | 2 +-
5 files changed, 60 insertions(+), 15 deletions(-)
hooks/post-receive
--
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]