[FFmpeg-devel] [PATCH] lavc/vvc: Clamp shift RHS

2024-01-26 Thread post
From: Frank Plowman 

Resolves the following undefined behavior sanitiser error:
runtime error: shift exponent 32 is too large for 32-bit type 'int'

Signed-off-by: Frank Plowman 
---
 libavcodec/vvc/vvc_intra_template.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vvc/vvc_intra_template.c 
b/libavcodec/vvc/vvc_intra_template.c
index 9fb47549d5..a078885266 100644
--- a/libavcodec/vvc/vvc_intra_template.c
+++ b/libavcodec/vvc/vvc_intra_template.c
@@ -969,7 +969,7 @@ static void FUNC(pred_angular_h)(uint8_t *_src, const 
uint8_t *_top, const uint8
 int pos = (1 + ref_idx) * intra_pred_angle;
 int wt;
 if (need_pdpc)
-wt = (32 >> ((y * 2) >> nscale));
+wt = (32 >> FFMIN(31, (y * 2) >> nscale));
 
 for (int x = 0; x < w; x++) {
 const int idx  = (pos >> 5) + ref_idx;
-- 
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 1/2] fftools/ffplay: add missing YUV metadata to buffersrc

2024-01-26 Thread Anton Khirnov
Quoting Niklas Haas (2024-01-10 10:05:46)
> From: Niklas Haas 
> 
> Fixes error spam from the `ffplay` tool since commit 2d555dc82d, caused
> by an oversight on my part - I didn't notice during development that
> `ffplay` goes through its own filtering code path separate from
> fftools/ffmpeg_filter.c

Wouldn't the same issue affect any other caller?

-- 
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 1/2] fftools/ffplay: add missing YUV metadata to buffersrc

2024-01-26 Thread Zhao Zhili



> On Jan 26, 2024, at 17:36, Anton Khirnov  wrote:
> 
> Quoting Niklas Haas (2024-01-10 10:05:46)
>> From: Niklas Haas 
>> 
>> Fixes error spam from the `ffplay` tool since commit 2d555dc82d, caused
>> by an oversight on my part - I didn't notice during development that
>> `ffplay` goes through its own filtering code path separate from
>> fftools/ffmpeg_filter.c
> 
> Wouldn't the same issue affect any other caller?

Firstly, can avfilter support color range/space change from unspecified to a 
specified value
on the first frame? I think it should silent the log most of the cases.

Secondly, log once for non-serious case.

> 
> -- 
> 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".

___
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] lavc: move bitstream filters into bsf/ subdir

2024-01-26 Thread Anton Khirnov
---
 libavcodec/Makefile   | 49 +---
 libavcodec/bsf/Makefile   | 56 +++
 .../aac_adtstoasc.c}  |  0
 .../av1_frame_merge.c}|  0
 .../av1_frame_split.c}|  0
 .../av1_metadata.c}   |  0
 libavcodec/{chomp_bsf.c => bsf/chomp.c}   |  0
 libavcodec/{dca_core_bsf.c => bsf/dca_core.c} |  0
 libavcodec/{dts2pts_bsf.c => bsf/dts2pts.c}   |  0
 .../dump_extradata.c} |  0
 .../dv_error_marker.c}|  0
 .../{eac3_core_bsf.c => bsf/eac3_core.c}  |  0
 .../evc_frame_merge.c}|  0
 .../extract_extradata.c}  |  0
 .../filter_units.c}   |  0
 .../h264_metadata.c}  |  0
 .../h264_mp4toannexb.c}   |  0
 .../h264_redundant_pps.c} |  0
 .../h265_metadata.c}  |  0
 .../h266_metadata.c}  |  0
 .../hapqa_extract.c}  |  0
 .../hevc_mp4toannexb.c}   |  0
 .../imx_dump_header.c}|  0
 .../media100_to_mjpegb.c} |  0
 .../{mjpeg2jpeg_bsf.c => bsf/mjpeg2jpeg.c}|  0
 .../mjpega_dump_header.c} |  0
 libavcodec/{movsub_bsf.c => bsf/movsub.c} |  0
 .../mp3_header_decompress.c}  |  0
 .../mpeg2_metadata.c} |  0
 .../mpeg4_unpack_bframes.c}   |  0
 libavcodec/{noise_bsf.c => bsf/noise.c}   |  0
 libavcodec/{null_bsf.c => bsf/null.c} |  0
 .../opus_metadata.c}  |  0
 .../{pcm_rechunk_bsf.c => bsf/pcm_rechunk.c}  |  0
 .../pgs_frame_merge.c}|  0
 .../prores_metadata.c}|  0
 .../remove_extradata.c}   |  0
 libavcodec/{setts_bsf.c => bsf/setts.c}   |  0
 .../trace_headers.c}  |  0
 .../{truehd_core_bsf.c => bsf/truehd_core.c}  |  0
 .../vp9_metadata.c}   |  0
 .../vp9_raw_reorder.c}|  0
 .../vp9_superframe.c} |  0
 .../vp9_superframe_split.c}   |  0
 .../vvc_mp4toannexb.c}|  0
 45 files changed, 57 insertions(+), 48 deletions(-)
 create mode 100644 libavcodec/bsf/Makefile
 rename libavcodec/{aac_adtstoasc_bsf.c => bsf/aac_adtstoasc.c} (100%)
 rename libavcodec/{av1_frame_merge_bsf.c => bsf/av1_frame_merge.c} (100%)
 rename libavcodec/{av1_frame_split_bsf.c => bsf/av1_frame_split.c} (100%)
 rename libavcodec/{av1_metadata_bsf.c => bsf/av1_metadata.c} (100%)
 rename libavcodec/{chomp_bsf.c => bsf/chomp.c} (100%)
 rename libavcodec/{dca_core_bsf.c => bsf/dca_core.c} (100%)
 rename libavcodec/{dts2pts_bsf.c => bsf/dts2pts.c} (100%)
 rename libavcodec/{dump_extradata_bsf.c => bsf/dump_extradata.c} (100%)
 rename libavcodec/{dv_error_marker_bsf.c => bsf/dv_error_marker.c} (100%)
 rename libavcodec/{eac3_core_bsf.c => bsf/eac3_core.c} (100%)
 rename libavcodec/{evc_frame_merge_bsf.c => bsf/evc_frame_merge.c} (100%)
 rename libavcodec/{extract_extradata_bsf.c => bsf/extract_extradata.c} (100%)
 rename libavcodec/{filter_units_bsf.c => bsf/filter_units.c} (100%)
 rename libavcodec/{h264_metadata_bsf.c => bsf/h264_metadata.c} (100%)
 rename libavcodec/{h264_mp4toannexb_bsf.c => bsf/h264_mp4toannexb.c} (100%)
 rename libavcodec/{h264_redundant_pps_bsf.c => bsf/h264_redundant_pps.c} (100%)
 rename libavcodec/{h265_metadata_bsf.c => bsf/h265_metadata.c} (100%)
 rename libavcodec/{h266_metadata_bsf.c => bsf/h266_metadata.c} (100%)
 rename libavcodec/{hapqa_extract_bsf.c => bsf/hapqa_extract.c} (100%)
 rename libavcodec/{hevc_mp4toannexb_bsf.c => bsf/hevc_mp4toannexb.c} (100%)
 rename libavcodec/{imx_dump_header_bsf.c => bsf/imx_dump_header.c} (100%)
 rename libavcodec/{media100_to_mjpegb_bsf.c => bsf/media100_to_mjpegb.c} (100%)
 rename libavcodec/{mjpeg2jpeg_bsf.c => bsf/mjpeg2jpeg.c} (100%)
 rename libavcodec/{mjpega_dump_header_bsf.c => bsf/mjpega_dump_header.c} (100%)
 rename libavcodec/{movsub_bsf.c => bsf/movsub.c} (100%)
 rename libavcodec/{mp3_header_decompress_bsf.c => bsf/mp3_header_decompress.c} 
(100%)
 rename libavcodec/{mpeg2_metadata_bsf.c => bsf/mpeg2_metadata.c} (100%)
 rename libavcodec/{mpeg4_unpack_bframes_bsf.c => bsf/mpeg4_unpack_bframes.c} 
(100%)
 rename libavcodec/{noise_bsf.c => bsf/noise.c} (100%)
 rename libavcodec/{null_bsf.c => bsf/null.c} (100%)
 rename libavcodec/{opus_metadata_bsf.c => bsf/opus_metadata.c} (100%)
 rename libavcodec/{pcm_rechunk_bsf.c => bsf/pcm_rechunk.c} (100%)
 rename libavcodec/{pgs_frame_merge_bsf.c => bsf/pgs_frame_merge.c} (100%)
 rename libavcodec/{prores_metadata_bsf.c => bsf/prores_metadata.c} (100%)
 rename libavcodec/{remove_extradata_bsf.c => bsf/remove_extradata.c} (100%)
 rename libavcodec/{sett

Re: [FFmpeg-devel] [PATCH] lavc: move bitstream filters into bsf/ subdir

2024-01-26 Thread Lynne
Jan 26, 2024, 11:40 by an...@khirnov.net:

> ---
>  libavcodec/Makefile   | 49 +---
>  libavcodec/bsf/Makefile   | 56 +++
>

Is that the general direction we want to take?
I don't mind it, but I'm wondering if I should do this for what I care about?
___
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] lavc: move bitstream filters into bsf/ subdir

2024-01-26 Thread Zhao Zhili



> On Jan 26, 2024, at 20:11, Lynne  wrote:
> 
> Jan 26, 2024, 11:40 by an...@khirnov.net:
> 
>> ---
>> libavcodec/Makefile   | 49 +---
>> libavcodec/bsf/Makefile   | 56 +++
>> 
> 
> Is that the general direction we want to take?
> I don't mind it, but I'm wondering if I should do this for what I care about?

I like the direction. It takes a few seconds for vim nerdtree to open 
libavcodec directory,
and more on RISC-V or other less powerful devices.

> ___
> 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] lavc: move bitstream filters into bsf/ subdir

2024-01-26 Thread Anton Khirnov
Quoting Lynne (2024-01-26 13:11:33)
> Jan 26, 2024, 11:40 by an...@khirnov.net:
> 
> > ---
> >  libavcodec/Makefile   | 49 +---
> >  libavcodec/bsf/Makefile   | 56 +++
> >
> 
> Is that the general direction we want to take?
> I don't mind it, but I'm wondering if I should do this for what I care about?

I'd say yes for things with >~ 10 files. libavcodec/ got way too large.

-- 
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] lavc: move bitstream filters into bsf/ subdir

2024-01-26 Thread Andreas Rheinhardt
Anton Khirnov:
> ---
>  libavcodec/Makefile   | 49 +---
>  libavcodec/bsf/Makefile   | 56 +++
>  .../aac_adtstoasc.c}  |  0
>  .../av1_frame_merge.c}|  0
>  .../av1_frame_split.c}|  0
>  .../av1_metadata.c}   |  0
>  libavcodec/{chomp_bsf.c => bsf/chomp.c}   |  0
>  libavcodec/{dca_core_bsf.c => bsf/dca_core.c} |  0
>  libavcodec/{dts2pts_bsf.c => bsf/dts2pts.c}   |  0
>  .../dump_extradata.c} |  0
>  .../dv_error_marker.c}|  0
>  .../{eac3_core_bsf.c => bsf/eac3_core.c}  |  0
>  .../evc_frame_merge.c}|  0
>  .../extract_extradata.c}  |  0
>  .../filter_units.c}   |  0
>  .../h264_metadata.c}  |  0
>  .../h264_mp4toannexb.c}   |  0
>  .../h264_redundant_pps.c} |  0
>  .../h265_metadata.c}  |  0
>  .../h266_metadata.c}  |  0
>  .../hapqa_extract.c}  |  0
>  .../hevc_mp4toannexb.c}   |  0
>  .../imx_dump_header.c}|  0
>  .../media100_to_mjpegb.c} |  0
>  .../{mjpeg2jpeg_bsf.c => bsf/mjpeg2jpeg.c}|  0
>  .../mjpega_dump_header.c} |  0
>  libavcodec/{movsub_bsf.c => bsf/movsub.c} |  0
>  .../mp3_header_decompress.c}  |  0
>  .../mpeg2_metadata.c} |  0
>  .../mpeg4_unpack_bframes.c}   |  0
>  libavcodec/{noise_bsf.c => bsf/noise.c}   |  0
>  libavcodec/{null_bsf.c => bsf/null.c} |  0
>  .../opus_metadata.c}  |  0
>  .../{pcm_rechunk_bsf.c => bsf/pcm_rechunk.c}  |  0
>  .../pgs_frame_merge.c}|  0
>  .../prores_metadata.c}|  0
>  .../remove_extradata.c}   |  0
>  libavcodec/{setts_bsf.c => bsf/setts.c}   |  0
>  .../trace_headers.c}  |  0
>  .../{truehd_core_bsf.c => bsf/truehd_core.c}  |  0
>  .../vp9_metadata.c}   |  0
>  .../vp9_raw_reorder.c}|  0
>  .../vp9_superframe.c} |  0
>  .../vp9_superframe_split.c}   |  0
>  .../vvc_mp4toannexb.c}|  0
>  45 files changed, 57 insertions(+), 48 deletions(-)
>  create mode 100644 libavcodec/bsf/Makefile
>  rename libavcodec/{aac_adtstoasc_bsf.c => bsf/aac_adtstoasc.c} (100%)
>  rename libavcodec/{av1_frame_merge_bsf.c => bsf/av1_frame_merge.c} (100%)
>  rename libavcodec/{av1_frame_split_bsf.c => bsf/av1_frame_split.c} (100%)
>  rename libavcodec/{av1_metadata_bsf.c => bsf/av1_metadata.c} (100%)
>  rename libavcodec/{chomp_bsf.c => bsf/chomp.c} (100%)
>  rename libavcodec/{dca_core_bsf.c => bsf/dca_core.c} (100%)
>  rename libavcodec/{dts2pts_bsf.c => bsf/dts2pts.c} (100%)
>  rename libavcodec/{dump_extradata_bsf.c => bsf/dump_extradata.c} (100%)
>  rename libavcodec/{dv_error_marker_bsf.c => bsf/dv_error_marker.c} (100%)
>  rename libavcodec/{eac3_core_bsf.c => bsf/eac3_core.c} (100%)
>  rename libavcodec/{evc_frame_merge_bsf.c => bsf/evc_frame_merge.c} (100%)
>  rename libavcodec/{extract_extradata_bsf.c => bsf/extract_extradata.c} (100%)
>  rename libavcodec/{filter_units_bsf.c => bsf/filter_units.c} (100%)
>  rename libavcodec/{h264_metadata_bsf.c => bsf/h264_metadata.c} (100%)
>  rename libavcodec/{h264_mp4toannexb_bsf.c => bsf/h264_mp4toannexb.c} (100%)
>  rename libavcodec/{h264_redundant_pps_bsf.c => bsf/h264_redundant_pps.c} 
> (100%)
>  rename libavcodec/{h265_metadata_bsf.c => bsf/h265_metadata.c} (100%)
>  rename libavcodec/{h266_metadata_bsf.c => bsf/h266_metadata.c} (100%)
>  rename libavcodec/{hapqa_extract_bsf.c => bsf/hapqa_extract.c} (100%)
>  rename libavcodec/{hevc_mp4toannexb_bsf.c => bsf/hevc_mp4toannexb.c} (100%)
>  rename libavcodec/{imx_dump_header_bsf.c => bsf/imx_dump_header.c} (100%)
>  rename libavcodec/{media100_to_mjpegb_bsf.c => bsf/media100_to_mjpegb.c} 
> (100%)
>  rename libavcodec/{mjpeg2jpeg_bsf.c => bsf/mjpeg2jpeg.c} (100%)
>  rename libavcodec/{mjpega_dump_header_bsf.c => bsf/mjpega_dump_header.c} 
> (100%)
>  rename libavcodec/{movsub_bsf.c => bsf/movsub.c} (100%)
>  rename libavcodec/{mp3_header_decompress_bsf.c => 
> bsf/mp3_header_decompress.c} (100%)
>  rename libavcodec/{mpeg2_metadata_bsf.c => bsf/mpeg2_metadata.c} (100%)
>  rename libavcodec/{mpeg4_unpack_bframes_bsf.c => bsf/mpeg4_unpack_bframes.c} 
> (100%)
>  rename libavcodec/{noise_bsf.c => bsf/noise.c} (100%)
>  rename libavcodec/{null_bsf.c => bsf/null.c} (100%)
>  rename libavcodec/{opus_metadata_bsf.c => bsf/opus_metadata.c} (100%)
>  rename libavcodec/{pcm_rechunk_bsf.c => bsf/pcm_rechunk.c} (100%)
>  rename libavcodec/{pgs_frame_merge_bsf.c => bsf/pgs_frame_me

[FFmpeg-devel] [PATCH] x86: Remove inline MMX assembly that clobbers the FPU state

2024-01-26 Thread Martin Storsjö
These inline implementations of AV_COPY64, AV_SWAP64 and AV_ZERO64
are known to clobber the FPU state - which has to be restored
with the 'emms' instruction afterwards.

This was known and signaled with the FF_COPY_SWAP_ZERO_USES_MMX
define, which calling code seems to have been supposed to check,
in order to call emms_c() after using them. See
0b1972d4096df5879038f0af776f87f41e90ebd4,
29c4c0886d143790fcbeddbe40a23dfc6f56345c and
df215e575850e41b19aeb1fd99e53372a6b3d537 for history on earlier
fixes in the same area.

However, new code can use these AV_*64() macros without knowing
about the need to call emms_c().

Just get rid of these dangerous inline assembly snippets; this
doesn't make any difference for 64 bit architectures anyway.

Signed-off-by: Martin Storsjö 
---
 libavcodec/dca_core.c| 16 
 libavutil/x86/intreadwrite.h | 36 
 2 files changed, 52 deletions(-)

diff --git a/libavcodec/dca_core.c b/libavcodec/dca_core.c
index 60508fabb9..5dd727fc72 100644
--- a/libavcodec/dca_core.c
+++ b/libavcodec/dca_core.c
@@ -770,10 +770,6 @@ static void erase_adpcm_history(DCACoreDecoder *s)
 for (ch = 0; ch < DCA_CHANNELS; ch++)
 for (band = 0; band < DCA_SUBBANDS; band++)
 AV_ZERO128(s->subband_samples[ch][band] - DCA_ADPCM_COEFFS);
-
-#ifdef FF_COPY_SWAP_ZERO_USES_MMX
-emms_c();
-#endif
 }
 
 static int alloc_sample_buffer(DCACoreDecoder *s)
