Re: [FFmpeg-devel] apsnr's PSNR formula is different from Wikipedia's formula

2024-10-07 Thread Shawn Singh via ffmpeg-devel
On Tue, Oct 1, 2024 at 3:41 PM Jing Lu  wrote:

> Hi ffmpeg-devel@,
>
> I recently came across the apnsr filter
> ,
> and the formula for PSNR it uses:
>
> 2.0 * log(s->max) - log(s->nb_samples / s->chs[ch].uv)
>
>
> which is different from the formula given by Wikipedia's PSNR
> :
>
> 20 * log_10(MAX) - 10 * log_10(MSE)
>
>
> Some differences I noticed:
> - the forms of the formulae are very different
> - natural number (e) as its log base v.s. 10 as the log base.
> - the choice of s->max
>  as
> FLT_MAX or DBL_MAX v.s. 1.0 or 2.0 in popular implementations of
> Wikipedia's formula, for floating point sample formats.
>
> These differences yield significantly different ranges of PSNR values:
> 600+ v.s. mostly around 0 - 100 dB.
>
> I'm wondering:
>
>- What's the context of apsnr's formula?
>- If we could change apsnr's implementation to use Wikipedia's formula
>or add a switch to use Wikipedia's formula?
>
> Thanks,
> Jing
>


Dear all, does anyone else have opinions about this?Here are some
additional thoughts I have:

- All definitions of decibels that I am aware of use log base 10, including
textbooks and online course materials.  Both Wikipedia and ITU-R V.574-5
cite two standards in particular, ISO 8-2 (or the upcoming ISO
8-15) and IEC 60027-3 as measurement standards that define decibels
with base 10.  (I have not seen the ISO or IEC documents myself)
-  The expression (nb_samples / s->chs[ch].uv) is the inverse of MSE.
Therefore, when the error is larger, the final logarithm result will be
lower.  This is backwards from the usual interpretation that more error has
a lower signal-to-noise ratio.

Is there interest in changing the apsnr implementation, if we can provide a
patch?

Thank you!
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH] libavfilter/vf_overlay: fix the displayed flags in CLI documentation

2024-10-07 Thread Thomas Guillory
When displaying help for overlay filter in CLI, the flags for x and y parameters
don't have the T flag. However these two parameters do have the capability to be
set at runtime, as implemented in commit d2752ef0615.
This commit fixes the CLI documentation.
---
 libavfilter/vf_overlay.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index 03b48bf681..73e838684a 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -944,10 +944,11 @@ static int activate(AVFilterContext *ctx)
 
 #define OFFSET(x) offsetof(OverlayContext, x)
 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
