[FFmpeg-cvslog] avformat/rtpenc: Add flag AVFMT_NODIMENSIONS.

2025-03-29 Thread Koushik Dutta
ffmpeg | branch: master | Koushik Dutta  | Wed Mar 26 
13:13:13 2025 -0700| [2657e1679ef595ad4e873cfae5a069dd559a762e] | committer: 
Michael Niedermayer

avformat/rtpenc: Add flag AVFMT_NODIMENSIONS.

Not all rtp formats require the video dimensions to be available
up front. H264 and HEVC will send them as stream parameters.
The flag is restrictive and prevents RTP repacketization
without parsing the codec information out of the stream.

This change checks to see if the codec parameters are available
on the rtp formats that need it.

Signed-off-by: Koushik Dutta 
Signed-off-by: Michael Niedermayer 

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

 libavformat/rtpenc.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index 3db13ee0b2..8b989dca71 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -635,10 +635,18 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket 
*pkt)
 rtp_send_ilbc(s1, pkt->data, size);
 break;
 case AV_CODEC_ID_MJPEG:
+if (st->codecpar->width <= 0 || st->codecpar->height <= 0) {
+av_log(s1, AV_LOG_ERROR, "dimensions not set\n");
+return AVERROR(EINVAL);
+}
 ff_rtp_send_jpeg(s1, pkt->data, size);
 break;
 case AV_CODEC_ID_BITPACKED:
 case AV_CODEC_ID_RAWVIDEO: {
+if (st->codecpar->width <= 0 || st->codecpar->height <= 0) {
+av_log(s1, AV_LOG_ERROR, "dimensions not set\n");
+return AVERROR(EINVAL);
+}
 int interlaced = st->codecpar->field_order != AV_FIELD_PROGRESSIVE;
 
 ff_rtp_send_raw_rfc4175(s1, pkt->data, size, interlaced, 0);
@@ -685,5 +693,5 @@ const FFOutputFormat ff_rtp_muxer = {
 .write_packet  = rtp_write_packet,
 .write_trailer = rtp_write_trailer,
 .p.priv_class  = &rtp_muxer_class,
-.p.flags   = AVFMT_TS_NONSTRICT,
+.p.flags   = AVFMT_NODIMENSIONS | AVFMT_TS_NONSTRICT,
 };

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

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


[FFmpeg-cvslog] fftools/ffprobe: Make pix_fmt output bitexact

2025-03-29 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Fri Mar 21 12:19:56 2025 +0100| [f47c8bca2c343f1eba42a060ef9659c8a900f4bc] | 
committer: Andreas Rheinhardt

fftools/ffprobe: Make pix_fmt output bitexact

It is currently not due to endianness. This forced to add
workarounds with sed in fate/mxf.mak (which are removed
in this commit).
This is supposed to fix the enhanced-flv-hevc-hdr10 test
on big endian systems.

Reviewed-by: Zhao Zhili 
Signed-off-by: Andreas Rheinhardt 

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

 fftools/ffprobe.c  | 33 +++--
 tests/fate/mxf.mak |  4 ++--
 tests/ref/fate/enhanced-flv-hevc-hdr10 |  2 +-
 3 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 7341731d2f..ccc046c560 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2651,6 +2651,31 @@ static void print_private_data(WriterContext *w, void 
*priv_data)
 }
 }
 