@@ -837,10 +833,6 @@ static int parse_frame_data(DCACoreDecoder *s, enum 
HeaderType header, int xch_b
 }
 }
 
-#ifdef FF_COPY_SWAP_ZERO_USES_MMX
-emms_c();
-#endif
-
 return 0;
 }
 
@@ -1283,10 +1275,6 @@ static void erase_x96_adpcm_history(DCACoreDecoder *s)
 for (ch = 0; ch < DCA_CHANNELS; ch++)
 for (band = 0; band < DCA_SUBBANDS_X96; band++)
 AV_ZERO128(s->x96_subband_samples[ch][band] - DCA_ADPCM_COEFFS);
-
-#ifdef FF_COPY_SWAP_ZERO_USES_MMX
-emms_c();
-#endif
 }
 
 static int alloc_x96_sample_buffer(DCACoreDecoder *s)
@@ -1516,10 +1504,6 @@ static int parse_x96_frame_data(DCACoreDecoder *s, int 
exss, int xch_base)
 }
 }
 
-#ifdef FF_COPY_SWAP_ZERO_USES_MMX
-emms_c();
-#endif
-
 return 0;
 }
 
diff --git a/libavutil/x86/intreadwrite.h b/libavutil/x86/intreadwrite.h
index 40f375b013..5e57d6a8cd 100644
--- a/libavutil/x86/intreadwrite.h
+++ b/libavutil/x86/intreadwrite.h
@@ -27,42 +27,6 @@
 
 #if HAVE_MMX
 
-#if !HAVE_FAST_64BIT && defined(__MMX__)
-
-#define FF_COPY_SWAP_ZERO_USES_MMX
-
-#define AV_COPY64 AV_COPY64
-static av_always_inline void AV_COPY64(void *d, const void *s)
-{
-__asm__("movq   %1, %%mm0  \n\t"
-"movq   %%mm0, %0  \n\t"
-: "=m"(*(uint64_t*)d)
-: "m" (*(const uint64_t*)s)
-: "mm0");
-}
-
-#define AV_SWAP64 AV_SWAP64
-static av_always_inline void AV_SWAP64(void *a, void *b)
-{
-__asm__("movq   %1, %%mm0  \n\t"
-"movq   %0, %%mm1  \n\t"
-"movq   %%mm0, %0  \n\t"
-"movq   %%mm1, %1  \n\t"
-: "+m"(*(uint64_t*)a), "+m"(*(uint64_t*)b)
-::"mm0", "mm1");
-}
-
-#define AV_ZERO64 AV_ZERO64
-static av_always_inline void AV_ZERO64(void *d)
-{
-__asm__("pxor %%mm0, %%mm0  \n\t"
-"movq %%mm0, %0 \n\t"
-: "=m"(*(uint64_t*)d)
-:: "mm0");
-}
-
-#endif /* !HAVE_FAST_64BIT && defined(__MMX__) */
-
 #ifdef __SSE__
 
 #define AV_COPY128 AV_COPY128
-- 
2.34.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".


Re: [FFmpeg-devel] [PATCH] x86: Remove inline MMX assembly that clobbers the FPU state

2024-01-26 Thread Martin Storsjö

On Fri, 26 Jan 2024, Martin Storsjö wrote:


These inline implementations of AV_COPY64, AV_SWAP64 and AV_ZERO64
are known to clobber the FPU state - which has to be restored
with the 'emms' instruction afterwards.

This was known and signaled with the FF_COPY_SWAP_ZERO_USES_MMX
define, which calling code seems to have been supposed to check,
in order to call emms_c() after using them. See
0b1972d4096df5879038f0af776f87f41e90ebd4,
29c4c0886d143790fcbeddbe40a23dfc6f56345c and
df215e575850e41b19aeb1fd99e53372a6b3d537 for history on earlier
fixes in the same area.

However, new code can use these AV_*64() macros without knowing
about the need to call emms_c().

Just get rid of these dangerous inline assembly snippets; this
doesn't make any difference for 64 bit architectures anyway.

Signed-off-by: Martin Storsjö 
---
libavcodec/dca_core.c| 16 
libavutil/x86/intreadwrite.h | 36 
2 files changed, 52 deletions(-)


I forgot to add some more context here; the VVC tests fail on i386 in some 
cases. 
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20240125170518.61211-1-p...@frankplowman.com/ 
fixes this, by using av_log2() instead of the float log2() in the VVC 
decoder. This patch fixes the same issue as well, by eliminating the FPU 
state clobbering (so that float math functions anywhere in decoders work 
as expected).


// 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".


Re: [FFmpeg-devel] [PATCH v2 1/2] avformat: add muxer support for H266/VVC

2024-01-26 Thread Thomas Siedel
Thanks for picking up the patch set!

On Thu, 25 Jan 2024 at 13:26, Nuo Mi  wrote:

> From: Thomas Siedel 
>
> Add muxer for vvcc byte stream format.
> Add AV_CODEC_ID_VVC to ff_mp4_obj_type.
> Add AV_CODEC_ID_VVC to ISO Media codec (VvcConfigurationBox vvi1,
> vvc1 defined in ISO/IEC 14496-15:2021).
> Add VvcConfigurationBox vvcC which extends FullBox type in
> ISO/IEC 14496-15:2021.
> Add ff_vvc_muxer to RAW muxers.
>
> Tested with:
> ffmpeg -i NovosobornayaSquare_1920x1080.mp4 -c:v libvvenc test.mp4 &&
> ffmpeg -i test.mp4 -f null -
> ffmpeg -i NovosobornayaSquare_1920x1080.mp4 -c:v copy test.mp4 &&
> ffmpeg -i test.mp4 -f md5 -
>
> Signed-off-by: Thomas Siedel 
> Co-Authored-By: Nuo Mi 
> ---
>  libavformat/Makefile|   6 +-
>  libavformat/isom.c  |   1 +
>  libavformat/isom_tags.c |   3 +
>  libavformat/mov.c   |   6 +
>  libavformat/movenc.c|  41 +-
>  libavformat/vvc.c   | 971 
>  libavformat/vvc.h   |  99 
>  7 files changed, 1123 insertions(+), 4 deletions(-)
>  create mode 100644 libavformat/vvc.c
>  create mode 100644 libavformat/vvc.h
>
> diff --git a/libavformat/Makefile b/libavformat/Makefile
> index dcc99eeac4..05b9b8a115 100644
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -343,7 +343,7 @@ OBJS-$(CONFIG_MATROSKA_DEMUXER)  +=
> matroskadec.o matroska.o  \
>  oggparsevorbis.o
> vorbiscomment.o \
>  qtpalette.o replaygain.o
> dovi_isom.o
>  OBJS-$(CONFIG_MATROSKA_MUXER)+= matroskaenc.o matroska.o \
> -av1.o avc.o hevc.o \
> +av1.o avc.o hevc.o vvc.o\
>  flacenc_header.o avlanguage.o
> \
>  vorbiscomment.o wv.o
> dovi_isom.o
>  OBJS-$(CONFIG_MCA_DEMUXER)   += mca.o
> @@ -365,7 +365,7 @@ OBJS-$(CONFIG_MODS_DEMUXER)  += mods.o
>  OBJS-$(CONFIG_MOFLEX_DEMUXER)+= moflex.o
>  OBJS-$(CONFIG_MOV_DEMUXER)   += mov.o mov_chan.o mov_esds.o \
>  qtpalette.o replaygain.o
> dovi_isom.o
> -OBJS-$(CONFIG_MOV_MUXER) += movenc.o av1.o avc.o hevc.o
> vpcc.o \
> +OBJS-$(CONFIG_MOV_MUXER) += movenc.o av1.o avc.o hevc.o
> vvc.o vpcc.o \
>  movenchint.o mov_chan.o rtp.o
> \
>  movenccenc.o movenc_ttml.o
> rawutils.o \
>  dovi_isom.o evc.o
> @@ -520,7 +520,7 @@ OBJS-$(CONFIG_RTP_MUXER) += rtp.o
>\
>  rtpenc_vp8.o  \
>  rtpenc_vp9.o\
>  rtpenc_xiph.o \
> -avc.o hevc.o
> +avc.o hevc.o vvc.o
>  OBJS-$(CONFIG_RTSP_DEMUXER)  += rtsp.o rtspdec.o httpauth.o \
>  urldecode.o
>  OBJS-$(CONFIG_RTSP_MUXER)+= rtsp.o rtspenc.o httpauth.o \
> diff --git a/libavformat/isom.c b/libavformat/isom.c
> index 6d019881e5..9fbccd4437 100644
> --- a/libavformat/isom.c
> +++ b/libavformat/isom.c
> @@ -36,6 +36,7 @@ const AVCodecTag ff_mp4_obj_type[] = {
>  { AV_CODEC_ID_MPEG4   , 0x20 },
>  { AV_CODEC_ID_H264, 0x21 },
>  { AV_CODEC_ID_HEVC, 0x23 },
> +{ AV_CODEC_ID_VVC , 0x33 },
>  { AV_CODEC_ID_AAC , 0x40 },
>  { AV_CODEC_ID_MP4ALS  , 0x40 }, /* 14496-3 ALS */
>  { AV_CODEC_ID_MPEG2VIDEO  , 0x61 }, /* MPEG-2 Main */
> diff --git a/libavformat/isom_tags.c b/libavformat/isom_tags.c
> index a575b7c160..705811e950 100644
> --- a/libavformat/isom_tags.c
> +++ b/libavformat/isom_tags.c
> @@ -123,6 +123,9 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
>  { AV_CODEC_ID_HEVC, MKTAG('d', 'v', 'h', 'e') }, /* HEVC-based Dolby
> Vision derived from hev1 */
>   /* dvh1 is handled
> within mov.c */
>
> +{ AV_CODEC_ID_VVC, MKTAG('v', 'v', 'i', '1') },  /* VVC/H.266 which
> indicates parameter sets may be in ES */
> +{ AV_CODEC_ID_VVC, MKTAG('v', 'v', 'c', '1') },  /* VVC/H.266 which
> indicates parameter shall not be in ES */
> +
>  { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, /* AVC-1/H.264 */
>  { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '2') },
>  { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '3') },
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 4cffd6c7db..cf931d4594 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -2123,6 +2123,11 @@ static int mov_read_glbl(MOVContext *c, AVIOContext
> *pb, MOVAtom atom)
>  if ((uint64_t)atom.size

[FFmpeg-devel] [PATCH] avfilter/buffersrc: limit link variance logs below debug loglevel

2024-01-26 Thread Gyan Doshi
The video param change check will print loglines below debug level
for each frame which is different from the inlink parameters. This
can spam the console. It is now printed at warning level once for
each param change else it is kept at debug level.

Partially addresses #10823
---
 libavfilter/buffersrc.c | 40 +++-
 1 file changed, 27 insertions(+), 13 deletions(-)

diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index afe69433b2..6e450ff6b7 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -49,10 +49,10 @@ typedef struct BufferSourceContext {
 unsigned  nb_failed_requests;
 
 /* video only */
-int   w, h;
-enum AVPixelFormat  pix_fmt;
-enum AVColorSpace color_space;
-enum AVColorRange color_range;
+int   w, h, prev_w, prev_h;
+enum AVPixelFormat  pix_fmt, prev_pix_fmt;
+enum AVColorSpace color_space, prev_color_space;
+enum AVColorRange color_range, prev_color_range;
 AVRationalpixel_aspect;
 
 AVBufferRef *hw_frames_ctx;
@@ -66,16 +66,30 @@ typedef struct BufferSourceContext {
 
 int eof;
 int64_t last_pts;
+int link_delta, prev_delta;
 } BufferSourceContext;
 
 #define CHECK_VIDEO_PARAM_CHANGE(s, c, width, height, format, csp, range, pts)\
-if (c->w != width || c->h != height || c->pix_fmt != format ||\
-c->color_space != csp || c->color_range != range) {\
-av_log(s, AV_LOG_INFO, "filter context - w: %d h: %d fmt: %d csp: %s 
range: %s, incoming frame - w: %d h: %d fmt: %d csp: %s range: %s pts_time: 
%s\n",\
+c->link_delta = c->w != width || c->h != height || c->pix_fmt != format ||\
+c->color_space != csp || c->color_range != range;\
+c->prev_delta = c->prev_w != width || c->prev_h != height || 
c->prev_pix_fmt != format ||\
+c->prev_color_space != csp || c->prev_color_range != 
range;\
+if (c->link_delta) {\
+int loglevel = c->prev_delta ? AV_LOG_WARNING : AV_LOG_DEBUG;\
+av_log(s, loglevel, "Changing video frame properties on the fly is not 
supported by all filters.\n");\
+av_log(s, loglevel, "filter context - w: %d h: %d fmt: %d csp: %s 
range: %s, incoming frame - w: %d h: %d fmt: %d csp: %s range: %s pts_time: 
%s\n",\
c->w, c->h, c->pix_fmt, av_color_space_name(c->color_space), 
av_color_range_name(c->color_range),\
width, height, format, av_color_space_name(csp), 
av_color_range_name(range),\
av_ts2timestr(pts, &s->outputs[0]->time_base));\
-av_log(s, AV_LOG_WARNING, "Changing video frame properties on the fly 
is not supported by all filters.\n");\
+}\
+if (c->prev_delta) {\
+if (!c->link_delta)\
+av_log(s, AV_LOG_VERBOSE, "video frame properties congruent with 
link at pts_time: %s\n", av_ts2timestr(pts, &s->outputs[0]->time_base));\
+c->prev_w = width;\
+c->prev_h = height;\
+c->prev_pix_fmt = format;\
+c->prev_color_space = csp;\
+c->prev_color_range = range;\
 }
 
 #define CHECK_AUDIO_PARAM_CHANGE(s, c, srate, layout, format, pts)\
@@ -111,12 +125,12 @@ int av_buffersrc_parameters_set(AVFilterContext *ctx, 
AVBufferSrcParameters *par
 switch (ctx->filter->outputs[0].type) {
 case AVMEDIA_TYPE_VIDEO:
 if (param->format != AV_PIX_FMT_NONE) {
-s->pix_fmt = param->format;
+s->pix_fmt = s->prev_pix_fmt = param->format;
 }
 if (param->width > 0)
-s->w = param->width;
+s->w = s->prev_w = param->width;
 if (param->height > 0)
-s->h = param->height;
+s->h = s->prev_h = param->height;
 if (param->sample_aspect_ratio.num > 0 && 
param->sample_aspect_ratio.den > 0)
 s->pixel_aspect = param->sample_aspect_ratio;
 if (param->frame_rate.num > 0 && param->frame_rate.den > 0)
@@ -128,9 +142,9 @@ int av_buffersrc_parameters_set(AVFilterContext *ctx, 
AVBufferSrcParameters *par
 return AVERROR(ENOMEM);
 }
 if (param->color_space != AVCOL_SPC_UNSPECIFIED)
-s->color_space = param->color_space;
+s->color_space = s->prev_color_space = param->color_space;
 if (param->color_range != AVCOL_RANGE_UNSPECIFIED)
-s->color_range = param->color_range;
+s->color_range = s->prev_color_range = param->color_range;
 break;
 case AVMEDIA_TYPE_AUDIO:
 if (param->format != AV_SAMPLE_FMT_NONE) {
-- 
2.39.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".


Re: [FFmpeg-devel] [PATCH v1 2/5] avformat: add muxer support for H266/VVC

2024-01-26 Thread Thomas Siedel
On Fri, 5 Jan 2024 at 01:31, James Almer  wrote:

> On 11/3/2023 6:57 AM, Thomas Siedel wrote:
> > Add muxer for vvcc byte stream format.
> > Add AV_CODEC_ID_VVC to ff_mp4_obj_type.
> > Add AV_CODEC_ID_VVC to ISO Media codec (VvcConfigurationBox vvi1,
> > vvc1 defined in ISO/IEC 14496-15:2021).
> > Add VvcConfigurationBox vvcC which extends FullBox type in
> > ISO/IEC 14496-15:2021.
> > Add ff_vvc_muxer to RAW muxers.
> >
> > Signed-off-by: Thomas Siedel 
> > ---
> >   libavformat/Makefile|   6 +-
> >   libavformat/isom.c  |   1 +
> >   libavformat/isom_tags.c |   3 +
> >   libavformat/mov.c   |   6 +
> >   libavformat/movenc.c|  41 +-
> >   libavformat/vvc.c   | 998 
> >   libavformat/vvc.h   |  99 
> >   7 files changed, 1150 insertions(+), 4 deletions(-)
> >   create mode 100644 libavformat/vvc.c
> >   create mode 100644 libavformat/vvc.h
> >
> > diff --git a/libavformat/Makefile b/libavformat/Makefile
> > index 329055ccfd..595f6bdf08 100644
> > --- a/libavformat/Makefile
> > +++ b/libavformat/Makefile
> > @@ -341,7 +341,7 @@ OBJS-$(CONFIG_MATROSKA_DEMUXER)  +=
> matroskadec.o matroska.o  \
> >   oggparsevorbis.o
> vorbiscomment.o \
> >   qtpalette.o replaygain.o
> dovi_isom.o
> >   OBJS-$(CONFIG_MATROSKA_MUXER)+= matroskaenc.o matroska.o \
> > -av1.o avc.o hevc.o \
> > +av1.o avc.o hevc.o vvc.o\
> >   flacenc_header.o
> avlanguage.o \
> >   vorbiscomment.o wv.o
> dovi_isom.o
> >   OBJS-$(CONFIG_MCA_DEMUXER)   += mca.o
> > @@ -363,7 +363,7 @@ OBJS-$(CONFIG_MODS_DEMUXER)  += mods.o
> >   OBJS-$(CONFIG_MOFLEX_DEMUXER)+= moflex.o
> >   OBJS-$(CONFIG_MOV_DEMUXER)   += mov.o mov_chan.o
> mov_esds.o \
> >   qtpalette.o replaygain.o
> dovi_isom.o
> > -OBJS-$(CONFIG_MOV_MUXER) += movenc.o av1.o avc.o hevc.o
> vpcc.o \
> > +OBJS-$(CONFIG_MOV_MUXER) += movenc.o av1.o avc.o hevc.o
> vvc.o vpcc.o \
> >   movenchint.o mov_chan.o
> rtp.o \
> >   movenccenc.o movenc_ttml.o
> rawutils.o \
> >   dovi_isom.o evc.o
> > @@ -516,7 +516,7 @@ OBJS-$(CONFIG_RTP_MUXER) += rtp.o
>  \
> >   rtpenc_vp8.o  \
> >   rtpenc_vp9.o
>   \
> >   rtpenc_xiph.o \
> > -avc.o hevc.o
> > +avc.o hevc.o vvc.o
> >   OBJS-$(CONFIG_RTSP_DEMUXER)  += rtsp.o rtspdec.o
> httpauth.o \
> >   urldecode.o
> >   OBJS-$(CONFIG_RTSP_MUXER)+= rtsp.o rtspenc.o
> httpauth.o \
> > diff --git a/libavformat/isom.c b/libavformat/isom.c
> > index 6d019881e5..9fbccd4437 100644
> > --- a/libavformat/isom.c
> > +++ b/libavformat/isom.c
> > @@ -36,6 +36,7 @@ const AVCodecTag ff_mp4_obj_type[] = {
> >   { AV_CODEC_ID_MPEG4   , 0x20 },
> >   { AV_CODEC_ID_H264, 0x21 },
> >   { AV_CODEC_ID_HEVC, 0x23 },
> > +{ AV_CODEC_ID_VVC , 0x33 },
> >   { AV_CODEC_ID_AAC , 0x40 },
> >   { AV_CODEC_ID_MP4ALS  , 0x40 }, /* 14496-3 ALS */
> >   { AV_CODEC_ID_MPEG2VIDEO  , 0x61 }, /* MPEG-2 Main */
> > diff --git a/libavformat/isom_tags.c b/libavformat/isom_tags.c
> > index a575b7c160..705811e950 100644
> > --- a/libavformat/isom_tags.c
> > +++ b/libavformat/isom_tags.c
> > @@ -123,6 +123,9 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
> >   { AV_CODEC_ID_HEVC, MKTAG('d', 'v', 'h', 'e') }, /* HEVC-based
> Dolby Vision derived from hev1 */
> >/* dvh1 is
> handled within mov.c */
> >
> > +{ AV_CODEC_ID_VVC, MKTAG('v', 'v', 'i', '1') },  /* VVC/H.266 which
> indicates parameter sets may be in ES */
> > +{ AV_CODEC_ID_VVC, MKTAG('v', 'v', 'c', '1') },  /* VVC/H.266 which
> indicates parameter shall not be in ES */
> > +
> >   { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, /* AVC-1/H.264 */
> >   { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '2') },
> >   { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '3') },
> > diff --git a/libavformat/mov.c b/libavformat/mov.c
> > index e8efccf6eb..11b43ac135 100644
> > --- a/libavformat/mov.c
> > +++ b/libavformat/mov.c
> > @@ -2117,6 +2117,11 @@ static int mov_read_glbl(MOVContext *c,
> AVIOContext *pb, MOVAtom atom)
> >   if ((uint64_t)atom.size > (1<<30))
> >   return AVERROR_INVALIDDATA;
> >
> > +  

Re: [FFmpeg-devel] [PATCH v1 2/5] avformat: add muxer support for H266/VVC

2024-01-26 Thread Thomas Siedel
On Fri, 5 Jan 2024 at 01:21, Nuo Mi  wrote:

> On Fri, Nov 3, 2023 at 5:58 PM Thomas Siedel 
> wrote:
>
> > Add muxer for vvcc byte stream format.
> > Add AV_CODEC_ID_VVC to ff_mp4_obj_type.
> > Add AV_CODEC_ID_VVC to ISO Media codec (VvcConfigurationBox vvi1,
> > vvc1 defined in ISO/IEC 14496-15:2021).
> > Add VvcConfigurationBox vvcC which extends FullBox type in
> > ISO/IEC 14496-15:2021.
> > Add ff_vvc_muxer to RAW muxers.
> >
> > Signed-off-by: Thomas Siedel 
> > ---
> >  libavformat/Makefile|   6 +-
> >  libavformat/isom.c  |   1 +
> >  libavformat/isom_tags.c |   3 +
> >  libavformat/mov.c   |   6 +
> >  libavformat/movenc.c|  41 +-
> >  libavformat/vvc.c   | 998 
> >  libavformat/vvc.h   |  99 
> >  7 files changed, 1150 insertions(+), 4 deletions(-)
> >  create mode 100644 libavformat/vvc.c
> >  create mode 100644 libavformat/vvc.h
> >
> Hi Thomas,
> Thank you for the patch set. Could you please provide some small MP4 and
> MPEG files? We can add them to FATE.
>

Sorry for the late reply.  I created some files using two
different encoders. You can download them here:
https://drive.google.com/drive/folders/1v4PipPu9zc2RmwSndE3L3wCd9WHVVJ1j?usp=drive_link

Is this sufficient? Let me know if you need anything else / something more
specific.
___
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/2] avformat: add muxer support for H266/VVC

2024-01-26 Thread Nuo Mi
On Fri, Jan 26, 2024 at 10:04 PM Thomas Siedel 
wrote:

> Thanks for picking up the patch set!
>
> On Thu, 25 Jan 2024 at 13:26, Nuo Mi  wrote:
>
>> From: Thomas Siedel 
>>
>> Add muxer for vvcc byte stream format.
>> Add AV_CODEC_ID_VVC to ff_mp4_obj_type.
>> Add AV_CODEC_ID_VVC to ISO Media codec (VvcConfigurationBox vvi1,
>> vvc1 defined in ISO/IEC 14496-15:2021).
>> Add VvcConfigurationBox vvcC which extends FullBox type in
>> ISO/IEC 14496-15:2021.
>> Add ff_vvc_muxer to RAW muxers.
>>
>> Tested with:
>> ffmpeg -i NovosobornayaSquare_1920x1080.mp4 -c:v libvvenc test.mp4 &&
>> ffmpeg -i test.mp4 -f null -
>> ffmpeg -i NovosobornayaSquare_1920x1080.mp4 -c:v copy test.mp4 &&
>> ffmpeg -i test.mp4 -f md5 -
>>
>> Signed-off-by: Thomas Siedel 
>> Co-Authored-By: Nuo Mi 
>> ---
>>  libavformat/Makefile|   6 +-
>>  libavformat/isom.c  |   1 +
>>  libavformat/isom_tags.c |   3 +
>>  libavformat/mov.c   |   6 +
>>  libavformat/movenc.c|  41 +-
>>  libavformat/vvc.c   | 971 
>>  libavformat/vvc.h   |  99 
>>  7 files changed, 1123 insertions(+), 4 deletions(-)
>>  create mode 100644 libavformat/vvc.c
>>  create mode 100644 libavformat/vvc.h
>>
>> diff --git a/libavformat/Makefile b/libavformat/Makefile
>> index dcc99eeac4..05b9b8a115 100644
>> --- a/libavformat/Makefile
>> +++ b/libavformat/Makefile
>> @@ -343,7 +343,7 @@ OBJS-$(CONFIG_MATROSKA_DEMUXER)  +=
>> matroskadec.o matroska.o  \
>>  oggparsevorbis.o
>> vorbiscomment.o \
>>  qtpalette.o replaygain.o
>> dovi_isom.o
>>  OBJS-$(CONFIG_MATROSKA_MUXER)+= matroskaenc.o matroska.o \
>> -av1.o avc.o hevc.o \
>> +av1.o avc.o hevc.o vvc.o\
>>  flacenc_header.o
>> avlanguage.o \
>>  vorbiscomment.o wv.o
>> dovi_isom.o
>>  OBJS-$(CONFIG_MCA_DEMUXER)   += mca.o
>> @@ -365,7 +365,7 @@ OBJS-$(CONFIG_MODS_DEMUXER)  += mods.o
>>  OBJS-$(CONFIG_MOFLEX_DEMUXER)+= moflex.o
>>  OBJS-$(CONFIG_MOV_DEMUXER)   += mov.o mov_chan.o mov_esds.o \
>>  qtpalette.o replaygain.o
>> dovi_isom.o
>> -OBJS-$(CONFIG_MOV_MUXER) += movenc.o av1.o avc.o hevc.o
>> vpcc.o \
>> +OBJS-$(CONFIG_MOV_MUXER) += movenc.o av1.o avc.o hevc.o
>> vvc.o vpcc.o \
>>  movenchint.o mov_chan.o
>> rtp.o \
>>  movenccenc.o movenc_ttml.o
>> rawutils.o \
>>  dovi_isom.o evc.o
>> @@ -520,7 +520,7 @@ OBJS-$(CONFIG_RTP_MUXER) += rtp.o
>>  \
>>  rtpenc_vp8.o  \
>>  rtpenc_vp9.o\
>>  rtpenc_xiph.o \
>> -avc.o hevc.o
>> +avc.o hevc.o vvc.o
>>  OBJS-$(CONFIG_RTSP_DEMUXER)  += rtsp.o rtspdec.o httpauth.o \
>>  urldecode.o
>>  OBJS-$(CONFIG_RTSP_MUXER)+= rtsp.o rtspenc.o httpauth.o \
>> diff --git a/libavformat/isom.c b/libavformat/isom.c
>> index 6d019881e5..9fbccd4437 100644
>> --- a/libavformat/isom.c
>> +++ b/libavformat/isom.c
>> @@ -36,6 +36,7 @@ const AVCodecTag ff_mp4_obj_type[] = {
>>  { AV_CODEC_ID_MPEG4   , 0x20 },
>>  { AV_CODEC_ID_H264, 0x21 },
>>  { AV_CODEC_ID_HEVC, 0x23 },
>> +{ AV_CODEC_ID_VVC , 0x33 },
>>  { AV_CODEC_ID_AAC , 0x40 },
>>  { AV_CODEC_ID_MP4ALS  , 0x40 }, /* 14496-3 ALS */
>>  { AV_CODEC_ID_MPEG2VIDEO  , 0x61 }, /* MPEG-2 Main */
>> diff --git a/libavformat/isom_tags.c b/libavformat/isom_tags.c
>> index a575b7c160..705811e950 100644
>> --- a/libavformat/isom_tags.c
>> +++ b/libavformat/isom_tags.c
>> @@ -123,6 +123,9 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
>>  { AV_CODEC_ID_HEVC, MKTAG('d', 'v', 'h', 'e') }, /* HEVC-based Dolby
>> Vision derived from hev1 */
>>   /* dvh1 is handled
>> within mov.c */
>>
>> +{ AV_CODEC_ID_VVC, MKTAG('v', 'v', 'i', '1') },  /* VVC/H.266 which
>> indicates parameter sets may be in ES */
>> +{ AV_CODEC_ID_VVC, MKTAG('v', 'v', 'c', '1') },  /* VVC/H.266 which
>> indicates parameter shall not be in ES */
>> +
>>  { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, /* AVC-1/H.264 */
>>  { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '2') },
>>  { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '3') },
>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>> index 4cffd6c7db..cf931d4594 100644
>> --- a/lib

Re: [FFmpeg-devel] [PATCH v1 2/5] avformat: add muxer support for H266/VVC

2024-01-26 Thread Nuo Mi
On Fri, Jan 26, 2024 at 11:18 PM Thomas Siedel 
wrote:

> On Fri, 5 Jan 2024 at 01:21, Nuo Mi  wrote:
>
> > On Fri, Nov 3, 2023 at 5:58 PM Thomas Siedel  >
> > wrote:
> >
> > > Add muxer for vvcc byte stream format.
> > > Add AV_CODEC_ID_VVC to ff_mp4_obj_type.
> > > Add AV_CODEC_ID_VVC to ISO Media codec (VvcConfigurationBox vvi1,
> > > vvc1 defined in ISO/IEC 14496-15:2021).
> > > Add VvcConfigurationBox vvcC which extends FullBox type in
> > > ISO/IEC 14496-15:2021.
> > > Add ff_vvc_muxer to RAW muxers.
> > >
> > > Signed-off-by: Thomas Siedel 
> > > ---
> > >  libavformat/Makefile|   6 +-
> > >  libavformat/isom.c  |   1 +
> > >  libavformat/isom_tags.c |   3 +
> > >  libavformat/mov.c   |   6 +
> > >  libavformat/movenc.c|  41 +-
> > >  libavformat/vvc.c   | 998 
> > >  libavformat/vvc.h   |  99 
> > >  7 files changed, 1150 insertions(+), 4 deletions(-)
> > >  create mode 100644 libavformat/vvc.c
> > >  create mode 100644 libavformat/vvc.h
> > >
> > Hi Thomas,
> > Thank you for the patch set. Could you please provide some small MP4 and
> > MPEG files? We can add them to FATE.
> >
>
> Sorry for the late reply.  I created some files using two
> different encoders. You can download them here:
>
> https://drive.google.com/drive/folders/1v4PipPu9zc2RmwSndE3L3wCd9WHVVJ1j?usp=drive_link
>
> Is this sufficient? Let me know if you need anything else / something more
> specific.
>
Good enough. Thank you thomas.

> ___
> 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] lavc: move bitstream filters into bsf/ subdir

2024-01-26 Thread James Almer

On 1/26/2024 9:17 AM, Anton Khirnov wrote:

Quoting Lynne (2024-01-26 13:11:33)

Jan 26, 2024, 11:40 by an...@khirnov.net:


---
  libavcodec/Makefile   | 49 +---
  libavcodec/bsf/Makefile   | 56 +++



Is that the general direction we want to take?
I don't mind it, but I'm wondering if I should do this for what I care about?


I'd say yes for things with >~ 10 files. libavcodec/ got way too large.


Is your idea something like..

libavcodec/bsf
libavcodec/common
libavcodec/decoder
libavcodec/encoder
libavcodec/parser

And then subfolders within those for big modules like h264, hevc, vvc, 
mpeg2, vp9, etc?
And like Andreas mentioned, the arch subfolders need to be considered 
for this.

___
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] lavc: move bitstream filters into bsf/ subdir

2024-01-26 Thread Anton Khirnov
Quoting James Almer (2024-01-26 17:09:32)
> On 1/26/2024 9:17 AM, Anton Khirnov wrote:
> > Quoting Lynne (2024-01-26 13:11:33)
> >> Jan 26, 2024, 11:40 by an...@khirnov.net:
> >>
> >>> ---
> >>>   libavcodec/Makefile   | 49 +---
> >>>   libavcodec/bsf/Makefile   | 56 +++
> >>>
> >>
> >> Is that the general direction we want to take?
> >> I don't mind it, but I'm wondering if I should do this for what I care 
> >> about?
> > 
> > I'd say yes for things with >~ 10 files. libavcodec/ got way too large.
> 
> Is your idea something like..
> 
> libavcodec/bsf
> libavcodec/common
> libavcodec/decoder
> libavcodec/encoder
> libavcodec/parser
> 
> And then subfolders within those for big modules like h264, hevc, vvc, 
> mpeg2, vp9, etc?

No, that strikes me as overkill. A subdir for bsfs, a subdir for every
codec/group of codecs/subsystem.

> And like Andreas mentioned, the arch subfolders need to be considered 
> for this.

Why?

-- 
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".


[FFmpeg-devel] [PATCH] lavc/vvc: Fix emulation prevention byte handling

2024-01-26 Thread post
From: Frank Plowman 

nal->skipped_bytes_pos contains the positions of errors relative to the
start of the slice header, whereas the position they were tested against
is relative to the start of the slice data, i.e. one byte after the end
of the slice header.

Patch fixes this by storing the size of the slice header in H266RawSlice
and adding it to the position given by the GetBitContext before
comparing to skipped_bytes_pos.  This fixes AVERROR_INVALIDDATAs for
various valid bitstreams, such as the LMCS_B_Dolby_2 conformance
bitstream.

Signed-off-by: Frank Plowman 
---
 libavcodec/cbs_h2645.c  | 1 +
 libavcodec/cbs_h266.h   | 1 +
 libavcodec/vvc/vvcdec.c | 9 +
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index c48a06b241..2fb249bcd3 100644
--- a/libavcodec/cbs_h2645.c
+++ b/libavcodec/cbs_h2645.c
@@ -1155,6 +1155,7 @@ static int cbs_h266_read_nal_unit(CodedBitstreamContext 
*ctx,
 return err;
 }
 
+slice->header_size = pos / 8;
 slice->data_size = len - pos / 8;
 slice->data_ref  = av_buffer_ref(unit->data_ref);
 if (!slice->data_ref)
diff --git a/libavcodec/cbs_h266.h b/libavcodec/cbs_h266.h
index 8b3ad391b1..73d94157d4 100644
--- a/libavcodec/cbs_h266.h
+++ b/libavcodec/cbs_h266.h
@@ -843,6 +843,7 @@ typedef struct H266RawSlice {
 
 uint8_t *data;
 AVBufferRef *data_ref;
+size_t   header_size;
 size_t   data_size;
 int  data_bit_start;
 } H266RawSlice;
diff --git a/libavcodec/vvc/vvcdec.c b/libavcodec/vvc/vvcdec.c
index 540a05f8cf..83ee472ce6 100644
--- a/libavcodec/vvc/vvcdec.c
+++ b/libavcodec/vvc/vvcdec.c
@@ -451,8 +451,9 @@ static int slices_realloc(VVCFrameContext *fc)
 }
 
 static void ep_init_cabac_decoder(SliceContext *sc, const int index,
-const H2645NAL *nal, GetBitContext *gb)
+const H2645NAL *nal, GetBitContext *gb, const CodedBitstreamUnit *unit)
 {
+const H266RawSlice *slice = unit->content_ref;
 const H266RawSliceHeader *rsh = sc->sh.r;
 EntryPoint *ep= sc->eps + index;
 int size;
@@ -461,10 +462,10 @@ static void ep_init_cabac_decoder(SliceContext *sc, const 
int index,
 int skipped = 0;
 int64_t start =  (gb->index >> 3);
 int64_t end = start + rsh->sh_entry_point_offset_minus1[index] + 1;
-while (skipped < nal->skipped_bytes && nal->skipped_bytes_pos[skipped] 
<= start) {
+while (skipped < nal->skipped_bytes && nal->skipped_bytes_pos[skipped] 
<= start + slice->header_size) {
 skipped++;
 }
-while (skipped < nal->skipped_bytes && nal->skipped_bytes_pos[skipped] 
< end) {
+while (skipped < nal->skipped_bytes && nal->skipped_bytes_pos[skipped] 
<= end + slice->header_size) {
 end--;
 skipped++;
 }
@@ -506,7 +507,7 @@ static int slice_init_entry_points(SliceContext *sc,
 fc->tab.slice_idx[rs] = sc->slice_idx;
 }
 
-ep_init_cabac_decoder(sc, i, nal, &gb);
+ep_init_cabac_decoder(sc, i, nal, &gb, unit);
 
 if (i + 1 < sc->nb_eps)
 ctu_addr = sh->entry_point_start_ctu[i];
-- 
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] lavc: move bitstream filters into bsf/ subdir

2024-01-26 Thread James Almer

On 1/26/2024 1:17 PM, Anton Khirnov wrote:

Quoting James Almer (2024-01-26 17:09:32)

On 1/26/2024 9:17 AM, Anton Khirnov wrote:

Quoting Lynne (2024-01-26 13:11:33)

Jan 26, 2024, 11:40 by an...@khirnov.net:


---
   libavcodec/Makefile   | 49 +---
   libavcodec/bsf/Makefile   | 56 +++



Is that the general direction we want to take?
I don't mind it, but I'm wondering if I should do this for what I care about?


I'd say yes for things with >~ 10 files. libavcodec/ got way too large.


Is your idea something like..

libavcodec/bsf
libavcodec/common
libavcodec/decoder
libavcodec/encoder
libavcodec/parser

And then subfolders within those for big modules like h264, hevc, vvc,
mpeg2, vp9, etc?


No, that strikes me as overkill. A subdir for bsfs, a subdir for every
codec/group of codecs/subsystem.


I don't think it's overkill. It separates modules per type, so it's easy 
to find a parser that right now is mixed between all the decoder related 
files.





And like Andreas mentioned, the arch subfolders need to be considered
for this.


Why?


I mean, where do you want them? inside the decoder/encoder subfolders 
(thus splitting them), or outside as they are right now?

___
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] lavc: move bitstream filters into bsf/ subdir

2024-01-26 Thread Anton Khirnov
Quoting Andreas Rheinhardt (2024-01-26 13:35:56)
> 
> This is inconsistent with the behaviour for arch-specific subfolders.

Does it need to be consistent? Bitstream filters typically share more
headers with decoders and parsers than arch-specific code.

> It also interferes with the files not in the bsf-subfolder (like
> h264_levels.o).

Interferes how?

-- 
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] lavc: move bitstream filters into bsf/ subdir

2024-01-26 Thread Anton Khirnov
Quoting James Almer (2024-01-26 17:22:06)
> On 1/26/2024 1:17 PM, Anton Khirnov wrote:
> > Quoting James Almer (2024-01-26 17:09:32)
> >> On 1/26/2024 9:17 AM, Anton Khirnov wrote:
> >>> Quoting Lynne (2024-01-26 13:11:33)
>  Jan 26, 2024, 11:40 by an...@khirnov.net:
> 
> > ---
> >libavcodec/Makefile   | 49 +---
> >libavcodec/bsf/Makefile   | 56 
> > +++
> >
> 
>  Is that the general direction we want to take?
>  I don't mind it, but I'm wondering if I should do this for what I care 
>  about?
> >>>
> >>> I'd say yes for things with >~ 10 files. libavcodec/ got way too large.
> >>
> >> Is your idea something like..
> >>
> >> libavcodec/bsf
> >> libavcodec/common
> >> libavcodec/decoder
> >> libavcodec/encoder
> >> libavcodec/parser
> >>
> >> And then subfolders within those for big modules like h264, hevc, vvc,
> >> mpeg2, vp9, etc?
> > 
> > No, that strikes me as overkill. A subdir for bsfs, a subdir for every
> > codec/group of codecs/subsystem.
> 
> I don't think it's overkill. It separates modules per type, so it's easy 
> to find a parser that right now is mixed between all the decoder related 
> files.

My plan is for parsers to turn into bitstream filters, so...

> >> And like Andreas mentioned, the arch subfolders need to be considered
> >> for this.
> > 
> > Why?
> 
> I mean, where do you want them? inside the decoder/encoder subfolders 
> (thus splitting them), or outside as they are right now?

I am perfectly fine with leaving them as they are now. Too many
directory levels make things hard to find as well.

-- 
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 24/24] libs: bump major version for all libraries

2024-01-26 Thread Vittorio Giovara
On Thu, Jan 25, 2024 at 2:48 PM James Almer  wrote:

> Signed-off-by: James Almer 
> ---
>  doc/APIchanges| 2 +-
>  libavcodec/version.h  | 2 +-
>  libavcodec/version_major.h| 2 +-
>  libavdevice/version.h | 2 +-
>  libavdevice/version_major.h   | 2 +-
>  libavfilter/version.h | 2 +-
>  libavfilter/version_major.h   | 2 +-
>  libavformat/version.h | 2 +-
>  libavformat/version_major.h   | 2 +-
>  libavutil/version.h   | 6 +++---
>  libpostproc/version.h | 2 +-
>  libpostproc/version_major.h   | 2 +-
>  libswresample/version.h   | 2 +-
>  libswresample/version_major.h | 2 +-
>  libswscale/version.h  | 2 +-
>  libswscale/version_major.h| 2 +-
>  16 files changed, 18 insertions(+), 18 deletions(-)
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index e477ed78e0..60711379a1 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -1,4 +1,4 @@
> -The last version increases of all libraries were on 2023-02-09
> +The last version increases of all libraries were on 2024-01-xx
>
>  API changes, most recent first:
>
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index 0fae3d06d3..8c3d476003 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -29,7 +29,7 @@
>
>  #include "version_major.h"
>
> -#define LIBAVCODEC_VERSION_MINOR  38
> +#define LIBAVCODEC_VERSION_MINOR   0
>  #define LIBAVCODEC_VERSION_MICRO 100


should we use this bump opportunity to reset MICRO to 0 too?
-- 
Vittorio
___
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 24/24] libs: bump major version for all libraries

2024-01-26 Thread James Almer

On 1/26/2024 1:44 PM, Vittorio Giovara wrote:

On Thu, Jan 25, 2024 at 2:48 PM James Almer  wrote:


Signed-off-by: James Almer 
---
  doc/APIchanges| 2 +-
  libavcodec/version.h  | 2 +-
  libavcodec/version_major.h| 2 +-
  libavdevice/version.h | 2 +-
  libavdevice/version_major.h   | 2 +-
  libavfilter/version.h | 2 +-
  libavfilter/version_major.h   | 2 +-
  libavformat/version.h | 2 +-
  libavformat/version_major.h   | 2 +-
  libavutil/version.h   | 6 +++---
  libpostproc/version.h | 2 +-
  libpostproc/version_major.h   | 2 +-
  libswresample/version.h   | 2 +-
  libswresample/version_major.h | 2 +-
  libswscale/version.h  | 2 +-
  libswscale/version_major.h| 2 +-
  16 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index e477ed78e0..60711379a1 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -1,4 +1,4 @@
-The last version increases of all libraries were on 2023-02-09
+The last version increases of all libraries were on 2024-01-xx

  API changes, most recent first:

diff --git a/libavcodec/version.h b/libavcodec/version.h
index 0fae3d06d3..8c3d476003 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@

  #include "version_major.h"

-#define LIBAVCODEC_VERSION_MINOR  38
+#define LIBAVCODEC_VERSION_MINOR   0
  #define LIBAVCODEC_VERSION_MICRO 100



should we use this bump opportunity to reset MICRO to 0 too?


It's an option. I don't recall if we decided anything about it last bump 
or during a meeting. And i don't know how much code out there still 
bothers to check for it to distinguish projects. But i guess that after 
so many bumps, any existing library user has long since stopped looking 
at it.

___
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 24/24] libs: bump major version for all libraries

2024-01-26 Thread Martin Storsjö

On Fri, 26 Jan 2024, James Almer wrote:


On 1/26/2024 1:44 PM, Vittorio Giovara wrote:

On Thu, Jan 25, 2024 at 2:48 PM James Almer  wrote:


Signed-off-by: James Almer 
---
  doc/APIchanges| 2 +-
  libavcodec/version.h  | 2 +-
  libavcodec/version_major.h| 2 +-
  libavdevice/version.h | 2 +-
  libavdevice/version_major.h   | 2 +-
  libavfilter/version.h | 2 +-
  libavfilter/version_major.h   | 2 +-
  libavformat/version.h | 2 +-
  libavformat/version_major.h   | 2 +-
  libavutil/version.h   | 6 +++---
  libpostproc/version.h | 2 +-
  libpostproc/version_major.h   | 2 +-
  libswresample/version.h   | 2 +-
  libswresample/version_major.h | 2 +-
  libswscale/version.h  | 2 +-
  libswscale/version_major.h| 2 +-
  16 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index e477ed78e0..60711379a1 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -1,4 +1,4 @@
-The last version increases of all libraries were on 2023-02-09
+The last version increases of all libraries were on 2024-01-xx

  API changes, most recent first:

diff --git a/libavcodec/version.h b/libavcodec/version.h
index 0fae3d06d3..8c3d476003 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@

  #include "version_major.h"

-#define LIBAVCODEC_VERSION_MINOR  38
+#define LIBAVCODEC_VERSION_MINOR   0
  #define LIBAVCODEC_VERSION_MICRO 100



should we use this bump opportunity to reset MICRO to 0 too?


It's an option. I don't recall if we decided anything about it last bump 
or during a meeting. And i don't know how much code out there still 
bothers to check for it to distinguish projects. But i guess that after 
so many bumps, any existing library user has long since stopped looking 
at it.


VLC 3 (which still is the latest stable version) still has got such checks 
around. VLC git master also still does have some checks, but only for 
deciding which "AVPROVIDER" to print in log messages, no function 
differences.


// 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".


Re: [FFmpeg-devel] [PATCH 24/24] libs: bump major version for all libraries

2024-01-26 Thread James Almer

On 1/26/2024 1:52 PM, Martin Storsjö wrote:

On Fri, 26 Jan 2024, James Almer wrote:


On 1/26/2024 1:44 PM, Vittorio Giovara wrote:

On Thu, Jan 25, 2024 at 2:48 PM James Almer  wrote:


Signed-off-by: James Almer 
---
  doc/APIchanges    | 2 +-
  libavcodec/version.h  | 2 +-
  libavcodec/version_major.h    | 2 +-
  libavdevice/version.h | 2 +-
  libavdevice/version_major.h   | 2 +-
  libavfilter/version.h | 2 +-
  libavfilter/version_major.h   | 2 +-
  libavformat/version.h | 2 +-
  libavformat/version_major.h   | 2 +-
  libavutil/version.h   | 6 +++---
  libpostproc/version.h | 2 +-
  libpostproc/version_major.h   | 2 +-
  libswresample/version.h   | 2 +-
  libswresample/version_major.h | 2 +-
  libswscale/version.h  | 2 +-
  libswscale/version_major.h    | 2 +-
  16 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index e477ed78e0..60711379a1 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -1,4 +1,4 @@
-The last version increases of all libraries were on 2023-02-09
+The last version increases of all libraries were on 2024-01-xx

  API changes, most recent first:

diff --git a/libavcodec/version.h b/libavcodec/version.h
index 0fae3d06d3..8c3d476003 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@

  #include "version_major.h"

-#define LIBAVCODEC_VERSION_MINOR  38
+#define LIBAVCODEC_VERSION_MINOR   0
  #define LIBAVCODEC_VERSION_MICRO 100



should we use this bump opportunity to reset MICRO to 0 too?


It's an option. I don't recall if we decided anything about it last 
bump or during a meeting. And i don't know how much code out there 
still bothers to check for it to distinguish projects. But i guess 
that after so many bumps, any existing library user has long since 
stopped looking at it.


VLC 3 (which still is the latest stable version) still has got such 
checks around. VLC git master also still does have some checks, but only 
for deciding which "AVPROVIDER" to print in log messages, no function 
differences.
VLC 3 surely wont compile and link with current ffmpeg, right? Or did 
they port it to the decoupled input/output decoder and encoder API, and 
even the new channel layout API?

___
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 24/24] libs: bump major version for all libraries

2024-01-26 Thread Martin Storsjö

On Fri, 26 Jan 2024, James Almer wrote:


On 1/26/2024 1:52 PM, Martin Storsjö wrote:

On Fri, 26 Jan 2024, James Almer wrote:


On 1/26/2024 1:44 PM, Vittorio Giovara wrote:

On Thu, Jan 25, 2024 at 2:48 PM James Almer  wrote:


Signed-off-by: James Almer 
---
  doc/APIchanges    | 2 +-
  libavcodec/version.h  | 2 +-
  libavcodec/version_major.h    | 2 +-
  libavdevice/version.h | 2 +-
  libavdevice/version_major.h   | 2 +-
  libavfilter/version.h | 2 +-
  libavfilter/version_major.h   | 2 +-
  libavformat/version.h | 2 +-
  libavformat/version_major.h   | 2 +-
  libavutil/version.h   | 6 +++---
  libpostproc/version.h | 2 +-
  libpostproc/version_major.h   | 2 +-
  libswresample/version.h   | 2 +-
  libswresample/version_major.h | 2 +-
  libswscale/version.h  | 2 +-
  libswscale/version_major.h    | 2 +-
  16 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index e477ed78e0..60711379a1 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -1,4 +1,4 @@
-The last version increases of all libraries were on 2023-02-09
+The last version increases of all libraries were on 2024-01-xx

  API changes, most recent first:

diff --git a/libavcodec/version.h b/libavcodec/version.h
index 0fae3d06d3..8c3d476003 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@

  #include "version_major.h"

-#define LIBAVCODEC_VERSION_MINOR  38
+#define LIBAVCODEC_VERSION_MINOR   0
  #define LIBAVCODEC_VERSION_MICRO 100



should we use this bump opportunity to reset MICRO to 0 too?


It's an option. I don't recall if we decided anything about it last 
bump or during a meeting. And i don't know how much code out there 
still bothers to check for it to distinguish projects. But i guess 
that after so many bumps, any existing library user has long since 
stopped looking at it.


VLC 3 (which still is the latest stable version) still has got such 
checks around. VLC git master also still does have some checks, but only 
for deciding which "AVPROVIDER" to print in log messages, no function 
differences.
VLC 3 surely wont compile and link with current ffmpeg, right? Or did 
they port it to the decoupled input/output decoder and encoder API, and 
even the new channel layout API?


They do backport updates to ffmpeg to VLC 3 in general, although it seems 
that they're still pretty far behind (at ffmpeg 4.4.4) indeed.


// 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".


[FFmpeg-devel] [PATCH 0/1] avformat/concatdec: fix seek with dts

2024-01-26 Thread Nicolas Gaullier
I have a bunch of patches about probing and making better concatdec, this is 
the first one.
Unfortunately, this is mostly about heuristics and find_stream_info things no 
one like very much.

This first patch seems very straightforward: there is already an heuristic in 
fftools for seeking,
and the same one is required when opening a file indirectly through concatdec.
(I can share a sample to reproduce the issue, but this is very commonplace).

fate results is updated for one test that uses lavf.ts (two "inpoint" 
directives in the script, thus two modified blocks).
Note: more packets are read but they are usually trimmed through 
segment_time_metadata etc.

Nicolas Gaullier (1):
  avformat/concatdec: fix seek with dts

 libavformat/concatdec.c   | 17 +++-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 40 ++-
 2 files changed, 54 insertions(+), 3 deletions(-)

-- 
2.30.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] avformat/concatdec: fix seek with dts

