[FFmpeg-cvslog] avformat: add a disposition field to AVStreamGroup

2024-02-13 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Feb 10 20:05:08 
2024 -0300| [ec2036454bcdc6c12382961d4ab539c2f9b70ec8] | committer: James Almer

avformat: add a disposition field to AVStreamGroup

The existing (and upcoming) available group types are meant to combine several
streams for presentation, with the result being treated as if it was a stream
itself.
For example, a file could export two stream groups of the same type with one of
them as the "default".

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ec2036454bcdc6c12382961d4ab539c2f9b70ec8
---

 doc/APIchanges |  3 ++
 libavformat/avformat.h | 10 ++
 libavformat/dump.c | 85 --
 libavformat/options.c  | 45 +-
 libavformat/version.h  |  2 +-
 5 files changed, 85 insertions(+), 60 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 221fea30c2..77b9740891 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09
 
 API changes, most recent first:
 
+2024-02-13 - xx - lavf 60.21.100 - avformat.h
+  Add AVStreamGroup.disposition.
+
 2024-02-xx - xx - lavu 58.38.100 - channel_layout.h
   Add av_channel_layout_retype().
 
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 5d0fe82250..e3daf4a107 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1093,6 +1093,16 @@ typedef struct AVStreamGroup {
  * Freed by libavformat in avformat_free_context().
  */
 AVStream **streams;
+
+/**
+ * Stream group disposition - a combination of AV_DISPOSITION_* flags.
+ * This field currently applies to all defined AVStreamGroupParamsType.
+ *
+ * - demuxing: set by libavformat when creating the group or in
+ * avformat_find_stream_info().
+ * - muxing: may be set by the caller before avformat_write_header().
+ */
+int disposition;
 } AVStreamGroup;
 
 struct AVCodecParserContext *av_stream_get_parser(const AVStream *s);
diff --git a/libavformat/dump.c b/libavformat/dump.c
index 9d37179bb7..9bf1695d96 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -538,6 +538,46 @@ static void dump_sidedata(void *ctx, const AVStream *st, 
const char *indent,
 }
 }
 