+static void print_pixel_format(WriterContext *w, enum AVPixelFormat pix_fmt)
+{
+const char *s = av_get_pix_fmt_name(pix_fmt);
+enum AVPixelFormat swapped_pix_fmt;
+
+if (!s) {
+print_str_opt("pix_fmt", "unknown");
+} else if (!do_bitexact ||
+   (swapped_pix_fmt = av_pix_fmt_swap_endianness(pix_fmt)) == 
AV_PIX_FMT_NONE) {
+print_str("pix_fmt", s);
+} else {
+const char *s2 = av_get_pix_fmt_name(swapped_pix_fmt);
+char buf[128];
+size_t i = 0;
+
+while (s[i] && s[i] == s2[i])
+i++;
+
+memcpy(buf, s, FFMIN(sizeof(buf) - 1, i));
+buf[i] = '\0';
+
+print_str("pix_fmt", buf);
+}
+}
+
 static void print_color_range(WriterContext *w, enum AVColorRange color_range)
 {
 const char *val = av_color_range_name(color_range);
@@ -2959,9 +2984,7 @@ static void show_frame(WriterContext *w, AVFrame *frame, 
AVStream *stream,
 print_int("crop_bottom",frame->crop_bottom);
 print_int("crop_left",  frame->crop_left);
 print_int("crop_right", frame->crop_right);
-s = av_get_pix_fmt_name(frame->format);
-if (s) print_str("pix_fmt", s);
-else   print_str_opt("pix_fmt", "unknown");
+print_pixel_format(w, frame->format);
 sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, frame);
 if (sar.num) {
 print_q("sample_aspect_ratio", sar, ':');
@@ -3360,9 +3383,7 @@ static int show_stream(WriterContext *w, AVFormatContext 
*fmt_ctx, int stream_id
 print_str_opt("sample_aspect_ratio", "N/A");
 print_str_opt("display_aspect_ratio", "N/A");
 }
-s = av_get_pix_fmt_name(par->format);
-if (s) print_str("pix_fmt", s);
-else   print_str_opt("pix_fmt", "unknown");
+print_pixel_format(w, par->format);
 print_int("level",   par->level);
 
 print_color_range(w, par->color_range);
diff --git a/tests/fate/mxf.mak b/tests/fate/mxf.mak
index 3e0e70e28b..ba09d136ce 100644
--- a/tests/fate/mxf.mak
+++ b/tests/fate/mxf.mak
@@ -29,7 +29,7 @@ fate-mxf-probe-dnxhd: CMD = run 
$(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)"
 
 FATE_MXF_PROBE-$(call DEMDEC, MXF, JPEG2000) += fate-mxf-probe-j2k
 fate-mxf-probe-j2k: SRC = $(TARGET_SAMPLES)/imf/countdown/countdown-small.mxf
-fate-mxf-probe-j2k: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)" | 
sed -e "s/rgb48../rgb48/"
+fate-mxf-probe-j2k: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)"
 
 FATE_MXF_PROBE-$(call DEMDEC, MXF, DVVIDEO PCM_S16LE) += fate-mxf-probe-dv25
 fate-mxf-probe-dv25: SRC = $(TARGET_SAMPLES)/mxf/Avid-5.mxf
@@ -37,7 +37,7 @@ fate-mxf-probe-dv25: CMD = run 
$(PROBE_FORMAT_STREAMS_COMMAND) -i "$(SRC)"
 
 FATE_MXF_PROBE-$(call DEMDEC, MXF, PRORES PCM_S24LE) += 
fate-mxf-probe-applehdr10
 fate-mxf-probe-applehdr10: SRC = 
$(TARGET_SAMPLES)/mxf/Meridian-Apple_ProResProxy-HDR10.mxf
-fate-mxf-probe-applehdr10: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i 
"$(SRC)" | sed -e "s/yuv422p10../yuv422p10/"
+fate-mxf-probe-applehdr10: CMD = run $(PROBE_FORMAT_STREAMS_COMMAND) -i 
"$(SRC)"
 
 # Tests remuxing ProRes as well as writing mastering display metadata.
 FATE_MXF_FFMPEG_FFPROBE-$(call REMUX, MXF, PRORES_DECODER) += 
fate-mxf-remux-applehdr10
diff --git a/tests/ref/fate/enhanced-flv-hevc-hdr10 
b/tests/ref/fate/enhanced-flv-hevc-hdr10
index cb7acea328..4d93f98e57 100644
--- a/tests/ref/fate/enhanced-flv-hevc-hdr10
+++ b/tests/ref/fate/enhanced-flv-hevc-hdr10
@@ -25,7 +25,7 @@ crop_top=0
 crop_bottom=0
 crop_left=0
 crop_right=0
-pix_fmt=yuv420p10le
+pix_fmt=yuv420p10
 sample_aspect_ratio=N/A
 pict_type=I
 interlaced_frame=0

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

To unsubscribe, visit link above, or email
ffmpeg-cvs

[FFmpeg-cvslog] avcodec/ituh263enc: Add necessary #if checks for FLV encoder

2025-03-29 Thread Andreas Rheinhardt
ffmpeg | branch: master | Andreas Rheinhardt  | 
Fri Mar 28 16:21:57 2025 +0100| [5fac8d062d2bfe74b8844dd2538137b087b985e5] | 
committer: Andreas Rheinhardt

avcodec/ituh263enc: Add necessary #if checks for FLV encoder

Fixes compilation in case where the FLV encoder is disabled
with any other H.263 based encoder enabled.

Signed-off-by: Andreas Rheinhardt 

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

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

diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c
index 2e087c518d..8be7ee4636 100644
--- a/libavcodec/ituh263enc.c
+++ b/libavcodec/ituh263enc.c
@@ -855,6 +855,7 @@ av_cold void ff_h263_encode_init(MPVMainEncContext *const m)
 }
 break;
 // Note for MPEG-4 & H.263 the dc-scale table will be set per frame as 