2024-01-26 Thread Nicolas Gaullier
Use same heuristic as in fftools.

Signed-off-by: Nicolas Gaullier 
---
 libavformat/concatdec.c   | 17 +++-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts | 40 ++-
 2 files changed, 54 insertions(+), 3 deletions(-)

diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index ffa8ade25b..96de9117fe 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -384,7 +384,22 @@ static int open_file(AVFormatContext *avf, unsigned fileno)
 if ((ret = match_streams(avf)) < 0)
 return ret;
 if (file->inpoint != AV_NOPTS_VALUE) {
-   if ((ret = avformat_seek_file(cat->avf, -1, INT64_MIN, file->inpoint, 
file->inpoint, 0)) < 0)
+int64_t seek_timestamp = file->inpoint;
+if (!(cat->avf->iformat->flags & AVFMT_SEEK_TO_PTS)) {
+int dts_heuristic = 0;
+int i;
+for (i=0; iavf->nb_streams; i++) {
+const AVCodecParameters *par = cat->avf->streams[i]->codecpar;
+if (par->video_delay) {
+dts_heuristic = 1;
+break;
+}
+}
+if (dts_heuristic) {
+seek_timestamp -= 3*AV_TIME_BASE / 23;
+}
+}
+if ((ret = avformat_seek_file(cat->avf, -1, INT64_MIN, seek_timestamp, 
seek_timestamp, 0)) < 0)
return ret;
 }
 return 0;