+#define TFLAGS 
AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
 
 static const AVOption overlay_options[] = {
-{ "x", "set the x expression", OFFSET(x_expr), AV_OPT_TYPE_STRING, {.str = 
"0"}, 0, 0, FLAGS },
-{ "y", "set the y expression", OFFSET(y_expr), AV_OPT_TYPE_STRING, {.str = 
"0"}, 0, 0, FLAGS },
+{ "x", "set the x expression", OFFSET(x_expr), AV_OPT_TYPE_STRING, {.str = 
"0"}, 0, 0, TFLAGS },
+{ "y", "set the y expression", OFFSET(y_expr), AV_OPT_TYPE_STRING, {.str = 
"0"}, 0, 0, TFLAGS },
 { "eof_action", "Action to take when encountering EOF from secondary input 
",
 OFFSET(fs.opt_eof_action), AV_OPT_TYPE_INT, { .i64 = EOF_ACTION_REPEAT 
},
 EOF_ACTION_REPEAT, EOF_ACTION_PASS, .flags = FLAGS, .unit = 
"eof_action" },
-- 
2.37.1 (Apple Git-137.1)

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

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


[FFmpeg-devel] [PATCH 17/20] avformat/movenc: add support for UYVA pixel format

2024-10-07 Thread James Almer
Signed-off-by: James Almer 
---
 libavformat/isom_tags.c | 1 +
 libavformat/movenc.c| 1 +
 2 files changed, 2 insertions(+)

diff --git a/libavformat/isom_tags.c b/libavformat/isom_tags.c
index 5dd72d570e..836bf14b80 100644
--- a/libavformat/isom_tags.c
+++ b/libavformat/isom_tags.c
@@ -33,6 +33,7 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
 { AV_CODEC_ID_RAWVIDEO, MKTAG('y', 'u', 'v', '2') }, /* uncompressed 
YUV422 */
 { AV_CODEC_ID_RAWVIDEO, MKTAG('2', 'v', 'u', 'y') }, /* uncompressed 8-bit 
4:2:2 */
 { AV_CODEC_ID_RAWVIDEO, MKTAG('y', 'u', 'v', 's') }, /* same as 2VUY but 
byte-swapped */
+{ AV_CODEC_ID_RAWVIDEO, MKTAG('v', '4', '0', '8') }, /* uncompressed  
8-bit 4:4:4:4 */
 
 { AV_CODEC_ID_RAWVIDEO, MKTAG('L', '5', '5', '5') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('L', '5', '6', '5') },
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index d20e45cf81..4d8dfe5783 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2612,6 +2612,7 @@ static int mov_write_video_tag(AVFormatContext *s, 
AVIOContext *pb, MOVMuxContex
 
 int uncompressed_ycbcr = ((track->par->codec_id == AV_CODEC_ID_RAWVIDEO && 
track->par->format == AV_PIX_FMT_UYVY422)
|| (track->par->codec_id == AV_CODEC_ID_RAWVIDEO && 
track->par->format == AV_PIX_FMT_YUYV422)
+   || (track->par->codec_id == AV_CODEC_ID_RAWVIDEO && 
track->par->format == AV_PIX_FMT_UYVA)
||  track->par->codec_id == AV_CODEC_ID_V308
||  track->par->codec_id == AV_CODEC_ID_V408
||  track->par->codec_id == AV_CODEC_ID_V410
-- 
2.46.2

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

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


[FFmpeg-devel] [PATCH 19/20] avcodec: deprecate v408 de/encoder

2024-10-07 Thread James Almer
The uyva pixel format was recently added, so this lavc workaround is no longer
needed.

Signed-off-by: James Almer 
---
 libavcodec/allcodecs.c | 2 ++
 libavcodec/codec_desc.c| 2 ++
 libavcodec/codec_id.h  | 2 ++
 libavcodec/v408dec.c   | 2 ++
 libavcodec/v408enc.c   | 2 ++
 libavcodec/version_major.h | 1 +
 libavformat/isom_tags.c| 2 ++
 libavformat/movenc.c   | 2 ++
 8 files changed, 15 insertions(+)

diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index aa0fc47647..356a78f6e0 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -347,8 +347,10 @@ extern const FFCodec ff_v210_decoder;
 extern const FFCodec ff_v210x_decoder;
 extern const FFCodec ff_v308_encoder;
 extern const FFCodec ff_v308_decoder;
+#if FF_API_V408_CODECID
 extern const FFCodec ff_v408_encoder;
 extern const FFCodec ff_v408_decoder;
+#endif
 extern const FFCodec ff_v410_encoder;
 extern const FFCodec ff_v410_decoder;
 extern const FFCodec ff_vb_decoder;
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 03dea5751a..6018052215 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1484,6 +1484,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed 4:4:4"),
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
 },
+#if FF_API_V408_CODECID
 {
 .id= AV_CODEC_ID_V408,
 .type  = AVMEDIA_TYPE_VIDEO,
@@ -1491,6 +1492,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed QT 4:4:4:4"),
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
 },
+#endif
 {
 .id= AV_CODEC_ID_YUV4,
 .type  = AVMEDIA_TYPE_VIDEO,
diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
index 0a8d3bed1e..0ab0f6761f 100644
--- a/libavcodec/codec_id.h
+++ b/libavcodec/codec_id.h
@@ -255,7 +255,9 @@ enum AVCodecID {
 AV_CODEC_ID_AVUI,
 AV_CODEC_ID_TARGA_Y216,
 AV_CODEC_ID_V308,
+#if FF_API_V408_CODECID
 AV_CODEC_ID_V408,
+#endif
 AV_CODEC_ID_YUV4,
 AV_CODEC_ID_AVRN,
 AV_CODEC_ID_CPIA,
diff --git a/libavcodec/v408dec.c b/libavcodec/v408dec.c
index 2433c6de14..4bce5c7b67 100644
--- a/libavcodec/v408dec.c
+++ b/libavcodec/v408dec.c
@@ -27,6 +27,8 @@ static av_cold int v408_decode_init(AVCodecContext *avctx)
 {
 avctx->pix_fmt = AV_PIX_FMT_YUVA444P;
 
+av_log(avctx, AV_LOG_WARNING, "This decoder is deprecated and will be 
removed.\n");
+
 return 0;
 }
 
diff --git a/libavcodec/v408enc.c b/libavcodec/v408enc.c
index c173f650ef..bf264de463 100644
--- a/libavcodec/v408enc.c
+++ b/libavcodec/v408enc.c
@@ -30,6 +30,8 @@ static av_cold int v408_encode_init(AVCodecContext *avctx)
 avctx->bits_per_coded_sample = 32;
 avctx->bit_rate = ff_guess_coded_bitrate(avctx);
 
+av_log(avctx, AV_LOG_WARNING, "This encoder is deprecated and will be 
removed.\n");
+
 return 0;
 }
 
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index 63df40e9dd..37f243f868 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -48,5 +48,6 @@
 #define FF_API_BUFFER_MIN_SIZE (LIBAVCODEC_VERSION_MAJOR < 62)
 #define FF_API_VDPAU_ALLOC_GET_SET (LIBAVCODEC_VERSION_MAJOR < 62)
 #define FF_API_QUALITY_FACTOR  (LIBAVCODEC_VERSION_MAJOR < 62)
+#define FF_API_V408_CODECID(LIBAVCODEC_VERSION_MAJOR < 62)
 
 #endif /* AVCODEC_VERSION_MAJOR_H */
diff --git a/libavformat/isom_tags.c b/libavformat/isom_tags.c
index 1605a669d3..d2f8f74e01 100644
--- a/libavformat/isom_tags.c
+++ b/libavformat/isom_tags.c
@@ -63,7 +63,9 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
 { AV_CODEC_ID_V210,   MKTAG('v', '2', '1', '0') }, /* uncompressed 10-bit 
4:2:2 */
 { AV_CODEC_ID_V210,   MKTAG('b', 'x', 'y', '2') }, /* BOXX 10-bit 4:2:2 */
 { AV_CODEC_ID_V308,   MKTAG('v', '3', '0', '8') }, /* uncompressed  8-bit 
4:4:4 */
+#if FF_API_V408_CODECID
 { AV_CODEC_ID_V408,   MKTAG('v', '4', '0', '8') }, /* uncompressed  8-bit 
4:4:4:4 */
+#endif
 { AV_CODEC_ID_V410,   MKTAG('v', '4', '1', '0') }, /* uncompressed 10-bit 
4:4:4 */
 { AV_CODEC_ID_Y41P,   MKTAG('Y', '4', '1', 'P') }, /* uncompressed 12-bit 
4:1:1 */
 { AV_CODEC_ID_YUV4,   MKTAG('y', 'u', 'v', '4') }, /* libquicktime packed 
yuv420p */
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index b1f6b29f8b..f1312b3022 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2615,7 +2615,9 @@ static int mov_write_video_tag(AVFormatContext *s, 
AVIOContext *pb, MOVMuxContex
|| (track->par->codec_id == AV_CODEC_ID_RAWVIDEO && 
track->par->format == AV_PIX_FMT_VYU444)
|| (track->par->codec_id == AV_CODEC_ID_RAWVIDEO && 
track->par->format == AV_PIX_FMT_UYVA)
||  track->par->codec_id == AV_CODEC_ID_V308
+#if FF_API_V408_CODECID

[FFmpeg-devel] [PATCH 18/20] avformat/movenc: add support for VYU444 pixel format

2024-10-07 Thread James Almer
Signed-off-by: James Almer 
---
 libavformat/isom_tags.c | 1 +
 libavformat/movenc.c| 1 +
 2 files changed, 2 insertions(+)

diff --git a/libavformat/isom_tags.c b/libavformat/isom_tags.c
index 836bf14b80..1605a669d3 100644
--- a/libavformat/isom_tags.c
+++ b/libavformat/isom_tags.c
@@ -33,6 +33,7 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
 { AV_CODEC_ID_RAWVIDEO, MKTAG('y', 'u', 'v', '2') }, /* uncompressed 
YUV422 */
 { AV_CODEC_ID_RAWVIDEO, MKTAG('2', 'v', 'u', 'y') }, /* uncompressed 8-bit 
4:2:2 */
 { AV_CODEC_ID_RAWVIDEO, MKTAG('y', 'u', 'v', 's') }, /* same as 2VUY but 
byte-swapped */
+{ AV_CODEC_ID_RAWVIDEO, MKTAG('v', '3', '0', '8') }, /* uncompressed  
8-bit 4:4:4 */
 { AV_CODEC_ID_RAWVIDEO, MKTAG('v', '4', '0', '8') }, /* uncompressed  
8-bit 4:4:4:4 */
 
 { AV_CODEC_ID_RAWVIDEO, MKTAG('L', '5', '5', '5') },
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 4d8dfe5783..b1f6b29f8b 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2612,6 +2612,7 @@ static int mov_write_video_tag(AVFormatContext *s, 
AVIOContext *pb, MOVMuxContex
 
 int uncompressed_ycbcr = ((track->par->codec_id == AV_CODEC_ID_RAWVIDEO && 
track->par->format == AV_PIX_FMT_UYVY422)
|| (track->par->codec_id == AV_CODEC_ID_RAWVIDEO && 
track->par->format == AV_PIX_FMT_YUYV422)
+   || (track->par->codec_id == AV_CODEC_ID_RAWVIDEO && 
track->par->format == AV_PIX_FMT_VYU444)
|| (track->par->codec_id == AV_CODEC_ID_RAWVIDEO && 
track->par->format == AV_PIX_FMT_UYVA)
||  track->par->codec_id == AV_CODEC_ID_V308
||  track->par->codec_id == AV_CODEC_ID_V408
-- 
2.46.2

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

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


[FFmpeg-devel] [PATCH 20/20] avcodec: deprecate v308 de/encoder

2024-10-07 Thread James Almer
The vyu444 pixel format was recently added, so this lavc workaround is no longer
needed.

Signed-off-by: James Almer 
---
 libavcodec/allcodecs.c  | 2 +-
 libavcodec/codec_desc.c | 2 +-
 libavcodec/codec_id.h   | 2 +-
 libavcodec/v308dec.c| 2 ++
 libavcodec/v308enc.c| 2 ++
 libavformat/isom_tags.c | 2 +-
 libavformat/movenc.c| 2 +-
 7 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 356a78f6e0..19f7d63c16 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -345,9 +345,9 @@ extern const FFCodec ff_utvideo_decoder;
 extern const FFCodec ff_v210_encoder;
 extern const FFCodec ff_v210_decoder;
 extern const FFCodec ff_v210x_decoder;
+#if FF_API_V408_CODECID
 extern const FFCodec ff_v308_encoder;
 extern const FFCodec ff_v308_decoder;
-#if FF_API_V408_CODECID
 extern const FFCodec ff_v408_encoder;
 extern const FFCodec ff_v408_decoder;
 #endif
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 6018052215..0e9cd669d2 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1477,6 +1477,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("Pinnacle TARGA CineWave YUV16"),
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
 },
+#if FF_API_V408_CODECID
 {
 .id= AV_CODEC_ID_V308,
 .type  = AVMEDIA_TYPE_VIDEO,
@@ -1484,7 +1485,6 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed 4:4:4"),
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
 },
-#if FF_API_V408_CODECID
 {
 .id= AV_CODEC_ID_V408,
 .type  = AVMEDIA_TYPE_VIDEO,
diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
index 0ab0f6761f..3608c4b856 100644
--- a/libavcodec/codec_id.h
+++ b/libavcodec/codec_id.h
@@ -254,8 +254,8 @@ enum AVCodecID {
 AV_CODEC_ID_012V,
 AV_CODEC_ID_AVUI,
 AV_CODEC_ID_TARGA_Y216,
-AV_CODEC_ID_V308,
 #if FF_API_V408_CODECID
+AV_CODEC_ID_V308,
 AV_CODEC_ID_V408,
 #endif
 AV_CODEC_ID_YUV4,
diff --git a/libavcodec/v308dec.c b/libavcodec/v308dec.c
index b591a79dd2..64876b7e5a 100644
--- a/libavcodec/v308dec.c
+++ b/libavcodec/v308dec.c
@@ -30,6 +30,8 @@ static av_cold int v308_decode_init(AVCodecContext *avctx)
 if (avctx->width & 1)
 av_log(avctx, AV_LOG_WARNING, "v308 requires width to be even.\n");
 
+av_log(avctx, AV_LOG_WARNING, "This decoder is deprecated and will be 
removed.\n");
+
 return 0;
 }
 
diff --git a/libavcodec/v308enc.c b/libavcodec/v308enc.c
index 68f9c3310b..2941ba3f03 100644
--- a/libavcodec/v308enc.c
+++ b/libavcodec/v308enc.c
@@ -33,6 +33,8 @@ static av_cold int v308_encode_init(AVCodecContext *avctx)
 return AVERROR_INVALIDDATA;
 }
 
+av_log(avctx, AV_LOG_WARNING, "This encoder is deprecated and will be 
removed.\n");
+
 avctx->bits_per_coded_sample = 24;
 avctx->bit_rate = ff_guess_coded_bitrate(avctx);
 
diff --git a/libavformat/isom_tags.c b/libavformat/isom_tags.c
index d2f8f74e01..1e3495f0e2 100644
--- a/libavformat/isom_tags.c
+++ b/libavformat/isom_tags.c
@@ -62,8 +62,8 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
 { AV_CODEC_ID_AVRP,   MKTAG('S', 'U', 'D', 'S') }, /* Avid DS Uncompressed 
*/
 { AV_CODEC_ID_V210,   MKTAG('v', '2', '1', '0') }, /* uncompressed 10-bit 
4:2:2 */
 { AV_CODEC_ID_V210,   MKTAG('b', 'x', 'y', '2') }, /* BOXX 10-bit 4:2:2 */
-{ AV_CODEC_ID_V308,   MKTAG('v', '3', '0', '8') }, /* uncompressed  8-bit 
4:4:4 */
 #if FF_API_V408_CODECID
+{ AV_CODEC_ID_V308,   MKTAG('v', '3', '0', '8') }, /* uncompressed  8-bit 
4:4:4 */
 { AV_CODEC_ID_V408,   MKTAG('v', '4', '0', '8') }, /* uncompressed  8-bit 
4:4:4:4 */
 #endif
 { AV_CODEC_ID_V410,   MKTAG('v', '4', '1', '0') }, /* uncompressed 10-bit 
4:4:4 */
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index f1312b3022..301b327bfd 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2614,8 +2614,8 @@ static int mov_write_video_tag(AVFormatContext *s, 
AVIOContext *pb, MOVMuxContex
|| (track->par->codec_id == AV_CODEC_ID_RAWVIDEO && 
track->par->format == AV_PIX_FMT_YUYV422)
|| (track->par->codec_id == AV_CODEC_ID_RAWVIDEO && 
track->par->format == AV_PIX_FMT_VYU444)
|| (track->par->codec_id == AV_CODEC_ID_RAWVIDEO && 
track->par->format == AV_PIX_FMT_UYVA)
-   ||  track->par->codec_id == AV_CODEC_ID_V308
 #if FF_API_V408_CODECID
+   ||  track->par->codec_id == AV_CODEC_ID_V308
||  track->par->codec_id == AV_CODEC_ID_V408
 #endif
||  track->par->codec_id == AV_CODEC_ID_V410
-- 
2.46.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg

[FFmpeg-devel] [PATCH 14/20] avutil/hwcontext_videotoolbox: add support for AYUV pixel format

2024-10-07 Thread James Almer
Signed-off-by: James Almer 
---
Untested

 libavutil/hwcontext_videotoolbox.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavutil/hwcontext_videotoolbox.c 
b/libavutil/hwcontext_videotoolbox.c
index 122a61d5e7..1d7dff4a7d 100644
--- a/libavutil/hwcontext_videotoolbox.c
+++ b/libavutil/hwcontext_videotoolbox.c
@@ -53,6 +53,7 @@ static const struct {
 #ifdef kCFCoreFoundationVersionNumber10_7
 { kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange,  false, AV_PIX_FMT_NV12 
},
 { kCVPixelFormatType_420YpCbCr8BiPlanarFullRange,   true,  AV_PIX_FMT_NV12 
},
+{ kCVPixelFormatType_AYpCbCr8,  false, AV_PIX_FMT_AYUV 
},
 { kCVPixelFormatType_AYpCbCr16, false, 
AV_PIX_FMT_AYUV64 },
 #endif
 #if HAVE_KCVPIXELFORMATTYPE_420YPCBCR10BIPLANARVIDEORANGE
@@ -86,6 +87,7 @@ static const struct {
 static const enum AVPixelFormat supported_formats[] = {
 #ifdef kCFCoreFoundationVersionNumber10_7
 AV_PIX_FMT_NV12,
+AV_PIX_FMT_AYUV,
 AV_PIX_FMT_AYUV64,
 #endif
 AV_PIX_FMT_YUV420P,
-- 
2.46.2

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

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


[FFmpeg-devel] [PATCH 16/20] avcodec/videotoolbox: choose AYUV pixel format when ideal

2024-10-07 Thread James Almer
Signed-off-by: James Almer 
---
Untested

 libavcodec/videotoolbox.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 90c1fbfb10..a606c29ded 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -1180,11 +1180,10 @@ static enum AVPixelFormat 
videotoolbox_best_pixel_format(AVCodecContext *avctx)
 if (!descriptor)
 return AV_PIX_FMT_NV12; // same as av_videotoolbox_alloc_context()
 
+depth = descriptor->comp[0].depth;
 
 if (descriptor->flags & AV_PIX_FMT_FLAG_ALPHA)
-return AV_PIX_FMT_AYUV64;
-
-depth = descriptor->comp[0].depth;
+return (depth > 8) ? AV_PIX_FMT_AYUV64 : AV_PIX_FMT_AYUV;
 
 #if HAVE_KCVPIXELFORMATTYPE_444YPCBCR16BIPLANARVIDEORANGE
 if (depth > 10)
-- 
2.46.2

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

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


[FFmpeg-devel] [PATCH] avcodec/hevc/ps: return a proper error code when we don't support parsing an sps

2024-10-07 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/hevc/ps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/hevc/ps.c b/libavcodec/hevc/ps.c
index c773d7d221..2f47410e66 100644
--- a/libavcodec/hevc/ps.c
+++ b/libavcodec/hevc/ps.c
@@ -1215,7 +1215,7 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, 
unsigned int *sps_id,
 if (sps->vps->nb_layers == 1) {
 av_log(avctx, AV_LOG_WARNING, "SPS %d references an unsupported 
VPS extension. Ignoring\n",
*sps_id);
-return AVERROR_INVALIDDATA;
+return AVERROR(ENOSYS);
 }
 
 if (get_bits1(gb) &&// update_rep_format_flag
-- 
2.46.2

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

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


[FFmpeg-devel] [PATCH v2 5/5] swscale/internal: constify and expose ff_swscale()

2024-10-07 Thread Niklas Haas
From: Niklas Haas 

Used as an intermediate entry point for the new swscale context. The extra
constification is a consistency measure, as I want to move the memcpy of
stride and plane pointers to the functions that actually need to mutate them.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas 
---
 libswscale/slice.c|  3 ++-
 libswscale/swscale.c  | 50 ---
 libswscale/swscale_internal.h |  8 +-
 3 files changed, 38 insertions(+), 23 deletions(-)

diff --git a/libswscale/slice.c b/libswscale/slice.c
index 1cc3f6c405..119bfbdb8d 100644
--- a/libswscale/slice.c
+++ b/libswscale/slice.c
@@ -145,7 +145,8 @@ int ff_rotate_slice(SwsSlice *s, int lum, int chr)
 return 0;
 }
 
-int ff_init_slice_from_src(SwsSlice * s, uint8_t *src[4], int stride[4], int 
srcW, int lumY, int lumH, int chrY, int chrH, int relative)
+int ff_init_slice_from_src(SwsSlice * s, uint8_t *const src[4], const int 
stride[4],
+   int srcW, int lumY, int lumH, int chrY, int chrH, 
int relative)
 {
 int i = 0;
 
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 5f77cad402..0f5e520515 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -233,10 +233,9 @@ static void lumRangeFromJpeg16_c(int16_t *_dst, int width)
 if (DEBUG_SWSCALE_BUFFERS)  \
 av_log(c, AV_LOG_DEBUG, __VA_ARGS__)
 
-static int swscale(SwsContext *c, const uint8_t *src[],
-   int srcStride[], int srcSliceY, int srcSliceH,
-   uint8_t *dst[], int dstStride[],
-   int dstSliceY, int dstSliceH)
+int ff_swscale(SwsContext *c, const uint8_t *const src[], const int 
srcStride[],
+   int srcSliceY, int srcSliceH, uint8_t *const dst[],
+   const int dstStride[], int dstSliceY, int dstSliceH)
 {
 const int scale_dst = dstSliceY > 0 || dstSliceH < c->dstH;
 
@@ -287,20 +286,29 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 int hasLumHoles = 1;
 int hasChrHoles = 1;
 
+const uint8_t *src2[4];
+int srcStride2[4];
+
 if (isPacked(c->srcFormat)) {
-src[1] =
-src[2] =
-src[3] = src[0];
-srcStride[1] =
-srcStride[2] =
-srcStride[3] = srcStride[0];
+src2[0] =
+src2[1] =
+src2[2] =
+src2[3] = src[0];
+srcStride2[0] =
+srcStride2[1] =
+srcStride2[2] =
+srcStride2[3] = srcStride[0];
+} else {
+memcpy(src2, src, sizeof(src2));
+memcpy(srcStride2, srcStride, sizeof(srcStride2));
 }
-srcStride[1] *= 1 << c->vChrDrop;
-srcStride[2] *= 1 << c->vChrDrop;
+
+srcStride2[1] *= 1 << c->vChrDrop;
+srcStride2[2] *= 1 << c->vChrDrop;
 
 DEBUG_BUFFERS("swscale() %p[%d] %p[%d] %p[%d] %p[%d] -> %p[%d] %p[%d] 
%p[%d] %p[%d]\n",
-  src[0], srcStride[0], src[1], srcStride[1],
-  src[2], srcStride[2], src[3], srcStride[3],
+  src2[0], srcStride2[0], src2[1], srcStride2[1],
+  src2[2], srcStride2[2], src2[3], srcStride2[3],
   dst[0], dstStride[0], dst[1], dstStride[1],
   dst[2], dstStride[2], dst[3], dstStride[3]);
 DEBUG_BUFFERS("srcSliceY: %d srcSliceH: %d dstY: %d dstH: %d\n",
@@ -320,10 +328,10 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 }
 
 #if ARCH_X86
-if (   (uintptr_t)dst[0]&15 || (uintptr_t)dst[1]&15 || (uintptr_t)dst[2]&15
-|| (uintptr_t)src[0]&15 || (uintptr_t)src[1]&15 || (uintptr_t)src[2]&15
-|| dstStride[0]&15 || dstStride[1]&15 || dstStride[2]&15 || 
dstStride[3]&15
-|| srcStride[0]&15 || srcStride[1]&15 || srcStride[2]&15 || 
srcStride[3]&15
+if (   (uintptr_t) dst[0]&15 || (uintptr_t) dst[1]&15 || (uintptr_t) 
dst[2]&15
+|| (uintptr_t)src2[0]&15 || (uintptr_t)src2[1]&15 || 
(uintptr_t)src2[2]&15
+||  dstStride[0]&15 ||  dstStride[1]&15 ||  dstStride[2]&15 ||  
dstStride[3]&15
+|| srcStride2[0]&15 || srcStride2[1]&15 || srcStride2[2]&15 || 
srcStride2[3]&15
 ) {
 SwsContext *const ctx = c->parent ? c->parent : c;
 int cpu_flags = av_get_cpu_flags();
@@ -356,7 +364,7 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 ff_init_vscale_pfn(c, yuv2plane1, yuv2planeX, yuv2nv12cX,
yuv2packed1, yuv2packed2, yuv2packedX, yuv2anyX, 
c->use_mmx_vfilter);
 
-ff_init_slice_from_src(src_slice, (uint8_t**)src, srcStride, c->srcW,
+ff_init_slice_from_src(src_slice, (uint8_t**)src2, srcStride2, c->srcW,
 srcSliceY, srcSliceH, chrSrcSliceY, chrSrcSliceH, 1);
 
 ff_init_slice_from_src(vout_slice, (uint8_t**)dst, dstStride, c->dstW,
@@ -1054,8 +1062,8 @@ static int scale_internal(SwsContext *c,
 if (scale_dst)
 dst2[0] += dstSliceY * dstStride2[0];
 } else {
-ret = swscale(c, src2, srcStride2, srcSliceY_internal, srcSliceH,
- 

[FFmpeg-devel] [PATCH v2 3/5] swscale/rgb2xyz: follow convention on image pointers and strides

2024-10-07 Thread Niklas Haas
From: Niklas Haas 

Instead of taking an int16_t pointer and a stride in halfwords, follow the
usual convention of treating all planes and strides as byte-addressed.

This does not have any immediate effect but makes these functions more
reusable without unintended "gotchas".

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas 
---
 libswscale/swscale.c | 83 
 1 file changed, 45 insertions(+), 38 deletions(-)

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 73264f3869..2d7b987071 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -637,23 +637,26 @@ static int check_image_pointers(const uint8_t * const 
data[4], enum AVPixelForma
 return 1;
 }
 
-static void xyz12Torgb48(struct SwsContext *c, uint16_t *dst,
- const uint16_t *src, int stride, int w, int h)
+static void xyz12Torgb48(struct SwsContext *c, uint8_t *dst, int dst_stride,
+ const uint8_t *src, int src_stride, int w, int h)
 {
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);
 
 for (int yp = 0; yp < h; yp++) {
+const uint16_t *src16 = (const uint16_t *) src;
+uint16_t *dst16 = (uint16_t *) dst;
+
 for (int xp = 0; xp < 3 * w; xp += 3) {
 int x, y, z, r, g, b;
 
 if (desc->flags & AV_PIX_FMT_FLAG_BE) {
-x = AV_RB16(src + xp + 0);
-y = AV_RB16(src + xp + 1);
-z = AV_RB16(src + xp + 2);
+x = AV_RB16(src16 + xp + 0);
+y = AV_RB16(src16 + xp + 1);
+z = AV_RB16(src16 + xp + 2);
 } else {
-x = AV_RL16(src + xp + 0);
-y = AV_RL16(src + xp + 1);
-z = AV_RL16(src + xp + 2);
+x = AV_RL16(src16 + xp + 0);
+y = AV_RL16(src16 + xp + 1);
+z = AV_RL16(src16 + xp + 2);
 }
 
 x = c->xyzgamma[x >> 4];
@@ -678,37 +681,41 @@ static void xyz12Torgb48(struct SwsContext *c, uint16_t 
*dst,
 
 // convert from sRGBlinear to RGB and scale from 12bit to 16bit
 if (desc->flags & AV_PIX_FMT_FLAG_BE) {
-AV_WB16(dst + xp + 0, c->rgbgamma[r] << 4);
-AV_WB16(dst + xp + 1, c->rgbgamma[g] << 4);
-AV_WB16(dst + xp + 2, c->rgbgamma[b] << 4);
+AV_WB16(dst16 + xp + 0, c->rgbgamma[r] << 4);
+AV_WB16(dst16 + xp + 1, c->rgbgamma[g] << 4);
+AV_WB16(dst16 + xp + 2, c->rgbgamma[b] << 4);
 } else {
-AV_WL16(dst + xp + 0, c->rgbgamma[r] << 4);
-AV_WL16(dst + xp + 1, c->rgbgamma[g] << 4);
-AV_WL16(dst + xp + 2, c->rgbgamma[b] << 4);
+AV_WL16(dst16 + xp + 0, c->rgbgamma[r] << 4);
+AV_WL16(dst16 + xp + 1, c->rgbgamma[g] << 4);
+AV_WL16(dst16 + xp + 2, c->rgbgamma[b] << 4);
 }
 }
-src += stride;
-dst += stride;
+
+src += src_stride;
+dst += dst_stride;
 }
 }
 
-static void rgb48Toxyz12(struct SwsContext *c, uint16_t *dst,
- const uint16_t *src, int stride, int w, int h)
+static void rgb48Toxyz12(struct SwsContext *c, uint8_t *dst, int dst_stride,
+ const uint8_t *src, int src_stride, int w, int h)
 {
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->dstFormat);
 
 for (int yp = 0; yp < h; yp++) {
+uint16_t *src16 = (uint16_t *) src;
+uint16_t *dst16 = (uint16_t *) dst;
+
 for (int xp = 0; xp < 3 * w; xp += 3) {
 int x, y, z, r, g, b;
 
 if (desc->flags & AV_PIX_FMT_FLAG_BE) {
-r = AV_RB16(src + xp + 0);
-g = AV_RB16(src + xp + 1);
-b = AV_RB16(src + xp + 2);
+r = AV_RB16(src16 + xp + 0);
+g = AV_RB16(src16 + xp + 1);
+b = AV_RB16(src16 + xp + 2);
 } else {
-r = AV_RL16(src + xp + 0);
-g = AV_RL16(src + xp + 1);
-b = AV_RL16(src + xp + 2);
+r = AV_RL16(src16 + xp + 0);
+g = AV_RL16(src16 + xp + 1);
+b = AV_RL16(src16 + xp + 2);
 }
 
 r = c->rgbgammainv[r>>4];
@@ -733,17 +740,18 @@ static void rgb48Toxyz12(struct SwsContext *c, uint16_t 
*dst,
 
 // convert from XYZlinear to X'Y'Z' and scale from 12bit to 16bit
 if (desc->flags & AV_PIX_FMT_FLAG_BE) {
-AV_WB16(dst + xp + 0, c->xyzgammainv[x] << 4);
-AV_WB16(dst + xp + 1, c->xyzgammainv[y] << 4);
-AV_WB16(dst + xp + 2, c->xyzgammainv[z] << 4);
+AV_WB16(dst16 + xp + 0, c->xyzgammainv[x] << 4);
+AV_WB16(dst16 + xp + 1, c->xyzgammainv[y] << 4);
+AV_WB16(dst16 + xp + 2, c->xyzgammainv[z] << 4);
   

[FFmpeg-devel] [PATCH v2 1/5] swscale/rgb2xyz: minor style fixes

2024-10-07 Thread Niklas Haas
From: Niklas Haas 

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas 
---
 libswscale/swscale.c | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 0abc84d33b..fa8eed10d9 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -640,11 +640,10 @@ static int check_image_pointers(const uint8_t * const 
data[4], enum AVPixelForma
 static void xyz12Torgb48(struct SwsContext *c, uint16_t *dst,
  const uint16_t *src, int stride, int h)
 {
-int xp,yp;
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);
 
-for (yp=0; ypflags & AV_PIX_FMT_FLAG_BE) {
@@ -657,9 +656,9 @@ static void xyz12Torgb48(struct SwsContext *c, uint16_t 
*dst,
 z = AV_RL16(src + xp + 2);
 }
 
-x = c->xyzgamma[x>>4];
-y = c->xyzgamma[y>>4];
-z = c->xyzgamma[z>>4];
+x = c->xyzgamma[x >> 4];
+y = c->xyzgamma[y >> 4];
+z = c->xyzgamma[z >> 4];
 
 // convert from XYZlinear to sRGBlinear
 r = c->xyz2rgb_matrix[0][0] * x +
@@ -696,11 +695,10 @@ static void xyz12Torgb48(struct SwsContext *c, uint16_t 
*dst,
 static void rgb48Toxyz12(struct SwsContext *c, uint16_t *dst,
  const uint16_t *src, int stride, int h)
 {
-int xp,yp;
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->dstFormat);
 
-for (yp=0; ypflags & AV_PIX_FMT_FLAG_BE) {
-- 
2.46.1

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

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


[FFmpeg-devel] [PATCH v2 2/5] swscale/rgb2xyz: add explicit width parameter

2024-10-07 Thread Niklas Haas
From: Niklas Haas 

This fixes an 11-year-old bug in the rgb2xyz functions, when used with a
negative stride. The current loop bounds turned it into a no-op.

Additionally, this increases performance on highly cropped images, whose
stride may be substantially higher than the effective width.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas 
---
 libswscale/swscale.c| 13 +++--
 tests/ref/fate/filter-pixfmts-vflip |  4 ++--
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index fa8eed10d9..73264f3869 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -638,12 +638,12 @@ static int check_image_pointers(const uint8_t * const 
data[4], enum AVPixelForma
 }
 
 static void xyz12Torgb48(struct SwsContext *c, uint16_t *dst,
- const uint16_t *src, int stride, int h)
+ const uint16_t *src, int stride, int w, int h)
 {
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);
 
 for (int yp = 0; yp < h; yp++) {
-for (int xp = 0; xp + 2 < stride; xp += 3) {
+for (int xp = 0; xp < 3 * w; xp += 3) {
 int x, y, z, r, g, b;
 
 if (desc->flags & AV_PIX_FMT_FLAG_BE) {
@@ -693,12 +693,12 @@ static void xyz12Torgb48(struct SwsContext *c, uint16_t 
*dst,
 }
 
 static void rgb48Toxyz12(struct SwsContext *c, uint16_t *dst,
- const uint16_t *src, int stride, int h)
+ const uint16_t *src, int stride, int w, int h)
 {
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->dstFormat);
 
 for (int yp = 0; yp < h; yp++) {
-for (int xp = 0; xp + 2 < stride; xp += 3) {
+for (int xp = 0; xp < 3 * w; xp += 3) {
 int x, y, z, r, g, b;
 
 if (desc->flags & AV_PIX_FMT_FLAG_BE) {
@@ -993,7 +993,8 @@ static int scale_internal(SwsContext *c,
 base = srcStride[0] < 0 ? c->xyz_scratch - srcStride[0] * 
(srcSliceH-1) :
   c->xyz_scratch;
 
-xyz12Torgb48(c, (uint16_t*)base, (const uint16_t*)src2[0], 
srcStride[0]/2, srcSliceH);
+xyz12Torgb48(c, (uint16_t*)base, (const uint16_t*)src2[0], 
srcStride[0]/2,
+ c->srcW, srcSliceH);
 src2[0] = base;
 }
 
@@ -1065,7 +1066,7 @@ static int scale_internal(SwsContext *c,
 }
 
 /* replace on the same data */
-rgb48Toxyz12(c, dst16, dst16, dstStride2[0]/2, ret);
+rgb48Toxyz12(c, dst16, dst16, dstStride2[0]/2, c->dstW, ret);
 }
 
 /* reset slice direction at end of frame */
diff --git a/tests/ref/fate/filter-pixfmts-vflip 
b/tests/ref/fate/filter-pixfmts-vflip
index 5ba28917a7..4cc716799f 100644
--- a/tests/ref/fate/filter-pixfmts-vflip
+++ b/tests/ref/fate/filter-pixfmts-vflip
@@ -103,8 +103,8 @@ x2bgr10le   795b66a5fc83cd2cf300aae51c230f80
 x2rgb10le   262c502230cf3724f8e2cf4737f18a42
 xv30le  7e29ee107a1fabf3c7251f337d4b9fe5
 xv36le  bf1cbef0745f90881e15f5c5db3c5949
-xyz12be 810644e008deb231850d779aaa27cc7e
-xyz12le 829701db461b43533cf9241e0743bc61
+xyz12be 23fa9fb36d49dce61e284d41b83e0e6b
+xyz12le ef73e6d1f932a9a355df1eedd628394f
 y210le  9544c81f8e1fc95e9fa4009dbecfea25
 y212le  c801725ae31e3b8f5be269359d49f191
 ya16be  55b1dbbe4d56ed0d22461685ce85520d
-- 
2.46.1

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

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


[FFmpeg-devel] [PATCH v2 4/5] swscale/rgb2xyz: expose these functions internally

2024-10-07 Thread Niklas Haas
From: Niklas Haas 

---
 libswscale/swscale.c  | 12 ++--
 libswscale/swscale_internal.h |  6 ++
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 2d7b987071..5f77cad402 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -637,8 +637,8 @@ static int check_image_pointers(const uint8_t * const 
data[4], enum AVPixelForma
 return 1;
 }
 
-static void xyz12Torgb48(struct SwsContext *c, uint8_t *dst, int dst_stride,
- const uint8_t *src, int src_stride, int w, int h)
+void ff_xyz12Torgb48(const SwsContext *c, uint8_t *dst, int dst_stride,
+ const uint8_t *src, int src_stride, int w, int h)
 {
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->srcFormat);
 
@@ -696,8 +696,8 @@ static void xyz12Torgb48(struct SwsContext *c, uint8_t 
*dst, int dst_stride,
 }
 }
 
-static void rgb48Toxyz12(struct SwsContext *c, uint8_t *dst, int dst_stride,
- const uint8_t *src, int src_stride, int w, int h)
+void ff_rgb48Toxyz12(const SwsContext *c, uint8_t *dst, int dst_stride,
+ const uint8_t *src, int src_stride, int w, int h)
 {
 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(c->dstFormat);
 
@@ -1001,7 +1001,7 @@ static int scale_internal(SwsContext *c,
 base = srcStride[0] < 0 ? c->xyz_scratch - srcStride[0] * 
(srcSliceH-1) :
   c->xyz_scratch;
 
-xyz12Torgb48(c, base, srcStride[0], src2[0], srcStride[0], c->srcW, 
srcSliceH);
+ff_xyz12Torgb48(c, base, srcStride[0], src2[0], srcStride[0], c->srcW, 
srcSliceH);
 src2[0] = base;
 }
 
@@ -1073,7 +1073,7 @@ static int scale_internal(SwsContext *c,
 }
 
 /* replace on the same data */
-rgb48Toxyz12(c, dst, dstStride2[0], dst, dstStride2[0], c->dstW, ret);
+ff_rgb48Toxyz12(c, dst, dstStride2[0], dst, dstStride2[0], c->dstW, 
ret);
 }
 
 /* reset slice direction at end of frame */
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index 1a991f11d8..cbafb9c8b4 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -1034,6 +1034,12 @@ void ff_copyPlane(const uint8_t *src, int srcStride,
   int srcSliceY, int srcSliceH, int width,
   uint8_t *dst, int dstStride);
 
+void ff_xyz12Torgb48(const SwsContext *c, uint8_t *dst, int dst_stride,
+ const uint8_t *src, int src_stride, int w, int h);
+
+void ff_rgb48Toxyz12(const SwsContext *c, uint8_t *dst, int dst_stride,
+ const uint8_t *src, int src_stride, int w, int h);
+
 static inline void fillPlane16(uint8_t *plane, int stride, int width, int 
height, int y,
int alpha, int bits, const int big_endian)
 {
-- 
2.46.1

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

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


[FFmpeg-devel] [PATCH 4/5] fftools/ffmpeg_filter: do not leak graph_desc on fg_create() failure

2024-10-07 Thread Anton Khirnov
fg_create() is passed a malloced string and assumed to always tak
ownership of it.
---
 fftools/ffmpeg_filter.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index faab003e71..4d444c161f 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -1058,8 +1058,10 @@ int fg_create(FilterGraph **pfg, char *graph_desc, 
Scheduler *sch)
 int ret = 0;
 
 fgp = av_mallocz(sizeof(*fgp));
-if (!fgp)
+if (!fgp) {
+av_freep(&graph_desc);
 return AVERROR(ENOMEM);
+}
 fg = &fgp->fg;
 
 if (pfg) {
@@ -1068,6 +1070,7 @@ int fg_create(FilterGraph **pfg, char *graph_desc, 
Scheduler *sch)
 } else {
 ret = av_dynarray_add_nofree(&filtergraphs, &nb_filtergraphs, fgp);
 if (ret < 0) {
+av_freep(&graph_desc);
 av_freep(&fgp);
 return ret;
 }
-- 
2.43.0

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

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


[FFmpeg-devel] [PATCH 2/5] fftools/cmdutils: do not treat single '-' as an option in locate_option()

2024-10-07 Thread Anton Khirnov
Fixes early parsing of trailing -v/-loglevel while using '-' to output
to stdout.
---
 fftools/cmdutils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 9eb49dbf20..8ac20bf049 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -492,8 +492,9 @@ int locate_option(int argc, char **argv, const OptionDef 
*options,
 for (i = 1; i < argc; i++) {
 const char *cur_opt = argv[i];
 
-if (*cur_opt++ != '-')
+if (!(cur_opt[0] == '-' && cur_opt[1]))
 continue;
+cur_opt++;
 
 po = find_option(options, cur_opt);
 if (!po->name && cur_opt[0] == 'n' && cur_opt[1] == 'o')
-- 
2.43.0

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

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


[FFmpeg-devel] [PATCH 1/5] fftools/cmdutils: group related calls together

2024-10-07 Thread Anton Khirnov
For readability only, should have no functional effect.
---
 fftools/cmdutils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 9beed94ead..9eb49dbf20 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -551,11 +551,12 @@ static void check_options(const OptionDef *po)
 
 void parse_loglevel(int argc, char **argv, const OptionDef *options)
 {
-int idx = locate_option(argc, argv, options, "loglevel");
+int idx;
 char *env;
 
 check_options(options);
 
+idx = locate_option(argc, argv, options, "loglevel");
 if (!idx)
 idx = locate_option(argc, argv, options, "v");
 if (idx && argv[idx + 1])
-- 
2.43.0

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

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


[FFmpeg-devel] [PATCH v2 05/20] swscale/input: add AYUV input support

2024-10-07 Thread James Almer
Signed-off-by: James Almer 
---
 libswscale/input.c | 35 +++
 libswscale/utils.c |  1 +
 2 files changed, 36 insertions(+)

diff --git a/libswscale/input.c b/libswscale/input.c
index 2a7a6c91dd..fd8077c455 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -710,6 +710,32 @@ static void read_vuya_A_c(uint8_t *dst, const uint8_t 
*src, const uint8_t *unuse
 dst[i] = src[i * 4 + 3];
 }
 
+static void read_ayuv_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t 
*unused0, const uint8_t *src,
+   const uint8_t *unused1, int width, uint32_t 
*unused2, void *opq)
+{
+int i;
+for (i = 0; i < width; i++) {
+dstU[i] = src[i * 4 + 2];
+dstV[i] = src[i * 4 + 3];
+}
+}
+
+static void read_ayuv_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t 
*unused0, const uint8_t *unused1, int width,
+  uint32_t *unused2, void *opq)
+{
+int i;
+for (i = 0; i < width; i++)
+dst[i] = src[i * 4 + 1];
+}
+
+static void read_ayuv_A_c(uint8_t *dst, const uint8_t *src, const uint8_t 
*unused0, const uint8_t *unused1, int width,
+  uint32_t *unused2, void *opq)
+{
+int i;
+for (i = 0; i < width; i++)
+dst[i] = src[i * 4];
+}
+
 static void read_xv30le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t 
*unused0, const uint8_t *unused1, int width,
uint32_t *unused2, void *opq)
 {
@@ -1444,6 +1470,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c,
 case AV_PIX_FMT_XV30LE:
 *chrToYV12 = read_xv30le_UV_c;
 break;
+case AV_PIX_FMT_AYUV:
+*chrToYV12 = read_ayuv_UV_c;
+break;
 case AV_PIX_FMT_AYUV64LE:
 *chrToYV12 = read_ayuv64le_UV_c;
 break;
@@ -1845,6 +1874,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c,
 case AV_PIX_FMT_XV30LE:
 *lumToYV12 = read_xv30le_Y_c;
 break;
+case AV_PIX_FMT_AYUV:
+*lumToYV12 = read_ayuv_Y_c;
+break;
 case AV_PIX_FMT_AYUV64LE:
 *lumToYV12 = read_ayuv64le_Y_c;
 break;
@@ -2031,6 +2063,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c,
 case AV_PIX_FMT_VUYA:
 *alpToYV12 = read_vuya_A_c;
 break;
+case AV_PIX_FMT_AYUV:
+*alpToYV12 = read_ayuv_A_c;
+break;
 case AV_PIX_FMT_AYUV64LE:
 *alpToYV12 = read_ayuv64le_A_c;
 break;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 642e34c46c..403444b309 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -268,6 +268,7 @@ static const FormatEntry format_entries[] = {
 [AV_PIX_FMT_RGBAF16LE]   = { 1, 0 },
 [AV_PIX_FMT_XV30LE]  = { 1, 1 },
 [AV_PIX_FMT_XV36LE]  = { 1, 1 },
+[AV_PIX_FMT_AYUV]= { 1, 0 },
 };
 
 /**
-- 
2.46.2

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

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


[FFmpeg-devel] [PATCH v2 07/20] swscale/input: add VYU444 input support

2024-10-07 Thread James Almer
Signed-off-by: James Almer 
---
 libswscale/input.c | 24 
 libswscale/utils.c |  1 +
 2 files changed, 25 insertions(+)

diff --git a/libswscale/input.c b/libswscale/input.c
index 15b0957fce..721f3a9645 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -746,6 +746,24 @@ static void read_uyva_UV_c(uint8_t *dstU, uint8_t *dstV, 
const uint8_t *unused0,
 }
 }
 
+static void vyuToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, 
const uint8_t *unused1, int width,
+ uint32_t *unused2, void *opq)
+{
+int i;
+for (i = 0; i < width; i++)
+dst[i] = src[i * 3 + 1];
+}
+
+static void vyuToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, 
const uint8_t *src,
+  const uint8_t *unused1, int width, uint32_t *unused2, 
void *opq)
+{
+int i;
+for (i = 0; i < width; i++) {
+dstU[i] = src[i * 3 + 2];
+dstV[i] = src[i * 3];
+}
+}
+
 static void read_xv30le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t 
*unused0, const uint8_t *unused1, int width,
uint32_t *unused2, void *opq)
 {
@@ -1342,6 +1360,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c,
 case AV_PIX_FMT_UYVY422:
 *chrToYV12 = uyvyToUV_c;
 break;
+case AV_PIX_FMT_VYU444:
+*chrToYV12 = vyuToUV_c;
+break;
 case AV_PIX_FMT_NV12:
 case AV_PIX_FMT_NV16:
 case AV_PIX_FMT_NV24:
@@ -1905,6 +1926,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c,
 case AV_PIX_FMT_UYVY422:
 *lumToYV12 = uyvyToY_c;
 break;
+case AV_PIX_FMT_VYU444:
+*lumToYV12 = vyuToY_c;
+break;
 case AV_PIX_FMT_BGR24:
 *lumToYV12 = bgr24ToY_c;
 break;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 978a2e1f09..9caf392993 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -270,6 +270,7 @@ static const FormatEntry format_entries[] = {
 [AV_PIX_FMT_XV36LE]  = { 1, 1 },
 [AV_PIX_FMT_AYUV]= { 1, 0 },
 [AV_PIX_FMT_UYVA]= { 1, 0 },
+[AV_PIX_FMT_VYU444]  = { 1, 0 },
 };
 
 /**
-- 
2.46.2

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

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


[FFmpeg-devel] [PATCH v2 06/20] swscale/input: add UYVA input support

2024-10-07 Thread James Almer
Signed-off-by: James Almer 
---
 libswscale/input.c | 14 ++
 libswscale/utils.c |  1 +
 2 files changed, 15 insertions(+)

diff --git a/libswscale/input.c b/libswscale/input.c
index fd8077c455..15b0957fce 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -736,6 +736,16 @@ static void read_ayuv_A_c(uint8_t *dst, const uint8_t 
*src, const uint8_t *unuse
 dst[i] = src[i * 4];
 }
 
+static void read_uyva_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t 
*unused0, const uint8_t *src,
+   const uint8_t *unused1, int width, uint32_t 
*unused2, void *opq)
+{
+int i;
+for (i = 0; i < width; i++) {
+dstU[i] = src[i * 4];
+dstV[i] = src[i * 4 + 2];
+}
+}
+
 static void read_xv30le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t 
*unused0, const uint8_t *unused1, int width,
uint32_t *unused2, void *opq)
 {
@@ -1476,6 +1486,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c,
 case AV_PIX_FMT_AYUV64LE:
 *chrToYV12 = read_ayuv64le_UV_c;
 break;
+case AV_PIX_FMT_UYVA:
+*chrToYV12 = read_uyva_UV_c;
+break;
 case AV_PIX_FMT_XV36LE:
 *chrToYV12 = read_xv36le_UV_c;
 break;
@@ -1875,6 +1888,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c,
 *lumToYV12 = read_xv30le_Y_c;
 break;
 case AV_PIX_FMT_AYUV:
+case AV_PIX_FMT_UYVA:
 *lumToYV12 = read_ayuv_Y_c;
 break;
 case AV_PIX_FMT_AYUV64LE:
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 403444b309..978a2e1f09 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -269,6 +269,7 @@ static const FormatEntry format_entries[] = {
 [AV_PIX_FMT_XV30LE]  = { 1, 1 },
 [AV_PIX_FMT_XV36LE]  = { 1, 1 },
 [AV_PIX_FMT_AYUV]= { 1, 0 },
+[AV_PIX_FMT_UYVA]= { 1, 0 },
 };
 
 /**
-- 
2.46.2

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

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


Re: [FFmpeg-devel] [PATCH 09/12] swscale/internal: constify SwsFunc

2024-10-07 Thread Niklas Haas
On Mon, 07 Oct 2024 16:53:41 -0400 Sean McGovern  wrote:
> Hi,
> 
> On Sun, Oct 6, 2024 at 6:31 PM Michael Niedermayer
>  wrote:
> >
> > On Sat, Oct 05, 2024 at 09:24:00PM +0200, Niklas Haas wrote:
> > > From: Niklas Haas 
> > >
> > > I want to move away from having random leaf processing functions mutate
> > > plane pointers, and while we're at it, we might as well make the strides
> > > and tables const as well.
> > >
> > > Sponsored-by: Sovereign Tech Fund
> > > Signed-off-by: Niklas Haas 
> > > ---
> > >  libswscale/aarch64/swscale_unscaled.c |  34 ++--
> > >  libswscale/alphablend.c   |   6 +-
> > >  libswscale/arm/swscale_unscaled.c |  26 +--
> > >  libswscale/bayer_template.c   |   4 +-
> > >  libswscale/loongarch/yuv2rgb_lasx.c   |  12 +-
> > >  libswscale/loongarch/yuv2rgb_lsx.c|  12 +-
> > >  libswscale/ppc/yuv2rgb_altivec.c  |  12 +-
> > >  libswscale/rgb2rgb.c  |   2 +-
> > >  libswscale/rgb2rgb.h  |   4 +-
> > >  libswscale/rgb2rgb_template.c |   2 +-
> > >  libswscale/swscale_internal.h |  12 +-
> > >  libswscale/swscale_unscaled.c | 242 +-
> > >  libswscale/x86/yuv2rgb.c  |  54 +++---
> > >  libswscale/yuv2rgb.c  |   6 +-
> > >  14 files changed, 220 insertions(+), 208 deletions(-)
> >
> > should be ok
> 
> Sorry for not checking this earlier, but PowerPC 32- and 64-bit builds
> with AltiVec enabled now fail with:
> 
> src/libswscale/ppc/yuv2yuv_altivec.c: In function 
> ‘ff_get_unscaled_swscale_ppc’:
> src/libswscale/ppc/yuv2yuv_altivec.c:199:33: error: assignment to
> ‘SwsFunc’ {aka ‘int (*)(SwsContext *, const unsigned char * const*,
> const int *, int,  int,  unsigned char * const*, const int *)’} from
> incompatible pointer type ‘int (*)(SwsContext *, const uint8_t **, int
> *, int,  int,  uint8_t **, int *)’ {aka ‘int (*)(SwsContext *, const
> unsigned char **, int *, int,  int,  unsigned char **, int *)’}
> [-Wincompatible-pointer-types]
>   199 | c->convert_unscaled = yv12toyuy2_unscaled_altivec;
>   | ^
> src/libswscale/ppc/yuv2yuv_altivec.c:201:33: error: assignment to
> ‘SwsFunc’ {aka ‘int (*)(SwsContext *, const unsigned char * const*,
> const int *, int,  int,  unsigned char * const*, const int *)’} from
> incompatible pointer type ‘int (*)(SwsContext *, const uint8_t **, int
> *, int,  int,  uint8_t **, int *)’ {aka ‘int (*)(SwsContext *, const
> unsigned char **, int *, int,  int,  unsigned char **, int *)’}
> [-Wincompatible-pointer-types]
>   201 | c->convert_unscaled = yv12touyvy_unscaled_altivec;
>   | ^
> make: *** [src/ffbuild/common.mak:81: libswscale/ppc/yuv2yuv_altivec.o] Error 
> 1

My bad for missing this one. Is there a public way I can test build on different
platforms before submitting series? I would have thought that posting it on the
ML is enough to trigger FATE runs on all platforms, but I didn't get any email
reply to the series.

Anyway, this should fix it:

diff --git a/libswscale/ppc/yuv2yuv_altivec.c b/libswscale/ppc/yuv2yuv_altivec.c
index 728e4d210c..d63feb6012 100644
--- a/libswscale/ppc/yuv2yuv_altivec.c
+++ b/libswscale/ppc/yuv2yuv_altivec.c
@@ -31,10 +31,10 @@
 
 #if HAVE_ALTIVEC
 
-static int yv12toyuy2_unscaled_altivec(SwsContext *c, const uint8_t *src[],
-   int srcStride[], int srcSliceY,
-   int srcSliceH, uint8_t *dstParam[],
-   int dstStride_a[])
+static int yv12toyuy2_unscaled_altivec(SwsContext *c, const uint8_t *const 
src[],
+   const int srcStride[], int srcSliceY,
+   int srcSliceH, uint8_t *const 
dstParam[],
+   const int dstStride_a[])
 {
 uint8_t *dst = dstParam[0] + dstStride_a[0] * srcSliceY;
 // yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH,
@@ -107,10 +107,10 @@ static int yv12toyuy2_unscaled_altivec(SwsContext *c, 
const uint8_t *src[],
 return srcSliceH;
 }
 
-static int yv12touyvy_unscaled_altivec(SwsContext *c, const uint8_t *src[],
-   int srcStride[], int srcSliceY,
-   int srcSliceH, uint8_t *dstParam[],
-   int dstStride_a[])
+static int yv12touyvy_unscaled_altivec(SwsContext *c, const uint8_t *const 
src[],
+   const int srcStride[], int srcSliceY,
+   int srcSliceH, uint8_t *const 
dstParam[],
+   const int dstStride_a[])
 {
 uint8_t *dst = dstParam[0] + dstStride_a[0] * srcSliceY;
 // yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH,

> 
> >
> >
> > thx
> >
> > [...]
> >
> > --
> > Michael GnuPG fingerprint: 9FF212

Re: [FFmpeg-devel] [PATCH 12/12] swscale/input: parametrize ff_sws_init_input_funcs() pointers

2024-10-07 Thread Niklas Haas
On Mon, 07 Oct 2024 20:14:50 -0300 James Almer  wrote:
> On 10/5/2024 4:24 PM, Niklas Haas wrote:
> > From: Niklas Haas 
> > 
> > Following the precedent set by ff_sws_init_output_funcs().
> > 
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Niklas Haas 
> > ---
> >   libswscale/input.c| 388 +-
> >   libswscale/swscale.c  |   3 +-
> >   libswscale/swscale_internal.h |   8 +-
> >   3 files changed, 206 insertions(+), 193 deletions(-)
> > 
> > diff --git a/libswscale/input.c b/libswscale/input.c
> > index d171394bb2..2a7a6c91dd 100644
> > --- a/libswscale/input.c
> > +++ b/libswscale/input.c
> > @@ -1285,86 +1285,92 @@ static void rgbaf16##endian_name##ToA_c(uint8_t 
> > *_dst, const uint8_t *_src, cons
> >   rgbaf16_funcs_endian(le, 0)
> >   rgbaf16_funcs_endian(be, 1)
> >   
> > -av_cold void ff_sws_init_input_funcs(SwsContext *c)
> > +av_cold void ff_sws_init_input_funcs(SwsContext *c,
> > + planar1_YV12_fn *lumToYV12,
> > + planar1_YV12_fn *alpToYV12,
> > + planar2_YV12_fn *chrToYV12,
> > + planarX_YV12_fn *readLumPlanar,
> > + planarX_YV12_fn *readAlpPlanar,
> > + planarX2_YV12_fn *readChrPlanar)
> 
> Is ff_sws_init_input_funcs() going to be called with function pointers 
> from other than the input SwsContext at some point?

The other functions will be used by my upcoming series. (ETA ~1 week)

This specific function is admittedly not yet used directly, but refactoring
input handling is next on my list for the ongoing rewrite.

> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 2/2] avcodec/hevc/ps: print a more accurate message when parsing an SPS for an unsupported layer

2024-10-07 Thread Anton Khirnov
Quoting James Almer (2024-10-03 19:54:28)
> With multilayer001.heic:
> 
> Before:
> [hevc @ ...] Scalability type 2 not supported
> [hevc @ ...] Ignoring unsupported VPS extension
> [hevc @ ...] The following bit-depths are currently specified: 8, 9, 10 and 
> 12 bits, chroma_format_idc is 0, depth is 0
> 
> After:
> [hevc @ ...] Scalability type 2 not supported
> [hevc @ ...] Ignoring unsupported VPS extension
> [hevc @ ...] SPS 1 references an unsupported VPS extension. Ignoring
> 
> Signed-off-by: James Almer 
> ---
>  libavcodec/hevc/ps.c | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/libavcodec/hevc/ps.c b/libavcodec/hevc/ps.c
> index 3fc14c1e72..993c60144f 100644
> --- a/libavcodec/hevc/ps.c
> +++ b/libavcodec/hevc/ps.c
> @@ -1207,6 +1207,12 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, 
> unsigned int *sps_id,
>  if (multi_layer_ext) {
>  const RepFormat *rf = &sps->vps->rep_format;
>  
> +if (sps->vps->nb_layers == 1) {
> +av_log(avctx, AV_LOG_WARNING, "SPS %d references an unsupported 
> VPS extension. Ignoring\n",
> +   *sps_id);
> +return AVERROR_INVALIDDATA;

Should be ENOSYS, the data is not invalid.

-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] configure: add spirv_compiler to avfilter_suggest as well

2024-10-07 Thread Hendrik Leppkes
On Mon, Oct 7, 2024 at 9:15 AM Lynne via ffmpeg-devel
 wrote:
>
> If someone were to enable libglslang/libshaderc, and then disable
> all Vulkan filters, they would have the same issue as the earlier
> fix for libavcodec.

If you run such a setup, shouldn't the code that uses this then be excluded?

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

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


[FFmpeg-devel] [PATCH] configure: add spirv_compiler to avfilter_suggest as well

2024-10-07 Thread Lynne via ffmpeg-devel
If someone were to enable libglslang/libshaderc, and then disable
all Vulkan filters, they would have the same issue as the earlier
fix for libavcodec.
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 1006ac98e2..461586cdb8 100755
--- a/configure
+++ b/configure
@@ -4043,7 +4043,7 @@ avcodec_suggest="libm stdatomic spirv_compiler"
 avdevice_deps="avformat avcodec avutil"
 avdevice_suggest="libm stdatomic"
 avfilter_deps="avutil"
-avfilter_suggest="libm stdatomic"
+avfilter_suggest="libm stdatomic spirv_compiler"
 avformat_deps="avcodec avutil"
 avformat_suggest="libm network zlib stdatomic"
 avutil_suggest="clock_gettime ffnvcodec gcrypt libm libdrm libmfx opencl 
openssl user32 vaapi vulkan videotoolbox corefoundation corevideo coremedia 
bcrypt stdatomic"
-- 
2.45.2.753.g447d99e1c3b
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH] configure: explicitly disable spirv_compiler

2024-10-07 Thread Lynne via ffmpeg-devel
spirv_compiler is an undeclared variable that was spontaneously
enabled if libshaderc or libglslang were detected, and served as
a way to enable filters.

However, it being undeclared had the effect that it was neither
considered explicitly disabled nor enabled if libshaderc or
libglslang were detected.

The only category we have which explicitly disables variables
is EXTERNAL_LIBRARY_LIST, however, spirv_compiler is not a real
external library, and making it present there would report its
detection on ./configure.
---
 configure | 9 +
 1 file changed, 9 insertions(+)

diff --git a/configure b/configure
index 1006ac98e2..8dfbf637d4 100755
--- a/configure
+++ b/configure
@@ -6553,6 +6553,15 @@ if test -n "$custom_allocator"; then
 add_extralibs "$custom_allocator_extralibs"
 fi
 
+# Unlike other feature flags or libraries, spirv_compiler is not defined
+# within any of our predefined categories of components.
+# It gets defined if either libshaderc or libglslang check succeeds.
+# As such, its in a state of neither being explicitly enabled, nor
+# explicitly disabled, but even in this state, being mentioned in
+# _deps results in it always passing.
+# Disable it explicitly to fix this.
+disable spirv_compiler
+
 check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
 check_func  ${malloc_prefix}memalign&& enable memalign
 check_func  ${malloc_prefix}posix_memalign  && enable posix_memalign
-- 
2.45.2.753.g447d99e1c3b
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] configure: add spirv_compiler to avfilter_suggest as well

2024-10-07 Thread Lynne via ffmpeg-devel

On 07/10/2024 09:28, Hendrik Leppkes wrote:

On Mon, Oct 7, 2024 at 9:15 AM Lynne via ffmpeg-devel
 wrote:


If someone were to enable libglslang/libshaderc, and then disable
all Vulkan filters, they would have the same issue as the earlier
fix for libavcodec.


If you run such a setup, shouldn't the code that uses this then be excluded?


No, the files are always compiled if the user enabled support.
> OBJS-$(CONFIG_LIBGLSLANG)+= vulkan_glslang.o
> OBJS-$(CONFIG_LIBSHADERC)+= vulkan_shaderc.o

We do the same for qsv.
If we only supported a single SPIRV compiler, we could have instead 
added the file to every filter, but unfortunately, both libraries are 
used more or less equally by distributions and users.


OpenPGP_0xA2FEA5F03F034464.asc
Description: OpenPGP public key


OpenPGP_signature.asc
Description: OpenPGP digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH 3/5] fftools/ffmpeg_opt: add a struct to be passed as opaque to global-option handlers

2024-10-07 Thread Anton Khirnov
Will be useful in following commits.
---
 fftools/ffmpeg_opt.c | 21 ++---
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index f639a1cf0a..052e68e943 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -86,6 +86,12 @@ int ignore_unknown_streams = 0;
 int copy_unknown_streams = 0;
 int recast_media = 0;
 
+// this struct is passed as the optctx argument
+// to func_arg() for global options
+typedef struct GlobalOptionsContext {
+Scheduler  *sch;
+} GlobalOptionsContext;
+
 static void uninit_options(OptionsContext *o)
 {
 /* all OPT_SPEC and OPT_TYPE_STRING can be freed in generic way */
@@ -611,8 +617,8 @@ static int opt_attach(void *optctx, const char *opt, const 
char *arg)
 
 static int opt_sdp_file(void *optctx, const char *opt, const char *arg)
 {
-Scheduler *sch = optctx;
-return sch_sdp_filename(sch, arg);
+GlobalOptionsContext *go = optctx;
+return sch_sdp_filename(go->sch, arg);
 }
 
 #if CONFIG_VAAPI
@@ -1150,18 +1156,18 @@ static int opt_audio_qscale(void *optctx, const char 
*opt, const char *arg)
 
 static int opt_filter_complex(void *optctx, const char *opt, const char *arg)
 {
-Scheduler *sch = optctx;
+GlobalOptionsContext *go = optctx;
 char *graph_desc = av_strdup(arg);
 if (!graph_desc)
 return AVERROR(ENOMEM);
 
-return fg_create(NULL, graph_desc, sch);
+return fg_create(NULL, graph_desc, go->sch);
 }
 
 #if FFMPEG_OPT_FILTER_SCRIPT
 static int opt_filter_complex_script(void *optctx, const char *opt, const char 
*arg)
 {
-Scheduler *sch = optctx;
+GlobalOptionsContext *go = optctx;
 char *graph_desc = file_read(arg);
 if (!graph_desc)
 return AVERROR(EINVAL);
@@ -1169,7 +1175,7 @@ static int opt_filter_complex_script(void *optctx, const 
char *opt, const char *
 av_log(NULL, AV_LOG_WARNING, "-%s is deprecated, use -/filter_complex %s 
instead\n",
opt, arg);
 
-return fg_create(NULL, graph_desc, sch);
+return fg_create(NULL, graph_desc, go->sch);
 }
 #endif
 
@@ -1346,6 +1352,7 @@ static int open_files(OptionGroupList *l, const char 
*inout, Scheduler *sch,
 
 int ffmpeg_parse_options(int argc, char **argv, Scheduler *sch)
 {
+GlobalOptionsContext go = { .sch = sch };
 OptionParseContext octx;
 const char *errmsg = NULL;
 int ret;
@@ -1361,7 +1368,7 @@ int ffmpeg_parse_options(int argc, char **argv, Scheduler 
*sch)
 }
 
 /* apply global options */
-ret = parse_optgroup(sch, &octx.global_opts, options);
+ret = parse_optgroup(&go, &octx.global_opts, options);
 if (ret < 0) {
 errmsg = "parsing global options";
 goto fail;
-- 
2.43.0

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

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


[FFmpeg-devel] [PATCH 5/5] fftools/ffmpeg: supply hw device context to probe-filtergraphs

2024-10-07 Thread Anton Khirnov
I.e. those that are only used to figure out input/output counts, since
some filters might expect a valid hw device in init and refuse to
initalize otherwise.

This requires complex filtergraphs to be created in a separate step
after parsing global options, after all hw devices are guaranteed to
exist.
---
 fftools/ffmpeg_filter.c |  3 ++-
 fftools/ffmpeg_opt.c| 43 +
 2 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 4d444c161f..4524a3e535 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -1097,7 +1097,8 @@ int fg_create(FilterGraph **pfg, char *graph_desc, 
Scheduler *sch)
 return AVERROR(ENOMEM);;
 graph->nb_threads = 1;
 
-ret = graph_parse(graph, fgp->graph_desc, &inputs, &outputs, NULL);
+ret = graph_parse(graph, fgp->graph_desc, &inputs, &outputs,
+  hw_device_for_filter());
 if (ret < 0)
 goto fail;
 
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 052e68e943..9bf0c4f0c4 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -90,6 +90,9 @@ int recast_media = 0;
 // to func_arg() for global options
 typedef struct GlobalOptionsContext {
 Scheduler  *sch;
+
+char  **filtergraphs;
+int  nb_filtergraphs;
 } GlobalOptionsContext;
 
 static void uninit_options(OptionsContext *o)
@@ -1157,25 +1160,45 @@ static int opt_audio_qscale(void *optctx, const char 
*opt, const char *arg)
 static int opt_filter_complex(void *optctx, const char *opt, const char *arg)
 {
 GlobalOptionsContext *go = optctx;
-char *graph_desc = av_strdup(arg);
+char *graph_desc;
+int ret;
+
+graph_desc = av_strdup(arg);
 if (!graph_desc)
 return AVERROR(ENOMEM);
 
-return fg_create(NULL, graph_desc, go->sch);
+ret = GROW_ARRAY(go->filtergraphs, go->nb_filtergraphs);
+if (ret < 0) {
+av_freep(&graph_desc);
+return ret;
+}
+go->filtergraphs[go->nb_filtergraphs - 1] = graph_desc;
+
+return 0;
 }
 
 #if FFMPEG_OPT_FILTER_SCRIPT
 static int opt_filter_complex_script(void *optctx, const char *opt, const char 
*arg)
 {
 GlobalOptionsContext *go = optctx;
-char *graph_desc = file_read(arg);
+char *graph_desc;
+int ret;
+
+graph_desc = file_read(arg);
 if (!graph_desc)
 return AVERROR(EINVAL);
 
 av_log(NULL, AV_LOG_WARNING, "-%s is deprecated, use -/filter_complex %s 
instead\n",
opt, arg);
 
-return fg_create(NULL, graph_desc, go->sch);
+ret = GROW_ARRAY(go->filtergraphs, go->nb_filtergraphs);
+if (ret < 0) {
+av_freep(&graph_desc);
+return ret;
+}
+go->filtergraphs[go->nb_filtergraphs - 1] = graph_desc;
+
+return 0;
 }
 #endif
 
@@ -1377,6 +1400,14 @@ int ffmpeg_parse_options(int argc, char **argv, 
Scheduler *sch)
 /* configure terminal and setup signal handlers */
 term_init();
 
+/* create complex filtergraphs */
+for (int i = 0; i < go.nb_filtergraphs; i++) {
+ret = fg_create(NULL, go.filtergraphs[i], sch);
+go.filtergraphs[i] = NULL;
+if (ret < 0)
+goto fail;
+}
+
 /* open input files */
 ret = open_files(&octx.groups[GROUP_INFILE], "input", sch, ifile_open);
 if (ret < 0) {
@@ -1412,6 +1443,10 @@ int ffmpeg_parse_options(int argc, char **argv, 
Scheduler *sch)
 goto fail;
 
 fail:
+for (int i = 0; i < go.nb_filtergraphs; i++)
+av_freep(&go.filtergraphs[i]);
+av_freep(&go.filtergraphs);
+
 uninit_parse_context(&octx);
 if (ret < 0 && ret != AVERROR_EXIT) {
 av_log(NULL, AV_LOG_FATAL, "Error %s: %s\n",
-- 
2.43.0

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

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


Re: [FFmpeg-devel] [PATCH 04/12] swscale/internal: swap SWS_DITHER_NONE and SWS_DITHER_AUTO

2024-10-07 Thread Niklas Haas
On Mon, 07 Oct 2024 00:15:32 +0200 Michael Niedermayer  
wrote:
> On Sat, Oct 05, 2024 at 09:23:55PM +0200, Niklas Haas wrote:
> > From: Niklas Haas 
> >
> > This is done for consistency with the other public enums which will be
> > added in the upcoming swscale API refactor. I went through the code and 
> > checked
> > carefully that the value of `dither` is never implicitly compared against
> > zero, so this change should not break anything.
> >
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Niklas Haas 
> > ---
> >  libswscale/swscale_internal.h | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
>
> this breaks:
>
> ./ffmpeg -i lena.pnm -vf 
> scale=iw:ih:flags=0x02:sws_dither=0,format=bgr4_byte -bitexact 
> whatever.bmp

This is expected, of course. Are you saying that the change in consistency is
not worth the risk of breaking users who directly specify numeric IDs instead
of using the symbolic names?

I am fine dropping this commit for now.

>
> thx
>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Many things microsoft did are stupid, but not doing something just because
> microsoft did it is even more stupid. If everything ms did were stupid they
> would be bankrupt already.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH] libavfilter/vf_overlay: fix the displayed flags in CLI documentation

2024-10-07 Thread Gyan Doshi




On 2024-10-07 05:14 pm, Thomas Guillory wrote:

When displaying help for overlay filter in CLI, the flags for x and y parameters
don't have the T flag. However these two parameters do have the capability to be
set at runtime, as implemented in commit d2752ef0615.
This commit fixes the CLI documentation.


Patchwork warns, "Please wrap lines in the body of the commit message 
between 60 and 72 characters."


but otherwise LGTM.

Regards,
Gyan

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

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


Re: [FFmpeg-devel] [PATCH] avcodec/decode: clean-up if get_hw_frames_parameters fails

2024-10-07 Thread Thomas Guillem via ffmpeg-devel


On Mon, Oct 7, 2024, at 17:12, Rémi Denis-Courmont wrote:
> Le 30 septembre 2024 17:27:46 GMT+09:00, Thomas Guillem via 
> ffmpeg-devel  a écrit :
>>Fixes the following assert:
>>
>>[7f1df83d17e0] vaapi generic error: avcodec_get_hw_frames_parameters 
>>failed: -22
>>Assertion p_dst->hwaccel_threadsafe || (!dst->hwaccel && 
>>!dst->internal->hwaccel_priv_data) failed at libavcodec/pthread_frame.c:349
>>
>>Reproduced from VLC with VAAPI, when fallbacking from hw to sw.
>>---
>> libavcodec/decode.c | 7 +++
>> 1 file changed, 7 insertions(+)
>>
>>diff --git a/libavcodec/decode.c b/libavcodec/decode.c
>>index c331bb8596..e90a6630e1 100644
>>--- a/libavcodec/decode.c
>>+++ b/libavcodec/decode.c
>>@@ -19,6 +19,7 @@
>>  */
>> 
>> #include 
>>+#include 
>> #include 
>> 
>> #include "config.h"
>>@@ -1173,6 +1174,7 @@ int avcodec_get_hw_frames_parameters(AVCodecContext 
>>*avctx,
>> const AVCodecHWConfigInternal *hw_config;
>> const FFHWAccel *hwa;
>> int i, ret;
>>+bool clean_priv_data = false;
>> 
>> for (i = 0;; i++) {
>> hw_config = ffcodec(avctx->codec)->hw_configs[i];
>>@@ -1197,6 +1199,7 @@ int avcodec_get_hw_frames_parameters(AVCodecContext 
>>*avctx,
>> av_buffer_unref(&frames_ref);
>> return AVERROR(ENOMEM);
>> }
>>+clean_priv_data = true;
>> }
>> 
>> ret = hwa->frame_params(avctx, frames_ref);
>>@@ -1217,6 +1220,10 @@ int avcodec_get_hw_frames_parameters(AVCodecContext 
>>*avctx,
>> 
>> *out_frames_ref = frames_ref;
>> } else {
>>+if (clean_priv_data) {
>>+av_freep(avctx->internal->hwaccel_priv_data);
>>+avctx->internal->hwaccel_priv_data = NULL;
>
> Isn't this assignment redundant? Though IMO, `av_freep` is an 
> abomination that needs to be exterminated with extreme prejudice, but I 
> digress. Did you mean to use `av_free`?

Ah yes, I will fix it. I will use `av_freep` in my future patch since this is 
what is currently used for this variable in the current file.

>
>>+}
>> av_buffer_unref(&frames_ref);
>> }
>> return ret;
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH] avcodec/decode: clean-up if get_hw_frames_parameters fails

2024-10-07 Thread Thomas Guillem via ffmpeg-devel
Fixes the following assert:

[7f1df83d17e0] vaapi generic error: avcodec_get_hw_frames_parameters 
failed: -22
Assertion p_dst->hwaccel_threadsafe || (!dst->hwaccel && 
!dst->internal->hwaccel_priv_data) failed at libavcodec/pthread_frame.c:349

Reproduced from VLC with VAAPI, when fallbacking from hw to sw.
---
 libavcodec/decode.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index c331bb8596..3380cb27cf 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -19,6 +19,7 @@
  */
 
 #include 
+#include 
 #include 
 
 #include "config.h"
@@ -1173,6 +1174,7 @@ int avcodec_get_hw_frames_parameters(AVCodecContext 
*avctx,
 const AVCodecHWConfigInternal *hw_config;
 const FFHWAccel *hwa;
 int i, ret;
+bool clean_priv_data = false;
 
 for (i = 0;; i++) {
 hw_config = ffcodec(avctx->codec)->hw_configs[i];
@@ -1197,6 +1199,7 @@ int avcodec_get_hw_frames_parameters(AVCodecContext 
*avctx,
 av_buffer_unref(&frames_ref);
 return AVERROR(ENOMEM);
 }
+clean_priv_data = true;
 }
 
 ret = hwa->frame_params(avctx, frames_ref);
@@ -1217,6 +1220,8 @@ int avcodec_get_hw_frames_parameters(AVCodecContext 
*avctx,
 
 *out_frames_ref = frames_ref;
 } else {
+if (clean_priv_data)
+av_freep(&avctx->internal->hwaccel_priv_data);
 av_buffer_unref(&frames_ref);
 }
 return ret;
-- 
2.45.2

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

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


[FFmpeg-devel] [PATCH 03/20] avutil/pixfmt: add UYVA pixel format

2024-10-07 Thread James Almer
This maps to the YpCbCrA8 pixel format as defined by Apple, which is ordered
Cb Y' Cr A.

Signed-off-by: James Almer 
---
 libavutil/pixdesc.c  | 13 +
 libavutil/pixfmt.h   |  2 ++
 libavutil/tests/pixfmt_best.c|  1 +
 tests/ref/fate/imgutils  |  2 ++
 tests/ref/fate/pixfmt_best   |  2 +-
 tests/ref/fate/sws-pixdesc-query |  3 +++
 6 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 588a5845c9..ab336433da 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2119,6 +2119,19 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
 .name = "cuda",
 .flags = AV_PIX_FMT_FLAG_HWACCEL,
 },
+[AV_PIX_FMT_UYVA] = {
+.name = "uyva",
+.nb_components = 4,
+.log2_chroma_w = 0,
+.log2_chroma_h = 0,
+.comp = {
+{ 0, 4, 1, 0, 8 },/* Y */
+{ 0, 4, 0, 0, 8 },/* U */
+{ 0, 4, 2, 0, 8 },/* V */
+{ 0, 4, 3, 0, 8 },/* A */
+},
+.flags = AV_PIX_FMT_FLAG_ALPHA,
+},
 [AV_PIX_FMT_AYUV] = {
 .name = "ayuv",
 .nb_components = 4,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index e305bba78c..6d624108ef 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -441,6 +441,8 @@ enum AVPixelFormat {
 
 AV_PIX_FMT_AYUV,///< packed AYUV 4:4:4, 32bpp (1 Cr & Cb sample 
per 1x1 Y & A samples), AYUVAYUV...
 
+AV_PIX_FMT_UYVA,///< packed UYVA 4:4:4, 32bpp (1 Cr & Cb sample 
per 1x1 Y & A samples), UYVAUYVA...
+
 AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you 
want to link with shared libav* because the number of formats might differ 
between versions
 };
 
diff --git a/libavutil/tests/pixfmt_best.c b/libavutil/tests/pixfmt_best.c
index 24e55c4f23..94666740d9 100644
--- a/libavutil/tests/pixfmt_best.c
+++ b/libavutil/tests/pixfmt_best.c
@@ -136,6 +136,7 @@ int main(void)
 TEST(AV_PIX_FMT_YUVA444P,  AV_PIX_FMT_YUV444P);
 TEST(AV_PIX_FMT_VUYA,  AV_PIX_FMT_YUV444P);
 TEST(AV_PIX_FMT_AYUV,  AV_PIX_FMT_YUV444P);
+TEST(AV_PIX_FMT_UYVA,  AV_PIX_FMT_YUV444P);
 TEST(AV_PIX_FMT_AYUV64,AV_PIX_FMT_YUV444P16);
 TEST(AV_PIX_FMT_RGBA,  AV_PIX_FMT_RGB24);
 TEST(AV_PIX_FMT_ABGR,  AV_PIX_FMT_RGB24);
diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils
index da764b38e5..03121e45fe 100644
--- a/tests/ref/fate/imgutils
+++ b/tests/ref/fate/imgutils
@@ -270,6 +270,7 @@ p412le  planes: 2, linesizes: 128 256   0   0, 
plane_sizes:  6144 12288
 gbrap14be   planes: 4, linesizes: 128 128 128 128, plane_sizes:  6144  
6144  6144  6144, plane_offsets:  6144  6144  6144, total_size: 24576
 gbrap14le   planes: 4, linesizes: 128 128 128 128, plane_sizes:  6144  
6144  6144  6144, plane_offsets:  6144  6144  6144, total_size: 24576
 ayuvplanes: 1, linesizes: 256   0   0   0, plane_sizes: 12288 
0 0 0, plane_offsets: 0 0 0, total_size: 12288
+uyvaplanes: 1, linesizes: 256   0   0   0, plane_sizes: 12288 
0 0 0, plane_offsets: 0 0 0, total_size: 12288
 
 image_fill_black tests
 yuv420p total_size:   4608,  black_unknown_crc: 0xd00f6cc6,  
black_tv_crc: 0xd00f6cc6,  black_pc_crc: 0x234969af
@@ -487,3 +488,4 @@ p412le  total_size:  18432,  black_unknown_crc: 
0x4028ac30,  black_tv_cr
 gbrap14be   total_size:  24576,  black_unknown_crc: 0x4ec0d987,  
black_tv_crc: 0x4ec0d987,  black_pc_crc: 0x4ec0d987
 gbrap14le   total_size:  24576,  black_unknown_crc: 0x13bde353,  
black_tv_crc: 0x13bde353,  black_pc_crc: 0x13bde353
 ayuvtotal_size:  12288,  black_unknown_crc: 0xcc44368b,  
black_tv_crc: 0xcc44368b,  black_pc_crc: 0x1e04c638
+uyvatotal_size:  12288,  black_unknown_crc: 0xdd657297,  
black_tv_crc: 0xdd657297,  black_pc_crc: 0x0f258224
diff --git a/tests/ref/fate/pixfmt_best b/tests/ref/fate/pixfmt_best
index 591fa5c912..3a2ba35238 100644
--- a/tests/ref/fate/pixfmt_best
+++ b/tests/ref/fate/pixfmt_best
@@ -1 +1 @@
-107 tests passed, 0 tests failed.
+108 tests passed, 0 tests failed.
diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query
index f12f0cbf42..8b7f7875f4 100644
--- a/tests/ref/fate/sws-pixdesc-query
+++ b/tests/ref/fate/sws-pixdesc-query
@@ -246,6 +246,7 @@ isYUV:
   p412le
   p416be
   p416le
+  uyva
   uyvy422
   uyyvyy411
   vuya
@@ -730,6 +731,7 @@ ALPHA:
   rgbaf16le
   rgbaf32be
   rgbaf32le
+  uyva
   vuya
   ya16be
   ya16le
@@ -821,6 +823,7 @@ Packed:
   rgbaf32le
   rgbf32be
   rgbf32le
+  uyva
   uyvy422
   uyyvyy411
   vuya
-- 
2.46.2

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg

[FFmpeg-devel] [PATCH 02/20] avutil/pixfmt: add AYUV pixel format

2024-10-07 Thread James Almer
This maps to the AYpCbCr8 pixel format as defined by Apple, which is ordered
A Y’ Cb Cr.

Signed-off-by: James Almer 
---
 libavutil/pixdesc.c  | 13 +
 libavutil/pixfmt.h   |  2 ++
 libavutil/tests/pixfmt_best.c|  1 +
 tests/ref/fate/imgutils  |  2 ++
 tests/ref/fate/pixfmt_best   |  2 +-
 tests/ref/fate/sws-pixdesc-query |  3 +++
 6 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 1c0bcf2232..588a5845c9 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2119,6 +2119,19 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
 .name = "cuda",
 .flags = AV_PIX_FMT_FLAG_HWACCEL,
 },
+[AV_PIX_FMT_AYUV] = {
+.name = "ayuv",
+.nb_components = 4,
+.log2_chroma_w = 0,
+.log2_chroma_h = 0,
+.comp = {
+{ 0, 4, 1, 0, 8 },/* Y */
+{ 0, 4, 2, 0, 8 },/* U */
+{ 0, 4, 3, 0, 8 },/* V */
+{ 0, 4, 0, 0, 8 },/* A */
+},
+.flags = AV_PIX_FMT_FLAG_ALPHA,
+},
 [AV_PIX_FMT_AYUV64LE] = {
 .name = "ayuv64le",
 .nb_components = 4,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index a7f50e1690..e305bba78c 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -439,6 +439,8 @@ enum AVPixelFormat {
  */
 AV_PIX_FMT_D3D12,
 
+AV_PIX_FMT_AYUV,///< packed AYUV 4:4:4, 32bpp (1 Cr & Cb sample 
per 1x1 Y & A samples), AYUVAYUV...
+
 AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you 
want to link with shared libav* because the number of formats might differ 
between versions
 };
 
diff --git a/libavutil/tests/pixfmt_best.c b/libavutil/tests/pixfmt_best.c
index d71b3cc2e8..24e55c4f23 100644
--- a/libavutil/tests/pixfmt_best.c
+++ b/libavutil/tests/pixfmt_best.c
@@ -135,6 +135,7 @@ int main(void)
 TEST(AV_PIX_FMT_YUVA422P,  AV_PIX_FMT_YUV422P);
 TEST(AV_PIX_FMT_YUVA444P,  AV_PIX_FMT_YUV444P);
 TEST(AV_PIX_FMT_VUYA,  AV_PIX_FMT_YUV444P);
+TEST(AV_PIX_FMT_AYUV,  AV_PIX_FMT_YUV444P);
 TEST(AV_PIX_FMT_AYUV64,AV_PIX_FMT_YUV444P16);
 TEST(AV_PIX_FMT_RGBA,  AV_PIX_FMT_RGB24);
 TEST(AV_PIX_FMT_ABGR,  AV_PIX_FMT_RGB24);
diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils
index fb2ed6d158..da764b38e5 100644
--- a/tests/ref/fate/imgutils
+++ b/tests/ref/fate/imgutils
@@ -269,6 +269,7 @@ p412be  planes: 2, linesizes: 128 256   0   0, 
plane_sizes:  6144 12288
 p412le  planes: 2, linesizes: 128 256   0   0, plane_sizes:  6144 
12288 0 0, plane_offsets:  6144 0 0, total_size: 18432
 gbrap14be   planes: 4, linesizes: 128 128 128 128, plane_sizes:  6144  
6144  6144  6144, plane_offsets:  6144  6144  6144, total_size: 24576
 gbrap14le   planes: 4, linesizes: 128 128 128 128, plane_sizes:  6144  
6144  6144  6144, plane_offsets:  6144  6144  6144, total_size: 24576
+ayuvplanes: 1, linesizes: 256   0   0   0, plane_sizes: 12288 
0 0 0, plane_offsets: 0 0 0, total_size: 12288
 
 image_fill_black tests
 yuv420p total_size:   4608,  black_unknown_crc: 0xd00f6cc6,  
black_tv_crc: 0xd00f6cc6,  black_pc_crc: 0x234969af
@@ -485,3 +486,4 @@ p412be  total_size:  18432,  black_unknown_crc: 
0x26991800,  black_tv_cr
 p412le  total_size:  18432,  black_unknown_crc: 0x4028ac30,  
black_tv_crc: 0x4028ac30,  black_pc_crc: 0xab7c7698
 gbrap14be   total_size:  24576,  black_unknown_crc: 0x4ec0d987,  
black_tv_crc: 0x4ec0d987,  black_pc_crc: 0x4ec0d987
 gbrap14le   total_size:  24576,  black_unknown_crc: 0x13bde353,  
black_tv_crc: 0x13bde353,  black_pc_crc: 0x13bde353
+ayuvtotal_size:  12288,  black_unknown_crc: 0xcc44368b,  
black_tv_crc: 0xcc44368b,  black_pc_crc: 0x1e04c638
diff --git a/tests/ref/fate/pixfmt_best b/tests/ref/fate/pixfmt_best
index 1bdc0e83f0..591fa5c912 100644
--- a/tests/ref/fate/pixfmt_best
+++ b/tests/ref/fate/pixfmt_best
@@ -1 +1 @@
-106 tests passed, 0 tests failed.
+107 tests passed, 0 tests failed.
diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query
index fff93bbf0e..f12f0cbf42 100644
--- a/tests/ref/fate/sws-pixdesc-query
+++ b/tests/ref/fate/sws-pixdesc-query
@@ -218,6 +218,7 @@ isBE:
   yuva444p9be
 
 isYUV:
+  ayuv
   ayuv64be
   ayuv64le
   nv12
@@ -702,6 +703,7 @@ AnyRGB:
   x2rgb10le
 
 ALPHA:
+  ayuv
   ayuv64be
   ayuv64le
   bgr32
@@ -761,6 +763,7 @@ ALPHA:
 Packed:
   0bgr
   0rgb
+  ayuv
   ayuv64be
   ayuv64le
   bayer_bggr16be
-- 
2.46.2

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

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


[FFmpeg-devel] [PATCH 01/20] swscale/output: add missing yuv2packed1 and yuv2packed2 support for VUY{X, A}

2024-10-07 Thread James Almer
Signed-off-by: James Almer 
---
FATE tests don't seem to trigger this.

 libswscale/output.c | 106 
 1 file changed, 106 insertions(+)

diff --git a/libswscale/output.c b/libswscale/output.c
index 31921a3cce..e5d555f76f 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -2668,6 +2668,110 @@ yuv2xv36le_X_c(SwsContext *c, const int16_t *lumFilter,
 }
 }
 
+static void
+yuv2vuyX_1_c(SwsContext *c, const int16_t *buf0,
+ const int16_t *ubuf[2], const int16_t *vbuf[2],
+ const int16_t *abuf0, uint8_t *dest, int dstW,
+ int uvalpha, int y)
+{
+int hasAlpha = !!abuf0;
+int i;
+
+if (uvalpha < 2048) {
+for (i = 0; i < dstW; i++) {
+int Y = (buf0[i] + 64) >> 7;
+int U = (ubuf[0][i] + 64) >> 7;
+int V = (vbuf[0][i] + 64) >> 7;
+int A = 255;
+
+if (Y & 0x100)
+Y = av_clip_uint8(Y);
+if (U & 0x100)
+U = av_clip_uint8(U);
+if (V & 0x100)
+V = av_clip_uint8(V);
+
+if (hasAlpha) {
+A = (abuf0[i] + 64) >> 7;
+if (A & 0x100)
+A = av_clip_uint8(A);
+}
+
+dest[i * 2] = Y;
+dest[i * 2 + 1] = A;
+}
+} else {
+for (i = 0; i < dstW; i++) {
+int Y = (buf0[i] + 64) >> 7;
+int U = (ubuf[0][i] + ubuf[1][i] + 128) >> 8;
+int V = (vbuf[0][i] + vbuf[1][i] + 128) >> 8;
+int A = 255;
+
+if (Y & 0x100)
+Y = av_clip_uint8(Y);
+if (U & 0x100)
+U = av_clip_uint8(U);
+if (V & 0x100)
+V = av_clip_uint8(V);
+
+if (hasAlpha) {
+A = (abuf0[i] + 64) >> 7;
+if (A & 0x100)
+A = av_clip_uint8(A);
+}
+
+dest[4 * i] = V;
+dest[4 * i + 1] = U;
+dest[4 * i + 2] = Y;
+dest[4 * i + 3] = A;
+}
+}
+}
+
+static void
+yuv2vuyX_2_c(SwsContext *c, const int16_t *buf[2],
+const int16_t *ubuf[2], const int16_t *vbuf[2],
+const int16_t *abuf[2], uint8_t *dest, int dstW,
+int yalpha, int uvalpha, int y)
+{
+int hasAlpha = abuf && abuf[0] && abuf[1];
+const int16_t *buf0  = buf[0],  *buf1  = buf[1],
+  *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
+  *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
+  *abuf0 = hasAlpha ? abuf[0] : NULL,
+  *abuf1 = hasAlpha ? abuf[1] : NULL;
+int yalpha1  = 4096 - yalpha;
+int uvalpha1 = 4096 - uvalpha;
+int i;
+
+av_assert2(yalpha  <= 4096U);
+av_assert2(uvalpha <= 4096U);
+
+for (i = 0; i < dstW; i++) {
+int Y = (buf0[i]  * yalpha1  + buf1[i]  * yalpha)  >> 19;
+int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha) >> 19;
+int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha) >> 19;
+int A = 255;
+
+if (Y & 0x100)
+Y = av_clip_uint8(Y);
+if (U & 0x100)
+U = av_clip_uint8(U);
+if (V & 0x100)
+V = av_clip_uint8(V);
+
+if (hasAlpha) {
+A = (abuf0[i] * yalpha1 + abuf1[i] * yalpha) >> 19;
+A = av_clip_uint8(A);
+}
+
+dest[4 * i] = V;
+dest[4 * i + 1] = U;
+dest[4 * i + 2] = Y;
+dest[4 * i + 3] = A;
+}
+}
+
 static void
 yuv2vuyX_X_c(SwsContext *c, const int16_t *lumFilter,
  const int16_t **lumSrc, int lumFilterSize,
@@ -3275,6 +3379,8 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
 break;
 case AV_PIX_FMT_VUYA:
 case AV_PIX_FMT_VUYX:
+*yuv2packed1 = yuv2vuyX_1_c;
+*yuv2packed2 = yuv2vuyX_2_c;
 *yuv2packedX = yuv2vuyX_X_c;
 break;
 case AV_PIX_FMT_XV30LE:
-- 
2.46.2

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

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


[FFmpeg-devel] [PATCH 04/20] avutil/pixfmt: add VYU444 pixel format

2024-10-07 Thread James Almer
This maps to the 444YpCbCr8 pixel format as defined by Apple, which is ordered
Cr Y' Cb.

Signed-off-by: James Almer 
---
 libavutil/pixdesc.c  | 11 +++
 libavutil/pixfmt.h   |  2 ++
 libavutil/tests/pixfmt_best.c|  1 +
 tests/ref/fate/imgutils  |  2 ++
 tests/ref/fate/pixfmt_best   |  2 +-
 tests/ref/fate/sws-pixdesc-query |  3 +++
 6 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index ab336433da..deff74d8a6 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2119,6 +2119,17 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
 .name = "cuda",
 .flags = AV_PIX_FMT_FLAG_HWACCEL,
 },
+[AV_PIX_FMT_VYU444] = {
+.name = "vyu444",
+.nb_components = 3,
+.log2_chroma_w = 0,
+.log2_chroma_h = 0,
+.comp = {
+{ 0, 3, 1, 0, 8 },/* Y */
+{ 0, 3, 2, 0, 8 },/* U */
+{ 0, 3, 0, 0, 8 },/* V */
+},
+},
 [AV_PIX_FMT_UYVA] = {
 .name = "uyva",
 .nb_components = 4,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 6d624108ef..cbdab31df4 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -443,6 +443,8 @@ enum AVPixelFormat {
 
 AV_PIX_FMT_UYVA,///< packed UYVA 4:4:4, 32bpp (1 Cr & Cb sample 
per 1x1 Y & A samples), UYVAUYVA...
 
+AV_PIX_FMT_VYU444,  ///< packed VYU 4:4:4, 24bpp (1 Cr & Cb sample per 
1x1 Y), VYUVYU...
+
 AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you 
want to link with shared libav* because the number of formats might differ 
between versions
 };
 
diff --git a/libavutil/tests/pixfmt_best.c b/libavutil/tests/pixfmt_best.c
index 94666740d9..fe04e26689 100644
--- a/libavutil/tests/pixfmt_best.c
+++ b/libavutil/tests/pixfmt_best.c
@@ -121,6 +121,7 @@ int main(void)
 TEST(AV_PIX_FMT_NV24,  AV_PIX_FMT_YUV444P);
 TEST(AV_PIX_FMT_YUYV422,   AV_PIX_FMT_YUV422P);
 TEST(AV_PIX_FMT_UYVY422,   AV_PIX_FMT_YUV422P);
+TEST(AV_PIX_FMT_VYU444,AV_PIX_FMT_YUV444P);
 TEST(AV_PIX_FMT_BGR565,AV_PIX_FMT_RGB565);
 TEST(AV_PIX_FMT_BGR24, AV_PIX_FMT_RGB24);
 TEST(AV_PIX_FMT_GBRP,  AV_PIX_FMT_RGB24);
diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils
index 03121e45fe..4197005a3f 100644
--- a/tests/ref/fate/imgutils
+++ b/tests/ref/fate/imgutils
@@ -271,6 +271,7 @@ gbrap14be   planes: 4, linesizes: 128 128 128 128, 
plane_sizes:  6144  6144
 gbrap14le   planes: 4, linesizes: 128 128 128 128, plane_sizes:  6144  
6144  6144  6144, plane_offsets:  6144  6144  6144, total_size: 24576
 ayuvplanes: 1, linesizes: 256   0   0   0, plane_sizes: 12288 
0 0 0, plane_offsets: 0 0 0, total_size: 12288
 uyvaplanes: 1, linesizes: 256   0   0   0, plane_sizes: 12288 
0 0 0, plane_offsets: 0 0 0, total_size: 12288
+vyu444  planes: 1, linesizes: 192   0   0   0, plane_sizes:  9216 
0 0 0, plane_offsets: 0 0 0, total_size: 9216
 
 image_fill_black tests
 yuv420p total_size:   4608,  black_unknown_crc: 0xd00f6cc6,  
black_tv_crc: 0xd00f6cc6,  black_pc_crc: 0x234969af
@@ -489,3 +490,4 @@ gbrap14be   total_size:  24576,  black_unknown_crc: 
0x4ec0d987,  black_tv_cr
 gbrap14le   total_size:  24576,  black_unknown_crc: 0x13bde353,  
black_tv_crc: 0x13bde353,  black_pc_crc: 0x13bde353
 ayuvtotal_size:  12288,  black_unknown_crc: 0xcc44368b,  
black_tv_crc: 0xcc44368b,  black_pc_crc: 0x1e04c638
 uyvatotal_size:  12288,  black_unknown_crc: 0xdd657297,  
black_tv_crc: 0xdd657297,  black_pc_crc: 0x0f258224
+vyu444  total_size:   9216,  black_unknown_crc: 0x575e6fb1,  
black_tv_crc: 0x575e6fb1,  black_pc_crc: 0x16564599
diff --git a/tests/ref/fate/pixfmt_best b/tests/ref/fate/pixfmt_best
index 3a2ba35238..72486587c6 100644
--- a/tests/ref/fate/pixfmt_best
+++ b/tests/ref/fate/pixfmt_best
@@ -1 +1 @@
-108 tests passed, 0 tests failed.
+109 tests passed, 0 tests failed.
diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query
index 8b7f7875f4..e1b2ac999a 100644
--- a/tests/ref/fate/sws-pixdesc-query
+++ b/tests/ref/fate/sws-pixdesc-query
@@ -251,6 +251,7 @@ isYUV:
   uyyvyy411
   vuya
   vuyx
+  vyu444
   xv30be
   xv30le
   xv36be
@@ -828,6 +829,7 @@ Packed:
   uyyvyy411
   vuya
   vuyx
+  vyu444
   x2bgr10be
   x2bgr10le
   x2rgb10be
@@ -1090,5 +1092,6 @@ SwappedChroma:
   nv42
   vuya
   vuyx
+  vyu444
   yvyu422
 
-- 
2.46.2

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

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


[FFmpeg-devel] [PATCH 07/20] swscale/input: add VYU444 input support

2024-10-07 Thread James Almer
Signed-off-by: James Almer 
---
 libswscale/input.c | 24 
 libswscale/utils.c |  1 +
 2 files changed, 25 insertions(+)

diff --git a/libswscale/input.c b/libswscale/input.c
index 3a93ac18e4..fe3e419edc 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -746,6 +746,24 @@ static void read_uyva_UV_c(uint8_t *dstU, uint8_t *dstV, 
const uint8_t *unused0,
 }
 }
 
+static void vyuToY_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, 
const uint8_t *unused1, int width,
+ uint32_t *unused2, void *opq)
+{
+int i;
+for (i = 0; i < width; i++)
+dst[i] = src[i * 3 + 1];
+}
+
+static void vyuToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, 
const uint8_t *src,
+  const uint8_t *unused1, int width, uint32_t *unused2, 
void *opq)
+{
+int i;
+for (i = 0; i < width; i++) {
+dstU[i] = src[i * 3 + 2];
+dstV[i] = src[i * 3];
+}
+}
+
 static void read_xv30le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t 
*unused0, const uint8_t *unused1, int width,
uint32_t *unused2, void *opq)
 {
@@ -1336,6 +1354,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 case AV_PIX_FMT_UYVY422:
 c->chrToYV12 = uyvyToUV_c;
 break;
+case AV_PIX_FMT_VYU444:
+c->chrToYV12 = vyuToUV_c;
+break;
 case AV_PIX_FMT_NV12:
 case AV_PIX_FMT_NV16:
 case AV_PIX_FMT_NV24:
@@ -1899,6 +1920,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 case AV_PIX_FMT_UYVY422:
 c->lumToYV12 = uyvyToY_c;
 break;
+case AV_PIX_FMT_VYU444:
+c->lumToYV12 = vyuToY_c;
+break;
 case AV_PIX_FMT_BGR24:
 c->lumToYV12 = bgr24ToY_c;
 break;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 2ddc8fa437..28861bde97 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -270,6 +270,7 @@ static const FormatEntry format_entries[] = {
 [AV_PIX_FMT_XV36LE]  = { 1, 1 },
 [AV_PIX_FMT_AYUV]= { 1, 0 },
 [AV_PIX_FMT_UYVA]= { 1, 0 },
+[AV_PIX_FMT_VYU444]  = { 1, 0 },
 };
 
 /**
-- 
2.46.2

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

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


[FFmpeg-devel] [PATCH 06/20] swscale/input: add UYVA input support

2024-10-07 Thread James Almer
Signed-off-by: James Almer 
---
 libswscale/input.c | 15 +++
 libswscale/utils.c |  1 +
 2 files changed, 16 insertions(+)

diff --git a/libswscale/input.c b/libswscale/input.c
index 9fe5ef47ce..3a93ac18e4 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -736,6 +736,16 @@ static void read_ayuv_A_c(uint8_t *dst, const uint8_t 
*src, const uint8_t *unuse
 dst[i] = src[i * 4];
 }
 
+static void read_uyva_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t 
*unused0, const uint8_t *src,
+   const uint8_t *unused1, int width, uint32_t 
*unused2, void *opq)
+{
+int i;
+for (i = 0; i < width; i++) {
+dstU[i] = src[i * 4];
+dstV[i] = src[i * 4 + 2];
+}
+}
+
 static void read_xv30le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t 
*unused0, const uint8_t *unused1, int width,
uint32_t *unused2, void *opq)
 {
@@ -1470,6 +1480,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 case AV_PIX_FMT_AYUV64LE:
 c->chrToYV12 = read_ayuv64le_UV_c;
 break;
+case AV_PIX_FMT_UYVA:
+c->chrToYV12 = read_uyva_UV_c;
+break;
 case AV_PIX_FMT_XV36LE:
 c->chrToYV12 = read_xv36le_UV_c;
 break;
@@ -1869,6 +1882,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 c->lumToYV12 = read_xv30le_Y_c;
 break;
 case AV_PIX_FMT_AYUV:
+case AV_PIX_FMT_UYVA:
 c->lumToYV12 = read_ayuv_Y_c;
 break;
 case AV_PIX_FMT_AYUV64LE:
@@ -2055,6 +2069,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 c->alpToYV12 = read_ya16be_alpha_c;
 break;
 case AV_PIX_FMT_VUYA:
+case AV_PIX_FMT_UYVA:
 c->alpToYV12 = read_vuya_A_c;
 break;
 case AV_PIX_FMT_AYUV:
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 1a4337833a..2ddc8fa437 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -269,6 +269,7 @@ static const FormatEntry format_entries[] = {
 [AV_PIX_FMT_XV30LE]  = { 1, 1 },
 [AV_PIX_FMT_XV36LE]  = { 1, 1 },
 [AV_PIX_FMT_AYUV]= { 1, 0 },
+[AV_PIX_FMT_UYVA]= { 1, 0 },
 };
 
 /**
-- 
2.46.2

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

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


[FFmpeg-devel] [PATCH 09/20] swscale/output: add UYVA output support

2024-10-07 Thread James Almer
Signed-off-by: James Almer 
---
 libswscale/output.c  | 56 
 libswscale/utils.c   |  2 +-
 tests/ref/fate/filter-pixdesc-uyva   |  1 +
 tests/ref/fate/filter-pixfmts-copy   |  1 +
 tests/ref/fate/filter-pixfmts-crop   |  1 +
 tests/ref/fate/filter-pixfmts-field  |  1 +
 tests/ref/fate/filter-pixfmts-fieldorder |  1 +
 tests/ref/fate/filter-pixfmts-hflip  |  1 +
 tests/ref/fate/filter-pixfmts-il |  1 +
 tests/ref/fate/filter-pixfmts-null   |  1 +
 tests/ref/fate/filter-pixfmts-pad|  1 +
 tests/ref/fate/filter-pixfmts-scale  |  1 +
 tests/ref/fate/filter-pixfmts-transpose  |  1 +
 tests/ref/fate/filter-pixfmts-vflip  |  1 +
 14 files changed, 69 insertions(+), 1 deletion(-)
 create mode 100644 tests/ref/fate/filter-pixdesc-uyva

diff --git a/libswscale/output.c b/libswscale/output.c
index 4d6b9d553b..a11bedde95 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -2878,6 +2878,59 @@ yuv2ayuv_X_c(SwsContext *c, const int16_t *lumFilter,
 }
 }
 
+static void
+yuv2uyva_X_c(SwsContext *c, const int16_t *lumFilter,
+ const int16_t **lumSrc, int lumFilterSize,
+ const int16_t *chrFilter, const int16_t **chrUSrc,
+ const int16_t **chrVSrc, int chrFilterSize,
+ const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
+{
+int i;
+
+for (i = 0; i < dstW; i++) {
+int j;
+int Y = 1 << 18, U = 1 << 18;
+int V = 1 << 18, A = 255;
+
+for (j = 0; j < lumFilterSize; j++)
+Y += lumSrc[j][i] * lumFilter[j];
+
+for (j = 0; j < chrFilterSize; j++)
+U += chrUSrc[j][i] * chrFilter[j];
+
+for (j = 0; j < chrFilterSize; j++)
+V += chrVSrc[j][i] * chrFilter[j];
+
+Y >>= 19;
+U >>= 19;
+V >>= 19;
+
+if (Y  & 0x100)
+Y = av_clip_uint8(Y);
+if (U  & 0x100)
+U = av_clip_uint8(U);
+if (V  & 0x100)
+V = av_clip_uint8(V);
+
+if (alpSrc) {
+A = 1 << 18;
+
+for (j = 0; j < lumFilterSize; j++)
+A += alpSrc[j][i] * lumFilter[j];
+
+A >>= 19;
+
+if (A & 0x100)
+A = av_clip_uint8(A);
+}
+
+dest[4 * i] = U;
+dest[4 * i + 1] = Y;
+dest[4 * i + 2] = V;
+dest[4 * i + 3] = A;
+}
+}
+
 #define output_pixel(pos, val, bits) \
 AV_WL16(pos, av_clip_uintp2(val >> shift, bits) << output_shift);
 
@@ -3439,6 +3492,9 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
 *yuv2packed2 = yuv2vuyX_2_c;
 *yuv2packedX = yuv2vuyX_X_c;
 break;
+case AV_PIX_FMT_UYVA:
+*yuv2packedX = yuv2uyva_X_c;
+break;
 case AV_PIX_FMT_XV30LE:
 *yuv2packedX = yuv2xv30le_X_c;
 break;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index a5be311393..a37e8c1869 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -269,7 +269,7 @@ static const FormatEntry format_entries[] = {
 [AV_PIX_FMT_XV30LE]  = { 1, 1 },
 [AV_PIX_FMT_XV36LE]  = { 1, 1 },
 [AV_PIX_FMT_AYUV]= { 1, 1 },
-[AV_PIX_FMT_UYVA]= { 1, 0 },
+[AV_PIX_FMT_UYVA]= { 1, 1 },
 [AV_PIX_FMT_VYU444]  = { 1, 0 },
 };
 
diff --git a/tests/ref/fate/filter-pixdesc-uyva 
b/tests/ref/fate/filter-pixdesc-uyva
new file mode 100644
index 00..49fd1bc6b1
--- /dev/null
+++ b/tests/ref/fate/filter-pixdesc-uyva
@@ -0,0 +1 @@
+pixdesc-uyva7cec5f820722500f491c3495113e726e
diff --git a/tests/ref/fate/filter-pixfmts-copy 
b/tests/ref/fate/filter-pixfmts-copy
index dc165b5ec5..de9b35e35a 100644
--- a/tests/ref/fate/filter-pixfmts-copy
+++ b/tests/ref/fate/filter-pixfmts-copy
@@ -97,6 +97,7 @@ rgb87ac6008c84d622c2fc50581706e17576
 rgbab6e1b441c365e03b5ffdf9b7b68d9a0c
 rgba64beae2ae04b5efedca3505f47c4dd6ea6ea
 rgba64leb91e1d77f799eb92241a2d2d28437b15
+uyvaaffad7282152bcce415bdf228df00ae4
 uyvy422 3bcf3c80047592f2211fae3260b1b65d
 vuya3d5e934651cae1ce334001cb1829ad22
 vuyx0af13a42f9d0932c5a9bb6a8a5d1c5ee
diff --git a/tests/ref/fate/filter-pixfmts-crop 
b/tests/ref/fate/filter-pixfmts-crop
index 07ded708bc..666d99f932 100644
--- a/tests/ref/fate/filter-pixfmts-crop
+++ b/tests/ref/fate/filter-pixfmts-crop
@@ -95,6 +95,7 @@ rgb89b364a8f112ad9459fec47a51cc03b30
 rgba9488ac85abceaf99a9309eac5a87697e
 rgba64be89910046972ab3c68e2a348302cc8ca9
 rgba64lefea8ebfc869b52adf353778f29eac7a7
+uyvacaa03b07812dbb6c48b5fb34edf73962
 vuya76578a705ff3a37559653c1289bd03dd
 vuyx615241c5406eb556fca0ad8606c23a02
 x2bgr10le   84de725b85662c362862820dc4a309aa
diff --git a/tests/ref/fate/filter-pixfmts-field 
b/tests/ref/fate/f

[FFmpeg-devel] [PATCH 10/20] swscale/output: add VYU444 output support

2024-10-07 Thread James Almer
Signed-off-by: James Almer 
---
 libswscale/output.c  | 43 
 libswscale/utils.c   |  2 +-
 tests/ref/fate/filter-pixdesc-vyu444 |  1 +
 tests/ref/fate/filter-pixfmts-copy   |  1 +
 tests/ref/fate/filter-pixfmts-crop   |  1 +
 tests/ref/fate/filter-pixfmts-field  |  1 +
 tests/ref/fate/filter-pixfmts-fieldorder |  1 +
 tests/ref/fate/filter-pixfmts-hflip  |  1 +
 tests/ref/fate/filter-pixfmts-il |  1 +
 tests/ref/fate/filter-pixfmts-null   |  1 +
 tests/ref/fate/filter-pixfmts-pad|  1 +
 tests/ref/fate/filter-pixfmts-scale  |  1 +
 tests/ref/fate/filter-pixfmts-transpose  |  1 +
 tests/ref/fate/filter-pixfmts-vflip  |  1 +
 14 files changed, 56 insertions(+), 1 deletion(-)
 create mode 100644 tests/ref/fate/filter-pixdesc-vyu444

diff --git a/libswscale/output.c b/libswscale/output.c
index a11bedde95..6716cfad34 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -2931,6 +2931,46 @@ yuv2uyva_X_c(SwsContext *c, const int16_t *lumFilter,
 }
 }
 
+static void
+yuv2vyu444_X_c(SwsContext *c, const int16_t *lumFilter,
+   const int16_t **lumSrc, int lumFilterSize,
+   const int16_t *chrFilter, const int16_t **chrUSrc,
+   const int16_t **chrVSrc, int chrFilterSize,
+   const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
+{
+int i;
+
+for (i = 0; i < dstW; i++) {
+int j;
+int Y = 1 << 18, U = 1 << 18;
+int V = 1 << 18;
+
+for (j = 0; j < lumFilterSize; j++)
+Y += lumSrc[j][i] * lumFilter[j];
+
+for (j = 0; j < chrFilterSize; j++)
+U += chrUSrc[j][i] * chrFilter[j];
+
+for (j = 0; j < chrFilterSize; j++)
+V += chrVSrc[j][i] * chrFilter[j];
+
+Y >>= 19;
+U >>= 19;
+V >>= 19;
+
+if (Y  & 0x100)
+Y = av_clip_uint8(Y);
+if (U  & 0x100)
+U = av_clip_uint8(U);
+if (V  & 0x100)
+V = av_clip_uint8(V);
+
+dest[3 * i] = V;
+dest[3 * i + 1] = Y;
+dest[3 * i + 2] = U;
+}
+}
+
 #define output_pixel(pos, val, bits) \
 AV_WL16(pos, av_clip_uintp2(val >> shift, bits) << output_shift);
 
@@ -3465,6 +3505,9 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
 *yuv2packed2 = yuv2uyvy422_2_c;
 *yuv2packedX = yuv2uyvy422_X_c;
 break;
+case AV_PIX_FMT_VYU444:
+*yuv2packedX = yuv2vyu444_X_c;
+break;
 case AV_PIX_FMT_YA8:
 *yuv2packed1 = yuv2ya8_1_c;
 *yuv2packed2 = yuv2ya8_2_c;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index a37e8c1869..a75800772c 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -270,7 +270,7 @@ static const FormatEntry format_entries[] = {
 [AV_PIX_FMT_XV36LE]  = { 1, 1 },
 [AV_PIX_FMT_AYUV]= { 1, 1 },
 [AV_PIX_FMT_UYVA]= { 1, 1 },
-[AV_PIX_FMT_VYU444]  = { 1, 0 },
+[AV_PIX_FMT_VYU444]  = { 1, 1 },
 };
 
 /**
diff --git a/tests/ref/fate/filter-pixdesc-vyu444 
b/tests/ref/fate/filter-pixdesc-vyu444
new file mode 100644
index 00..7572621e76
--- /dev/null
+++ b/tests/ref/fate/filter-pixdesc-vyu444
@@ -0,0 +1 @@
+pixdesc-vyu444  ae888f94235dd6d122c4fa3aa40f11d0
diff --git a/tests/ref/fate/filter-pixfmts-copy 
b/tests/ref/fate/filter-pixfmts-copy
index de9b35e35a..e538466636 100644
--- a/tests/ref/fate/filter-pixfmts-copy
+++ b/tests/ref/fate/filter-pixfmts-copy
@@ -101,6 +101,7 @@ uyvaaffad7282152bcce415bdf228df00ae4
 uyvy422 3bcf3c80047592f2211fae3260b1b65d
 vuya3d5e934651cae1ce334001cb1829ad22
 vuyx0af13a42f9d0932c5a9bb6a8a5d1c5ee
+vyu444  2b2e6df31f5895340f25d6f67572b113
 x2bgr10le   550c0d190cf695afa4eaacb644db6b75
 x2rgb10le   c1e3ac21be04a16bb157b22784524520
 xv30le  c14b5a953bf3be56346f66ca174a5b1b
diff --git a/tests/ref/fate/filter-pixfmts-crop 
b/tests/ref/fate/filter-pixfmts-crop
index 666d99f932..37b78ce5ae 100644
--- a/tests/ref/fate/filter-pixfmts-crop
+++ b/tests/ref/fate/filter-pixfmts-crop
@@ -98,6 +98,7 @@ rgba64lefea8ebfc869b52adf353778f29eac7a7
 uyvacaa03b07812dbb6c48b5fb34edf73962
 vuya76578a705ff3a37559653c1289bd03dd
 vuyx615241c5406eb556fca0ad8606c23a02
+vyu444  a6067a24e63385242948dbc4c5a4ab5d
 x2bgr10le   84de725b85662c362862820dc4a309aa
 x2rgb10le   f4265aca7a67dbfa9354370098ca6f33
 xv30le  a9edb820819b900a4a897fee4562a4fb
diff --git a/tests/ref/fate/filter-pixfmts-field 
b/tests/ref/fate/filter-pixfmts-field
index 672ee5d2ec..0cf92f3c21 100644
--- a/tests/ref/fate/filter-pixfmts-field
+++ b/tests/ref/fate/filter-pixfmts-field
@@ -101,6 +101,7 @@ uyvac1c2953840061e3778842051b078a41e
 uyvy422 1c49e44ab3f060e85fc4a3a9464f045e
 vuyaf

[FFmpeg-devel] [PATCH 05/20] swscale/input: add AYUV input support

2024-10-07 Thread James Almer
Signed-off-by: James Almer 
---
 libswscale/input.c | 35 +++
 libswscale/utils.c |  1 +
 2 files changed, 36 insertions(+)

diff --git a/libswscale/input.c b/libswscale/input.c
index d171394bb2..9fe5ef47ce 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -710,6 +710,32 @@ static void read_vuya_A_c(uint8_t *dst, const uint8_t 
*src, const uint8_t *unuse
 dst[i] = src[i * 4 + 3];
 }
 
+static void read_ayuv_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t 
*unused0, const uint8_t *src,
+   const uint8_t *unused1, int width, uint32_t 
*unused2, void *opq)
+{
+int i;
+for (i = 0; i < width; i++) {
+dstU[i] = src[i * 4 + 2];
+dstV[i] = src[i * 4 + 3];
+}
+}
+
+static void read_ayuv_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t 
*unused0, const uint8_t *unused1, int width,
+  uint32_t *unused2, void *opq)
+{
+int i;
+for (i = 0; i < width; i++)
+dst[i] = src[i * 4 + 1];
+}
+
+static void read_ayuv_A_c(uint8_t *dst, const uint8_t *src, const uint8_t 
*unused0, const uint8_t *unused1, int width,
+  uint32_t *unused2, void *opq)
+{
+int i;
+for (i = 0; i < width; i++)
+dst[i] = src[i * 4];
+}
+
 static void read_xv30le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t 
*unused0, const uint8_t *unused1, int width,
uint32_t *unused2, void *opq)
 {
@@ -1438,6 +1464,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 case AV_PIX_FMT_XV30LE:
 c->chrToYV12 = read_xv30le_UV_c;
 break;
+case AV_PIX_FMT_AYUV:
+c->chrToYV12 = read_ayuv_UV_c;
+break;
 case AV_PIX_FMT_AYUV64LE:
 c->chrToYV12 = read_ayuv64le_UV_c;
 break;
@@ -1839,6 +1868,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 case AV_PIX_FMT_XV30LE:
 c->lumToYV12 = read_xv30le_Y_c;
 break;
+case AV_PIX_FMT_AYUV:
+c->lumToYV12 = read_ayuv_Y_c;
+break;
 case AV_PIX_FMT_AYUV64LE:
 c->lumToYV12 = read_ayuv64le_Y_c;
 break;
@@ -2025,6 +2057,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 case AV_PIX_FMT_VUYA:
 c->alpToYV12 = read_vuya_A_c;
 break;
+case AV_PIX_FMT_AYUV:
+c->alpToYV12 = read_ayuv_A_c;
+break;
 case AV_PIX_FMT_AYUV64LE:
 c->alpToYV12 = read_ayuv64le_A_c;
 break;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index c3154d82c1..1a4337833a 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -268,6 +268,7 @@ static const FormatEntry format_entries[] = {
 [AV_PIX_FMT_RGBAF16LE]   = { 1, 0 },
 [AV_PIX_FMT_XV30LE]  = { 1, 1 },
 [AV_PIX_FMT_XV36LE]  = { 1, 1 },
+[AV_PIX_FMT_AYUV]= { 1, 0 },
 };
 
 /**
-- 
2.46.2

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

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


[FFmpeg-devel] [PATCH 13/20] avformat/riff: map v308 fourcc to RAWVIDEO decoder

2024-10-07 Thread James Almer
There's no need to keep using a custom decoder for this pixel format.

Signed-off-by: James Almer 
---
 libavcodec/raw.c | 1 +
 libavformat/riff.c   | 2 +-
 tests/ref/fate/filter-pixdesc-vyu444 | 2 +-
 tests/ref/fate/filter-pixfmts-copy   | 2 +-
 tests/ref/fate/filter-pixfmts-crop   | 2 +-
 tests/ref/fate/filter-pixfmts-field  | 2 +-
 tests/ref/fate/filter-pixfmts-fieldorder | 2 +-
 tests/ref/fate/filter-pixfmts-hflip  | 2 +-
 tests/ref/fate/filter-pixfmts-il | 2 +-
 tests/ref/fate/filter-pixfmts-null   | 2 +-
 tests/ref/fate/filter-pixfmts-pad| 2 +-
 tests/ref/fate/filter-pixfmts-scale  | 2 +-
 tests/ref/fate/filter-pixfmts-transpose  | 2 +-
 tests/ref/fate/filter-pixfmts-vflip  | 2 +-
 14 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/libavcodec/raw.c b/libavcodec/raw.c
index 4b77be4157..086823c06e 100644
--- a/libavcodec/raw.c
+++ b/libavcodec/raw.c
@@ -237,6 +237,7 @@ static const PixelFormatTag raw_pix_fmt_tags[] = {
 { AV_PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', '2') },
 { AV_PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', 's') },
 { AV_PIX_FMT_YUYV422, MKTAG('D', 'V', 'O', 'O') }, /* Digital Voodoo SD 8 
Bit */
+{ AV_PIX_FMT_VYU444,  MKTAG('v', '3', '0', '8') },
 { AV_PIX_FMT_UYVA,MKTAG('v', '4', '0', '8') },
 { AV_PIX_FMT_AYUV,MKTAG('y', '4', '0', '8') },
 { AV_PIX_FMT_RGB555LE,MKTAG('L', '5', '5', '5') },
diff --git a/libavformat/riff.c b/libavformat/riff.c
index a88d54e005..f64dfdeb81 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -296,6 +296,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
 { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '4', 'C', 'B') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '0', 'F', 'L') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '0', 'F', 'B') },
+{ AV_CODEC_ID_RAWVIDEO, MKTAG('v', '3', '0', '8') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('v', '4', '0', '8') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('y', '4', '0', '8') },
 { AV_CODEC_ID_FRWU, MKTAG('F', 'R', 'W', 'U') },
@@ -303,7 +304,6 @@ const AVCodecTag ff_codec_bmp_tags[] = {
 { AV_CODEC_ID_R210, MKTAG('r', '2', '1', '0') },
 { AV_CODEC_ID_V210, MKTAG('v', '2', '1', '0') },
 { AV_CODEC_ID_V210, MKTAG('C', '2', '1', '0') },
-{ AV_CODEC_ID_V308, MKTAG('v', '3', '0', '8') },
 { AV_CODEC_ID_V410, MKTAG('v', '4', '1', '0') },
 { AV_CODEC_ID_YUV4, MKTAG('y', 'u', 'v', '4') },
 { AV_CODEC_ID_INDEO3,   MKTAG('I', 'V', '3', '1') },
diff --git a/tests/ref/fate/filter-pixdesc-vyu444 
b/tests/ref/fate/filter-pixdesc-vyu444
index 7572621e76..a08abee73d 100644
--- a/tests/ref/fate/filter-pixdesc-vyu444
+++ b/tests/ref/fate/filter-pixdesc-vyu444
@@ -1 +1 @@
-pixdesc-vyu444  ae888f94235dd6d122c4fa3aa40f11d0
+pixdesc-vyu444  be62739ab38a49b86c0ed51f21de29e4
diff --git a/tests/ref/fate/filter-pixfmts-copy 
b/tests/ref/fate/filter-pixfmts-copy
index 121bf63a8e..c585b3cbd1 100644
--- a/tests/ref/fate/filter-pixfmts-copy
+++ b/tests/ref/fate/filter-pixfmts-copy
@@ -101,7 +101,7 @@ uyva8896d7525f12de08818a01a5d5cf84f1
 uyvy422 3bcf3c80047592f2211fae3260b1b65d
 vuya3d5e934651cae1ce334001cb1829ad22
 vuyx0af13a42f9d0932c5a9bb6a8a5d1c5ee
-vyu444  2b2e6df31f5895340f25d6f67572b113
+vyu444  93912234400a4373b1a6b5c4e4b1a4ef
 x2bgr10le   550c0d190cf695afa4eaacb644db6b75
 x2rgb10le   c1e3ac21be04a16bb157b22784524520
 xv30le  c14b5a953bf3be56346f66ca174a5b1b
diff --git a/tests/ref/fate/filter-pixfmts-crop 
b/tests/ref/fate/filter-pixfmts-crop
index 25971e5b35..4d3b042aa3 100644
--- a/tests/ref/fate/filter-pixfmts-crop
+++ b/tests/ref/fate/filter-pixfmts-crop
@@ -98,7 +98,7 @@ rgba64lefea8ebfc869b52adf353778f29eac7a7
 uyva03f362ac6a39f25286bc6616111b0752
 vuya76578a705ff3a37559653c1289bd03dd
 vuyx615241c5406eb556fca0ad8606c23a02
-vyu444  a6067a24e63385242948dbc4c5a4ab5d
+vyu444  5d976b25782ff69e4b3b18453fa1447b
 x2bgr10le   84de725b85662c362862820dc4a309aa
 x2rgb10le   f4265aca7a67dbfa9354370098ca6f33
 xv30le  a9edb820819b900a4a897fee4562a4fb
diff --git a/tests/ref/fate/filter-pixfmts-field 
b/tests/ref/fate/filter-pixfmts-field
index 7117898f51..8dd6e6149f 100644
--- a/tests/ref/fate/filter-pixfmts-field
+++ b/tests/ref/fate/filter-pixfmts-field
@@ -101,7 +101,7 @@ uyva147398d2e8d310f915c95863ad192c5e
 uyvy422 1c49e44ab3f060e85fc4a3a9464f045e
 vuyaf72bcf29d75cd143d0c565f7cc49119a
 vuyx3d02eeab336d0a8106f6fdd91be61073
-vyu444  09fcf24f46ed72d51983d87ad3bed864
+vyu444  b139fb4ddaef12a7542a68277211efa7
 x2bgr10le   dbe21538d7cb1744914f6bd46ec09b55
 x2rgb10le   a18bc4ae5274e0a8cca9137ecd50c

[FFmpeg-devel] [PATCH 12/20] avformat/riff: map v408 fourcc to RAWVIDEO decoder

2024-10-07 Thread James Almer
There's no need to keep using a custom decoder for this pixel format.

Signed-off-by: James Almer 
---
 libavcodec/raw.c | 1 +
 libavformat/riff.c   | 2 +-
 tests/ref/fate/filter-pixdesc-uyva   | 2 +-
 tests/ref/fate/filter-pixfmts-copy   | 2 +-
 tests/ref/fate/filter-pixfmts-crop   | 2 +-
 tests/ref/fate/filter-pixfmts-field  | 2 +-
 tests/ref/fate/filter-pixfmts-fieldorder | 2 +-
 tests/ref/fate/filter-pixfmts-hflip  | 2 +-
 tests/ref/fate/filter-pixfmts-il | 2 +-
 tests/ref/fate/filter-pixfmts-null   | 2 +-
 tests/ref/fate/filter-pixfmts-pad| 2 +-
 tests/ref/fate/filter-pixfmts-scale  | 2 +-
 tests/ref/fate/filter-pixfmts-transpose  | 2 +-
 tests/ref/fate/filter-pixfmts-vflip  | 2 +-
 14 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/libavcodec/raw.c b/libavcodec/raw.c
index acdd79ded8..4b77be4157 100644
--- a/libavcodec/raw.c
+++ b/libavcodec/raw.c
@@ -237,6 +237,7 @@ static const PixelFormatTag raw_pix_fmt_tags[] = {
 { AV_PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', '2') },
 { AV_PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', 's') },
 { AV_PIX_FMT_YUYV422, MKTAG('D', 'V', 'O', 'O') }, /* Digital Voodoo SD 8 
Bit */
+{ AV_PIX_FMT_UYVA,MKTAG('v', '4', '0', '8') },
 { AV_PIX_FMT_AYUV,MKTAG('y', '4', '0', '8') },
 { AV_PIX_FMT_RGB555LE,MKTAG('L', '5', '5', '5') },
 { AV_PIX_FMT_RGB565LE,MKTAG('L', '5', '6', '5') },
diff --git a/libavformat/riff.c b/libavformat/riff.c
index b079b00f6c..a88d54e005 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -296,6 +296,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
 { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '4', 'C', 'B') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '0', 'F', 'L') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '0', 'F', 'B') },
+{ AV_CODEC_ID_RAWVIDEO, MKTAG('v', '4', '0', '8') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('y', '4', '0', '8') },
 { AV_CODEC_ID_FRWU, MKTAG('F', 'R', 'W', 'U') },
 { AV_CODEC_ID_R10K, MKTAG('R', '1', '0', 'k') },
@@ -303,7 +304,6 @@ const AVCodecTag ff_codec_bmp_tags[] = {
 { AV_CODEC_ID_V210, MKTAG('v', '2', '1', '0') },
 { AV_CODEC_ID_V210, MKTAG('C', '2', '1', '0') },
 { AV_CODEC_ID_V308, MKTAG('v', '3', '0', '8') },
-{ AV_CODEC_ID_V408, MKTAG('v', '4', '0', '8') },
 { AV_CODEC_ID_V410, MKTAG('v', '4', '1', '0') },
 { AV_CODEC_ID_YUV4, MKTAG('y', 'u', 'v', '4') },
 { AV_CODEC_ID_INDEO3,   MKTAG('I', 'V', '3', '1') },
diff --git a/tests/ref/fate/filter-pixdesc-uyva 
b/tests/ref/fate/filter-pixdesc-uyva
index 49fd1bc6b1..684562877e 100644
--- a/tests/ref/fate/filter-pixdesc-uyva
+++ b/tests/ref/fate/filter-pixdesc-uyva
@@ -1 +1 @@
-pixdesc-uyva7cec5f820722500f491c3495113e726e
+pixdesc-uyva646d7fbb9600f80590d9a7cff4919cd5
diff --git a/tests/ref/fate/filter-pixfmts-copy 
b/tests/ref/fate/filter-pixfmts-copy
index 47e4619369..121bf63a8e 100644
--- a/tests/ref/fate/filter-pixfmts-copy
+++ b/tests/ref/fate/filter-pixfmts-copy
@@ -97,7 +97,7 @@ rgb87ac6008c84d622c2fc50581706e17576
 rgbab6e1b441c365e03b5ffdf9b7b68d9a0c
 rgba64beae2ae04b5efedca3505f47c4dd6ea6ea
 rgba64leb91e1d77f799eb92241a2d2d28437b15
-uyvaaffad7282152bcce415bdf228df00ae4
+uyva8896d7525f12de08818a01a5d5cf84f1
 uyvy422 3bcf3c80047592f2211fae3260b1b65d
 vuya3d5e934651cae1ce334001cb1829ad22
 vuyx0af13a42f9d0932c5a9bb6a8a5d1c5ee
diff --git a/tests/ref/fate/filter-pixfmts-crop 
b/tests/ref/fate/filter-pixfmts-crop
index a1f9faa450..25971e5b35 100644
--- a/tests/ref/fate/filter-pixfmts-crop
+++ b/tests/ref/fate/filter-pixfmts-crop
@@ -95,7 +95,7 @@ rgb89b364a8f112ad9459fec47a51cc03b30
 rgba9488ac85abceaf99a9309eac5a87697e
 rgba64be89910046972ab3c68e2a348302cc8ca9
 rgba64lefea8ebfc869b52adf353778f29eac7a7
-uyvacaa03b07812dbb6c48b5fb34edf73962
+uyva03f362ac6a39f25286bc6616111b0752
 vuya76578a705ff3a37559653c1289bd03dd
 vuyx615241c5406eb556fca0ad8606c23a02
 vyu444  a6067a24e63385242948dbc4c5a4ab5d
diff --git a/tests/ref/fate/filter-pixfmts-field 
b/tests/ref/fate/filter-pixfmts-field
index 67dbff6ea3..7117898f51 100644
--- a/tests/ref/fate/filter-pixfmts-field
+++ b/tests/ref/fate/filter-pixfmts-field
@@ -97,7 +97,7 @@ rgb862c3b9e2a171de3d894a8eeb271c85e8
 rgbaee616262ca6d67b7ecfba4b36c602ce3
 rgba64be23c8c0edaabe3eaec89ce69633fb0048
 rgba64ledfdba4de4a7cac9abf08852666c341d3
-uyvac1c2953840061e3778842051b078a41e
+uyva147398d2e8d310f915c95863ad192c5e
 uyvy422 1c49e44ab3f060e85fc4a3a9464f045e
 vuyaf72bcf29d75cd143d0c565f7cc49119a
 vuyx   

[FFmpeg-devel] [PATCH 08/20] swscale/output: add AYUV output support

2024-10-07 Thread James Almer
Signed-off-by: James Almer 
---
 libswscale/output.c  | 56 
 libswscale/utils.c   |  2 +-
 tests/ref/fate/filter-pixdesc-ayuv   |  1 +
 tests/ref/fate/filter-pixfmts-copy   |  1 +
 tests/ref/fate/filter-pixfmts-crop   |  1 +
 tests/ref/fate/filter-pixfmts-field  |  1 +
 tests/ref/fate/filter-pixfmts-fieldorder |  1 +
 tests/ref/fate/filter-pixfmts-hflip  |  1 +
 tests/ref/fate/filter-pixfmts-il |  1 +
 tests/ref/fate/filter-pixfmts-null   |  1 +
 tests/ref/fate/filter-pixfmts-pad|  1 +
 tests/ref/fate/filter-pixfmts-scale  |  1 +
 tests/ref/fate/filter-pixfmts-transpose  |  1 +
 tests/ref/fate/filter-pixfmts-vflip  |  1 +
 14 files changed, 69 insertions(+), 1 deletion(-)
 create mode 100644 tests/ref/fate/filter-pixdesc-ayuv

diff --git a/libswscale/output.c b/libswscale/output.c
index e5d555f76f..4d6b9d553b 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -2825,6 +2825,59 @@ yuv2vuyX_X_c(SwsContext *c, const int16_t *lumFilter,
 }
 }
 
+static void
+yuv2ayuv_X_c(SwsContext *c, const int16_t *lumFilter,
+ const int16_t **lumSrc, int lumFilterSize,
+ const int16_t *chrFilter, const int16_t **chrUSrc,
+ const int16_t **chrVSrc, int chrFilterSize,
+ const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
+{
+int i;
+
+for (i = 0; i < dstW; i++) {
+int j;
+int Y = 1 << 18, U = 1 << 18;
+int V = 1 << 18, A = 255;
+
+for (j = 0; j < lumFilterSize; j++)
+Y += lumSrc[j][i] * lumFilter[j];
+
+for (j = 0; j < chrFilterSize; j++)
+U += chrUSrc[j][i] * chrFilter[j];
+
+for (j = 0; j < chrFilterSize; j++)
+V += chrVSrc[j][i] * chrFilter[j];
+
+Y >>= 19;
+U >>= 19;
+V >>= 19;
+
+if (Y  & 0x100)
+Y = av_clip_uint8(Y);
+if (U  & 0x100)
+U = av_clip_uint8(U);
+if (V  & 0x100)
+V = av_clip_uint8(V);
+
+if (alpSrc) {
+A = 1 << 18;
+
+for (j = 0; j < lumFilterSize; j++)
+A += alpSrc[j][i] * lumFilter[j];
+
+A >>= 19;
+
+if (A & 0x100)
+A = av_clip_uint8(A);
+}
+
+dest[4 * i] = A;
+dest[4 * i + 1] = Y;
+dest[4 * i + 2] = U;
+dest[4 * i + 3] = V;
+}
+}
+
 #define output_pixel(pos, val, bits) \
 AV_WL16(pos, av_clip_uintp2(val >> shift, bits) << output_shift);
 
@@ -3377,6 +3430,9 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
 case AV_PIX_FMT_AYUV64LE:
 *yuv2packedX = yuv2ayuv64le_X_c;
 break;
+case AV_PIX_FMT_AYUV:
+*yuv2packedX = yuv2ayuv_X_c;
+break;
 case AV_PIX_FMT_VUYA:
 case AV_PIX_FMT_VUYX:
 *yuv2packed1 = yuv2vuyX_1_c;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 28861bde97..a5be311393 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -268,7 +268,7 @@ static const FormatEntry format_entries[] = {
 [AV_PIX_FMT_RGBAF16LE]   = { 1, 0 },
 [AV_PIX_FMT_XV30LE]  = { 1, 1 },
 [AV_PIX_FMT_XV36LE]  = { 1, 1 },
-[AV_PIX_FMT_AYUV]= { 1, 0 },
+[AV_PIX_FMT_AYUV]= { 1, 1 },
 [AV_PIX_FMT_UYVA]= { 1, 0 },
 [AV_PIX_FMT_VYU444]  = { 1, 0 },
 };
diff --git a/tests/ref/fate/filter-pixdesc-ayuv 
b/tests/ref/fate/filter-pixdesc-ayuv
new file mode 100644
index 00..178e847222
--- /dev/null
+++ b/tests/ref/fate/filter-pixdesc-ayuv
@@ -0,0 +1 @@
+pixdesc-ayuva21ac760efdec0065bcf605f4ed75f7f
diff --git a/tests/ref/fate/filter-pixfmts-copy 
b/tests/ref/fate/filter-pixfmts-copy
index 120129dc1e..dc165b5ec5 100644
--- a/tests/ref/fate/filter-pixfmts-copy
+++ b/tests/ref/fate/filter-pixfmts-copy
@@ -2,6 +2,7 @@
 0rgb527ef3d164c8fd0700493733959689c2
 abgr023ecf6396d324edb113e4a483b79ba2
 argbf003b555ef429222005d33844cca9325
+ayuveb7e43cfbb961d1e369311d0f58b9f52
 ayuv64le07b9c969dfbe4add4c0626773b151d4f
 bgr06fcd67c8e6cec723dab21c70cf53dc16
 bgr24   4cff3814819f02ecf5824edfd768d2b1
diff --git a/tests/ref/fate/filter-pixfmts-crop 
b/tests/ref/fate/filter-pixfmts-crop
index 4731e96fc0..07ded708bc 100644
--- a/tests/ref/fate/filter-pixfmts-crop
+++ b/tests/ref/fate/filter-pixfmts-crop
@@ -2,6 +2,7 @@
 0rgb974833c777e6abe6d84dc59af2ca5625
 abgr1d21f5b8a20186ac9dd54459c986a2a7
 argb8b822972049a1e207000763f2564d6e0
+ayuvf2846cdd8fc01820e561fe4d3855938c
 ayuv64leab2f7bc8f150af47c42c778e3ea28bce
 bgr038a84849a9198667c348c686802e3b52
 bgr24   1dacd8e04bf0eff163e82250d01a9cc7
diff --git a/tests/ref/fate/filter-pixfmts-field 
b/tests/ref/fate/filter-pixfmts-field
index 0727d733f2..9e1e06bd80 100644
--- a/test

[FFmpeg-devel] [PATCH 11/20] avformat/riff: map y408 fourcc to RAWVIDEO decoder

2024-10-07 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/raw.c | 1 +
 libavformat/riff.c   | 1 +
 tests/ref/fate/filter-pixdesc-ayuv   | 2 +-
 tests/ref/fate/filter-pixfmts-copy   | 2 +-
 tests/ref/fate/filter-pixfmts-crop   | 2 +-
 tests/ref/fate/filter-pixfmts-field  | 2 +-
 tests/ref/fate/filter-pixfmts-fieldorder | 2 +-
 tests/ref/fate/filter-pixfmts-hflip  | 2 +-
 tests/ref/fate/filter-pixfmts-il | 2 +-
 tests/ref/fate/filter-pixfmts-null   | 2 +-
 tests/ref/fate/filter-pixfmts-pad| 2 +-
 tests/ref/fate/filter-pixfmts-scale  | 2 +-
 tests/ref/fate/filter-pixfmts-transpose  | 2 +-
 tests/ref/fate/filter-pixfmts-vflip  | 2 +-
 14 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/libavcodec/raw.c b/libavcodec/raw.c
index b73b80e5fd..acdd79ded8 100644
--- a/libavcodec/raw.c
+++ b/libavcodec/raw.c
@@ -237,6 +237,7 @@ static const PixelFormatTag raw_pix_fmt_tags[] = {
 { AV_PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', '2') },
 { AV_PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', 's') },
 { AV_PIX_FMT_YUYV422, MKTAG('D', 'V', 'O', 'O') }, /* Digital Voodoo SD 8 
Bit */
+{ AV_PIX_FMT_AYUV,MKTAG('y', '4', '0', '8') },
 { AV_PIX_FMT_RGB555LE,MKTAG('L', '5', '5', '5') },
 { AV_PIX_FMT_RGB565LE,MKTAG('L', '5', '6', '5') },
 { AV_PIX_FMT_RGB565BE,MKTAG('B', '5', '6', '5') },
diff --git a/libavformat/riff.c b/libavformat/riff.c
index ca81b4837a..b079b00f6c 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -296,6 +296,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
 { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '4', 'C', 'B') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '0', 'F', 'L') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '0', 'F', 'B') },
+{ AV_CODEC_ID_RAWVIDEO, MKTAG('y', '4', '0', '8') },
 { AV_CODEC_ID_FRWU, MKTAG('F', 'R', 'W', 'U') },
 { AV_CODEC_ID_R10K, MKTAG('R', '1', '0', 'k') },
 { AV_CODEC_ID_R210, MKTAG('r', '2', '1', '0') },
diff --git a/tests/ref/fate/filter-pixdesc-ayuv 
b/tests/ref/fate/filter-pixdesc-ayuv
index 178e847222..aed45638ef 100644
--- a/tests/ref/fate/filter-pixdesc-ayuv
+++ b/tests/ref/fate/filter-pixdesc-ayuv
@@ -1 +1 @@
-pixdesc-ayuva21ac760efdec0065bcf605f4ed75f7f
+pixdesc-ayuv31b8e3c2e1f027af001f774e8a6feae4
diff --git a/tests/ref/fate/filter-pixfmts-copy 
b/tests/ref/fate/filter-pixfmts-copy
index e538466636..47e4619369 100644
--- a/tests/ref/fate/filter-pixfmts-copy
+++ b/tests/ref/fate/filter-pixfmts-copy
@@ -2,7 +2,7 @@
 0rgb527ef3d164c8fd0700493733959689c2
 abgr023ecf6396d324edb113e4a483b79ba2
 argbf003b555ef429222005d33844cca9325
-ayuveb7e43cfbb961d1e369311d0f58b9f52
+ayuv631859cdc018cd9671482e435a87becc
 ayuv64le07b9c969dfbe4add4c0626773b151d4f
 bgr06fcd67c8e6cec723dab21c70cf53dc16
 bgr24   4cff3814819f02ecf5824edfd768d2b1
diff --git a/tests/ref/fate/filter-pixfmts-crop 
b/tests/ref/fate/filter-pixfmts-crop
index 37b78ce5ae..a1f9faa450 100644
--- a/tests/ref/fate/filter-pixfmts-crop
+++ b/tests/ref/fate/filter-pixfmts-crop
@@ -2,7 +2,7 @@
 0rgb974833c777e6abe6d84dc59af2ca5625
 abgr1d21f5b8a20186ac9dd54459c986a2a7
 argb8b822972049a1e207000763f2564d6e0
-ayuvf2846cdd8fc01820e561fe4d3855938c
+ayuvfb7bdb9f775c47099892c0588f5be426
 ayuv64leab2f7bc8f150af47c42c778e3ea28bce
 bgr038a84849a9198667c348c686802e3b52
 bgr24   1dacd8e04bf0eff163e82250d01a9cc7
diff --git a/tests/ref/fate/filter-pixfmts-field 
b/tests/ref/fate/filter-pixfmts-field
index 0cf92f3c21..67dbff6ea3 100644
--- a/tests/ref/fate/filter-pixfmts-field
+++ b/tests/ref/fate/filter-pixfmts-field
@@ -2,7 +2,7 @@
 0rgbe2c35753a2271d1f9455b1809bc0e907
 abgrc0eb95959edf5d40ff8af315e62d0f8a
 argb6dca4f2987b49b7d63f702d17bace630
-ayuv6aeadbc3ec2a6ff2bfab9495e7285fed
+ayuv25f429cbd3c1ac60851d69c262601415
 ayuv64led9836decca6323ba88b3b3d02257c0b6
 bgr01da3fdbac616b3b410d081e39ed7a1f6
 bgr24   573c76d77b1cbe6534ea7c0267dc1b13
diff --git a/tests/ref/fate/filter-pixfmts-fieldorder 
b/tests/ref/fate/filter-pixfmts-fieldorder
index d902c9087d..745034aba9 100644
--- a/tests/ref/fate/filter-pixfmts-fieldorder
+++ b/tests/ref/fate/filter-pixfmts-fieldorder
@@ -2,7 +2,7 @@
 0rgb2b0f066cfa0bef378a492875d541de8f
 abgr832924b5351361db68dbdbb96c60ae55
 argb80d08e68cb91bc8f2f817516e65f0bd0
-ayuv61b23fc754d8ca0d6740fa08a0a6ebf2
+ayuv7fd34c9bd28c8ac7979eaa41c1a8ab9f
 ayuv64le84ef6260fe02427da946d4a2207fb54c
 bgr0d2c676224ea80ac3ce01afde325ea1a0
 bgr24   b7fdbcd10f20e6ea2d40aae0f329f80d
diff --git

[FFmpeg-devel] [PATCH 15/20] avutil/hwcontext_videotoolbox: add support for UYVA pixel format

2024-10-07 Thread James Almer
Signed-off-by: James Almer 
---
Untested

 libavutil/hwcontext_videotoolbox.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavutil/hwcontext_videotoolbox.c 
b/libavutil/hwcontext_videotoolbox.c
index 1d7dff4a7d..d77b6168f7 100644
--- a/libavutil/hwcontext_videotoolbox.c
+++ b/libavutil/hwcontext_videotoolbox.c
@@ -53,6 +53,7 @@ static const struct {
 #ifdef kCFCoreFoundationVersionNumber10_7
 { kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange,  false, AV_PIX_FMT_NV12 
},
 { kCVPixelFormatType_420YpCbCr8BiPlanarFullRange,   true,  AV_PIX_FMT_NV12 
},
+{ kCVPixelFormatType_YpCbCrA8,  false, AV_PIX_FMT_UYVA 
},
 { kCVPixelFormatType_AYpCbCr8,  false, AV_PIX_FMT_AYUV 
},
 { kCVPixelFormatType_AYpCbCr16, false, 
AV_PIX_FMT_AYUV64 },
 #endif
@@ -88,6 +89,7 @@ static const enum AVPixelFormat supported_formats[] = {
 #ifdef kCFCoreFoundationVersionNumber10_7
 AV_PIX_FMT_NV12,
 AV_PIX_FMT_AYUV,
+AV_PIX_FMT_UYVA,
 AV_PIX_FMT_AYUV64,
 #endif
 AV_PIX_FMT_YUV420P,
-- 
2.46.2

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

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


Re: [FFmpeg-devel] [PATCH] avcodec/decode: clean-up if get_hw_frames_parameters fails

2024-10-07 Thread Rémi Denis-Courmont


Le 30 septembre 2024 17:27:46 GMT+09:00, Thomas Guillem via ffmpeg-devel 
 a écrit :
>Fixes the following assert:
>
>[7f1df83d17e0] vaapi generic error: avcodec_get_hw_frames_parameters 
>failed: -22
>Assertion p_dst->hwaccel_threadsafe || (!dst->hwaccel && 
>!dst->internal->hwaccel_priv_data) failed at libavcodec/pthread_frame.c:349
>
>Reproduced from VLC with VAAPI, when fallbacking from hw to sw.
>---
> libavcodec/decode.c | 7 +++
> 1 file changed, 7 insertions(+)
>
>diff --git a/libavcodec/decode.c b/libavcodec/decode.c
>index c331bb8596..e90a6630e1 100644
>--- a/libavcodec/decode.c
>+++ b/libavcodec/decode.c
>@@ -19,6 +19,7 @@
>  */
> 
> #include 
>+#include 
> #include 
> 
> #include "config.h"
>@@ -1173,6 +1174,7 @@ int avcodec_get_hw_frames_parameters(AVCodecContext 
>*avctx,
> const AVCodecHWConfigInternal *hw_config;
> const FFHWAccel *hwa;
> int i, ret;
>+bool clean_priv_data = false;
> 
> for (i = 0;; i++) {
> hw_config = ffcodec(avctx->codec)->hw_configs[i];
>@@ -1197,6 +1199,7 @@ int avcodec_get_hw_frames_parameters(AVCodecContext 
>*avctx,
> av_buffer_unref(&frames_ref);
> return AVERROR(ENOMEM);
> }
>+clean_priv_data = true;
> }
> 
> ret = hwa->frame_params(avctx, frames_ref);
>@@ -1217,6 +1220,10 @@ int avcodec_get_hw_frames_parameters(AVCodecContext 
>*avctx,
> 
> *out_frames_ref = frames_ref;
> } else {
>+if (clean_priv_data) {
>+av_freep(avctx->internal->hwaccel_priv_data);
>+avctx->internal->hwaccel_priv_data = NULL;

Isn't this assignment redundant? Though IMO, `av_freep` is an abomination that 
needs to be exterminated with extreme prejudice, but I digress. Did you mean to 
use `av_free`?

>+}
> av_buffer_unref(&frames_ref);
> }
> return ret;
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 04/12] swscale/internal: swap SWS_DITHER_NONE and SWS_DITHER_AUTO

2024-10-07 Thread Michael Niedermayer
On Mon, Oct 07, 2024 at 06:47:24PM +0200, Niklas Haas wrote:
> On Mon, 07 Oct 2024 00:15:32 +0200 Michael Niedermayer 
>  wrote:
> > On Sat, Oct 05, 2024 at 09:23:55PM +0200, Niklas Haas wrote:
> > > From: Niklas Haas 
> > >
> > > This is done for consistency with the other public enums which will be
> > > added in the upcoming swscale API refactor. I went through the code and 
> > > checked
> > > carefully that the value of `dither` is never implicitly compared against
> > > zero, so this change should not break anything.
> > >
> > > Sponsored-by: Sovereign Tech Fund
> > > Signed-off-by: Niklas Haas 
> > > ---
> > >  libswscale/swscale_internal.h | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > this breaks:
> >
> > ./ffmpeg -i lena.pnm -vf 
> > scale=iw:ih:flags=0x02:sws_dither=0,format=bgr4_byte -bitexact 
> > whatever.bmp
> 
> This is expected, of course. Are you saying that the change in consistency is
> not worth the risk of breaking users who directly specify numeric IDs instead
> of using the symbolic names?

iam not really sure what to do but
0 has a feeling of "none" to me

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is what and why we do it that matters, not just one of them.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 04/12] swscale/internal: swap SWS_DITHER_NONE and SWS_DITHER_AUTO

2024-10-07 Thread Niklas Haas
On Mon, 07 Oct 2024 20:03:06 +0200 Michael Niedermayer  
wrote:
> On Mon, Oct 07, 2024 at 06:47:24PM +0200, Niklas Haas wrote:
> > On Mon, 07 Oct 2024 00:15:32 +0200 Michael Niedermayer 
> >  wrote:
> > > On Sat, Oct 05, 2024 at 09:23:55PM +0200, Niklas Haas wrote:
> > > > From: Niklas Haas 
> > > >
> > > > This is done for consistency with the other public enums which will be
> > > > added in the upcoming swscale API refactor. I went through the code and 
> > > > checked
> > > > carefully that the value of `dither` is never implicitly compared 
> > > > against
> > > > zero, so this change should not break anything.
> > > >
> > > > Sponsored-by: Sovereign Tech Fund
> > > > Signed-off-by: Niklas Haas 
> > > > ---
> > > >  libswscale/swscale_internal.h | 4 ++--
> > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > this breaks:
> > >
> > > ./ffmpeg -i lena.pnm -vf 
> > > scale=iw:ih:flags=0x02:sws_dither=0,format=bgr4_byte -bitexact 
> > > whatever.bmp
> >
> > This is expected, of course. Are you saying that the change in consistency 
> > is
> > not worth the risk of breaking users who directly specify numeric IDs 
> > instead
> > of using the symbolic names?
>
> iam not really sure what to do but
> 0 has a feeling of "none" to me

Well, I also wanted to add a "none" option to the enum, so maybe I can make
that be the value of 0. I just think that it's weird for the default value of
an enum option to be something other than 0, and the default should probably
be "auto". (Otherwise, what's the point of the "auto" option?)

>
> thx
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> It is what and why we do it that matters, not just one of them.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH v2 1/5] swscale/rgb2xyz: minor style fixes

2024-10-07 Thread Michael Niedermayer
On Mon, Oct 07, 2024 at 07:52:59PM +0200, Niklas Haas wrote:
> From: Niklas Haas 
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Niklas Haas 
> ---
>  libswscale/swscale.c | 16 +++-
>  1 file changed, 7 insertions(+), 9 deletions(-)

ok

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH v2 2/5] swscale/rgb2xyz: add explicit width parameter

2024-10-07 Thread Michael Niedermayer
On Mon, Oct 07, 2024 at 07:53:00PM +0200, Niklas Haas wrote:
> From: Niklas Haas 
> 
> This fixes an 11-year-old bug in the rgb2xyz functions, when used with a
> negative stride. The current loop bounds turned it into a no-op.
> 
> Additionally, this increases performance on highly cropped images, whose
> stride may be substantially higher than the effective width.
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Niklas Haas 
> ---
>  libswscale/swscale.c| 13 +++--
>  tests/ref/fate/filter-pixfmts-vflip |  4 ++--
>  2 files changed, 9 insertions(+), 8 deletions(-)

ok

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH v2 3/5] swscale/rgb2xyz: follow convention on image pointers and strides

2024-10-07 Thread Michael Niedermayer
On Mon, Oct 07, 2024 at 07:53:01PM +0200, Niklas Haas wrote:
> From: Niklas Haas 
> 
> Instead of taking an int16_t pointer and a stride in halfwords, follow the
> usual convention of treating all planes and strides as byte-addressed.
> 
> This does not have any immediate effect but makes these functions more
> reusable without unintended "gotchas".
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Niklas Haas 
> ---
>  libswscale/swscale.c | 83 
>  1 file changed, 45 insertions(+), 38 deletions(-)

ok

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The day soldiers stop bringing you their problems is the day you have stopped 
leading them. They have either lost confidence that you can help or concluded 
you do not care. Either case is a failure of leadership. - Colin Powell


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH v2 4/5] swscale/rgb2xyz: expose these functions internally

2024-10-07 Thread Michael Niedermayer
On Mon, Oct 07, 2024 at 07:53:02PM +0200, Niklas Haas wrote:
> From: Niklas Haas 
> 
> ---
>  libswscale/swscale.c  | 12 ++--
>  libswscale/swscale_internal.h |  6 ++
>  2 files changed, 12 insertions(+), 6 deletions(-)

if they will be used, sure ok

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

"You are 36 times more likely to die in a bathtub than at the hands of a
terrorist. Also, you are 2.5 times more likely to become a president and
2 times more likely to become an astronaut, than to die in a terrorist
attack." -- Thoughty2



signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 04/12] swscale/internal: swap SWS_DITHER_NONE and SWS_DITHER_AUTO

2024-10-07 Thread Michael Niedermayer
On Mon, Oct 07, 2024 at 08:09:19PM +0200, Niklas Haas wrote:
> On Mon, 07 Oct 2024 20:03:06 +0200 Michael Niedermayer 
>  wrote:
> > On Mon, Oct 07, 2024 at 06:47:24PM +0200, Niklas Haas wrote:
> > > On Mon, 07 Oct 2024 00:15:32 +0200 Michael Niedermayer 
> > >  wrote:
> > > > On Sat, Oct 05, 2024 at 09:23:55PM +0200, Niklas Haas wrote:
> > > > > From: Niklas Haas 
> > > > >
> > > > > This is done for consistency with the other public enums which will be
> > > > > added in the upcoming swscale API refactor. I went through the code 
> > > > > and checked
> > > > > carefully that the value of `dither` is never implicitly compared 
> > > > > against
> > > > > zero, so this change should not break anything.
> > > > >
> > > > > Sponsored-by: Sovereign Tech Fund
> > > > > Signed-off-by: Niklas Haas 
> > > > > ---
> > > > >  libswscale/swscale_internal.h | 4 ++--
> > > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > >
> > > > this breaks:
> > > >
> > > > ./ffmpeg -i lena.pnm -vf 
> > > > scale=iw:ih:flags=0x02:sws_dither=0,format=bgr4_byte -bitexact 
> > > > whatever.bmp
> > >
> > > This is expected, of course. Are you saying that the change in 
> > > consistency is
> > > not worth the risk of breaking users who directly specify numeric IDs 
> > > instead
> > > of using the symbolic names?
> >
> > iam not really sure what to do but
> > 0 has a feeling of "none" to me
> 
> Well, I also wanted to add a "none" option to the enum, so maybe I can make
> that be the value of 0.

> I just think that it's weird for the default value of
> an enum option to be something other than 0,

dont see why


> and the default should probably
> be "auto". (Otherwise, what's the point of the "auto" option?)

yes

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH v2 5/5] swscale/internal: constify and expose ff_swscale()

2024-10-07 Thread Michael Niedermayer
On Mon, Oct 07, 2024 at 07:53:03PM +0200, Niklas Haas wrote:
> From: Niklas Haas 
> 
> Used as an intermediate entry point for the new swscale context. The extra
> constification is a consistency measure, as I want to move the memcpy of
> stride and plane pointers to the functions that actually need to mutate them.
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Niklas Haas 
> ---
>  libswscale/slice.c|  3 ++-
>  libswscale/swscale.c  | 50 ---
>  libswscale/swscale_internal.h |  8 +-
>  3 files changed, 38 insertions(+), 23 deletions(-)

probably ok

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH 24/26] avformat/riff: map v410 fourcc to RAWVIDEO decoder

2024-10-07 Thread James Almer
There's no need to keep using a custom decoder for this pixel format.

Signed-off-by: James Almer 
---
 libavcodec/raw.c | 1 +
 libavformat/riff.c   | 1 +
 tests/ref/fate/filter-pixdesc-v30xle | 2 +-
 tests/ref/fate/filter-pixfmts-copy   | 2 +-
 tests/ref/fate/filter-pixfmts-crop   | 2 +-
 tests/ref/fate/filter-pixfmts-field  | 2 +-
 tests/ref/fate/filter-pixfmts-fieldorder | 2 +-
 tests/ref/fate/filter-pixfmts-hflip  | 2 +-
 tests/ref/fate/filter-pixfmts-il | 2 +-
 tests/ref/fate/filter-pixfmts-null   | 2 +-
 tests/ref/fate/filter-pixfmts-scale  | 2 +-
 tests/ref/fate/filter-pixfmts-transpose  | 2 +-
 tests/ref/fate/filter-pixfmts-vflip  | 2 +-
 13 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/libavcodec/raw.c b/libavcodec/raw.c
index 086823c06e..adc189b26a 100644
--- a/libavcodec/raw.c
+++ b/libavcodec/raw.c
@@ -239,6 +239,7 @@ static const PixelFormatTag raw_pix_fmt_tags[] = {
 { AV_PIX_FMT_YUYV422, MKTAG('D', 'V', 'O', 'O') }, /* Digital Voodoo SD 8 
Bit */
 { AV_PIX_FMT_VYU444,  MKTAG('v', '3', '0', '8') },
 { AV_PIX_FMT_UYVA,MKTAG('v', '4', '0', '8') },
+{ AV_PIX_FMT_V30XLE,  MKTAG('v', '4', '1', '0') },
 { AV_PIX_FMT_AYUV,MKTAG('y', '4', '0', '8') },
 { AV_PIX_FMT_RGB555LE,MKTAG('L', '5', '5', '5') },
 { AV_PIX_FMT_RGB565LE,MKTAG('L', '5', '6', '5') },
diff --git a/libavformat/riff.c b/libavformat/riff.c
index 3e87e60e4d..0f5682313e 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -298,6 +298,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
 { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '0', 'F', 'B') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('v', '3', '0', '8') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('v', '4', '0', '8') },
+{ AV_CODEC_ID_RAWVIDEO, MKTAG('v', '4', '1', '0') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('y', '4', '0', '8') },
 { AV_CODEC_ID_FRWU, MKTAG('F', 'R', 'W', 'U') },
 { AV_CODEC_ID_R10K, MKTAG('R', '1', '0', 'k') },
diff --git a/tests/ref/fate/filter-pixdesc-v30xle 
b/tests/ref/fate/filter-pixdesc-v30xle
index 7544dba962..d8f7f5881d 100644
--- a/tests/ref/fate/filter-pixdesc-v30xle
+++ b/tests/ref/fate/filter-pixdesc-v30xle
@@ -1 +1 @@
-pixdesc-v30xle  11ef5c41cd1b0b1be40685e08d806400
+pixdesc-v30xle  aba54233d20ed3da48e361c5058a
diff --git a/tests/ref/fate/filter-pixfmts-copy 
b/tests/ref/fate/filter-pixfmts-copy
index b3f9a192f4..afe9cc5158 100644
--- a/tests/ref/fate/filter-pixfmts-copy
+++ b/tests/ref/fate/filter-pixfmts-copy
@@ -99,7 +99,7 @@ rgba64beae2ae04b5efedca3505f47c4dd6ea6ea
 rgba64leb91e1d77f799eb92241a2d2d28437b15
 uyva8896d7525f12de08818a01a5d5cf84f1
 uyvy422 3bcf3c80047592f2211fae3260b1b65d
-v30xle  1e8a98ac92e19c9ae66b5c52502802aa
+v30xle  bbb1fb47679ea7dc1ab90cc26db8f7d7
 vuya3d5e934651cae1ce334001cb1829ad22
 vuyx0af13a42f9d0932c5a9bb6a8a5d1c5ee
 vyu444  93912234400a4373b1a6b5c4e4b1a4ef
diff --git a/tests/ref/fate/filter-pixfmts-crop 
b/tests/ref/fate/filter-pixfmts-crop
index 03e3d6fa09..8c1ed3c3f7 100644
--- a/tests/ref/fate/filter-pixfmts-crop
+++ b/tests/ref/fate/filter-pixfmts-crop
@@ -96,7 +96,7 @@ rgba9488ac85abceaf99a9309eac5a87697e
 rgba64be89910046972ab3c68e2a348302cc8ca9
 rgba64lefea8ebfc869b52adf353778f29eac7a7
 uyva03f362ac6a39f25286bc6616111b0752
-v30xle  fa8904232b248b08b912a3e427d55052
+v30xle  2c259da6e0329e22c6c68c483f721978
 vuya76578a705ff3a37559653c1289bd03dd
 vuyx615241c5406eb556fca0ad8606c23a02
 vyu444  5d976b25782ff69e4b3b18453fa1447b
diff --git a/tests/ref/fate/filter-pixfmts-field 
b/tests/ref/fate/filter-pixfmts-field
index 7a24cbc8f5..8037e3206c 100644
--- a/tests/ref/fate/filter-pixfmts-field
+++ b/tests/ref/fate/filter-pixfmts-field
@@ -99,7 +99,7 @@ rgba64be23c8c0edaabe3eaec89ce69633fb0048
 rgba64ledfdba4de4a7cac9abf08852666c341d3
 uyva147398d2e8d310f915c95863ad192c5e
 uyvy422 1c49e44ab3f060e85fc4a3a9464f045e
-v30xle  265a463ad722cfaede2fa6cb5e9bf34e
+v30xle  337aab325e9bd1247560b22dae767c29
 vuyaf72bcf29d75cd143d0c565f7cc49119a
 vuyx3d02eeab336d0a8106f6fdd91be61073
 vyu444  b139fb4ddaef12a7542a68277211efa7
diff --git a/tests/ref/fate/filter-pixfmts-fieldorder 
b/tests/ref/fate/filter-pixfmts-fieldorder
index fe4a98530f..5d370a92f5 100644
--- a/tests/ref/fate/filter-pixfmts-fieldorder
+++ b/tests/ref/fate/filter-pixfmts-fieldorder
@@ -88,7 +88,7 @@ rgba64be5598f44514d122b9a57c5c92c20bbc61
 rgba64leb34e6e30621ae579519a2d91a96a0acf
 uyvaccf5dfd33765dda88c4b4afa2ea31305
 uyvy422 75de70e31c435dde878002d3f22b238a
-v30xle  f256208af

[FFmpeg-devel] [PATCH 25/26] avformat/movenc: add support for V410 pixel format

2024-10-07 Thread James Almer
Signed-off-by: James Almer 
---
 libavformat/isom_tags.c | 1 +
 libavformat/movenc.c| 1 +
 2 files changed, 2 insertions(+)

diff --git a/libavformat/isom_tags.c b/libavformat/isom_tags.c
index 1e3495f0e2..e999aa7fef 100644
--- a/libavformat/isom_tags.c
+++ b/libavformat/isom_tags.c
@@ -35,6 +35,7 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
 { AV_CODEC_ID_RAWVIDEO, MKTAG('y', 'u', 'v', 's') }, /* same as 2VUY but 
byte-swapped */
 { AV_CODEC_ID_RAWVIDEO, MKTAG('v', '3', '0', '8') }, /* uncompressed  
8-bit 4:4:4 */
 { AV_CODEC_ID_RAWVIDEO, MKTAG('v', '4', '0', '8') }, /* uncompressed  
8-bit 4:4:4:4 */
+{ AV_CODEC_ID_RAWVIDEO, MKTAG('v', '4', '1', '0') }, /* uncompressed 
10-bit 4:4:4 */
 
 { AV_CODEC_ID_RAWVIDEO, MKTAG('L', '5', '5', '5') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('L', '5', '6', '5') },
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 301b327bfd..8f47e85490 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2614,6 +2614,7 @@ static int mov_write_video_tag(AVFormatContext *s, 
AVIOContext *pb, MOVMuxContex
|| (track->par->codec_id == AV_CODEC_ID_RAWVIDEO && 
track->par->format == AV_PIX_FMT_YUYV422)
|| (track->par->codec_id == AV_CODEC_ID_RAWVIDEO && 
track->par->format == AV_PIX_FMT_VYU444)
|| (track->par->codec_id == AV_CODEC_ID_RAWVIDEO && 
track->par->format == AV_PIX_FMT_UYVA)
+   || (track->par->codec_id == AV_CODEC_ID_RAWVIDEO && 
track->par->format == AV_PIX_FMT_V30X)
 #if FF_API_V408_CODECID
||  track->par->codec_id == AV_CODEC_ID_V308
||  track->par->codec_id == AV_CODEC_ID_V408
-- 
2.46.2

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

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


[FFmpeg-devel] [PATCH 23/26] swscale/output: add V30X output support

2024-10-07 Thread James Almer
Signed-off-by: James Almer 
---
 libswscale/output.c  | 31 
 libswscale/utils.c   |  2 +-
 tests/ref/fate/filter-pixdesc-v30xle |  1 +
 tests/ref/fate/filter-pixfmts-copy   |  1 +
 tests/ref/fate/filter-pixfmts-crop   |  1 +
 tests/ref/fate/filter-pixfmts-field  |  1 +
 tests/ref/fate/filter-pixfmts-fieldorder |  1 +
 tests/ref/fate/filter-pixfmts-hflip  |  1 +
 tests/ref/fate/filter-pixfmts-il |  1 +
 tests/ref/fate/filter-pixfmts-null   |  1 +
 tests/ref/fate/filter-pixfmts-scale  |  1 +
 tests/ref/fate/filter-pixfmts-transpose  |  1 +
 tests/ref/fate/filter-pixfmts-vflip  |  1 +
 13 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100644 tests/ref/fate/filter-pixdesc-v30xle

diff --git a/libswscale/output.c b/libswscale/output.c
index 6716cfad34..dba1a41277 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -2613,6 +2613,34 @@ yuv2ayuv64le_X_c(SwsContext *c, const int16_t *lumFilter,
 }
 }
 
+static void
+yuv2v30xle_X_c(SwsContext *c, const int16_t *lumFilter,
+   const int16_t **lumSrc, int lumFilterSize,
+   const int16_t *chrFilter, const int16_t **chrUSrc,
+   const int16_t **chrVSrc, int chrFilterSize,
+   const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
+{
+int i;
+for (i = 0; i < dstW; i++) {
+unsigned Y = 1 << 16, U = 1 << 16, V = 1 << 16;
+int j;
+
+for (j = 0; j < lumFilterSize; j++)
+Y += lumSrc[j][i] * lumFilter[j];
+
+for (j = 0; j < chrFilterSize; j++) {
+U += chrUSrc[j][i] * chrFilter[j];
+V += chrVSrc[j][i] * chrFilter[j];
+}
+
+Y = av_clip_uintp2(Y >> 17, 10);
+U = av_clip_uintp2(U >> 17, 10);
+V = av_clip_uintp2(V >> 17, 10);
+
+AV_WL32(dest + 4 * i, U << 2 | Y << 12 | V << 22);
+}
+}
+
 static void
 yuv2xv30le_X_c(SwsContext *c, const int16_t *lumFilter,
const int16_t **lumSrc, int lumFilterSize,
@@ -3523,6 +3551,9 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
 *yuv2packed2 = yuv2ya16be_2_c;
 *yuv2packedX = yuv2ya16be_X_c;
 break;
+case AV_PIX_FMT_V30XLE:
+*yuv2packedX = yuv2v30xle_X_c;
+break;
 case AV_PIX_FMT_AYUV64LE:
 *yuv2packedX = yuv2ayuv64le_X_c;
 break;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 719619858f..c81e3b29b8 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -271,7 +271,7 @@ static const FormatEntry format_entries[] = {
 [AV_PIX_FMT_AYUV]= { 1, 1 },
 [AV_PIX_FMT_UYVA]= { 1, 1 },
 [AV_PIX_FMT_VYU444]  = { 1, 1 },
-[AV_PIX_FMT_V30XLE]  = { 1, 0 },
+[AV_PIX_FMT_V30XLE]  = { 1, 1 },
 };
 
 /**
diff --git a/tests/ref/fate/filter-pixdesc-v30xle 
b/tests/ref/fate/filter-pixdesc-v30xle
new file mode 100644
index 00..7544dba962
--- /dev/null
+++ b/tests/ref/fate/filter-pixdesc-v30xle
@@ -0,0 +1 @@
+pixdesc-v30xle  11ef5c41cd1b0b1be40685e08d806400
diff --git a/tests/ref/fate/filter-pixfmts-copy 
b/tests/ref/fate/filter-pixfmts-copy
index c585b3cbd1..b3f9a192f4 100644
--- a/tests/ref/fate/filter-pixfmts-copy
+++ b/tests/ref/fate/filter-pixfmts-copy
@@ -99,6 +99,7 @@ rgba64beae2ae04b5efedca3505f47c4dd6ea6ea
 rgba64leb91e1d77f799eb92241a2d2d28437b15
 uyva8896d7525f12de08818a01a5d5cf84f1
 uyvy422 3bcf3c80047592f2211fae3260b1b65d
+v30xle  1e8a98ac92e19c9ae66b5c52502802aa
 vuya3d5e934651cae1ce334001cb1829ad22
 vuyx0af13a42f9d0932c5a9bb6a8a5d1c5ee
 vyu444  93912234400a4373b1a6b5c4e4b1a4ef
diff --git a/tests/ref/fate/filter-pixfmts-crop 
b/tests/ref/fate/filter-pixfmts-crop
index 4d3b042aa3..03e3d6fa09 100644
--- a/tests/ref/fate/filter-pixfmts-crop
+++ b/tests/ref/fate/filter-pixfmts-crop
@@ -96,6 +96,7 @@ rgba9488ac85abceaf99a9309eac5a87697e
 rgba64be89910046972ab3c68e2a348302cc8ca9
 rgba64lefea8ebfc869b52adf353778f29eac7a7
 uyva03f362ac6a39f25286bc6616111b0752
+v30xle  fa8904232b248b08b912a3e427d55052
 vuya76578a705ff3a37559653c1289bd03dd
 vuyx615241c5406eb556fca0ad8606c23a02
 vyu444  5d976b25782ff69e4b3b18453fa1447b
diff --git a/tests/ref/fate/filter-pixfmts-field 
b/tests/ref/fate/filter-pixfmts-field
index 8dd6e6149f..7a24cbc8f5 100644
--- a/tests/ref/fate/filter-pixfmts-field
+++ b/tests/ref/fate/filter-pixfmts-field
@@ -99,6 +99,7 @@ rgba64be23c8c0edaabe3eaec89ce69633fb0048
 rgba64ledfdba4de4a7cac9abf08852666c341d3
 uyva147398d2e8d310f915c95863ad192c5e
 uyvy422 1c49e44ab3f060e85fc4a3a9464f045e
+v30xle  265a463ad722cfaede2fa6cb5e9bf34e
 vuyaf72bcf29d75cd143d0c565f7cc49119a
 vuyx3d02eeab336d0a8106

[FFmpeg-devel] [PATCH 26/26] avcodec: deprecate v410 de/encoder

2024-10-07 Thread James Almer
The V30X pixel format was recently added, so this lavc workaround is no longer
needed.

Signed-off-by: James Almer 
---
 libavcodec/allcodecs.c  | 2 +-
 libavcodec/codec_desc.c | 2 ++
 libavcodec/codec_id.h   | 2 ++
 libavcodec/v410dec.c| 2 ++
 libavcodec/v410enc.c| 2 ++
 libavformat/isom_tags.c | 2 +-
 libavformat/movenc.c| 2 +-
 libavformat/riff.c  | 2 +-
 8 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 19f7d63c16..d69e70a29b 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -350,9 +350,9 @@ extern const FFCodec ff_v308_encoder;
 extern const FFCodec ff_v308_decoder;
 extern const FFCodec ff_v408_encoder;
 extern const FFCodec ff_v408_decoder;
-#endif
 extern const FFCodec ff_v410_encoder;
 extern const FFCodec ff_v410_decoder;
+#endif
 extern const FFCodec ff_vb_decoder;
 extern const FFCodec ff_vbn_encoder;
 extern const FFCodec ff_vbn_decoder;
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 0e9cd669d2..2c03a466d6 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1146,6 +1146,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("Dxtory"),
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
 },
+#if FF_API_V408_CODECID
 {
 .id= AV_CODEC_ID_V410,
 .type  = AVMEDIA_TYPE_VIDEO,
@@ -1153,6 +1154,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:4:4 10-bit"),
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
 },
+#endif
 {
 .id= AV_CODEC_ID_XWD,
 .type  = AVMEDIA_TYPE_VIDEO,
diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
index 3608c4b856..787313ffaf 100644
--- a/libavcodec/codec_id.h
+++ b/libavcodec/codec_id.h
@@ -206,7 +206,9 @@ enum AVCodecID {
 AV_CODEC_ID_BMV_VIDEO,
 AV_CODEC_ID_VBLE,
 AV_CODEC_ID_DXTORY,
+#if FF_API_V408_CODECID
 AV_CODEC_ID_V410,
+#endif
 AV_CODEC_ID_XWD,
 AV_CODEC_ID_CDXL,
 AV_CODEC_ID_XBM,
diff --git a/libavcodec/v410dec.c b/libavcodec/v410dec.c
index 04be830ad2..d3747c18e0 100644
--- a/libavcodec/v410dec.c
+++ b/libavcodec/v410dec.c
@@ -46,6 +46,8 @@ static av_cold int v410_decode_init(AVCodecContext *avctx)
 }
 }
 
+av_log(avctx, AV_LOG_WARNING, "This decoder is deprecated and will be 
removed.\n");
+
 return 0;
 }
 
diff --git a/libavcodec/v410enc.c b/libavcodec/v410enc.c
index 89ee3a7278..78362ce453 100644
--- a/libavcodec/v410enc.c
+++ b/libavcodec/v410enc.c
@@ -37,6 +37,8 @@ static av_cold int v410_encode_init(AVCodecContext *avctx)
 avctx->bits_per_coded_sample = 32;
 avctx->bit_rate = ff_guess_coded_bitrate(avctx);
 
+av_log(avctx, AV_LOG_WARNING, "This encoder is deprecated and will be 
removed.\n");
+
 return 0;
 }
 
diff --git a/libavformat/isom_tags.c b/libavformat/isom_tags.c
index e999aa7fef..a476efb8f1 100644
--- a/libavformat/isom_tags.c
+++ b/libavformat/isom_tags.c
@@ -66,8 +66,8 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
 #if FF_API_V408_CODECID
 { AV_CODEC_ID_V308,   MKTAG('v', '3', '0', '8') }, /* uncompressed  8-bit 
4:4:4 */
 { AV_CODEC_ID_V408,   MKTAG('v', '4', '0', '8') }, /* uncompressed  8-bit 
4:4:4:4 */
-#endif
 { AV_CODEC_ID_V410,   MKTAG('v', '4', '1', '0') }, /* uncompressed 10-bit 
4:4:4 */
+#endif
 { AV_CODEC_ID_Y41P,   MKTAG('Y', '4', '1', 'P') }, /* uncompressed 12-bit 
4:1:1 */
 { AV_CODEC_ID_YUV4,   MKTAG('y', 'u', 'v', '4') }, /* libquicktime packed 
yuv420p */
 { AV_CODEC_ID_TARGA_Y216, MKTAG('Y', '2', '1', '6') },
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 8f47e85490..0291710762 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2618,8 +2618,8 @@ static int mov_write_video_tag(AVFormatContext *s, 
AVIOContext *pb, MOVMuxContex
 #if FF_API_V408_CODECID
||  track->par->codec_id == AV_CODEC_ID_V308
||  track->par->codec_id == AV_CODEC_ID_V408
-#endif
||  track->par->codec_id == AV_CODEC_ID_V410
+#endif
||  track->par->codec_id == AV_CODEC_ID_V210);
 
 avio_wb32(pb, 0); /* size */
diff --git a/libavformat/riff.c b/libavformat/riff.c
index 0f5682313e..88c4d6cbe9 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -308,8 +308,8 @@ const AVCodecTag ff_codec_bmp_tags[] = {
 #if FF_API_V408_CODECID
 { AV_CODEC_ID_V308, MKTAG('v', '3', '0', '8') },
 { AV_CODEC_ID_V408, MKTAG('v', '4', '0', '8') },
-#endif
 { AV_CODEC_ID_V410, MKTAG('v', '4', '1', '0') },
+#endif
 { AV_CODEC_ID_YUV4, MKTAG('y', 'u', 'v', '4') },
 { AV_CODEC_ID_INDEO3,   MKTAG('I', 'V', '3', '1') },
 { AV_CODEC_ID_INDEO3,   MKTAG('I', 'V', '3', '2') },
-- 
2.46.2

___

[FFmpeg-devel] [PATCH 22/26] swscale/input: add V30X input support

2024-10-07 Thread James Almer
Signed-off-by: James Almer 
---
 libswscale/input.c | 26 ++
 libswscale/utils.c |  1 +
 2 files changed, 27 insertions(+)

diff --git a/libswscale/input.c b/libswscale/input.c
index 7237333e56..3d97c555a3 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -764,6 +764,26 @@ static void vyuToUV_c(uint8_t *dstU, uint8_t *dstV, const 
uint8_t *unused0, cons
 }
 }
 
+static void read_v30xle_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t 
*unused0, const uint8_t *unused1, int width,
+   uint32_t *unused2, void *opq)
+{
+int i;
+for (i = 0; i < width; i++)
+AV_WN16(dst + i * 2, (AV_RL32(src + i * 4) >> 12) & 0x3FFu);
+}
+
+
+static void read_v30xle_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t 
*unused0, const uint8_t *src,
+   const uint8_t *unused1, int width, uint32_t 
*unused2, void *opq)
+{
+int i;
+for (i = 0; i < width; i++) {
+uint32_t pixel = AV_RL32(src + i * 4);
+AV_WN16(dstU + i * 2, (pixel >>  2) & 0x3FFu);
+AV_WN16(dstV + i * 2, (pixel >> 22) & 0x3FFu);
+}
+}
+
 static void read_xv30le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t 
*unused0, const uint8_t *unused1, int width,
uint32_t *unused2, void *opq)
 {
@@ -1501,6 +1521,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c,
 case AV_PIX_FMT_XV30LE:
 *chrToYV12 = read_xv30le_UV_c;
 break;
+case AV_PIX_FMT_V30XLE:
+*chrToYV12 = read_v30xle_UV_c;
+break;
 case AV_PIX_FMT_AYUV:
 *chrToYV12 = read_ayuv_UV_c;
 break;
@@ -1908,6 +1931,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c,
 case AV_PIX_FMT_XV30LE:
 *lumToYV12 = read_xv30le_Y_c;
 break;
+case AV_PIX_FMT_V30XLE:
+*lumToYV12 = read_v30xle_Y_c;
+break;
 case AV_PIX_FMT_AYUV:
 case AV_PIX_FMT_UYVA:
 *lumToYV12 = read_ayuv_Y_c;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 2d3b2b9557..719619858f 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -271,6 +271,7 @@ static const FormatEntry format_entries[] = {
 [AV_PIX_FMT_AYUV]= { 1, 1 },
 [AV_PIX_FMT_UYVA]= { 1, 1 },
 [AV_PIX_FMT_VYU444]  = { 1, 1 },
+[AV_PIX_FMT_V30XLE]  = { 1, 0 },
 };
 
 /**
-- 
2.46.2

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

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


[FFmpeg-devel] [PATCH 21/26] avutil/pixfmt: add V30X pixel format

2024-10-07 Thread James Almer
This maps to the 444YpCbCr10 pixel format as defined by Apple.

Signed-off-by: James Almer 
---
 libavutil/pixdesc.c  | 23 +++
 libavutil/pixfmt.h   |  4 
 tests/ref/fate/imgutils  |  4 
 tests/ref/fate/sws-pixdesc-query |  7 +++
 4 files changed, 38 insertions(+)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index deff74d8a6..f8d6055084 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2727,6 +2727,29 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
 },
 .flags = AV_PIX_FMT_FLAG_BE,
 },
+[AV_PIX_FMT_V30XLE] = {
+.name = "v30xle",
+.nb_components = 3,
+.log2_chroma_w = 0,
+.log2_chroma_h = 0,
+.comp = {
+{ 0, 4, 1, 4, 10 },   /* Y */
+{ 0, 4, 0, 2, 10 },   /* U */
+{ 0, 4, 2, 6, 10 },   /* V */
+},
+},
+[AV_PIX_FMT_V30XBE] = {
+.name = "v30xbe",
+.nb_components= 3,
+.log2_chroma_w= 0,
+.log2_chroma_h= 0,
+.comp = {
+{ 0, 32, 12, 0, 10 }, /* Y */
+{ 0, 32,  2, 0, 10 }, /* U */
+{ 0, 32, 22, 0, 10 }, /* V */
+},
+.flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_BITSTREAM,
+},
 [AV_PIX_FMT_RGBF32BE] = {
 .name = "rgbf32be",
 .nb_components = 3,
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index cbdab31df4..55bdf196fa 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -445,6 +445,9 @@ enum AVPixelFormat {
 
 AV_PIX_FMT_VYU444,  ///< packed VYU 4:4:4, 24bpp (1 Cr & Cb sample per 
1x1 Y), VYUVYU...
 
+AV_PIX_FMT_V30XBE,  ///< packed VYUX 4:4:4 like XV30, 32bpp, (msb)10V 
10Y 10U 2X(lsb), big-endian
+AV_PIX_FMT_V30XLE,  ///< packed VYUX 4:4:4 like XV30, 32bpp, (msb)10V 
10Y 10U 2X(lsb), little-endian
+
 AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you 
want to link with shared libav* because the number of formats might differ 
between versions
 };
 
@@ -539,6 +542,7 @@ enum AVPixelFormat {
 #define AV_PIX_FMT_Y212   AV_PIX_FMT_NE(Y212BE,  Y212LE)
 #define AV_PIX_FMT_XV30   AV_PIX_FMT_NE(XV30BE,  XV30LE)
 #define AV_PIX_FMT_XV36   AV_PIX_FMT_NE(XV36BE,  XV36LE)
+#define AV_PIX_FMT_V30X   AV_PIX_FMT_NE(V30XBE,  V30XLE)
 #define AV_PIX_FMT_X2RGB10AV_PIX_FMT_NE(X2RGB10BE, X2RGB10LE)
 #define AV_PIX_FMT_X2BGR10AV_PIX_FMT_NE(X2BGR10BE, X2BGR10LE)
 
diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils
index 4197005a3f..fd5a510530 100644
--- a/tests/ref/fate/imgutils
+++ b/tests/ref/fate/imgutils
@@ -272,6 +272,8 @@ gbrap14le   planes: 4, linesizes: 128 128 128 128, 
plane_sizes:  6144  6144
 ayuvplanes: 1, linesizes: 256   0   0   0, plane_sizes: 12288 
0 0 0, plane_offsets: 0 0 0, total_size: 12288
 uyvaplanes: 1, linesizes: 256   0   0   0, plane_sizes: 12288 
0 0 0, plane_offsets: 0 0 0, total_size: 12288
 vyu444  planes: 1, linesizes: 192   0   0   0, plane_sizes:  9216 
0 0 0, plane_offsets: 0 0 0, total_size: 9216
+v30xbe  planes: 1, linesizes: 256   0   0   0, plane_sizes: 12288 
0 0 0, plane_offsets: 0 0 0, total_size: 12288
+v30xle  planes: 1, linesizes: 256   0   0   0, plane_sizes: 12288 
0 0 0, plane_offsets: 0 0 0, total_size: 12288
 
 image_fill_black tests
 yuv420p total_size:   4608,  black_unknown_crc: 0xd00f6cc6,  
black_tv_crc: 0xd00f6cc6,  black_pc_crc: 0x234969af
@@ -491,3 +493,5 @@ gbrap14le   total_size:  24576,  black_unknown_crc: 
0x13bde353,  black_tv_cr
 ayuvtotal_size:  12288,  black_unknown_crc: 0xcc44368b,  
black_tv_crc: 0xcc44368b,  black_pc_crc: 0x1e04c638
 uyvatotal_size:  12288,  black_unknown_crc: 0xdd657297,  
black_tv_crc: 0xdd657297,  black_pc_crc: 0x0f258224
 vyu444  total_size:   9216,  black_unknown_crc: 0x575e6fb1,  
black_tv_crc: 0x575e6fb1,  black_pc_crc: 0x16564599
+v30xbe  total_size:  12288,  black_unknown_crc: 0x7108457c,  
black_tv_crc: 0x7108457c,  black_pc_crc: 0xdefcbbe0
+v30xle  total_size:  12288,  black_unknown_crc: 0xf5b3c795,  
black_tv_crc: 0xf5b3c795,  black_pc_crc: 0x0b56173c
diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query
index e1b2ac999a..f153ed3169 100644
--- a/tests/ref/fate/sws-pixdesc-query
+++ b/tests/ref/fate/sws-pixdesc-query
@@ -75,6 +75,8 @@ isNBPS:
   p410le
   p412be
   p412le
+  v30xbe
+  v30xle
   x2bgr10be
   x2bgr10le
   x2rgb10be
@@ -180,6 +182,7 @@ isBE:
   rgbaf16be
   rgbaf32be
   rgbf32be
+  v30xbe
   x2bgr10be
   x2rgb10be
   xv30be
@@ -249,6 +252,8 @@ isYUV:
   uyva
   uyvy422
   uyyvyy411
+  v30xbe
+  v30xle
   vuya
   vuyx
   vyu444
@@ -827,6 +832,8 @@ Packed:
   uyva
   uyvy422
   uyyvyy411
+  v30xbe
+  v30xl

Re: [FFmpeg-devel] [PATCH 13/20] avformat/riff: map v308 fourcc to RAWVIDEO decoder

2024-10-07 Thread James Almer

On 10/7/2024 5:43 PM, Michael Niedermayer wrote:

On Mon, Oct 07, 2024 at 09:29:48AM -0300, James Almer wrote:

There's no need to keep using a custom decoder for this pixel format.

Signed-off-by: James Almer 
---
  libavcodec/raw.c | 1 +
  libavformat/riff.c   | 2 +-
  tests/ref/fate/filter-pixdesc-vyu444 | 2 +-
  tests/ref/fate/filter-pixfmts-copy   | 2 +-
  tests/ref/fate/filter-pixfmts-crop   | 2 +-
  tests/ref/fate/filter-pixfmts-field  | 2 +-
  tests/ref/fate/filter-pixfmts-fieldorder | 2 +-
  tests/ref/fate/filter-pixfmts-hflip  | 2 +-
  tests/ref/fate/filter-pixfmts-il | 2 +-
  tests/ref/fate/filter-pixfmts-null   | 2 +-
  tests/ref/fate/filter-pixfmts-pad| 2 +-
  tests/ref/fate/filter-pixfmts-scale  | 2 +-
  tests/ref/fate/filter-pixfmts-transpose  | 2 +-
  tests/ref/fate/filter-pixfmts-vflip  | 2 +-
  14 files changed, 14 insertions(+), 13 deletions(-)


breaks fate here (but i had conflicts in this patchset)


Niklas pushed a set that made extensive changes to libswscale/input.c, 
so i guess that's why you had conflicts.




TESTvsynth1-v308
--- ./tests/ref/vsynth/vsynth1-v308 2024-09-26 22:49:42.026891952 +0200
+++ tests/data/fate/vsynth1-v3082024-10-07 22:42:35.915229512 +0200
@@ -1,4 +1,4 @@
-5d868b73c554a9a2422d6c8a18ce9c02 *tests/data/fate/vsynth1-v308.avi
+5c0b18a7a404b8eabd4a40092331191a *tests/data/fate/vsynth1-v308.avi
  15213252 tests/data/fate/vsynth1-v308.avi
-10fb42f1abf40a289c3edafc0390482c *tests/data/fate/vsynth1-v308.out.rawvideo
-stddev:2.67 PSNR: 39.60 MAXDIFF:   43 bytes:  7603200/  7603200
+0ad01683d6ee3af89b5e25f07139a2b6 *tests/data/fate/vsynth1-v308.out.rawvideo
+stddev:   39.07 PSNR: 16.29 MAXDIFF:  131 bytes:  7603200/  7603200
Test vsynth1-v308 failed. Look at tests/data/fate/vsynth1-v308.err for details.
make: *** [tests/Makefile:312: fate-vsynth1-v308] Error 1


Will send a new version.



[...]


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

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




OpenPGP_signature.asc
Description: OpenPGP digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH v3 04/17] avformat/dvdvideodec: remove "auto" value for -pg option, default to 1

2024-10-07 Thread Marth64
The default "auto" mode is effectively useless; the reasonable
default use case is to use the first PG (segment) of the
selected PGC for both menus and standard titles. Just
default the value to 1, since the option is irrelevant
unless -pgc is also set.

Note that this should not break users using this advanced option.
The "auto" mode errored and asked for a PG number regardless
for non-menus, and for menus the mode simply defaulted to 1.

Signed-off-by: Marth64 
---
 doc/demuxers.texi |  3 +--
 libavformat/dvdvideodec.c | 31 +--
 2 files changed, 10 insertions(+), 24 deletions(-)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 04293c4813..74b68778bd 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -397,8 +397,7 @@ Default is 0, automatically resolve from value of 
@option{title}.
 The entry PG to start playback, in conjunction with @option{pgc}.
 Alternative to setting @option{title}.
 Chapter markers are not supported at this time.
-Default is 0, automatically resolve from value of @option{title}, or
-start from the beginning (PG 1) of the menu.
+Default is 1, the first PG of the PGC.
 
 @item preindex @var{bool}
 Enable this to have accurate chapter (PTT) markers and duration measurement,
diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index 18c356c132..bed7c38ff6 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -537,7 +537,7 @@ static int dvdvideo_play_open(AVFormatContext *s, 
DVDVideoPlaybackState *state)
 goto end_dvdnav_error;
 }
 
-if (c->opt_pgc > 0 && c->opt_pg > 0) {
+if (c->opt_pgc > 0) {
 if (dvdnav_program_play(state->dvdnav, c->opt_title, c->opt_pgc, 
c->opt_pg) != DVDNAV_STATUS_OK) {
 av_log(s, AV_LOG_ERROR, "Unable to start playback at title %d, PGC 
%d, PG %d\n",
 c->opt_title, c->opt_pgc, c->opt_pg);
@@ -1541,13 +1541,6 @@ static int dvdvideo_read_header(AVFormatContext *s)
 c->opt_menu_lu = 1;
 }
 
-if (!c->opt_pg) {
-av_log(s, AV_LOG_INFO, "Defaulting to menu PG #1. "
-   "This is not always desirable, validation 
suggested.\n");
-
-c->opt_pg = 1;
-}
-
 if ((ret = dvdvideo_ifo_open(s)) < 0||
 (ret = dvdvideo_menu_open(s, &c->play_state)) < 0   ||
 (ret = dvdvideo_subdemux_open(s)) < 0   ||
@@ -1558,7 +1551,13 @@ static int dvdvideo_read_header(AVFormatContext *s)
 return 0;
 }
 
-if (c->opt_chapter_end != 0 && c->opt_chapter_start > c->opt_chapter_end) {
+if (c->opt_pgc && (c->opt_chapter_start > 1 || c->opt_chapter_end > 0 || 
c->opt_preindex)) {
+av_log(s, AV_LOG_ERROR, "PGC extraction not compatible with chapter or 
preindex options\n");
+
+return AVERROR(EINVAL);
+}
+
+if (!c->opt_pgc && (c->opt_chapter_end != 0 && c->opt_chapter_start > 
c->opt_chapter_end)) {
 av_log(s, AV_LOG_ERROR, "Chapter (PTT) range [%d, %d] is invalid\n",
 c->opt_chapter_start, c->opt_chapter_end);
 
@@ -1572,18 +1571,6 @@ static int dvdvideo_read_header(AVFormatContext *s)
 c->opt_title = 1;
 }
 
-if (c->opt_pgc) {
-if (c->opt_pg == 0) {
-av_log(s, AV_LOG_ERROR, "Invalid coordinates. If -pgc is set, -pg 
must be set too.\n");
-
-return AVERROR(EINVAL);
-} else if (c->opt_chapter_start > 1 || c->opt_chapter_end > 0 || 
c->opt_preindex) {
-av_log(s, AV_LOG_ERROR, "-pgc is not compatible with the -preindex 
or "
-"-chapter_start/-chapter_end options\n");
-return AVERROR(EINVAL);
-}
-}
-
 if ((ret = dvdvideo_ifo_open(s)) < 0)
 return ret;
 
@@ -1761,7 +1748,7 @@ static const AVOption dvdvideo_options[] = {
 {"menu","demux menu domain",   
 OFFSET(opt_menu),   AV_OPT_TYPE_BOOL,   { .i64=0 }, 0, 
 1, AV_OPT_FLAG_DECODING_PARAM },
 {"menu_lu", "menu language unit (0=auto)", 
 OFFSET(opt_menu_lu),AV_OPT_TYPE_INT,{ .i64=0 }, 0, 
 99,AV_OPT_FLAG_DECODING_PARAM },
 {"menu_vts","menu VTS (0=VMG main menu)",  
 OFFSET(opt_menu_vts),   AV_OPT_TYPE_INT,{ .i64=0 }, 0, 
 99,AV_OPT_FLAG_DECODING_PARAM },
-{"pg",  "entry PG number (0=auto)",
 OFFSET(opt_pg), AV_OPT_TYPE_INT,{ .i64=0 }, 0, 
 255,   AV_OPT_FLAG_DECODING_PARAM },
+{"pg",  "entry PG number (when paired with PGC number)",   
 OFFSET(opt_pg), AV_OPT_TYPE_INT,{ .i64=1 }, 1, 
 255,   AV_OPT_FLAG_DECODING_PARAM },
 {"pgc", "entry PGC number (0=auto)",  

[FFmpeg-devel] [PATCH v3 00/17] avformat/dvdvideodec: bugfixes and menu chapter markers

2024-10-07 Thread Marth64
This set aims to fix subtle desync issues when handling discontinuities,
do some cleanup, and improve menu support.

Effectively a refresh of v2 set with added patches. Compared to v2:
* Patches 01-11 are the same except fixed (1) sorting typos, (2) missing doc 
update.
* Drops corrupt or duplicate AC3 frames at end of demuxing chapter segments, 
which
  was only revealed as an issue after the frame dropping was fixed in patch 09.
  This is cleaning up after some DVD muxers which author seamless segments in a 
strange way.
* Does some additional cleanup of unnecessary logic/inefficiencies.

Signed-off-by: Marth64 

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

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


[FFmpeg-devel] [PATCH v3 03/17] avformat/dvdvideodec: measure duration of the current menu VOBU in state

2024-10-07 Thread Marth64
This will be a pre-requisite to calculating chapter markers
for menus.

Signed-off-by: Marth64 
---
 libavformat/dvdvideodec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index da41a9d329..18c356c132 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -474,6 +474,7 @@ static int dvdvideo_menu_next_ps_block(AVFormatContext *s, 
DVDVideoPlaybackState
 }
 
 state->vobu_e_ptm= pci.pci_gi.vobu_e_ptm;
+state->vobu_duration = pci.pci_gi.vobu_e_ptm - 
pci.pci_gi.vobu_s_ptm;
 
 av_log(s, AV_LOG_DEBUG, "NAV packet: sector=%d "
 "vobu_s_ptm=%d vobu_e_ptm=%d ts_offset=%" 
PRId64 "\n",
-- 
2.39.5 (Apple Git-154)

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

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


[FFmpeg-devel] [PATCH v3 02/17] avformat/dvdvideodec: fix menu PGC number off-by-one in state

2024-10-07 Thread Marth64
Signed-off-by: Marth64 
---
 libavformat/dvdvideodec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index 4e33d1aba6..da41a9d329 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -344,7 +344,7 @@ static int dvdvideo_menu_open(AVFormatContext *s, 
DVDVideoPlaybackState *state)
 }
 
 /* make sure the PGC is valid */
-state->pgcn  = c->opt_pgc - 1;
+state->pgcn  = c->opt_pgc;
 state->pgc   = pgci_ut->lu[c->opt_menu_lu - 
1].pgcit->pgci_srp[c->opt_pgc - 1].pgc;
 if (!state->pgc || !state->pgc->program_map || !state->pgc->cell_playback) 
{
 av_log(s, AV_LOG_ERROR, "Invalid PGC structure for menu [LU %d, PGC 
%d]\n",
-- 
2.39.5 (Apple Git-154)

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

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


[FFmpeg-devel] [PATCH v3 01/17] avformat/dvdvideodec: remove unused headers

2024-10-07 Thread Marth64
Signed-off-by: Marth64 
---
 libavformat/dvdvideodec.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index 6bd1dbc17f..4e33d1aba6 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -44,8 +44,6 @@
 #include "libavutil/mem.h"
 #include "libavutil/opt.h"
 #include "libavutil/samplefmt.h"
-#include "libavutil/time.h"
-#include "libavutil/timestamp.h"
 
 #include "avformat.h"
 #include "avio_internal.h"
-- 
2.39.5 (Apple Git-154)

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

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


[FFmpeg-devel] [PATCH v3 09/17] avformat/dvdvideodec: reset the subdemuxer on discontinuity instead of flushing

2024-10-07 Thread Marth64
DVDs naturally consist of segmented MPEG-PS blobs within a VOB
(i.e. VOBs are not linear). NAV packs set the segment boundaries.
When switching between segments, discontinuities occur and thus
the subdemuxer needs to be reset. The current approach to manage
this is by invoking ff_read_frame_flush() on the subdemuxer context,
via a callback function which is invoked during the menu or dvdnav
block functions. The same subdemuxer context is used throughout
the demux, with a stretched PTS wrap bits value (64) + disabled
overflow correction, and then flushed on each segment. Eventually,
a play_end context variable is set to declare EOF.

However, this approach causes frame drops. The block read flushes the
demuxer before the frame read is complete, causing frames to drop
on discontinuity. The play_end signal likewise ends playback before
the frame read is complete, causing frames to drop at end of the title.
To compound the issue, the PTS wrap bits value of 64 is wrong;
the VOBU limit is actually 32 and the overflow correction should work.

Instead, EOF the MPEG-PS subdemuxer organically when each VOB segment
ends, and re-open it if needed with the offset after the full frame read
is complete. In doing so, correct the PTS wrap behavior to 32 bits and
remove the play_end/segment_started signals and callback pattern.

Note that the timestamps as reported by the NAV packets are known as
"PTMs", so the fields storing the time prior to adjustment are renamed
accordingly. This makes it more clear when we are offsetting the
NAV packet reported timestamps versus what we present as a demuxer.

Signed-off-by: Marth64 
---
 libavformat/dvdvideodec.c | 139 --
 1 file changed, 75 insertions(+), 64 deletions(-)

diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index ebcfdca9a5..726c45601f 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -56,7 +56,7 @@
 #define DVDVIDEO_MAX_PS_SEARCH_BLOCKS   128
 #define DVDVIDEO_BLOCK_SIZE 2048
 #define DVDVIDEO_TIME_BASE_Q(AVRational) { 1, 
9 }
-#define DVDVIDEO_PTS_WRAP_BITS  64 /* VOBUs use 32 
(PES allows 33) */
+#define DVDVIDEO_PTS_WRAP_BITS  32 /* VOBUs use 32 
(PES allows 33) */
 #define DVDVIDEO_LIBDVDX_LOG_BUFFER_SIZE1024
 
 #define PCI_START_BYTE  45 /* complement 
dvdread's DSI_START_BYTE */
@@ -115,8 +115,9 @@ typedef struct DVDVideoPlaybackState {
 int pgc_nb_pg_est;  /* number of PGs as 
reported by IFOs */
 int pgcn;   /* ID of the PGC we are 
playing */
 int pgn;/* ID of the PG we are in 
now */
+int ptm_discont;/* signal that a PTM 
discontinuity occurred */
+int64_t ptm_offset; /* PTM discontinuity 
offset (as NAV value) */
 int ptt;/* ID of the chapter we 
are in now */
-int64_t ts_offset;  /* PTS discontinuity 
offset (ex. VOB change) */
 uint32_tvobu_duration;  /* duration of the current 
VOBU */
 uint32_tvobu_e_ptm; /* end PTM of the current 
VOBU */
 int vtsn;   /* ID of the active VTS 
(video title set) */
@@ -163,11 +164,11 @@ typedef struct DVDVideoDemuxContext {
 
 /* playback control */
 int64_t first_pts;  /* the PTS of the first 
video keyframe */
-int play_end;   /* signal EOF to the 
parent demuxer */
-DVDVideoPlaybackState   play_state; /* the active playback 
state */
 int play_started;   /* signal that playback 
has started */
+DVDVideoPlaybackState   play_state; /* the active playback 
state */
+int64_t pts_offset; /* PTS discontinuity 
offset (ex. VOB change) */
 int seek_warned;/* signal that we warned 
about seeking limits */
-int segment_started;/* signal that subdemuxer 
is on a segment */
+int subdemux_reset; /* signal that subdemuxer 
should be reset */
 } DVDVideoDemuxContext;
 
 static void dvdvideo_libdvdread_log(void *opaque, dvd_logger_level_t level,
@@ -390,8 +391,7 @@ static int dvdvideo_menu_open(AVFormatContext *s, 
DVDVideoPlaybackState *state)
 }
 
 static int dvdvideo_menu_next_ps_block(AVFormatContext *s, 
DVDVideoPlaybackState *state,
-   uint8_t *buf, int buf_size, int 
*p_is_nav_packet,
-   void (*flush_cb)(AVFormatContext *s))
+   uint8_t *buf, int buf_size, int 

[FFmpeg-devel] [PATCH v3 14/17] avformat/dvdvideodec: remove unnecessary need_parsing argument

2024-10-07 Thread Marth64
The value is always AVSTREAM_PARSE_HEADERS.

Signed-off-by: Marth64 
---
 libavformat/dvdvideodec.c | 22 +-
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index 72565ee125..d64a678589 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -1051,9 +1051,7 @@ static int dvdvideo_video_stream_analyze(AVFormatContext 
*s, video_attr_t video_
 return 0;
 }
 
-static int dvdvideo_video_stream_add(AVFormatContext *s,
- DVDVideoVTSVideoStreamEntry *entry,
- enum AVStreamParseType need_parsing)
+static int dvdvideo_video_stream_add(AVFormatContext *s, 
DVDVideoVTSVideoStreamEntry *entry)
 {
 AVStream *st;
 FFStream *sti;
@@ -1077,7 +1075,7 @@ static int dvdvideo_video_stream_add(AVFormatContext *s,
 
 sti = ffstream(st);
 sti->request_probe = 0;
-sti->need_parsing = need_parsing;
+sti->need_parsing = AVSTREAM_PARSE_HEADERS;
 sti->display_aspect_ratio = entry->dar;
 
 avpriv_set_pts_info(st, DVDVIDEO_PTS_WRAP_BITS,
@@ -1101,7 +1099,7 @@ static int dvdvideo_video_stream_setup(AVFormatContext *s)
 video_attr = c->vts_ifo->vtsi_mat->vts_video_attr;
 
 if ((ret = dvdvideo_video_stream_analyze(s, video_attr, &entry)) < 0 ||
-(ret = dvdvideo_video_stream_add(s, &entry, AVSTREAM_PARSE_HEADERS)) < 
0) {
+(ret = dvdvideo_video_stream_add(s, &entry)) < 0) {
 
 av_log(s, AV_LOG_ERROR, "Unable to add video stream\n");
 return ret;
@@ -1213,8 +1211,7 @@ static int dvdvideo_audio_stream_analyze(AVFormatContext 
*s, audio_attr_t audio_
 return 0;
 }
 
-static int dvdvideo_audio_stream_add(AVFormatContext *s, 
DVDVideoPGCAudioStreamEntry *entry,
- enum AVStreamParseType need_parsing)
+static int dvdvideo_audio_stream_add(AVFormatContext *s, 
DVDVideoPGCAudioStreamEntry *entry)
 {
 AVStream *st;
 FFStream *sti;
@@ -1239,7 +1236,7 @@ static int dvdvideo_audio_stream_add(AVFormatContext *s, 
DVDVideoPGCAudioStreamE
 
 sti = ffstream(st);
 sti->request_probe = 0;
-sti->need_parsing = need_parsing;
+sti->need_parsing = AVSTREAM_PARSE_HEADERS;
 
 avpriv_set_pts_info(st, DVDVIDEO_PTS_WRAP_BITS,
 DVDVIDEO_TIME_BASE_Q.num, DVDVIDEO_TIME_BASE_Q.den);
@@ -1282,7 +1279,7 @@ static int dvdvideo_audio_stream_add_all(AVFormatContext 
*s)
 if (s->streams[j]->id == entry.startcode)
 continue;
 
-if ((ret = dvdvideo_audio_stream_add(s, &entry, 
AVSTREAM_PARSE_HEADERS)) < 0)
+if ((ret = dvdvideo_audio_stream_add(s, &entry)) < 0)
 goto break_error;
 
 continue;
@@ -1319,8 +1316,7 @@ static int dvdvideo_subp_stream_analyze(AVFormatContext 
*s, uint32_t offset, sub
 return 0;
 }
 
-static int dvdvideo_subp_stream_add(AVFormatContext *s, 
DVDVideoPGCSubtitleStreamEntry *entry,
-enum AVStreamParseType need_parsing)
+static int dvdvideo_subp_stream_add(AVFormatContext *s, 
DVDVideoPGCSubtitleStreamEntry *entry)
 {
 AVStream *st;
 FFStream *sti;
@@ -1346,7 +1342,7 @@ static int dvdvideo_subp_stream_add(AVFormatContext *s, 
DVDVideoPGCSubtitleStrea
 
 sti = ffstream(st);
 sti->request_probe = 0;
-sti->need_parsing = need_parsing;
+sti->need_parsing = AVSTREAM_PARSE_HEADERS;
 
 avpriv_set_pts_info(st, DVDVIDEO_PTS_WRAP_BITS,
 DVDVIDEO_TIME_BASE_Q.num, DVDVIDEO_TIME_BASE_Q.den);
@@ -1371,7 +1367,7 @@ static int 
dvdvideo_subp_stream_add_internal(AVFormatContext *s, uint32_t offset
 if (s->streams[i]->id == entry.startcode)
 return 0;
 
-if ((ret = dvdvideo_subp_stream_add(s, &entry, AVSTREAM_PARSE_HEADERS)) < 
0)
+if ((ret = dvdvideo_subp_stream_add(s, &entry)) < 0)
 goto end_error;
 
 return 0;
-- 
2.39.5 (Apple Git-154)

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

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


[FFmpeg-devel] [PATCH v3 13/17] avformat/dvdvideodec: open subdemuxer after initializing IFO headers

2024-10-07 Thread Marth64
It is wasteful to open the subdemuxer if an error occurs while
initializing streams or reading IFO headers.

Signed-off-by: Marth64 
---
 libavformat/dvdvideodec.c | 18 --
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index 9983d34ec9..72565ee125 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -1565,9 +1565,9 @@ static int dvdvideo_read_header(AVFormatContext *s)
 if ((ret = dvdvideo_ifo_open(s)) < 0   
  ||
 (c->opt_preindex && (ret = dvdvideo_chapters_setup_preindex(s)) < 
0) ||
 (ret = dvdvideo_menu_open(s, &c->play_state)) < 0  
  ||
-(ret = dvdvideo_subdemux_open(s)) < 0  
  ||
 (ret = dvdvideo_video_stream_setup(s)) < 0 
  ||
-(ret = dvdvideo_audio_stream_add_all(s)) < 0)
+(ret = dvdvideo_audio_stream_add_all(s)) < 0   
  ||
+(ret = dvdvideo_subdemux_open(s)) < 0)
 return ret;
 
 return 0;
@@ -1599,16 +1599,14 @@ static int dvdvideo_read_header(AVFormatContext *s)
 if (!c->opt_pgc && c->opt_preindex && (ret = 
dvdvideo_chapters_setup_preindex(s)) < 0)
 return ret;
 
-if ((ret = dvdvideo_play_open(s, &c->play_state)) < 0   ||
-(ret = dvdvideo_subdemux_open(s)) < 0   ||
-(ret = dvdvideo_video_stream_setup(s)) < 0  ||
-(ret = dvdvideo_audio_stream_add_all(s)) < 0||
-(ret = dvdvideo_subp_stream_add_all(s)) < 0)
+if ((ret = dvdvideo_play_open(s, &c->play_state)) < 0  
||
+(!c->opt_pgc && !c->opt_preindex && (ret = 
dvdvideo_chapters_setup_simple(s)) < 0) ||
+(ret = dvdvideo_video_stream_setup(s)) < 0 
||
+(ret = dvdvideo_audio_stream_add_all(s)) < 0   
||
+(ret = dvdvideo_subp_stream_add_all(s)) < 0
||
+(ret = dvdvideo_subdemux_open(s)) < 0)
 return ret;
 
-if (!c->opt_pgc && !c->opt_preindex)
-return dvdvideo_chapters_setup_simple(s);
-
 return 0;
 }
 
-- 
2.39.5 (Apple Git-154)

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

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


[FFmpeg-devel] [PATCH v3 16/17] avformat/dvdvideodec: discard duplicate or partial AC3 samples

2024-10-07 Thread Marth64
Some DVD muxers signal segments to start with duplicate audio samples
when starting extraction from a chapter marker or terminate seamless PGs
on partial audio samples (causing corrupt AC3 frames). Clean up after
these muxers by tracking frames with duplicate PTS and eliminating
partial AC3 frames.

This results in smoother chapter extraction and overall seeking experience,
with linear PTS and AC3 delay within 32ms (1 sample) away from the video.

The issue was not apparent until the flushing pattern was replaced with
a full subdemux reset, as the flushing dropped the frames prematurely,
along side others, as such they were never present to begin with.
---
 libavformat/dvdvideodec.c | 36 +++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index f20d2aa5cb..06f842cc1c 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -38,6 +38,7 @@
 #include 
 #include 
 
+#include "libavcodec/ac3_parser.h"
 #include "libavutil/avstring.h"
 #include "libavutil/avutil.h"
 #include "libavutil/intreadwrite.h"
@@ -166,6 +167,7 @@ typedef struct DVDVideoDemuxContext {
 int64_t first_pts;  /* the PTS of the first 
video keyframe */
 int play_started;   /* signal that playback 
has started */
 DVDVideoPlaybackState   play_state; /* the active playback 
state */
+int64_t *prev_pts;  /* track the previous PTS 
emitted per stream */
 int64_t pts_offset; /* PTS discontinuity 
offset (ex. VOB change) */
 int seek_warned;/* signal that we warned 
about seeking limits */
 int subdemux_reset; /* signal that subdemuxer 
should be reset */
@@ -1566,7 +1568,7 @@ static int dvdvideo_read_header(AVFormatContext *s)
 (ret = dvdvideo_subdemux_open(s)) < 0)
 return ret;
 
-return 0;
+goto end_ready;
 }
 
 if (c->opt_pgc && (c->opt_chapter_start > 1 || c->opt_chapter_end > 0 || 
c->opt_preindex)) {
@@ -1603,6 +1605,14 @@ static int dvdvideo_read_header(AVFormatContext *s)
 (ret = dvdvideo_subdemux_open(s)) < 0)
 return ret;
 
+end_ready:
+c->prev_pts = av_malloc(s->nb_streams * sizeof(int64_t));
+if (!c->prev_pts)
+return AVERROR(ENOMEM);
+
+for (int i = 0; i < s->nb_streams; i++)
+c->prev_pts[i] = AV_NOPTS_VALUE;
+
 return 0;
 }
 
@@ -1614,6 +1624,8 @@ static int dvdvideo_read_packet(AVFormatContext *s, 
AVPacket *pkt)
 int is_key = 0;
 int st_mapped  = 0;
 AVStream *st_subdemux;
+uint8_t  ac3_bitstream_id;
+uint16_t ac3_frame_size;
 
 ret = av_read_frame(c->mpeg_ctx, pkt);
 if (ret < 0) {
@@ -1661,11 +1673,27 @@ static int dvdvideo_read_packet(AVFormatContext *s, 
AVPacket *pkt)
 if (pkt->pts < 0)
 goto discard;
 
+/* clean up after DVD muxers which end seamless PGs on duplicate or 
partial AC3 samples */
+if (st_subdemux->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&
+st_subdemux->codecpar->codec_id == AV_CODEC_ID_AC3) {
+
+if (pkt->pts <= c->prev_pts[pkt->stream_index])
+goto discard;
+
+ret = av_ac3_parse_header(pkt->buf->data, pkt->size,
+&ac3_bitstream_id, &ac3_frame_size);
+
+if (ret < 0 || pkt->size != ac3_frame_size)
+goto discard;
+}
+
 av_log(s, AV_LOG_TRACE, "st=%d pts=%" PRId64 " dts=%" PRId64 " "
 "pts_offset=%" PRId64 " first_pts=%" PRId64 "\n",
 pkt->stream_index, pkt->pts, pkt->dts,
 c->pts_offset, c->first_pts);
 
+c->prev_pts[pkt->stream_index] = pkt->pts;
+
 return 0;
 
 discard:
@@ -1673,6 +1701,9 @@ discard:
"Discarding frame @ st=%d pts=%" PRId64 " dts=%" PRId64 " is_key=%d 
st_mapped=%d\n",
st_mapped ? pkt->stream_index : -1, pkt->pts, pkt->dts, is_key, 
st_mapped);
 
+if (st_mapped)
+c->prev_pts[pkt->stream_index] = pkt->pts;
+
 return FFERROR_REDO;
 }
 
@@ -1689,6 +1720,9 @@ static int dvdvideo_close(AVFormatContext *s)
 
 dvdvideo_ifo_close(s);
 
+if (c->prev_pts)
+av_freep(&c->prev_pts);
+
 return 0;
 }
 
-- 
2.39.5 (Apple Git-154)

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

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


[FFmpeg-devel] [PATCH v3 12/17] avformat/dvdvideodec: remove auto value for menu_lu option

2024-10-07 Thread Marth64
The "auto" mode serves no functional purpose except for logging
a message and setting the value to 1. The documentation clearly
explains what the option is for.

Signed-off-by: Marth64 
---
 doc/demuxers.texi | 2 +-
 libavformat/dvdvideodec.c | 9 +
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 95be82aefc..86a9158e59 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -380,7 +380,7 @@ Default is false.
 
 @item menu_lu @var{int}
 The menu language to demux. In DVD, menus are grouped by language.
-Default is 0, the first language unit.
+Default is 1, the first language unit.
 
 @item menu_vts @var{int}
 The VTS where the menu lives, or 0 if it is a VMG menu (root-level).
diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index 1da1865061..9983d34ec9 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -1562,13 +1562,6 @@ static int dvdvideo_read_header(AVFormatContext *s)
 return AVERROR(EINVAL);
 }
 
-if (!c->opt_menu_lu) {
-av_log(s, AV_LOG_INFO, "Defaulting to menu language unit #1. "
-   "This is not always desirable, validation 
suggested.\n");
-
-c->opt_menu_lu = 1;
-}
-
 if ((ret = dvdvideo_ifo_open(s)) < 0   
  ||
 (c->opt_preindex && (ret = dvdvideo_chapters_setup_preindex(s)) < 
0) ||
 (ret = dvdvideo_menu_open(s, &c->play_state)) < 0  
  ||
@@ -1782,7 +1775,7 @@ static const AVOption dvdvideo_options[] = {
 {"chapter_end", "exit chapter (PTT) number (0=end)",   
 OFFSET(opt_chapter_end),AV_OPT_TYPE_INT,{ .i64=0 }, 0, 
 99,AV_OPT_FLAG_DECODING_PARAM },
 {"chapter_start",   "entry chapter (PTT) number",  
 OFFSET(opt_chapter_start),  AV_OPT_TYPE_INT,{ .i64=1 }, 1, 
 99,AV_OPT_FLAG_DECODING_PARAM },
 {"menu","demux menu domain",   
 OFFSET(opt_menu),   AV_OPT_TYPE_BOOL,   { .i64=0 }, 0, 
 1, AV_OPT_FLAG_DECODING_PARAM },
-{"menu_lu", "menu language unit (0=auto)", 
 OFFSET(opt_menu_lu),AV_OPT_TYPE_INT,{ .i64=0 }, 0, 
 99,AV_OPT_FLAG_DECODING_PARAM },
+{"menu_lu", "menu language unit",  
 OFFSET(opt_menu_lu),AV_OPT_TYPE_INT,{ .i64=1 }, 1, 
 99,AV_OPT_FLAG_DECODING_PARAM },
 {"menu_vts","menu VTS (0=VMG root menu)",  
 OFFSET(opt_menu_vts),   AV_OPT_TYPE_INT,{ .i64=1 }, 0, 
 99,AV_OPT_FLAG_DECODING_PARAM },
 {"pg",  "entry PG number (when paired with PGC number)",   
 OFFSET(opt_pg), AV_OPT_TYPE_INT,{ .i64=1 }, 1, 
 255,   AV_OPT_FLAG_DECODING_PARAM },
 {"pgc", "entry PGC number (0=auto)",   
 OFFSET(opt_pgc),AV_OPT_TYPE_INT,{ .i64=0 }, 0, 
 999,   AV_OPT_FLAG_DECODING_PARAM },
-- 
2.39.5 (Apple Git-154)

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

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


[FFmpeg-devel] [PATCH v3 15/17] avformat/dvdvideodec: drop packets with unset PTS or DTS

2024-10-07 Thread Marth64
The packets effectively serve no purpose and we are already
dropping packets with PTS less than 0. This also creates
for a smoother seeking experience after the subdemuxer
reset fix.

Signed-off-by: Marth64 
---
 libavformat/dvdvideodec.c | 29 -
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index d64a678589..f20d2aa5cb 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -1643,28 +1643,23 @@ static int dvdvideo_read_packet(AVFormatContext *s, 
AVPacket *pkt)
 }
 }
 
-if (!st_mapped)
+if (!st_mapped || pkt->pts == AV_NOPTS_VALUE || pkt->dts == AV_NOPTS_VALUE)
 goto discard;
 
-if (pkt->pts != AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE) {
-if (!c->play_started) {
-/* try to start at the beginning of a GOP */
-if (st_subdemux->codecpar->codec_type != AVMEDIA_TYPE_VIDEO || 
!is_key)
-goto discard;
+if (!c->play_started) {
+/* try to start at the beginning of a GOP */
+if (st_subdemux->codecpar->codec_type != AVMEDIA_TYPE_VIDEO || !is_key)
+goto discard;
 
-c->first_pts = pkt->pts;
-c->play_started = 1;
-}
+c->first_pts = pkt->pts;
+c->play_started = 1;
+}
 
-pkt->pts += c->pts_offset - c->first_pts;
-pkt->dts += c->pts_offset - c->first_pts;
+pkt->pts += c->pts_offset - c->first_pts;
+pkt->dts += c->pts_offset - c->first_pts;
 
-if (pkt->pts < 0)
-goto discard;
-} else {
-av_log(s, AV_LOG_WARNING, "Unset PTS or DTS @ st=%d pts=%" PRId64 " 
dts=%" PRId64 "\n",
-  pkt->stream_index, pkt->pts, pkt->dts);
-}
+if (pkt->pts < 0)
+goto discard;
 
 av_log(s, AV_LOG_TRACE, "st=%d pts=%" PRId64 " dts=%" PRId64 " "
 "pts_offset=%" PRId64 " first_pts=%" PRId64 "\n",
-- 
2.39.5 (Apple Git-154)

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

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


[FFmpeg-devel] [PATCH v3 08/17] avformat/dvdvideodec: simplify dvdvideo_read_packet()

2024-10-07 Thread Marth64
The function has a few branches where it discards frames via
FFERROR_REDO; consolidate is via a goto block to simplify the
function and improve readability. Logging still maintains
all the relevant details for the reason of the discard.

Signed-off-by: Marth64 
---
 libavformat/dvdvideodec.c | 44 +++
 1 file changed, 21 insertions(+), 23 deletions(-)

diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index 5df123ac44..ebcfdca9a5 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -1615,8 +1615,9 @@ static int dvdvideo_read_packet(AVFormatContext *s, 
AVPacket *pkt)
 DVDVideoDemuxContext *c = s->priv_data;
 
 int ret;
-enum AVMediaType st_type;
-int found_stream = 0;
+int is_key = 0;
+int st_mapped  = 0;
+AVStream *st_subdemux;
 
 if (c->play_end)
 return AVERROR_EOF;
@@ -1629,32 +1630,27 @@ static int dvdvideo_read_packet(AVFormatContext *s, 
AVPacket *pkt)
 if (!c->segment_started)
 c->segment_started = 1;
 
-st_type = c->mpeg_ctx->streams[pkt->stream_index]->codecpar->codec_type;
+st_subdemux = c->mpeg_ctx->streams[pkt->stream_index];
+is_key  = pkt->flags & AV_PKT_FLAG_KEY;
 
 /* map the subdemuxer stream to the parent demuxer's stream (by startcode) 
*/
 for (int i = 0; i < s->nb_streams; i++) {
-if (s->streams[i]->id == c->mpeg_ctx->streams[pkt->stream_index]->id) {
+if (s->streams[i]->id == st_subdemux->id) {
 pkt->stream_index = s->streams[i]->index;
-found_stream = 1;
+st_mapped = 1;
+
 break;
 }
 }
 
-if (!found_stream) {
-av_log(s, AV_LOG_DEBUG, "discarding frame with stream that was not in 
IFO headers "
-"(stream id=%d)\n", 
c->mpeg_ctx->streams[pkt->stream_index]->id);
-
-return FFERROR_REDO;
-}
+if (!st_mapped)
+goto discard;
 
 if (pkt->pts != AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE) {
 if (!c->play_started) {
 /* try to start at the beginning of a GOP */
-if (st_type != AVMEDIA_TYPE_VIDEO || !(pkt->flags & 
AV_PKT_FLAG_KEY)) {
-av_log(s, AV_LOG_VERBOSE, "Discarding packet which is not a 
video keyframe or "
-  "with unset PTS/DTS at start\n");
-return FFERROR_REDO;
-}
+if (st_subdemux->codecpar->codec_type != AVMEDIA_TYPE_VIDEO || 
!is_key)
+goto discard;
 
 c->first_pts = pkt->pts;
 c->play_started = 1;
@@ -1663,13 +1659,8 @@ static int dvdvideo_read_packet(AVFormatContext *s, 
AVPacket *pkt)
 pkt->pts += c->play_state.ts_offset - c->first_pts;
 pkt->dts += c->play_state.ts_offset - c->first_pts;
 
-if (pkt->pts < 0) {
-av_log(s, AV_LOG_VERBOSE, "Discarding packet with negative PTS 
(st=%d pts=%" PRId64 "), "
-  "this is OK at start of playback\n",
-  pkt->stream_index, pkt->pts);
-
-return FFERROR_REDO;
-}
+if (pkt->pts < 0)
+goto discard;
 } else {
 av_log(s, AV_LOG_WARNING, "Unset PTS or DTS @ st=%d pts=%" PRId64 " 
dts=%" PRId64 "\n",
   pkt->stream_index, pkt->pts, pkt->dts);
@@ -1681,6 +1672,13 @@ static int dvdvideo_read_packet(AVFormatContext *s, 
AVPacket *pkt)
 c->play_state.ts_offset, c->first_pts);
 
 return c->play_end ? AVERROR_EOF : 0;
+
+discard:
+av_log(s, st_mapped ? AV_LOG_VERBOSE : AV_LOG_DEBUG,
+   "Discarding frame @ st=%d pts=%" PRId64 " dts=%" PRId64 " is_key=%d 
st_mapped=%d\n",
+   st_mapped ? pkt->stream_index : -1, pkt->pts, pkt->dts, is_key, 
st_mapped);
+
+return FFERROR_REDO;
 }
 
 static int dvdvideo_close(AVFormatContext *s)
-- 
2.39.5 (Apple Git-154)

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

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


[FFmpeg-devel] [PATCH v3 05/17] avformat/dvdvideodec: move memcpy below missed NAV packet warning

2024-10-07 Thread Marth64
Readability improvement; the warning can be bundled beneath
the preceding validations rather than awkwardly between the memcpy
and return.

Signed-off-by: Marth64 
---
 libavformat/dvdvideodec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index bed7c38ff6..9246ac0863 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -804,13 +804,13 @@ static int dvdvideo_play_next_ps_block(AVFormatContext 
*s, DVDVideoPlaybackState
 return AVERROR_INPUT_CHANGED;
 }
 
-memcpy(buf, &nav_buf, nav_len);
-
 if (state->pgn != cur_pgn)
 av_log(s, AV_LOG_WARNING, "Unexpected PG change 
(expected=%d actual=%d); "
   "this could be due to a missed 
NAV packet\n",
   state->pgn, cur_pgn);
 
+memcpy(buf, &nav_buf, nav_len);
+
 (*p_nav_event) = nav_event;
 
 state->is_seeking = 0;
-- 
2.39.5 (Apple Git-154)

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

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


[FFmpeg-devel] [PATCH v3 17/17] avformat/dvdvideodec: don't allow seeking beyond dvdnav reported duration

2024-10-07 Thread Marth64
There is no reason to accept timestamp values beyond what dvdnav
reported as the duration of the title.

Signed-off-by: Marth64 
---
 libavformat/dvdvideodec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index 06f842cc1c..b3ad2d63aa 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -1743,7 +1743,7 @@ static int dvdvideo_read_seek(AVFormatContext *s, int 
stream_index, int64_t time
 if ((flags & AVSEEK_FLAG_BYTE))
 return AVERROR(ENOSYS);
 
-if (timestamp < 0)
+if (timestamp < 0 || timestamp > s->duration)
 return AVERROR(EINVAL);
 
 if (!c->seek_warned) {
-- 
2.39.5 (Apple Git-154)

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

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


[FFmpeg-devel] [PATCH v3 07/17] avformat/dvdvideodec: enable chapter calculation for menus

2024-10-07 Thread Marth64
Menus are generally segmented by cell, so use them as the
marker delimiters. Requires preindex option to be enabled.

Signed-off-by: Marth64 
---
 doc/demuxers.texi |  1 -
 libavformat/dvdvideodec.c | 53 ++-
 2 files changed, 35 insertions(+), 19 deletions(-)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 74b68778bd..a03e80732a 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -405,7 +405,6 @@ which requires a slow second pass read in order to index 
the chapter marker
 timestamps from NAV packets. This is non-ideal extra work for real optical 
drives.
 It is recommended and faster to use this option with a backup of the DVD 
structure
 stored on a hard drive. Not compatible with @option{pgc} and @option{pg}.
-Not applicable to menus.
 Default is 0, false.
 
 @item trim @var{bool}
diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index 066edaaa27..5df123ac44 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -909,19 +909,26 @@ static int 
dvdvideo_chapters_setup_preindex(AVFormatContext *s)
 {
 DVDVideoDemuxContext *c = s->priv_data;
 
-int ret = 0, interrupt = 0;
-int nb_chapters = 0, last_ptt = c->opt_chapter_start;
+int ret, partn, last_partn;
+int interrupt = 0, nb_chapters = 0;
 uint64_t cur_chapter_offset = 0, cur_chapter_duration = 0;
 DVDVideoPlaybackState state = {0};
 
 uint8_t nav_buf[DVDVIDEO_BLOCK_SIZE];
-int nav_event;
+int is_nav_packet;
 
 if (c->opt_chapter_start == c->opt_chapter_end)
-return ret;
+return 0;
 
-if ((ret = dvdvideo_play_open(s, &state)) < 0)
-return ret;
+if (c->opt_menu) {
+if ((ret = dvdvideo_menu_open(s, &state)) < 0)
+return ret;
+last_partn = state.celln;
+} else {
+if ((ret = dvdvideo_play_open(s, &state)) < 0)
+return ret;
+last_partn = c->opt_chapter_start;
+}
 
 if (state.pgc->nr_of_programs == 1)
 goto end_close;
@@ -930,15 +937,22 @@ static int 
dvdvideo_chapters_setup_preindex(AVFormatContext *s)
"Indexing chapter markers, this will take a long time. Please 
wait...\n");
 
 while (!(interrupt = ff_check_interrupt(&s->interrupt_callback))) {
-ret = dvdvideo_play_next_ps_block(s, &state, nav_buf, 
DVDVIDEO_BLOCK_SIZE,
-  &nav_event, NULL);
+if (c->opt_menu)
+ret = dvdvideo_menu_next_ps_block(s, &state, nav_buf, 
DVDVIDEO_BLOCK_SIZE, &is_nav_packet,
+  NULL);
+else
+ret = dvdvideo_play_next_ps_block(s, &state, nav_buf, 
DVDVIDEO_BLOCK_SIZE, &is_nav_packet,
+  NULL);
+
 if (ret < 0 && ret != AVERROR_EOF)
 goto end_close;
 
-if (nav_event != DVDNAV_NAV_PACKET && ret != AVERROR_EOF)
+if (!is_nav_packet && ret != AVERROR_EOF)
 continue;
 
-if (state.ptt == last_ptt) {
+partn = c->opt_menu ? state.celln : state.ptt;
+
+if (partn == last_partn) {
 cur_chapter_duration += state.vobu_duration;
 /* ensure we add the last chapter */
 if (ret != AVERROR_EOF)
@@ -957,7 +971,7 @@ static int dvdvideo_chapters_setup_preindex(AVFormatContext 
*s)
 
 cur_chapter_offset += cur_chapter_duration;
 cur_chapter_duration = state.vobu_duration;
-last_ptt = state.ptt;
+last_partn = partn;
 
 if (ret == AVERROR_EOF)
 break;
@@ -977,7 +991,10 @@ static int 
dvdvideo_chapters_setup_preindex(AVFormatContext *s)
 ret = 0;
 
 end_close:
-dvdvideo_play_close(s, &state);
+if (c->opt_menu)
+dvdvideo_menu_close(s, &state);
+else
+dvdvideo_play_close(s, &state);
 
 return ret;
 }
@@ -1523,11 +1540,10 @@ static int dvdvideo_read_header(AVFormatContext *s)
 if (c->opt_menu) {
 if (c->opt_region   ||
 c->opt_title > 1||
-c->opt_preindex ||
 c->opt_chapter_start > 1||
 c->opt_chapter_end > 0) {
 av_log(s, AV_LOG_ERROR, "-menu is not compatible with the -region, 
-title, "
-"-preindex, or -chapter_start/-chapter_end 
options\n");
+"or -chapter_start/-chapter_end 
options\n");
 return AVERROR(EINVAL);
 }
 
@@ -1544,10 +1560,11 @@ static int dvdvideo_read_header(AVFormatContext *s)
 c->opt_menu_lu = 1;
 }
 
-if ((ret = dvdvideo_ifo_open(s)) < 0||
-(ret = dvdvideo_menu_open(s, &c->play_state)) < 0   ||
-(ret = dvdvideo_subdemux_open(s)) < 0   ||
-(ret = dvdvideo_video_stream_setup(s)) < 0  ||
+if ((ret = dvdvideo_ifo_open(s)) < 0   
  

[FFmpeg-devel] [PATCH v3 06/17] avformat/dvdvideodec: standardize the NAV packet event signal

2024-10-07 Thread Marth64
This consolidates the FFERROR_REDO handling of NAV packets to
dvdvideo_subdemux_read_data(), is a pre-requisite to calculating
chapter markers for menus, and a pre-requisite to fixing the
frame desync issue when the subdemuxer is flushed.

Signed-off-by: Marth64 
---
 libavformat/dvdvideodec.c | 31 +--
 1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index 9246ac0863..066edaaa27 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -390,7 +390,7 @@ static int dvdvideo_menu_open(AVFormatContext *s, 
DVDVideoPlaybackState *state)
 }
 
 static int dvdvideo_menu_next_ps_block(AVFormatContext *s, 
DVDVideoPlaybackState *state,
-   uint8_t *buf, int buf_size,
+   uint8_t *buf, int buf_size, int 
*p_is_nav_packet,
void (*flush_cb)(AVFormatContext *s))
 {
 int64_t blocks_read   = 0;
@@ -398,6 +398,8 @@ static int dvdvideo_menu_next_ps_block(AVFormatContext *s, 
DVDVideoPlaybackState
 pci_t pci = (pci_t) {0};
 dsi_t dsi = (dsi_t) {0};
 
+(*p_is_nav_packet)  = 0;
+
 if (buf_size != DVDVIDEO_BLOCK_SIZE) {
 av_log(s, AV_LOG_ERROR, "Invalid buffer size (expected=%d 
actual=%d)\n",
 DVDVIDEO_BLOCK_SIZE, buf_size);
@@ -481,7 +483,9 @@ static int dvdvideo_menu_next_ps_block(AVFormatContext *s, 
DVDVideoPlaybackState
 dsi.dsi_gi.nv_pck_lbn,
 pci.pci_gi.vobu_s_ptm, pci.pci_gi.vobu_e_ptm, 
state->ts_offset);
 
-return FFERROR_REDO;
+(*p_is_nav_packet) = 1;
+
+return 0;
 }
 
 /* we are in the middle of a VOBU, so pass on the PS packet */
@@ -611,8 +615,7 @@ end_dvdnav_error:
 }
 
 static int dvdvideo_play_next_ps_block(AVFormatContext *s, 
DVDVideoPlaybackState *state,
-   uint8_t *buf, int buf_size,
-   int *p_nav_event,
+   uint8_t *buf, int buf_size, int 
*p_is_nav_packet,
void (*flush_cb)(AVFormatContext *s))
 {
 DVDVideoDemuxContext *c = s->priv_data;
@@ -627,6 +630,8 @@ static int dvdvideo_play_next_ps_block(AVFormatContext *s, 
DVDVideoPlaybackState
 pci_t *e_pci;
 dsi_t *e_dsi;
 
+(*p_is_nav_packet)  = 0;
+
 if (buf_size != DVDVIDEO_BLOCK_SIZE) {
 av_log(s, AV_LOG_ERROR, "Invalid buffer size (expected=%d 
actual=%d)\n",
 DVDVIDEO_BLOCK_SIZE, buf_size);
@@ -780,9 +785,9 @@ static int dvdvideo_play_next_ps_block(AVFormatContext *s, 
DVDVideoPlaybackState
 
 state->vobu_e_ptm = e_pci->pci_gi.vobu_e_ptm;
 
-(*p_nav_event) = nav_event;
+(*p_is_nav_packet) = 1;
 
-return nav_len;
+return 0;
 case DVDNAV_BLOCK_OK:
 if (!state->in_ps) {
 if (state->in_pgc)
@@ -811,8 +816,6 @@ static int dvdvideo_play_next_ps_block(AVFormatContext *s, 
DVDVideoPlaybackState
 
 memcpy(buf, &nav_buf, nav_len);
 
-(*p_nav_event) = nav_event;
-
 state->is_seeking = 0;
 
 return nav_len;
@@ -1442,18 +1445,18 @@ static int dvdvideo_subdemux_read_data(void *opaque, 
uint8_t *buf, int buf_size)
 AVFormatContext *s = opaque;
 DVDVideoDemuxContext *c = s->priv_data;
 
-int ret = 0;
-int nav_event;
+int ret;
+int is_nav_packet;
 
 if (c->play_end)
 return AVERROR_EOF;
 
 if (c->opt_menu)
-ret = dvdvideo_menu_next_ps_block(s, &c->play_state, buf, buf_size,
+ret = dvdvideo_menu_next_ps_block(s, &c->play_state, buf, buf_size, 
&is_nav_packet,
   dvdvideo_subdemux_flush);
 else
-ret = dvdvideo_play_next_ps_block(opaque, &c->play_state, buf, 
buf_size,
-  &nav_event, dvdvideo_subdemux_flush);
+ret = dvdvideo_play_next_ps_block(s, &c->play_state, buf, buf_size, 
&is_nav_packet,
+  dvdvideo_subdemux_flush);
 
 if (ret == AVERROR_EOF) {
 c->mpeg_pb.pub.eof_reached = 1;
@@ -1462,7 +1465,7 @@ static int dvdvideo_subdemux_read_data(void *opaque, 
uint8_t *buf, int buf_size)
 return AVERROR_EOF;
 }
 
-if (ret >= 0 && nav_event == DVDNAV_NAV_PACKET)
+if (ret == 0 && is_nav_packet)
 return FFERROR_REDO;
 
 return ret;
-- 
2.39.5 (Apple Git-154)

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

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

[FFmpeg-devel] [PATCH v3 11/17] avformat/dvdvideodec: default menu_vts option to 1 and clarify description

2024-10-07 Thread Marth64
Menu 0 is the VIDEO_TS root menu, which does not appear to be used
commonly for menu segments. Instead, default to the menu of VTS 1.

Signed-off-by: Marth64 
---
 doc/demuxers.texi | 2 +-
 libavformat/dvdvideodec.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index a03e80732a..95be82aefc 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -384,7 +384,7 @@ Default is 0, the first language unit.
 
 @item menu_vts @var{int}
 The VTS where the menu lives, or 0 if it is a VMG menu (root-level).
-Default is 0, VMG menu.
+Default is 1, menu of the first VTS.
 
 @item pgc @var{int}
 The entry PGC to start playback, in conjunction with @option{pg}.
diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index f7c7ba5a3b..1da1865061 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -1783,7 +1783,7 @@ static const AVOption dvdvideo_options[] = {
 {"chapter_start",   "entry chapter (PTT) number",  
 OFFSET(opt_chapter_start),  AV_OPT_TYPE_INT,{ .i64=1 }, 1, 
 99,AV_OPT_FLAG_DECODING_PARAM },
 {"menu","demux menu domain",   
 OFFSET(opt_menu),   AV_OPT_TYPE_BOOL,   { .i64=0 }, 0, 
 1, AV_OPT_FLAG_DECODING_PARAM },
 {"menu_lu", "menu language unit (0=auto)", 
 OFFSET(opt_menu_lu),AV_OPT_TYPE_INT,{ .i64=0 }, 0, 
 99,AV_OPT_FLAG_DECODING_PARAM },
-{"menu_vts","menu VTS (0=VMG main menu)",  
 OFFSET(opt_menu_vts),   AV_OPT_TYPE_INT,{ .i64=0 }, 0, 
 99,AV_OPT_FLAG_DECODING_PARAM },
+{"menu_vts","menu VTS (0=VMG root menu)",  
 OFFSET(opt_menu_vts),   AV_OPT_TYPE_INT,{ .i64=1 }, 0, 
 99,AV_OPT_FLAG_DECODING_PARAM },
 {"pg",  "entry PG number (when paired with PGC number)",   
 OFFSET(opt_pg), AV_OPT_TYPE_INT,{ .i64=1 }, 1, 
 255,   AV_OPT_FLAG_DECODING_PARAM },
 {"pgc", "entry PGC number (0=auto)",   
 OFFSET(opt_pgc),AV_OPT_TYPE_INT,{ .i64=0 }, 0, 
 999,   AV_OPT_FLAG_DECODING_PARAM },
 {"preindex","enable for accurate chapter markers, slow (2-pass 
read)",  OFFSET(opt_preindex),   AV_OPT_TYPE_BOOL,   { .i64=0 }, 0, 
 1, AV_OPT_FLAG_DECODING_PARAM },
-- 
2.39.5 (Apple Git-154)

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

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


[FFmpeg-devel] [PATCH v3 10/17] avformat/dvdvideodec: check the length of a NAV packet when reading titles

2024-10-07 Thread Marth64
Some discs present titles with bogus NAV packets. We apply this check
for menus and for title MPEG blocks, but we should also apply it
for NAV packets during title demuxing.

Signed-off-by: Marth64 
---
 libavformat/dvdvideodec.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index 726c45601f..f7c7ba5a3b 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -740,6 +740,13 @@ static int dvdvideo_play_next_ps_block(AVFormatContext *s, 
DVDVideoPlaybackState
 return AVERROR_EOF;
 }
 
+if (nav_len != DVDVIDEO_BLOCK_SIZE) {
+av_log(s, AV_LOG_ERROR, "Invalid NAV packet size 
(expected=%d actual=%d)\n",
+DVDVIDEO_BLOCK_SIZE, nav_len);
+
+return AVERROR_INVALIDDATA;
+}
+
 e_pci = dvdnav_get_current_nav_pci(state->dvdnav);
 e_dsi = dvdnav_get_current_nav_dsi(state->dvdnav);
 
-- 
2.39.5 (Apple Git-154)

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

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


Re: [FFmpeg-devel] [PATCH 12/12] swscale/input: parametrize ff_sws_init_input_funcs() pointers

2024-10-07 Thread James Almer

On 10/5/2024 4:24 PM, Niklas Haas wrote:

From: Niklas Haas 

Following the precedent set by ff_sws_init_output_funcs().

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas 
---
  libswscale/input.c| 388 +-
  libswscale/swscale.c  |   3 +-
  libswscale/swscale_internal.h |   8 +-
  3 files changed, 206 insertions(+), 193 deletions(-)

diff --git a/libswscale/input.c b/libswscale/input.c
index d171394bb2..2a7a6c91dd 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -1285,86 +1285,92 @@ static void rgbaf16##endian_name##ToA_c(uint8_t *_dst, 
const uint8_t *_src, cons
  rgbaf16_funcs_endian(le, 0)
  rgbaf16_funcs_endian(be, 1)
  
-av_cold void ff_sws_init_input_funcs(SwsContext *c)

+av_cold void ff_sws_init_input_funcs(SwsContext *c,
+ planar1_YV12_fn *lumToYV12,
+ planar1_YV12_fn *alpToYV12,
+ planar2_YV12_fn *chrToYV12,
+ planarX_YV12_fn *readLumPlanar,
+ planarX_YV12_fn *readAlpPlanar,
+ planarX2_YV12_fn *readChrPlanar)


Is ff_sws_init_input_funcs() going to be called with function pointers 
from other than the input SwsContext at some point?




OpenPGP_signature.asc
Description: OpenPGP digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 13/20] avformat/riff: map v308 fourcc to RAWVIDEO decoder

2024-10-07 Thread Michael Niedermayer
On Mon, Oct 07, 2024 at 09:29:48AM -0300, James Almer wrote:
> There's no need to keep using a custom decoder for this pixel format.
> 
> Signed-off-by: James Almer 
> ---
>  libavcodec/raw.c | 1 +
>  libavformat/riff.c   | 2 +-
>  tests/ref/fate/filter-pixdesc-vyu444 | 2 +-
>  tests/ref/fate/filter-pixfmts-copy   | 2 +-
>  tests/ref/fate/filter-pixfmts-crop   | 2 +-
>  tests/ref/fate/filter-pixfmts-field  | 2 +-
>  tests/ref/fate/filter-pixfmts-fieldorder | 2 +-
>  tests/ref/fate/filter-pixfmts-hflip  | 2 +-
>  tests/ref/fate/filter-pixfmts-il | 2 +-
>  tests/ref/fate/filter-pixfmts-null   | 2 +-
>  tests/ref/fate/filter-pixfmts-pad| 2 +-
>  tests/ref/fate/filter-pixfmts-scale  | 2 +-
>  tests/ref/fate/filter-pixfmts-transpose  | 2 +-
>  tests/ref/fate/filter-pixfmts-vflip  | 2 +-
>  14 files changed, 14 insertions(+), 13 deletions(-)

breaks fate here (but i had conflicts in this patchset)

TESTvsynth1-v308
--- ./tests/ref/vsynth/vsynth1-v308 2024-09-26 22:49:42.026891952 +0200
+++ tests/data/fate/vsynth1-v3082024-10-07 22:42:35.915229512 +0200
@@ -1,4 +1,4 @@
-5d868b73c554a9a2422d6c8a18ce9c02 *tests/data/fate/vsynth1-v308.avi
+5c0b18a7a404b8eabd4a40092331191a *tests/data/fate/vsynth1-v308.avi
 15213252 tests/data/fate/vsynth1-v308.avi
-10fb42f1abf40a289c3edafc0390482c *tests/data/fate/vsynth1-v308.out.rawvideo
-stddev:2.67 PSNR: 39.60 MAXDIFF:   43 bytes:  7603200/  7603200
+0ad01683d6ee3af89b5e25f07139a2b6 *tests/data/fate/vsynth1-v308.out.rawvideo
+stddev:   39.07 PSNR: 16.29 MAXDIFF:  131 bytes:  7603200/  7603200
Test vsynth1-v308 failed. Look at tests/data/fate/vsynth1-v308.err for details.
make: *** [tests/Makefile:312: fate-vsynth1-v308] Error 1

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Any man who breaks a law that conscience tells him is unjust and willingly 
accepts the penalty by staying in jail in order to arouse the conscience of 
the community on the injustice of the law is at that moment expressing the 
very highest respect for law. - Martin Luther King Jr


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 09/12] swscale/internal: constify SwsFunc

2024-10-07 Thread Sean McGovern
Hi,

On Sun, Oct 6, 2024 at 6:31 PM Michael Niedermayer
 wrote:
>
> On Sat, Oct 05, 2024 at 09:24:00PM +0200, Niklas Haas wrote:
> > From: Niklas Haas 
> >
> > I want to move away from having random leaf processing functions mutate
> > plane pointers, and while we're at it, we might as well make the strides
> > and tables const as well.
> >
> > Sponsored-by: Sovereign Tech Fund
> > Signed-off-by: Niklas Haas 
> > ---
> >  libswscale/aarch64/swscale_unscaled.c |  34 ++--
> >  libswscale/alphablend.c   |   6 +-
> >  libswscale/arm/swscale_unscaled.c |  26 +--
> >  libswscale/bayer_template.c   |   4 +-
> >  libswscale/loongarch/yuv2rgb_lasx.c   |  12 +-
> >  libswscale/loongarch/yuv2rgb_lsx.c|  12 +-
> >  libswscale/ppc/yuv2rgb_altivec.c  |  12 +-
> >  libswscale/rgb2rgb.c  |   2 +-
> >  libswscale/rgb2rgb.h  |   4 +-
> >  libswscale/rgb2rgb_template.c |   2 +-
> >  libswscale/swscale_internal.h |  12 +-
> >  libswscale/swscale_unscaled.c | 242 +-
> >  libswscale/x86/yuv2rgb.c  |  54 +++---
> >  libswscale/yuv2rgb.c  |   6 +-
> >  14 files changed, 220 insertions(+), 208 deletions(-)
>
> should be ok

Sorry for not checking this earlier, but PowerPC 32- and 64-bit builds
with AltiVec enabled now fail with:

src/libswscale/ppc/yuv2yuv_altivec.c: In function ‘ff_get_unscaled_swscale_ppc’:
src/libswscale/ppc/yuv2yuv_altivec.c:199:33: error: assignment to
‘SwsFunc’ {aka ‘int (*)(SwsContext *, const unsigned char * const*,
const int *, int,  int,  unsigned char * const*, const int *)’} from
incompatible pointer type ‘int (*)(SwsContext *, const uint8_t **, int
*, int,  int,  uint8_t **, int *)’ {aka ‘int (*)(SwsContext *, const
unsigned char **, int *, int,  int,  unsigned char **, int *)’}
[-Wincompatible-pointer-types]
  199 | c->convert_unscaled = yv12toyuy2_unscaled_altivec;
  | ^
src/libswscale/ppc/yuv2yuv_altivec.c:201:33: error: assignment to
‘SwsFunc’ {aka ‘int (*)(SwsContext *, const unsigned char * const*,
const int *, int,  int,  unsigned char * const*, const int *)’} from
incompatible pointer type ‘int (*)(SwsContext *, const uint8_t **, int
*, int,  int,  uint8_t **, int *)’ {aka ‘int (*)(SwsContext *, const
unsigned char **, int *, int,  int,  unsigned char **, int *)’}
[-Wincompatible-pointer-types]
  201 | c->convert_unscaled = yv12touyvy_unscaled_altivec;
  | ^
make: *** [src/ffbuild/common.mak:81: libswscale/ppc/yuv2yuv_altivec.o] Error 1

>
>
> thx
>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Modern terrorism, a quick summary: Need oil, start war with country that
> has oil, kill hundread thousand in war. Let country fall into chaos,
> be surprised about raise of fundamantalists. Drop more bombs, kill more
> people, be surprised about them taking revenge and drop even more bombs
> and strip your own citizens of their rights and freedoms. to be continued
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH v2 13/20] avformat/riff: map v308 fourcc to RAWVIDEO decoder

2024-10-07 Thread James Almer
There's no need to keep using a custom decoder for this pixel format.

Signed-off-by: James Almer 
---
 libavcodec/raw.c | 1 +
 libavformat/riff.c   | 1 +
 tests/ref/fate/filter-pixdesc-vyu444 | 2 +-
 tests/ref/fate/filter-pixfmts-copy   | 2 +-
 tests/ref/fate/filter-pixfmts-crop   | 2 +-
 tests/ref/fate/filter-pixfmts-field  | 2 +-
 tests/ref/fate/filter-pixfmts-fieldorder | 2 +-
 tests/ref/fate/filter-pixfmts-hflip  | 2 +-
 tests/ref/fate/filter-pixfmts-il | 2 +-
 tests/ref/fate/filter-pixfmts-null   | 2 +-
 tests/ref/fate/filter-pixfmts-pad| 2 +-
 tests/ref/fate/filter-pixfmts-scale  | 2 +-
 tests/ref/fate/filter-pixfmts-transpose  | 2 +-
 tests/ref/fate/filter-pixfmts-vflip  | 2 +-
 14 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/libavcodec/raw.c b/libavcodec/raw.c
index 4b77be4157..086823c06e 100644
--- a/libavcodec/raw.c
+++ b/libavcodec/raw.c
@@ -237,6 +237,7 @@ static const PixelFormatTag raw_pix_fmt_tags[] = {
 { AV_PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', '2') },
 { AV_PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', 's') },
 { AV_PIX_FMT_YUYV422, MKTAG('D', 'V', 'O', 'O') }, /* Digital Voodoo SD 8 
Bit */
+{ AV_PIX_FMT_VYU444,  MKTAG('v', '3', '0', '8') },
 { AV_PIX_FMT_UYVA,MKTAG('v', '4', '0', '8') },
 { AV_PIX_FMT_AYUV,MKTAG('y', '4', '0', '8') },
 { AV_PIX_FMT_RGB555LE,MKTAG('L', '5', '5', '5') },
diff --git a/libavformat/riff.c b/libavformat/riff.c
index 02f6b5ebc6..7ee04c70f4 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -296,6 +296,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
 { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '4', 'C', 'B') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '0', 'F', 'L') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '0', 'F', 'B') },
+{ AV_CODEC_ID_RAWVIDEO, MKTAG('v', '3', '0', '8') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('v', '4', '0', '8') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('y', '4', '0', '8') },
 { AV_CODEC_ID_FRWU, MKTAG('F', 'R', 'W', 'U') },
diff --git a/tests/ref/fate/filter-pixdesc-vyu444 
b/tests/ref/fate/filter-pixdesc-vyu444
index 7572621e76..a08abee73d 100644
--- a/tests/ref/fate/filter-pixdesc-vyu444
+++ b/tests/ref/fate/filter-pixdesc-vyu444
@@ -1 +1 @@
-pixdesc-vyu444  ae888f94235dd6d122c4fa3aa40f11d0
+pixdesc-vyu444  be62739ab38a49b86c0ed51f21de29e4
diff --git a/tests/ref/fate/filter-pixfmts-copy 
b/tests/ref/fate/filter-pixfmts-copy
index 121bf63a8e..c585b3cbd1 100644
--- a/tests/ref/fate/filter-pixfmts-copy
+++ b/tests/ref/fate/filter-pixfmts-copy
@@ -101,7 +101,7 @@ uyva8896d7525f12de08818a01a5d5cf84f1
 uyvy422 3bcf3c80047592f2211fae3260b1b65d
 vuya3d5e934651cae1ce334001cb1829ad22
 vuyx0af13a42f9d0932c5a9bb6a8a5d1c5ee
-vyu444  2b2e6df31f5895340f25d6f67572b113
+vyu444  93912234400a4373b1a6b5c4e4b1a4ef
 x2bgr10le   550c0d190cf695afa4eaacb644db6b75
 x2rgb10le   c1e3ac21be04a16bb157b22784524520
 xv30le  c14b5a953bf3be56346f66ca174a5b1b
diff --git a/tests/ref/fate/filter-pixfmts-crop 
b/tests/ref/fate/filter-pixfmts-crop
index 25971e5b35..4d3b042aa3 100644
--- a/tests/ref/fate/filter-pixfmts-crop
+++ b/tests/ref/fate/filter-pixfmts-crop
@@ -98,7 +98,7 @@ rgba64lefea8ebfc869b52adf353778f29eac7a7
 uyva03f362ac6a39f25286bc6616111b0752
 vuya76578a705ff3a37559653c1289bd03dd
 vuyx615241c5406eb556fca0ad8606c23a02
-vyu444  a6067a24e63385242948dbc4c5a4ab5d
+vyu444  5d976b25782ff69e4b3b18453fa1447b
 x2bgr10le   84de725b85662c362862820dc4a309aa
 x2rgb10le   f4265aca7a67dbfa9354370098ca6f33
 xv30le  a9edb820819b900a4a897fee4562a4fb
diff --git a/tests/ref/fate/filter-pixfmts-field 
b/tests/ref/fate/filter-pixfmts-field
index 7117898f51..8dd6e6149f 100644
--- a/tests/ref/fate/filter-pixfmts-field
+++ b/tests/ref/fate/filter-pixfmts-field
@@ -101,7 +101,7 @@ uyva147398d2e8d310f915c95863ad192c5e
 uyvy422 1c49e44ab3f060e85fc4a3a9464f045e
 vuyaf72bcf29d75cd143d0c565f7cc49119a
 vuyx3d02eeab336d0a8106f6fdd91be61073
-vyu444  09fcf24f46ed72d51983d87ad3bed864
+vyu444  b139fb4ddaef12a7542a68277211efa7
 x2bgr10le   dbe21538d7cb1744914f6bd46ec09b55
 x2rgb10le   a18bc4ae5274e0a8cca9137ecd50c677
 xv30le  e940366c78efc9e292e9de28cf04dba9
diff --git a/tests/ref/fate/filter-pixfmts-fieldorder 
b/tests/ref/fate/filter-pixfmts-fieldorder
index c36e382b3f..41c6607ec7 100644
--- a/tests/ref/fate/filter-pixfmts-fieldorder
+++ b/tests/ref/fate/filter-pixfmts-fieldorder
@@ -90,7 +90,7 @@ uyvaccf5dfd33765dda88c4b4afa2ea31305
 uyvy422 75de70e31c435dde878002d3f22b238a
 vuyaa3891d4168ff208948fd0b3ba0910495
 vuyx9e4480c5fc

[FFmpeg-devel] [PATCH v2 12/20] avformat/riff: map v408 fourcc to RAWVIDEO decoder

2024-10-07 Thread James Almer
There's no need to keep using a custom decoder for this pixel format.

Signed-off-by: James Almer 
---
 libavcodec/raw.c | 1 +
 libavformat/riff.c   | 1 +
 tests/ref/fate/filter-pixdesc-uyva   | 2 +-
 tests/ref/fate/filter-pixfmts-copy   | 2 +-
 tests/ref/fate/filter-pixfmts-crop   | 2 +-
 tests/ref/fate/filter-pixfmts-field  | 2 +-
 tests/ref/fate/filter-pixfmts-fieldorder | 2 +-
 tests/ref/fate/filter-pixfmts-hflip  | 2 +-
 tests/ref/fate/filter-pixfmts-il | 2 +-
 tests/ref/fate/filter-pixfmts-null   | 2 +-
 tests/ref/fate/filter-pixfmts-pad| 2 +-
 tests/ref/fate/filter-pixfmts-scale  | 2 +-
 tests/ref/fate/filter-pixfmts-transpose  | 2 +-
 tests/ref/fate/filter-pixfmts-vflip  | 2 +-
 14 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/libavcodec/raw.c b/libavcodec/raw.c
index acdd79ded8..4b77be4157 100644
--- a/libavcodec/raw.c
+++ b/libavcodec/raw.c
@@ -237,6 +237,7 @@ static const PixelFormatTag raw_pix_fmt_tags[] = {
 { AV_PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', '2') },
 { AV_PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', 's') },
 { AV_PIX_FMT_YUYV422, MKTAG('D', 'V', 'O', 'O') }, /* Digital Voodoo SD 8 
Bit */
+{ AV_PIX_FMT_UYVA,MKTAG('v', '4', '0', '8') },
 { AV_PIX_FMT_AYUV,MKTAG('y', '4', '0', '8') },
 { AV_PIX_FMT_RGB555LE,MKTAG('L', '5', '5', '5') },
 { AV_PIX_FMT_RGB565LE,MKTAG('L', '5', '6', '5') },
diff --git a/libavformat/riff.c b/libavformat/riff.c
index b079b00f6c..02f6b5ebc6 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -296,6 +296,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
 { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '4', 'C', 'B') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '0', 'F', 'L') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '0', 'F', 'B') },
+{ AV_CODEC_ID_RAWVIDEO, MKTAG('v', '4', '0', '8') },
 { AV_CODEC_ID_RAWVIDEO, MKTAG('y', '4', '0', '8') },
 { AV_CODEC_ID_FRWU, MKTAG('F', 'R', 'W', 'U') },
 { AV_CODEC_ID_R10K, MKTAG('R', '1', '0', 'k') },
diff --git a/tests/ref/fate/filter-pixdesc-uyva 
b/tests/ref/fate/filter-pixdesc-uyva
index 49fd1bc6b1..684562877e 100644
--- a/tests/ref/fate/filter-pixdesc-uyva
+++ b/tests/ref/fate/filter-pixdesc-uyva
@@ -1 +1 @@
-pixdesc-uyva7cec5f820722500f491c3495113e726e
+pixdesc-uyva646d7fbb9600f80590d9a7cff4919cd5
diff --git a/tests/ref/fate/filter-pixfmts-copy 
b/tests/ref/fate/filter-pixfmts-copy
index 47e4619369..121bf63a8e 100644
--- a/tests/ref/fate/filter-pixfmts-copy
+++ b/tests/ref/fate/filter-pixfmts-copy
@@ -97,7 +97,7 @@ rgb87ac6008c84d622c2fc50581706e17576
 rgbab6e1b441c365e03b5ffdf9b7b68d9a0c
 rgba64beae2ae04b5efedca3505f47c4dd6ea6ea
 rgba64leb91e1d77f799eb92241a2d2d28437b15
-uyvaaffad7282152bcce415bdf228df00ae4
+uyva8896d7525f12de08818a01a5d5cf84f1
 uyvy422 3bcf3c80047592f2211fae3260b1b65d
 vuya3d5e934651cae1ce334001cb1829ad22
 vuyx0af13a42f9d0932c5a9bb6a8a5d1c5ee
diff --git a/tests/ref/fate/filter-pixfmts-crop 
b/tests/ref/fate/filter-pixfmts-crop
index a1f9faa450..25971e5b35 100644
--- a/tests/ref/fate/filter-pixfmts-crop
+++ b/tests/ref/fate/filter-pixfmts-crop
@@ -95,7 +95,7 @@ rgb89b364a8f112ad9459fec47a51cc03b30
 rgba9488ac85abceaf99a9309eac5a87697e
 rgba64be89910046972ab3c68e2a348302cc8ca9
 rgba64lefea8ebfc869b52adf353778f29eac7a7
-uyvacaa03b07812dbb6c48b5fb34edf73962
+uyva03f362ac6a39f25286bc6616111b0752
 vuya76578a705ff3a37559653c1289bd03dd
 vuyx615241c5406eb556fca0ad8606c23a02
 vyu444  a6067a24e63385242948dbc4c5a4ab5d
diff --git a/tests/ref/fate/filter-pixfmts-field 
b/tests/ref/fate/filter-pixfmts-field
index 67dbff6ea3..7117898f51 100644
--- a/tests/ref/fate/filter-pixfmts-field
+++ b/tests/ref/fate/filter-pixfmts-field
@@ -97,7 +97,7 @@ rgb862c3b9e2a171de3d894a8eeb271c85e8
 rgbaee616262ca6d67b7ecfba4b36c602ce3
 rgba64be23c8c0edaabe3eaec89ce69633fb0048
 rgba64ledfdba4de4a7cac9abf08852666c341d3
-uyvac1c2953840061e3778842051b078a41e
+uyva147398d2e8d310f915c95863ad192c5e
 uyvy422 1c49e44ab3f060e85fc4a3a9464f045e
 vuyaf72bcf29d75cd143d0c565f7cc49119a
 vuyx3d02eeab336d0a8106f6fdd91be61073
diff --git a/tests/ref/fate/filter-pixfmts-fieldorder 
b/tests/ref/fate/filter-pixfmts-fieldorder
index 745034aba9..c36e382b3f 100644
--- a/tests/ref/fate/filter-pixfmts-fieldorder
+++ b/tests/ref/fate/filter-pixfmts-fieldorder
@@ -86,7 +86,7 @@ rgb86deae05ccac5c50bd0d9c9fe8e124557
 rgba1fdf872a087a32cd35b80cc7be399578
 rgba64be5598f44514d122b9a57c5c92c20bbc61
 rgba64leb34e6e30621ae579519a2d

Re: [FFmpeg-devel] [PATCH 09/12] swscale/internal: constify SwsFunc

2024-10-07 Thread Sean McGovern
Hi,

On Mon, Oct 7, 2024 at 8:22 PM Niklas Haas  wrote:
>
> On Mon, 07 Oct 2024 16:53:41 -0400 Sean McGovern  wrote:
> > Hi,
> >
> > On Sun, Oct 6, 2024 at 6:31 PM Michael Niedermayer
> >  wrote:
> > >
> > > On Sat, Oct 05, 2024 at 09:24:00PM +0200, Niklas Haas wrote:
> > > > From: Niklas Haas 
> > > >
> > > > I want to move away from having random leaf processing functions mutate
> > > > plane pointers, and while we're at it, we might as well make the strides
> > > > and tables const as well.
> > > >
> > > > Sponsored-by: Sovereign Tech Fund
> > > > Signed-off-by: Niklas Haas 
> > > > ---
> > > >  libswscale/aarch64/swscale_unscaled.c |  34 ++--
> > > >  libswscale/alphablend.c   |   6 +-
> > > >  libswscale/arm/swscale_unscaled.c |  26 +--
> > > >  libswscale/bayer_template.c   |   4 +-
> > > >  libswscale/loongarch/yuv2rgb_lasx.c   |  12 +-
> > > >  libswscale/loongarch/yuv2rgb_lsx.c|  12 +-
> > > >  libswscale/ppc/yuv2rgb_altivec.c  |  12 +-
> > > >  libswscale/rgb2rgb.c  |   2 +-
> > > >  libswscale/rgb2rgb.h  |   4 +-
> > > >  libswscale/rgb2rgb_template.c |   2 +-
> > > >  libswscale/swscale_internal.h |  12 +-
> > > >  libswscale/swscale_unscaled.c | 242 +-
> > > >  libswscale/x86/yuv2rgb.c  |  54 +++---
> > > >  libswscale/yuv2rgb.c  |   6 +-
> > > >  14 files changed, 220 insertions(+), 208 deletions(-)
> > >
> > > should be ok
> >
> > Sorry for not checking this earlier, but PowerPC 32- and 64-bit builds
> > with AltiVec enabled now fail with:
> >
> > src/libswscale/ppc/yuv2yuv_altivec.c: In function 
> > ‘ff_get_unscaled_swscale_ppc’:
> > src/libswscale/ppc/yuv2yuv_altivec.c:199:33: error: assignment to
> > ‘SwsFunc’ {aka ‘int (*)(SwsContext *, const unsigned char * const*,
> > const int *, int,  int,  unsigned char * const*, const int *)’} from
> > incompatible pointer type ‘int (*)(SwsContext *, const uint8_t **, int
> > *, int,  int,  uint8_t **, int *)’ {aka ‘int (*)(SwsContext *, const
> > unsigned char **, int *, int,  int,  unsigned char **, int *)’}
> > [-Wincompatible-pointer-types]
> >   199 | c->convert_unscaled = yv12toyuy2_unscaled_altivec;
> >   | ^
> > src/libswscale/ppc/yuv2yuv_altivec.c:201:33: error: assignment to
> > ‘SwsFunc’ {aka ‘int (*)(SwsContext *, const unsigned char * const*,
> > const int *, int,  int,  unsigned char * const*, const int *)’} from
> > incompatible pointer type ‘int (*)(SwsContext *, const uint8_t **, int
> > *, int,  int,  uint8_t **, int *)’ {aka ‘int (*)(SwsContext *, const
> > unsigned char **, int *, int,  int,  unsigned char **, int *)’}
> > [-Wincompatible-pointer-types]
> >   201 | c->convert_unscaled = yv12touyvy_unscaled_altivec;
> >   | ^
> > make: *** [src/ffbuild/common.mak:81: libswscale/ppc/yuv2yuv_altivec.o] 
> > Error 1
>
> My bad for missing this one. Is there a public way I can test build on 
> different
> platforms before submitting series? I would have thought that posting it on 
> the
> ML is enough to trigger FATE runs on all platforms, but I didn't get any email
> reply to the series.
>
> Anyway, this should fix it:
>
> diff --git a/libswscale/ppc/yuv2yuv_altivec.c 
> b/libswscale/ppc/yuv2yuv_altivec.c
> index 728e4d210c..d63feb6012 100644
> --- a/libswscale/ppc/yuv2yuv_altivec.c
> +++ b/libswscale/ppc/yuv2yuv_altivec.c
> @@ -31,10 +31,10 @@
>
>  #if HAVE_ALTIVEC
>
> -static int yv12toyuy2_unscaled_altivec(SwsContext *c, const uint8_t *src[],
> -   int srcStride[], int srcSliceY,
> -   int srcSliceH, uint8_t *dstParam[],
> -   int dstStride_a[])
> +static int yv12toyuy2_unscaled_altivec(SwsContext *c, const uint8_t *const 
> src[],
> +   const int srcStride[], int srcSliceY,
> +   int srcSliceH, uint8_t *const 
> dstParam[],
> +   const int dstStride_a[])
>  {
>  uint8_t *dst = dstParam[0] + dstStride_a[0] * srcSliceY;
>  // yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH,
> @@ -107,10 +107,10 @@ static int yv12toyuy2_unscaled_altivec(SwsContext *c, 
> const uint8_t *src[],
>  return srcSliceH;
>  }
>
> -static int yv12touyvy_unscaled_altivec(SwsContext *c, const uint8_t *src[],
> -   int srcStride[], int srcSliceY,
> -   int srcSliceH, uint8_t *dstParam[],
> -   int dstStride_a[])
> +static int yv12touyvy_unscaled_altivec(SwsContext *c, const uint8_t *const 
> src[],
> +   const int srcStride[], int srcSliceY,
> +   int srcSliceH, uint8_t *const 
> dstParam[],
> +  

Re: [FFmpeg-devel] [PATCH 04/12] swscale/internal: swap SWS_DITHER_NONE and SWS_DITHER_AUTO

2024-10-07 Thread Tobias Rapp

On 07/10/2024 20:09, Niklas Haas wrote:


On Mon, 07 Oct 2024 20:03:06 +0200 Michael Niedermayer  
wrote:

On Mon, Oct 07, 2024 at 06:47:24PM +0200, Niklas Haas wrote:

On Mon, 07 Oct 2024 00:15:32 +0200 Michael Niedermayer  
wrote:

On Sat, Oct 05, 2024 at 09:23:55PM +0200, Niklas Haas wrote:

From: Niklas Haas 

This is done for consistency with the other public enums which will be
added in the upcoming swscale API refactor. I went through the code and checked
carefully that the value of `dither` is never implicitly compared against
zero, so this change should not break anything.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas 
---
  libswscale/swscale_internal.h | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

this breaks:

./ffmpeg -i lena.pnm -vf 
scale=iw:ih:flags=0x02:sws_dither=0,format=bgr4_byte -bitexact whatever.bmp

This is expected, of course. Are you saying that the change in consistency is
not worth the risk of breaking users who directly specify numeric IDs instead
of using the symbolic names?

iam not really sure what to do but
0 has a feeling of "none" to me

Well, I also wanted to add a "none" option to the enum, so maybe I can make
that be the value of 0. I just think that it's weird for the default value of
an enum option to be something other than 0, and the default should probably
be "auto". (Otherwise, what's the point of the "auto" option?)


For some of the options in FFmpeg "auto" is mapped to -1, and the 
explicit options start at 0 (for example in wavenc.c RF64_AUTO=-1 / 
RF64_NEVER=0 / RF64_ALWAYS=1). You could do that here if you want to 
align "none" with zero.


Just my 2ct.

Regards, Tobias


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

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


Re: [FFmpeg-devel] [PATCH 09/12] swscale/internal: constify SwsFunc

2024-10-07 Thread Martin Storsjö

On Tue, 8 Oct 2024, Niklas Haas wrote:


Sorry for not checking this earlier, but PowerPC 32- and 64-bit builds
with AltiVec enabled now fail with:

src/libswscale/ppc/yuv2yuv_altivec.c: In function ‘ff_get_unscaled_swscale_ppc’:
src/libswscale/ppc/yuv2yuv_altivec.c:199:33: error: assignment to
‘SwsFunc’ {aka ‘int (*)(SwsContext *, const unsigned char * const*,
const int *, int,  int,  unsigned char * const*, const int *)’} from
incompatible pointer type ‘int (*)(SwsContext *, const uint8_t **, int
*, int,  int,  uint8_t **, int *)’ {aka ‘int (*)(SwsContext *, const
unsigned char **, int *, int,  int,  unsigned char **, int *)’}
[-Wincompatible-pointer-types]
  199 | c->convert_unscaled = yv12toyuy2_unscaled_altivec;
  | ^
src/libswscale/ppc/yuv2yuv_altivec.c:201:33: error: assignment to
‘SwsFunc’ {aka ‘int (*)(SwsContext *, const unsigned char * const*,
const int *, int,  int,  unsigned char * const*, const int *)’} from
incompatible pointer type ‘int (*)(SwsContext *, const uint8_t **, int
*, int,  int,  uint8_t **, int *)’ {aka ‘int (*)(SwsContext *, const
unsigned char **, int *, int,  int,  unsigned char **, int *)’}
[-Wincompatible-pointer-types]
  201 | c->convert_unscaled = yv12touyvy_unscaled_altivec;
  | ^
make: *** [src/ffbuild/common.mak:81: libswscale/ppc/yuv2yuv_altivec.o] Error 1


My bad for missing this one. Is there a public way I can test build on different
platforms before submitting series? I would have thought that posting it on the
ML is enough to trigger FATE runs on all platforms, but I didn't get any email
reply to the series.


No, there's no such infrastructure for running FATE across the various 
(individually driven) instances that voluntarily run tests more or less 
frequently, unfortunately. There is some minimal testing hooked up via 
patchwork though.


In this case, also, the issue is that older compilers treat this issue as 
a warning, while newer compilers are more strict and make it an error - 
see 
http://fate.ffmpeg.org/log.cgi?log=compile&slot=aarch64-linux-clang-10&time=20241008042010 
vs 
http://fate.ffmpeg.org/log.cgi?time=20241008032612&log=compile&slot=aarch64-linux-clang-trunk


In my testing, I ran into similar issues on both aarch64 and i686, while 
x86_64 and armv7 seem to be fine. I'll push fixes for those architectures.


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

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