needed later
+#if CONFIG_FLV_ENCODER
 case AV_CODEC_ID_FLV1:
 m->encode_picture_header = ff_flv_encode_picture_header;
 if (s->c.h263_flv > 1) {
@@ -865,6 +866,7 @@ av_cold void ff_h263_encode_init(MPVMainEncContext *const m)
 s->max_qcoeff=  127;
 }
 break;
+#endif
 default: //nothing needed - default table already set in mpegvideo.c
 s->min_qcoeff= -127;
 s->max_qcoeff=  127;

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

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


[FFmpeg-cvslog] avutil: remove deprecated FF_API_FRAME_KEY

2025-03-29 Thread James Almer
ffmpeg | branch: master | James Almer  | Wed Feb 19 13:58:04 
2025 -0300| [1061689ad80e8e9a2f7ff8a55c955acdca4396dc] | committer: James Almer

avutil: remove deprecated FF_API_FRAME_KEY

Deprecated since 2023-05-04.

Signed-off-by: James Almer 

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

 libavcodec/decode.c  |  5 -
 libavcodec/encode.c  |  7 ---
 libavfilter/buffersrc.c  |  7 ---
 libavfilter/vf_coreimage.m   |  7 ---
 libavfilter/vsrc_gradients.c |  6 --
 libavutil/frame.c|  5 -
 libavutil/frame.h| 10 --
 libavutil/version.h  |  1 -
 8 files changed, 48 deletions(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index ed46d297c7..d726cac8c9 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -670,11 +670,6 @@ static int decode_receive_frame_internal(AVCodecContext 
*avctx, AVFrame *frame)
 return ret;
 }
 
-#if FF_API_FRAME_KEY
-FF_DISABLE_DEPRECATION_WARNINGS
-frame->key_frame = !!(frame->flags & AV_FRAME_FLAG_KEY);
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
 frame->best_effort_timestamp = guess_correct_pts(dc,
  frame->pts,
  frame->pkt_dts);
diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index d831cac13b..72dfa8867a 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -214,13 +214,6 @@ int ff_encode_get_frame(AVCodecContext *avctx, AVFrame 
*frame)
 
 av_frame_move_ref(frame, avci->buffer_frame);
 
-#if FF_API_FRAME_KEY
-FF_DISABLE_DEPRECATION_WARNINGS
-if (frame->key_frame)
-frame->flags |= AV_FRAME_FLAG_KEY;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
 return 0;
 }
 
diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index d41d1112d4..af27306b3b 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -252,13 +252,6 @@ int attribute_align_arg 
av_buffersrc_add_frame_flags(AVFilterContext *ctx, AVFra
 return AVERROR(ENOMEM);
 }
 
-#if FF_API_FRAME_KEY
-FF_DISABLE_DEPRECATION_WARNINGS
-if (copy->key_frame)
-copy->flags |= AV_FRAME_FLAG_KEY;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
 if (copy->colorspace == AVCOL_SPC_UNSPECIFIED)
 copy->colorspace = ctx->outputs[0]->colorspace;
 if (copy->color_range == AVCOL_RANGE_UNSPECIFIED)
diff --git a/libavfilter/vf_coreimage.m b/libavfilter/vf_coreimage.m
index 9e03c46ce5..dfa8758ce9 100644
--- a/libavfilter/vf_coreimage.m
+++ b/libavfilter/vf_coreimage.m
@@ -299,13 +299,6 @@ static int request_frame(AVFilterLink *link)
 frame->duration= 1;
 frame->flags  |= AV_FRAME_FLAG_KEY;
 frame->flags  &= ~AV_FRAME_FLAG_INTERLACED;
-
-FF_DISABLE_DEPRECATION_WARNINGS
-#if FF_API_FRAME_KEY
-frame->key_frame   = 1;
-#endif
-FF_ENABLE_DEPRECATION_WARNINGS
-
 frame->pict_type   = AV_PICTURE_TYPE_I;
 frame->sample_aspect_ratio = ctx->sar;
 
diff --git a/libavfilter/vsrc_gradients.c b/libavfilter/vsrc_gradients.c
index d4dc2b1bc5..cb1b73773f 100644
--- a/libavfilter/vsrc_gradients.c
+++ b/libavfilter/vsrc_gradients.c
@@ -408,12 +408,6 @@ static int activate(AVFilterContext *ctx)
 if (!frame)
 return AVERROR(ENOMEM);
 