diff --git a/tests/ref/fate/concat-demuxer-simple2-lavf-ts 
b/tests/ref/fate/concat-demuxer-simple2-lavf-ts
index 548cab01c6..329b42fbe9 100644
--- a/tests/ref/fate/concat-demuxer-simple2-lavf-ts
+++ b/tests/ref/fate/concat-demuxer-simple2-lavf-ts
@@ -126,6 +126,24 @@ 
audio|0|177970|1.977444|177970|1.977444|2351|0.026122|209|N/A|K__
 audio|0|180321|2.003567|180321|2.003567|2351|0.026122|209|N/A|K__
 video|1|174764|1.941822|171164|1.901822|3600|0.04|12678|347800|___|MPEGTS 
Stream ID|224
 video|1|178364|1.981822|174764|1.941822|3600|0.04|24711|361336|K__
+video|1|125182|1.390911|121582|1.350911|3600|0.04|12398|254552|___|MPEGTS 
Stream ID|224
+video|1|128782|1.430911|125182|1.390911|3600|0.04|13455|267336|___|MPEGTS 
Stream ID|224
+audio|0|99515|1.105722|99515|1.105722|2351|0.026122|209|308508|K__|MPEGTS 
Stream ID|192
+audio|0|101866|1.131844|101866|1.131844|2351|0.026122|209|N/A|K__
+audio|0|104217|1.157967|104217|1.157967|2351|0.026122|209|N/A|K__
+audio|0|106568|1.184089|106568|1.184089|2351|0.026122|209|N/A|K__
+audio|0|108919|1.210211|108919|1.210211|2351|0.026122|209|N/A|K__
+audio|0|111270|1.236333|111270|1.236333|2351|0.026122|209|N/A|K__
+audio|0|113621|1.262456|113621|1.262456|2351|0.026122|209|N/A|K__
+audio|0|115972|1.288578|115972|1.288578|2351|0.026122|209|N/A|K__
+audio|0|118323|1.314700|118323|1.314700|2351|0.026122|209|N/A|K__
+audio|0|120674|1.340822|120674|1.340822|2351|0.026122|209|N/A|K__
+audio|0|123025|1.366944|123025|1.366944|2351|0.026122|209|N/A|K__
+audio|0|125376|1.393067|125376|1.393067|2351|0.026122|209|N/A|K__
+audio|0|127727|1.419189|127727|1.419189|2351|0.026122|209|N/A|K__
+audio|0|130078|1.445311|130078|1.445311|2351|0.026122|209|N/A|K__
+video|1|132382|1.470911|128782|1.430911|3600|0.04|13836|281624|___|MPEGTS 
Stream ID|224
+video|1|135982|1.510911|132382|1.470911|3600|0.04|12163|295912|___|MPEGTS 
Stream ID|224
 video|1|139582|1.550911|135982|1.510911|3600|0.04|12692|311516|___|MPEGTS 
Stream ID|224
 video|1|143182|1.590911|139582|1.550911|3600|0.04|10824|325052|___|MPEGTS 
Stream ID|224
 video|1|146782|1.630911|143182|1.590911|3600|0.04|11286|336144|___|MPEGTS 
Stream ID|224
@@ -142,10 +160,28 @@ 
audio|0|153588|1.706533|153588|1.706533|2351|0.026122|209|N/A|K__
 audio|0|155939|1.732656|155939|1.732656|2351|0.026122|209|N/A|K__
 video|1|150382|1.670911|146782|1.630911|3600|0.04|12678|347800|___|MPEGTS 
Stream ID|224
 video|1|153982|1.710911|150382|1.670911|3600|0.04|24711|361336|K__
+video|1|146782|1.630911|143182|1.590911|3600|0.04|12755|98700|___|MPEGTS 
Stream ID|224
+video|1|150382|1.670911|146782|1.630911|3600|0.04|12023|111860|___|MPEGTS 
Stream ID|224
+audio|0|124200|1.38|124200|1.38|2351|0.026122|208|152844|K__|MPEGTS 
Stream ID|192
+audio|0|126551|1.406122|126551|1.406122|2351|0.026122|209|N/A|K__
+audio|0|128902|1.432244|128902|1.432244|2351|0.026122|209|N/A|K__
+audio|0|131253|1.458367|131253|1.458367|2351|0.026122|209|N/A|K__
+audio|0|133604|1.484489|133604|1.484489|2351|0.026122|209|N/A|K__
+audio|0|135955|1.510611|135955|1.510611|2351|0.026122|209|N/A|K__
+audio|0|138306|1.536733|138306|1.536733|2351|0.026122|209|N/A|K__
+audio|0|140657|1.562856|140657|1.562856|2351|0.026122|209|N/A|K__
+audio|0|143008|1.588978|143008|1.588978|2351|0.026122|209|N/A|K__
+audio|0|145359|1.615100|145359|1.615100|2351|0.026122|209|N/A|K__
+audio|0|147710|1.641222|147710|1.641222|2351|0.026122|209|N/A|K__
+audio|0|150061|1.667344|150061|1.667344|2351|0.026122|209|N/A|K__
+audio|0|152412|1.693467|152412|1.693467|2351|0.026122|209|

[FFmpeg-devel] [PATCH] [MXF] - Set aspect ratio for jpeg2000 images

2024-01-26 Thread Cédric Le Barz

Set aspect ratio for jpeg2000 images.
--- Begin Message ---
Signed-off-by: Cedric Le Barz 
---
 ffmpeg/libavformat/mxfenc.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ffmpeg/libavformat/mxfenc.c b/ffmpeg/libavformat/mxfenc.c
index 0f13068..7ea19ca 100644
--- a/ffmpeg/libavformat/mxfenc.c
+++ b/ffmpeg/libavformat/mxfenc.c
@@ -2639,7 +2639,6 @@ static int mxf_parse_jpeg2000_frame(AVFormatContext *s, 
AVStream *st, AVPacket *
 {
 MXFContext *mxf = s->priv_data;
 MXFStreamContext *sc = st->priv_data;
-AVIOContext *pb = s->pb;
 int component_count = av_pix_fmt_count_planes(st->codecpar->format);
 GetByteContext g;
 uint32_t j2k_ncomponents;
@@ -2679,6 +2678,10 @@ static int mxf_parse_jpeg2000_frame(AVFormatContext *s, 
AVStream *st, AVPacket *
 }
 bytestream2_get_bufferu(&g, sc->j2k_info.j2k_comp_desc, 3 * 
j2k_ncomponents);
 
+/* Set aspect ratio */
+av_reduce(&sc->aspect_ratio.num, &sc->aspect_ratio.den,
+  sc->j2k_info.j2k_xsiz, sc->j2k_info.j2k_ysiz, INT32_MAX);
+
 sc->frame_size = pkt->size;
 
 return 1;
-- 
2.34.1

--- End Message ---
___
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] [MXF] - Add "footer_with_hmd" option

2024-01-26 Thread Cédric Le Barz
Add "footer_with_hmd" option: this option activates the writing of the 
header metadata in the footer partition.
--- Begin Message ---
Signed-off-by: Cedric Le Barz 
---
 ffmpeg/libavformat/mxfenc.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/ffmpeg/libavformat/mxfenc.c b/ffmpeg/libavformat/mxfenc.c
index 0f13068..79c92e1 100644
--- a/ffmpeg/libavformat/mxfenc.c
+++ b/ffmpeg/libavformat/mxfenc.c
@@ -480,6 +480,7 @@ typedef struct MXFContext {
 int cbr_index;   ///< use a constant bitrate index
 uint8_t unused_tags[MXF_NUM_TAGS];  ///< local tags that we know will not 
be used
 MXFStreamContext timecode_track_priv;
+int footer_with_hmd; // Flag to activate header metadata writing in footer 
partition
 } MXFContext;
 
 static void mxf_write_uuid(AVIOContext *pb, enum MXFMetadataSetType type, int 
value)
@@ -3420,10 +3421,10 @@ static int mxf_write_footer(AVFormatContext *s)
 mxf_write_klv_fill(s);
 mxf->footer_partition_offset = avio_tell(pb);
 if (mxf->edit_unit_byte_count && !IS_OPATOM(s)) { // no need to repeat 
index
-if ((err = mxf_write_partition(s, 0, 0, footer_partition_key, 0)) < 0)
+if ((err = mxf_write_partition(s, 0, 0, footer_partition_key, 
mxf->footer_with_hmd)) < 0)
 return err;
 } else {
-if ((err = mxf_write_partition(s, 0, 2, footer_partition_key, 0)) < 0)
+if ((err = mxf_write_partition(s, 0, 2, footer_partition_key, 
mxf->footer_with_hmd)) < 0)
 return err;
 mxf_write_klv_fill(s);
 mxf_write_index_table_segment(s);
@@ -3567,6 +3568,8 @@ static const AVOption mxf_options[] = {
 MXF_COMMON_OPTIONS
 { "store_user_comments", "",
   offsetof(MXFContext, store_user_comments), AV_OPT_TYPE_BOOL, {.i64 = 1}, 
0, 1, AV_OPT_FLAG_ENCODING_PARAM},
+{ "footer_with_hmd", "",
+  offsetof(MXFContext, footer_with_hmd), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 
1, AV_OPT_FLAG_ENCODING_PARAM},
 { NULL },
 };
 
-- 
2.34.1

--- End Message ---
___
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] [MXF] - Set aspect ratio for jpeg2000 images

2024-01-26 Thread Pierre-Anthony Lemieux
On Fri, Jan 26, 2024 at 10:02 AM Cédric Le Barz  wrote:
>
> Set aspect ratio for jpeg2000 images.

"The image area on the reference grid is defined by its upper left
hand reference grid point at location (XOsiz, YOsiz), and its lower
right hand reference grid point at location (Xsiz – 1, Ysiz – 1)"
(15444-1, 8.2)

AFAIK setting the MXF aspect ratio item to the ratio of the image
pixel dimensions only works if (a) the pixel aspect ratio is 1 and (b)
the video is not interlaced -- see 6.2.1.2 and Annex H at
https://pub.smpte.org/doc/st2067-21/20221124-pub/.


> ___
> 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 1/1] libavformat/rtpenc_jpeg.c: add support for the DRI marker

2024-01-26 Thread Sebastien Cote
This patch adds support for the DRI marker in the JPEG RTP payloader.

---
 libavformat/rtpenc_jpeg.c | 28 
 1 file changed, 28 insertions(+)

diff --git a/libavformat/rtpenc_jpeg.c b/libavformat/rtpenc_jpeg.c
index e4e95931f4..60f56680e2 100644
--- a/libavformat/rtpenc_jpeg.c
+++ b/libavformat/rtpenc_jpeg.c
@@ -33,6 +33,7 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const
uint8_t *buf, int size)
 uint8_t type = 2; /* initialized non-0/1 value for RTP/JPEG type check*/
 uint8_t w, h;
 uint8_t *p;
+uint16_t rst_marker_interval = 0;
 int off = 0; /* fragment offset of the current JPEG frame */
 int len;
 int i;
@@ -155,6 +156,22 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const
uint8_t *buf, int size)
 dht_size = 0;
 continue;
 }
+} else if (buf[i + 1] == DRI) {
+uint16_t dri_size = 0;
+if (i + 5 > size) {
+av_log(s1, AV_LOG_ERROR, "Too short JPEG header. Aborted!\n");
+return;
+}
+
+dri_size = AV_RB16(&buf[i + 2]);
+rst_marker_interval = AV_RB16(&buf[i + 4]);
+
+if (i + 1 + dri_size > size) {
+av_log(s1, AV_LOG_ERROR, "Too short JPEG header. Aborted!\n");
+return;
+}
+
+i += 1 + dri_size;
 } else if (buf[i + 1] == SOS) {
 /* SOS is last marker in the header */
 i += AV_RB16(&buf[i + 2]) + 2;
@@ -196,10 +213,16 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const
uint8_t *buf, int size)
 }
 }

+if (rst_marker_interval > 0)
+type += 64;
+
 p = s->buf_ptr;
 while (size > 0) {
 int hdr_size = 8;

+if (rst_marker_interval > 0)
+hdr_size += 4;
+
 if (off == 0 && nb_qtables)
 hdr_size += 4 + 64 * nb_qtables;

@@ -214,6 +237,11 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const
uint8_t *buf, int size)
 bytestream_put_byte(&p, w);
 bytestream_put_byte(&p, h);

+if (rst_marker_interval > 0) {
+bytestream_put_be16(&p, rst_marker_interval);
+bytestream_put_be16(&p, 0x);
+}
+
 if (off == 0 && nb_qtables) {
 /* set quantization tables header */
 bytestream_put_byte(&p, 0);
--
2.34.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".


Re: [FFmpeg-devel] [PATCH 24/24] libs: bump major version for all libraries

2024-01-26 Thread Michael Niedermayer
On Thu, Jan 25, 2024 at 10:43:47AM -0300, James Almer wrote:
> Signed-off-by: James Almer 
> ---
>  doc/APIchanges| 2 +-
>  libavcodec/version.h  | 2 +-
>  libavcodec/version_major.h| 2 +-
>  libavdevice/version.h | 2 +-
>  libavdevice/version_major.h   | 2 +-
>  libavfilter/version.h | 2 +-
>  libavfilter/version_major.h   | 2 +-
>  libavformat/version.h | 2 +-
>  libavformat/version_major.h   | 2 +-
>  libavutil/version.h   | 6 +++---
>  libpostproc/version.h | 2 +-
>  libpostproc/version_major.h   | 2 +-
>  libswresample/version.h   | 2 +-
>  libswresample/version_major.h | 2 +-
>  libswscale/version.h  | 2 +-
>  libswscale/version_major.h| 2 +-
>  16 files changed, 18 insertions(+), 18 deletions(-)

breaks fate here:

TESTfilter-formats
--- ./tests/ref/fate/filter-formats 2024-01-26 01:29:14.807206331 +0100
+++ tests/data/fate/filter-formats  2024-01-26 19:16:02.846589727 +0100
@@ -82,7 +82,7 @@
 0 = ff_parse_channel_layout(, 65, 65C);
 0 = ff_parse_channel_layout(003F,  6, 5.1);
 0 = ff_parse_channel_layout(0003,  2, stereo);
-0 = ff_parse_channel_layout(0001,  1, 1+1+1+1);
-0 = ff_parse_channel_layout(0004,  1, 1c+1c+1c+1c);
-0 = ff_parse_channel_layout(0007,  3, 2c+1c);
+-1 = ff_parse_channel_layout(, -1, 1+1+1+1);
+-1 = ff_parse_channel_layout(, -1, 1c+1c+1c+1c);
+-1 = ff_parse_channel_layout(, -1, 2c+1c);
 0 = ff_parse_channel_layout(0003,  2, 0x3);
Test filter-formats failed. Look at tests/data/fate/filter-formats.err for 
details.
tests/Makefile:318: recipe for target 'fate-filter-formats' failed


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

If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.


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 24/24] libs: bump major version for all libraries

2024-01-26 Thread James Almer

On 1/26/2024 3:18 PM, Michael Niedermayer wrote:

On Thu, Jan 25, 2024 at 10:43:47AM -0300, James Almer wrote:

Signed-off-by: James Almer 
---
  doc/APIchanges| 2 +-
  libavcodec/version.h  | 2 +-
  libavcodec/version_major.h| 2 +-
  libavdevice/version.h | 2 +-
  libavdevice/version_major.h   | 2 +-
  libavfilter/version.h | 2 +-
  libavfilter/version_major.h   | 2 +-
  libavformat/version.h | 2 +-
  libavformat/version_major.h   | 2 +-
  libavutil/version.h   | 6 +++---
  libpostproc/version.h | 2 +-
  libpostproc/version_major.h   | 2 +-
  libswresample/version.h   | 2 +-
  libswresample/version_major.h | 2 +-
  libswscale/version.h  | 2 +-
  libswscale/version_major.h| 2 +-
  16 files changed, 18 insertions(+), 18 deletions(-)


breaks fate here:


This patch depends on all 23 before it.
___
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 24/24] libs: bump major version for all libraries