+static void dump_disposition(int disposition, int log_level)
+{
+if (disposition & AV_DISPOSITION_DEFAULT)
+av_log(NULL, log_level, " (default)");
+if (disposition & AV_DISPOSITION_DUB)
+av_log(NULL, log_level, " (dub)");
+if (disposition & AV_DISPOSITION_ORIGINAL)
+av_log(NULL, log_level, " (original)");
+if (disposition & AV_DISPOSITION_COMMENT)
+av_log(NULL, log_level, " (comment)");
+if (disposition & AV_DISPOSITION_LYRICS)
+av_log(NULL, log_level, " (lyrics)");
+if (disposition & AV_DISPOSITION_KARAOKE)
+av_log(NULL, log_level, " (karaoke)");
+if (disposition & AV_DISPOSITION_FORCED)
+av_log(NULL, log_level, " (forced)");
+if (disposition & AV_DISPOSITION_HEARING_IMPAIRED)
+av_log(NULL, log_level, " (hearing impaired)");
+if (disposition & AV_DISPOSITION_VISUAL_IMPAIRED)
+av_log(NULL, log_level, " (visual impaired)");
+if (disposition & AV_DISPOSITION_CLEAN_EFFECTS)
+av_log(NULL, log_level, " (clean effects)");
+if (disposition & AV_DISPOSITION_ATTACHED_PIC)
+av_log(NULL, log_level, " (attached pic)");
+if (disposition & AV_DISPOSITION_TIMED_THUMBNAILS)
+av_log(NULL, log_level, " (timed thumbnails)");
+if (disposition & AV_DISPOSITION_CAPTIONS)
+av_log(NULL, log_level, " (captions)");
+if (disposition & AV_DISPOSITION_DESCRIPTIONS)
+av_log(NULL, log_level, " (descriptions)");
+if (disposition & AV_DISPOSITION_METADATA)
+av_log(NULL, log_level, " (metadata)");
+if (disposition & AV_DISPOSITION_DEPENDENT)
+av_log(NULL, log_level, " (dependent)");
+if (disposition & AV_DISPOSITION_STILL_IMAGE)
+av_log(NULL, log_level, " (still image)");
+if (disposition & AV_DISPOSITION_NON_DIEGETIC)
+av_log(NULL, log_level, " (non-diegetic)");
+}
+
 /* "user interface" functions */
 static void dump_stream_format(const AVFormatContext *ic, int i,
int group_index, int index, int is_output,
@@ -620,42 +660,7 @@ static void dump_stream_format(const AVFormatContext *ic, 
int i,
 print_fps(1 / av_q2d(st->time_base), "tbn", log_level);
 }
 
-if (st->disposition & AV_DISPOSITION_DEFAULT)
-av_log(NULL, log_level, " (default)");
-if (st->disposition & AV_DISPOSITION_DUB)
-av_log(NULL, log_level, " (dub)");
-if (st->disposition & AV_DISPOSITION_ORIGINAL)
-av_log(NULL, log_level, " (original)");
-if (st->disposition & AV_DISPOSITION_COMMENT)
-av_log(NULL, log_level, " (comment)");
-if (st->disposition & AV_DISPOS

[FFmpeg-cvslog] avformat/dump: Fix use of undeclared variables

2024-02-13 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Tue Feb 13 14:04:32 2024 +0100| [568645f08782cb4a12a81bcd0b655395a3f5a737] | 
committer: Andreas Rheinhardt

avformat/dump: Fix use of undeclared variables

Broken in ec2036454bcdc6c12382961d4ab539c2f9b70ec8.

Reviewed-by: James Almer 
Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=568645f08782cb4a12a81bcd0b655395a3f5a737
---

 libavformat/dump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/dump.c b/libavformat/dump.c
index 9bf1695d96..42b1909bd7 100644
--- a/libavformat/dump.c
+++ b/libavformat/dump.c
@@ -685,7 +685,7 @@ static void dump_stream_group(const AVFormatContext *ic, 
uint8_t *printed,
 case AV_STREAM_GROUP_PARAMS_IAMF_AUDIO_ELEMENT: {
 const AVIAMFAudioElement *audio_element = 
stg->params.iamf_audio_element;
 av_log(NULL, AV_LOG_INFO, " IAMF Audio Element:");
-dump_disposition(st->disposition, log_level);
+dump_disposition(stg->disposition, AV_LOG_INFO);
 av_log(NULL, AV_LOG_INFO, "\n");
 dump_metadata(NULL, stg->metadata, "", AV_LOG_INFO);
 for (int j = 0; j < audio_element->nb_layers; j++) {
@@ -708,7 +708,7 @@ static void dump_stream_group(const AVFormatContext *ic, 
uint8_t *printed,
 case AV_STREAM_GROUP_PARAMS_IAMF_MIX_PRESENTATION: {
 const AVIAMFMixPresentation *mix_presentation = 
stg->params.iamf_mix_presentation;
 av_log(NULL, AV_LOG_INFO, " IAMF Mix Presentation:");
-dump_disposition(st->disposition, log_level);
+dump_disposition(stg->disposition, AV_LOG_INFO);
 av_log(NULL, AV_LOG_INFO, "\n");
 dump_metadata(NULL, stg->metadata, "", AV_LOG_INFO);
 dump_dictionary(NULL, mix_presentation->annotations, "Annotations", "  
  ", AV_LOG_INFO);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/matroska: Add support for A_ATRAC/AT1

2024-02-13 Thread asivery
ffmpeg | branch: master | asivery  | Mon Feb 12 
19:01:32 2024 +0100| [7f4abe7c371f669b0fa8b957e33f95b966775dd9] | committer: 
Andreas Rheinhardt

avformat/matroska: Add support for A_ATRAC/AT1

Signed-off-by: asivery 
Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7f4abe7c371f669b0fa8b957e33f95b966775dd9
---

 libavformat/matroska.c| 1 +
 libavformat/matroskadec.c | 8 
 libavformat/matroskaenc.c | 1 +
 3 files changed, 10 insertions(+)

diff --git a/libavformat/matroska.c b/libavformat/matroska.c
index 5878594e68..d0ecfbeb6a 100644
--- a/libavformat/matroska.c
+++ b/libavformat/matroska.c
@@ -28,6 +28,7 @@ const CodecTags ff_mkv_codec_tags[]={
 {"A_AAC", AV_CODEC_ID_AAC},
 {"A_AC3", AV_CODEC_ID_AC3},
 {"A_ALAC"   , AV_CODEC_ID_ALAC},
+{"A_ATRAC/AT1"  , AV_CODEC_ID_ATRAC1},
 {"A_DTS", AV_CODEC_ID_DTS},
 {"A_EAC3"   , AV_CODEC_ID_EAC3},
 {"A_FLAC"   , AV_CODEC_ID_FLAC},
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 8f000f86be..5d3d18a146 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2779,6 +2779,14 @@ static int mka_parse_audio_codec(MatroskaTrack *track, 
AVCodecParameters *par,
 return AVERROR(ENOMEM);
 break;
 }
+case AV_CODEC_ID_ATRAC1:
+/* ATRAC1 uses a constant frame size.
+ * Typical ATRAC1 streams are either mono or stereo.
+ * At most, ATRAC1 was used to store 8 channels of audio. */
+if (track->audio.channels > 8)
+return AVERROR_INVALIDDATA;
+par->block_align = track->audio.channels * 212;
+break;
 case AV_CODEC_ID_FLAC:
 if (track->codec_priv.size) {
 ret = matroska_parse_flac(s, track, extradata_offset);
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 1457a6890c..21ce4aef3d 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -3474,6 +3474,7 @@ static int mkv_check_bitstream(AVFormatContext *s, 
AVStream *st,
 
 static const AVCodecTag additional_audio_tags[] = {
 { AV_CODEC_ID_ALAC,  0X },
+{ AV_CODEC_ID_ATRAC1,0x },
 { AV_CODEC_ID_MLP,   0x },
 { AV_CODEC_ID_OPUS,  0x },
 { AV_CODEC_ID_PCM_S16BE, 0x },

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avutil/hwcontext_opencl: Use proper OpenCLFramesContext

2024-02-13 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sun Feb 11 17:16:40 2024 +0100| [aa3bf6d41c1a78262244766c517084bfef953666] | 
committer: Andreas Rheinhardt

avutil/hwcontext_opencl: Use proper OpenCLFramesContext

The currently used pointer when unmapping DXVA2 and D3D11
actually points to an OpenCLDeviceContext.

Reviewed-by: Mark Thompson 
Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=aa3bf6d41c1a78262244766c517084bfef953666
---

 libavutil/hwcontext_opencl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavutil/hwcontext_opencl.c b/libavutil/hwcontext_opencl.c
index 247834aaf6..c1764ed098 100644
--- a/libavutil/hwcontext_opencl.c
+++ b/libavutil/hwcontext_opencl.c
@@ -2346,7 +2346,7 @@ static void opencl_unmap_from_dxva2(AVHWFramesContext 
*dst_fc,
 {
 AVOpenCLFrameDescriptor*desc = hwmap->priv;
 OpenCLDeviceContext *device_priv = dst_fc->device_ctx->internal->priv;
-OpenCLFramesContext *frames_priv = dst_fc->device_ctx->internal->priv;
+OpenCLFramesContext *frames_priv = dst_fc->internal->priv;
 cl_event event;
 cl_int cle;
 
@@ -2511,7 +2511,7 @@ static void opencl_unmap_from_d3d11(AVHWFramesContext 
*dst_fc,
 {
 AVOpenCLFrameDescriptor*desc = hwmap->priv;
 OpenCLDeviceContext *device_priv = dst_fc->device_ctx->internal->priv;
-OpenCLFramesContext *frames_priv = dst_fc->device_ctx->internal->priv;
+OpenCLFramesContext *frames_priv = dst_fc->internal->priv;
 cl_event event;
 cl_int cle;
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avfilter/vf_setparams: use YUV colorspace negotiation API

2024-02-13 Thread Niklas Haas
ffmpeg | branch: master | Niklas Haas  | Sat Feb 10 11:54:57 
2024 +0100| [3bf80df3ccd32aed23f09a7e1b3b9e6700e65b15] | committer: Niklas Haas

avfilter/vf_setparams: use YUV colorspace negotiation API

When this filter overrides frame properties, the outgoing frames have
a different YUV colorspace than the incoming ones. This requires
signalling the new colorspace on the outlink, and in particular, making
sure it's *not* set to a common ref with the input - otherwise the point
of this filter would be destroyed.

Untouched fields will continue being passed through, so we don't need to
do anything there.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3bf80df3ccd32aed23f09a7e1b3b9e6700e65b15
---

 libavfilter/vf_setparams.c | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/libavfilter/vf_setparams.c b/libavfilter/vf_setparams.c
index ae4c937518..a33c35a942 100644
--- a/libavfilter/vf_setparams.c
+++ b/libavfilter/vf_setparams.c
@@ -23,6 +23,7 @@
 #include "libavutil/pixfmt.h"
 #include "libavutil/opt.h"
 #include "avfilter.h"
+#include "formats.h"
 #include "internal.h"
 #include "video.h"
 
@@ -120,6 +121,29 @@ static const AVOption setparams_options[] = {
 
 AVFILTER_DEFINE_CLASS(setparams);
 
+static int query_formats(AVFilterContext *ctx)
+{
+SetParamsContext *s = ctx->priv;
+AVFilterLink *outlink = ctx->outputs[0];
+int ret;
+
+if (s->colorspace >= 0) {
+ret = ff_formats_ref(ff_make_formats_list_singleton(s->colorspace),
+ &outlink->incfg.color_spaces);
+if (ret < 0)
+return ret;
+}
+
+if (s->color_range >= 0) {
+ret = ff_formats_ref(ff_make_formats_list_singleton(s->color_range),
+ &outlink->incfg.color_ranges);
+if (ret < 0)
+return ret;
+}
+
+return 0;
+}
+
 static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
 {
 AVFilterContext *ctx = inlink->dst;
@@ -177,6 +201,7 @@ const AVFilter ff_vf_setparams = {
 .flags   = AVFILTER_FLAG_METADATA_ONLY,
 FILTER_INPUTS(inputs),
 FILTER_OUTPUTS(ff_video_default_filterpad),
+FILTER_QUERY_FUNC(query_formats),
 };
 
 #if CONFIG_SETRANGE_FILTER
@@ -217,6 +242,7 @@ const AVFilter ff_vf_setrange = {
 .flags   = AVFILTER_FLAG_METADATA_ONLY,
 FILTER_INPUTS(inputs),
 FILTER_OUTPUTS(ff_video_default_filterpad),
+FILTER_QUERY_FUNC(query_formats),
 };
 #endif /* CONFIG_SETRANGE_FILTER */
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] fate/subtitles: Ignore line endings for sub-scc test

2024-02-13 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Tue Feb 13 14:20:55 2024 +0100| [99d33cc661fbd04e8657831b818042b11f1862a2] | 
committer: Andreas Rheinhardt

fate/subtitles: Ignore line endings for sub-scc test

Since 7bf1b9b35769b37684dd2f18a54f01d852a540c8,
the test produces ordinary \n, yet this is not what the reference
file used for the most time, leading to test failures.

Reviewed-by: Martin Storsjö 
Signed-off-by: Andreas Rheinhardt 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=99d33cc661fbd04e8657831b818042b11f1862a2
---

 tests/fate/subtitles.mak | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak
index cea4c810dd..90412e9ac1 100644
--- a/tests/fate/subtitles.mak
+++ b/tests/fate/subtitles.mak
@@ -114,6 +114,7 @@ fate-sub-charenc: CMD = fmtstdout ass -sub_charenc cp1251 
-i $(TARGET_SAMPLES)/s
 
 FATE_SUBTITLES-$(call DEMDEC, SCC, CCAPTION) += fate-sub-scc
 fate-sub-scc: CMD = fmtstdout ass -ss 57 -i $(TARGET_SAMPLES)/sub/witch.scc
+fate-sub-scc: CMP = diff
 
 FATE_SUBTITLES-$(call DEMMUX, SCC, SCC) += fate-sub-scc-remux
 fate-sub-scc-remux: CMD = fmtstdout scc -i $(TARGET_SAMPLES)/sub/witch.scc -ss 
4:00 -map 0 -c copy

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avfilter/buffersrc: promote unspecified color metadata

2024-02-13 Thread Niklas Haas
ffmpeg | branch: master | Niklas Haas  | Fri Jan 12 09:14:01 
2024 +0100| [2303bf32327b94c25e1cbd78f87a32de05d48bc6] | committer: Niklas Haas

avfilter/buffersrc: promote unspecified color metadata

Currently, this only affects untagged RGB/XYZ/Gray, which get forced to
their corresponding metadata before entering the filter graph. The main
justification for this change, however, is the planned ability to add
automatic promotion of unspecified yuv to mpeg range yuv.

Notably, this change will never allow accidentally cross-promoting
unspecified to jpeg or to a specific YUV matrix, since that is still
bound by the constraints of YUV range negotiation as set up by
query_formats.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2303bf32327b94c25e1cbd78f87a32de05d48bc6
---

 libavfilter/buffersrc.c  | 5 +
 tests/ref/fate/rgb24-mkv | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index 6e450ff6b7..93fadab65f 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -291,6 +291,11 @@ FF_DISABLE_DEPRECATION_WARNINGS
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 
+if (copy->colorspace == AVCOL_SPC_UNSPECIFIED)
+copy->colorspace = ctx->outputs[0]->colorspace;
+if (copy->color_range == AVCOL_RANGE_UNSPECIFIED)
+copy->color_range = ctx->outputs[0]->color_range;
+
 ret = ff_filter_frame(ctx->outputs[0], copy);
 if (ret < 0)
 return ret;
diff --git a/tests/ref/fate/rgb24-mkv b/tests/ref/fate/rgb24-mkv
index 99234f1052..1cbed136dd 100644
--- a/tests/ref/fate/rgb24-mkv
+++ b/tests/ref/fate/rgb24-mkv
@@ -1,5 +1,5 @@
-e181dc84058c3584598333dabd110123 *tests/data/fate/rgb24-mkv.matroska
-58225 tests/data/fate/rgb24-mkv.matroska
+7d767e8238c674ecfa80458cb281c09e *tests/data/fate/rgb24-mkv.matroska
+58236 tests/data/fate/rgb24-mkv.matroska
 #tb 0: 1/10
 #media_type 0: video
 #codec_id 0: rawvideo

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avfilter/buffersrc: allow promoting color range to MPEG

2024-02-13 Thread Niklas Haas
ffmpeg | branch: master | Niklas Haas  | Fri Jan 12 09:16:16 
2024 +0100| [d2ae2aad8c6731ea5a5e6a4891fbb4fe17a77665] | committer: Niklas Haas

avfilter/buffersrc: allow promoting color range to MPEG

Otherwise, passing an UNSPECIFIED frame to am MPEG-only filter graph
would trigger insertion of an unnecessary vf_scale filter, which would
perform a memcpy to convert between the two.

This is safe to do because unspecified YUV frames are already
universally assumed to be MPEG range, in particular by swscale.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d2ae2aad8c6731ea5a5e6a4891fbb4fe17a77665
---

 libavfilter/buffersrc.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index 93fadab65f..a6a000df1e 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -506,8 +506,14 @@ static int query_formats(AVFilterContext *ctx)
 if ((ret = ff_add_format(&color_spaces, c->color_space)) < 0 ||
 (ret = ff_set_common_color_spaces(ctx, color_spaces)) < 0)
 return ret;
-if ((ret = ff_add_format(&color_ranges, c->color_range)) < 0 ||
-(ret = ff_set_common_color_ranges(ctx, color_ranges)) < 0)
+if ((ret = ff_add_format(&color_ranges, c->color_range)) < 0)
+return ret;
+if (c->color_range == AVCOL_RANGE_UNSPECIFIED) {
+/* allow implicitly promoting unspecified to mpeg */
+if ((ret = ff_add_format(&color_ranges, AVCOL_RANGE_MPEG)) < 0)
+return ret;
+}
+if ((ret = ff_set_common_color_ranges(ctx, color_ranges)) < 0)
 return ret;
 }
 break;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] lavc/blockdsp: R-V V clear_blocks

2024-02-13 Thread sunyuechi
ffmpeg | branch: master | sunyuechi  | Thu Feb  1 
15:41:09 2024 +0800| [fdebde817c03e0983da31a1d5445b48bf0122e2c] | committer: 
Rémi Denis-Courmont

lavc/blockdsp: R-V V clear_blocks

C908:
blockdsp.clear_blocks_c: 128.2
blockdsp.clear_blocks_rvv_i64: 102.5

Signed-off-by: Rémi Denis-Courmont 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fdebde817c03e0983da31a1d5445b48bf0122e2c
---

 libavcodec/riscv/blockdsp_init.c |  2 ++
 libavcodec/riscv/blockdsp_rvv.S  | 13 +
 2 files changed, 15 insertions(+)

diff --git a/libavcodec/riscv/blockdsp_init.c b/libavcodec/riscv/blockdsp_init.c
index 5370418687..59b2f9d47b 100644
--- a/libavcodec/riscv/blockdsp_init.c
+++ b/libavcodec/riscv/blockdsp_init.c
@@ -26,6 +26,7 @@
 #include "libavcodec/blockdsp.h"
 
 void ff_clear_block_rvv(int16_t *block);
+void ff_clear_blocks_rvv(int16_t *block);
 
 av_cold void ff_blockdsp_init_riscv(BlockDSPContext *c)
 {
@@ -34,6 +35,7 @@ av_cold void ff_blockdsp_init_riscv(BlockDSPContext *c)
 
 if (flags & AV_CPU_FLAG_RVV_I64 && ff_get_rv_vlenb() >= 16) {
 c->clear_block = ff_clear_block_rvv;
+c->clear_blocks = ff_clear_blocks_rvv;
 }
 #endif
 }
diff --git a/libavcodec/riscv/blockdsp_rvv.S b/libavcodec/riscv/blockdsp_rvv.S
index e85697613a..8bb00bb467 100644
--- a/libavcodec/riscv/blockdsp_rvv.S
+++ b/libavcodec/riscv/blockdsp_rvv.S
@@ -27,3 +27,16 @@ func ff_clear_block_rvv, zve64x
 
 ret
 endfunc
+
+func ff_clear_blocks_rvv, zve64x
+vsetivli  zero, 16, e64, m8, ta, ma
+vmv.v.i   v0, 0
+
+.rept 5
+vse64.v   v0, (a0)
+addi  a0, a0, 128
+.endr
+vse64.v   v0, (a0)
+
+ret
+endfunc

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] vp6dsp: Remove MMX code

2024-02-13 Thread Kieran Kunhya
ffmpeg | branch: master | Kieran Kunhya  | Sun Feb 11 20:27:04 
2024 +| [f43b5f109832d3197773c67b50f70a7103a36503] | committer: Kieran 
Kunhya

vp6dsp: Remove MMX code

Missed from 6cb3ee8

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f43b5f109832d3197773c67b50f70a7103a36503
---

 libavcodec/x86/vp6dsp.asm | 55 ---
 1 file changed, 55 deletions(-)

diff --git a/libavcodec/x86/vp6dsp.asm b/libavcodec/x86/vp6dsp.asm
index 512fe89def..0106541734 100644
--- a/libavcodec/x86/vp6dsp.asm
+++ b/libavcodec/x86/vp6dsp.asm
@@ -27,44 +27,6 @@ cextern pw_64
 SECTION .text
 
 %macro DIAG4 6
-%if mmsize == 8
-movq  m0, [%1+%2]
-movq  m1, [%1+%3]
-movq  m3, m0
-movq  m4, m1
-punpcklbw m0, m7
-punpcklbw m1, m7
-punpckhbw m3, m7
-punpckhbw m4, m7
-pmullwm0, [rsp+8*11] ; src[x-8 ] * biweight [0]
-pmullwm1, [rsp+8*12] ; src[x   ] * biweight [1]
-pmullwm3, [rsp+8*11] ; src[x-8 ] * biweight [0]
-pmullwm4, [rsp+8*12] ; src[x   ] * biweight [1]
-paddw m0, m1
-paddw m3, m4
-movq  m1, [%1+%4]
-movq  m2, [%1+%5]
-movq  m4, m1
-movq  m5, m2
-punpcklbw m1, m7
-punpcklbw m2, m7
-punpckhbw m4, m7
-punpckhbw m5, m7
-pmullwm1, [rsp+8*13] ; src[x+8 ] * biweight [2]
-pmullwm2, [rsp+8*14] ; src[x+16] * biweight [3]
-pmullwm4, [rsp+8*13] ; src[x+8 ] * biweight [2]
-pmullwm5, [rsp+8*14] ; src[x+16] * biweight [3]
-paddw m1, m2
-paddw m4, m5
-paddswm0, m1
-paddswm3, m4
-paddswm0, m6 ; Add 64
-paddswm3, m6 ; Add 64
-psraw m0, 7
-psraw m3, 7
-packuswb  m0, m3
-movq[%6], m0
-%else ; mmsize == 16
 movq  m0, [%1+%2]
 movq  m1, [%1+%3]
 punpcklbw m0, m7
@@ -84,25 +46,9 @@ SECTION .text
 psraw m0, 7
 packuswb  m0, m0
 movq[%6], m0
-%endif ; mmsize == 8/16
 %endmacro
 
 %macro SPLAT4REGS 0
-%if mmsize == 8
-movq m5, m3
-punpcklwdm3, m3
-movq m4, m3
-punpckldqm3, m3
-punpckhdqm4, m4
-punpckhwdm5, m5
-movq m2, m5
-punpckhdqm2, m2
-punpckldqm5, m5
-movq [rsp+8*11], m3
-movq [rsp+8*12], m4
-movq [rsp+8*13], m5
-movq [rsp+8*14], m2
-%else ; mmsize == 16
 pshuflw  m4, m3, 0x0
 pshuflw  m5, m3, 0x55
 pshuflw  m6, m3, 0xAA
@@ -111,7 +57,6 @@ SECTION .text
 punpcklqdq   m5, m5
 punpcklqdq   m6, m6
 punpcklqdq   m3, m3
-%endif ; mmsize == 8/16
 %endmacro
 
 ; void ff_vp6_filter_diag4_(uint8_t *dst, uint8_t *src, ptrdiff_t stride,

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] x86/h264_pred: Convert ff_pred8x8_vertical_8_mmx to ff_pred8x8_vertical_8_sse2

2024-02-13 Thread Kieran Kunhya
ffmpeg | branch: master | Kieran Kunhya  | Sun Feb 11 22:33:41 
2024 +| [40c5c19eac21025d1538250926761e8e960e6c81] | committer: Kieran 
Kunhya

x86/h264_pred: Convert ff_pred8x8_vertical_8_mmx to ff_pred8x8_vertical_8_sse2

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=40c5c19eac21025d1538250926761e8e960e6c81
---

 libavcodec/x86/h264_intrapred.asm| 12 ++--
 libavcodec/x86/h264_intrapred_init.c | 10 +++---
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/libavcodec/x86/h264_intrapred.asm 
b/libavcodec/x86/h264_intrapred.asm
index 49a63f900e..ea46bc595d 100644
--- a/libavcodec/x86/h264_intrapred.asm
+++ b/libavcodec/x86/h264_intrapred.asm
@@ -566,17 +566,17 @@ H264_PRED8x8_PLANE
 ; void ff_pred8x8_vertical_8(uint8_t *src, ptrdiff_t stride)
 ;-
 
-INIT_MMX mmx
+INIT_XMM sse2
 cglobal pred8x8_vertical_8, 2,2
 subr0, r1
-movq  mm0, [r0]
+movq   m0, [r0]
 %rep 3
-movq [r0+r1*1], mm0
-movq [r0+r1*2], mm0
+movq [r0+r1*1], m0
+movq [r0+r1*2], m0
 lear0, [r0+r1*2]
 %endrep
-movq [r0+r1*1], mm0
-movq [r0+r1*2], mm0
+movq [r0+r1*1], m0
+movq [r0+r1*2], m0
 RET
 
 ;-
diff --git a/libavcodec/x86/h264_intrapred_init.c 
b/libavcodec/x86/h264_intrapred_init.c
index 06cb0ea8fe..aa9bc721f0 100644
--- a/libavcodec/x86/h264_intrapred_init.c
+++ b/libavcodec/x86/h264_intrapred_init.c
@@ -116,7 +116,7 @@ PRED16x16(tm_vp8, 8, avx2)
 PRED8x8(top_dc, 8, mmxext)
 PRED8x8(dc_rv40, 8, mmxext)
 PRED8x8(dc, 8, mmxext)
-PRED8x8(vertical, 8, mmx)
+PRED8x8(vertical, 8, sse2)
 PRED8x8(horizontal, 8, mmxext)
 PRED8x8(horizontal, 8, ssse3)
 PRED8x8(plane, 8, sse2)
@@ -163,12 +163,6 @@ av_cold void ff_h264_pred_init_x86(H264PredContext *h, int 
codec_id,
 int cpu_flags = av_get_cpu_flags();
 
 if (bit_depth == 8) {
-if (EXTERNAL_MMX(cpu_flags)) {
-if (chroma_format_idc <= 1) {
-h->pred8x8  [VERT_PRED8x8 ] = ff_pred8x8_vertical_8_mmx;
-}
-}
-
 if (EXTERNAL_MMXEXT(cpu_flags)) {
 if (chroma_format_idc <= 1)
 h->pred8x8[HOR_PRED8x8  ] = 
ff_pred8x8_horizontal_8_mmxext;
@@ -216,6 +210,8 @@ av_cold void ff_h264_pred_init_x86(H264PredContext *h, int 
codec_id,
 h->pred8x8l [VERT_RIGHT_PRED  ] = 
ff_pred8x8l_vertical_right_8_sse2;
 h->pred8x8l [VERT_LEFT_PRED   ] = 
ff_pred8x8l_vertical_left_8_sse2;
 h->pred8x8l [HOR_DOWN_PRED] = 
ff_pred8x8l_horizontal_down_8_sse2;
+if (chroma_format_idc <= 1)
+h->pred8x8  [VERT_PRED8x8 ] = ff_pred8x8_vertical_8_sse2;
 if (codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8) {
 h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_8_sse2;
 h->pred8x8  [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_8_sse2;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/hevcdsp: Offset ff_hevc_.pel_filters to simplify addressing

2024-02-13 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Sun Feb 11 09:23:02 2024 +0100| [6106fb2b4c5ebd88a75fadfbbe7cf7e7fb944d18] | 
committer: James Almer

avcodec/hevcdsp: Offset ff_hevc_.pel_filters to simplify addressing

Besides simplifying address computations (it saves 432B of .text
in hevcdsp.o alone here) it also fixes undefined behaviour that
occurs if mx or my are 0 (happens when the filters are unused)
because they lead to an array index of -1 in the old code.
This happens in the checkasm-hevc_pel FATE-test.

Signed-off-by: Andreas Rheinhardt 
Reviewed-by: Nuo Mi 
Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6106fb2b4c5ebd88a75fadfbbe7cf7e7fb944d18
---

 libavcodec/hevcdsp.c|   6 +-
 libavcodec/hevcdsp.h|   5 +-
 libavcodec/hevcdsp_template.c   |  38 +++---
 libavcodec/loongarch/hevc_mc.S  | 224 +++-
 libavcodec/loongarch/hevc_mc_bi_lsx.c   |   6 +-
 libavcodec/loongarch/hevc_mc_uni_lsx.c  |   6 +-
 libavcodec/loongarch/hevc_mc_uniw_lsx.c |   4 +-
 libavcodec/loongarch/hevcdsp_lsx.c  |   6 +-
 libavcodec/mips/hevc_mc_bi_msa.c|   6 +-
 libavcodec/mips/hevc_mc_biw_msa.c   |   6 +-
 libavcodec/mips/hevc_mc_uni_msa.c   |   6 +-
 libavcodec/mips/hevc_mc_uniw_msa.c  |   6 +-
 libavcodec/mips/hevcdsp_mmi.c   |  20 +--
 libavcodec/mips/hevcdsp_msa.c   |   6 +-
 libavcodec/x86/hevcdsp_init.c   |   4 +-
 15 files changed, 112 insertions(+), 237 deletions(-)

diff --git a/libavcodec/hevcdsp.c b/libavcodec/hevcdsp.c
index 2ca551df1d..630fdc012e 100644
--- a/libavcodec/hevcdsp.c
+++ b/libavcodec/hevcdsp.c
@@ -91,7 +91,8 @@ static const int8_t transform[32][32] = {
   90, -90,  88, -85,  82, -78,  73, -67,  61, -54,  46, -38,  31, -22,  
13,  -4 },
 };
 
-DECLARE_ALIGNED(16, const int8_t, ff_hevc_epel_filters)[7][4] = {
+DECLARE_ALIGNED(16, const int8_t, ff_hevc_epel_filters)[8][4] = {
+{  0 },
 { -2, 58, 10, -2},
 { -4, 54, 16, -2},
 { -6, 46, 28, -4},
@@ -101,7 +102,8 @@ DECLARE_ALIGNED(16, const int8_t, 
ff_hevc_epel_filters)[7][4] = {
 { -2, 10, 58, -2},
 };
 
-DECLARE_ALIGNED(16, const int8_t, ff_hevc_qpel_filters)[3][16] = {
+DECLARE_ALIGNED(16, const int8_t, ff_hevc_qpel_filters)[4][16] = {
+{ 0 },
 { -1,  4,-10, 58, 17, -5,  1,  0, -1,  4,-10, 58, 17, -5,  1,  0},
 { -1,  4,-11, 40, 40,-11,  4, -1, -1,  4,-11, 40, 40,-11,  4, -1},
 {  0,  1, -5, 17, 58,-10,  4, -1,  0,  1, -5, 17, 58,-10,  4, -1}
diff --git a/libavcodec/hevcdsp.h b/libavcodec/hevcdsp.h
index 1b9c5bb6bc..a5933dcac4 100644
--- a/libavcodec/hevcdsp.h
+++ b/libavcodec/hevcdsp.h
@@ -126,8 +126,9 @@ typedef struct HEVCDSPContext {
 
 void ff_hevc_dsp_init(HEVCDSPContext *hpc, int bit_depth);
 
-extern const int8_t ff_hevc_epel_filters[7][4];
-extern const int8_t ff_hevc_qpel_filters[3][16];
+/** ff_hevc_.pel_filters[0] are dummies to simplify array addressing */
+extern const int8_t ff_hevc_epel_filters[8][4];
+extern const int8_t ff_hevc_qpel_filters[4][16];
 
 void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth);
 void ff_hevc_dsp_init_arm(HEVCDSPContext *c, const int bit_depth);
diff --git a/libavcodec/hevcdsp_template.c b/libavcodec/hevcdsp_template.c
index 9b48bdf08e..121c44c401 100644
--- a/libavcodec/hevcdsp_template.c
+++ b/libavcodec/hevcdsp_template.c
@@ -301,9 +301,9 @@ IDCT_DC(32)
 //
 

 #define ff_hevc_pel_filters ff_hevc_qpel_filters
-#define DECL_HV_FILTER(f)  \
-const uint8_t *hf = ff_hevc_ ## f ## _filters[mx - 1]; \
-const uint8_t *vf = ff_hevc_ ## f ## _filters[my - 1];
+#define DECL_HV_FILTER(f)  \
+const uint8_t *hf = ff_hevc_ ## f ## _filters[mx]; \
+const uint8_t *vf = ff_hevc_ ## f ## _filters[my];
 
 #define FW_PUT(p, f, t)
   \
 static void FUNC(put_hevc_## f)(int16_t *dst, const uint8_t *src, ptrdiff_t 
srcstride, int height,\
@@ -421,7 +421,7 @@ static void FUNC(put_hevc_qpel_bi_h)(uint8_t *_dst, 
ptrdiff_t _dststride, const
 pixel *dst  = (pixel *)_dst;
 ptrdiff_t dststride = _dststride / sizeof(pixel);
 
-const int8_t *filter= ff_hevc_qpel_filters[mx - 1];
+const int8_t *filter= ff_hevc_qpel_filters[mx];
 
 int shift = 14  + 1 - BIT_DEPTH;
 #if BIT_DEPTH < 14
@@ -449,7 +449,7 @@ static void FUNC(put_hevc_qpel_bi_v)(uint8_t *_dst, 
ptrdiff_t _dststride,
 pixel *dst  = (pixel *)_dst;
 ptrdiff_t dststride = _dststride / sizeof(pixel);
 
-const int8_t *filter= ff_hevc_qpel_filters[my - 1];
+const int8_t *filter= ff_hevc_qpel_filters[my];
 
 int shift = 14 + 1 - BIT_DEPTH;
 #if BIT_DEPTH < 14
@@ -487,7 +487,7 @@ static void FUNC(put_hevc_qpel_bi_hv)(uint8_t *_dst, 
ptrdiff_t _dstst

[FFmpeg-cvslog] avcodec/avcodec: don't print coded dimensions if not set

2024-02-13 Thread James Almer
ffmpeg | branch: master | James Almer  | Sat Feb 10 14:39:41 
2024 -0300| [eb5b4e60c9c2ad701c99f5ab2c606a66b3119341] | committer: James Almer

avcodec/avcodec: don't print coded dimensions if not set

The avctx passed to avcodec_string() may have unset coded dimensions, as is the
case when called by av_dump_format() where the streams had all the needed
information at the container level, and as such no frames were decoded
internally.

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=eb5b4e60c9c2ad701c99f5ab2c606a66b3119341
---

 libavcodec/avcodec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index b6d27ada21..a13b781996 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -625,6 +625,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext 
*enc, int encode)
enc->width, enc->height);
 
 if (av_log_get_level() >= AV_LOG_VERBOSE &&
+enc->coded_width && enc->coded_height &&
 (enc->width != enc->coded_width ||
  enc->height != enc->coded_height))
 av_bprintf(&bprint, " (%dx%d)",

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/vvcdec: frame_context_setup, set fc->ref to NULL

2024-02-13 Thread Nuo Mi
ffmpeg | branch: master | Nuo Mi  | Mon Feb 12 11:41:55 
2024 +0800| [1e174120d48a5ed86d9353018e7bb3c11636772c] | committer: Nuo Mi

avcodec/vvcdec: frame_context_setup, set fc->ref to NULL

fc->ref points to an old VVCFrame, which cannot be used after 
frame_context_setup.
This prevents crashes in decode_nal_units-->ff_vvc_report_frame_finished.

Signed-off-by: Frank Plowman 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1e174120d48a5ed86d9353018e7bb3c11636772c
---

 libavcodec/vvc/vvcdec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/vvc/vvcdec.c b/libavcodec/vvc/vvcdec.c
index 8163b5ecb6..e88e746de4 100644
--- a/libavcodec/vvc/vvcdec.c
+++ b/libavcodec/vvc/vvcdec.c
@@ -594,6 +594,8 @@ static int frame_context_setup(VVCFrameContext *fc, 
VVCContext *s)
 {
 int ret;
 
+fc->ref = NULL;
+
 // copy refs from the last frame
 if (s->nb_frames && s->nb_fcs > 1) {
 VVCFrameContext *prev = get_frame_context(s, fc, -1);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".