-#if FF_API_FRAME_KEY
-FF_DISABLE_DEPRECATION_WARNINGS
-frame->key_frame   = 1;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
 frame->flags  |= AV_FRAME_FLAG_KEY;
 frame->flags  &= ~AV_FRAME_FLAG_INTERLACED;
 frame->pict_type   = AV_PICTURE_TYPE_I;
diff --git a/libavutil/frame.c b/libavutil/frame.c
index 5c6461442a..a0459f4544 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -221,11 +221,6 @@ static int frame_copy_props(AVFrame *dst, const AVFrame 
*src, int force_copy)
 {
 int ret;
 
-#if FF_API_FRAME_KEY
-FF_DISABLE_DEPRECATION_WARNINGS
-dst->key_frame  = src->key_frame;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
 dst->pict_type  = src->pict_type;
 dst->sample_aspect_ratio= src->sample_aspect_ratio;
 dst->crop_top   = src->crop_top;
diff --git a/libavutil/frame.h b/libavutil/frame.h
index a6667aadce..60edcc4787 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -496,16 +496,6 @@ typedef struct AVFrame {
  */
 int format;
 
-#if FF_API_FRAME_KEY
-/**
- * 1 -> keyframe, 0-> not
- *
- * @deprecated Use AV_FRAME_FLAG_KEY instead
- */
-attribute_deprecated
-int key_frame;
-#endif
-
 /**
  * Picture type of the frame.
  */
diff --git a/libavutil/version.h b/libavutil/version.h
index f51ed93799..ab73ba4faf 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -105,7 +105,6 @@
  * @{
  */
 
-#define FF_API_FRAME_KEY(LIBAVUTIL_VERSION_MAJOR < 60)
 #define FF_API_

[FFmpeg-cvslog] avcodec/x86/mathops: clip constants used with shift instructions within inline assembly

2025-03-29 Thread Rémi Denis-Courmont
ffmpeg | branch: release/3.4 | Rémi Denis-Courmont  | Sun Jul 
16 18:18:02 2023 +0300| [9983d098ff0ee54bc3b77676dd885883bfbe4ffb] | committer: 
James Almer

avcodec/x86/mathops: clip constants used with shift instructions within inline 
assembly

Fixes assembling with binutil as >= 2.41

Signed-off-by: James Almer 
(cherry picked from commit effadce6c756247ea8bae32dc13bb3e6f464f0eb)

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

 libavcodec/x86/mathops.h | 26 +++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h
index 6298f5ed19..ca7e2dffc1 100644
--- a/libavcodec/x86/mathops.h
+++ b/libavcodec/x86/mathops.h
@@ -35,12 +35,20 @@
 static av_always_inline av_const int MULL(int a, int b, unsigned shift)
 {
 int rt, dummy;
+if (__builtin_constant_p(shift))
 __asm__ (
 "imull %3   \n\t"
 "shrdl %4, %%edx, %%eax \n\t"
 :"=a"(rt), "=d"(dummy)
-:"a"(a), "rm"(b), "ci"((uint8_t)shift)
+:"a"(a), "rm"(b), "i"(shift & 0x1F)
 );
+else
+__asm__ (
+"imull %3   \n\t"
+"shrdl %4, %%edx, %%eax \n\t"
+:"=a"(rt), "=d"(dummy)
+:"a"(a), "rm"(b), "c"((uint8_t)shift)
+);
 return rt;
 }
 
@@ -113,19 +121,31 @@ __asm__ volatile(\
 // avoid +32 for shift optimization (gcc should do that ...)
 #define NEG_SSR32 NEG_SSR32
 static inline  int32_t NEG_SSR32( int32_t a, int8_t s){
+if (__builtin_constant_p(s))
 __asm__ ("sarl %1, %0\n\t"
  : "+r" (a)
- : "ic" ((uint8_t)(-s))
+ : "i" (-s & 0x1F)
 );
+else
+__asm__ ("sarl %1, %0\n\t"
+   : "+r" (a)
+   : "c" ((uint8_t)(-s))
+);
 return a;
 }
 
 #define NEG_USR32 NEG_USR32
 static inline uint32_t NEG_USR32(uint32_t a, int8_t s){
+if (__builtin_constant_p(s))
 __asm__ ("shrl %1, %0\n\t"
  : "+r" (a)
- : "ic" ((uint8_t)(-s))
+ : "i" (-s & 0x1F)
 );
+else
+__asm__ ("shrl %1, %0\n\t"
+   : "+r" (a)
+   : "c" ((uint8_t)(-s))
+);
 return a;
 }
 

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

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