2024-01-26 Thread Michael Niedermayer
On Fri, Jan 26, 2024 at 07:18:46PM +0100, Michael Niedermayer wrote:
> On Thu, Jan 25, 2024 at 10:43:47AM -0300, James Almer wrote:
> > Signed-off-by: James Almer 
> > ---
> >  doc/APIchanges| 2 +-
> >  libavcodec/version.h  | 2 +-
> >  libavcodec/version_major.h| 2 +-
> >  libavdevice/version.h | 2 +-
> >  libavdevice/version_major.h   | 2 +-
> >  libavfilter/version.h | 2 +-
> >  libavfilter/version_major.h   | 2 +-
> >  libavformat/version.h | 2 +-
> >  libavformat/version_major.h   | 2 +-
> >  libavutil/version.h   | 6 +++---
> >  libpostproc/version.h | 2 +-
> >  libpostproc/version_major.h   | 2 +-
> >  libswresample/version.h   | 2 +-
> >  libswresample/version_major.h | 2 +-
> >  libswscale/version.h  | 2 +-
> >  libswscale/version_major.h| 2 +-
> >  16 files changed, 18 insertions(+), 18 deletions(-)
> 
> breaks fate here:

please disregard this, i have one patch missing fron the series

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle


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] lavc/vvc: Use av_log2 when destination is integer

2024-01-26 Thread James Almer

On 1/26/2024 1:43 AM, Nuo Mi wrote:

LGTM


Applied.


On Fri, Jan 26, 2024 at 1:05 AM  wrote:


From: Frank Plowman 

Signed-off-by: Frank Plowman 
---
  libavcodec/vvc/vvc_ctu.c | 4 ++--
  libavcodec/vvc/vvc_ps.c  | 2 +-
  2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/vvc/vvc_ctu.c b/libavcodec/vvc/vvc_ctu.c
