ffmpeg-cvslog
Threads by month
- ----- 2026 -----
- 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
November 2025
- 1 participants
- 206 discussions
[ffmpeg] branch master updated. 04eeaeed11 avfilter/vf_libplacebo: also rotate SAR when fitting
by ffmpeg-git@ffmpeg.org 29 Nov '25
by ffmpeg-git@ffmpeg.org 29 Nov '25
29 Nov '25
The branch, master has been updated
via 04eeaeed11d721ccbcd0104c2e79e3ceb819585d (commit)
via f83fdad550f6dddd09c99b6e00b81c327bfb7a5e (commit)
via 6e0034ab7e46429731fec6d2c390fa536a9157ad (commit)
from 372dab2a4d2cbfee365b3e654681f38547916145 (commit)
- Log -----------------------------------------------------------------
commit 04eeaeed11d721ccbcd0104c2e79e3ceb819585d
Author: Niklas Haas <git(a)haasn.dev>
AuthorDate: Mon Nov 10 12:38:11 2025 +0100
Commit: Niklas Haas <ffmpeg(a)haasn.dev>
CommitDate: Sat Nov 29 08:45:24 2025 +0000
avfilter/vf_libplacebo: also rotate SAR when fitting
diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index 8b5f789280..b1788565bf 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -928,10 +928,13 @@ static void update_crops(AVFilterContext *ctx, LibplaceboInput *in,
/* Effective visual crop */
double sar_in = q2d_fallback(inlink->sample_aspect_ratio, 1.0);
double sar_out = q2d_fallback(outlink->sample_aspect_ratio, 1.0);
- const float w_adj = sar_in / sar_out;
+
+ pl_rotation rot_total = PL_ROTATION_360 + image->rotation - target->rotation;
+ if (rot_total % PL_ROTATION_180 == PL_ROTATION_90)
+ sar_in = 1.0 / sar_in;
pl_rect2df fixed = image->crop;
- pl_rect2df_stretch(&fixed, w_adj, 1.0);
+ pl_rect2df_stretch(&fixed, sar_in / sar_out, 1.0);
switch (s->fit_mode) {
case FIT_FILL:
@@ -954,8 +957,7 @@ static void update_crops(AVFilterContext *ctx, LibplaceboInput *in,
pl_rect2df_aspect_fit(&target->crop, &fixed, 0.0);
}
- const pl_rotation rot_total = image->rotation - target->rotation;
- if ((rot_total + PL_ROTATION_360) % PL_ROTATION_180 == PL_ROTATION_90) {
+ if (rot_total % PL_ROTATION_180 == PL_ROTATION_90) {
/* Libplacebo expects the input crop relative to the actual frame
* dimensions, so un-transpose them here */
FFSWAP(float, image->crop.x0, image->crop.y0);
commit f83fdad550f6dddd09c99b6e00b81c327bfb7a5e
Author: Niklas Haas <git(a)haasn.dev>
AuthorDate: Mon Nov 10 12:36:33 2025 +0100
Commit: Niklas Haas <ffmpeg(a)haasn.dev>
CommitDate: Sat Nov 29 08:45:24 2025 +0000
avfilter/vf_libplacebo: fix math when AVRationals are undefined
diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index 5a615aceed..8b5f789280 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -861,6 +861,11 @@ static const AVFrame *ref_frame(const struct pl_frame_mix *mix)
return NULL;
}
+static inline double q2d_fallback(AVRational q, const double def)
+{
+ return (q.num && q.den) ? av_q2d(q) : def;
+}
+
static void update_crops(AVFilterContext *ctx, LibplaceboInput *in,
struct pl_frame *target, double target_pts)
{
@@ -882,8 +887,7 @@ static void update_crops(AVFilterContext *ctx, LibplaceboInput *in,
s->var_values[VAR_IN_W] = s->var_values[VAR_IW] = inlink->w;
s->var_values[VAR_IN_H] = s->var_values[VAR_IH] = inlink->h;
s->var_values[VAR_A] = (double) inlink->w / inlink->h;
- s->var_values[VAR_SAR] = inlink->sample_aspect_ratio.num ?
- av_q2d(inlink->sample_aspect_ratio) : 1.0;
+ s->var_values[VAR_SAR] = q2d_fallback(inlink->sample_aspect_ratio, 1.0);
s->var_values[VAR_IN_T] = s->var_values[VAR_T] = image_pts;
s->var_values[VAR_OUT_T] = s->var_values[VAR_OT] = target_pts;
s->var_values[VAR_N] = outl->frame_count_out;
@@ -920,9 +924,11 @@ static void update_crops(AVFilterContext *ctx, LibplaceboInput *in,
target->crop.x1 = target->crop.x0 + s->var_values[VAR_POS_W];
target->crop.y1 = target->crop.y0 + s->var_values[VAR_POS_H];
+
/* Effective visual crop */
- const float w_adj = av_q2d(inlink->sample_aspect_ratio) /
- av_q2d(outlink->sample_aspect_ratio);
+ double sar_in = q2d_fallback(inlink->sample_aspect_ratio, 1.0);
+ double sar_out = q2d_fallback(outlink->sample_aspect_ratio, 1.0);
+ const float w_adj = sar_in / sar_out;
pl_rect2df fixed = image->crop;
pl_rect2df_stretch(&fixed, w_adj, 1.0);
@@ -1278,7 +1284,7 @@ static int libplacebo_activate(AVFilterContext *ctx)
in->qstatus = pl_queue_update(in->queue, &in->mix, pl_queue_params(
.pts = TS2T(out_pts, outlink->time_base),
.radius = pl_frame_mix_radius(&s->opts->params),
- .vsync_duration = l->frame_rate.num ? av_q2d(av_inv_q(l->frame_rate)) : 0,
+ .vsync_duration = q2d_fallback(av_inv_q(l->frame_rate), 0.0),
));
switch (in->qstatus) {
@@ -1461,8 +1467,7 @@ static int libplacebo_config_output(AVFilterLink *outlink)
&outlink->w, &outlink->h));
s->reset_sar |= s->normalize_sar || s->nb_inputs > 1;
- double sar_in = inlink->sample_aspect_ratio.num ?
- av_q2d(inlink->sample_aspect_ratio) : 1.0;
+ double sar_in = q2d_fallback(inlink->sample_aspect_ratio, 1.0);
int force_oar = s->force_original_aspect_ratio;
if (!force_oar && s->fit_sense == FIT_CONSTRAINT) {
@@ -1549,8 +1554,7 @@ static int libplacebo_config_output(AVFilterLink *outlink)
/* Static variables */
s->var_values[VAR_OUT_W] = s->var_values[VAR_OW] = outlink->w;
s->var_values[VAR_OUT_H] = s->var_values[VAR_OH] = outlink->h;
- s->var_values[VAR_DAR] = outlink->sample_aspect_ratio.num ?
- av_q2d(outlink->sample_aspect_ratio) : 1.0;
+ s->var_values[VAR_DAR] = q2d_fallback(outlink->sample_aspect_ratio, 1.0);
s->var_values[VAR_HSUB] = 1 << desc->log2_chroma_w;
s->var_values[VAR_VSUB] = 1 << desc->log2_chroma_h;
s->var_values[VAR_OHSUB] = 1 << out_desc->log2_chroma_w;
commit 6e0034ab7e46429731fec6d2c390fa536a9157ad
Author: Niklas Haas <git(a)haasn.dev>
AuthorDate: Mon Nov 10 12:32:32 2025 +0100
Commit: Niklas Haas <ffmpeg(a)haasn.dev>
CommitDate: Sat Nov 29 08:45:24 2025 +0000
avfilter/vf_libplacebo: un-rotate image crop after fitting
When combining rotation with a FIT_ mode other than FIT_FILL, the fitting
logic was operating on the un-rotated rects, when it should have been
operating on the rotated (output) rects.
diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index 42501c51f2..5a615aceed 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -913,14 +913,6 @@ static void update_crops(AVFilterContext *ctx, LibplaceboInput *in,
image->crop.x1 = image->crop.x0 + s->var_values[VAR_CROP_W];
image->crop.y1 = image->crop.y0 + s->var_values[VAR_CROP_H];
- const pl_rotation rot_total = image->rotation - target->rotation;
- if ((rot_total + PL_ROTATION_360) % PL_ROTATION_180 == PL_ROTATION_90) {
- /* Libplacebo expects the input crop relative to the actual frame
- * dimensions, so un-transpose them here */
- FFSWAP(float, image->crop.x0, image->crop.y0);
- FFSWAP(float, image->crop.x1, image->crop.y1);
- }
-
if (src == ref) {
/* Only update the target crop once, for the 'reference' frame */
target->crop.x0 = av_expr_eval(s->pos_x_pexpr, s->var_values, NULL);
@@ -955,6 +947,14 @@ static void update_crops(AVFilterContext *ctx, LibplaceboInput *in,
case FIT_SCALE_DOWN:
pl_rect2df_aspect_fit(&target->crop, &fixed, 0.0);
}
+
+ const pl_rotation rot_total = image->rotation - target->rotation;
+ if ((rot_total + PL_ROTATION_360) % PL_ROTATION_180 == PL_ROTATION_90) {
+ /* Libplacebo expects the input crop relative to the actual frame
+ * dimensions, so un-transpose them here */
+ FFSWAP(float, image->crop.x0, image->crop.y0);
+ FFSWAP(float, image->crop.x1, image->crop.y1);
+ }
}
}
}
-----------------------------------------------------------------------
Summary of changes:
libavfilter/vf_libplacebo.c | 42 ++++++++++++++++++++++++------------------
1 file changed, 24 insertions(+), 18 deletions(-)
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. 372dab2a4d All: Removed reliance on compiler performing dead code elimination, changed various macro constant checks from if() to #if
by ffmpeg-git@ffmpeg.org 29 Nov '25
by ffmpeg-git@ffmpeg.org 29 Nov '25
29 Nov '25
The branch, master has been updated
via 372dab2a4d2cbfee365b3e654681f38547916145 (commit)
from a6206a31eae57c6ea7afb7e54443993584b76217 (commit)
- Log -----------------------------------------------------------------
commit 372dab2a4d2cbfee365b3e654681f38547916145
Author: Piotr Pawlowski <p(a)perkele.cc>
AuthorDate: Thu Oct 30 14:41:40 2025 +0100
Commit: Kacper Michajłow <kasper93(a)gmail.com>
CommitDate: Fri Nov 28 19:52:51 2025 +0100
All: Removed reliance on compiler performing dead code elimination, changed various macro constant checks from if() to #if
diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index 14aca0f164..dacdfba8da 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -437,10 +437,11 @@ av_cold void ff_codec_close(AVCodecContext *avctx)
if (avcodec_is_open(avctx)) {
AVCodecInternal *avci = avctx->internal;
- if (CONFIG_FRAME_THREAD_ENCODER &&
- avci->frame_thread_encoder && avctx->thread_count > 1) {
+#if CONFIG_FRAME_THREAD_ENCODER
+ if (avci->frame_thread_encoder && avctx->thread_count > 1) {
ff_frame_thread_encoder_free(avctx);
}
+#endif
if (HAVE_THREADS && avci->thread_ctx)
ff_thread_free(avctx);
if (avci->needs_close && ffcodec(avctx->codec)->close)
diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index 6e0620a36e..407bd8920f 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -317,12 +317,13 @@ static int encode_simple_internal(AVCodecContext *avctx, AVPacket *avpkt)
av_assert0(codec->cb_type == FF_CODEC_CB_TYPE_ENCODE);
- if (CONFIG_FRAME_THREAD_ENCODER && avci->frame_thread_encoder)
+#if CONFIG_FRAME_THREAD_ENCODER
+ if (avci->frame_thread_encoder)
/* This will unref frame. */
ret = ff_thread_video_encode_frame(avctx, avpkt, frame, &got_packet);
- else {
+ else
+#endif
ret = ff_encode_encode_cb(avctx, avpkt, frame, &got_packet);
- }
if (avci->draining && !got_packet)
avci->draining_done = 1;
@@ -825,11 +826,11 @@ int ff_encode_preinit(AVCodecContext *avctx)
memcpy(sd_packet->data, sd_frame->data, sd_frame->size);
}
- if (CONFIG_FRAME_THREAD_ENCODER) {
- ret = ff_frame_thread_encoder_init(avctx);
- if (ret < 0)
- return ret;
- }
+#if CONFIG_FRAME_THREAD_ENCODER
+ ret = ff_frame_thread_encoder_init(avctx);
+ if (ret < 0)
+ return ret;
+#endif
return 0;
}
diff --git a/libavcodec/x86/flacdsp_init.c b/libavcodec/x86/flacdsp_init.c
index fa993d3466..386955ba67 100644
--- a/libavcodec/x86/flacdsp_init.c
+++ b/libavcodec/x86/flacdsp_init.c
@@ -85,8 +85,10 @@ av_cold void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int
c->decorrelate[0] = ff_flac_decorrelate_indep4_16_ssse3;
else if (channels == 6)
c->decorrelate[0] = ff_flac_decorrelate_indep6_16_ssse3;
- else if (ARCH_X86_64 && channels == 8)
+#if ARCH_X86_64
+ else if (channels == 8)
c->decorrelate[0] = ff_flac_decorrelate_indep8_16_ssse3;
+#endif
} else if (fmt == AV_SAMPLE_FMT_S32) {
if (channels == 2)
c->decorrelate[0] = ff_flac_decorrelate_indep2_32_ssse3;
@@ -94,8 +96,10 @@ av_cold void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int
c->decorrelate[0] = ff_flac_decorrelate_indep4_32_ssse3;
else if (channels == 6)
c->decorrelate[0] = ff_flac_decorrelate_indep6_32_ssse3;
- else if (ARCH_X86_64 && channels == 8)
+#if ARCH_X86_64
+ else if (channels == 8)
c->decorrelate[0] = ff_flac_decorrelate_indep8_32_ssse3;
+#endif
}
}
if (EXTERNAL_SSE4(cpu_flags)) {
@@ -105,15 +109,19 @@ av_cold void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int
}
if (EXTERNAL_AVX(cpu_flags)) {
if (fmt == AV_SAMPLE_FMT_S16) {
- if (ARCH_X86_64 && channels == 8)
+#if ARCH_X86_64
+ if (channels == 8)
c->decorrelate[0] = ff_flac_decorrelate_indep8_16_avx;
+#endif
} else if (fmt == AV_SAMPLE_FMT_S32) {
if (channels == 4)
c->decorrelate[0] = ff_flac_decorrelate_indep4_32_avx;
else if (channels == 6)
c->decorrelate[0] = ff_flac_decorrelate_indep6_32_avx;
- else if (ARCH_X86_64 && channels == 8)
+#if ARCH_X86_64
+ else if (channels == 8)
c->decorrelate[0] = ff_flac_decorrelate_indep8_32_avx;
+#endif
}
}
if (EXTERNAL_XOP(cpu_flags)) {
diff --git a/libavcodec/x86/hevc/dsp_init.c b/libavcodec/x86/hevc/dsp_init.c
index f1558b7e3e..5b2b10f33a 100644
--- a/libavcodec/x86/hevc/dsp_init.c
+++ b/libavcodec/x86/hevc/dsp_init.c
@@ -821,13 +821,13 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
if (EXTERNAL_SSE2(cpu_flags)) {
c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_8_sse2;
c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_8_sse2;
- if (ARCH_X86_64) {
- c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_8_sse2;
- c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_8_sse2;
+#if ARCH_X86_64
+ c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_8_sse2;
+ c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_8_sse2;
- c->idct[2] = ff_hevc_idct_16x16_8_sse2;
- c->idct[3] = ff_hevc_idct_32x32_8_sse2;
- }
+ c->idct[2] = ff_hevc_idct_16x16_8_sse2;
+ c->idct[3] = ff_hevc_idct_32x32_8_sse2;
+#endif
SAO_BAND_INIT(8, sse2);
c->idct_dc[0] = ff_hevc_idct_4x4_dc_8_sse2;
@@ -843,10 +843,10 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
c->add_residual[3] = ff_hevc_add_residual_32_8_sse2;
}
if (EXTERNAL_SSSE3(cpu_flags)) {
- if(ARCH_X86_64) {
- c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_8_ssse3;
- c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_8_ssse3;
- }
+#if ARCH_X86_64
+ c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_8_ssse3;
+ c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_8_ssse3;
+#endif
SAO_EDGE_INIT(8, ssse3);
}
#if HAVE_SSE4_EXTERNAL && ARCH_X86_64
@@ -866,13 +866,13 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
if (EXTERNAL_AVX(cpu_flags)) {
c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_8_avx;
c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_8_avx;
- if (ARCH_X86_64) {
- c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_8_avx;
- c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_8_avx;
+#if ARCH_X86_64
+ c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_8_avx;
+ c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_8_avx;
- c->idct[2] = ff_hevc_idct_16x16_8_avx;
- c->idct[3] = ff_hevc_idct_32x32_8_avx;
- }
+ c->idct[2] = ff_hevc_idct_16x16_8_avx;
+ c->idct[3] = ff_hevc_idct_32x32_8_avx;
+#endif
SAO_BAND_INIT(8, avx);
c->idct[0] = ff_hevc_idct_4x4_8_avx;
@@ -982,7 +982,8 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
c->add_residual[3] = ff_hevc_add_residual_32_8_avx2;
}
#endif /* HAVE_AVX2_EXTERNAL */
- if (EXTERNAL_AVX512ICL(cpu_flags) && ARCH_X86_64) {
+#if ARCH_X86_64
+ if (EXTERNAL_AVX512ICL(cpu_flags)) {
c->put_hevc_qpel[1][0][1] = ff_hevc_put_qpel_h4_8_avx512icl;
c->put_hevc_qpel[3][0][1] = ff_hevc_put_qpel_h8_8_avx512icl;
c->put_hevc_qpel[5][0][1] = ff_hevc_put_qpel_h16_8_avx512icl;
@@ -990,6 +991,7 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
c->put_hevc_qpel[9][0][1] = ff_hevc_put_qpel_h64_8_avx512icl;
c->put_hevc_qpel[3][1][1] = ff_hevc_put_qpel_hv8_8_avx512icl;
}
+#endif
} else if (bit_depth == 10) {
if (EXTERNAL_MMXEXT(cpu_flags)) {
c->add_residual[0] = ff_hevc_add_residual_4_10_mmxext;
@@ -997,13 +999,13 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
if (EXTERNAL_SSE2(cpu_flags)) {
c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_10_sse2;
c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_10_sse2;
- if (ARCH_X86_64) {
- c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_10_sse2;
- c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_10_sse2;
+#if ARCH_X86_64
+ c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_10_sse2;
+ c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_10_sse2;
- c->idct[2] = ff_hevc_idct_16x16_10_sse2;
- c->idct[3] = ff_hevc_idct_32x32_10_sse2;
- }
+ c->idct[2] = ff_hevc_idct_16x16_10_sse2;
+ c->idct[3] = ff_hevc_idct_32x32_10_sse2;
+#endif
SAO_BAND_INIT(10, sse2);
SAO_EDGE_INIT(10, sse2);
@@ -1019,10 +1021,12 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
c->add_residual[2] = ff_hevc_add_residual_16_10_sse2;
c->add_residual[3] = ff_hevc_add_residual_32_10_sse2;
}
- if (EXTERNAL_SSSE3(cpu_flags) && ARCH_X86_64) {
+#if ARCH_X86_64
+ if (EXTERNAL_SSSE3(cpu_flags)) {
c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_10_ssse3;
c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_10_ssse3;
}
+#endif
#if HAVE_SSE4_EXTERNAL && ARCH_X86_64
if (EXTERNAL_SSE4(cpu_flags)) {
EPEL_LINKS(c->put_hevc_epel, 0, 0, pel_pixels, 10, sse4);
@@ -1039,13 +1043,13 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
if (EXTERNAL_AVX(cpu_flags)) {
c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_10_avx;
c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_10_avx;
- if (ARCH_X86_64) {
- c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_10_avx;
- c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_10_avx;
+#if ARCH_X86_64
+ c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_10_avx;
+ c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_10_avx;
- c->idct[2] = ff_hevc_idct_16x16_10_avx;
- c->idct[3] = ff_hevc_idct_32x32_10_avx;
- }
+ c->idct[2] = ff_hevc_idct_16x16_10_avx;
+ c->idct[3] = ff_hevc_idct_32x32_10_avx;
+#endif
c->idct[0] = ff_hevc_idct_4x4_10_avx;
c->idct[1] = ff_hevc_idct_8x8_10_avx;
@@ -1216,10 +1220,10 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
if (EXTERNAL_SSE2(cpu_flags)) {
c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_12_sse2;
c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_12_sse2;
- if (ARCH_X86_64) {
- c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_12_sse2;
- c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_12_sse2;
- }
+#if ARCH_X86_64
+ c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_12_sse2;
+ c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_12_sse2;
+#endif
SAO_BAND_INIT(12, sse2);
SAO_EDGE_INIT(12, sse2);
@@ -1228,10 +1232,12 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
c->idct_dc[2] = ff_hevc_idct_16x16_dc_12_sse2;
c->idct_dc[3] = ff_hevc_idct_32x32_dc_12_sse2;
}
- if (EXTERNAL_SSSE3(cpu_flags) && ARCH_X86_64) {
+#if ARCH_X86_64
+ if (EXTERNAL_SSSE3(cpu_flags)) {
c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_12_ssse3;
c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_12_ssse3;
}
+#endif
#if HAVE_SSE4_EXTERNAL && ARCH_X86_64
if (EXTERNAL_SSE4(cpu_flags)) {
EPEL_LINKS(c->put_hevc_epel, 0, 0, pel_pixels, 12, sse4);
@@ -1248,10 +1254,10 @@ void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth)
if (EXTERNAL_AVX(cpu_flags)) {
c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_12_avx;
c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_12_avx;
- if (ARCH_X86_64) {
- c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_12_avx;
- c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_12_avx;
- }
+#if ARCH_X86_64
+ c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_12_avx;
+ c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_12_avx;
+#endif
SAO_BAND_INIT(12, avx);
}
if (EXTERNAL_AVX2(cpu_flags)) {
diff --git a/libavcodec/x86/idctdsp_init.c b/libavcodec/x86/idctdsp_init.c
index 9c7f235b3f..fce62e5590 100644
--- a/libavcodec/x86/idctdsp_init.c
+++ b/libavcodec/x86/idctdsp_init.c
@@ -83,8 +83,8 @@ av_cold void ff_idctdsp_init_x86(IDCTDSPContext *c, AVCodecContext *avctx,
}
#endif
- if (ARCH_X86_64 &&
- !high_bit_depth &&
+#if ARCH_X86_64
+ if (!high_bit_depth &&
avctx->lowres == 0 &&
(avctx->idct_algo == FF_IDCT_AUTO ||
avctx->idct_algo == FF_IDCT_SIMPLEAUTO ||
@@ -95,9 +95,11 @@ av_cold void ff_idctdsp_init_x86(IDCTDSPContext *c, AVCodecContext *avctx,
c->idct_add = ff_simple_idct8_add_sse2;
c->perm_type = FF_IDCT_PERM_TRANSPOSE;
}
+#endif
}
- if (ARCH_X86_64 && avctx->lowres == 0) {
+#if ARCH_X86_64
+ if (avctx->lowres == 0) {
if (EXTERNAL_AVX(cpu_flags) &&
!high_bit_depth &&
(avctx->idct_algo == FF_IDCT_AUTO ||
@@ -147,4 +149,5 @@ av_cold void ff_idctdsp_init_x86(IDCTDSPContext *c, AVCodecContext *avctx,
}
}
}
+#endif
}
diff --git a/libavcodec/x86/mlpdsp_init.c b/libavcodec/x86/mlpdsp_init.c
index 950f996832..21a0e38143 100644
--- a/libavcodec/x86/mlpdsp_init.c
+++ b/libavcodec/x86/mlpdsp_init.c
@@ -200,8 +200,10 @@ av_cold void ff_mlpdsp_init_x86(MLPDSPContext *c)
if (INLINE_MMX(cpu_flags))
c->mlp_filter_channel = mlp_filter_channel_x86;
#endif
- if (ARCH_X86_64 && EXTERNAL_SSE4(cpu_flags))
+#if ARCH_X86_64
+ if (EXTERNAL_SSE4(cpu_flags))
c->mlp_rematrix_channel = ff_mlp_rematrix_channel_sse4;
- if (ARCH_X86_64 && EXTERNAL_AVX2_FAST(cpu_flags) && cpu_flags & AV_CPU_FLAG_BMI2)
+ if (EXTERNAL_AVX2_FAST(cpu_flags) && cpu_flags & AV_CPU_FLAG_BMI2)
c->mlp_rematrix_channel = ff_mlp_rematrix_channel_avx2_bmi2;
+#endif // ARCH_X86_64
}
diff --git a/libavcodec/x86/v210-init.c b/libavcodec/x86/v210-init.c
index 8b3677b8aa..895cc8f329 100644
--- a/libavcodec/x86/v210-init.c
+++ b/libavcodec/x86/v210-init.c
@@ -38,28 +38,38 @@ av_cold void ff_v210_x86_init(V210DecContext *s)
if (s->aligned_input) {
if (cpu_flags & AV_CPU_FLAG_SSSE3)
s->unpack_frame = ff_v210_planar_unpack_aligned_ssse3;
-
- if (HAVE_AVX_EXTERNAL && cpu_flags & AV_CPU_FLAG_AVX)
+#if HAVE_AVX_EXTERNAL
+ if (cpu_flags & AV_CPU_FLAG_AVX)
s->unpack_frame = ff_v210_planar_unpack_aligned_avx;
+#endif
- if (HAVE_AVX2_EXTERNAL && cpu_flags & AV_CPU_FLAG_AVX2)
+#if HAVE_AVX2_EXTERNAL
+ if (cpu_flags & AV_CPU_FLAG_AVX2)
s->unpack_frame = ff_v210_planar_unpack_aligned_avx2;
+#endif
+#if HAVE_AVX512ICL_EXTERNAL
if (EXTERNAL_AVX512ICL(cpu_flags))
s->unpack_frame = ff_v210_planar_unpack_avx512icl;
+#endif
}
else {
if (cpu_flags & AV_CPU_FLAG_SSSE3)
s->unpack_frame = ff_v210_planar_unpack_unaligned_ssse3;
-
- if (HAVE_AVX_EXTERNAL && cpu_flags & AV_CPU_FLAG_AVX)
+#if HAVE_AVX_EXTERNAL
+ if (cpu_flags & AV_CPU_FLAG_AVX)
s->unpack_frame = ff_v210_planar_unpack_unaligned_avx;
+#endif
- if (HAVE_AVX2_EXTERNAL && cpu_flags & AV_CPU_FLAG_AVX2)
+#if HAVE_AVX2_EXTERNAL
+ if (cpu_flags & AV_CPU_FLAG_AVX2)
s->unpack_frame = ff_v210_planar_unpack_unaligned_avx2;
+#endif
+#if HAVE_AVX512ICL_EXTERNAL
if (EXTERNAL_AVX512ICL(cpu_flags))
s->unpack_frame = ff_v210_planar_unpack_avx512icl;
- }
#endif
+ }
+#endif // HAVE_X86ASM
}
diff --git a/libavcodec/x86/v210enc_init.c b/libavcodec/x86/v210enc_init.c
index 44f22ca7fe..8396ea7a0b 100644
--- a/libavcodec/x86/v210enc_init.c
+++ b/libavcodec/x86/v210enc_init.c
@@ -71,11 +71,12 @@ av_cold void ff_v210enc_init_x86(V210EncContext *s)
s->pack_line_10 = ff_v210_planar_pack_10_avx512;
#endif
}
-
+#if HAVE_AVX512ICL_EXTERNAL
if (EXTERNAL_AVX512ICL(cpu_flags)) {
s->sample_factor_8 = 4;
s->pack_line_8 = ff_v210_planar_pack_8_avx512icl;
s->sample_factor_10 = 4;
s->pack_line_10 = ff_v210_planar_pack_10_avx512icl;
}
+#endif
}
diff --git a/libavfilter/x86/colorspacedsp_init.c b/libavfilter/x86/colorspacedsp_init.c
index b5006ac295..429cc8bd26 100644
--- a/libavfilter/x86/colorspacedsp_init.c
+++ b/libavfilter/x86/colorspacedsp_init.c
@@ -78,9 +78,10 @@ void ff_multiply3x3_sse2(int16_t *data[3], ptrdiff_t stride, int w, int h,
void ff_colorspacedsp_x86_init(ColorSpaceDSPContext *dsp)
{
+#if ARCH_X86_64
int cpu_flags = av_get_cpu_flags();
- if (ARCH_X86_64 && EXTERNAL_SSE2(cpu_flags)) {
+ if (EXTERNAL_SSE2(cpu_flags)) {
#define assign_yuv2yuv_fns(ss) \
dsp->yuv2yuv[BPP_8 ][BPP_8 ][SS_##ss] = ff_yuv2yuv_##ss##p8to8_sse2; \
dsp->yuv2yuv[BPP_8 ][BPP_10][SS_##ss] = ff_yuv2yuv_##ss##p8to10_sse2; \
@@ -116,4 +117,5 @@ void ff_colorspacedsp_x86_init(ColorSpaceDSPContext *dsp)
dsp->multiply3x3 = ff_multiply3x3_sse2;
}
+#endif
}
diff --git a/libavfilter/x86/f_ebur128_init.c b/libavfilter/x86/f_ebur128_init.c
index 6d43b4887f..8169e75ccc 100644
--- a/libavfilter/x86/f_ebur128_init.c
+++ b/libavfilter/x86/f_ebur128_init.c
@@ -30,12 +30,14 @@ double ff_ebur128_find_peak_2ch_avx(double *, int, const double *, int);
av_cold void ff_ebur128_init_x86(EBUR128DSPContext *dsp, int nb_channels)
{
+#if ARCH_X86_64
int cpu_flags = av_get_cpu_flags();
- if (ARCH_X86_64 && EXTERNAL_AVX(cpu_flags)) {
+ if (EXTERNAL_AVX(cpu_flags)) {
if (nb_channels >= 2)
dsp->filter_channels = ff_ebur128_filter_channels_avx;
if (nb_channels == 2)
dsp->find_peak = ff_ebur128_find_peak_2ch_avx;
}
+#endif
}
diff --git a/libavfilter/x86/vf_atadenoise_init.c b/libavfilter/x86/vf_atadenoise_init.c
index e7a653f191..3847e53250 100644
--- a/libavfilter/x86/vf_atadenoise_init.c
+++ b/libavfilter/x86/vf_atadenoise_init.c
@@ -36,15 +36,17 @@ void ff_atadenoise_filter_row8_serial_sse4(const uint8_t *src, uint8_t *dst,
av_cold void ff_atadenoise_init_x86(ATADenoiseDSPContext *dsp, int depth, int algorithm, const float *sigma)
{
+#if ARCH_X86_64
int cpu_flags = av_get_cpu_flags();
for (int p = 0; p < 4; p++) {
- if (ARCH_X86_64 && EXTERNAL_SSE4(cpu_flags) && depth <= 8 && algorithm == PARALLEL && sigma[p] == INT16_MAX) {
+ if (EXTERNAL_SSE4(cpu_flags) && depth <= 8 && algorithm == PARALLEL && sigma[p] == INT16_MAX) {
dsp->filter_row[p] = ff_atadenoise_filter_row8_sse4;
}
- if (ARCH_X86_64 && EXTERNAL_SSE4(cpu_flags) && depth <= 8 && algorithm == SERIAL && sigma[p] == INT16_MAX) {
+ if (EXTERNAL_SSE4(cpu_flags) && depth <= 8 && algorithm == SERIAL && sigma[p] == INT16_MAX) {
dsp->filter_row[p] = ff_atadenoise_filter_row8_serial_sse4;
}
}
+#endif
}
diff --git a/libavfilter/x86/vf_bwdif_init.c b/libavfilter/x86/vf_bwdif_init.c
index 76b574b2a9..51508ee771 100644
--- a/libavfilter/x86/vf_bwdif_init.c
+++ b/libavfilter/x86/vf_bwdif_init.c
@@ -67,18 +67,22 @@ av_cold void ff_bwdif_init_x86(BWDIFDSPContext *bwdif, int bit_depth)
bwdif->filter_line = ff_bwdif_filter_line_sse2;
if (EXTERNAL_SSSE3(cpu_flags))
bwdif->filter_line = ff_bwdif_filter_line_ssse3;
- if (ARCH_X86_64 && EXTERNAL_AVX2_FAST(cpu_flags))
+#if ARCH_X86_64
+ if (EXTERNAL_AVX2_FAST(cpu_flags))
bwdif->filter_line = ff_bwdif_filter_line_avx2;
- if (ARCH_X86_64 && EXTERNAL_AVX512ICL(cpu_flags))
+ if (EXTERNAL_AVX512ICL(cpu_flags))
bwdif->filter_line = ff_bwdif_filter_line_avx512icl;
+#endif
} else if (bit_depth <= 12) {
if (EXTERNAL_SSE2(cpu_flags))
bwdif->filter_line = ff_bwdif_filter_line_12bit_sse2;
if (EXTERNAL_SSSE3(cpu_flags))
bwdif->filter_line = ff_bwdif_filter_line_12bit_ssse3;
- if (ARCH_X86_64 && EXTERNAL_AVX2_FAST(cpu_flags))
+#if ARCH_X86_64
+ if (EXTERNAL_AVX2_FAST(cpu_flags))
bwdif->filter_line = ff_bwdif_filter_line_12bit_avx2;
- if (ARCH_X86_64 && EXTERNAL_AVX512ICL(cpu_flags))
+ if (EXTERNAL_AVX512ICL(cpu_flags))
bwdif->filter_line = ff_bwdif_filter_line_12bit_avx512icl;
+#endif
}
}
diff --git a/libavfilter/x86/vf_nlmeans_init.c b/libavfilter/x86/vf_nlmeans_init.c
index 37764d30ab..5d67090a98 100644
--- a/libavfilter/x86/vf_nlmeans_init.c
+++ b/libavfilter/x86/vf_nlmeans_init.c
@@ -33,8 +33,10 @@ void ff_compute_weights_line_avx2(const uint32_t *const iia,
av_cold void ff_nlmeans_init_x86(NLMeansDSPContext *dsp)
{
+#if ARCH_X86_64
int cpu_flags = av_get_cpu_flags();
- if (ARCH_X86_64 && EXTERNAL_AVX2_FAST(cpu_flags))
+ if (EXTERNAL_AVX2_FAST(cpu_flags))
dsp->compute_weights_line = ff_compute_weights_line_avx2;
+#endif
}
diff --git a/libavfilter/x86/vf_ssim_init.c b/libavfilter/x86/vf_ssim_init.c
index cbaa20ef16..6f2305430c 100644
--- a/libavfilter/x86/vf_ssim_init.c
+++ b/libavfilter/x86/vf_ssim_init.c
@@ -34,8 +34,10 @@ void ff_ssim_init_x86(SSIMDSPContext *dsp)
{
int cpu_flags = av_get_cpu_flags();
- if (ARCH_X86_64 && EXTERNAL_SSSE3(cpu_flags))
+#if ARCH_X86_64
+ if (EXTERNAL_SSSE3(cpu_flags))
dsp->ssim_4x4_line = ff_ssim_4x4_line_ssse3;
+#endif
if (EXTERNAL_SSE4(cpu_flags))
dsp->ssim_end_line = ff_ssim_end_line_sse4;
if (EXTERNAL_XOP(cpu_flags))
diff --git a/libavfilter/x86/vf_w3fdif_init.c b/libavfilter/x86/vf_w3fdif_init.c
index 16202fba76..6d677d651d 100644
--- a/libavfilter/x86/vf_w3fdif_init.c
+++ b/libavfilter/x86/vf_w3fdif_init.c
@@ -56,7 +56,9 @@ av_cold void ff_w3fdif_init_x86(W3FDIFDSPContext *dsp, int depth)
dsp->filter_scale = ff_w3fdif_scale_sse2;
}
- if (ARCH_X86_64 && EXTERNAL_SSE2(cpu_flags) && depth <= 8) {
+#if ARCH_X86_64
+ if (EXTERNAL_SSE2(cpu_flags) && depth <= 8) {
dsp->filter_complex_high = ff_w3fdif_complex_high_sse2;
}
+#endif
}
-----------------------------------------------------------------------
Summary of changes:
libavcodec/avcodec.c | 5 ++-
libavcodec/encode.c | 17 ++++----
libavcodec/x86/flacdsp_init.c | 16 +++++--
libavcodec/x86/hevc/dsp_init.c | 84 +++++++++++++++++++-----------------
libavcodec/x86/idctdsp_init.c | 9 ++--
libavcodec/x86/mlpdsp_init.c | 6 ++-
libavcodec/x86/v210-init.c | 24 ++++++++---
libavcodec/x86/v210enc_init.c | 3 +-
libavfilter/x86/colorspacedsp_init.c | 4 +-
libavfilter/x86/f_ebur128_init.c | 4 +-
libavfilter/x86/vf_atadenoise_init.c | 6 ++-
libavfilter/x86/vf_bwdif_init.c | 12 ++++--
libavfilter/x86/vf_nlmeans_init.c | 4 +-
libavfilter/x86/vf_ssim_init.c | 4 +-
libavfilter/x86/vf_w3fdif_init.c | 4 +-
15 files changed, 125 insertions(+), 77 deletions(-)
hooks/post-receive
--
1
0
[ffmpeg] branch release/7.1 updated. f65fc0b137 avformat/iamf_parse: fix compilation error
by ffmpeg-git@ffmpeg.org 28 Nov '25
by ffmpeg-git@ffmpeg.org 28 Nov '25
28 Nov '25
The branch, release/7.1 has been updated
via f65fc0b13754c94d6185b1b18e604b8129d4f774 (commit)
from c0e599e9d83a80cf1002c62684ecd90ae8776efd (commit)
- Log -----------------------------------------------------------------
commit f65fc0b13754c94d6185b1b18e604b8129d4f774
Author: James Almer <jamrial(a)gmail.com>
AuthorDate: Fri Nov 28 09:51:36 2025 -0300
Commit: James Almer <jamrial(a)gmail.com>
CommitDate: Fri Nov 28 09:51:36 2025 -0300
avformat/iamf_parse: fix compilation error
Regression since a2a67282859904283f1008e1ce0a7f6bc1e71757.
Signed-off-by: James Almer <jamrial(a)gmail.com>
diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c
index 8ea9616ec7..8fe7e1bb0e 100644
--- a/libavformat/iamf_parse.c
+++ b/libavformat/iamf_parse.c
@@ -398,7 +398,7 @@ static int scalable_channel_layout_config(void *s, AVIOContext *pb,
.nb_channels = substream_count +
coupled_substream_count };
- if (i && ch_layout.nb_channels <= audio_element->element->layers[i-1]->ch_layout.nb_channels)
+ if (i && layer->ch_layout.nb_channels <= audio_element->element->layers[i-1]->ch_layout.nb_channels)
return AVERROR_INVALIDDATA;
for (int j = 0; j < substream_count; j++) {
-----------------------------------------------------------------------
Summary of changes:
libavformat/iamf_parse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. a6206a31ea swscale: Fix out-of-bounds write errors in yuv2rgb_lasx.c file.
by ffmpeg-git@ffmpeg.org 28 Nov '25
by ffmpeg-git@ffmpeg.org 28 Nov '25
28 Nov '25
The branch, master has been updated
via a6206a31eae57c6ea7afb7e54443993584b76217 (commit)
from c1b86a009e6724aa23eda26ac2b688a63226e42b (commit)
- Log -----------------------------------------------------------------
commit a6206a31eae57c6ea7afb7e54443993584b76217
Author: Hao Chen <chenhao(a)loongson.cn>
AuthorDate: Tue Nov 11 19:05:48 2025 +0800
Commit: Zhao Zhili <quink(a)noreply.code.ffmpeg.org>
CommitDate: Fri Nov 28 03:40:47 2025 +0000
swscale: Fix out-of-bounds write errors in yuv2rgb_lasx.c file.
The patch adds support for dstw values ending in 2, 4, 6, 8, 10, 12, and 14,
which fixes the out-of-bounds write problem.
diff --git a/libswscale/loongarch/yuv2rgb_lasx.c b/libswscale/loongarch/yuv2rgb_lasx.c
index d83e5d70fe..9032887ff8 100644
--- a/libswscale/loongarch/yuv2rgb_lasx.c
+++ b/libswscale/loongarch/yuv2rgb_lasx.c
@@ -173,7 +173,7 @@
__m256i shuf3 = {0x1E0F0E1C0D0C1A0B, 0x0101010101010101, \
0x1E0F0E1C0D0C1A0B, 0x0101010101010101}; \
YUV2RGB_LOAD_COE \
- y = (c->opts.dst_w + 7) & ~7; \
+ y = c->opts.dst_w; \
h_size = y >> 4; \
res = y & 15; \
\
@@ -199,7 +199,7 @@
__m256i a = __lasx_xvldi(0xFF); \
\
YUV2RGB_LOAD_COE \
- y = (c->opts.dst_w + 7) & ~7; \
+ y = c->opts.dst_w; \
h_size = y >> 4; \
res = y & 15; \
\
@@ -215,7 +215,7 @@
const uint8_t *pv = src[2] + (y >> vshift) * srcStride[2]; \
for(x = 0; x < h_size; x++) { \
-#define DEALYUV2RGBREMAIN \
+#define DEALYUV2RGBLINE \
py_1 += 16; \
py_2 += 16; \
pu += 8; \
@@ -223,9 +223,40 @@
image1 += 48; \
image2 += 48; \
} \
- if (res) { \
+ if (res & 8) { \
-#define DEALYUV2RGBREMAIN32 \
+#define DEALYUV2RGBLINERES \
+ py_1 += 8; \
+ py_2 += 8; \
+ pu += 4; \
+ pv += 4; \
+ image1 += 24; \
+ image2 += 24; \
+ res -= 8 ; \
+ } \
+ if (res) {
+
+#define ENDYUV2RGBLINE(rgb_l, rgb_h, image_1, image_2) \
+ if (res == 6) { \
+ __lasx_xvstelm_d(rgb_l, image_1, 0, 0); \
+ __lasx_xvstelm_d(rgb_l, image_1, 8, 1); \
+ __lasx_xvstelm_h(rgb_h, image_1, 16, 0); \
+ __lasx_xvstelm_d(rgb_l, image_2, 0, 2); \
+ __lasx_xvstelm_d(rgb_l, image_2, 8, 3); \
+ __lasx_xvstelm_h(rgb_h, image_2, 16, 8); \
+ } else if (res == 4) { \
+ __lasx_xvstelm_d(rgb_l, image_1, 0, 0); \
+ __lasx_xvstelm_w(rgb_l, image_1, 8, 2); \
+ __lasx_xvstelm_d(rgb_l, image_2, 0, 2); \
+ __lasx_xvstelm_w(rgb_l, image_2, 8, 6); \
+ } else if (res == 2) { \
+ __lasx_xvstelm_w(rgb_l, image_1, 0, 0); \
+ __lasx_xvstelm_h(rgb_l, image_1, 4, 2); \
+ __lasx_xvstelm_w(rgb_l, image_2, 0, 4); \
+ __lasx_xvstelm_h(rgb_l, image_2, 4, 10); \
+ }
+
+#define DEALYUV2RGBLINE32 \
py_1 += 16; \
py_2 += 16; \
pu += 8; \
@@ -233,7 +264,36 @@
image1 += 16; \
image2 += 16; \
} \
- if (res) { \
+ if (res & 8) { \
+
+#define DEALYUV2RGBLINERES32 \
+ py_1 += 8; \
+ py_2 += 8; \
+ pu += 4; \
+ pv += 4; \
+ image1 += 8; \
+ image2 += 8; \
+ res -= 8; \
+ } \
+ if (res) {
+
+#define ENDYUV2RGBLINE32(rgb_l, rgb_h, image_1, image_2) \
+ if (res == 6) { \
+ __lasx_xvstelm_d(rgb_l, image_1, 0, 0); \
+ __lasx_xvstelm_d(rgb_l, image_1, 8, 1); \
+ __lasx_xvstelm_d(rgb_l, image_1, 16, 2); \
+ __lasx_xvstelm_d(rgb_h, image_2, 0, 0); \
+ __lasx_xvstelm_d(rgb_h, image_2, 8, 1); \
+ __lasx_xvstelm_d(rgb_h, image_2, 16, 2); \
+ } else if (res == 4) { \
+ __lasx_xvstelm_d(rgb_l, image_1, 0, 0); \
+ __lasx_xvstelm_d(rgb_l, image_1, 8, 1); \
+ __lasx_xvstelm_d(rgb_h, image_2, 0, 0); \
+ __lasx_xvstelm_d(rgb_h, image_2, 8, 1); \
+ } else if (res == 2) { \
+ __lasx_xvstelm_d(rgb_l, image_1, 0, 0); \
+ __lasx_xvstelm_d(rgb_h, image_2, 0, 0); \
+ }
#define END_FUNC() \
@@ -249,10 +309,14 @@ YUV2RGBFUNC(yuv420_rgb24_lasx, uint8_t, 0)
RGB_PACK(r2, g2, b2, rgb2_l, rgb2_h);
RGB_STORE(rgb1_l, rgb1_h, image1);
RGB_STORE(rgb2_l, rgb2_h, image2);
- DEALYUV2RGBREMAIN
+ DEALYUV2RGBLINE
YUV2RGB_RES
RGB_PACK(r1, g1, b1, rgb1_l, rgb1_h);
RGB_STORE_RES(rgb1_l, rgb1_h, image1, image2);
+ DEALYUV2RGBLINERES
+ YUV2RGB_RES
+ RGB_PACK(r1, g1, b1, rgb1_l, rgb1_h);
+ ENDYUV2RGBLINE(rgb1_l, rgb1_h, image1, image2);
END_FUNC()
YUV2RGBFUNC(yuv420_bgr24_lasx, uint8_t, 0)
@@ -262,10 +326,14 @@ YUV2RGBFUNC(yuv420_bgr24_lasx, uint8_t, 0)
RGB_PACK(b2, g2, r2, rgb2_l, rgb2_h);
RGB_STORE(rgb1_l, rgb1_h, image1);
RGB_STORE(rgb2_l, rgb2_h, image2);
- DEALYUV2RGBREMAIN
+ DEALYUV2RGBLINE
YUV2RGB_RES
RGB_PACK(b1, g1, r1, rgb1_l, rgb1_h);
RGB_STORE_RES(rgb1_l, rgb1_h, image1, image2);
+ DEALYUV2RGBLINERES
+ YUV2RGB_RES
+ RGB_PACK(b1, g1, r1, rgb1_l, rgb1_h);
+ ENDYUV2RGBLINE(rgb1_l, rgb1_h, image1, image2);
END_FUNC()
YUV2RGBFUNC32(yuv420_rgba32_lasx, uint32_t, 0)
@@ -275,10 +343,14 @@ YUV2RGBFUNC32(yuv420_rgba32_lasx, uint32_t, 0)
RGB32_PACK(r2, g2, b2, a, rgb2_l, rgb2_h);
RGB32_STORE(rgb1_l, rgb1_h, image1);
RGB32_STORE(rgb2_l, rgb2_h, image2);
- DEALYUV2RGBREMAIN32
+ DEALYUV2RGBLINE32
YUV2RGB_RES
RGB32_PACK(r1, g1, b1, a, rgb1_l, rgb1_h);
RGB32_STORE_RES(rgb1_l, rgb1_h, image1, image2);
+ DEALYUV2RGBLINERES32
+ YUV2RGB_RES
+ RGB32_PACK(r1, g1, b1, a, rgb1_l, rgb1_h);
+ ENDYUV2RGBLINE32(rgb1_l, rgb1_h, image1, image2);
END_FUNC()
YUV2RGBFUNC32(yuv420_bgra32_lasx, uint32_t, 0)
@@ -288,10 +360,14 @@ YUV2RGBFUNC32(yuv420_bgra32_lasx, uint32_t, 0)
RGB32_PACK(b2, g2, r2, a, rgb2_l, rgb2_h);
RGB32_STORE(rgb1_l, rgb1_h, image1);
RGB32_STORE(rgb2_l, rgb2_h, image2);
- DEALYUV2RGBREMAIN32
+ DEALYUV2RGBLINE32
YUV2RGB_RES
RGB32_PACK(b1, g1, r1, a, rgb1_l, rgb1_h);
RGB32_STORE_RES(rgb1_l, rgb1_h, image1, image2);
+ DEALYUV2RGBLINERES32
+ YUV2RGB_RES
+ RGB32_PACK(b1, g1, r1, a, rgb1_l, rgb1_h);
+ ENDYUV2RGBLINE32(rgb1_l, rgb1_h, image1, image2);
END_FUNC()
YUV2RGBFUNC32(yuv420_argb32_lasx, uint32_t, 0)
@@ -301,10 +377,14 @@ YUV2RGBFUNC32(yuv420_argb32_lasx, uint32_t, 0)
RGB32_PACK(a, r2, g2, b2, rgb2_l, rgb2_h);
RGB32_STORE(rgb1_l, rgb1_h, image1);
RGB32_STORE(rgb2_l, rgb2_h, image2);
- DEALYUV2RGBREMAIN32
+ DEALYUV2RGBLINE32
YUV2RGB_RES
RGB32_PACK(a, r1, g1, b1, rgb1_l, rgb1_h);
RGB32_STORE_RES(rgb1_l, rgb1_h, image1, image2);
+ DEALYUV2RGBLINERES32
+ YUV2RGB_RES
+ RGB32_PACK(a, r1, g1, b1, rgb1_l, rgb1_h);
+ ENDYUV2RGBLINE32(rgb1_l, rgb1_h, image1, image2);
END_FUNC()
YUV2RGBFUNC32(yuv420_abgr32_lasx, uint32_t, 0)
@@ -314,8 +394,12 @@ YUV2RGBFUNC32(yuv420_abgr32_lasx, uint32_t, 0)
RGB32_PACK(a, b2, g2, r2, rgb2_l, rgb2_h);
RGB32_STORE(rgb1_l, rgb1_h, image1);
RGB32_STORE(rgb2_l, rgb2_h, image2);
- DEALYUV2RGBREMAIN32
+ DEALYUV2RGBLINE32
YUV2RGB_RES
RGB32_PACK(a, b1, g1, r1, rgb1_l, rgb1_h);
RGB32_STORE_RES(rgb1_l, rgb1_h, image1, image2);
+ DEALYUV2RGBLINERES32
+ YUV2RGB_RES
+ RGB32_PACK(a, b1, g1, r1, rgb1_l, rgb1_h);
+ ENDYUV2RGBLINE32(rgb1_l, rgb1_h, image1, image2);
END_FUNC()
-----------------------------------------------------------------------
Summary of changes:
libswscale/loongarch/yuv2rgb_lasx.c | 108 ++++++++++++++++++++++++++++++++----
1 file changed, 96 insertions(+), 12 deletions(-)
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. c1b86a009e tests/fate-filter-drawvg-video: copy drawvg.lines file to tests/data.
by ffmpeg-git@ffmpeg.org 28 Nov '25
by ffmpeg-git@ffmpeg.org 28 Nov '25
28 Nov '25
The branch, master has been updated
via c1b86a009e6724aa23eda26ac2b688a63226e42b (commit)
from 3d96d83a0a009a3bf566b208b14a7d264f17263b (commit)
- Log -----------------------------------------------------------------
commit c1b86a009e6724aa23eda26ac2b688a63226e42b
Author: Ayose <ayosec(a)gmail.com>
AuthorDate: Wed Nov 26 22:00:39 2025 +0000
Commit: Kacper Michajłow <kasper93(a)gmail.com>
CommitDate: Fri Nov 28 02:38:09 2025 +0000
tests/fate-filter-drawvg-video: copy drawvg.lines file to tests/data.
If the SRC_PATH variable contains certain characters (like a `:`, which may
happen when FATE is executed on Windows), the value for the `file` option is
broken, so `make fate-filter-drawvg-video` always fails.
The solution in this commit is to copy the `drawvg.lines` to the `tests/data`
directory (which already has temp files), so the value for `file` is a fixed
string with no problematic characters.
Signed-off-by: Ayose <ayosec(a)gmail.com>
diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index 3fe7f10476..087ba8d9cd 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -609,7 +609,10 @@ fate-filter-tiltandshift-410: CMD = framecrc -c:v pgmyuv -i $(SRC) -flags +bitex
fate-filter-tiltandshift-422: CMD = framecrc -c:v pgmyuv -i $(SRC) -flags +bitexact -vf scale=sws_flags=+accurate_rnd+bitexact,format=yuv422p,tiltandshift
fate-filter-tiltandshift-444: CMD = framecrc -c:v pgmyuv -i $(SRC) -flags +bitexact -vf scale=sws_flags=+accurate_rnd+bitexact,format=yuv444p,tiltandshift
-DRAWVG_SCRIPT_LINES = $(SRC_PATH)/tests/ref/lavf/drawvg.lines
+DRAWVG_SCRIPT_LINES = tests/data/fate/drawvg.lines
+$(DRAWVG_SCRIPT_LINES): $(SRC_PATH)/tests/ref/lavf/drawvg.lines
+ $(M)cp $< $@
+
FATE_FILTER_VSYNTH_VIDEO_FILTER-$(CONFIG_DRAWVG_FILTER) += fate-filter-drawvg-video
fate-filter-drawvg-video: $(DRAWVG_SCRIPT_LINES)
fate-filter-drawvg-video: CMD = video_filter scale,format=bgr0,drawvg=file=$(DRAWVG_SCRIPT_LINES)
-----------------------------------------------------------------------
Summary of changes:
tests/fate/filter-video.mak | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
hooks/post-receive
--
1
0
[ffmpeg] branch release/7.1 updated. c0e599e9d8 avfilter/vf_scale: don't attempt to rescale AV_NOPTS_VALUE
by ffmpeg-git@ffmpeg.org 28 Nov '25
by ffmpeg-git@ffmpeg.org 28 Nov '25
28 Nov '25
The branch, release/7.1 has been updated
via c0e599e9d83a80cf1002c62684ecd90ae8776efd (commit)
via 46293e9905f1bfd0e4576c7a5ac41a92cc6f4c4d (commit)
via 9403cdd6e86efa4992b9322436e07d76e32da66a (commit)
via a2a67282859904283f1008e1ce0a7f6bc1e71757 (commit)
from 9e3030bc440e07887b787ae4a5bf407ff8548c75 (commit)
- Log -----------------------------------------------------------------
commit c0e599e9d83a80cf1002c62684ecd90ae8776efd
Author: James Almer <jamrial(a)gmail.com>
AuthorDate: Wed Sep 24 20:31:26 2025 -0300
Commit: James Almer <jamrial(a)gmail.com>
CommitDate: Thu Nov 27 22:02:55 2025 -0300
avfilter/vf_scale: don't attempt to rescale AV_NOPTS_VALUE
Finishes fixing issue #20589.
Signed-off-by: James Almer <jamrial(a)gmail.com>
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 3319428d9c..420dc13dc5 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -1119,7 +1119,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
goto err;
av_assert0(out);
- out->pts = av_rescale_q(fs->pts, fs->time_base, outlink->time_base);
+ out->pts = av_rescale_q_rnd(fs->pts, fs->time_base, outlink->time_base, AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX);
return ff_filter_frame(outlink, out);
err:
commit 46293e9905f1bfd0e4576c7a5ac41a92cc6f4c4d
Author: James Almer <jamrial(a)gmail.com>
AuthorDate: Wed Sep 24 20:31:11 2025 -0300
Commit: James Almer <jamrial(a)gmail.com>
CommitDate: Thu Nov 27 22:02:43 2025 -0300
avfilter/framesync: don't attempt to rescale AV_NOPTS_VALUE
Part of a fix for issue #20589.
Signed-off-by: James Almer <jamrial(a)gmail.com>
diff --git a/libavfilter/framesync.c b/libavfilter/framesync.c
index 0d5779f830..846d1c7e50 100644
--- a/libavfilter/framesync.c
+++ b/libavfilter/framesync.c
@@ -248,7 +248,7 @@ static void framesync_inject_frame(FFFrameSync *fs, unsigned in, AVFrame *frame)
av_assert0(!fs->in[in].have_next);
av_assert0(frame);
- pts = av_rescale_q(frame->pts, fs->in[in].time_base, fs->time_base);
+ pts = av_rescale_q_rnd(frame->pts, fs->in[in].time_base, fs->time_base, AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX);
frame->pts = pts;
fs->in[in].frame_next = frame;
fs->in[in].pts_next = pts;
commit 9403cdd6e86efa4992b9322436e07d76e32da66a
Author: James Almer <jamrial(a)gmail.com>
AuthorDate: Tue Nov 25 12:42:30 2025 -0300
Commit: James Almer <jamrial(a)gmail.com>
CommitDate: Thu Nov 27 22:00:39 2025 -0300
avformat/iamf_parse: ensure the stream count in a scalable channel representation is equal to the audio element's stream count
Signed-off-by: James Almer <jamrial(a)gmail.com>
(cherry picked from commit faa382e5b196f2acb5bc5b159aaf06682291328b)
diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c
index b0a166ba1f..8ea9616ec7 100644
--- a/libavformat/iamf_parse.c
+++ b/libavformat/iamf_parse.c
@@ -414,6 +414,9 @@ static int scalable_channel_layout_config(void *s, AVIOContext *pb,
}
+ if (k != audio_element->nb_substreams)
+ return AVERROR_INVALIDDATA;
+
return 0;
}
commit a2a67282859904283f1008e1ce0a7f6bc1e71757
Author: James Almer <jamrial(a)gmail.com>
AuthorDate: Tue Nov 25 10:26:27 2025 -0300
Commit: James Almer <jamrial(a)gmail.com>
CommitDate: Thu Nov 27 22:00:30 2025 -0300
avformat/iamf_parse: ensure each layout in an scalable channel representation has an increasing number of channels
Fixes issue #21013
Signed-off-by: James Almer <jamrial(a)gmail.com>
(cherry picked from commit 554ae5ada98cd44686ade995102d3aa2295d7b09)
diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c
index a7a2b7deb5..b0a166ba1f 100644
--- a/libavformat/iamf_parse.c
+++ b/libavformat/iamf_parse.c
@@ -398,6 +398,9 @@ static int scalable_channel_layout_config(void *s, AVIOContext *pb,
.nb_channels = substream_count +
coupled_substream_count };
+ if (i && ch_layout.nb_channels <= audio_element->element->layers[i-1]->ch_layout.nb_channels)
+ return AVERROR_INVALIDDATA;
+
for (int j = 0; j < substream_count; j++) {
IAMFSubStream *substream = &audio_element->substreams[k++];
-----------------------------------------------------------------------
Summary of changes:
libavfilter/framesync.c | 2 +-
libavfilter/vf_scale.c | 2 +-
libavformat/iamf_parse.c | 6 ++++++
3 files changed, 8 insertions(+), 2 deletions(-)
hooks/post-receive
--
1
0
[ffmpeg] branch release/8.0 updated. fe72a8781b avformat/iamf_parse: ensure the stream count in a scalable channel representation is equal to the audio element's stream count
by ffmpeg-git@ffmpeg.org 28 Nov '25
by ffmpeg-git@ffmpeg.org 28 Nov '25
28 Nov '25
The branch, release/8.0 has been updated
via fe72a8781b22912ec7125de1509d83fc2b1ad802 (commit)
via b5996929df27276db37e075600988ebb17890eb4 (commit)
via 371d717601a3a4842e1182fab6503b0c05e93032 (commit)
via 1447aac2eb34cf887f720c7316d7adf4ab3dbe60 (commit)
from af737ace1ee93fef49fe201c851359b0bf1b989b (commit)
- Log -----------------------------------------------------------------
commit fe72a8781b22912ec7125de1509d83fc2b1ad802
Author: James Almer <jamrial(a)gmail.com>
AuthorDate: Tue Nov 25 12:42:30 2025 -0300
Commit: James Almer <jamrial(a)gmail.com>
CommitDate: Thu Nov 27 21:58:55 2025 -0300
avformat/iamf_parse: ensure the stream count in a scalable channel representation is equal to the audio element's stream count
Signed-off-by: James Almer <jamrial(a)gmail.com>
(cherry picked from commit faa382e5b196f2acb5bc5b159aaf06682291328b)
diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c
index 737e3f7404..597d800be0 100644
--- a/libavformat/iamf_parse.c
+++ b/libavformat/iamf_parse.c
@@ -480,6 +480,9 @@ static int scalable_channel_layout_config(void *s, AVIOContext *pb,
av_channel_layout_copy(&layer->ch_layout, &ch_layout);
}
+ if (k != audio_element->nb_substreams)
+ return AVERROR_INVALIDDATA;
+
return 0;
}
commit b5996929df27276db37e075600988ebb17890eb4
Author: James Almer <jamrial(a)gmail.com>
AuthorDate: Tue Nov 25 10:26:27 2025 -0300
Commit: James Almer <jamrial(a)gmail.com>
CommitDate: Thu Nov 27 21:58:42 2025 -0300
avformat/iamf_parse: ensure each layout in an scalable channel representation has an increasing number of channels
Fixes issue #21013
Signed-off-by: James Almer <jamrial(a)gmail.com>
(cherry picked from commit 554ae5ada98cd44686ade995102d3aa2295d7b09)
diff --git a/libavformat/iamf_parse.c b/libavformat/iamf_parse.c
index 50acd7cf5a..737e3f7404 100644
--- a/libavformat/iamf_parse.c
+++ b/libavformat/iamf_parse.c
@@ -406,6 +406,9 @@ static int scalable_channel_layout_config(void *s, AVIOContext *pb,
.nb_channels = substream_count +
coupled_substream_count };
+ if (i && ch_layout.nb_channels <= audio_element->element->layers[i-1]->ch_layout.nb_channels)
+ return AVERROR_INVALIDDATA;
+
for (int j = 0; j < substream_count; j++) {
IAMFSubStream *substream = &audio_element->substreams[k++];
commit 371d717601a3a4842e1182fab6503b0c05e93032
Author: James Almer <jamrial(a)gmail.com>
AuthorDate: Wed Sep 24 20:31:26 2025 -0300
Commit: James Almer <jamrial(a)gmail.com>
CommitDate: Thu Nov 27 21:57:42 2025 -0300
avfilter/vf_scale: don't attempt to rescale AV_NOPTS_VALUE
Finishes fixing issue #20589.
Signed-off-by: James Almer <jamrial(a)gmail.com>
(cherry picked from commit b9cc8e32109bba3daec1cfb6a834e45f72266b46)
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index aec765b441..6c1302f8ce 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -944,7 +944,7 @@ static int do_scale(FFFrameSync *fs)
goto err;
av_assert0(out);
- out->pts = av_rescale_q(fs->pts, fs->time_base, outlink->time_base);
+ out->pts = av_rescale_q_rnd(fs->pts, fs->time_base, outlink->time_base, AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX);
return ff_filter_frame(outlink, out);
err:
commit 1447aac2eb34cf887f720c7316d7adf4ab3dbe60
Author: James Almer <jamrial(a)gmail.com>
AuthorDate: Wed Sep 24 20:31:11 2025 -0300
Commit: James Almer <jamrial(a)gmail.com>
CommitDate: Thu Nov 27 21:57:42 2025 -0300
avfilter/framesync: don't attempt to rescale AV_NOPTS_VALUE
Part of a fix for issue #20589.
Signed-off-by: James Almer <jamrial(a)gmail.com>
(cherry picked from commit 5614672d1bed49557f234639f7eeaf3b9c0385fe)
diff --git a/libavfilter/framesync.c b/libavfilter/framesync.c
index 0d5779f830..846d1c7e50 100644
--- a/libavfilter/framesync.c
+++ b/libavfilter/framesync.c
@@ -248,7 +248,7 @@ static void framesync_inject_frame(FFFrameSync *fs, unsigned in, AVFrame *frame)
av_assert0(!fs->in[in].have_next);
av_assert0(frame);
- pts = av_rescale_q(frame->pts, fs->in[in].time_base, fs->time_base);
+ pts = av_rescale_q_rnd(frame->pts, fs->in[in].time_base, fs->time_base, AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX);
frame->pts = pts;
fs->in[in].frame_next = frame;
fs->in[in].pts_next = pts;
-----------------------------------------------------------------------
Summary of changes:
libavfilter/framesync.c | 2 +-
libavfilter/vf_scale.c | 2 +-
libavformat/iamf_parse.c | 6 ++++++
3 files changed, 8 insertions(+), 2 deletions(-)
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. 3d96d83a0a avformat/rawdec: set framerate in codec parameters
by ffmpeg-git@ffmpeg.org 28 Nov '25
by ffmpeg-git@ffmpeg.org 28 Nov '25
28 Nov '25
The branch, master has been updated
via 3d96d83a0a009a3bf566b208b14a7d264f17263b (commit)
via 69534d4e7e1986c99caed7863de42af9eda90f8f (commit)
from 75b85675916337bc0993f02a70279b96e5903153 (commit)
- Log -----------------------------------------------------------------
commit 3d96d83a0a009a3bf566b208b14a7d264f17263b
Author: Gavin Li <gfl3162(a)gmail.com>
AuthorDate: Sun Jan 26 22:54:06 2025 -0500
Commit: James Almer <jamrial(a)gmail.com>
CommitDate: Thu Nov 27 20:01:54 2025 -0300
avformat/rawdec: set framerate in codec parameters
Commit ba4b73c9779c32580f8a3ba08602a5d94e0bcd7c caused a regression in
the usage of avg_frame_rate to detect the frame rate of raw h264/hevc
bitstreams: after the commit, avg_frame_rate is always the value of the
-framerate option (which is set to 25 by default) instead of the actual
frame rate derived from the bitstream SPS/VPS NALUs.
This commit fixes the regression by setting the framerate codec
parameter to the value of the framerate option instead. After this
change, bitstreams without timing information will derive avg_frame_rate
from the -framerate option, while bitstreams with timing information
will derive avg_frame_rate from the bitstream itself.
The h264-bsf-dts2pts test now returns the correct frame durations for a
bitstream with a mix of single-field and double-field frames.
Signed-off-by: Gavin Li <git(a)thegavinli.com>
Signed-off-by: James Almer <jamrial(a)gmail.com>
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index d0c829dc42..5cf2764a0d 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -83,9 +83,9 @@ int ff_raw_video_read_header(AVFormatContext *s)
st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
st->codecpar->codec_id = ffifmt(s->iformat)->raw_codec_id;
+ st->codecpar->framerate = s1->framerate;
sti->need_parsing = AVSTREAM_PARSE_FULL_RAW;
- st->avg_frame_rate = s1->framerate;
avpriv_set_pts_info(st, 64, 1, 1200000);
fail:
diff --git a/tests/ref/fate/cavs-demux b/tests/ref/fate/cavs-demux
index c4847293ab..eb16eb1f9d 100644
--- a/tests/ref/fate/cavs-demux
+++ b/tests/ref/fate/cavs-demux
@@ -58,5 +58,5 @@ packet|codec_type=video|stream_index=0|pts=2240000|pts_time=1.866667|dts=2240000
packet|codec_type=video|stream_index=0|pts=2280000|pts_time=1.900000|dts=2280000|dts_time=1.900000|duration=40000|duration_time=0.033333|size=67|pos=172185|flags=___|data_hash=CRC32:42484449
packet|codec_type=video|stream_index=0|pts=2320000|pts_time=1.933333|dts=2320000|dts_time=1.933333|duration=40000|duration_time=0.033333|size=83|pos=172252|flags=___|data_hash=CRC32:a941bdf0
packet|codec_type=video|stream_index=0|pts=2360000|pts_time=1.966667|dts=2360000|dts_time=1.966667|duration=40000|duration_time=0.033333|size=5417|pos=172335|flags=___|data_hash=CRC32:9d0d503b
-stream|index=0|codec_name=cavs|profile=unknown|codec_type=video|codec_tag_string=[0][0][0][0]|codec_tag=0x0000|width=1280|height=720|coded_width=1280|coded_height=720|has_b_frames=0|sample_aspect_ratio=N/A|display_aspect_ratio=N/A|pix_fmt=yuv420p|level=-99|color_range=unknown|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=unspecified|field_order=unknown|refs=1|id=N/A|r_frame_rate=30/1|avg_frame_rate=25/1|time_base=1/1200000|start_pts=N/A|start_time=N/A|duration_ts=N/A|duration=N/A|bit_rate=N/A|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=60|extradata_size=18|extradata_hash=CRC32:1255d52e|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:non_diegetic=
0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|disposition:multilayer=0
+stream|index=0|codec_name=cavs|profile=unknown|codec_type=video|codec_tag_string=[0][0][0][0]|codec_tag=0x0000|width=1280|height=720|coded_width=1280|coded_height=720|has_b_frames=0|sample_aspect_ratio=N/A|display_aspect_ratio=N/A|pix_fmt=yuv420p|level=-99|color_range=unknown|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=unspecified|field_order=unknown|refs=1|id=N/A|r_frame_rate=30/1|avg_frame_rate=30/1|time_base=1/1200000|start_pts=N/A|start_time=N/A|duration_ts=N/A|duration=N/A|bit_rate=N/A|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=60|extradata_size=18|extradata_hash=CRC32:1255d52e|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:non_diegetic=
0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|disposition:multilayer=0
format|filename=bunny.mp4|nb_streams=1|nb_programs=0|nb_stream_groups=0|format_name=cavsvideo|start_time=N/A|duration=N/A|size=177752|bit_rate=N/A|probe_score=51
diff --git a/tests/ref/fate/enhanced-flv-hevc-hdr10 b/tests/ref/fate/enhanced-flv-hevc-hdr10
index 525f056d66..bebcf84fab 100644
--- a/tests/ref/fate/enhanced-flv-hevc-hdr10
+++ b/tests/ref/fate/enhanced-flv-hevc-hdr10
@@ -4,7 +4,7 @@
#codec_id 0: hevc
#dimensions 0: 1280x720
#sar 0: 0/1
-0, 0, 0, 40, 77718, 0xb59c83a5
+0, 0, 0, 0, 77718, 0xb59c83a5
[FRAME]
media_type=video
stream_index=0
@@ -17,7 +17,7 @@ best_effort_timestamp=0
best_effort_timestamp_time=0.000000
duration=N/A
duration_time=N/A
-pkt_pos=459
+pkt_pos=439
pkt_size=77718
width=1280
height=720
diff --git a/tests/ref/fate/h264-bsf-dts2pts b/tests/ref/fate/h264-bsf-dts2pts
index f908bb44f5..46c640eab8 100644
--- a/tests/ref/fate/h264-bsf-dts2pts
+++ b/tests/ref/fate/h264-bsf-dts2pts
@@ -1,5 +1,5 @@
-219edd347ce3151f5b5579d300cd7179 *tests/data/fate/h264-bsf-dts2pts.mov
-243937 tests/data/fate/h264-bsf-dts2pts.mov
+451601038b9091014e45660bc98e09dc *tests/data/fate/h264-bsf-dts2pts.mov
+244033 tests/data/fate/h264-bsf-dts2pts.mov
#extradata 0: 26, 0x75e2093d
#tb 0: 1/1200000
#media_type 0: video
@@ -7,52 +7,52 @@
#dimensions 0: 352x288
#sar 0: 0/1
0, -48000, 0, 48000, 13686, 0x5ee9bd4c
-0, 0, 240000, 48000, 9320, 0x17224db1, F=0x0
-0, 48000, 288000, 48000, 8903, 0xe394918b, F=0x0
-0, 96000, 96000, 48000, 10108, 0x98418e7e, F=0x0
-0, 144000, 144000, 48000, 2937, 0x49dccb76, F=0x0
-0, 192000, 192000, 48000, 2604, 0xfc8013cd, F=0x0
-0, 240000, 480000, 48000, 7420, 0xcb4155cd, F=0x0
-0, 288000, 528000, 48000, 5664, 0x060bc948, F=0x0
-0, 336000, 336000, 48000, 4859, 0x0a5a8368, F=0x0
-0, 384000, 384000, 48000, 2883, 0xb9639a19, F=0x0
-0, 432000, 432000, 48000, 2547, 0xba95e99d, F=0x0
-0, 480000, 672000, 48000, 4659, 0x19203a0d, F=0x0
-0, 528000, 696000, 48000, 9719, 0xb500c328, F=0x0
-0, 576000, 576000, 48000, 5078, 0x5359c6b8, F=0x0
-0, 624000, 624000, 48000, 5041, 0x88dfcdf1, F=0x0
-0, 672000, 864000, 48000, 9494, 0x29297319, F=0x0
-0, 720000, 720000, 48000, 4772, 0x80273a60, F=0x0
-0, 768000, 768000, 48000, 3237, 0xd99e742c, F=0x0
-0, 816000, 816000, 48000, 2650, 0xc7cc378a, F=0x0
-0, 864000, 1152000, 48000, 6519, 0x142aa357, F=0x0
-0, 912000, 1176000, 48000, 5878, 0xe70d7e21, F=0x0
-0, 960000, 960000, 48000, 2648, 0xe58b1c4b, F=0x0
-0, 1008000, 1008000, 48000, 4522, 0x33ad0882, F=0x0
-0, 1056000, 1056000, 48000, 3246, 0xdbfa539f, F=0x0
-0, 1104000, 1104000, 48000, 3027, 0xdb5bf675, F=0x0
-0, 1152000, 1392000, 48000, 9282, 0x07973603, F=0x0
-0, 1200000, 1200000, 48000, 2786, 0x14824d92, F=0x0
-0, 1248000, 1248000, 48000, 2719, 0x00614eef, F=0x0
-0, 1296000, 1296000, 48000, 2627, 0xe8e91216, F=0x0
-0, 1344000, 1344000, 48000, 2720, 0xbe974fcc, F=0x0
-0, 1392000, 1584000, 48000, 7687, 0x0de01895, F=0x0
-0, 1440000, 1440000, 48000, 5464, 0x113f954d, F=0x0
-0, 1488000, 1488000, 48000, 3482, 0x5c90cdae, F=0x0
-0, 1536000, 1536000, 48000, 2791, 0x4acb702a, F=0x0
-0, 1584000, 1872000, 48000, 11362, 0x13363bdb, F=0x0
-0, 1632000, 1920000, 48000, 2975, 0x99b1e813, F=0x0
-0, 1680000, 1680000, 48000, 2342, 0xe9587867, F=0x0
-0, 1728000, 1728000, 48000, 2634, 0x8d9814fc, F=0x0
-0, 1776000, 1776000, 48000, 2419, 0x033cbb5f, F=0x0
-0, 1824000, 1824000, 48000, 2498, 0x7dd9e476, F=0x0
-0, 1872000, 2112000, 48000, 2668, 0x358e2bd8, F=0x0
-0, 1920000, 2136000, 48000, 9068, 0x3a639927, F=0x0
-0, 1968000, 1968000, 48000, 4939, 0xa5309a8c, F=0x0
-0, 2016000, 2016000, 48000, 2650, 0x2ab82b97, F=0x0
-0, 2064000, 2064000, 48000, 2503, 0xfd97cd4c, F=0x0
-0, 2112000, 2352000, 48000, 5121, 0xaf88e5b8, F=0x0
-0, 2160000, 2160000, 48000, 2643, 0xa1791db0, F=0x0
-0, 2208000, 2208000, 48000, 2637, 0xe1a42510, F=0x0
-0, 2256000, 2256000, 48000, 2633, 0x08430f15, F=0x0
-0, 2304000, 2304000, 48000, 2721, 0xe6756990, F=0x0
+0, 0, 144000, 24000, 9320, 0x17224db1, F=0x0
+0, 24000, 168000, 24000, 8903, 0xe394918b, F=0x0
+0, 48000, 48000, 48000, 10108, 0x98418e7e, F=0x0
+0, 96000, 96000, 24000, 2937, 0x49dccb76, F=0x0
+0, 120000, 120000, 24000, 2604, 0xfc8013cd, F=0x0
+0, 144000, 288000, 24000, 7420, 0xcb4155cd, F=0x0
+0, 168000, 312000, 24000, 5664, 0x060bc948, F=0x0
+0, 192000, 192000, 48000, 4859, 0x0a5a8368, F=0x0
+0, 240000, 240000, 24000, 2883, 0xb9639a19, F=0x0
+0, 264000, 264000, 24000, 2547, 0xba95e99d, F=0x0
+0, 288000, 432000, 24000, 4659, 0x19203a0d, F=0x0
+0, 312000, 456000, 24000, 9719, 0xb500c328, F=0x0
+0, 336000, 336000, 48000, 5078, 0x5359c6b8, F=0x0
+0, 384000, 384000, 48000, 5041, 0x88dfcdf1, F=0x0
+0, 432000, 576000, 48000, 9494, 0x29297319, F=0x0
+0, 480000, 480000, 48000, 4772, 0x80273a60, F=0x0
+0, 528000, 528000, 24000, 3237, 0xd99e742c, F=0x0
+0, 552000, 552000, 24000, 2650, 0xc7cc378a, F=0x0
+0, 576000, 720000, 24000, 6519, 0x142aa357, F=0x0
+0, 600000, 744000, 24000, 5878, 0xe70d7e21, F=0x0
+0, 624000, 624000, 24000, 2648, 0xe58b1c4b, F=0x0
+0, 648000, 648000, 24000, 4522, 0x33ad0882, F=0x0
+0, 672000, 672000, 24000, 3246, 0xdbfa539f, F=0x0
+0, 696000, 696000, 24000, 3027, 0xdb5bf675, F=0x0
+0, 720000, 864000, 48000, 9282, 0x07973603, F=0x0
+0, 768000, 768000, 24000, 2786, 0x14824d92, F=0x0
+0, 792000, 792000, 24000, 2719, 0x00614eef, F=0x0
+0, 816000, 816000, 24000, 2627, 0xe8e91216, F=0x0
+0, 840000, 840000, 24000, 2720, 0xbe974fcc, F=0x0
+0, 864000, 1008000, 48000, 7687, 0x0de01895, F=0x0
+0, 912000, 912000, 48000, 5464, 0x113f954d, F=0x0
+0, 960000, 960000, 24000, 3482, 0x5c90cdae, F=0x0
+0, 984000, 984000, 24000, 2791, 0x4acb702a, F=0x0
+0, 1008000, 1152000, 24000, 11362, 0x13363bdb, F=0x0
+0, 1032000, 1176000, 24000, 2975, 0x99b1e813, F=0x0
+0, 1056000, 1056000, 24000, 2342, 0xe9587867, F=0x0
+0, 1080000, 1080000, 24000, 2634, 0x8d9814fc, F=0x0
+0, 1104000, 1104000, 24000, 2419, 0x033cbb5f, F=0x0
+0, 1128000, 1128000, 24000, 2498, 0x7dd9e476, F=0x0
+0, 1152000, 1296000, 24000, 2668, 0x358e2bd8, F=0x0
+0, 1176000, 1320000, 24000, 9068, 0x3a639927, F=0x0
+0, 1200000, 1200000, 48000, 4939, 0xa5309a8c, F=0x0
+0, 1248000, 1248000, 24000, 2650, 0x2ab82b97, F=0x0
+0, 1272000, 1272000, 24000, 2503, 0xfd97cd4c, F=0x0
+0, 1296000, 1440000, 48000, 5121, 0xaf88e5b8, F=0x0
+0, 1344000, 1344000, 24000, 2643, 0xa1791db0, F=0x0
+0, 1368000, 1368000, 24000, 2637, 0xe1a42510, F=0x0
+0, 1392000, 1392000, 24000, 2633, 0x08430f15, F=0x0
+0, 1416000, 1416000, 24000, 2721, 0xe6756990, F=0x0
diff --git a/tests/ref/fate/h264-conformance-cvpcmnl2_sva_c b/tests/ref/fate/h264-conformance-cvpcmnl2_sva_c
index 0303bc24e6..0a0795df41 100644
--- a/tests/ref/fate/h264-conformance-cvpcmnl2_sva_c
+++ b/tests/ref/fate/h264-conformance-cvpcmnl2_sva_c
@@ -1,7 +1,7 @@
-#tb 0: 1/25
+#tb 0: 1/50
#media_type 0: video
#codec_id 0: rawvideo
#dimensions 0: 1280x720
#sar 0: 0/1
-0, 0, 0, 1, 1382400, 0xccbe6bf8
-0, 1, 1, 1, 1382400, 0x49c0cfd7
+0, 0, 0, 2, 1382400, 0xccbe6bf8
+0, 2, 2, 2, 1382400, 0x49c0cfd7
diff --git a/tests/ref/fate/hevc-bsf-dts2pts-cra b/tests/ref/fate/hevc-bsf-dts2pts-cra
index 4e9e2c5114..e50aad6f70 100644
--- a/tests/ref/fate/hevc-bsf-dts2pts-cra
+++ b/tests/ref/fate/hevc-bsf-dts2pts-cra
@@ -1,5 +1,5 @@
-c3c00fdc637a19fa3d23d37d9974d28d *tests/data/fate/hevc-bsf-dts2pts-cra.mov
-103067 tests/data/fate/hevc-bsf-dts2pts-cra.mov
+f6102684fbf13aa624e6edece38c83f2 *tests/data/fate/hevc-bsf-dts2pts-cra.mov
+102971 tests/data/fate/hevc-bsf-dts2pts-cra.mov
#extradata 0: 118, 0x25f51994
#tb 0: 1/1200000
#media_type 0: video
@@ -54,35 +54,35 @@ c3c00fdc637a19fa3d23d37d9974d28d *tests/data/fate/hevc-bsf-dts2pts-cra.mov
0, 2016000, 2160000, 48000, 892, 0x0d2ab3bc, F=0x0
0, 2064000, 2112000, 48000, 238, 0x45827561, F=0x0
0, 2112000, 2208000, 48000, 281, 0x2a3a8e61, F=0x0
-0, 2160000, 2256010, 48000, 4629, 0xf2e0fb0f, F=0x0
-0, 2208000, 2256005, 48000, 1453, 0x6ae5dc98, F=0x0
-0, 2256000, 2256002, 1, 869, 0x3982ae69, F=0x0
-0, 2256001, 2256001, 1, 282, 0xd9e28960, F=0x0
-0, 2256002, 2256004, 2, 259, 0x253a809d, F=0x0
-0, 2256004, 2256007, 1, 835, 0x83499f30, F=0x0
-0, 2256005, 2256006, 1, 255, 0xa77b7690, F=0x0
-0, 2256006, 2256008, 1, 242, 0x83977ccf, F=0x0
-0, 2256007, 2256019, 1, 5082, 0xba55ee51, F=0x0
-0, 2256008, 2256014, 2, 1393, 0xc998b442, F=0x0
-0, 2256010, 2256012, 1, 742, 0x91ab75d2, F=0x0
-0, 2256011, 2256011, 1, 229, 0xfa326d98, F=0x0
-0, 2256012, 2256013, 1, 275, 0x49c38226, F=0x0
-0, 2256013, 2256017, 1, 869, 0xdd05acc4, F=0x0
-0, 2256014, 2256016, 2, 293, 0xcc9e904f, F=0x0
-0, 2256016, 2256018, 1, 334, 0x212aa4b1, F=0x0
-0, 2256017, 2256029, 1, 8539, 0xcccc9eb1
-0, 2256018, 2256024, 1, 1593, 0x5a351a68, F=0x0
-0, 2256019, 2256022, 1, 1042, 0xb77d00cc, F=0x0
-0, 2256020, 2256020, 2, 302, 0xbcdb9750, F=0x0
-0, 2256022, 2256023, 1, 336, 0xc7b0a55d, F=0x0
-0, 2256023, 2256026, 1, 875, 0x7e31b046, F=0x0
-0, 2256024, 2256025, 1, 401, 0xb473bca8, F=0x0
-0, 2256025, 2256028, 1, 246, 0x43357263, F=0x0
-0, 2256026, 2256038, 2, 3254, 0x8be44a2d, F=0x0
-0, 2256028, 2256034, 1, 1151, 0x29d52d14, F=0x0
-0, 2256029, 2256031, 1, 733, 0x33606982, F=0x0
-0, 2256030, 2256030, 1, 234, 0xb70a79ff, F=0x0
-0, 2256031, 2256032, 1, 228, 0x86916848, F=0x0
-0, 2256032, 2256036, 2, 689, 0xcca34b40, F=0x0
-0, 2256034, 2256035, 1, 223, 0xa96f6e31, F=0x0
-0, 2256035, 2256037, 1, 241, 0x7ac17531, F=0x0
+0, 2160000, 2640000, 48000, 4629, 0xf2e0fb0f, F=0x0
+0, 2208000, 2448000, 48000, 1453, 0x6ae5dc98, F=0x0
+0, 2256000, 2352000, 48000, 869, 0x3982ae69, F=0x0
+0, 2304000, 2304000, 48000, 282, 0xd9e28960, F=0x0
+0, 2352000, 2400000, 48000, 259, 0x253a809d, F=0x0
+0, 2400000, 2544000, 48000, 835, 0x83499f30, F=0x0
+0, 2448000, 2496000, 48000, 255, 0xa77b7690, F=0x0
+0, 2496000, 2592000, 48000, 242, 0x83977ccf, F=0x0
+0, 2544000, 3024000, 48000, 5082, 0xba55ee51, F=0x0
+0, 2592000, 2832000, 48000, 1393, 0xc998b442, F=0x0
+0, 2640000, 2736000, 48000, 742, 0x91ab75d2, F=0x0
+0, 2688000, 2688000, 48000, 229, 0xfa326d98, F=0x0
+0, 2736000, 2784000, 48000, 275, 0x49c38226, F=0x0
+0, 2784000, 2928000, 48000, 869, 0xdd05acc4, F=0x0
+0, 2832000, 2880000, 48000, 293, 0xcc9e904f, F=0x0
+0, 2880000, 2976000, 48000, 334, 0x212aa4b1, F=0x0
+0, 2928000, 3408000, 48000, 8539, 0xcccc9eb1
+0, 2976000, 3216000, 48000, 1593, 0x5a351a68, F=0x0
+0, 3024000, 3120000, 48000, 1042, 0xb77d00cc, F=0x0
+0, 3072000, 3072000, 48000, 302, 0xbcdb9750, F=0x0
+0, 3120000, 3168000, 48000, 336, 0xc7b0a55d, F=0x0
+0, 3168000, 3312000, 48000, 875, 0x7e31b046, F=0x0
+0, 3216000, 3264000, 48000, 401, 0xb473bca8, F=0x0
+0, 3264000, 3360000, 48000, 246, 0x43357263, F=0x0
+0, 3312000, 3792000, 48000, 3254, 0x8be44a2d, F=0x0
+0, 3360000, 3600000, 48000, 1151, 0x29d52d14, F=0x0
+0, 3408000, 3504000, 48000, 733, 0x33606982, F=0x0
+0, 3456000, 3456000, 48000, 234, 0xb70a79ff, F=0x0
+0, 3504000, 3552000, 48000, 228, 0x86916848, F=0x0
+0, 3552000, 3696000, 48000, 689, 0xcca34b40, F=0x0
+0, 3600000, 3648000, 48000, 223, 0xa96f6e31, F=0x0
+0, 3648000, 3744000, 48000, 241, 0x7ac17531, F=0x0
diff --git a/tests/ref/fate/hevc-bsf-dts2pts-idr b/tests/ref/fate/hevc-bsf-dts2pts-idr
index 9568a5932c..adfbe75987 100644
--- a/tests/ref/fate/hevc-bsf-dts2pts-idr
+++ b/tests/ref/fate/hevc-bsf-dts2pts-idr
@@ -1,5 +1,5 @@
-368d177821450241820bf3507d74b35a *tests/data/fate/hevc-bsf-dts2pts-idr.mov
-346603 tests/data/fate/hevc-bsf-dts2pts-idr.mov
+8f02d31fece6a067a8488d8ca6ee3329 *tests/data/fate/hevc-bsf-dts2pts-idr.mov
+346579 tests/data/fate/hevc-bsf-dts2pts-idr.mov
#extradata 0: 699, 0x9c810c10
#tb 0: 1/1200000
#media_type 0: video
@@ -47,7 +47,7 @@
0, 1680000, 1824000, 48000, 2208, 0x8e2146e8, F=0x0
0, 1728000, 1776000, 48000, 900, 0x669fb97b, F=0x0
0, 1776000, 1872000, 48000, 817, 0x3eb689e1, F=0x0
-0, 1824000, 2256001, 48000, 17919, 0x4e83b301, F=0x0
+0, 1824000, 2304000, 48000, 17919, 0x4e83b301, F=0x0
0, 1872000, 2112000, 48000, 4911, 0x2fc88e1f, F=0x0
0, 1920000, 2016000, 48000, 2717, 0xcc1f551e, F=0x0
0, 1968000, 1968000, 48000, 908, 0x43e1b421, F=0x0
@@ -55,19 +55,19 @@
0, 2064000, 2208000, 48000, 2857, 0xdeee9614, F=0x0
0, 2112000, 2160000, 48000, 1039, 0x9cf8f494, F=0x0
0, 2160000, 2256000, 48000, 975, 0x0f4ec85b, F=0x0
-0, 2208000, 2256011, 48000, 18345, 0xf9dabd3b, F=0x0
-0, 2256000, 2256006, 1, 5280, 0xc5c33809, F=0x0
-0, 2256001, 2256004, 1, 2755, 0xda955c75, F=0x0
-0, 2256002, 2256002, 2, 1027, 0xf652eff3, F=0x0
-0, 2256004, 2256005, 1, 901, 0xe23cb716, F=0x0
-0, 2256005, 2256008, 1, 3010, 0x783de5cb, F=0x0
-0, 2256006, 2256007, 1, 1005, 0x91fcf92f, F=0x0
-0, 2256007, 2256010, 1, 1131, 0xd88b2920, F=0x0
-0, 2256008, 2256008, 2, 29018, 0xc9b25608
-0, 2256010, 2256016, 1, 7436, 0x18344e77, F=0x0
-0, 2256011, 2256013, 1, 4050, 0x54fcbee0, F=0x0
-0, 2256012, 2256012, 1, 1412, 0xe249bd86, F=0x0
-0, 2256013, 2256014, 1, 977, 0xa749dc21, F=0x0
-0, 2256014, 2256014, 2, 2953, 0xba90c008, F=0x0
-0, 2256016, 2256017, 1, 1004, 0xddebea9a, F=0x0
-0, 2256017, 2256017, 1, 1109, 0x7e081570, F=0x0
+0, 2208000, 2688000, 48000, 18345, 0xf9dabd3b, F=0x0
+0, 2256000, 2496000, 48000, 5280, 0xc5c33809, F=0x0
+0, 2304000, 2400000, 48000, 2755, 0xda955c75, F=0x0
+0, 2352000, 2352000, 48000, 1027, 0xf652eff3, F=0x0
+0, 2400000, 2448000, 48000, 901, 0xe23cb716, F=0x0
+0, 2448000, 2592000, 48000, 3010, 0x783de5cb, F=0x0
+0, 2496000, 2544000, 48000, 1005, 0x91fcf92f, F=0x0
+0, 2544000, 2640000, 48000, 1131, 0xd88b2920, F=0x0
+0, 2592000, 2592000, 48000, 29018, 0xc9b25608
+0, 2640000, 2880000, 48000, 7436, 0x18344e77, F=0x0
+0, 2688000, 2784000, 48000, 4050, 0x54fcbee0, F=0x0
+0, 2736000, 2736000, 48000, 1412, 0xe249bd86, F=0x0
+0, 2784000, 2832000, 1, 977, 0xa749dc21, F=0x0
+0, 2784001, 2784001, 95999, 2953, 0xba90c008, F=0x0
+0, 2880000, 2928000, 1, 1004, 0xddebea9a, F=0x0
+0, 2880001, 2880001, 48000, 1109, 0x7e081570, F=0x0
diff --git a/tests/ref/fate/hevc-bsf-dts2pts-idr-cra b/tests/ref/fate/hevc-bsf-dts2pts-idr-cra
index 02e9765a26..b12f02581f 100644
--- a/tests/ref/fate/hevc-bsf-dts2pts-idr-cra
+++ b/tests/ref/fate/hevc-bsf-dts2pts-idr-cra
@@ -1,5 +1,5 @@
-07a216d6537502705348fea392d5d73d *tests/data/fate/hevc-bsf-dts2pts-idr-cra.mov
-375266 tests/data/fate/hevc-bsf-dts2pts-idr-cra.mov
+ed8d735b9a2780ce8ada61fd31c68886 *tests/data/fate/hevc-bsf-dts2pts-idr-cra.mov
+375210 tests/data/fate/hevc-bsf-dts2pts-idr-cra.mov
#extradata 0: 648, 0x30a7fa5c
#tb 0: 1/1200000
#media_type 0: video
@@ -47,7 +47,7 @@
0, 1680000, 1824000, 48000, 2674, 0x296fd411, F=0x0
0, 1728000, 1776000, 48000, 1420, 0x304d6168, F=0x0
0, 1776000, 1872000, 48000, 1364, 0x48734084, F=0x0
-0, 1824000, 2256001, 48000, 19349, 0xda0944f0, F=0x0
+0, 1824000, 2304000, 48000, 19349, 0xda0944f0, F=0x0
0, 1872000, 2112000, 48000, 5550, 0x9c346b7b, F=0x0
0, 1920000, 2016000, 48000, 3180, 0x5368f72b, F=0x0
0, 1968000, 1968000, 48000, 1475, 0x369b7aae, F=0x0
@@ -55,19 +55,19 @@
0, 2064000, 2208000, 48000, 3365, 0x81d511a6, F=0x0
0, 2112000, 2160000, 48000, 1575, 0xba81b0a5, F=0x0
0, 2160000, 2256000, 48000, 1538, 0xf1199439, F=0x0
-0, 2208000, 2256011, 48000, 20138, 0x101fb220, F=0x0
-0, 2256000, 2256006, 1, 5806, 0xcc500158, F=0x0
-0, 2256001, 2256004, 1, 3267, 0xf8f0d6cd, F=0x0
-0, 2256002, 2256002, 2, 1557, 0x894faf3e, F=0x0
-0, 2256004, 2256005, 1, 1482, 0x6b1884b7, F=0x0
-0, 2256005, 2256008, 1, 3513, 0x81227a59, F=0x0
-0, 2256006, 2256007, 1, 1576, 0x855eabd8, F=0x0
-0, 2256007, 2256010, 1, 1668, 0x030ade2e, F=0x0
-0, 2256008, 2256008, 2, 32088, 0xfadbf5f6
-0, 2256010, 2256016, 1, 5921, 0x21fb4976, F=0x0
-0, 2256011, 2256013, 1, 3436, 0x92085cd6, F=0x0
-0, 2256012, 2256012, 1, 1613, 0x1e0cb7c6, F=0x0
-0, 2256013, 2256014, 1, 1483, 0x88d18a4e, F=0x0
-0, 2256014, 2256018, 2, 3540, 0xc57c8e7b, F=0x0
-0, 2256016, 2256017, 1, 1561, 0x9740a363, F=0x0
-0, 2256017, 2256019, 1, 1651, 0x18e3d52d, F=0x0
+0, 2208000, 2688000, 48000, 20138, 0x101fb220, F=0x0
+0, 2256000, 2496000, 48000, 5806, 0xcc500158, F=0x0
+0, 2304000, 2400000, 48000, 3267, 0xf8f0d6cd, F=0x0
+0, 2352000, 2352000, 48000, 1557, 0x894faf3e, F=0x0
+0, 2400000, 2448000, 48000, 1482, 0x6b1884b7, F=0x0
+0, 2448000, 2592000, 48000, 3513, 0x81227a59, F=0x0
+0, 2496000, 2544000, 48000, 1576, 0x855eabd8, F=0x0
+0, 2544000, 2640000, 48000, 1668, 0x030ade2e, F=0x0
+0, 2592000, 2592000, 48000, 32088, 0xfadbf5f6
+0, 2640000, 2880000, 48000, 5921, 0x21fb4976, F=0x0
+0, 2688000, 2784000, 48000, 3436, 0x92085cd6, F=0x0
+0, 2736000, 2736000, 48000, 1613, 0x1e0cb7c6, F=0x0
+0, 2784000, 2832000, 48000, 1483, 0x88d18a4e, F=0x0
+0, 2832000, 2976000, 48000, 3540, 0xc57c8e7b, F=0x0
+0, 2880000, 2928000, 48000, 1561, 0x9740a363, F=0x0
+0, 2928000, 3024000, 48000, 1651, 0x18e3d52d, F=0x0
diff --git a/tests/ref/lavf-fate/hevc.mp4 b/tests/ref/lavf-fate/hevc.mp4
index aea5ae8979..39dddd49cb 100644
--- a/tests/ref/lavf-fate/hevc.mp4
+++ b/tests/ref/lavf-fate/hevc.mp4
@@ -1,3 +1,3 @@
-37b3a3e84df2350380b05b2af4dc97f5 *tests/data/lavf-fate/lavf.hevc.mp4
+539b0f6daece6656609de0898a1f3d42 *tests/data/lavf-fate/lavf.hevc.mp4
151340 tests/data/lavf-fate/lavf.hevc.mp4
tests/data/lavf-fate/lavf.hevc.mp4 CRC=0xc0a771de
commit 69534d4e7e1986c99caed7863de42af9eda90f8f
Author: James Almer <jamrial(a)gmail.com>
AuthorDate: Tue Nov 25 18:55:35 2025 -0300
Commit: James Almer <jamrial(a)gmail.com>
CommitDate: Thu Nov 27 20:01:54 2025 -0300
avcodec/cavs_parser: parse sequence headers for stream parameters
Signed-off-by: James Almer <jamrial(a)gmail.com>
diff --git a/libavcodec/cavs_parser.c b/libavcodec/cavs_parser.c
index 13fbd009c8..882840cd7f 100644
--- a/libavcodec/cavs_parser.c
+++ b/libavcodec/cavs_parser.c
@@ -27,7 +27,10 @@
#include "parser.h"
#include "cavs.h"
+#include "get_bits.h"
+#include "mpeg12data.h"
#include "parser_internal.h"
+#include "startcode.h"
/**
@@ -73,6 +76,85 @@ static int cavs_find_frame_end(ParseContext *pc, const uint8_t *buf,
return END_NOT_FOUND;
}
+static int parse_seq_header(AVCodecParserContext *s, AVCodecContext *avctx,
+ GetBitContext *gb)
+{
+ int frame_rate_code;
+ int width, height;
+ int mb_width, mb_height;
+
+ skip_bits(gb, 8); // profile
+ skip_bits(gb, 8); // level
+ skip_bits1(gb); // progressive sequence
+
+ width = get_bits(gb, 14);
+ height = get_bits(gb, 14);
+ if (width <= 0 || height <= 0) {
+ av_log(avctx, AV_LOG_ERROR, "Dimensions invalid\n");
+ return AVERROR_INVALIDDATA;
+ }
+ mb_width = (width + 15) >> 4;
+ mb_height = (height + 15) >> 4;
+
+ skip_bits(gb, 2); // chroma format
+ skip_bits(gb, 3); // sample_precision
+ skip_bits(gb, 4); // aspect_ratio
+ frame_rate_code = get_bits(gb, 4);
+ if (frame_rate_code == 0 || frame_rate_code > 13) {
+ av_log(avctx, AV_LOG_WARNING,
+ "frame_rate_code %d is invalid\n", frame_rate_code);
+ frame_rate_code = 1;
+ }
+
+ skip_bits(gb, 18); // bit_rate_lower
+ skip_bits1(gb); // marker_bit
+ skip_bits(gb, 12); // bit_rate_upper
+ skip_bits1(gb); // low_delay
+
+ s->width = width;
+ s->height = height;
+ s->coded_width = 16 * mb_width;
+ s->coded_height = 16 * mb_height;
+ avctx->framerate = ff_mpeg12_frame_rate_tab[frame_rate_code];
+
+ return 0;
+}
+
+static int cavs_parse_frame(AVCodecParserContext *s, AVCodecContext *avctx,
+ const uint8_t *buf, int buf_size)
+{
+ GetBitContext gb;
+ const uint8_t *buf_end;
+ const uint8_t *buf_ptr;
+ uint32_t stc = -1;
+
+ s->key_frame = 0;
+ s->pict_type = AV_PICTURE_TYPE_NONE;
+
+ if (buf_size == 0)
+ return 0;
+
+ buf_ptr = buf;
+ buf_end = buf + buf_size;
+ for (;;) {
+ buf_ptr = avpriv_find_start_code(buf_ptr, buf_end, &stc);
+ if ((stc & 0xFFFFFE00) || buf_ptr == buf_end)
+ return 0;
+ switch (stc) {
+ case CAVS_START_CODE:
+ init_get_bits8(&gb, buf_ptr, buf_end - buf_ptr);
+ parse_seq_header(s, avctx, &gb);
+ break;
+ case PIC_I_START_CODE:
+ s->key_frame = 1;
+ s->pict_type = AV_PICTURE_TYPE_I;
+ break;
+ default:
+ break;
+ }
+ }
+}
+
static int cavsvideo_parse(AVCodecParserContext *s,
AVCodecContext *avctx,
const uint8_t **poutbuf, int *poutbuf_size,
@@ -92,6 +174,9 @@ static int cavsvideo_parse(AVCodecParserContext *s,
return buf_size;
}
}
+
+ cavs_parse_frame(s, avctx, buf, buf_size);
+
*poutbuf = buf;
*poutbuf_size = buf_size;
return next;
diff --git a/tests/ref/fate/cavs-demux b/tests/ref/fate/cavs-demux
index b1e2c2fd25..c4847293ab 100644
--- a/tests/ref/fate/cavs-demux
+++ b/tests/ref/fate/cavs-demux
@@ -1,62 +1,62 @@
-packet|codec_type=video|stream_index=0|pts=0|pts_time=0.000000|dts=0|dts_time=0.000000|duration=48000|duration_time=0.040000|size=14447|pos=0|flags=K__|data_hash=CRC32:83f257c0
-packet|codec_type=video|stream_index=0|pts=48000|pts_time=0.040000|dts=48000|dts_time=0.040000|duration=48000|duration_time=0.040000|size=483|pos=14447|flags=K__|data_hash=CRC32:5abb82f8
-packet|codec_type=video|stream_index=0|pts=96000|pts_time=0.080000|dts=96000|dts_time=0.080000|duration=48000|duration_time=0.040000|size=18|pos=14930|flags=K__|data_hash=CRC32:b8b123d8
-packet|codec_type=video|stream_index=0|pts=144000|pts_time=0.120000|dts=144000|dts_time=0.120000|duration=48000|duration_time=0.040000|size=18|pos=14948|flags=K__|data_hash=CRC32:19180fa8
-packet|codec_type=video|stream_index=0|pts=192000|pts_time=0.160000|dts=192000|dts_time=0.160000|duration=48000|duration_time=0.040000|size=18|pos=14966|flags=K__|data_hash=CRC32:cf501647
-packet|codec_type=video|stream_index=0|pts=240000|pts_time=0.200000|dts=240000|dts_time=0.200000|duration=40000|duration_time=0.033333|size=1807|pos=14984|flags=K__|data_hash=CRC32:4267e1d5
-packet|codec_type=video|stream_index=0|pts=280000|pts_time=0.233333|dts=280000|dts_time=0.233333|duration=40000|duration_time=0.033333|size=28|pos=16791|flags=K__|data_hash=CRC32:c223285a
-packet|codec_type=video|stream_index=0|pts=320000|pts_time=0.266667|dts=320000|dts_time=0.266667|duration=40000|duration_time=0.033333|size=25|pos=16819|flags=K__|data_hash=CRC32:2565cc9e
-packet|codec_type=video|stream_index=0|pts=360000|pts_time=0.300000|dts=360000|dts_time=0.300000|duration=40000|duration_time=0.033333|size=22|pos=16844|flags=K__|data_hash=CRC32:7fbf36ac
-packet|codec_type=video|stream_index=0|pts=400000|pts_time=0.333333|dts=400000|dts_time=0.333333|duration=40000|duration_time=0.033333|size=23884|pos=16866|flags=K__|data_hash=CRC32:d61430fd
-packet|codec_type=video|stream_index=0|pts=440000|pts_time=0.366667|dts=440000|dts_time=0.366667|duration=40000|duration_time=0.033333|size=265|pos=40750|flags=K__|data_hash=CRC32:d64145a0
-packet|codec_type=video|stream_index=0|pts=480000|pts_time=0.400000|dts=480000|dts_time=0.400000|duration=40000|duration_time=0.033333|size=393|pos=41015|flags=K__|data_hash=CRC32:32c020e2
-packet|codec_type=video|stream_index=0|pts=520000|pts_time=0.433333|dts=520000|dts_time=0.433333|duration=40000|duration_time=0.033333|size=656|pos=41408|flags=K__|data_hash=CRC32:965c7846
-packet|codec_type=video|stream_index=0|pts=560000|pts_time=0.466667|dts=560000|dts_time=0.466667|duration=40000|duration_time=0.033333|size=3500|pos=42064|flags=K__|data_hash=CRC32:ddf731de
-packet|codec_type=video|stream_index=0|pts=600000|pts_time=0.500000|dts=600000|dts_time=0.500000|duration=40000|duration_time=0.033333|size=68|pos=45564|flags=K__|data_hash=CRC32:f8c8ba07
-packet|codec_type=video|stream_index=0|pts=640000|pts_time=0.533333|dts=640000|dts_time=0.533333|duration=40000|duration_time=0.033333|size=58|pos=45632|flags=K__|data_hash=CRC32:22adbb83
-packet|codec_type=video|stream_index=0|pts=680000|pts_time=0.566667|dts=680000|dts_time=0.566667|duration=40000|duration_time=0.033333|size=43|pos=45690|flags=K__|data_hash=CRC32:53fb136c
-packet|codec_type=video|stream_index=0|pts=720000|pts_time=0.600000|dts=720000|dts_time=0.600000|duration=40000|duration_time=0.033333|size=11757|pos=45733|flags=K__|data_hash=CRC32:551e491b
-packet|codec_type=video|stream_index=0|pts=760000|pts_time=0.633333|dts=760000|dts_time=0.633333|duration=40000|duration_time=0.033333|size=98|pos=57490|flags=K__|data_hash=CRC32:4e718dd4
-packet|codec_type=video|stream_index=0|pts=800000|pts_time=0.666667|dts=800000|dts_time=0.666667|duration=40000|duration_time=0.033333|size=79|pos=57588|flags=K__|data_hash=CRC32:4c5a32f5
-packet|codec_type=video|stream_index=0|pts=840000|pts_time=0.700000|dts=840000|dts_time=0.700000|duration=40000|duration_time=0.033333|size=128|pos=57667|flags=K__|data_hash=CRC32:95b8cad1
-packet|codec_type=video|stream_index=0|pts=880000|pts_time=0.733333|dts=880000|dts_time=0.733333|duration=40000|duration_time=0.033333|size=10487|pos=57795|flags=K__|data_hash=CRC32:8646f8f2
-packet|codec_type=video|stream_index=0|pts=920000|pts_time=0.766667|dts=920000|dts_time=0.766667|duration=40000|duration_time=0.033333|size=65|pos=68282|flags=K__|data_hash=CRC32:73687d19
-packet|codec_type=video|stream_index=0|pts=960000|pts_time=0.800000|dts=960000|dts_time=0.800000|duration=40000|duration_time=0.033333|size=46|pos=68347|flags=K__|data_hash=CRC32:ad381ca5
-packet|codec_type=video|stream_index=0|pts=1000000|pts_time=0.833333|dts=1000000|dts_time=0.833333|duration=40000|duration_time=0.033333|size=67|pos=68393|flags=K__|data_hash=CRC32:89069152
-packet|codec_type=video|stream_index=0|pts=1040000|pts_time=0.866667|dts=1040000|dts_time=0.866667|duration=40000|duration_time=0.033333|size=8403|pos=68460|flags=K__|data_hash=CRC32:a22913dd
-packet|codec_type=video|stream_index=0|pts=1080000|pts_time=0.900000|dts=1080000|dts_time=0.900000|duration=40000|duration_time=0.033333|size=70|pos=76863|flags=K__|data_hash=CRC32:98772596
-packet|codec_type=video|stream_index=0|pts=1120000|pts_time=0.933333|dts=1120000|dts_time=0.933333|duration=40000|duration_time=0.033333|size=63|pos=76933|flags=K__|data_hash=CRC32:cfd62cc4
-packet|codec_type=video|stream_index=0|pts=1160000|pts_time=0.966667|dts=1160000|dts_time=0.966667|duration=40000|duration_time=0.033333|size=70|pos=76996|flags=K__|data_hash=CRC32:9b526357
-packet|codec_type=video|stream_index=0|pts=1200000|pts_time=1.000000|dts=1200000|dts_time=1.000000|duration=40000|duration_time=0.033333|size=7945|pos=77066|flags=K__|data_hash=CRC32:d0f46769
-packet|codec_type=video|stream_index=0|pts=1240000|pts_time=1.033333|dts=1240000|dts_time=1.033333|duration=40000|duration_time=0.033333|size=40558|pos=85011|flags=K__|data_hash=CRC32:4db0bd7d
-packet|codec_type=video|stream_index=0|pts=1280000|pts_time=1.066667|dts=1280000|dts_time=1.066667|duration=40000|duration_time=0.033333|size=1260|pos=125569|flags=K__|data_hash=CRC32:3c4397d7
-packet|codec_type=video|stream_index=0|pts=1320000|pts_time=1.100000|dts=1320000|dts_time=1.100000|duration=40000|duration_time=0.033333|size=27|pos=126829|flags=K__|data_hash=CRC32:5e233c77
-packet|codec_type=video|stream_index=0|pts=1360000|pts_time=1.133333|dts=1360000|dts_time=1.133333|duration=40000|duration_time=0.033333|size=26|pos=126856|flags=K__|data_hash=CRC32:57985e7b
-packet|codec_type=video|stream_index=0|pts=1400000|pts_time=1.166667|dts=1400000|dts_time=1.166667|duration=40000|duration_time=0.033333|size=18|pos=126882|flags=K__|data_hash=CRC32:f4eb01ba
-packet|codec_type=video|stream_index=0|pts=1440000|pts_time=1.200000|dts=1440000|dts_time=1.200000|duration=40000|duration_time=0.033333|size=2931|pos=126900|flags=K__|data_hash=CRC32:ca20964f
-packet|codec_type=video|stream_index=0|pts=1480000|pts_time=1.233333|dts=1480000|dts_time=1.233333|duration=40000|duration_time=0.033333|size=25|pos=129831|flags=K__|data_hash=CRC32:a82bd0b4
-packet|codec_type=video|stream_index=0|pts=1520000|pts_time=1.266667|dts=1520000|dts_time=1.266667|duration=40000|duration_time=0.033333|size=19|pos=129856|flags=K__|data_hash=CRC32:bc5f709d
-packet|codec_type=video|stream_index=0|pts=1560000|pts_time=1.300000|dts=1560000|dts_time=1.300000|duration=40000|duration_time=0.033333|size=30|pos=129875|flags=K__|data_hash=CRC32:c1f8a4c9
-packet|codec_type=video|stream_index=0|pts=1600000|pts_time=1.333333|dts=1600000|dts_time=1.333333|duration=40000|duration_time=0.033333|size=5088|pos=129905|flags=K__|data_hash=CRC32:41ace145
-packet|codec_type=video|stream_index=0|pts=1640000|pts_time=1.366667|dts=1640000|dts_time=1.366667|duration=40000|duration_time=0.033333|size=41|pos=134993|flags=K__|data_hash=CRC32:e169b3c7
-packet|codec_type=video|stream_index=0|pts=1680000|pts_time=1.400000|dts=1680000|dts_time=1.400000|duration=40000|duration_time=0.033333|size=53|pos=135034|flags=K__|data_hash=CRC32:973c5fe3
-packet|codec_type=video|stream_index=0|pts=1720000|pts_time=1.433333|dts=1720000|dts_time=1.433333|duration=40000|duration_time=0.033333|size=54|pos=135087|flags=K__|data_hash=CRC32:665639e6
-packet|codec_type=video|stream_index=0|pts=1760000|pts_time=1.466667|dts=1760000|dts_time=1.466667|duration=40000|duration_time=0.033333|size=7150|pos=135141|flags=K__|data_hash=CRC32:cc910027
-packet|codec_type=video|stream_index=0|pts=1800000|pts_time=1.500000|dts=1800000|dts_time=1.500000|duration=40000|duration_time=0.033333|size=48|pos=142291|flags=K__|data_hash=CRC32:45658f78
-packet|codec_type=video|stream_index=0|pts=1840000|pts_time=1.533333|dts=1840000|dts_time=1.533333|duration=40000|duration_time=0.033333|size=48|pos=142339|flags=K__|data_hash=CRC32:94e359a2
-packet|codec_type=video|stream_index=0|pts=1880000|pts_time=1.566667|dts=1880000|dts_time=1.566667|duration=40000|duration_time=0.033333|size=51|pos=142387|flags=K__|data_hash=CRC32:959ccdd9
-packet|codec_type=video|stream_index=0|pts=1920000|pts_time=1.600000|dts=1920000|dts_time=1.600000|duration=40000|duration_time=0.033333|size=9379|pos=142438|flags=K__|data_hash=CRC32:a3318410
-packet|codec_type=video|stream_index=0|pts=1960000|pts_time=1.633333|dts=1960000|dts_time=1.633333|duration=40000|duration_time=0.033333|size=58|pos=151817|flags=K__|data_hash=CRC32:44b24f03
-packet|codec_type=video|stream_index=0|pts=2000000|pts_time=1.666667|dts=2000000|dts_time=1.666667|duration=40000|duration_time=0.033333|size=43|pos=151875|flags=K__|data_hash=CRC32:f4876e05
-packet|codec_type=video|stream_index=0|pts=2040000|pts_time=1.700000|dts=2040000|dts_time=1.700000|duration=40000|duration_time=0.033333|size=62|pos=151918|flags=K__|data_hash=CRC32:34dce749
-packet|codec_type=video|stream_index=0|pts=2080000|pts_time=1.733333|dts=2080000|dts_time=1.733333|duration=40000|duration_time=0.033333|size=10733|pos=151980|flags=K__|data_hash=CRC32:9012fdfb
-packet|codec_type=video|stream_index=0|pts=2120000|pts_time=1.766667|dts=2120000|dts_time=1.766667|duration=40000|duration_time=0.033333|size=58|pos=162713|flags=K__|data_hash=CRC32:8a3c8760
-packet|codec_type=video|stream_index=0|pts=2160000|pts_time=1.800000|dts=2160000|dts_time=1.800000|duration=40000|duration_time=0.033333|size=41|pos=162771|flags=K__|data_hash=CRC32:28da6bf4
-packet|codec_type=video|stream_index=0|pts=2200000|pts_time=1.833333|dts=2200000|dts_time=1.833333|duration=40000|duration_time=0.033333|size=68|pos=162812|flags=K__|data_hash=CRC32:959dcc10
-packet|codec_type=video|stream_index=0|pts=2240000|pts_time=1.866667|dts=2240000|dts_time=1.866667|duration=40000|duration_time=0.033333|size=9247|pos=162880|flags=K__|data_hash=CRC32:cf1e2a1a
-packet|codec_type=video|stream_index=0|pts=2280000|pts_time=1.900000|dts=2280000|dts_time=1.900000|duration=40000|duration_time=0.033333|size=58|pos=172127|flags=K__|data_hash=CRC32:2efcb7ba
-packet|codec_type=video|stream_index=0|pts=2320000|pts_time=1.933333|dts=2320000|dts_time=1.933333|duration=40000|duration_time=0.033333|size=67|pos=172185|flags=K__|data_hash=CRC32:42484449
-packet|codec_type=video|stream_index=0|pts=2360000|pts_time=1.966667|dts=2360000|dts_time=1.966667|duration=40000|duration_time=0.033333|size=83|pos=172252|flags=K__|data_hash=CRC32:a941bdf0
-packet|codec_type=video|stream_index=0|pts=2400000|pts_time=2.000000|dts=2400000|dts_time=2.000000|duration=40000|duration_time=0.033333|size=5417|pos=172335|flags=K__|data_hash=CRC32:9d0d503b
+packet|codec_type=video|stream_index=0|pts=0|pts_time=0.000000|dts=0|dts_time=0.000000|duration=40000|duration_time=0.033333|size=14447|pos=0|flags=K__|data_hash=CRC32:83f257c0
+packet|codec_type=video|stream_index=0|pts=40000|pts_time=0.033333|dts=40000|dts_time=0.033333|duration=40000|duration_time=0.033333|size=483|pos=14447|flags=___|data_hash=CRC32:5abb82f8
+packet|codec_type=video|stream_index=0|pts=80000|pts_time=0.066667|dts=80000|dts_time=0.066667|duration=40000|duration_time=0.033333|size=18|pos=14930|flags=___|data_hash=CRC32:b8b123d8
+packet|codec_type=video|stream_index=0|pts=120000|pts_time=0.100000|dts=120000|dts_time=0.100000|duration=40000|duration_time=0.033333|size=18|pos=14948|flags=___|data_hash=CRC32:19180fa8
+packet|codec_type=video|stream_index=0|pts=160000|pts_time=0.133333|dts=160000|dts_time=0.133333|duration=40000|duration_time=0.033333|size=18|pos=14966|flags=___|data_hash=CRC32:cf501647
+packet|codec_type=video|stream_index=0|pts=200000|pts_time=0.166667|dts=200000|dts_time=0.166667|duration=40000|duration_time=0.033333|size=1807|pos=14984|flags=___|data_hash=CRC32:4267e1d5
+packet|codec_type=video|stream_index=0|pts=240000|pts_time=0.200000|dts=240000|dts_time=0.200000|duration=40000|duration_time=0.033333|size=28|pos=16791|flags=___|data_hash=CRC32:c223285a
+packet|codec_type=video|stream_index=0|pts=280000|pts_time=0.233333|dts=280000|dts_time=0.233333|duration=40000|duration_time=0.033333|size=25|pos=16819|flags=___|data_hash=CRC32:2565cc9e
+packet|codec_type=video|stream_index=0|pts=320000|pts_time=0.266667|dts=320000|dts_time=0.266667|duration=40000|duration_time=0.033333|size=22|pos=16844|flags=___|data_hash=CRC32:7fbf36ac
+packet|codec_type=video|stream_index=0|pts=360000|pts_time=0.300000|dts=360000|dts_time=0.300000|duration=40000|duration_time=0.033333|size=23884|pos=16866|flags=___|data_hash=CRC32:d61430fd
+packet|codec_type=video|stream_index=0|pts=400000|pts_time=0.333333|dts=400000|dts_time=0.333333|duration=40000|duration_time=0.033333|size=265|pos=40750|flags=___|data_hash=CRC32:d64145a0
+packet|codec_type=video|stream_index=0|pts=440000|pts_time=0.366667|dts=440000|dts_time=0.366667|duration=40000|duration_time=0.033333|size=393|pos=41015|flags=___|data_hash=CRC32:32c020e2
+packet|codec_type=video|stream_index=0|pts=480000|pts_time=0.400000|dts=480000|dts_time=0.400000|duration=40000|duration_time=0.033333|size=656|pos=41408|flags=___|data_hash=CRC32:965c7846
+packet|codec_type=video|stream_index=0|pts=520000|pts_time=0.433333|dts=520000|dts_time=0.433333|duration=40000|duration_time=0.033333|size=3500|pos=42064|flags=___|data_hash=CRC32:ddf731de
+packet|codec_type=video|stream_index=0|pts=560000|pts_time=0.466667|dts=560000|dts_time=0.466667|duration=40000|duration_time=0.033333|size=68|pos=45564|flags=___|data_hash=CRC32:f8c8ba07
+packet|codec_type=video|stream_index=0|pts=600000|pts_time=0.500000|dts=600000|dts_time=0.500000|duration=40000|duration_time=0.033333|size=58|pos=45632|flags=___|data_hash=CRC32:22adbb83
+packet|codec_type=video|stream_index=0|pts=640000|pts_time=0.533333|dts=640000|dts_time=0.533333|duration=40000|duration_time=0.033333|size=43|pos=45690|flags=___|data_hash=CRC32:53fb136c
+packet|codec_type=video|stream_index=0|pts=680000|pts_time=0.566667|dts=680000|dts_time=0.566667|duration=40000|duration_time=0.033333|size=11757|pos=45733|flags=___|data_hash=CRC32:551e491b
+packet|codec_type=video|stream_index=0|pts=720000|pts_time=0.600000|dts=720000|dts_time=0.600000|duration=40000|duration_time=0.033333|size=98|pos=57490|flags=___|data_hash=CRC32:4e718dd4
+packet|codec_type=video|stream_index=0|pts=760000|pts_time=0.633333|dts=760000|dts_time=0.633333|duration=40000|duration_time=0.033333|size=79|pos=57588|flags=___|data_hash=CRC32:4c5a32f5
+packet|codec_type=video|stream_index=0|pts=800000|pts_time=0.666667|dts=800000|dts_time=0.666667|duration=40000|duration_time=0.033333|size=128|pos=57667|flags=___|data_hash=CRC32:95b8cad1
+packet|codec_type=video|stream_index=0|pts=840000|pts_time=0.700000|dts=840000|dts_time=0.700000|duration=40000|duration_time=0.033333|size=10487|pos=57795|flags=___|data_hash=CRC32:8646f8f2
+packet|codec_type=video|stream_index=0|pts=880000|pts_time=0.733333|dts=880000|dts_time=0.733333|duration=40000|duration_time=0.033333|size=65|pos=68282|flags=___|data_hash=CRC32:73687d19
+packet|codec_type=video|stream_index=0|pts=920000|pts_time=0.766667|dts=920000|dts_time=0.766667|duration=40000|duration_time=0.033333|size=46|pos=68347|flags=___|data_hash=CRC32:ad381ca5
+packet|codec_type=video|stream_index=0|pts=960000|pts_time=0.800000|dts=960000|dts_time=0.800000|duration=40000|duration_time=0.033333|size=67|pos=68393|flags=___|data_hash=CRC32:89069152
+packet|codec_type=video|stream_index=0|pts=1000000|pts_time=0.833333|dts=1000000|dts_time=0.833333|duration=40000|duration_time=0.033333|size=8403|pos=68460|flags=___|data_hash=CRC32:a22913dd
+packet|codec_type=video|stream_index=0|pts=1040000|pts_time=0.866667|dts=1040000|dts_time=0.866667|duration=40000|duration_time=0.033333|size=70|pos=76863|flags=___|data_hash=CRC32:98772596
+packet|codec_type=video|stream_index=0|pts=1080000|pts_time=0.900000|dts=1080000|dts_time=0.900000|duration=40000|duration_time=0.033333|size=63|pos=76933|flags=___|data_hash=CRC32:cfd62cc4
+packet|codec_type=video|stream_index=0|pts=1120000|pts_time=0.933333|dts=1120000|dts_time=0.933333|duration=40000|duration_time=0.033333|size=70|pos=76996|flags=___|data_hash=CRC32:9b526357
+packet|codec_type=video|stream_index=0|pts=1160000|pts_time=0.966667|dts=1160000|dts_time=0.966667|duration=40000|duration_time=0.033333|size=7945|pos=77066|flags=___|data_hash=CRC32:d0f46769
+packet|codec_type=video|stream_index=0|pts=1200000|pts_time=1.000000|dts=1200000|dts_time=1.000000|duration=40000|duration_time=0.033333|size=40558|pos=85011|flags=K__|data_hash=CRC32:4db0bd7d
+packet|codec_type=video|stream_index=0|pts=1240000|pts_time=1.033333|dts=1240000|dts_time=1.033333|duration=40000|duration_time=0.033333|size=1260|pos=125569|flags=___|data_hash=CRC32:3c4397d7
+packet|codec_type=video|stream_index=0|pts=1280000|pts_time=1.066667|dts=1280000|dts_time=1.066667|duration=40000|duration_time=0.033333|size=27|pos=126829|flags=___|data_hash=CRC32:5e233c77
+packet|codec_type=video|stream_index=0|pts=1320000|pts_time=1.100000|dts=1320000|dts_time=1.100000|duration=40000|duration_time=0.033333|size=26|pos=126856|flags=___|data_hash=CRC32:57985e7b
+packet|codec_type=video|stream_index=0|pts=1360000|pts_time=1.133333|dts=1360000|dts_time=1.133333|duration=40000|duration_time=0.033333|size=18|pos=126882|flags=___|data_hash=CRC32:f4eb01ba
+packet|codec_type=video|stream_index=0|pts=1400000|pts_time=1.166667|dts=1400000|dts_time=1.166667|duration=40000|duration_time=0.033333|size=2931|pos=126900|flags=___|data_hash=CRC32:ca20964f
+packet|codec_type=video|stream_index=0|pts=1440000|pts_time=1.200000|dts=1440000|dts_time=1.200000|duration=40000|duration_time=0.033333|size=25|pos=129831|flags=___|data_hash=CRC32:a82bd0b4
+packet|codec_type=video|stream_index=0|pts=1480000|pts_time=1.233333|dts=1480000|dts_time=1.233333|duration=40000|duration_time=0.033333|size=19|pos=129856|flags=___|data_hash=CRC32:bc5f709d
+packet|codec_type=video|stream_index=0|pts=1520000|pts_time=1.266667|dts=1520000|dts_time=1.266667|duration=40000|duration_time=0.033333|size=30|pos=129875|flags=___|data_hash=CRC32:c1f8a4c9
+packet|codec_type=video|stream_index=0|pts=1560000|pts_time=1.300000|dts=1560000|dts_time=1.300000|duration=40000|duration_time=0.033333|size=5088|pos=129905|flags=___|data_hash=CRC32:41ace145
+packet|codec_type=video|stream_index=0|pts=1600000|pts_time=1.333333|dts=1600000|dts_time=1.333333|duration=40000|duration_time=0.033333|size=41|pos=134993|flags=___|data_hash=CRC32:e169b3c7
+packet|codec_type=video|stream_index=0|pts=1640000|pts_time=1.366667|dts=1640000|dts_time=1.366667|duration=40000|duration_time=0.033333|size=53|pos=135034|flags=___|data_hash=CRC32:973c5fe3
+packet|codec_type=video|stream_index=0|pts=1680000|pts_time=1.400000|dts=1680000|dts_time=1.400000|duration=40000|duration_time=0.033333|size=54|pos=135087|flags=___|data_hash=CRC32:665639e6
+packet|codec_type=video|stream_index=0|pts=1720000|pts_time=1.433333|dts=1720000|dts_time=1.433333|duration=40000|duration_time=0.033333|size=7150|pos=135141|flags=___|data_hash=CRC32:cc910027
+packet|codec_type=video|stream_index=0|pts=1760000|pts_time=1.466667|dts=1760000|dts_time=1.466667|duration=40000|duration_time=0.033333|size=48|pos=142291|flags=___|data_hash=CRC32:45658f78
+packet|codec_type=video|stream_index=0|pts=1800000|pts_time=1.500000|dts=1800000|dts_time=1.500000|duration=40000|duration_time=0.033333|size=48|pos=142339|flags=___|data_hash=CRC32:94e359a2
+packet|codec_type=video|stream_index=0|pts=1840000|pts_time=1.533333|dts=1840000|dts_time=1.533333|duration=40000|duration_time=0.033333|size=51|pos=142387|flags=___|data_hash=CRC32:959ccdd9
+packet|codec_type=video|stream_index=0|pts=1880000|pts_time=1.566667|dts=1880000|dts_time=1.566667|duration=40000|duration_time=0.033333|size=9379|pos=142438|flags=___|data_hash=CRC32:a3318410
+packet|codec_type=video|stream_index=0|pts=1920000|pts_time=1.600000|dts=1920000|dts_time=1.600000|duration=40000|duration_time=0.033333|size=58|pos=151817|flags=___|data_hash=CRC32:44b24f03
+packet|codec_type=video|stream_index=0|pts=1960000|pts_time=1.633333|dts=1960000|dts_time=1.633333|duration=40000|duration_time=0.033333|size=43|pos=151875|flags=___|data_hash=CRC32:f4876e05
+packet|codec_type=video|stream_index=0|pts=2000000|pts_time=1.666667|dts=2000000|dts_time=1.666667|duration=40000|duration_time=0.033333|size=62|pos=151918|flags=___|data_hash=CRC32:34dce749
+packet|codec_type=video|stream_index=0|pts=2040000|pts_time=1.700000|dts=2040000|dts_time=1.700000|duration=40000|duration_time=0.033333|size=10733|pos=151980|flags=___|data_hash=CRC32:9012fdfb
+packet|codec_type=video|stream_index=0|pts=2080000|pts_time=1.733333|dts=2080000|dts_time=1.733333|duration=40000|duration_time=0.033333|size=58|pos=162713|flags=___|data_hash=CRC32:8a3c8760
+packet|codec_type=video|stream_index=0|pts=2120000|pts_time=1.766667|dts=2120000|dts_time=1.766667|duration=40000|duration_time=0.033333|size=41|pos=162771|flags=___|data_hash=CRC32:28da6bf4
+packet|codec_type=video|stream_index=0|pts=2160000|pts_time=1.800000|dts=2160000|dts_time=1.800000|duration=40000|duration_time=0.033333|size=68|pos=162812|flags=___|data_hash=CRC32:959dcc10
+packet|codec_type=video|stream_index=0|pts=2200000|pts_time=1.833333|dts=2200000|dts_time=1.833333|duration=40000|duration_time=0.033333|size=9247|pos=162880|flags=___|data_hash=CRC32:cf1e2a1a
+packet|codec_type=video|stream_index=0|pts=2240000|pts_time=1.866667|dts=2240000|dts_time=1.866667|duration=40000|duration_time=0.033333|size=58|pos=172127|flags=___|data_hash=CRC32:2efcb7ba
+packet|codec_type=video|stream_index=0|pts=2280000|pts_time=1.900000|dts=2280000|dts_time=1.900000|duration=40000|duration_time=0.033333|size=67|pos=172185|flags=___|data_hash=CRC32:42484449
+packet|codec_type=video|stream_index=0|pts=2320000|pts_time=1.933333|dts=2320000|dts_time=1.933333|duration=40000|duration_time=0.033333|size=83|pos=172252|flags=___|data_hash=CRC32:a941bdf0
+packet|codec_type=video|stream_index=0|pts=2360000|pts_time=1.966667|dts=2360000|dts_time=1.966667|duration=40000|duration_time=0.033333|size=5417|pos=172335|flags=___|data_hash=CRC32:9d0d503b
stream|index=0|codec_name=cavs|profile=unknown|codec_type=video|codec_tag_string=[0][0][0][0]|codec_tag=0x0000|width=1280|height=720|coded_width=1280|coded_height=720|has_b_frames=0|sample_aspect_ratio=N/A|display_aspect_ratio=N/A|pix_fmt=yuv420p|level=-99|color_range=unknown|color_space=unknown|color_transfer=unknown|color_primaries=unknown|chroma_location=unspecified|field_order=unknown|refs=1|id=N/A|r_frame_rate=30/1|avg_frame_rate=25/1|time_base=1/1200000|start_pts=N/A|start_time=N/A|duration_ts=N/A|duration=N/A|bit_rate=N/A|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=60|extradata_size=18|extradata_hash=CRC32:1255d52e|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:non_diegetic=
0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|disposition:multilayer=0
format|filename=bunny.mp4|nb_streams=1|nb_programs=0|nb_stream_groups=0|format_name=cavsvideo|start_time=N/A|duration=N/A|size=177752|bit_rate=N/A|probe_score=51
-----------------------------------------------------------------------
Summary of changes:
libavcodec/cavs_parser.c | 85 +++++++++++++++++
libavformat/rawdec.c | 2 +-
tests/ref/fate/cavs-demux | 122 ++++++++++++-------------
tests/ref/fate/enhanced-flv-hevc-hdr10 | 4 +-
tests/ref/fate/h264-bsf-dts2pts | 102 ++++++++++-----------
tests/ref/fate/h264-conformance-cvpcmnl2_sva_c | 6 +-
tests/ref/fate/hevc-bsf-dts2pts-cra | 68 +++++++-------
tests/ref/fate/hevc-bsf-dts2pts-idr | 38 ++++----
tests/ref/fate/hevc-bsf-dts2pts-idr-cra | 38 ++++----
tests/ref/lavf-fate/hevc.mp4 | 2 +-
10 files changed, 276 insertions(+), 191 deletions(-)
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. 75b8567591 avfilter/scale_cuda: Add support for 4:2:2 chroma subsampling
by ffmpeg-git@ffmpeg.org 27 Nov '25
by ffmpeg-git@ffmpeg.org 27 Nov '25
27 Nov '25
The branch, master has been updated
via 75b85675916337bc0993f02a70279b96e5903153 (commit)
via 04b5e25d353a4b9de2a1bf0802a8138d42dfe85b (commit)
via 9c76d7db863c11ff968d71e4970fc2359303b65f (commit)
from 0cd75dbfa0fc6c213cf9240b3c03c809070c5209 (commit)
- Log -----------------------------------------------------------------
commit 75b85675916337bc0993f02a70279b96e5903153
Author: Diego de Souza <ddesouza(a)nvidia.com>
AuthorDate: Tue Nov 18 17:16:43 2025 +0100
Commit: Timo Rothenpieler <timo(a)rothenpieler.org>
CommitDate: Thu Nov 27 22:11:57 2025 +0100
avfilter/scale_cuda: Add support for 4:2:2 chroma subsampling
The supported YUV pixel formats were separated between planar
and semiplanar. This approach reduces the number of CUDA kernels
for all pixel formats.
This patch:
1. Adds support for YUV 4:2:2 planar and semi-planar formats:
yuv422p, yuv422p10, nv16, p210, p216
2. Implements new conversion structures and kernel definitions
for planar and semi-planar formats
Signed-off-by: Diego de Souza <ddesouza(a)nvidia.com>
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index d56a458e45..67814c0d77 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -678,6 +678,7 @@ SKIPHEADERS-$(CONFIG_QSVVPP) += qsvvpp.h stack_internal.h
SKIPHEADERS-$(CONFIG_OPENCL) += opencl.h
SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_vpp.h stack_internal.h
SKIPHEADERS-$(CONFIG_VULKAN) += vulkan_filter.h
+SKIPHEADERS-$(CONFIG_SCALE_CUDA_FILTER) += vf_scale_cuda.h
TOOLS = graph2dot
TESTPROGS = drawutils filtfmts formats integral
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 4a69d6be98..776321d1fc 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -32,7 +32,7 @@
#include "version_major.h"
#define LIBAVFILTER_VERSION_MINOR 10
-#define LIBAVFILTER_VERSION_MICRO 100
+#define LIBAVFILTER_VERSION_MICRO 101
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
diff --git a/libavfilter/vf_scale_cuda.c b/libavfilter/vf_scale_cuda.c
index 88a6e20610..5fd757161b 100644
--- a/libavfilter/vf_scale_cuda.c
+++ b/libavfilter/vf_scale_cuda.c
@@ -39,17 +39,29 @@
#include "cuda/load_helper.h"
#include "vf_scale_cuda.h"
-static const enum AVPixelFormat supported_formats[] = {
- AV_PIX_FMT_YUV420P,
- AV_PIX_FMT_NV12,
- AV_PIX_FMT_YUV444P,
- AV_PIX_FMT_P010,
- AV_PIX_FMT_P016,
- AV_PIX_FMT_YUV444P16,
- AV_PIX_FMT_0RGB32,
- AV_PIX_FMT_0BGR32,
- AV_PIX_FMT_RGB32,
- AV_PIX_FMT_BGR32,
+struct format_entry {
+ enum AVPixelFormat format;
+ char name[13];
+};
+
+static const struct format_entry supported_formats[] = {
+ {AV_PIX_FMT_YUV420P, "planar8"},
+ {AV_PIX_FMT_YUV422P, "planar8"},
+ {AV_PIX_FMT_YUV444P, "planar8"},
+ {AV_PIX_FMT_YUV420P10,"planar10"},
+ {AV_PIX_FMT_YUV422P10,"planar10"},
+ {AV_PIX_FMT_YUV444P10,"planar10"},
+ {AV_PIX_FMT_YUV444P16,"planar16"},
+ {AV_PIX_FMT_NV12, "semiplanar8"},
+ {AV_PIX_FMT_NV16, "semiplanar8"},
+ {AV_PIX_FMT_P010, "semiplanar10"},
+ {AV_PIX_FMT_P210, "semiplanar10"},
+ {AV_PIX_FMT_P016, "semiplanar16"},
+ {AV_PIX_FMT_P216, "semiplanar16"},
+ {AV_PIX_FMT_0RGB32, "bgr0"},
+ {AV_PIX_FMT_0BGR32, "rgb0"},
+ {AV_PIX_FMT_RGB32, "bgra"},
+ {AV_PIX_FMT_BGR32, "rgba"},
};
#define DIV_UP(a, b) ( ((a) + (b) - 1) / (b) )
@@ -184,14 +196,20 @@ fail:
static int format_is_supported(enum AVPixelFormat fmt)
{
- int i;
-
- for (i = 0; i < FF_ARRAY_ELEMS(supported_formats); i++)
- if (supported_formats[i] == fmt)
+ for (int i = 0; i < FF_ARRAY_ELEMS(supported_formats); i++)
+ if (supported_formats[i].format == fmt)
return 1;
return 0;
}
+static const char* get_format_name(enum AVPixelFormat fmt)
+{
+ for (int i = 0; i < FF_ARRAY_ELEMS(supported_formats); i++)
+ if (supported_formats[i].format == fmt)
+ return supported_formats[i].name;
+ return NULL;
+}
+
static av_cold void set_format_info(AVFilterContext *ctx, enum AVPixelFormat in_format, enum AVPixelFormat out_format)
{
CUDAScaleContext *s = ctx->priv;
@@ -284,8 +302,8 @@ static av_cold int cudascale_load_functions(AVFilterContext *ctx)
char buf[128];
int ret;
- const char *in_fmt_name = av_get_pix_fmt_name(s->in_fmt);
- const char *out_fmt_name = av_get_pix_fmt_name(s->out_fmt);
+ const char *in_fmt_name = get_format_name(s->in_fmt);
+ const char *out_fmt_name = get_format_name(s->out_fmt);
const char *function_infix = "";
@@ -335,11 +353,13 @@ static av_cold int cudascale_load_functions(AVFilterContext *ctx)
ret = AVERROR(ENOSYS);
goto fail;
}
+ av_log(ctx, AV_LOG_DEBUG, "Luma filter: %s (%s -> %s)\n", buf, av_get_pix_fmt_name(s->in_fmt), av_get_pix_fmt_name(s->out_fmt));
snprintf(buf, sizeof(buf), "Subsample_%s_%s_%s_uv", function_infix, in_fmt_name, out_fmt_name);
ret = CHECK_CU(cu->cuModuleGetFunction(&s->cu_func_uv, s->cu_module, buf));
if (ret < 0)
goto fail;
+ av_log(ctx, AV_LOG_DEBUG, "Chroma filter: %s (%s -> %s)\n", buf, av_get_pix_fmt_name(s->in_fmt), av_get_pix_fmt_name(s->out_fmt));
fail:
CHECK_CU(cu->cuCtxPopCurrent(&dummy));
@@ -416,26 +436,35 @@ fail:
static int call_resize_kernel(AVFilterContext *ctx, CUfunction func,
CUtexObject src_tex[4], int src_left, int src_top, int src_width, int src_height,
- AVFrame *out_frame, int dst_width, int dst_height, int dst_pitch)
+ AVFrame *out_frame, int dst_width, int dst_height, int dst_pitch, int mpeg_range)
{
CUDAScaleContext *s = ctx->priv;
CudaFunctions *cu = s->hwctx->internal->cuda_dl;
- CUdeviceptr dst_devptr[4] = {
- (CUdeviceptr)out_frame->data[0], (CUdeviceptr)out_frame->data[1],
- (CUdeviceptr)out_frame->data[2], (CUdeviceptr)out_frame->data[3]
+ CUDAScaleKernelParams params = {
+ .src_tex = {src_tex[0], src_tex[1], src_tex[2], src_tex[3]},
+ .dst = {
+ (CUdeviceptr)out_frame->data[0],
+ (CUdeviceptr)out_frame->data[1],
+ (CUdeviceptr)out_frame->data[2],
+ (CUdeviceptr)out_frame->data[3]
+ },
+ .dst_width = dst_width,
+ .dst_height = dst_height,
+ .dst_pitch = dst_pitch,
+ .src_left = src_left,
+ .src_top = src_top,
+ .src_width = src_width,
+ .src_height = src_height,
+ .param = s->param,
+ .mpeg_range = mpeg_range
};
- void *args_uchar[] = {
- &src_tex[0], &src_tex[1], &src_tex[2], &src_tex[3],
- &dst_devptr[0], &dst_devptr[1], &dst_devptr[2], &dst_devptr[3],
- &dst_width, &dst_height, &dst_pitch,
- &src_left, &src_top, &src_width, &src_height, &s->param
- };
+ void *args[] = { ¶ms };
return CHECK_CU(cu->cuLaunchKernel(func,
DIV_UP(dst_width, BLOCKX), DIV_UP(dst_height, BLOCKY), 1,
- BLOCKX, BLOCKY, 1, 0, s->cu_stream, args_uchar, NULL));
+ BLOCKX, BLOCKY, 1, 0, s->cu_stream, args, NULL));
}
static int scalecuda_resize(AVFilterContext *ctx,
@@ -445,6 +474,7 @@ static int scalecuda_resize(AVFilterContext *ctx,
CudaFunctions *cu = s->hwctx->internal->cuda_dl;
CUcontext dummy, cuda_ctx = s->hwctx->cuda_ctx;
int i, ret;
+ int mpeg_range = in->color_range != AVCOL_RANGE_JPEG;
CUtexObject tex[4] = { 0, 0, 0, 0 };
@@ -489,7 +519,7 @@ static int scalecuda_resize(AVFilterContext *ctx,
// scale primary plane(s). Usually Y (and A), or single plane of RGB frames.
ret = call_resize_kernel(ctx, s->cu_func,
tex, in->crop_left, in->crop_top, crop_width, crop_height,
- out, out->width, out->height, out->linesize[0]);
+ out, out->width, out->height, out->linesize[0], mpeg_range);
if (ret < 0)
goto exit;
@@ -503,7 +533,7 @@ static int scalecuda_resize(AVFilterContext *ctx,
out,
AV_CEIL_RSHIFT(out->width, s->out_desc->log2_chroma_w),
AV_CEIL_RSHIFT(out->height, s->out_desc->log2_chroma_h),
- out->linesize[1]);
+ out->linesize[1], mpeg_range);
if (ret < 0)
goto exit;
}
diff --git a/libavfilter/vf_scale_cuda.cu b/libavfilter/vf_scale_cuda.cu
index 271b55cd5d..d674c0885a 100644
--- a/libavfilter/vf_scale_cuda.cu
+++ b/libavfilter/vf_scale_cuda.cu
@@ -35,9 +35,16 @@ using subsample_function_t = T (*)(cudaTextureObject_t tex, int xo, int yo,
static const ushort mask_10bit = 0xFFC0;
static const ushort mask_16bit = 0xFFFF;
-static inline __device__ ushort conv_8to16(uchar in, ushort mask)
+static inline __device__ ushort conv_8to16(uchar in, ushort mask, int mpeg_range)
{
- return ((ushort)in | ((ushort)in << 8)) & mask;
+ ushort shifted = (ushort)in << 8;
+ return mpeg_range ? shifted : ((shifted | ((ushort)in )) & mask);
+}
+
+static inline __device__ ushort conv_8to10pl(uchar in, int mpeg_range)
+{
+ ushort shifted = (ushort)in << 2;
+ return mpeg_range ? shifted : (shifted | ((ushort)in >> 6));
}
static inline __device__ uchar conv_16to8(ushort in)
@@ -50,9 +57,21 @@ static inline __device__ uchar conv_10to8(ushort in)
return in >> 8;
}
-static inline __device__ ushort conv_10to16(ushort in)
+static inline __device__ uchar conv_10to8pl(ushort in)
+{
+ return in >> 2;
+}
+
+static inline __device__ ushort conv_10to16(ushort in, int mpeg_range)
{
- return in | (in >> 10);
+ ushort shifted = (in >> 10);
+ return mpeg_range ? in : (in | shifted);
+}
+
+static inline __device__ ushort conv_10to16pl(ushort in, int mpeg_range)
+{
+ ushort shifted = (in << 6);
+ return mpeg_range ? shifted : (shifted | (in >> 4));
}
static inline __device__ ushort conv_16to10(ushort in)
@@ -60,12 +79,18 @@ static inline __device__ ushort conv_16to10(ushort in)
return in & mask_10bit;
}
+static inline __device__ ushort conv_16to10pl(ushort in)
+{
+ return in >> 6;
+}
+
#define DEF_F(N, T) \
template<subsample_function_t<in_T> subsample_func_y, \
subsample_function_t<in_T_uv> subsample_func_uv> \
__device__ static inline void N(cudaTextureObject_t src_tex[4], T *dst[4], int xo, int yo, \
int dst_width, int dst_height, int dst_pitch, \
- int src_left, int src_top, int src_width, int src_height, float param)
+ int src_left, int src_top, int src_width, int src_height, \
+ float param, int mpeg_range)
#define SUB_F(m, plane) \
subsample_func_##m(src_tex[plane], xo, yo, \
@@ -81,9 +106,9 @@ static inline __device__ ushort conv_16to10(ushort in)
#define DEFAULT_DST(n) \
dst[n][yo*FIXED_PITCH+xo]
-// yuv420p->X
+// planar8->X
-struct Convert_yuv420p_yuv420p
+struct Convert_planar8_planar8
{
static const int in_bit_depth = 8;
typedef uchar in_T;
@@ -103,71 +128,69 @@ struct Convert_yuv420p_yuv420p
}
};
-struct Convert_yuv420p_nv12
+struct Convert_planar8_planar10
{
static const int in_bit_depth = 8;
typedef uchar in_T;
typedef uchar in_T_uv;
- typedef uchar out_T;
- typedef uchar2 out_T_uv;
+ typedef ushort out_T;
+ typedef ushort out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = SUB_F(y, 0);
+ DEFAULT_DST(0) = conv_8to10pl(SUB_F(y, 0), mpeg_range);
}
DEF_F(Convert_uv, out_T_uv)
{
- DEFAULT_DST(1) = make_uchar2(
- SUB_F(uv, 1),
- SUB_F(uv, 2)
- );
+ DEFAULT_DST(1) = conv_8to10pl(SUB_F(uv, 1), mpeg_range);
+ DEFAULT_DST(2) = conv_8to10pl(SUB_F(uv, 2), mpeg_range);
}
};
-struct Convert_yuv420p_yuv444p
+struct Convert_planar8_planar16
{
static const int in_bit_depth = 8;
typedef uchar in_T;
typedef uchar in_T_uv;
- typedef uchar out_T;
- typedef uchar out_T_uv;
+ typedef ushort out_T;
+ typedef ushort out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = SUB_F(y, 0);
+ DEFAULT_DST(0) = conv_8to16(SUB_F(y, 0), mask_16bit, mpeg_range);
}
DEF_F(Convert_uv, out_T_uv)
{
- DEFAULT_DST(1) = SUB_F(uv, 1);
- DEFAULT_DST(2) = SUB_F(uv, 2);
+ DEFAULT_DST(1) = conv_8to16(SUB_F(uv, 1), mask_16bit, mpeg_range);
+ DEFAULT_DST(2) = conv_8to16(SUB_F(uv, 2), mask_16bit, mpeg_range);
}
};
-struct Convert_yuv420p_p010le
+struct Convert_planar8_semiplanar8
{
static const int in_bit_depth = 8;
typedef uchar in_T;
typedef uchar in_T_uv;
- typedef ushort out_T;
- typedef ushort2 out_T_uv;
+ typedef uchar out_T;
+ typedef uchar2 out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = conv_8to16(SUB_F(y, 0), mask_10bit);
+ DEFAULT_DST(0) = SUB_F(y, 0);
}
DEF_F(Convert_uv, out_T_uv)
{
- DEFAULT_DST(1) = make_ushort2(
- conv_8to16(SUB_F(uv, 1), mask_10bit),
- conv_8to16(SUB_F(uv, 2), mask_10bit)
+ DEFAULT_DST(1) = make_uchar2(
+ SUB_F(uv, 1),
+ SUB_F(uv, 2)
);
}
};
-struct Convert_yuv420p_p016le
+struct Convert_planar8_semiplanar10
{
static const int in_bit_depth = 8;
typedef uchar in_T;
@@ -177,68 +200,71 @@ struct Convert_yuv420p_p016le
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = conv_8to16(SUB_F(y, 0), mask_16bit);
+ DEFAULT_DST(0) = conv_8to16(SUB_F(y, 0), mask_10bit, mpeg_range);
}
DEF_F(Convert_uv, out_T_uv)
{
DEFAULT_DST(1) = make_ushort2(
- conv_8to16(SUB_F(uv, 1), mask_16bit),
- conv_8to16(SUB_F(uv, 2), mask_16bit)
+ conv_8to16(SUB_F(uv, 1), mask_10bit, mpeg_range),
+ conv_8to16(SUB_F(uv, 2), mask_10bit, mpeg_range)
);
}
};
-struct Convert_yuv420p_yuv444p16le
+struct Convert_planar8_semiplanar16
{
static const int in_bit_depth = 8;
typedef uchar in_T;
typedef uchar in_T_uv;
typedef ushort out_T;
- typedef ushort out_T_uv;
+ typedef ushort2 out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = conv_8to16(SUB_F(y, 0), mask_16bit);
+ DEFAULT_DST(0) = conv_8to16(SUB_F(y, 0), mask_16bit, mpeg_range);
}
DEF_F(Convert_uv, out_T_uv)
{
- DEFAULT_DST(1) = conv_8to16(SUB_F(uv, 1), mask_16bit);
- DEFAULT_DST(2) = conv_8to16(SUB_F(uv, 2), mask_16bit);
+ DEFAULT_DST(1) = make_ushort2(
+ conv_8to16(SUB_F(uv, 1), mask_16bit, mpeg_range),
+ conv_8to16(SUB_F(uv, 2), mask_16bit, mpeg_range)
+ );
}
};
-// nv12->X
-struct Convert_nv12_yuv420p
+
+// planar10->X
+
+struct Convert_planar10_planar8
{
- static const int in_bit_depth = 8;
- typedef uchar in_T;
- typedef uchar2 in_T_uv;
+ static const int in_bit_depth = 10;
+ typedef ushort in_T;
+ typedef ushort in_T_uv;
typedef uchar out_T;
typedef uchar out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = SUB_F(y, 0);
+ DEFAULT_DST(0) = conv_10to8pl(SUB_F(y, 0));
}
DEF_F(Convert_uv, out_T_uv)
{
- in_T_uv res = SUB_F(uv, 1);
- DEFAULT_DST(1) = res.x;
- DEFAULT_DST(2) = res.y;
+ DEFAULT_DST(1) = conv_10to8pl(SUB_F(uv, 1));
+ DEFAULT_DST(2) = conv_10to8pl(SUB_F(uv, 2));
}
};
-struct Convert_nv12_nv12
+struct Convert_planar10_planar10
{
- static const int in_bit_depth = 8;
- typedef uchar in_T;
- typedef uchar2 in_T_uv;
- typedef uchar out_T;
- typedef uchar2 out_T_uv;
+ static const int in_bit_depth = 10;
+ typedef ushort in_T;
+ typedef ushort in_T_uv;
+ typedef ushort out_T;
+ typedef ushort out_T_uv;
DEF_F(Convert, out_T)
{
@@ -248,148 +274,145 @@ struct Convert_nv12_nv12
DEF_F(Convert_uv, out_T_uv)
{
DEFAULT_DST(1) = SUB_F(uv, 1);
+ DEFAULT_DST(2) = SUB_F(uv, 2);
}
};
-struct Convert_nv12_yuv444p
+struct Convert_planar10_planar16
{
- static const int in_bit_depth = 8;
- typedef uchar in_T;
- typedef uchar2 in_T_uv;
- typedef uchar out_T;
- typedef uchar out_T_uv;
+ static const int in_bit_depth = 10;
+ typedef ushort in_T;
+ typedef ushort in_T_uv;
+ typedef ushort out_T;
+ typedef ushort out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = SUB_F(y, 0);
+ DEFAULT_DST(0) = conv_10to16pl(SUB_F(y, 0), mpeg_range);
}
DEF_F(Convert_uv, out_T_uv)
{
- in_T_uv res = SUB_F(uv, 1);
- DEFAULT_DST(1) = res.x;
- DEFAULT_DST(2) = res.y;
+ DEFAULT_DST(1) = conv_10to16pl(SUB_F(uv, 1), mpeg_range);
+ DEFAULT_DST(2) = conv_10to16pl(SUB_F(uv, 2), mpeg_range);
}
};
-struct Convert_nv12_p010le
+struct Convert_planar10_semiplanar8
{
- static const int in_bit_depth = 8;
- typedef uchar in_T;
- typedef uchar2 in_T_uv;
- typedef ushort out_T;
- typedef ushort2 out_T_uv;
+ static const int in_bit_depth = 10;
+ typedef ushort in_T;
+ typedef ushort in_T_uv;
+ typedef uchar out_T;
+ typedef uchar2 out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = conv_8to16(SUB_F(y, 0), mask_10bit);
+ DEFAULT_DST(0) = conv_10to8pl(SUB_F(y, 0));
}
DEF_F(Convert_uv, out_T_uv)
{
- in_T_uv res = SUB_F(uv, 1);
- DEFAULT_DST(1) = make_ushort2(
- conv_8to16(res.x, mask_10bit),
- conv_8to16(res.y, mask_10bit)
+ DEFAULT_DST(1) = make_uchar2(
+ conv_10to8pl(SUB_F(uv, 1)),
+ conv_10to8pl(SUB_F(uv, 2))
);
}
};
-struct Convert_nv12_p016le
+struct Convert_planar10_semiplanar10
{
- static const int in_bit_depth = 8;
- typedef uchar in_T;
- typedef uchar2 in_T_uv;
+ static const int in_bit_depth = 10;
+ typedef ushort in_T;
+ typedef ushort in_T_uv;
typedef ushort out_T;
typedef ushort2 out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = conv_8to16(SUB_F(y, 0), mask_16bit);
+ DEFAULT_DST(0) = (SUB_F(y, 0) << 6);
}
DEF_F(Convert_uv, out_T_uv)
{
- in_T_uv res = SUB_F(uv, 1);
DEFAULT_DST(1) = make_ushort2(
- conv_8to16(res.x, mask_16bit),
- conv_8to16(res.y, mask_16bit)
+ (SUB_F(uv, 1) << 6),
+ (SUB_F(uv, 2) << 6)
);
}
};
-struct Convert_nv12_yuv444p16le
+struct Convert_planar10_semiplanar16
{
- static const int in_bit_depth = 8;
- typedef uchar in_T;
- typedef uchar2 in_T_uv;
+ static const int in_bit_depth = 10;
+ typedef ushort in_T;
+ typedef ushort in_T_uv;
typedef ushort out_T;
- typedef ushort out_T_uv;
+ typedef ushort2 out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = conv_8to16(SUB_F(y, 0), mask_16bit);
+ DEFAULT_DST(0) = conv_10to16pl(SUB_F(y, 0), mpeg_range);
}
DEF_F(Convert_uv, out_T_uv)
{
- in_T_uv res = SUB_F(uv, 1);
- DEFAULT_DST(1) = conv_8to16(res.x, mask_16bit);
- DEFAULT_DST(2) = conv_8to16(res.y, mask_16bit);
+ DEFAULT_DST(1) = make_ushort2(
+ conv_10to16pl(SUB_F(uv, 1), mpeg_range),
+ conv_10to16pl(SUB_F(uv, 2), mpeg_range)
+ );
}
};
-// yuv444p->X
+// planar16->X
-struct Convert_yuv444p_yuv420p
+struct Convert_planar16_planar8
{
- static const int in_bit_depth = 8;
- typedef uchar in_T;
- typedef uchar in_T_uv;
+ static const int in_bit_depth = 16;
+ typedef ushort in_T;
+ typedef ushort in_T_uv;
typedef uchar out_T;
typedef uchar out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = SUB_F(y, 0);
+ DEFAULT_DST(0) = conv_16to8(SUB_F(y, 0));
}
DEF_F(Convert_uv, out_T_uv)
{
- DEFAULT_DST(1) = SUB_F(uv, 1);
- DEFAULT_DST(2) = SUB_F(uv, 2);
+ DEFAULT_DST(1) = conv_16to8(SUB_F(uv, 1));
+ DEFAULT_DST(2) = conv_16to8(SUB_F(uv, 2));
}
};
-struct Convert_yuv444p_nv12
+struct Convert_planar16_planar10
{
- static const int in_bit_depth = 8;
- typedef uchar in_T;
- typedef uchar in_T_uv;
- typedef uchar out_T;
- typedef uchar2 out_T_uv;
+ static const int in_bit_depth = 16;
+ typedef ushort in_T;
+ typedef ushort in_T_uv;
+ typedef ushort out_T;
+ typedef ushort out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = SUB_F(y, 0);
+ DEFAULT_DST(0) = conv_16to10pl(SUB_F(y, 0));
}
DEF_F(Convert_uv, out_T_uv)
{
- DEFAULT_DST(1) = make_uchar2(
- SUB_F(uv, 1),
- SUB_F(uv, 2)
- );
+ DEFAULT_DST(1) = conv_16to10pl(SUB_F(uv, 1));
+ DEFAULT_DST(2) = conv_16to10pl(SUB_F(uv, 2));
}
};
-struct Convert_yuv444p_yuv444p
+struct Convert_planar16_planar16
{
- static const int in_bit_depth = 8;
- typedef uchar in_T;
- typedef uchar in_T_uv;
- typedef uchar out_T;
- typedef uchar out_T_uv;
+ static const int in_bit_depth = 16;
+ typedef ushort in_T;
+ typedef ushort in_T_uv;
+ typedef ushort out_T;
+ typedef ushort out_T_uv;
DEF_F(Convert, out_T)
{
@@ -403,144 +426,144 @@ struct Convert_yuv444p_yuv444p
}
};
-struct Convert_yuv444p_p010le
+struct Convert_planar16_semiplanar8
{
- static const int in_bit_depth = 8;
- typedef uchar in_T;
- typedef uchar in_T_uv;
- typedef ushort out_T;
- typedef ushort2 out_T_uv;
+ static const int in_bit_depth = 16;
+ typedef ushort in_T;
+ typedef ushort in_T_uv;
+ typedef uchar out_T;
+ typedef uchar2 out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = conv_8to16(SUB_F(y, 0), mask_10bit);
+ DEFAULT_DST(0) = conv_16to8(SUB_F(y, 0));
}
DEF_F(Convert_uv, out_T_uv)
{
- DEFAULT_DST(1) = make_ushort2(
- conv_8to16(SUB_F(uv, 1), mask_10bit),
- conv_8to16(SUB_F(uv, 2), mask_10bit)
+ DEFAULT_DST(1) = make_uchar2(
+ conv_16to8(SUB_F(uv, 1)),
+ conv_16to8(SUB_F(uv, 2))
);
}
};
-struct Convert_yuv444p_p016le
+struct Convert_planar16_semiplanar10
{
- static const int in_bit_depth = 8;
- typedef uchar in_T;
- typedef uchar in_T_uv;
+ static const int in_bit_depth = 16;
+ typedef ushort in_T;
+ typedef ushort in_T_uv;
typedef ushort out_T;
typedef ushort2 out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = conv_8to16(SUB_F(y, 0), mask_16bit);
+ DEFAULT_DST(0) = conv_16to10(SUB_F(y, 0));
}
DEF_F(Convert_uv, out_T_uv)
{
DEFAULT_DST(1) = make_ushort2(
- conv_8to16(SUB_F(uv, 1), mask_16bit),
- conv_8to16(SUB_F(uv, 2), mask_16bit)
+ conv_16to10(SUB_F(uv, 1)),
+ conv_16to10(SUB_F(uv, 2))
);
}
};
-struct Convert_yuv444p_yuv444p16le
+struct Convert_planar16_semiplanar16
{
- static const int in_bit_depth = 8;
- typedef uchar in_T;
- typedef uchar in_T_uv;
+ static const int in_bit_depth = 16;
+ typedef ushort in_T;
+ typedef ushort in_T_uv;
typedef ushort out_T;
- typedef ushort out_T_uv;
+ typedef ushort2 out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = conv_8to16(SUB_F(y, 0), mask_16bit);
+ DEFAULT_DST(0) = SUB_F(y, 0);
}
DEF_F(Convert_uv, out_T_uv)
{
- DEFAULT_DST(1) = conv_8to16(SUB_F(uv, 1), mask_16bit);
- DEFAULT_DST(2) = conv_8to16(SUB_F(uv, 2), mask_16bit);
+ DEFAULT_DST(1) = make_ushort2(
+ SUB_F(uv, 1),
+ SUB_F(uv, 2)
+ );
}
};
-// p010le->X
+// semiplanar8->X
-struct Convert_p010le_yuv420p
+struct Convert_semiplanar8_planar8
{
- static const int in_bit_depth = 10;
- typedef ushort in_T;
- typedef ushort2 in_T_uv;
+ static const int in_bit_depth = 8;
+ typedef uchar in_T;
+ typedef uchar2 in_T_uv;
typedef uchar out_T;
typedef uchar out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = conv_10to8(SUB_F(y, 0));
+ DEFAULT_DST(0) = SUB_F(y, 0);
}
DEF_F(Convert_uv, out_T_uv)
{
in_T_uv res = SUB_F(uv, 1);
- DEFAULT_DST(1) = conv_10to8(res.x);
- DEFAULT_DST(2) = conv_10to8(res.y);
+ DEFAULT_DST(1) = res.x;
+ DEFAULT_DST(2) = res.y;
}
};
-struct Convert_p010le_nv12
+struct Convert_semiplanar8_planar10
{
- static const int in_bit_depth = 10;
- typedef ushort in_T;
- typedef ushort2 in_T_uv;
- typedef uchar out_T;
- typedef uchar2 out_T_uv;
+ static const int in_bit_depth = 8;
+ typedef uchar in_T;
+ typedef uchar2 in_T_uv;
+ typedef ushort out_T;
+ typedef ushort out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = conv_10to8(SUB_F(y, 0));
+ DEFAULT_DST(0) = conv_8to10pl(SUB_F(y, 0), mpeg_range);
}
DEF_F(Convert_uv, out_T_uv)
{
in_T_uv res = SUB_F(uv, 1);
- DEFAULT_DST(1) = make_uchar2(
- conv_10to8(res.x),
- conv_10to8(res.y)
- );
+ DEFAULT_DST(1) = conv_8to10pl(res.x, mpeg_range);
+ DEFAULT_DST(2) = conv_8to10pl(res.y, mpeg_range);
}
};
-struct Convert_p010le_yuv444p
+struct Convert_semiplanar8_planar16
{
- static const int in_bit_depth = 10;
- typedef ushort in_T;
- typedef ushort2 in_T_uv;
- typedef uchar out_T;
- typedef uchar out_T_uv;
+ static const int in_bit_depth = 8;
+ typedef uchar in_T;
+ typedef uchar2 in_T_uv;
+ typedef ushort out_T;
+ typedef ushort out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = conv_10to8(SUB_F(y, 0));
+ DEFAULT_DST(0) = conv_8to16(SUB_F(y, 0), mask_16bit, mpeg_range);
}
DEF_F(Convert_uv, out_T_uv)
{
in_T_uv res = SUB_F(uv, 1);
- DEFAULT_DST(1) = conv_10to8(res.x);
- DEFAULT_DST(2) = conv_10to8(res.y);
+ DEFAULT_DST(1) = conv_8to16(res.x, mask_16bit, mpeg_range);
+ DEFAULT_DST(2) = conv_8to16(res.y, mask_16bit, mpeg_range);
}
};
-struct Convert_p010le_p010le
+struct Convert_semiplanar8_semiplanar8
{
- static const int in_bit_depth = 10;
- typedef ushort in_T;
- typedef ushort2 in_T_uv;
- typedef ushort out_T;
- typedef ushort2 out_T_uv;
+ static const int in_bit_depth = 8;
+ typedef uchar in_T;
+ typedef uchar2 in_T_uv;
+ typedef uchar out_T;
+ typedef uchar2 out_T_uv;
DEF_F(Convert, out_T)
{
@@ -553,55 +576,57 @@ struct Convert_p010le_p010le
}
};
-struct Convert_p010le_p016le
+struct Convert_semiplanar8_semiplanar10
{
- static const int in_bit_depth = 10;
- typedef ushort in_T;
- typedef ushort2 in_T_uv;
+ static const int in_bit_depth = 8;
+ typedef uchar in_T;
+ typedef uchar2 in_T_uv;
typedef ushort out_T;
typedef ushort2 out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = conv_10to16(SUB_F(y, 0));
+ DEFAULT_DST(0) = conv_8to16(SUB_F(y, 0), mask_10bit, mpeg_range);
}
DEF_F(Convert_uv, out_T_uv)
{
in_T_uv res = SUB_F(uv, 1);
DEFAULT_DST(1) = make_ushort2(
- conv_10to16(res.x),
- conv_10to16(res.y)
+ conv_8to16(res.x, mask_10bit, mpeg_range),
+ conv_8to16(res.y, mask_10bit, mpeg_range)
);
}
};
-struct Convert_p010le_yuv444p16le
+struct Convert_semiplanar8_semiplanar16
{
- static const int in_bit_depth = 10;
- typedef ushort in_T;
- typedef ushort2 in_T_uv;
+ static const int in_bit_depth = 8;
+ typedef uchar in_T;
+ typedef uchar2 in_T_uv;
typedef ushort out_T;
- typedef ushort out_T_uv;
+ typedef ushort2 out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = conv_10to16(SUB_F(y, 0));
+ DEFAULT_DST(0) = conv_8to16(SUB_F(y, 0), mask_16bit, mpeg_range);
}
DEF_F(Convert_uv, out_T_uv)
{
in_T_uv res = SUB_F(uv, 1);
- DEFAULT_DST(1) = conv_10to16(res.x);
- DEFAULT_DST(2) = conv_10to16(res.y);
+ DEFAULT_DST(1) = make_ushort2(
+ conv_8to16(res.x, mask_16bit, mpeg_range),
+ conv_8to16(res.y, mask_16bit, mpeg_range)
+ );
}
};
-// p016le->X
+// semiplanar10->X
-struct Convert_p016le_yuv420p
+struct Convert_semiplanar10_planar8
{
- static const int in_bit_depth = 16;
+ static const int in_bit_depth = 10;
typedef ushort in_T;
typedef ushort2 in_T_uv;
typedef uchar out_T;
@@ -609,87 +634,85 @@ struct Convert_p016le_yuv420p
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = conv_16to8(SUB_F(y, 0));
+ DEFAULT_DST(0) = conv_10to8(SUB_F(y, 0));
}
DEF_F(Convert_uv, out_T_uv)
{
in_T_uv res = SUB_F(uv, 1);
- DEFAULT_DST(1) = conv_16to8(res.x);
- DEFAULT_DST(2) = conv_16to8(res.y);
+ DEFAULT_DST(1) = conv_10to8(res.x);
+ DEFAULT_DST(2) = conv_10to8(res.y);
}
};
-struct Convert_p016le_nv12
+struct Convert_semiplanar10_planar10
{
- static const int in_bit_depth = 16;
+ static const int in_bit_depth = 10;
typedef ushort in_T;
typedef ushort2 in_T_uv;
- typedef uchar out_T;
- typedef uchar2 out_T_uv;
+ typedef ushort out_T;
+ typedef ushort out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = conv_16to8(SUB_F(y, 0));
+ DEFAULT_DST(0) = SUB_F(y, 0) >> 6;
}
DEF_F(Convert_uv, out_T_uv)
{
in_T_uv res = SUB_F(uv, 1);
- DEFAULT_DST(1) = make_uchar2(
- conv_16to8(res.x),
- conv_16to8(res.y)
- );
+ DEFAULT_DST(1) = res.x >> 6;
+ DEFAULT_DST(2) = res.y >> 6;
}
};
-struct Convert_p016le_yuv444p
+struct Convert_semiplanar10_planar16
{
- static const int in_bit_depth = 16;
+ static const int in_bit_depth = 10;
typedef ushort in_T;
typedef ushort2 in_T_uv;
- typedef uchar out_T;
- typedef uchar out_T_uv;
+ typedef ushort out_T;
+ typedef ushort out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = conv_16to8(SUB_F(y, 0));
+ DEFAULT_DST(0) = conv_10to16(SUB_F(y, 0), mpeg_range);
}
DEF_F(Convert_uv, out_T_uv)
{
in_T_uv res = SUB_F(uv, 1);
- DEFAULT_DST(1) = conv_16to8(res.x);
- DEFAULT_DST(2) = conv_16to8(res.y);
+ DEFAULT_DST(1) = conv_10to16(res.x, mpeg_range);
+ DEFAULT_DST(2) = conv_10to16(res.y, mpeg_range);
}
};
-struct Convert_p016le_p010le
+struct Convert_semiplanar10_semiplanar8
{
- static const int in_bit_depth = 16;
+ static const int in_bit_depth = 10;
typedef ushort in_T;
typedef ushort2 in_T_uv;
- typedef ushort out_T;
- typedef ushort2 out_T_uv;
+ typedef uchar out_T;
+ typedef uchar2 out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = conv_16to10(SUB_F(y, 0));
+ DEFAULT_DST(0) = conv_10to8(SUB_F(y, 0));
}
DEF_F(Convert_uv, out_T_uv)
{
in_T_uv res = SUB_F(uv, 1);
- DEFAULT_DST(1) = make_ushort2(
- conv_16to10(res.x),
- conv_16to10(res.y)
+ DEFAULT_DST(1) = make_uchar2(
+ conv_10to8(res.x),
+ conv_10to8(res.y)
);
}
};
-struct Convert_p016le_p016le
+struct Convert_semiplanar10_semiplanar10
{
- static const int in_bit_depth = 16;
+ static const int in_bit_depth = 10;
typedef ushort in_T;
typedef ushort2 in_T_uv;
typedef ushort out_T;
@@ -706,34 +729,37 @@ struct Convert_p016le_p016le
}
};
-struct Convert_p016le_yuv444p16le
+struct Convert_semiplanar10_semiplanar16
{
- static const int in_bit_depth = 16;
+ static const int in_bit_depth = 10;
typedef ushort in_T;
typedef ushort2 in_T_uv;
typedef ushort out_T;
- typedef ushort out_T_uv;
+ typedef ushort2 out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = SUB_F(y, 0);
+ DEFAULT_DST(0) = conv_10to16(SUB_F(y, 0), mpeg_range);
}
DEF_F(Convert_uv, out_T_uv)
{
in_T_uv res = SUB_F(uv, 1);
- DEFAULT_DST(1) = res.x;
- DEFAULT_DST(2) = res.y;
+ DEFAULT_DST(1) = make_ushort2(
+ conv_10to16(res.x, mpeg_range),
+ conv_10to16(res.y, mpeg_range)
+ );
}
};
-// yuv444p16le->X
-struct Convert_yuv444p16le_yuv420p
+// semiplanar16->X
+
+struct Convert_semiplanar16_planar8
{
static const int in_bit_depth = 16;
typedef ushort in_T;
- typedef ushort in_T_uv;
+ typedef ushort2 in_T_uv;
typedef uchar out_T;
typedef uchar out_T_uv;
@@ -744,104 +770,107 @@ struct Convert_yuv444p16le_yuv420p
DEF_F(Convert_uv, out_T_uv)
{
- DEFAULT_DST(1) = conv_16to8(SUB_F(uv, 1));
- DEFAULT_DST(2) = conv_16to8(SUB_F(uv, 2));
+ in_T_uv res = SUB_F(uv, 1);
+ DEFAULT_DST(1) = conv_16to8(res.x);
+ DEFAULT_DST(2) = conv_16to8(res.y);
}
};
-struct Convert_yuv444p16le_nv12
+struct Convert_semiplanar16_planar10
{
static const int in_bit_depth = 16;
typedef ushort in_T;
- typedef ushort in_T_uv;
- typedef uchar out_T;
- typedef uchar2 out_T_uv;
+ typedef ushort2 in_T_uv;
+ typedef ushort out_T;
+ typedef ushort out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = conv_16to8(SUB_F(y, 0));
+ DEFAULT_DST(0) = conv_16to10pl(SUB_F(y, 0));
}
DEF_F(Convert_uv, out_T_uv)
{
- DEFAULT_DST(1) = make_uchar2(
- conv_16to8(SUB_F(uv, 1)),
- conv_16to8(SUB_F(uv, 2))
- );
+ in_T_uv res = SUB_F(uv, 1);
+ DEFAULT_DST(1) = conv_16to10pl(res.x);
+ DEFAULT_DST(2) = conv_16to10pl(res.y);
}
};
-struct Convert_yuv444p16le_yuv444p
+struct Convert_semiplanar16_planar16
{
static const int in_bit_depth = 16;
typedef ushort in_T;
- typedef ushort in_T_uv;
- typedef uchar out_T;
- typedef uchar out_T_uv;
+ typedef ushort2 in_T_uv;
+ typedef ushort out_T;
+ typedef ushort out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = conv_16to8(SUB_F(y, 0));
+ DEFAULT_DST(0) = SUB_F(y, 0);
}
DEF_F(Convert_uv, out_T_uv)
{
- DEFAULT_DST(1) = conv_16to8(SUB_F(uv, 1));
- DEFAULT_DST(2) = conv_16to8(SUB_F(uv, 2));
+ in_T_uv res = SUB_F(uv, 1);
+ DEFAULT_DST(1) = res.x;
+ DEFAULT_DST(2) = res.y;
}
};
-struct Convert_yuv444p16le_p010le
+struct Convert_semiplanar16_semiplanar8
{
static const int in_bit_depth = 16;
typedef ushort in_T;
- typedef ushort in_T_uv;
- typedef ushort out_T;
- typedef ushort2 out_T_uv;
+ typedef ushort2 in_T_uv;
+ typedef uchar out_T;
+ typedef uchar2 out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = conv_16to10(SUB_F(y, 0));
+ DEFAULT_DST(0) = conv_16to8(SUB_F(y, 0));
}
DEF_F(Convert_uv, out_T_uv)
{
- DEFAULT_DST(1) = make_ushort2(
- conv_16to10(SUB_F(uv, 1)),
- conv_16to10(SUB_F(uv, 2))
+ in_T_uv res = SUB_F(uv, 1);
+ DEFAULT_DST(1) = make_uchar2(
+ conv_16to8(res.x),
+ conv_16to8(res.y)
);
}
};
-struct Convert_yuv444p16le_p016le
+struct Convert_semiplanar16_semiplanar10
{
static const int in_bit_depth = 16;
typedef ushort in_T;
- typedef ushort in_T_uv;
+ typedef ushort2 in_T_uv;
typedef ushort out_T;
typedef ushort2 out_T_uv;
DEF_F(Convert, out_T)
{
- DEFAULT_DST(0) = SUB_F(y, 0);
+ DEFAULT_DST(0) = conv_16to10(SUB_F(y, 0));
}
DEF_F(Convert_uv, out_T_uv)
{
+ in_T_uv res = SUB_F(uv, 1);
DEFAULT_DST(1) = make_ushort2(
- SUB_F(uv, 1),
- SUB_F(uv, 2)
+ conv_16to10(res.x),
+ conv_16to10(res.y)
);
}
};
-struct Convert_yuv444p16le_yuv444p16le
+struct Convert_semiplanar16_semiplanar16
{
static const int in_bit_depth = 16;
typedef ushort in_T;
- typedef ushort in_T_uv;
+ typedef ushort2 in_T_uv;
typedef ushort out_T;
- typedef ushort out_T_uv;
+ typedef ushort2 out_T_uv;
DEF_F(Convert, out_T)
{
@@ -851,7 +880,6 @@ struct Convert_yuv444p16le_yuv444p16le
DEF_F(Convert_uv, out_T_uv)
{
DEFAULT_DST(1) = SUB_F(uv, 1);
- DEFAULT_DST(2) = SUB_F(uv, 2);
}
};
@@ -930,7 +958,7 @@ struct Convert_bgr0_bgra
res.x,
res.y,
res.z,
- 1
+ 0xFF
);
}
@@ -954,7 +982,7 @@ struct Convert_bgr0_rgba
res.z,
res.y,
res.x,
- 1
+ 0xFF
);
}
@@ -978,7 +1006,7 @@ struct Convert_rgb0_bgra
res.z,
res.y,
res.x,
- 1
+ 0xFF
);
}
@@ -1002,7 +1030,7 @@ struct Convert_rgb0_rgba
res.x,
res.y,
res.z,
- 1
+ 0xFF
);
}
@@ -1147,25 +1175,26 @@ __device__ static inline T Subsample_Bicubic(cudaTextureObject_t tex,
/// --- FUNCTION EXPORTS ---
-#define KERNEL_ARGS(T) \
- cudaTextureObject_t src_tex_0, cudaTextureObject_t src_tex_1, \
- cudaTextureObject_t src_tex_2, cudaTextureObject_t src_tex_3, \
- T *dst_0, T *dst_1, T *dst_2, T *dst_3, \
- int dst_width, int dst_height, int dst_pitch, \
- int src_left, int src_top, int src_width, int src_height, float param
+#define KERNEL_ARGS(T) CUDAScaleKernelParams params
#define SUBSAMPLE(Convert, T) \
- cudaTextureObject_t src_tex[4] = \
- { src_tex_0, src_tex_1, src_tex_2, src_tex_3 }; \
- T *dst[4] = { dst_0, dst_1, dst_2, dst_3 }; \
+ cudaTextureObject_t src_tex[4] = { \
+ params.src_tex[0], params.src_tex[1], \
+ params.src_tex[2], params.src_tex[3] \
+ }; \
+ T *dst[4] = { \
+ (T*)params.dst[0], (T*)params.dst[1], \
+ (T*)params.dst[2], (T*)params.dst[3] \
+ }; \
int xo = blockIdx.x * blockDim.x + threadIdx.x; \
int yo = blockIdx.y * blockDim.y + threadIdx.y; \
- if (yo >= dst_height || xo >= dst_width) return; \
+ if (yo >= params.dst_height || xo >= params.dst_width) return; \
Convert( \
src_tex, dst, xo, yo, \
- dst_width, dst_height, dst_pitch, \
- src_left, src_top, \
- src_width, src_height, param);
+ params.dst_width, params.dst_height, params.dst_pitch, \
+ params.src_left, params.src_top, \
+ params.src_width, params.src_height, \
+ params.param, params.mpeg_range);
extern "C" {
@@ -1184,12 +1213,12 @@ extern "C" {
NEAREST_KERNEL(C,_uv)
#define NEAREST_KERNELS(C) \
- NEAREST_KERNEL_RAW(yuv420p_ ## C) \
- NEAREST_KERNEL_RAW(nv12_ ## C) \
- NEAREST_KERNEL_RAW(yuv444p_ ## C) \
- NEAREST_KERNEL_RAW(p010le_ ## C) \
- NEAREST_KERNEL_RAW(p016le_ ## C) \
- NEAREST_KERNEL_RAW(yuv444p16le_ ## C)
+ NEAREST_KERNEL_RAW(planar8_ ## C) \
+ NEAREST_KERNEL_RAW(planar10_ ## C) \
+ NEAREST_KERNEL_RAW(planar16_ ## C) \
+ NEAREST_KERNEL_RAW(semiplanar8_ ## C) \
+ NEAREST_KERNEL_RAW(semiplanar10_ ## C) \
+ NEAREST_KERNEL_RAW(semiplanar16_ ## C)
#define NEAREST_KERNELS_RGB(C) \
NEAREST_KERNEL_RAW(rgb0_ ## C) \
@@ -1197,12 +1226,12 @@ extern "C" {
NEAREST_KERNEL_RAW(rgba_ ## C) \
NEAREST_KERNEL_RAW(bgra_ ## C) \
-NEAREST_KERNELS(yuv420p)
-NEAREST_KERNELS(nv12)
-NEAREST_KERNELS(yuv444p)
-NEAREST_KERNELS(p010le)
-NEAREST_KERNELS(p016le)
-NEAREST_KERNELS(yuv444p16le)
+NEAREST_KERNELS(planar8)
+NEAREST_KERNELS(planar10)
+NEAREST_KERNELS(planar16)
+NEAREST_KERNELS(semiplanar8)
+NEAREST_KERNELS(semiplanar10)
+NEAREST_KERNELS(semiplanar16)
NEAREST_KERNELS_RGB(rgb0)
NEAREST_KERNELS_RGB(bgr0)
@@ -1224,12 +1253,12 @@ NEAREST_KERNELS_RGB(bgra)
BILINEAR_KERNEL(C,_uv)
#define BILINEAR_KERNELS(C) \
- BILINEAR_KERNEL_RAW(yuv420p_ ## C) \
- BILINEAR_KERNEL_RAW(nv12_ ## C) \
- BILINEAR_KERNEL_RAW(yuv444p_ ## C) \
- BILINEAR_KERNEL_RAW(p010le_ ## C) \
- BILINEAR_KERNEL_RAW(p016le_ ## C) \
- BILINEAR_KERNEL_RAW(yuv444p16le_ ## C)
+ BILINEAR_KERNEL_RAW(planar8_ ## C) \
+ BILINEAR_KERNEL_RAW(planar10_ ## C) \
+ BILINEAR_KERNEL_RAW(planar16_ ## C) \
+ BILINEAR_KERNEL_RAW(semiplanar8_ ## C) \
+ BILINEAR_KERNEL_RAW(semiplanar10_ ## C) \
+ BILINEAR_KERNEL_RAW(semiplanar16_ ## C)
#define BILINEAR_KERNELS_RGB(C) \
BILINEAR_KERNEL_RAW(rgb0_ ## C) \
@@ -1237,12 +1266,12 @@ NEAREST_KERNELS_RGB(bgra)
BILINEAR_KERNEL_RAW(rgba_ ## C) \
BILINEAR_KERNEL_RAW(bgra_ ## C)
-BILINEAR_KERNELS(yuv420p)
-BILINEAR_KERNELS(nv12)
-BILINEAR_KERNELS(yuv444p)
-BILINEAR_KERNELS(p010le)
-BILINEAR_KERNELS(p016le)
-BILINEAR_KERNELS(yuv444p16le)
+BILINEAR_KERNELS(planar8)
+BILINEAR_KERNELS(planar10)
+BILINEAR_KERNELS(planar16)
+BILINEAR_KERNELS(semiplanar8)
+BILINEAR_KERNELS(semiplanar10)
+BILINEAR_KERNELS(semiplanar16)
BILINEAR_KERNELS_RGB(rgb0)
BILINEAR_KERNELS_RGB(bgr0)
@@ -1264,12 +1293,12 @@ BILINEAR_KERNELS_RGB(bgra)
BICUBIC_KERNEL(C,_uv)
#define BICUBIC_KERNELS(C) \
- BICUBIC_KERNEL_RAW(yuv420p_ ## C) \
- BICUBIC_KERNEL_RAW(nv12_ ## C) \
- BICUBIC_KERNEL_RAW(yuv444p_ ## C) \
- BICUBIC_KERNEL_RAW(p010le_ ## C) \
- BICUBIC_KERNEL_RAW(p016le_ ## C) \
- BICUBIC_KERNEL_RAW(yuv444p16le_ ## C)
+ BICUBIC_KERNEL_RAW(planar8_ ## C) \
+ BICUBIC_KERNEL_RAW(planar10_ ## C) \
+ BICUBIC_KERNEL_RAW(planar16_ ## C) \
+ BICUBIC_KERNEL_RAW(semiplanar8_ ## C) \
+ BICUBIC_KERNEL_RAW(semiplanar10_ ## C) \
+ BICUBIC_KERNEL_RAW(semiplanar16_ ## C)
#define BICUBIC_KERNELS_RGB(C) \
BICUBIC_KERNEL_RAW(rgb0_ ## C) \
@@ -1277,12 +1306,12 @@ BILINEAR_KERNELS_RGB(bgra)
BICUBIC_KERNEL_RAW(rgba_ ## C) \
BICUBIC_KERNEL_RAW(bgra_ ## C)
-BICUBIC_KERNELS(yuv420p)
-BICUBIC_KERNELS(nv12)
-BICUBIC_KERNELS(yuv444p)
-BICUBIC_KERNELS(p010le)
-BICUBIC_KERNELS(p016le)
-BICUBIC_KERNELS(yuv444p16le)
+BICUBIC_KERNELS(planar8)
+BICUBIC_KERNELS(planar10)
+BICUBIC_KERNELS(planar16)
+BICUBIC_KERNELS(semiplanar8)
+BICUBIC_KERNELS(semiplanar10)
+BICUBIC_KERNELS(semiplanar16)
BICUBIC_KERNELS_RGB(rgb0)
BICUBIC_KERNELS_RGB(bgr0)
@@ -1304,12 +1333,12 @@ BICUBIC_KERNELS_RGB(bgra)
LANCZOS_KERNEL(C,_uv)
#define LANCZOS_KERNELS(C) \
- LANCZOS_KERNEL_RAW(yuv420p_ ## C) \
- LANCZOS_KERNEL_RAW(nv12_ ## C) \
- LANCZOS_KERNEL_RAW(yuv444p_ ## C) \
- LANCZOS_KERNEL_RAW(p010le_ ## C) \
- LANCZOS_KERNEL_RAW(p016le_ ## C) \
- LANCZOS_KERNEL_RAW(yuv444p16le_ ## C)
+ LANCZOS_KERNEL_RAW(planar8_ ## C) \
+ LANCZOS_KERNEL_RAW(planar10_ ## C) \
+ LANCZOS_KERNEL_RAW(planar16_ ## C) \
+ LANCZOS_KERNEL_RAW(semiplanar8_ ## C) \
+ LANCZOS_KERNEL_RAW(semiplanar10_ ## C) \
+ LANCZOS_KERNEL_RAW(semiplanar16_ ## C)
#define LANCZOS_KERNELS_RGB(C) \
LANCZOS_KERNEL_RAW(rgb0_ ## C) \
@@ -1317,12 +1346,12 @@ BICUBIC_KERNELS_RGB(bgra)
LANCZOS_KERNEL_RAW(rgba_ ## C) \
LANCZOS_KERNEL_RAW(bgra_ ## C)
-LANCZOS_KERNELS(yuv420p)
-LANCZOS_KERNELS(nv12)
-LANCZOS_KERNELS(yuv444p)
-LANCZOS_KERNELS(p010le)
-LANCZOS_KERNELS(p016le)
-LANCZOS_KERNELS(yuv444p16le)
+LANCZOS_KERNELS(planar8)
+LANCZOS_KERNELS(planar10)
+LANCZOS_KERNELS(planar16)
+LANCZOS_KERNELS(semiplanar8)
+LANCZOS_KERNELS(semiplanar10)
+LANCZOS_KERNELS(semiplanar16)
LANCZOS_KERNELS_RGB(rgb0)
LANCZOS_KERNELS_RGB(bgr0)
diff --git a/libavfilter/vf_scale_cuda.h b/libavfilter/vf_scale_cuda.h
index 40d5b9cfac..81fd8061e3 100644
--- a/libavfilter/vf_scale_cuda.h
+++ b/libavfilter/vf_scale_cuda.h
@@ -23,6 +23,28 @@
#ifndef AVFILTER_SCALE_CUDA_H
#define AVFILTER_SCALE_CUDA_H
+#if defined(__CUDACC__) || defined(__CUDA__)
+#include <stdint.h>
+typedef cudaTextureObject_t CUtexObject;
+typedef uint8_t* CUdeviceptr;
+#else
+#include <ffnvcodec/dynlink_cuda.h>
+#endif
+
#define SCALE_CUDA_PARAM_DEFAULT 999999.0f
+typedef struct {
+ CUtexObject src_tex[4];
+ CUdeviceptr dst[4];
+ int dst_width;
+ int dst_height;
+ int dst_pitch;
+ int src_left;
+ int src_top;
+ int src_width;
+ int src_height;
+ float param;
+ int mpeg_range;
+} CUDAScaleKernelParams;
+
#endif
commit 04b5e25d353a4b9de2a1bf0802a8138d42dfe85b
Author: Diego de Souza <ddesouza(a)nvidia.com>
AuthorDate: Thu Nov 13 09:49:45 2025 +0100
Commit: Timo Rothenpieler <timo(a)rothenpieler.org>
CommitDate: Thu Nov 27 22:11:57 2025 +0100
avfilter/hwupload_cuda: Expands pixel formats support
Add support for uploading additional pixel formats to NVIDIA GPUs:
- Planar formats (yuv420p10, yuv422p, yuv422p10, yuv444p10)
- Semiplanar formats (nv16, p210, p216)
Signed-off-by: Diego de Souza <ddesouza(a)nvidia.com>
diff --git a/libavfilter/vf_hwupload_cuda.c b/libavfilter/vf_hwupload_cuda.c
index b505f8b298..34f959ca50 100644
--- a/libavfilter/vf_hwupload_cuda.c
+++ b/libavfilter/vf_hwupload_cuda.c
@@ -59,9 +59,9 @@ static int cudaupload_query_formats(const AVFilterContext *ctx,
int ret;
static const enum AVPixelFormat input_pix_fmts[] = {
- AV_PIX_FMT_NV12, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUV444P,
- AV_PIX_FMT_P010, AV_PIX_FMT_P016, AV_PIX_FMT_YUV444P16,
- AV_PIX_FMT_0RGB32, AV_PIX_FMT_0BGR32,
+ AV_PIX_FMT_NV12, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NV16, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P,
+ AV_PIX_FMT_P010, AV_PIX_FMT_P016, AV_PIX_FMT_P210, AV_PIX_FMT_P216, AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10, AV_PIX_FMT_YUV444P16,
+ AV_PIX_FMT_0RGB32, AV_PIX_FMT_0BGR32, AV_PIX_FMT_RGB32, AV_PIX_FMT_BGR32,
#if CONFIG_VULKAN
AV_PIX_FMT_VULKAN,
#endif
commit 9c76d7db863c11ff968d71e4970fc2359303b65f
Author: Diego de Souza <ddesouza(a)nvidia.com>
AuthorDate: Wed Nov 12 20:08:45 2025 +0100
Commit: Timo Rothenpieler <timo(a)rothenpieler.org>
CommitDate: Thu Nov 27 22:11:57 2025 +0100
avutil/hwcontext_cuda: Expands pixel formats support
Add support for additional pixel formats in CUDA hardware context:
- Planar formats (yuv420p10, yuv422p, yuv422p10, yuv444p10)
- Semiplanar formats (nv16, p210, p216)
Signed-off-by: Diego de Souza <ddesouza(a)nvidia.com>
diff --git a/libavutil/hwcontext_cuda.c b/libavutil/hwcontext_cuda.c
index 10d3399537..b0b65b2446 100644
--- a/libavutil/hwcontext_cuda.c
+++ b/libavutil/hwcontext_cuda.c
@@ -50,6 +50,10 @@ static const enum AVPixelFormat supported_formats[] = {
AV_PIX_FMT_P016,
AV_PIX_FMT_P210,
AV_PIX_FMT_P216,
+ AV_PIX_FMT_YUV422P,
+ AV_PIX_FMT_YUV420P10,
+ AV_PIX_FMT_YUV422P10,
+ AV_PIX_FMT_YUV444P10,
AV_PIX_FMT_YUV444P10MSB,
AV_PIX_FMT_YUV444P12MSB,
AV_PIX_FMT_YUV444P16,
diff --git a/libavutil/version.h b/libavutil/version.h
index db250d5c9e..d058e94425 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -80,7 +80,7 @@
#define LIBAVUTIL_VERSION_MAJOR 60
#define LIBAVUTIL_VERSION_MINOR 19
-#define LIBAVUTIL_VERSION_MICRO 100
+#define LIBAVUTIL_VERSION_MICRO 101
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \
-----------------------------------------------------------------------
Summary of changes:
libavfilter/Makefile | 1 +
libavfilter/version.h | 2 +-
libavfilter/vf_hwupload_cuda.c | 6 +-
libavfilter/vf_scale_cuda.c | 90 ++++--
libavfilter/vf_scale_cuda.cu | 689 +++++++++++++++++++++--------------------
libavfilter/vf_scale_cuda.h | 22 ++
libavutil/hwcontext_cuda.c | 4 +
libavutil/version.h | 2 +-
8 files changed, 451 insertions(+), 365 deletions(-)
hooks/post-receive
--
1
0
[ffmpeg] branch master updated. 0cd75dbfa0 libavdevice/decklink: Implement QueryInterface to support newer driver
by ffmpeg-git@ffmpeg.org 27 Nov '25
by ffmpeg-git@ffmpeg.org 27 Nov '25
27 Nov '25
The branch, master has been updated
via 0cd75dbfa0fc6c213cf9240b3c03c809070c5209 (commit)
from 5169b0c3dca3a142a84ed157c964cb650ff5a25e (commit)
- Log -----------------------------------------------------------------
commit 0cd75dbfa0fc6c213cf9240b3c03c809070c5209
Author: Thomas Gritzan <phygon(a)gmx.de>
AuthorDate: Mon Nov 24 00:26:33 2025 +0100
Commit: Marton Balint <cus(a)passwd.hu>
CommitDate: Thu Nov 27 20:12:03 2025 +0000
libavdevice/decklink: Implement QueryInterface to support newer driver
Playback to a decklink device with a newer version of the
DeckLink SDK (14.3) stalls because the driver code calls
IDeckLinkVideoFrame::QueryInterface, which is not
implemented by ffmpeg.
This patch implements decklink_frame::QueryInterface,
so that playback works with both older (12.x) and
newer (>= 14.3) drivers.
Note: The patch still does not allow the code to compile
with DeckLink SDK 14.3 or newer, as the API has changed.
diff --git a/configure b/configure
index a7b0c18d9c..883539e361 100755
--- a/configure
+++ b/configure
@@ -7405,8 +7405,8 @@ fi
if enabled decklink; then
case $target_os in
mingw32*|mingw64*|win32|win64)
- decklink_outdev_extralibs="$decklink_outdev_extralibs -lole32 -loleaut32"
- decklink_indev_extralibs="$decklink_indev_extralibs -lole32 -loleaut32"
+ decklink_outdev_extralibs="$decklink_outdev_extralibs -lole32 -luuid -loleaut32"
+ decklink_indev_extralibs="$decklink_indev_extralibs -lole32 -luuid -loleaut32"
;;
esac
fi
diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp
index cb8f91730e..195f005c17 100644
--- a/libavdevice/decklink_enc.cpp
+++ b/libavdevice/decklink_enc.cpp
@@ -47,6 +47,16 @@ extern "C" {
#include "libklvanc/pixels.h"
#endif
+#ifdef _WIN32
+#include <guiddef.h>
+#else
+/* There is no guiddef.h in Linux builds, so we provide our own IsEqualIID() */
+static bool IsEqualIID(REFIID riid1, REFIID riid2)
+{
+ return memcmp(&riid1, &riid2, sizeof(REFIID)) == 0;
+}
+#endif
+
/* DeckLink callback class declaration */
class decklink_frame : public IDeckLinkVideoFrame
{
@@ -111,7 +121,21 @@ public:
_ancillary->AddRef();
return S_OK;
}
- virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) { return E_NOINTERFACE; }
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, LPVOID *ppv)
+ {
+ if (IsEqualIID(riid, IID_IUnknown)) {
+ *ppv = static_cast<IUnknown*>(this);
+ } else if (IsEqualIID(riid, IID_IDeckLinkVideoFrame)) {
+ *ppv = static_cast<IDeckLinkVideoFrame*>(this);
+ } else {
+ *ppv = NULL;
+ return E_NOINTERFACE;
+ }
+
+ AddRef();
+ return S_OK;
+ }
+
virtual ULONG STDMETHODCALLTYPE AddRef(void) { return ++_refs; }
virtual ULONG STDMETHODCALLTYPE Release(void)
{
-----------------------------------------------------------------------
Summary of changes:
configure | 4 ++--
libavdevice/decklink_enc.cpp | 26 +++++++++++++++++++++++++-
2 files changed, 27 insertions(+), 3 deletions(-)
hooks/post-receive
--
1
0