index 307bc3490e..d166b16a19 100644
--- a/libavcodec/vvc/vvc_ctu.c
+++ b/libavcodec/vvc/vvc_ctu.c
@@ -257,8 +257,8 @@ static TransformBlock* add_tb(TransformUnit *tu,
VVCLocalContext *lc,
  tb->y0 = y0;
  tb->tb_width  = tb_width;
  tb->tb_height = tb_height;
-tb->log2_tb_width  = log2(tb_width);
-tb->log2_tb_height = log2(tb_height);
+tb->log2_tb_width  = av_log2(tb_width);
+tb->log2_tb_height = av_log2(tb_height);

  tb->max_scan_x = tb->max_scan_y = 0;
  tb->min_scan_x = tb->min_scan_y = 0;
diff --git a/libavcodec/vvc/vvc_ps.c b/libavcodec/vvc/vvc_ps.c
index ac96ed9f43..c2afc0ac93 100644
--- a/libavcodec/vvc/vvc_ps.c
+++ b/libavcodec/vvc/vvc_ps.c
@@ -910,7 +910,7 @@ static void scaling_derive(VVCScalingList *sl, const
H266RawAPS *aps)
  {
  for (int id = 0; id < SL_MAX_ID; id++) {
  const int matrix_size   = derive_matrix_size(id);
-const int log2_size = log2(matrix_size);
+const int log2_size = av_log2(matrix_size);
  const int list_size = matrix_size * matrix_size;
  int coeff[SL_MAX_MATRIX_SIZE * SL_MAX_MATRIX_SIZE];
  const uint8_t *pred;

___
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] lavc/vvc: Clamp shift RHS

2024-01-26 Thread James Almer

On 1/26/2024 6:13 AM, p...@frankplowman.com wrote:

From: Frank Plowman 

Resolves the following undefined behavior sanitiser error:
runtime error: shift exponent 32 is too large for 32-bit type 'int'

Signed-off-by: Frank Plowman 
---
  libavcodec/vvc/vvc_intra_template.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vvc/vvc_intra_template.c 
b/libavcodec/vvc/vvc_intra_template.c
index 9fb47549d5..a078885266 100644
--- a/libavcodec/vvc/vvc_intra_template.c
+++ b/libavcodec/vvc/vvc_intra_template.c
@@ -969,7 +969,7 @@ static void FUNC(pred_angular_h)(uint8_t *_src, const 
uint8_t *_top, const uint8
  int pos = (1 + ref_idx) * intra_pred_angle;
  int wt;
  if (need_pdpc)
-wt = (32 >> ((y * 2) >> nscale));
+wt = (32 >> FFMIN(31, (y * 2) >> nscale));
  
  for (int x = 0; x < w; x++) {

  const int idx  = (pos >> 5) + ref_idx;


Applied, thanks.
___
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 1/7] avcodec/dxvenc: Don't cast const away

2024-01-26 Thread Andreas Rheinhardt
Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavcodec/dxvenc.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/dxvenc.c b/libavcodec/dxvenc.c
> index 3a5b310c9b..10473038cc 100644
> --- a/libavcodec/dxvenc.c
> +++ b/libavcodec/dxvenc.c
> @@ -56,7 +56,7 @@ static void ht_init(HTEntry *ht)
>  }
>  }
>  
> -static uint32_t ht_lookup_and_upsert(HTEntry *ht, AVCRC *hash_ctx,
> +static uint32_t ht_lookup_and_upsert(HTEntry *ht, const AVCRC *hash_ctx,
>  uint32_t key, uint32_t pos)
>  {
>  uint32_t ret = -1;
> @@ -74,7 +74,7 @@ static uint32_t ht_lookup_and_upsert(HTEntry *ht, AVCRC 
> *hash_ctx,
>  return ret;
>  }
>  
> -static void ht_delete(HTEntry *ht, AVCRC *hash_ctx,
> +static void ht_delete(HTEntry *ht, const AVCRC *hash_ctx,
>uint32_t key, uint32_t pos)
>  {
>  HTEntry *removed_entry = NULL;
> @@ -124,7 +124,7 @@ typedef struct DXVEncContext {
>  enum DXVTextureFormat tex_fmt;
>  int (*compress_tex)(AVCodecContext *avctx);
>  
> -AVCRC *crc_ctx;
> +const AVCRC *crc_ctx;
>  
>  HTEntry color_lookback_ht[LOOKBACK_HT_ELEMS];
>  HTEntry lut_lookback_ht[LOOKBACK_HT_ELEMS];
> @@ -309,7 +309,7 @@ static av_cold int dxv_init(AVCodecContext *avctx)
>  return AVERROR(ENOMEM);
>  }
>  
> -ctx->crc_ctx = (AVCRC*)av_crc_get_table(AV_CRC_32_IEEE);
> +ctx->crc_ctx = av_crc_get_table(AV_CRC_32_IEEE);
>  if (!ctx->crc_ctx) {
>  av_log(avctx, AV_LOG_ERROR, "Could not initialize CRC table.\n");
>  return AVERROR_BUG;

Will apply this patchset tomorrow unless there are objections.

- Andreas

___
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 1/7] avcodec/dxvenc: Don't cast const away

2024-01-26 Thread Connor Worley
I tested against
https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=10566, seems happy.

On Fri, Jan 26, 2024 at 10:58 AM Andreas Rheinhardt <
andreas.rheinha...@outlook.com> wrote:

> Andreas Rheinhardt:
> > Signed-off-by: Andreas Rheinhardt 
> > ---
> >  libavcodec/dxvenc.c | 8 
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/libavcodec/dxvenc.c b/libavcodec/dxvenc.c
> > index 3a5b310c9b..10473038cc 100644
> > --- a/libavcodec/dxvenc.c
> > +++ b/libavcodec/dxvenc.c
> > @@ -56,7 +56,7 @@ static void ht_init(HTEntry *ht)
> >  }
> >  }
> >
> > -static uint32_t ht_lookup_and_upsert(HTEntry *ht, AVCRC *hash_ctx,
> > +static uint32_t ht_lookup_and_upsert(HTEntry *ht, const AVCRC *hash_ctx,
> >  uint32_t key, uint32_t pos)
> >  {
> >  uint32_t ret = -1;
> > @@ -74,7 +74,7 @@ static uint32_t ht_lookup_and_upsert(HTEntry *ht,
> AVCRC *hash_ctx,
> >  return ret;
> >  }
> >
> > -static void ht_delete(HTEntry *ht, AVCRC *hash_ctx,
> > +static void ht_delete(HTEntry *ht, const AVCRC *hash_ctx,
> >uint32_t key, uint32_t pos)
> >  {
> >  HTEntry *removed_entry = NULL;
> > @@ -124,7 +124,7 @@ typedef struct DXVEncContext {
> >  enum DXVTextureFormat tex_fmt;
> >  int (*compress_tex)(AVCodecContext *avctx);
> >
> > -AVCRC *crc_ctx;
> > +const AVCRC *crc_ctx;
> >
> >  HTEntry color_lookback_ht[LOOKBACK_HT_ELEMS];
> >  HTEntry lut_lookback_ht[LOOKBACK_HT_ELEMS];
> > @@ -309,7 +309,7 @@ static av_cold int dxv_init(AVCodecContext *avctx)
> >  return AVERROR(ENOMEM);
> >  }
> >
> > -ctx->crc_ctx = (AVCRC*)av_crc_get_table(AV_CRC_32_IEEE);
> > +ctx->crc_ctx = av_crc_get_table(AV_CRC_32_IEEE);
> >  if (!ctx->crc_ctx) {
> >  av_log(avctx, AV_LOG_ERROR, "Could not initialize CRC
> table.\n");
> >  return AVERROR_BUG;
>
> Will apply this patchset tomorrow unless there are objections.
>
> - Andreas
>
> ___
> 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".
>


-- 
Connor Worley
___
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/3] avcodec/cbs_h266_syntax_template: sanity check num_multi_layer_olss

2024-01-26 Thread Michael Niedermayer
It is not possible to encode a index into an empty list. Thus
this must be invalid at this point or before.
Its likely a broader earlier check can be used here, someone knowing
VVC should look at that. Its not immedeatly obvious from the spec
by looking for numlayerolss

Fixes: out of array access
Fixes: 
65160/clusterfuzz-testcase-minimized-ffmpeg_BSF_VVC_METADATA_fuzzer-4665241535119360

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/cbs_h266_syntax_template.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/cbs_h266_syntax_template.c 
b/libavcodec/cbs_h266_syntax_template.c
index 549d0212119..9e479c9c314 100644
--- a/libavcodec/cbs_h266_syntax_template.c
+++ b/libavcodec/cbs_h266_syntax_template.c
@@ -946,6 +946,8 @@ static int FUNC(vps) (CodedBitstreamContext *ctx, RWContext 
*rw,
 
 if (!current->vps_each_layer_is_an_ols_flag) {
 uint16_t vps_num_dpb_params;
+if (!num_multi_layer_olss)
+return AVERROR_INVALIDDATA;
 ue(vps_num_dpb_params_minus1, 0, num_multi_layer_olss - 1);
 if (current->vps_each_layer_is_an_ols_flag)
 vps_num_dpb_params = 0;
-- 
2.17.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 3/3] avcodec/vvc/vvc_ps: check aps_adaptation_parameter_set_id

2024-01-26 Thread Michael Niedermayer
"When aps_params_type is equal to ALF_APS or SCALING_APS, the value of 
aps_adaptation_parameter_set_id shall be
in the range of 0 to 7, inclusive.
When aps_params_type is equal to LMCS_APS, the value of 
aps_adaptation_parameter_set_id shall be in the range of 0
to 3, inclusive."

Fixes: out of array accesses
Fixes: 
65932/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VVC_fuzzer-4563412340244480

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vvc/vvc_ps.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/vvc/vvc_ps.c b/libavcodec/vvc/vvc_ps.c
index c2afc0ac932..41589c138d1 100644
--- a/libavcodec/vvc/vvc_ps.c
+++ b/libavcodec/vvc/vvc_ps.c
@@ -991,12 +991,19 @@ int ff_vvc_decode_aps(VVCParamSets *ps, const 
CodedBitstreamUnit *unit)
 
 switch (aps->aps_params_type) {
 case APS_ALF:
+if (aps->aps_adaptation_parameter_set_id >= 
FF_ARRAY_ELEMS(ps->alf_list))
+return AVERROR_INVALIDDATA;
+
 ret = 
aps_decode_alf(&ps->alf_list[aps->aps_adaptation_parameter_set_id], aps);
 break;
 case APS_LMCS:
+if (aps->aps_adaptation_parameter_set_id >= 
FF_ARRAY_ELEMS(ps->lmcs_list))
+return AVERROR_INVALIDDATA;
 
ff_refstruct_replace(&ps->lmcs_list[aps->aps_adaptation_parameter_set_id], aps);
 break;
 case APS_SCALING:
+if (aps->aps_adaptation_parameter_set_id >= 
FF_ARRAY_ELEMS(ps->scaling_list))
+return AVERROR_INVALIDDATA;
 ret = 
aps_decode_scaling(&ps->scaling_list[aps->aps_adaptation_parameter_set_id], 
aps);
 break;
 }
-- 
2.17.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 1/3] avcodec/vvc/vvcdec: Do not submit frames without VVCFrameThread

2024-01-26 Thread Michael Niedermayer
Such frames will crash when pthread functions are called on the NULL pointer

Fixes: member access within null pointer of type 'VVCFrameThread' (aka 'struct 
VVCFrameThread')
Fixes: 
65160/clusterfuzz-testcase-minimized-ffmpeg_BSF_VVC_METADATA_fuzzer-4665241535119360
 (partly)
Fixes: 
65636/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VVC_fuzzer-5394745824182272

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vvc/vvcdec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/vvc/vvcdec.c b/libavcodec/vvc/vvcdec.c
index 540a05f8cf4..2fa6aa46d9b 100644
--- a/libavcodec/vvc/vvcdec.c
+++ b/libavcodec/vvc/vvcdec.c
@@ -910,6 +910,9 @@ static int vvc_decode_frame(AVCodecContext *avctx, AVFrame 
*output,
 if (ret < 0)
 return ret;
 
+if (!fc->ft)
+return avpkt->size;
+
 ret = submit_frame(s, fc, output, got_output);
 if (ret < 0)
 return ret;
-- 
2.17.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".


Re: [FFmpeg-devel] [PATCH 3/3] avcodec/vvc/vvc_ps: check aps_adaptation_parameter_set_id

2024-01-26 Thread James Almer

On 1/26/2024 6:46 PM, Michael Niedermayer wrote:

"When aps_params_type is equal to ALF_APS or SCALING_APS, the value of 
aps_adaptation_parameter_set_id shall be
in the range of 0 to 7, inclusive.
When aps_params_type is equal to LMCS_APS, the value of 
aps_adaptation_parameter_set_id shall be in the range of 0
to 3, inclusive."


This should be checked in CBS instead, and not one of its users.
Something like:


diff --git a/libavcodec/cbs_h266_syntax_template.c 
b/libavcodec/cbs_h266_syntax_template.c
index 549d021211..9fd8399f0e 100644
--- a/libavcodec/cbs_h266_syntax_template.c
+++ b/libavcodec/cbs_h266_syntax_template.c
@@ -2455,6 +2455,7 @@ static int FUNC(scaling_list_data)(CodedBitstreamContext 
*ctx, RWContext *rw,
 static int FUNC(aps)(CodedBitstreamContext *ctx, RWContext *rw,
  H266RawAPS *current, int prefix)
 {
+int aps_id_max = MAX_UINT_BITS(5);
 int err;

 if (prefix)
@@ -2467,7 +2468,12 @@ static int FUNC(aps)(CodedBitstreamContext *ctx, 
RWContext *rw,
: VVC_SUFFIX_APS_NUT));

 ub(3, aps_params_type);
-ub(5, aps_adaptation_parameter_set_id);
+if (current->aps_params_type == VVC_ASP_TYPE_ALF ||
+current->aps_params_type == VVC_ASP_TYPE_SCALING)
+aps_id_max = 7;
+else if (current->aps_params_type == VVC_ASP_TYPE_LMCS)
+aps_id_max = 3;
+u(5, aps_adaptation_parameter_set_id, 0, aps_id_max);
 flag(aps_chroma_present_flag);
 if (current->aps_params_type == VVC_ASP_TYPE_ALF)
 CHECK(FUNC(alf_data)(ctx, rw, current));

___
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 1/1] libavformat/rtpenc_jpeg.c: add support for the DRI marker

2024-01-26 Thread Michael Niedermayer
On Fri, Jan 26, 2024 at 11:12:53AM -0700, Sebastien Cote wrote:
> This patch adds support for the DRI marker in the JPEG RTP payloader.
> 
> ---
>  libavformat/rtpenc_jpeg.c | 28 
>  1 file changed, 28 insertions(+)
> 
> diff --git a/libavformat/rtpenc_jpeg.c b/libavformat/rtpenc_jpeg.c
> index e4e95931f4..60f56680e2 100644
> --- a/libavformat/rtpenc_jpeg.c
> +++ b/libavformat/rtpenc_jpeg.c
> @@ -33,6 +33,7 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const
> uint8_t *buf, int size)

patch corrupted by line breaks

Applying: libavformat/rtpenc_jpeg.c: add support for the DRI marker
error: corrupt patch at line 10

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

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates


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] avcodec/cbs_h266_syntax_template: check aps_adaptation_parameter_set_id

2024-01-26 Thread Michael Niedermayer
From: James Almer 

"When aps_params_type is equal to ALF_APS or SCALING_APS, the value of 
aps_adaptation_parameter_set_id shall be
in the range of 0 to 7, inclusive.
When aps_params_type is equal to LMCS_APS, the value of 
aps_adaptation_parameter_set_id shall be in the range of 0
to 3, inclusive."

Fixes: out of array accesses
Fixes: 
65932/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VVC_fuzzer-4563412340244480

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/cbs_h266_syntax_template.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavcodec/cbs_h266_syntax_template.c 
b/libavcodec/cbs_h266_syntax_template.c
index 9e479c9c314..21da8195556 100644
--- a/libavcodec/cbs_h266_syntax_template.c
+++ b/libavcodec/cbs_h266_syntax_template.c
@@ -2457,6 +2457,7 @@ static int FUNC(scaling_list_data)(CodedBitstreamContext 
*ctx, RWContext *rw,
 static int FUNC(aps)(CodedBitstreamContext *ctx, RWContext *rw,
  H266RawAPS *current, int prefix)
 {
+int aps_id_max = MAX_UINT_BITS(5);
 int err;
 
 if (prefix)
@@ -2469,7 +2470,12 @@ static int FUNC(aps)(CodedBitstreamContext *ctx, 
RWContext *rw,
: VVC_SUFFIX_APS_NUT));
 
 ub(3, aps_params_type);
-ub(5, aps_adaptation_parameter_set_id);
+if (current->aps_params_type == VVC_ASP_TYPE_ALF ||
+current->aps_params_type == VVC_ASP_TYPE_SCALING)
+aps_id_max = 7;
+else if (current->aps_params_type == VVC_ASP_TYPE_LMCS)
+aps_id_max = 3;
+u(5, aps_adaptation_parameter_set_id, 0, aps_id_max);
 flag(aps_chroma_present_flag);
 if (current->aps_params_type == VVC_ASP_TYPE_ALF)
 CHECK(FUNC(alf_data)(ctx, rw, current));
-- 
2.17.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 v3 0/6] Add mp4 and ts support for vvc

2024-01-26 Thread Nuo Mi
Major changes for mpegtsenc since v2:
Remove VVC from get_m2ts_stream_type (Marton)
Refact check_h26x_startcode to remove duplicate code (Marton)
Refact mpegts_check_bitstream to remove duplicate code (Marton)
Refact out h26x_prefix_aud
Remove h264, hevc magic numbers to improve readability

Nuo Mi (4):
  avformat/mpegtsenc: refact mpegts_check_bitstream to loop up table
  avformat/mpegtsenc: refact, move h264, hevc startcode checking to
check_h26x_startcode
  avformat/mpegtsenc: refact, remove h264, hevc magic numbers for
nal_type
  avformat/mpegtsenc: refact out h26x_prefix_aud

Thomas Siedel (2):
  avformat: add muxer support for H266/VVC
  avformat: add ts stream types for H266/VVC

 configure   |   2 +-
 libavformat/Makefile|   6 +-
 libavformat/isom.c  |   1 +
 libavformat/isom_tags.c |   3 +
 libavformat/mov.c   |   6 +
 libavformat/movenc.c|  41 +-
 libavformat/mpeg.c  |   6 +
 libavformat/mpeg.h  |   1 +
 libavformat/mpegts.c|   2 +
 libavformat/mpegts.h|   1 +
 libavformat/mpegtsenc.c | 173 ---
 libavformat/vvc.c   | 971 
 libavformat/vvc.h   |  99 
 13 files changed, 1245 insertions(+), 67 deletions(-)
 create mode 100644 libavformat/vvc.c
 create mode 100644 libavformat/vvc.h

--
2.25.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 v3 1/6] avformat: add muxer support for H266/VVC

2024-01-26 Thread Nuo Mi
From: Thomas Siedel 

Add muxer for vvcc byte stream format.
Add AV_CODEC_ID_VVC to ff_mp4_obj_type.
Add AV_CODEC_ID_VVC to ISO Media codec (VvcConfigurationBox vvi1,
vvc1 defined in ISO/IEC 14496-15:2021).
Add VvcConfigurationBox vvcC which extends FullBox type in
ISO/IEC 14496-15:2021.

Tested with:
ffmpeg -i NovosobornayaSquare_1920x1080.mp4 -c:v libvvenc test.mp4 && 
ffmpeg -i test.mp4 -f null -
ffmpeg -i NovosobornayaSquare_1920x1080.mp4 -c:v copy test.mp4 && 
ffmpeg -i test.mp4 -f md5 -

Signed-off-by: Thomas Siedel 
Co-Authored-By: Nuo Mi 
---
 libavformat/Makefile|   6 +-
 libavformat/isom.c  |   1 +
 libavformat/isom_tags.c |   3 +
 libavformat/mov.c   |   6 +
 libavformat/movenc.c|  41 +-
 libavformat/vvc.c   | 971 
 libavformat/vvc.h   |  99 
 7 files changed, 1123 insertions(+), 4 deletions(-)
 create mode 100644 libavformat/vvc.c
 create mode 100644 libavformat/vvc.h

diff --git a/libavformat/Makefile b/libavformat/Makefile
index dcc99eeac4..05b9b8a115 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -343,7 +343,7 @@ OBJS-$(CONFIG_MATROSKA_DEMUXER)  += matroskadec.o 
matroska.o  \
 oggparsevorbis.o vorbiscomment.o \
 qtpalette.o replaygain.o 
dovi_isom.o
 OBJS-$(CONFIG_MATROSKA_MUXER)+= matroskaenc.o matroska.o \
-av1.o avc.o hevc.o \
+av1.o avc.o hevc.o vvc.o\
 flacenc_header.o avlanguage.o \
 vorbiscomment.o wv.o dovi_isom.o
 OBJS-$(CONFIG_MCA_DEMUXER)   += mca.o
@@ -365,7 +365,7 @@ OBJS-$(CONFIG_MODS_DEMUXER)  += mods.o
 OBJS-$(CONFIG_MOFLEX_DEMUXER)+= moflex.o
 OBJS-$(CONFIG_MOV_DEMUXER)   += mov.o mov_chan.o mov_esds.o \
 qtpalette.o replaygain.o 
dovi_isom.o
-OBJS-$(CONFIG_MOV_MUXER) += movenc.o av1.o avc.o hevc.o vpcc.o 
\
+OBJS-$(CONFIG_MOV_MUXER) += movenc.o av1.o avc.o hevc.o vvc.o 
vpcc.o \
 movenchint.o mov_chan.o rtp.o \
 movenccenc.o movenc_ttml.o 
rawutils.o \
 dovi_isom.o evc.o
@@ -520,7 +520,7 @@ OBJS-$(CONFIG_RTP_MUXER) += rtp.o \
 rtpenc_vp8.o  \
 rtpenc_vp9.o\
 rtpenc_xiph.o \
-avc.o hevc.o
+avc.o hevc.o vvc.o
 OBJS-$(CONFIG_RTSP_DEMUXER)  += rtsp.o rtspdec.o httpauth.o \
 urldecode.o
 OBJS-$(CONFIG_RTSP_MUXER)+= rtsp.o rtspenc.o httpauth.o \
diff --git a/libavformat/isom.c b/libavformat/isom.c
index 6d019881e5..9fbccd4437 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -36,6 +36,7 @@ const AVCodecTag ff_mp4_obj_type[] = {
 { AV_CODEC_ID_MPEG4   , 0x20 },
 { AV_CODEC_ID_H264, 0x21 },
 { AV_CODEC_ID_HEVC, 0x23 },
+{ AV_CODEC_ID_VVC , 0x33 },
 { AV_CODEC_ID_AAC , 0x40 },
 { AV_CODEC_ID_MP4ALS  , 0x40 }, /* 14496-3 ALS */
 { AV_CODEC_ID_MPEG2VIDEO  , 0x61 }, /* MPEG-2 Main */
diff --git a/libavformat/isom_tags.c b/libavformat/isom_tags.c
index a575b7c160..705811e950 100644
--- a/libavformat/isom_tags.c
+++ b/libavformat/isom_tags.c
@@ -123,6 +123,9 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
 { AV_CODEC_ID_HEVC, MKTAG('d', 'v', 'h', 'e') }, /* HEVC-based Dolby 
Vision derived from hev1 */
  /* dvh1 is handled within 
mov.c */
 
+{ AV_CODEC_ID_VVC, MKTAG('v', 'v', 'i', '1') },  /* VVC/H.266 which 
indicates parameter sets may be in ES */
+{ AV_CODEC_ID_VVC, MKTAG('v', 'v', 'c', '1') },  /* VVC/H.266 which 
indicates parameter shall not be in ES */
+
 { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, /* AVC-1/H.264 */
 { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '2') },
 { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '3') },
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 4cffd6c7db..cf931d4594 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2123,6 +2123,11 @@ static int mov_read_glbl(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 if ((uint64_t)atom.size > (1<<30))
 return AVERROR_INVALIDDATA;
 
+if (atom.type == MKTAG('v','v','c','C')) {
+avio_skip(pb, 4);
+atom.size -= 4;
+}
+
 if (atom.size >= 10) {
 // Broken files created by legacy versions of libavformat will
 // wrap a whole fiel atom inside of a glb

[FFmpeg-devel] [PATCH v3 2/6] avformat/mpegtsenc: refact mpegts_check_bitstream to loop up table

2024-01-26 Thread Nuo Mi
---
 libavformat/mpegtsenc.c | 33 ++---
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 84edd418f0..418fa08ad5 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -2257,23 +2257,26 @@ static void mpegts_deinit(AVFormatContext *s)
 static int mpegts_check_bitstream(AVFormatContext *s, AVStream *st,
   const AVPacket *pkt)
 {
-int ret = 1;
+struct Entry {
+enum AVCodecID id;
+const char *bsf_name;
+uint8_t m;
+uint8_t v;
+} list[] = {
+{ AV_CODEC_ID_H264, "h264_mp4toannexb", 0xff, 0x01 },
+{ AV_CODEC_ID_HEVC, "hevc_mp4toannexb", 0xff, 0x01 },
+};
 
-if (st->codecpar->codec_id == AV_CODEC_ID_H264) {
-if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x001 &&
- (AV_RB24(pkt->data) != 0x01 ||
-  (st->codecpar->extradata_size > 0 &&
-   st->codecpar->extradata[0] == 1)))
-ret = ff_stream_add_bitstream_filter(st, "h264_mp4toannexb", NULL);
-} else if (st->codecpar->codec_id == AV_CODEC_ID_HEVC) {
-if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x001 &&
- (AV_RB24(pkt->data) != 0x01 ||
-  (st->codecpar->extradata_size > 0 &&
-   st->codecpar->extradata[0] == 1)))
-ret = ff_stream_add_bitstream_filter(st, "hevc_mp4toannexb", NULL);
+for (int i = 0; i < FF_ARRAY_ELEMS(list); i++) {
+struct Entry *e = list + i;
+if (e->id == st->codecpar->codec_id &&
+pkt->size >= 5 && AV_RB32(pkt->data) != 0x001 &&
+(AV_RB24(pkt->data) != 0x01 ||
+(st->codecpar->extradata_size > 0 &&
+(st->codecpar->extradata[0] & e->m == e->v
+return ff_stream_add_bitstream_filter(st, e->bsf_name, NULL);
 }
-
-return ret;
+return 1;
 }
 
 #define OFFSET(x) offsetof(MpegTSWrite, x)
-- 
2.25.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 v3 3/6] avformat/mpegtsenc: refact, move h264, hevc startcode checking to check_h26x_startcode

2024-01-26 Thread Nuo Mi
---
 libavformat/mpegtsenc.c | 26 --
 1 file changed, 8 insertions(+), 18 deletions(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 418fa08ad5..01b8c8d87a 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1759,16 +1759,16 @@ static void mpegts_write_pes(AVFormatContext *s, 
AVStream *st,
 ts_st->prev_payload_key = key;
 }
 
-int ff_check_h264_startcode(AVFormatContext *s, const AVStream *st, const 
AVPacket *pkt)
+static int check_h26x_startcode(AVFormatContext *s, const AVStream *st, const 
AVPacket *pkt, const char *codec)
 {
 if (pkt->size < 5 || AV_RB32(pkt->data) != 0x001 && AV_RB24(pkt->data) 
!= 0x01) {
 if (!st->nb_frames) {
-av_log(s, AV_LOG_ERROR, "H.264 bitstream malformed, "
-   "no startcode found, use the video bitstream filter 
'h264_mp4toannexb' to fix it "
-   "('-bsf:v h264_mp4toannexb' option with ffmpeg)\n");
+av_log(s, AV_LOG_ERROR, "%s bitstream malformed, "
+   "no startcode found, use the video bitstream filter 
'%s_mp4toannexb' to fix it "
+   "('-bsf:v %s_mp4toannexb' option with ffmpeg)\n", codec, 
codec, codec);
 return AVERROR_INVALIDDATA;
 }
-av_log(s, AV_LOG_WARNING, "H.264 bitstream error, startcode missing, 
size %d", pkt->size);
+av_log(s, AV_LOG_WARNING, "%s bitstream error, startcode missing, size 
%d", codec, pkt->size);
 if (pkt->size)
 av_log(s, AV_LOG_WARNING, " data %08"PRIX32, AV_RB32(pkt->data));
 av_log(s, AV_LOG_WARNING, "\n");
@@ -1776,19 +1776,9 @@ int ff_check_h264_startcode(AVFormatContext *s, const 
AVStream *st, const AVPack
 return 0;
 }
 
-static int check_hevc_startcode(AVFormatContext *s, const AVStream *st, const 
AVPacket *pkt)
+int ff_check_h264_startcode(AVFormatContext *s, const AVStream *st, const 
AVPacket *pkt)
 {
-if (pkt->size < 5 || AV_RB32(pkt->data) != 0x001 && AV_RB24(pkt->data) 
!= 0x01) {
-if (!st->nb_frames) {
-av_log(s, AV_LOG_ERROR, "HEVC bitstream malformed, no startcode 
found\n");
-return AVERROR_PATCHWELCOME;
-}
-av_log(s, AV_LOG_WARNING, "HEVC bitstream error, startcode missing, 
size %d", pkt->size);
-if (pkt->size)
-av_log(s, AV_LOG_WARNING, " data %08"PRIX32, AV_RB32(pkt->data));
-av_log(s, AV_LOG_WARNING, "\n");
-}
-return 0;
+return check_h26x_startcode(s, st, pkt, "h264");
 }
 
 /* Based on GStreamer's gst-plugins-base/ext/ogg/gstoggstream.c
@@ -1985,7 +1975,7 @@ static int mpegts_write_packet_internal(AVFormatContext 
*s, AVPacket *pkt)
 const uint8_t *p = buf, *buf_end = p + size;
 uint32_t state = -1;
 int extradd = (pkt->flags & AV_PKT_FLAG_KEY) ? 
st->codecpar->extradata_size : 0;
-int ret = check_hevc_startcode(s, st, pkt);
+int ret = check_h26x_startcode(s, st, pkt, "hevc");
 if (ret < 0)
 return ret;
 
-- 
2.25.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 v3 4/6] avformat/mpegtsenc: refact, remove h264, hevc magic numbers for nal_type

2024-01-26 Thread Nuo Mi
---
 libavformat/mpegtsenc.c | 32 +++-
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 01b8c8d87a..0843516ee6 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -31,6 +31,7 @@
 #include "libavcodec/bytestream.h"
 #include "libavcodec/defs.h"
 #include "libavcodec/h264.h"
+#include "libavcodec/hevc.h"
 #include "libavcodec/startcode.h"
 
 #include "avformat.h"
@@ -1833,6 +1834,8 @@ static int opus_get_packet_samples(AVFormatContext *s, 
AVPacket *pkt)
 return duration;
 }
 
+#define H264_NAL_TYPE(state) (state & 0x1f)
+#define HEVC_NAL_TYPE(state) ((state & 0x7e) >> 1)
 static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
 {
 AVStream *st = s->streams[pkt->stream_index];
@@ -1876,6 +1879,7 @@ static int mpegts_write_packet_internal(AVFormatContext 
*s, AVPacket *pkt)
 if (st->codecpar->codec_id == AV_CODEC_ID_H264) {
 const uint8_t *p = buf, *buf_end = p + size;
 const uint8_t *found_aud = NULL, *found_aud_end = NULL;
+int nal_type;
 uint32_t state = -1;
 int extradd = (pkt->flags & AV_PKT_FLAG_KEY) ? 
st->codecpar->extradata_size : 0;
 int ret = ff_check_h264_startcode(s, st, pkt);
@@ -1890,10 +1894,11 @@ static int mpegts_write_packet_internal(AVFormatContext 
*s, AVPacket *pkt)
  * are assumed to be available in 'extradata' if not found in-band. */
 do {
 p = avpriv_find_start_code(p, buf_end, &state);
-av_log(s, AV_LOG_TRACE, "nal %"PRId32"\n", state & 0x1f);
-if ((state & 0x1f) == H264_NAL_SPS)
+nal_type = H264_NAL_TYPE(state);
+av_log(s, AV_LOG_TRACE, "nal %"PRId32"\n", nal_type);
+if (nal_type == H264_NAL_SPS)
 extradd = 0;
-if ((state & 0x1f) == H264_NAL_AUD) {
+if (nal_type == H264_NAL_AUD) {
 found_aud = p - 4; // start of the 0x01 start code.
 found_aud_end = p + 1; // first byte past the AUD.
 if (found_aud < buf)
@@ -1902,10 +1907,10 @@ static int mpegts_write_packet_internal(AVFormatContext 
*s, AVPacket *pkt)
 found_aud_end = buf_end;
 }
 } while (p < buf_end
- && (state & 0x1f) != H264_NAL_IDR_SLICE
- && (state & 0x1f) != H264_NAL_SLICE
+ && nal_type != H264_NAL_IDR_SLICE
+ && nal_type != H264_NAL_SLICE
  && (extradd > 0 || !found_aud));
-if ((state & 0x1f) != H264_NAL_IDR_SLICE)
+if (nal_type != H264_NAL_IDR_SLICE)
 extradd = 0;
 
 if (!found_aud) {
@@ -1974,6 +1979,7 @@ static int mpegts_write_packet_internal(AVFormatContext 
*s, AVPacket *pkt)
 } else if (st->codecpar->codec_id == AV_CODEC_ID_HEVC) {
 const uint8_t *p = buf, *buf_end = p + size;
 uint32_t state = -1;
+int nal_type;
 int extradd = (pkt->flags & AV_PKT_FLAG_KEY) ? 
st->codecpar->extradata_size : 0;
 int ret = check_h26x_startcode(s, st, pkt, "hevc");
 if (ret < 0)
@@ -1984,22 +1990,22 @@ static int mpegts_write_packet_internal(AVFormatContext 
*s, AVPacket *pkt)
 
 do {
 p = avpriv_find_start_code(p, buf_end, &state);
-av_log(s, AV_LOG_TRACE, "nal %"PRId32"\n", (state & 0x7e)>>1);
-if ((state & 0x7e) == 2*32)
+nal_type = HEVC_NAL_TYPE(state);
+av_log(s, AV_LOG_TRACE, "nal %"PRId32"\n", nal_type);
+if (nal_type == HEVC_NAL_VPS)
 extradd = 0;
-} while (p < buf_end && (state & 0x7e) != 2*35 &&
- (state & 0x7e) >= 2*32);
+} while (p < buf_end && nal_type != HEVC_NAL_AUD && nal_type >= 
HEVC_NAL_VPS);
 
-if ((state & 0x7e) < 2*16 || (state & 0x7e) >= 2*24)
+if (nal_type < HEVC_NAL_BLA_W_LP || nal_type >= HEVC_NAL_RSV_VCL24)
 extradd = 0;
-if ((state & 0x7e) != 2*35) { // AUD NAL
+if (nal_type != HEVC_NAL_AUD) { // AUD NAL
 data = av_malloc(pkt->size + 7 + extradd);
 if (!data)
 return AVERROR(ENOMEM);
 memcpy(data + 7, st->codecpar->extradata, extradd);
 memcpy(data + 7 + extradd, pkt->data, pkt->size);
 AV_WB32(data, 0x0001);
-data[4] = 2*35;
+data[4] = (HEVC_NAL_AUD << 1);
 data[5] = 1;
 data[6] = 0x50; // any slice type (0x4) + rbsp stop one bit
 buf = data;
-- 
2.25.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 v3 5/6] avformat/mpegtsenc: refact out h26x_prefix_aud

2024-01-26 Thread Nuo Mi
---
 libavformat/mpegtsenc.c | 45 +
 1 file changed, 28 insertions(+), 17 deletions(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 0843516ee6..ff1c4de640 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1834,6 +1834,21 @@ static int opus_get_packet_samples(AVFormatContext *s, 
AVPacket *pkt)
 return duration;
 }
 
+static uint8_t *h26x_prefix_aud(const uint8_t *aud, const int aud_size,
+const uint8_t *extra_data, const int extra_size, AVPacket *pkt, int *size)
+{
+const int sz = 4;   //start code size
+uint8_t *data = av_malloc(pkt->size + sz + aud_size + extra_size);
+if (!data)
+return NULL;
+AV_WB32(data, 0x0001);
+memcpy(data + sz, aud, aud_size);
+memcpy(data + sz + aud_size, extra_data, extra_size);
+memcpy(data + sz + aud_size + extra_size, pkt->data, pkt->size);
+*size = pkt->size + sz + aud_size + extra_size;
+return data;
+}
+
 #define H264_NAL_TYPE(state) (state & 0x1f)
 #define HEVC_NAL_TYPE(state) ((state & 0x7e) >> 1)
 static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
@@ -1915,16 +1930,14 @@ static int mpegts_write_packet_internal(AVFormatContext 
*s, AVPacket *pkt)
 
 if (!found_aud) {
 /* Prefix 'buf' with the missing AUD, and extradata if needed. */
-data = av_malloc(pkt->size + 6 + extradd);
+const uint8_t aud[] = {
+H264_NAL_AUD,
+0xf0, // any slice type (0xe) + rbsp stop one bit
+};
+buf = data = h26x_prefix_aud(aud, FF_ARRAY_ELEMS(aud),
+st->codecpar->extradata, extradd, pkt, &size);
 if (!data)
 return AVERROR(ENOMEM);
-memcpy(data + 6, st->codecpar->extradata, extradd);
-memcpy(data + 6 + extradd, pkt->data, pkt->size);
-AV_WB32(data, 0x0001);
-data[4] = H264_NAL_AUD;
-data[5] = 0xf0; // any slice type (0xe) + rbsp stop one bit
-buf = data;
-size= pkt->size + 6 + extradd;
 } else if (extradd != 0) {
 /* Move the AUD up to the beginning of the frame, where the H.264
  * spec requires it to appear. Emit the extradata after it. */
@@ -1999,17 +2012,15 @@ static int mpegts_write_packet_internal(AVFormatContext 
*s, AVPacket *pkt)
 if (nal_type < HEVC_NAL_BLA_W_LP || nal_type >= HEVC_NAL_RSV_VCL24)
 extradd = 0;
 if (nal_type != HEVC_NAL_AUD) { // AUD NAL
-data = av_malloc(pkt->size + 7 + extradd);
+const uint8_t aud[] = {
+(HEVC_NAL_AUD << 1),
+0x01,
+0x50, // any slice type (0x4) + rbsp stop one bit
+};
+buf = data = h26x_prefix_aud(aud, FF_ARRAY_ELEMS(aud),
+st->codecpar->extradata, extradd, pkt, &size);
 if (!data)
 return AVERROR(ENOMEM);
-memcpy(data + 7, st->codecpar->extradata, extradd);
-memcpy(data + 7 + extradd, pkt->data, pkt->size);
-AV_WB32(data, 0x0001);
-data[4] = (HEVC_NAL_AUD << 1);
-data[5] = 1;
-data[6] = 0x50; // any slice type (0x4) + rbsp stop one bit
-buf = data;
-size= pkt->size + 7 + extradd;
 }
 } else if (st->codecpar->codec_id == AV_CODEC_ID_OPUS) {
 if (pkt->size < 2) {
-- 
2.25.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 v3 6/6] avformat: add ts stream types for H266/VVC

2024-01-26 Thread Nuo Mi
From: Thomas Siedel 

Add transport stream stream type 0x33 for vvc.
Add STREAM_TYPE_VIDEO_VVC to MPEG-1/2 and MPEG-2 transport stream.
Add basic transport stream support for TS mux/demux.

Tested with:
ffmpeg -i NovosobornayaSquare_1920x1080.mp4 -c:v libvvenc test.ts && ffmpeg -i 
test.ts -f null -
ffmpeg -i NovosobornayaSquare_1920x1080.mp4 -c:v copy test.ts && ffmpeg -i 
test.ts -f md5 -

Signed-off-by: Thomas Siedel 
Co-Authored-By: Nuo Mi 
---
 configure   |  2 +-
 libavformat/mpeg.c  |  6 ++
 libavformat/mpeg.h  |  1 +
 libavformat/mpegts.c|  2 ++
 libavformat/mpegts.h|  1 +
 libavformat/mpegtsenc.c | 39 +++
 6 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 21663000f8..68f675a4bc 100755
--- a/configure
+++ b/configure
@@ -3552,7 +3552,7 @@ mp3_demuxer_select="mpegaudio_parser"
 mp3_muxer_select="mpegaudioheader"
 mp4_muxer_select="mov_muxer"
 mpegts_demuxer_select="iso_media"
-mpegts_muxer_select="ac3_parser adts_muxer latm_muxer h264_mp4toannexb_bsf 
hevc_mp4toannexb_bsf"
+mpegts_muxer_select="ac3_parser adts_muxer latm_muxer h264_mp4toannexb_bsf 
hevc_mp4toannexb_bsf vvc_mp4toannexb_bsf"
 mpegtsraw_demuxer_select="mpegts_demuxer"
 mxf_muxer_select="pcm_rechunk_bsf rangecoder"
 mxf_d10_muxer_select="mxf_muxer"
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index 781c3162d6..4b0c65826e 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -546,6 +546,12 @@ redo:
 } else if (es_type == STREAM_TYPE_VIDEO_HEVC) {
 codec_id = AV_CODEC_ID_HEVC;
 type = AVMEDIA_TYPE_VIDEO;
+} else if (es_type == STREAM_TYPE_VIDEO_VVC) {
+codec_id = AV_CODEC_ID_VVC;
+type = AVMEDIA_TYPE_VIDEO;
+} else if (es_type == STREAM_TYPE_VIDEO_VVC) {
+codec_id = AV_CODEC_ID_VVC;
+type = AVMEDIA_TYPE_VIDEO;
 } else if (es_type == STREAM_TYPE_AUDIO_AC3) {
 codec_id = AV_CODEC_ID_AC3;
 type = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/mpeg.h b/libavformat/mpeg.h
index b635295776..20592eb184 100644
--- a/libavformat/mpeg.h
+++ b/libavformat/mpeg.h
@@ -56,6 +56,7 @@
 #define STREAM_TYPE_VIDEO_MPEG4 0x10
 #define STREAM_TYPE_VIDEO_H264  0x1b
 #define STREAM_TYPE_VIDEO_HEVC  0x24
+#define STREAM_TYPE_VIDEO_VVC   0x33
 #define STREAM_TYPE_VIDEO_CAVS  0x42
 
 #define STREAM_TYPE_AUDIO_AC3   0x81
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index c7fd1f5d1f..bef00c88e7 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -812,6 +812,7 @@ static const StreamType ISO_types[] = {
 { 0x20, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_H264   },
 { 0x21, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_JPEG2000   },
 { 0x24, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_HEVC   },
+{ 0x33, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_VVC},
 { 0x42, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_CAVS   },
 { 0xd1, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_DIRAC  },
 { 0xd2, AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_AVS2   },
@@ -867,6 +868,7 @@ static const StreamType REGD_types[] = {
 { MKTAG('D', 'T', 'S', '3'), AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_DTS   },
 { MKTAG('E', 'A', 'C', '3'), AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_EAC3  },
 { MKTAG('H', 'E', 'V', 'C'), AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_HEVC  },
+{ MKTAG('V', 'V', 'C', ' '), AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_VVC   },
 { MKTAG('K', 'L', 'V', 'A'), AVMEDIA_TYPE_DATA,  AV_CODEC_ID_SMPTE_KLV },
 { MKTAG('V', 'A', 'N', 'C'), AVMEDIA_TYPE_DATA,  AV_CODEC_ID_SMPTE_2038 },
 { MKTAG('I', 'D', '3', ' '), AVMEDIA_TYPE_DATA,  AV_CODEC_ID_TIMED_ID3 },
diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h
index a48f14e768..14ae312c50 100644
--- a/libavformat/mpegts.h
+++ b/libavformat/mpegts.h
@@ -128,6 +128,7 @@
 #define STREAM_TYPE_METADATA0x15
 #define STREAM_TYPE_VIDEO_H264  0x1b
 #define STREAM_TYPE_VIDEO_HEVC  0x24
+#define STREAM_TYPE_VIDEO_VVC   0x33
 #define STREAM_TYPE_VIDEO_CAVS  0x42
 #define STREAM_TYPE_VIDEO_AVS2  0xd2
 #define STREAM_TYPE_VIDEO_AVS3  0xd4
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index ff1c4de640..69ba47534a 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -32,6 +32,7 @@
 #include "libavcodec/defs.h"
 #include "libavcodec/h264.h"
 #include "libavcodec/hevc.h"
+#include "libavcodec/vvc.h"
 #include "libavcodec/startcode.h"
 
 #include "avformat.h"
@@ -369,6 +370,9 @@ static int get_dvb_stream_type(AVFormatContext *s, AVStream 
*st)
 case AV_CODEC_ID_HEVC:
 stream_type = STREAM_TYPE_VIDEO_HEVC;
 break;
+case AV_CODEC_ID_VVC:
+stream_type = STREAM_TYPE_VIDEO_VVC;
+break;
 case AV_CODEC_ID_CAVS:
 stream_type = STREAM_TYPE_VIDEO_CAVS;
 break;
@@ -1851,6 +1855,7 @@ static uint8_t *h26x_prefix_aud(const uint8_t *aud, const 
int aud_size,
 
 #define H264_NAL_TYPE(state) (state & 0x1f)
 #define HEVC_NAL_

[FFmpeg-devel] [PATCH v2 1/1] libavformat/rtpenc_jpeg.c: add support for the DRI marker

2024-01-26 Thread Sebastien Cote
This patch adds support for the DRI marker in the JPEG RTP encoder.
Apologies for the bad line breaks in the previous patch. The production line 
for this patch is 100% Linux.

Signed-off-by: Sebastien Cote 
---
 libavformat/rtpenc_jpeg.c | 28 
 1 file changed, 28 insertions(+)

diff --git a/libavformat/rtpenc_jpeg.c b/libavformat/rtpenc_jpeg.c
index e4e95931f4..de2148a29d 100644
--- a/libavformat/rtpenc_jpeg.c
+++ b/libavformat/rtpenc_jpeg.c
@@ -33,6 +33,7 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t 
*buf, int size)
 uint8_t type = 2; /* initialized non-0/1 value for RTP/JPEG type check*/
 uint8_t w, h;
 uint8_t *p;
+uint16_t rst_marker_interval = 0;
 int off = 0; /* fragment offset of the current JPEG frame */
 int len;
 int i;
@@ -155,6 +156,22 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t 
*buf, int size)
 dht_size = 0;
 continue;
 }
+} else if (buf[i + 1] == DRI) {
+uint16_t dri_size = 0;
+if (i + 5 > size) {
+av_log(s1, AV_LOG_ERROR, "Too short JPEG header. Aborted!\n");
+return;
+}
+
+dri_size = AV_RB16(&buf[i + 2]);
+rst_marker_interval = AV_RB16(&buf[i + 4]);
+
+if (i + 1 + dri_size > size) {
+av_log(s1, AV_LOG_ERROR, "Too short JPEG header. Aborted!\n");
+return;
+}
+
+i += 1 + dri_size;
 } else if (buf[i + 1] == SOS) {
 /* SOS is last marker in the header */
 i += AV_RB16(&buf[i + 2]) + 2;
@@ -196,10 +213,16 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t 
*buf, int size)
 }
 }
 
+if (rst_marker_interval > 0)
+type += 64;
+
 p = s->buf_ptr;
 while (size > 0) {
 int hdr_size = 8;
 
+if (rst_marker_interval > 0)
+hdr_size += 4;
+
 if (off == 0 && nb_qtables)
 hdr_size += 4 + 64 * nb_qtables;
 
@@ -214,6 +237,11 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t 
*buf, int size)
 bytestream_put_byte(&p, w);
 bytestream_put_byte(&p, h);
 
+if (rst_marker_interval > 0) {
+bytestream_put_be16(&p, rst_marker_interval);
+bytestream_put_be16(&p, 0x);
+}
+
 if (off == 0 && nb_qtables) {
 /* set quantization tables header */
 bytestream_put_byte(&p, 0);
-- 
2.40.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".


Re: [FFmpeg-devel] [PATCH] lavc/vvc: Fix emulation prevention byte handling

2024-01-26 Thread Nuo Mi
On Sat, Jan 27, 2024 at 12:21 AM  wrote:

> From: Frank Plowman 
>
> nal->skipped_bytes_pos contains the positions of errors relative to the
> start of the slice header, whereas the position they were tested against
> is relative to the start of the slice data, i.e. one byte after the end
> of the slice header.
>
> Patch fixes this by storing the size of the slice header in H266RawSlice
> and adding it to the position given by the GetBitContext before
> comparing to skipped_bytes_pos.  This fixes AVERROR_INVALIDDATAs for
> various valid bitstreams, such as the LMCS_B_Dolby_2 conformance
> bitstream.
>
> Signed-off-by: Frank Plowman 
>
Hi Frank,
Thanks for the patch.
The decode md5 still mismatch with reference for LMCS_B_Dolby_2
Do you happen to know why?

---
>
> ___
> 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] x86: Remove inline MMX assembly that clobbers the FPU state

2024-01-26 Thread Nuo Mi
On Fri, Jan 26, 2024 at 9:45 PM Martin Storsjö  wrote:

> On Fri, 26 Jan 2024, Martin Storsjö wrote:
>
> > These inline implementations of AV_COPY64, AV_SWAP64 and AV_ZERO64
> > are known to clobber the FPU state - which has to be restored
> > with the 'emms' instruction afterwards.
> >
> > This was known and signaled with the FF_COPY_SWAP_ZERO_USES_MMX
> > define, which calling code seems to have been supposed to check,
> > in order to call emms_c() after using them. See
> > 0b1972d4096df5879038f0af776f87f41e90ebd4,
> > 29c4c0886d143790fcbeddbe40a23dfc6f56345c and
> > df215e575850e41b19aeb1fd99e53372a6b3d537 for history on earlier
> > fixes in the same area.
> >
> > However, new code can use these AV_*64() macros without knowing
> > about the need to call emms_c().
> >
> > Just get rid of these dangerous inline assembly snippets; this
> > doesn't make any difference for 64 bit architectures anyway.
> >
> > Signed-off-by: Martin Storsjö 
> > ---
> > libavcodec/dca_core.c| 16 
> > libavutil/x86/intreadwrite.h | 36 
> > 2 files changed, 52 deletions(-)
>
> I forgot to add some more context here; the VVC tests fail on i386 in some
> cases.
>
> https://patchwork.ffmpeg.org/project/ffmpeg/patch/20240125170518.61211-1-p...@frankplowman.com/
> fixes this, by using av_log2() instead of the float log2() in the VVC
> decoder. This patch fixes the same issue as well, by eliminating the FPU
> state clobbering (so that float math functions anywhere in decoders work
> as expected).
>
👍

>
> // 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".
>
___
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".