[FFmpeg-devel] [PATCH 24/24] fate/h264: Fix test requirements

2022-04-29 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 tests/fate/h264.mak | 69 +++--
 1 file changed, 36 insertions(+), 33 deletions(-)

diff --git a/tests/fate/h264.mak b/tests/fate/h264.mak
index e075b6f67f..44e20f7259 100644
--- a/tests/fate/h264.mak
+++ b/tests/fate/h264.mak
@@ -1,3 +1,21 @@
+FATE_H264_HIGH_BIT_DEPTH := \
+frext-hi422fr13_sony_b  \
+frext-hi422fr6_sony_a   \
+frext-pph10i1_panasonic_a   \
+frext-pph10i2_panasonic_a   \
+frext-pph10i3_panasonic_a   \
+frext-pph10i4_panasonic_a   \
+frext-pph10i5_panasonic_a   \
+frext-pph10i6_panasonic_a   \
+frext-pph10i7_panasonic_a   \
+frext-pph422i1_panasonic_a  \
+frext-pph422i2_panasonic_a  \
+frext-pph422i3_panasonic_a  \
+frext-pph422i4_panasonic_a  \
+frext-pph422i5_panasonic_a  \
+frext-pph422i6_panasonic_a  \
+frext-pph422i7_panasonic_a  \
+
 FATE_H264 = aud_mw_e\
 ba1_ft_c\
 ba1_sony_d  \
@@ -115,9 +133,7 @@ FATE_H264 = aud_mw_e
\
 frext-hcafr4_hhi_a  \
 frext-hcamff1_hhi_b \
 frext-hi422fr10_sony_b  \
-frext-hi422fr13_sony_b  \
 frext-hi422fr1_sony_a   \
-frext-hi422fr6_sony_a   \
 frext-hpca_brcm_c   \
 frext-hpcadq_brcm_b \
 frext-hpcafl_bcrm_c \
@@ -132,20 +148,6 @@ FATE_H264 = aud_mw_e   
 \
 frext-hpcvflnl_bcrm_a   \
 frext-hpcvmolq_brcm_b   \
 frext-hpcvnl_brcm_a \
-frext-pph10i1_panasonic_a   \
-frext-pph10i2_panasonic_a   \
-frext-pph10i3_panasonic_a   \
-frext-pph10i4_panasonic_a   \
-frext-pph10i5_panasonic_a   \
-frext-pph10i6_panasonic_a   \
-frext-pph10i7_panasonic_a   \
-frext-pph422i1_panasonic_a  \
-frext-pph422i2_panasonic_a  \
-frext-pph422i3_panasonic_a  \
-frext-pph422i4_panasonic_a  \
-frext-pph422i5_panasonic_a  \
-frext-pph422i6_panasonic_a  \
-frext-pph422i7_panasonic_a  \
 hcbp2_hhi_a \
 hcmp1_hhi_a \
 ls_sva_d\
@@ -182,6 +184,7 @@ FATE_H264 = aud_mw_e
\
 sva_fm1_e   \
 sva_nl1_b   \
 sva_nl2_e   \
+$(if $(CONFIG_SCALE_FILTER),$(FATE_H264_HIGH_BIT_DEPTH))
 
 FATE_H264_REINIT_TESTS := large_420_8-to-small_420_8\
   small_420_8-to-large_444_10   \
@@ -189,44 +192,44 @@ FATE_H264_REINIT_TESTS := large_420_8-to-small_420_8  
  \
   small_422_9-to-small_420_9\
 
 FATE_H264  := $(FATE_H264:%=fate-h264-conformance-%)\
-  $(

[FFmpeg-devel] [PATCH 23/24] fate/hap: Fix test requirements

2022-04-29 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 tests/fate/hap.mak | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/tests/fate/hap.mak b/tests/fate/hap.mak
index ba921798cc..8268798f4a 100644
--- a/tests/fate/hap.mak
+++ b/tests/fate/hap.mak
@@ -25,8 +25,10 @@ fate-hap-alpha-only-nosnappy-128x72: CMD = framecrc -i 
$(TARGET_SAMPLES)/hap/Hap
 FATE_HAP += fate-hap-alpha-only-snappy-127x71
 fate-hap-alpha-only-snappy-127x71: CMD = framecrc -i 
$(TARGET_SAMPLES)/hap/HapAlphaOnly_snappy1chunk_127x71.mov -pix_fmt gray8
 
-FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, HAP) += $(FATE_HAP)
-fate-hap: $(FATE_HAP)
+FATE_HAP-$(call FRAMECRC, MOV, HAP) += $(FATE_HAP)
+
+FATE_SAMPLES_FFMPEG += $(FATE_HAP-yes)
+fate-hap: $(FATE_HAP-yes)
 
 
 #Test bsf conversion
@@ -42,6 +44,7 @@ fate-hapqa-extract-snappy1-to-hapalphaonly: CMD = framecrc -i 
$(TARGET_SAMPLES)/
 FATE_HAPQA_EXTRACT_BSF += fate-hapqa-extract-snappy16-to-hapalphaonly
 fate-hapqa-extract-snappy16-to-hapalphaonly: CMD = framecrc -i 
$(TARGET_SAMPLES)/hap/HAPQA_Snappy_16chunk_127x1.mov -c:v copy -bsf:v 
hapqa_extract=texture=alpha -tag:v HapA -metadata:s:v:0 encoder="HAPAlphaOnly"
 
+FATE_HAPQA_EXTRACT_BSF-$(call REMUX, FRAMECRC MOV, HAPQA_EXTRACT_BSF) += 
$(FATE_HAPQA_EXTRACT_BSF)
 
 #Test bsf conversion and mov
 tests/data/hapq_nosnappy.mov: TAG = GEN
@@ -65,8 +68,8 @@ FATE_HAPQA_EXTRACT_BSF_FFPROBE += 
fate-hapqa-extract-nosnappy-to-hapalphaonly-mo
 fate-hapqa-extract-nosnappy-to-hapalphaonly-mov: 
tests/data/hapalphaonly_nosnappy.mov
 fate-hapqa-extract-nosnappy-to-hapalphaonly-mov: CMD = run 
ffprobe$(PROGSSUF)$(EXESUF) -show_packets -show_data_hash adler32 -bitexact 
-show_streams -select_streams v -v 0 
$(TARGET_PATH)/tests/data/hapalphaonly_nosnappy.mov
 
+FATE_HAPQA_EXTRACT_BSF_FFPROBE-$(call DEMMUX, MOV, MOV, HAPQA_EXTRACT_BSF 
HAP_DECODER) += $(FATE_HAPQA_EXTRACT_BSF_FFPROBE)
 
-FATE_SAMPLES_FFMPEG-$(call ALLYES, MOV_DEMUXER HAPQA_EXTRACT_BSF MOV_MUXER) += 
$(FATE_HAPQA_EXTRACT_BSF)
-FATE_SAMPLES_FFPROBE += $(FATE_HAPQA_EXTRACT_BSF_FFPROBE)
-
-fate-hapqa-extract-bsf: $(FATE_HAPQA_EXTRACT_BSF) 
$(FATE_HAPQA_EXTRACT_BSF_FFPROBE)
+FATE_SAMPLES_FFMPEG += $(FATE_HAPQA_EXTRACT_BSF-yes)
+FATE_SAMPLES_FFMPEG_FFPROBE += $(FATE_HAPQA_EXTRACT_BSF_FFPROBE-yes)
+fate-hapqa-extract-bsf: $(FATE_HAPQA_EXTRACT_BSF-yes) 
$(FATE_HAPQA_EXTRACT_BSF_FFPROBE-yes)
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 21/24] tests/ref: Remove unused reference files

2022-04-29 Thread Andreas Rheinhardt
Accidentally resurrected in fc49f22c3b735db5aaac5f98e40b7124a2be13b8
and 7711f19eda40a7fd1c8a327f1700ffdd115e1667,
forgotten in 6ebc71847e21a8abaf7ff3d902cb1cf63511e7b4 and
1a6a088f7c7b164042ad16d43d05543ce1bacfa4 or never needed
(filter-aemphasis).

Signed-off-by: Andreas Rheinhardt 
---
 tests/ref/acodec/adpcm_ima_qt|4 -
 tests/ref/fate/acodec-aref   |4 -
 tests/ref/fate/filter-aemphasis  |  526 
 tests/ref/fate/g729-0| 1000 --
 tests/ref/fate/g729-1| 1000 --
 tests/ref/fate/hapenc-hap-none   |   14 -
 tests/ref/fate/hapenc-hapa-none  |   14 -
 tests/ref/fate/hapenc-hapq-none  |   14 -
 tests/ref/fate/smjpeg|  425 -
 tests/ref/vsynth/vsynth1-dnxhd_1080i |4 -
 tests/ref/vsynth/vsynth1-dv_411  |4 -
 tests/ref/vsynth/vsynth1-zmbv|4 -
 tests/ref/vsynth/vsynth_lena-dnxhd_1080i |4 -
 tests/ref/vsynth/vsynth_lena-dv_411  |4 -
 tests/ref/vsynth/vsynth_lena-zmbv|4 -
 tests/ref/vsynth1/cljr   |4 -
 tests/ref/vsynth1/yuv|4 -
 tests/ref/vsynth_lena/cljr   |4 -
 tests/ref/vsynth_lena/huffyuv|4 -
 tests/ref/vsynth_lena/yuv|4 -
 20 files changed, 3045 deletions(-)
 delete mode 100644 tests/ref/acodec/adpcm_ima_qt
 delete mode 100644 tests/ref/fate/acodec-aref
 delete mode 100644 tests/ref/fate/filter-aemphasis
 delete mode 100644 tests/ref/fate/g729-0
 delete mode 100644 tests/ref/fate/g729-1
 delete mode 100644 tests/ref/fate/hapenc-hap-none
 delete mode 100644 tests/ref/fate/hapenc-hapa-none
 delete mode 100644 tests/ref/fate/hapenc-hapq-none
 delete mode 100644 tests/ref/fate/smjpeg
 delete mode 100644 tests/ref/vsynth/vsynth1-dnxhd_1080i
 delete mode 100644 tests/ref/vsynth/vsynth1-dv_411
 delete mode 100644 tests/ref/vsynth/vsynth1-zmbv
 delete mode 100644 tests/ref/vsynth/vsynth_lena-dnxhd_1080i
 delete mode 100644 tests/ref/vsynth/vsynth_lena-dv_411
 delete mode 100644 tests/ref/vsynth/vsynth_lena-zmbv
 delete mode 100644 tests/ref/vsynth1/cljr
 delete mode 100644 tests/ref/vsynth1/yuv
 delete mode 100644 tests/ref/vsynth_lena/cljr
 delete mode 100644 tests/ref/vsynth_lena/huffyuv
 delete mode 100644 tests/ref/vsynth_lena/yuv

diff --git a/tests/ref/acodec/adpcm_ima_qt b/tests/ref/acodec/adpcm_ima_qt
deleted file mode 100644
index a50c30a27c..00
--- a/tests/ref/acodec/adpcm_ima_qt
+++ /dev/null
@@ -1,4 +0,0 @@
-23cbae1182e150ebf28e0abfb9cba127 *./tests/data/acodec/adpcm_qt.aiff
-281252 ./tests/data/acodec/adpcm_qt.aiff
-b0fafd002c38fb70acaddfda1a31ed61 *./tests/data/adpcm_ima_qt.acodec.out.wav
-stddev:  904.76 PSNR: 37.20 MAXDIFF:34029 bytes:  1058560/  1058400
diff --git a/tests/ref/fate/acodec-aref b/tests/ref/fate/acodec-aref
deleted file mode 100644
index d70876d9d9..00
--- a/tests/ref/fate/acodec-aref
+++ /dev/null
@@ -1,4 +0,0 @@
-64151e4bcc2b717aa5a8454d424d6a1f *./tests/data/acodec.ref.wav
-1058446 ./tests/data/acodec.ref.wav
-ce524631c2ad0a40aaab46e3a80a1176 *./tests/data/acodec-16000-1.ref.wav
-192046 ./tests/data/acodec-16000-1.ref.wav
diff --git a/tests/ref/fate/filter-aemphasis b/tests/ref/fate/filter-aemphasis
deleted file mode 100644
index 143a434972..00
--- a/tests/ref/fate/filter-aemphasis
+++ /dev/null
@@ -1,526 +0,0 @@
-#tb 0: 1/44100
-#media_type 0: audio
-#codec_id 0: pcm_s16le
-#sample_rate 0: 44100
-0,  0,  0, 1024, 4096, 0xb9c5fefd
-0,   1024,   1024, 1024, 4096, 0xb2ae0a90
-0,   2048,   2048, 1024, 4096, 0x97e6e9f3
-0,   3072,   3072, 1024, 4096, 0x5837f26f
-0,   4096,   4096, 1024, 4096, 0x71500376
-0,   5120,   5120, 1024, 4096, 0xb4650378
-0,   6144,   6144, 1024, 4096, 0xd261f5b1
-0,   7168,   7168, 1024, 4096, 0x3038f3fd
-0,   8192,   8192, 1024, 4096, 0x8e1908c6
-0,   9216,   9216, 1024, 4096, 0x1d6bfd33
-0,  10240,  10240, 1024, 4096, 0x7036f23f
-0,  11264,  11264, 1024, 4096, 0xaf73e9a1
-0,  12288,  12288, 1024, 4096, 0x0ba70404
-0,  13312,  13312, 1024, 4096, 0xd34bf249
-0,  14336,  14336, 1024, 4096, 0x0c88fc2b
-0,  15360,  15360, 1024, 4096, 0x55ebf9cf
-0,  16384,  16384, 1024, 4096, 0xc16df0bd
-0,  17408,  17408, 1024, 4096, 0xa635eac5
-0,  18432,  18432, 1024, 4096, 0xb41d059e
-0,  19456,  19456, 1024, 4096, 0xa905f4d3
-0,  20480,  20480, 1024, 4096, 0x2736f1fb
-0,  21504,  21504, 1024, 4096, 0x1a89f007
-0,  22528,  22528, 1024, 4096, 0x81d1fdab
-0,  23552,  23552, 1024, 4096, 0x6156f97d
-0,  24576,  24576, 1024, 4096

[FFmpeg-devel] [PATCH 22/24] tests/fate-run: Always use -bitexact for ffprobe

2022-04-29 Thread Andreas Rheinhardt
Makes no difference currently.

Signed-off-by: Andreas Rheinhardt 
---
 tests/fate-run.sh | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index 3c62246c8a..821e949b01 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -86,15 +86,15 @@ runecho(){
 }
 
 probefmt(){
-run ffprobe${PROGSUF}${EXECSUF} -show_entries format=format_name 
-print_format default=nw=1:nk=1 "$@"
+run ffprobe${PROGSUF}${EXECSUF} -bitexact -show_entries format=format_name 
-print_format default=nw=1:nk=1 "$@"
 }
 
 probeaudiostream(){
-run ffprobe${PROGSUF}${EXECSUF} -show_entries 
stream=codec_name,codec_time_base,sample_fmt,channels,channel_layout:side_data 
"$@"
+run ffprobe${PROGSUF}${EXECSUF} -bitexact -show_entries 
stream=codec_name,codec_time_base,sample_fmt,channels,channel_layout:side_data 
"$@"
 }
 
 probetags(){
-run ffprobe${PROGSUF}${EXECSUF} -show_entries format_tags "$@"
+run ffprobe${PROGSUF}${EXECSUF} -bitexact -show_entries format_tags "$@"
 }
 
 runlocal(){
@@ -103,11 +103,11 @@ runlocal(){
 }
 
 probeframes(){
-run ffprobe${PROGSUF}${EXECSUF} -show_frames "$@"
+run ffprobe${PROGSUF}${EXECSUF} -bitexact -show_frames "$@"
 }
 
 probechapters(){
-run ffprobe${PROGSUF}${EXECSUF} -show_chapters "$@"
+run ffprobe${PROGSUF}${EXECSUF} -bitexact -show_chapters "$@"
 }
 
 probegaplessinfo(){
@@ -222,7 +222,7 @@ enc_dec(){
 do_md5sum $decfile
 tests/tiny_psnr${HOSTEXECSUF} $srcfile $decfile $cmp_unit $cmp_shift
 test -z $ffprobe_opts || \
-run ffprobe${PROGSUF}${EXECSUF} $ffprobe_opts $tencfile || return
+run ffprobe${PROGSUF}${EXECSUF} -bitexact $ffprobe_opts $tencfile || 
return
 }
 
 transcode(){
@@ -245,7 +245,7 @@ transcode(){
 ffmpeg $DEC_OPTS -i $tencfile $ENC_OPTS $FLAGS $final_decode \
 -f framecrc - || return
 test -z $ffprobe_opts || \
-run ffprobe${PROGSUF}${EXECSUF} $ffprobe_opts $tencfile || return
+run ffprobe${PROGSUF}${EXECSUF} -bitexact $ffprobe_opts $tencfile || 
return
 }
 
 stream_remux(){
@@ -264,7 +264,7 @@ stream_remux(){
 ffmpeg $DEC_OPTS -i $tencfile $ENC_OPTS $FLAGS $final_decode \
 -f framecrc - || return
 test -z $ffprobe_opts || \
-run ffprobe${PROGSUF}${EXECSUF} $ffprobe_opts $tencfile || return
+run ffprobe${PROGSUF}${EXECSUF} -bitexact $ffprobe_opts $tencfile || 
return
 }
 
 # FIXME: There is a certain duplication between the avconv-related helper
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 20/24] fate/qtrle: Fix test requirements

2022-04-29 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 tests/fate/qtrle.mak | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/tests/fate/qtrle.mak b/tests/fate/qtrle.mak
index 3dd0afbd3f..3adefd2009 100644
--- a/tests/fate/qtrle.mak
+++ b/tests/fate/qtrle.mak
@@ -1,23 +1,26 @@
 FATE_QTRLE += fate-qtrle-1bit
 fate-qtrle-1bit: CMD = framecrc -i 
$(TARGET_SAMPLES)/qtrle/Animation-Monochrome.mov -an
 
-FATE_QTRLE += fate-qtrle-2bit
+FATE_QTRLE_SCALE += fate-qtrle-2bit
 fate-qtrle-2bit: CMD = framecrc -i 
$(TARGET_SAMPLES)/qtrle/Animation-4Greys.mov -pix_fmt rgb24 -an -vf scale
 
-FATE_QTRLE += fate-qtrle-4bit
+FATE_QTRLE_SCALE += fate-qtrle-4bit
 fate-qtrle-4bit: CMD = framecrc -i 
$(TARGET_SAMPLES)/qtrle/Animation-16Greys.mov -pix_fmt rgb24 -an -vf scale
 
-FATE_QTRLE += fate-qtrle-8bit
+FATE_QTRLE_SCALE += fate-qtrle-8bit
 fate-qtrle-8bit: CMD = framecrc -i 
$(TARGET_SAMPLES)/qtrle/criticalpath-credits.mov -pix_fmt rgb24 -an -vf scale
 
-FATE_QTRLE += fate-qtrle-16bit
+FATE_QTRLE_SCALE += fate-qtrle-16bit
 fate-qtrle-16bit: CMD = framecrc -i $(TARGET_SAMPLES)/qtrle/mr-cork-rle.mov 
-pix_fmt rgb24 -vf scale
 
 FATE_QTRLE += fate-qtrle-24bit
 fate-qtrle-24bit: CMD = framecrc -i $(TARGET_SAMPLES)/qtrle/aletrek-rle.mov
 
-FATE_QTRLE += fate-qtrle-32bit
+FATE_QTRLE_SCALE += fate-qtrle-32bit
 fate-qtrle-32bit: CMD = framecrc -i 
$(TARGET_SAMPLES)/qtrle/ultra_demo_720_480_32bpp_rle.mov -pix_fmt bgra -vf scale
 
-FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, QTRLE) += $(FATE_QTRLE)
-fate-qtrle: $(FATE_QTRLE)
+FATE_QTRLE-$(call FRAMECRC, MOV, QTRLE) += $(FATE_QTRLE)
+FATE_QTRLE-$(call FRAMECRC, MOV, QTRLE, SCALE_FILTER) += $(FATE_QTRLE_SCALE)
+
+FATE_SAMPLES_FFMPEG += $(FATE_QTRLE-yes)
+fate-qtrle: $(FATE_QTRLE-yes)
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 2/2] avcodec/h2645_parse: Check HEVC NAL size

2022-04-29 Thread Michael Niedermayer
Fixes: Assertion failure
Fixes: 
46662/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-4947860854013952

This also results in more frames to be decoded from fate samples

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/h2645_parse.c   |  2 +-
 .../ref/fate/hevc-conformance-NoOutPrior_A_Qualcomm_1  | 10 ++
 tests/ref/fate/hevc-conformance-RAP_B_Bossen_1 |  3 +++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c
index 03780680c6..78ab22b76e 100644
--- a/libavcodec/h2645_parse.c
+++ b/libavcodec/h2645_parse.c
@@ -292,7 +292,7 @@ static int hevc_parse_nal_header(H2645NAL *nal, void 
*logctx)
 {
 GetBitContext *gb = &nal->gb;
 
-if (get_bits1(gb) != 0)
+if (get_bits_left(gb) < 16 || get_bits1(gb) != 0)
 return AVERROR_INVALIDDATA;
 
 nal->type = get_bits(gb, 6);
diff --git a/tests/ref/fate/hevc-conformance-NoOutPrior_A_Qualcomm_1 
b/tests/ref/fate/hevc-conformance-NoOutPrior_A_Qualcomm_1
index 0c930f6556..3283925e38 100644
--- a/tests/ref/fate/hevc-conformance-NoOutPrior_A_Qualcomm_1
+++ b/tests/ref/fate/hevc-conformance-NoOutPrior_A_Qualcomm_1
@@ -25,6 +25,16 @@
 0, 19, 19,1,   599040, 0x4227009b
 0, 20, 20,1,   599040, 0x1bda8be4
 0, 21, 21,1,   599040, 0xd1d5dcb4
+0, 22, 22,1,   599040, 0x58b2edb3
+0, 23, 23,1,   599040, 0xd1f795d8
+0, 24, 24,1,   599040, 0x3331d5e6
+0, 25, 25,1,   599040, 0x5e5ec2c9
+0, 26, 26,1,   599040, 0x3b907bf5
+0, 27, 27,1,   599040, 0xefcbf471
+0, 28, 28,1,   599040, 0x2769a578
+0, 29, 29,1,   599040, 0x812ce986
+0, 30, 30,1,   599040, 0xf07c212c
+0, 31, 31,1,   599040, 0xb5476890
 0, 32, 32,1,   599040, 0x00a0249f
 0, 33, 33,1,   599040, 0x7263f7cf
 0, 34, 34,1,   599040, 0x47054be4
diff --git a/tests/ref/fate/hevc-conformance-RAP_B_Bossen_1 
b/tests/ref/fate/hevc-conformance-RAP_B_Bossen_1
index e661ff245e..776267b59c 100644
--- a/tests/ref/fate/hevc-conformance-RAP_B_Bossen_1
+++ b/tests/ref/fate/hevc-conformance-RAP_B_Bossen_1
@@ -70,6 +70,9 @@
 0, 64, 64,1,   149760, 0x3362678b
 0, 65, 65,1,   149760, 0x6e7fc851
 0, 66, 66,1,   149760, 0x33f96449
+0, 67, 67,1,   149760, 0xd9d05007
+0, 75, 75,1,   149760, 0x477f2cf2
+0, 76, 76,1,   149760, 0xe1f9ccd0
 0, 77, 77,1,   149760, 0xb3ba8cfb
 0, 78, 78,1,   149760, 0x64787995
 0, 79, 79,1,   149760, 0xc10de4c4
-- 
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/2] tools/target_dec_fuzzer: Adjust threshold or CFHD

2022-04-29 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
46504/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-6376835606249472

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

diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c
index 288aa63313..7258c76c84 100644
--- a/tools/target_dec_fuzzer.c
+++ b/tools/target_dec_fuzzer.c
@@ -157,7 +157,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 case AV_CODEC_ID_AGM: maxpixels  /= 1024;  break;
 case AV_CODEC_ID_ARBC:maxpixels  /= 1024;  break;
 case AV_CODEC_ID_BINKVIDEO:   maxpixels  /= 32;break;
-case AV_CODEC_ID_CFHD:maxpixels  /= 128;   break;
+case AV_CODEC_ID_CFHD:maxpixels  /= 4096;  break;
 case AV_CODEC_ID_COOK:maxsamples /= 1<<20; break;
 case AV_CODEC_ID_DFA: maxpixels  /= 1024;  break;
 case AV_CODEC_ID_DIRAC:   maxpixels  /= 8192;  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".


Re: [FFmpeg-devel] [PATCH v2 1/5] avutil/hwcontext_d3d11va: fix the uninitialized texture bindflag

2022-04-29 Thread Hendrik Leppkes
On Fri, Apr 29, 2022 at 12:45 PM Tong Wu
 wrote:
>
> When uploading rawvideos using d3d11va hardware framecontext, the bindflag
> is not initialized and will cause creating texture failure. Now fix it,
> assign it the value of D3D11_BIND_RENDER_TARGET.
>

As with similar fixes of this nature, this implicit behavior to fix
one particular bug does not seem fitting inside the hwcontext itself.
There can be a large list of usages of the hwcontext that all require
different BindFlags, but we can only define one default - why this one
specifically?

So rather:

Where is the context created?
Why is a required flag not set there? That would be better, because
that knows what flags it needs.

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

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


Re: [FFmpeg-devel] [PATCH v2] avcodec/libaomenc: Add unmet target level warning

2022-04-29 Thread Bohan Li
Gentle ping on this :)

On Tue, Apr 19, 2022 at 11:20 AM Bohan Li  wrote:

> When target levels are set, this patch checks whether they are
> satisfied by libaom. If not, a warning is shown. Otherwise the output
> levels are also logged.
>
> This patch applies basically the same approach used for libvpx.
>
> Signed-off-by: Bohan Li 
> ---
>  libavcodec/libaomenc.c | 64 ++
>  1 file changed, 64 insertions(+)
>
> diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
> index 054903e6e2..77be56fa51 100644
> --- a/libavcodec/libaomenc.c
> +++ b/libavcodec/libaomenc.c
> @@ -198,6 +198,12 @@ static const char *const ctlidstr[] = {
>  [AV1E_SET_ENABLE_SMOOTH_INTERINTRA] =
> "AV1E_SET_ENABLE_SMOOTH_INTERINTRA",
>  [AV1E_SET_ENABLE_REF_FRAME_MVS] = "AV1E_SET_ENABLE_REF_FRAME_MVS",
>  #endif
> +#ifdef AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX
> +[AV1E_GET_SEQ_LEVEL_IDX]= "AV1E_GET_SEQ_LEVEL_IDX",
> +#endif
> +#ifdef AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX
> +[AV1E_GET_TARGET_SEQ_LEVEL_IDX] = "AV1E_GET_TARGET_SEQ_LEVEL_IDX",
> +#endif
>  };
>
>  static av_cold void log_encoder_error(AVCodecContext *avctx, const char
> *desc)
> @@ -323,10 +329,68 @@ static av_cold int codecctl_int(AVCodecContext
> *avctx,
>  return 0;
>  }
>
> +#if defined(AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX) && \
> +defined(AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX)
> +static av_cold int codecctl_intp(AVCodecContext *avctx,
> +#ifdef UENUM1BYTE
> + aome_enc_control_id id,
> +#else
> + enum aome_enc_control_id id,
> +#endif
> + int* ptr)
> +{
> +AOMContext *ctx = avctx->priv_data;
> +char buf[80];
> +int width = -30;
> +int res;
> +
> +snprintf(buf, sizeof(buf), "%s:", ctlidstr[id]);
> +av_log(avctx, AV_LOG_DEBUG, "  %*s%d\n", width, buf, *ptr);
> +
> +res = aom_codec_control(&ctx->encoder, id, ptr);
> +if (res != AOM_CODEC_OK) {
> +snprintf(buf, sizeof(buf), "Failed to set %s codec control",
> + ctlidstr[id]);
> +log_encoder_error(avctx, buf);
> +return AVERROR(EINVAL);
> +}
> +
> +return 0;
> +}
> +#endif
> +
>  static av_cold int aom_free(AVCodecContext *avctx)
>  {
>  AOMContext *ctx = avctx->priv_data;
>
> +#if defined(AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX) && \
> +defined(AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX)
> +if (!(avctx->flags & AV_CODEC_FLAG_PASS1)) {
> +int levels[32] = { 0 };
> +int target_levels[32] = { 0 };
> +
> +if (!codecctl_intp(avctx, AV1E_GET_SEQ_LEVEL_IDX, levels) &&
> +!codecctl_intp(avctx, AV1E_GET_TARGET_SEQ_LEVEL_IDX,
> +   target_levels)) {
> +for (int i = 0; i < 32; i++) {
> +if (levels[i] > target_levels[i]) {
> +// Warn when the target level was not met
> +av_log(avctx, AV_LOG_WARNING,
> +   "Could not encode to target level %d.%d for "
> +   "operating point %d. The output level is
> %d.%d.\n",
> +   2 + (target_levels[i] >> 2), target_levels[i]
> & 3,
> +   i, 2 + (levels[i] >> 2), levels[i] & 3);
> +} else if (target_levels[i] < 31) {
> +// Log the encoded level if a target level was given
> +av_log(avctx, AV_LOG_INFO,
> +   "Output level for operating point %d is
> %d.%d.\n",
> +   i, 2 + (levels[i] >> 2), levels[i] & 3);
> +}
> +}
> +}
> +}
> +#endif
> +
>  aom_codec_destroy(&ctx->encoder);
>  av_freep(&ctx->twopass_stats.buf);
>  av_freep(&avctx->stats_out);
> --
> 2.36.0.rc0.470.gd361397f0d-goog
>
>
___
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] avfilter/alimiter: Add an option "comp_delay" that removes the delay introduced by lookahead buffer

2022-04-29 Thread Wang Cao
On Fri, Apr 15, 2022 at 11:50 AM Wang Cao  wrote:

> 1. The option also flushes all the valid audio samples in the lookahead
>buffer so the audio integrity is preserved. Previously the the output
>audio will lose the amount of audio samples equal to the size of
>lookahead buffer
> 2. Add a FATE test to verify that when the filter is working as
>passthrough filter, all audio samples are properly handled from the
>input to the output.
>
> Signed-off-by: Wang Cao 
> ---
>  doc/filters.texi|  5 +++
>  libavfilter/af_alimiter.c   | 74 +
>  tests/fate/filter-audio.mak | 12 ++
>  3 files changed, 91 insertions(+)
>
> diff --git a/doc/filters.texi b/doc/filters.texi
> index a161754233..2af0953c89 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -1978,6 +1978,11 @@ in release time while 1 produces higher release
> times.
>  @item level
>  Auto level output signal. Default is enabled.
>  This normalizes audio back to 0dB if enabled.
> +
> +@item comp_delay
> +Compensate the delay introduced by using the lookahead buffer set with
> attack
> +parameter. Also flush the valid audio data in the lookahead buffer when
> the
> +stream hits EOF.
>  @end table
>
>  Depending on picked setting it is recommended to upsample input 2x or 4x
> times
> diff --git a/libavfilter/af_alimiter.c b/libavfilter/af_alimiter.c
> index 133f98f165..d10a90859b 100644
> --- a/libavfilter/af_alimiter.c
> +++ b/libavfilter/af_alimiter.c
> @@ -55,6 +55,12 @@ typedef struct AudioLimiterContext {
>  int *nextpos;
>  double *nextdelta;
>
> +int lookahead_delay_samples;
> +int lookahead_flush_samples;
> +int64_t output_pts;
> +int64_t next_output_pts;
> +int comp_delay;
> +
>  double delta;
>  int nextiter;
>  int nextlen;
> @@ -73,6 +79,7 @@ static const AVOption alimiter_options[] = {
>  { "asc",   "enable asc",   OFFSET(auto_release),
> AV_OPT_TYPE_BOOL,   {.i64=0},  0,1, AF },
>  { "asc_level", "set asc level",OFFSET(asc_coeff),
> AV_OPT_TYPE_DOUBLE, {.dbl=0.5},0,1, AF },
>  { "level", "auto level",   OFFSET(auto_level),
>  AV_OPT_TYPE_BOOL,   {.i64=1},  0,1, AF },
> +{ "comp_delay","compensate delay", OFFSET(comp_delay),
>  AV_OPT_TYPE_BOOL,   {.i64=0},  0,1, AF },
>  { NULL }
>  };
>
> @@ -129,6 +136,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame
> *in)
>  AVFrame *out;
>  double *buf;
>  int n, c, i;
> +int num_output_samples = in->nb_samples;
> +int trim_offset;
>
>  if (av_frame_is_writable(in)) {
>  out = in;
> @@ -271,10 +280,71 @@ static int filter_frame(AVFilterLink *inlink,
> AVFrame *in)
>
>  if (in != out)
>  av_frame_free(&in);
> +
> +if (!s->comp_delay) {
> +return ff_filter_frame(outlink, out);
> +}
> +
> +if (s->output_pts == AV_NOPTS_VALUE) {
> +s->output_pts = in->pts;
> +}
> +
> +if (s->lookahead_delay_samples > 0) {
> +// The current output frame is completely silence
> +if (s->lookahead_delay_samples >= in->nb_samples) {
> +s->lookahead_delay_samples -= in->nb_samples;
> +return 0;
> +}
> +
> +// Trim the silence part
> +trim_offset = av_samples_get_buffer_size(
> +NULL, inlink->ch_layout.nb_channels,
> s->lookahead_delay_samples,
> +(enum AVSampleFormat)out->format, 1);
> +out->data[0] += trim_offset;
> +out->nb_samples = in->nb_samples - s->lookahead_delay_samples;
> +s->lookahead_delay_samples = 0;
> +num_output_samples = out->nb_samples;
> +}
> +
> +if (s->lookahead_delay_samples < 0) {
> +return AVERROR_BUG;
> +}
> +
> +out->pts = s->output_pts;
> +s->next_output_pts = s->output_pts + num_output_samples;
> +s->output_pts = s->next_output_pts;
>
>  return ff_filter_frame(outlink, out);
>  }
>
> +static int request_frame(AVFilterLink* outlink)
> +{
> +AVFilterContext *ctx = outlink->src;
> +AudioLimiterContext *s = (AudioLimiterContext*)ctx->priv;
> +int ret;
> +AVFilterLink *inlink;
> +AVFrame *silence_frame;
> +
> +ret = ff_request_frame(ctx->inputs[0]);
> +
> +if (ret != AVERROR_EOF || s->lookahead_flush_samples == 0 ||
> !s->comp_delay) {
> +  // Not necessarily an error, just not EOF.
> +  return ret;
> +}
> +
> +// We reach here when input filters have finished producing data
> (i.e. EOF),
> +// but because of the attack param, s->buffer still has meaningful
> +// audio content that needs flushing.
> +inlink = ctx->inputs[0];
> +// Pushes silence frame to flush valid audio in the s->buffer
> +silence_frame = ff_get_audio_buffer(inlink,
> s->lookahead_flush_samples);
> +ret = filter_frame(inlink, silence_frame);
> +if (ret < 0) {
> +  return ret;
> +}
> +return AVERROR_EOF;
> +}
> +
>  static int con

[FFmpeg-devel] [PATCH 19/19] fate/pixlet: Fix test requirements

2022-04-29 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 tests/fate/pixlet.mak | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/fate/pixlet.mak b/tests/fate/pixlet.mak
index 7c4604cc08..524a8797c0 100644
--- a/tests/fate/pixlet.mak
+++ b/tests/fate/pixlet.mak
@@ -1,5 +1,5 @@
-FATE_PIXLET += fate-pixlet-rgb
+FATE_PIXLET-$(call FRAMECRC, MOV, PIXLET, SCALE_FILTER) += fate-pixlet-rgb
 fate-pixlet-rgb: CMD = framecrc -i $(TARGET_SAMPLES)/pixlet/pixlet_rgb.mov -an 
-pix_fmt yuv420p16le -vf scale
 
-FATE_SAMPLES_AVCONV-$(call DEMDEC, MOV, PIXLET) += $(FATE_PIXLET)
-fate-pixlet: $(FATE_PIXLET)
+FATE_SAMPLES_FFMPEG += $(FATE_PIXLET-yes)
+fate-pixlet: $(FATE_PIXLET-yes)
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 18/19] fate/mpeg4: Fix test requirements

2022-04-29 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 tests/fate/mpeg4.mak | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tests/fate/mpeg4.mak b/tests/fate/mpeg4.mak
index 05c26b9be5..4cec21c547 100644
--- a/tests/fate/mpeg4.mak
+++ b/tests/fate/mpeg4.mak
@@ -3,21 +3,23 @@ MPEG4_RESOLUTION_CHANGE = down-down down-up up-down up-up
 
 fate-mpeg4-resolution-change-%: CMD = framemd5 -flags +bitexact -idct simple 
-i $(TARGET_SAMPLES)/mpeg4/resize_$(@:fate-mpeg4-resolution-change-%=%).h263 
-sws_flags +bitexact
 
-FATE_MPEG4-$(call DEMDEC, H263, H263) := $(addprefix 
fate-mpeg4-resolution-change-, $(MPEG4_RESOLUTION_CHANGE))
+FATE_MPEG4-$(call FRAMEMD5, M4V, MPEG4, SCALE_FILTER) := $(addprefix 
fate-mpeg4-resolution-change-, $(MPEG4_RESOLUTION_CHANGE))
 
 fate-mpeg4-bsf-unpack-bframes: CMD = md5 -i 
$(TARGET_SAMPLES)/mpeg4/packed_bframes.avi -flags +bitexact -fflags +bitexact 
-c:v copy -bsf mpeg4_unpack_bframes -f avi
-FATE_MPEG4-$(call ALLYES, AVI_DEMUXER MPEG4_UNPACK_BFRAMES_BSF AVI_MUXER) += 
fate-mpeg4-bsf-unpack-bframes
+FATE_MPEG4-$(call DEMMUX, AVI, AVI, MPEG4_UNPACK_BFRAMES_BSF) += 
fate-mpeg4-bsf-unpack-bframes
 
 fate-mpeg4-packed: CMD = framecrc -flags +bitexact -idct simple -i 
$(TARGET_SAMPLES)/mpeg4/packed_bframes.avi -flags +bitexact -fflags +bitexact 
-vsync cfr
-FATE_MPEG4-$(call ALLYES, AVI_DEMUXER MPEG4_DECODER) += fate-mpeg4-packed
+FATE_MPEG4-$(call FRAMECRC, AVI, MPEG4) += fate-mpeg4-packed
 
 FATE_MPEG4-$(call ALLYES, FILE_PROTOCOL M4V_DEMUXER MPEG4_DECODER SCALE_FILTER 
\
   RAWVIDEO_ENCODER FRAMECRC_MUXER PIPE_PROTOCOL) \
   += fate-mpeg4-simple-studio-profile
 fate-mpeg4-simple-studio-profile: CMD = framecrc -bitexact -idct simple -i 
$(TARGET_SAMPLES)/mpeg4/mpeg4_sstp_dpcm.m4v -sws_flags +accurate_rnd+bitexact 
-pix_fmt yuv422p10le -vf scale
 
-FATE_MPEG4-$(call DEMDEC, M4V, MPEG4) += fate-m4v  fate-m4v-cfr
+FATE_MPEG4-$(call FRAMECRC, M4V, MPEG4) += fate-m4v
 fate-m4v: CMD = framecrc -flags +bitexact -idct simple -i 
$(TARGET_SAMPLES)/mpeg4/demo.m4v
+
+FATE_MPEG4-$(call FRAMECRC, M4V, MPEG4, FPS_FILTER) += fate-m4v-cfr
 fate-m4v-cfr: CMD = framecrc -flags +bitexact -idct simple -i 
$(TARGET_SAMPLES)/mpeg4/demo.m4v -vf fps=5
 
 FATE_SAMPLES_AVCONV += $(FATE_MPEG4-yes)
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 17/19] fate/microsoft: Fix test requirements

2022-04-29 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 tests/fate/microsoft.mak | 68 +++-
 1 file changed, 32 insertions(+), 36 deletions(-)

diff --git a/tests/fate/microsoft.mak b/tests/fate/microsoft.mak
index 639757880c..ee1a062425 100644
--- a/tests/fate/microsoft.mak
+++ b/tests/fate/microsoft.mak
@@ -1,7 +1,7 @@
-FATE_MICROSOFT-$(call DEMDEC, AVI, MSMPEG4V1) += fate-msmpeg4v1
+FATE_MICROSOFT-$(call FRAMECRC, AVI, MSMPEG4V1) += fate-msmpeg4v1
 fate-msmpeg4v1: CMD = framecrc -flags +bitexact -idct simple -i 
$(TARGET_SAMPLES)/msmpeg4v1/mpg4.avi -an
 
-FATE_SAMPLES_AVCONV-$(call DEMDEC, ASF, MSS1) += fate-mss1-pal
+FATE_MICROSOFT-$(call FRAMECRC, ASF, MSS1) += fate-mss1-pal
 fate-mss1-pal: CMD = framecrc -i $(TARGET_SAMPLES)/mss1/screen_codec.wmv -an
 
 FATE_MSS2 += fate-mss2-pal
@@ -10,80 +10,76 @@ fate-mss2-pal: CMD = framecrc -i 
$(TARGET_SAMPLES)/mss2/rlepal.wmv
 FATE_MSS2 += fate-mss2-pals
 fate-mss2-pals: CMD = framecrc -i $(TARGET_SAMPLES)/mss2/rlepals.wmv
 
-FATE_MSS2 += fate-mss2-rgb555
-fate-mss2-rgb555: CMD = framecrc -i $(TARGET_SAMPLES)/mss2/rle555.wmv -pix_fmt 
rgb555le -vf scale
-
-FATE_MSS2 += fate-mss2-rgb555s
+FATE_MSS2-$(call FRAMECRC, ASF, MSS2, SCALE_FILTER) += fate-mss2-rgb555 
fate-mss2-rgb555s
+fate-mss2-rgb555:  CMD = framecrc -i $(TARGET_SAMPLES)/mss2/rle555.wmv  
-pix_fmt rgb555le -vf scale
 fate-mss2-rgb555s: CMD = framecrc -i $(TARGET_SAMPLES)/mss2/rle555s.wmv 
-pix_fmt rgb555le -vf scale
 
 FATE_MSS2 += fate-mss2-wmv
 fate-mss2-wmv: CMD = framecrc -i $(TARGET_SAMPLES)/mss2/msscreencodec.wmv -an 
-frames 100
 
-FATE_SAMPLES_AVCONV-$(call DEMDEC, ASF, MSS2) += $(FATE_MSS2)
-fate-mss2: $(FATE_MSS2)
+FATE_MSS2-$(call FRAMECRC, ASF, MSS2) += $(FATE_MSS2)
 
-FATE_MTS2 += fate-mts2-xesc
-fate-mts2-xesc: CMD = framecrc -i $(TARGET_SAMPLES)/mts2/sample.xesc -pix_fmt 
yuv444p
+FATE_MICROSOFT += $(FATE_MSS2-yes)
+fate-mss2: $(FATE_MSS2-yes)
 
-FATE_SAMPLES_AVCONV-$(call DEMDEC, ASF, MTS2) += $(FATE_MTS2)
-fate-mts2: $(FATE_MTS2)
+FATE_MTS2-$(call FRAMECRC, ASF, MTS2) += fate-mts2-xesc
+fate-mts2-xesc: CMD = framecrc -i $(TARGET_SAMPLES)/mts2/sample.xesc -pix_fmt 
yuv444p
 
-FATE_MSVIDEO1 += fate-msvideo1-8bit
-fate-msvideo1-8bit: CMD = framecrc -i $(TARGET_SAMPLES)/cram/skating.avi -t 1 
-pix_fmt rgb24 -vf scale
+FATE_MICROSOFT += $(FATE_MTS2-yes)
+fate-mts2: $(FATE_MTS2-yes)
 
-FATE_MSVIDEO1 += fate-msvideo1-16bit
+FATE_MSVIDEO1-$(call FRAMECRC, AVI, MSVIDEO1, SCALE_FILTER) += 
fate-msvideo1-8bit fate-msvideo1-16bit
+fate-msvideo1-8bit:  CMD = framecrc -i $(TARGET_SAMPLES)/cram/skating.avi -t 1 
-pix_fmt rgb24 -vf scale
 fate-msvideo1-16bit: CMD = framecrc -i $(TARGET_SAMPLES)/cram/clock-cram16.avi 
-pix_fmt rgb24 -vf scale
 
-FATE_MICROSOFT-$(call DEMDEC, AVI, MSVIDEO1) += $(FATE_MSVIDEO1)
-fate-msvideo1: $(FATE_MSVIDEO1)
+FATE_MICROSOFT += $(FATE_MSVIDEO1-yes)
+fate-msvideo1: $(FATE_MSVIDEO1-yes)
 
-FATE_SAMPLES_AVCONV-$(call DEMDEC, ASF, MTS2) += fate-mts2
+FATE_MICROSOFT-$(call FRAMECRC, ASF, MTS2) += fate-mts2
 fate-mts2: CMD = framecrc -i $(TARGET_SAMPLES)/mts2/ScreenCapture.xesc
 
-FATE_WMV3_DRM += fate-wmv3-drm-dec
+FATE_WMV3_DRM-$(call FRAMECRC, ASF, WMV3) += fate-wmv3-drm-dec 
fate-wmv3-drm-nodec
 # discard last packet to avoid fails due to overread of VC-1 decoder
-fate-wmv3-drm-dec: CMD = framecrc -cryptokey 
137381538c84c068111902a59c5cf6c340247c39 -i $(TARGET_SAMPLES)/wmv8/wmv_drm.wmv 
-an -frames:v 129
-
-FATE_WMV3_DRM += fate-wmv3-drm-nodec
+fate-wmv3-drm-dec:   CMD = framecrc -cryptokey 
137381538c84c068111902a59c5cf6c340247c39 -i $(TARGET_SAMPLES)/wmv8/wmv_drm.wmv 
-an -frames:v 129
 fate-wmv3-drm-nodec: CMD = framecrc -cryptokey 
137381538c84c068111902a59c5cf6c340247c39 -i $(TARGET_SAMPLES)/wmv8/wmv_drm.wmv 
-c:a copy -c:v copy
 
-FATE_SAMPLES_AVCONV-$(call DEMDEC, ASF, WMV3) += $(FATE_WMV3_DRM)
-fate-wmv3-drm: $(FATE_WMV3_DRM)
+FATE_MICROSOFT += $(FATE_WMV3_DRM-yes)
+fate-wmv3-drm: $(FATE_WMV3_DRM-yes)
 
 FATE_MICROSOFT-$(call DEMDEC, ASF, WMV2) += fate-wmv8-x8intra
 fate-wmv8-x8intra: CMD = framecrc -flags +bitexact -i 
$(TARGET_SAMPLES)/wmv8/wmv8_x8intra.wmv -an
 
-FATE_VC1-$(CONFIG_VC1_DEMUXER) += fate-vc1_sa00040
+FATE_VC1 += fate-vc1_sa00040
 fate-vc1_sa00040: CMD = framecrc -i $(TARGET_SAMPLES)/vc1/SA00040.vc1
 
-FATE_VC1-$(CONFIG_VC1_DEMUXER) += fate-vc1_sa00050
+FATE_VC1 += fate-vc1_sa00050
 fate-vc1_sa00050: CMD = framecrc -i $(TARGET_SAMPLES)/vc1/SA00050.vc1
 
-FATE_VC1-$(CONFIG_VC1_DEMUXER) += fate-vc1_sa10091
+FATE_VC1 += fate-vc1_sa10091
 fate-vc1_sa10091: CMD = framecrc -i $(TARGET_SAMPLES)/vc1/SA10091.vc1
 
-FATE_VC1-$(CONFIG_VC1_DEMUXER) += fate-vc1_sa10143
+FATE_VC1 += fate-vc1_sa10143
 fate-vc1_sa10143: CMD = framecrc -i $(TARGET_SAMPLES)/vc1/SA10143.vc1
 
-FATE_VC1-$(CONFIG_VC1_DEMUXER) += fate-vc1_sa20021
+FATE_VC1 += fate-vc1_sa20021
 fate-vc1_sa20021: CMD = framecrc -i $(TARGET_SAMPLES)/vc1/SA20021.vc1
 
-FATE_VC1-$(CONFIG_VC1_DEMUXER) += fate-vc1_ilaced_twomv
+FATE_VC1 += fate-vc1_ilaced_twomv
 fate-vc1_ilaced_twomv: CM

[FFmpeg-devel] [PATCH 16/19] fate/lossless-video: Fix test requirements

2022-04-29 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 tests/fate/lossless-video.mak | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/tests/fate/lossless-video.mak b/tests/fate/lossless-video.mak
index a81c6e9ab0..05a8ba29e1 100644
--- a/tests/fate/lossless-video.mak
+++ b/tests/fate/lossless-video.mak
@@ -1,7 +1,7 @@
 FATE_LAGARITH += fate-lagarith-rgb24
 fate-lagarith-rgb24: CMD = framecrc -i $(TARGET_SAMPLES)/lagarith/lag-rgb24.avi
 
-FATE_LAGARITH += fate-lagarith-rgb32
+FATE_LAGARITH-$(call FRAMECRC, AVI, LAGARITH, SCALE_FILTER) += 
fate-lagarith-rgb32
 fate-lagarith-rgb32: CMD = framecrc -i 
$(TARGET_SAMPLES)/lagarith/lag-rgb32.avi -pix_fmt bgra -vf scale
 
 FATE_LAGARITH += fate-lagarith-yuy2
@@ -19,31 +19,31 @@ fate-lagarith-ticket4119-cfr : CMD = framecrc -i 
$(TARGET_SAMPLES)/lagarith/laga
 fate-lagarith-ticket4119-vfr : CMD = framecrc -i 
$(TARGET_SAMPLES)/lagarith/lagarith-1.3.27-black-frames-and-off-by-ones.avi 
-vsync vfr
 fate-lagarith-ticket4119-pass: CMD = framecrc -i 
$(TARGET_SAMPLES)/lagarith/lagarith-1.3.27-black-frames-and-off-by-ones.avi 
-vsync passthrough
 
-FATE_LOSSLESS_VIDEO-$(call DEMDEC, AVI, LAGARITH) += $(FATE_LAGARITH)
-fate-lagarith: $(FATE_LAGARITH)
+FATE_LAGARITH-$(call FRAMECRC, AVI, LAGARITH) += $(FATE_LAGARITH)
 
-FATE_LOCO += fate-loco-rgb
-fate-loco-rgb: CMD = framecrc -i $(TARGET_SAMPLES)/loco/pig-loco-rgb.avi
+FATE_LOSSLESS_VIDEO += $(FATE_LAGARITH-yes)
+fate-lagarith: $(FATE_LAGARITH-yes)
 
-FATE_LOCO += fate-loco-yuy2
+FATE_LOCO-$(call FRAMECRC, AVI, LOCO) += fate-loco-rgb fate-loco-yuy2
+fate-loco-rgb:  CMD = framecrc -i $(TARGET_SAMPLES)/loco/pig-loco-rgb.avi
 fate-loco-yuy2: CMD = framecrc -i $(TARGET_SAMPLES)/loco/pig-loco-0.avi
 
-FATE_LOSSLESS_VIDEO-$(call DEMDEC, AVI, LOCO) += $(FATE_LOCO)
-fate-loco: $(FATE_LOCO)
+FATE_LOSSLESS_VIDEO += $(FATE_LOCO-yes)
+fate-loco: $(FATE_LOCO-yes)
 
-FATE_LOSSLESS_VIDEO-$(call DEMDEC, AVI, MSRLE) += fate-msrle-8bit
+FATE_LOSSLESS_VIDEO-$(call FRAMECRC, AVI, MSRLE, SCALE_FILTER) += 
fate-msrle-8bit
 fate-msrle-8bit: CMD = framecrc -i $(TARGET_SAMPLES)/msrle/Search-RLE.avi 
-pix_fmt rgb24 -vf scale
 
-FATE_LOSSLESS_VIDEO-$(call DEMDEC, AVI, MSZH) += fate-mszh
+FATE_LOSSLESS_VIDEO-$(call FRAMECRC, AVI, MSZH) += fate-mszh
 fate-mszh: CMD = framecrc -i $(TARGET_SAMPLES)/lcl/mszh-1frame.avi
 
-FATE_LOSSLESS_VIDEO-$(call DEMDEC, AVI, VBLE) += fate-vble
+FATE_LOSSLESS_VIDEO-$(call FRAMECRC, AVI, VBLE) += fate-vble
 fate-vble: CMD = framecrc -i $(TARGET_SAMPLES)/vble/flowers-partial-2MB.avi
 
-FATE_LOSSLESS_VIDEO-$(call DEMDEC, AVI, ZEROCODEC) += fate-zerocodec
+FATE_LOSSLESS_VIDEO-$(call FRAMECRC, AVI, ZEROCODEC) += fate-zerocodec
 fate-zerocodec: CMD = framecrc -i $(TARGET_SAMPLES)/zerocodec/sample-zeco.avi
 
-FATE_LOSSLESS_VIDEO-$(call DEMDEC, AVI, ZLIB) += fate-zlib
+FATE_LOSSLESS_VIDEO-$(call FRAMECRC, AVI, ZLIB) += fate-zlib
 fate-zlib: CMD = framecrc -i $(TARGET_SAMPLES)/lcl/zlib-1frame.avi
 
 FATE_LOSSLESS_VIDEO += $(FATE_LOSSLESS_VIDEO-yes)
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 15/19] fate/hevc: Fix test requirements

2022-04-29 Thread Andreas Rheinhardt
Also replace define/foreach with pattern-specific variable values.

Signed-off-by: Andreas Rheinhardt 
---
 tests/fate/hevc.mak | 102 +++-
 1 file changed, 34 insertions(+), 68 deletions(-)

diff --git a/tests/fate/hevc.mak b/tests/fate/hevc.mak
index 3adee59e54..2f16e3a29f 100644
--- a/tests/fate/hevc.mak
+++ b/tests/fate/hevc.mak
@@ -1,4 +1,4 @@
-HEVC_SAMPLES =  \
+HEVC_SAMPLES_8BIT = \
 AMP_A_Samsung_4 \
 AMP_A_Samsung_6 \
 AMP_B_Samsung_4 \
@@ -158,23 +158,27 @@ HEVC_SAMPLES_422_10BIT =\
 ADJUST_IPRED_ANGLE_A_RExt_Mitsubishi_1 \
 IPCM_A_RExt_NEC \
 
-HEVC_SAMPLES_422_10BIN =\
-Main_422_10_A_RExt_Sony_1   \
-
 HEVC_SAMPLES_422_10BIN_LARGE =  \
 Main_422_10_B_RExt_Sony_1   \
 
+HEVC_SAMPLES_422_10BIN =\
+Main_422_10_A_RExt_Sony_1   \
+$(if $(CONFIG_LARGE_TESTS), $(HEVC_SAMPLES_422_10BIN_LARGE))
+
 HEVC_SAMPLES_444_8BIT = \
 QMATRIX_A_RExt_Sony_1   \
 
+HEVC_SAMPLES_444_12BIT_LARGE =  \
+SAO_A_RExt_MediaTek_1   \
+
 HEVC_SAMPLES_444_12BIT =\
 IPCM_B_RExt_NEC \
 PERSIST_RPARAM_A_RExt_Sony_1\
 PERSIST_RPARAM_A_RExt_Sony_3\
+$(if $(CONFIG_LARGE_TESTS), $(HEVC_SAMPLES_444_12BIT_LARGE))
 
-HEVC_SAMPLES_444_12BIT_LARGE =  \
-SAO_A_RExt_MediaTek_1   \
-
+FATE_HEVC_VARS := 8BIT 10BIT 422_10BIT 422_10BIN 444_8BIT 444_12BIT
+$(foreach VAR,$(FATE_HEVC_VARS), $(eval HEVC_TESTS_$(VAR) := $(addprefix 
fate-hevc-conformance-, $(HEVC_SAMPLES_$(VAR)
 
 # equivalent bitstreams
 # AMP_D_Hisilicon_3 -- AMP_D_Hisilicon
@@ -190,103 +194,65 @@ HEVC_SAMPLES_444_12BIT_LARGE =  \
 # PERSIST_RPARAM_A_RExt_Sony_1 (rext)
 
 
-define FATE_HEVC_TEST
-FATE_HEVC += fate-hevc-conformance-$(1)
-fate-hevc-conformance-$(1): CMD = framecrc -flags unaligned -i 
$(TARGET_SAMPLES)/hevc-conformance/$(1).bit -pix_fmt yuv420p
-endef
-
-define FATE_HEVC_TEST_10BIT
-FATE_HEVC += fate-hevc-conformance-$(1)
-fate-hevc-conformance-$(1): CMD = framecrc -flags unaligned -i 
$(TARGET_SAMPLES)/hevc-conformance/$(1).bit -pix_fmt yuv420p10le -vf scale
-endef
-
-define FATE_HEVC_TEST_422_10BIT
-FATE_HEVC += fate-hevc-conformance-$(1)
-fate-hevc-conformance-$(1): CMD = framecrc -flags unaligned -i 
$(TARGET_SAMPLES)/hevc-conformance/$(1).bit -pix_fmt yuv422p10le -vf scale
-endef
-
-define FATE_HEVC_TEST_422_10BIN
-FATE_HEVC += fate-hevc-conformance-$(1)
-fate-hevc-conformance-$(1): CMD = framecrc -flags unaligned -i 
$(TARGET_SAMPLES)/hevc-conformance/$(1).bin -pix_fmt yuv422p10le -vf scale
-endef
-
-define FATE_HEVC_TEST_422_10BIN_LARGE
-FATE_HEVC_LARGE += fate-hevc-conformance-$(1)
-fate-hevc-conformance-$(1): CMD = framecrc -flags unaligned -i 
$(TARGET_SAMPLES)/hevc-conformance/$(1).bin -pix_fmt yuv422p10le -vf scale
-endef
+$(HEVC_TESTS_8BIT): SCALE_OPTS := -pix_fmt yuv420p
+$(HEVC_TESTS_444_8BIT): SCALE_OPTS := -pix_fmt yuv444p
+$(HEVC_TESTS_10BIT): SCALE_OPTS := -pix_fmt yuv420p10le -vf scale
+$(HEVC_TESTS_422_10BIT) $(HEVC_TESTS_422_10BIN): SCALE_OPTS := -pix_fmt 
yuv422p10le -vf scale
+$(HEVC_TESTS_444_12BIT): SCALE_OPTS := -pix_fmt yuv444p12le -vf scale
+fate-hevc-conformance-%: CMD = framecrc -flags unaligned -i 
$(TARGET_SAMPLES)/hevc-conformance/$(subst fate-hevc-conformance-,,$(@)).bit 
$(SCALE_OPTS)
+$(HEVC_TESTS_422_10BIN): CMD = framecrc -flags unaligned -i 
$(TARGET_SAMPLES)/hevc-conformance/$(subst fate-hevc-conformance-,,$(@)).bin 
$(SCALE_OPTS)
 
-define FATE_HEVC_TEST_444_8BIT
-FATE_HEVC += fate-hevc-conformance-$(1)
-fate-hevc-conformance-$(1): CMD = framecrc -flags unaligned -i 
$(TARGET_SAMPLES)/hevc-conformance/$(1).bit -pix_fmt yuv444p
-endef
-
-define FATE_HEVC_TEST_444_12BIT
-FATE_HEVC += fate-hevc-conformance-$(1)
-fate-hevc-conformance-$(1): CMD = framecrc -flags unaligned -i 
$(TARGET_SAMPLES)/hevc-conformance/$(1).bit -pix_fmt yuv444p12le -vf scale
-endef
-
-define FATE_HEVC_TEST_444_12BIT_LARGE
-FATE_HEVC_LARGE += fate-hevc-conformance-$(1)
-fate-hevc-conformance-$(1): CMD = framecrc -flags unaligned -i 
$(TARGET_SAMPLES)/hevc-conformance/$(1).bit -pix_fmt yuv444p12le -vf scale
-endef
-
-$(foreach N,$(HEVC_SAMPLES),$(eval $(call FATE_HEVC_TEST,$(N
-$(foreach N,$(HEVC_SAMPLES_10BIT),$(eval $(call FATE_HEVC_TEST_10BIT,$(N
-$(foreach N,$(HEVC_SAMPLES_422_10BIT),$(eval $(call 
FATE_HEVC_TEST_422_10BIT,$(N
-$(foreach N,$(HEVC_SAMPLES_422_10BIN),$(eval $(call 
FATE_HEVC_TEST_422_10BIN,$(N
-$(foreach N,$(HEVC_SAMPLES_422_10BIN_LARGE),$(eval $(call 
FATE_HEVC_TEST_422_10BIN_LARGE,$(N
-$(foreach N,$(HEVC_SAMPLES_444_8BIT),$(eval $(call 
FATE_HEVC_TEST_444_8BIT,$(N
-$(foreach N,$(HEVC_SAMPLES_444_12BIT),$(eval $(call 
FATE_HEVC_TEST_444_12BIT,$(N
-$(foreach N,$(HEVC_SAMPLES_444_12BIT_LARGE),$(eval $(call 
FATE_HEVC_TEST_444_12BIT_LARGE,$(N
+FATE_HEVC-$(call FRAMECRC, HEVC, HEVC, HEVC_PARSER) += $(HEVC_TESTS_8BIT) 
$(HEVC_TESTS_444_8BIT)
+FATE_HEVC-$(call FRAMECRC

[FFmpeg-devel] [PATCH 14/19] tests/Makefile: Remove unset FATE_TESTS

2022-04-29 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 tests/Makefile | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/Makefile b/tests/Makefile
index ea5e939cf5..ca228ae897 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -274,10 +274,10 @@ fate:: $(FATE)
 fate-hw: $(FATE_HW-yes)
 FATE += $(FATE_HW-yes)
 
-$(FATE) $(FATE_TESTS-no): export PROGSUF = $(PROGSSUF)
-$(FATE) $(FATE_TESTS-no): export EXECSUF = $(EXESUF)
-$(FATE) $(FATE_TESTS-no): export HOSTEXECSUF = $(HOSTEXESUF)
-$(FATE) $(FATE_TESTS-no): $(FATE_UTILS:%=tests/%$(HOSTEXESUF)) | 
$(FATE_OUTDIRS)
+$(FATE): export PROGSUF = $(PROGSSUF)
+$(FATE): export EXECSUF = $(EXESUF)
+$(FATE): export HOSTEXECSUF = $(HOSTEXESUF)
+$(FATE): $(FATE_UTILS:%=tests/%$(HOSTEXESUF)) | $(FATE_OUTDIRS)
@echo "TEST$(@:fate-%=%)"
$(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(TARGET_SAMPLES)" 
"$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)' 
'$(THREADS)' '$(THREAD_TYPE)' '$(CPUFLAGS)' '$(CMP_SHIFT)' '$(CMP_TARGET)' 
'$(SIZE_TOLERANCE)' '$(CMP_UNIT)' '$(GEN)' '$(HWACCEL)' '$(REPORT)' '$(KEEP)'
 
-- 
2.32.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 v11 1/6] libavutil/wchar_filename.h: Add whcartoutf8, wchartoansi and utf8toansi

2022-04-29 Thread nil-admirari
> As soon as Microsoft actually makes UTF-8
> the default code page going forward, that issue will poof
> out of existence, as if by magic. It already does if you
> toggle it on in the system settings.

True. System-wide UTF-8 can cause problems with legacy software, but starting
with Windows 11 such software can specify a non-UTF8 activeCodePage for itself:
https://docs.microsoft.com/en-us/windows/win32/sbscs/application-manifests#activeCodePage.

"Set active code page to UTF-8 on Windows" is a separate patch, independent 
from all others:
https://ffmpeg.org/pipermail/ffmpeg-devel/2022-April/295572.html.
If it's deemed to be too problematic, the rest of the patchset can simply be 
merged without 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 v11 1/6] libavutil/wchar_filename.h: Add whcartoutf8, wchartoansi and utf8toansi

2022-04-29 Thread nil-admirari
> This patchset does not provide reliable behavior.

Actually it does.

> This way, you won't be able to use long paths with ffmpeg within the next 5-8 
> years at minimum,

Long paths can be used since August, 2 2016. Some ~6 years have already passed.

> because even in the latest versions of Windows 11, this is not enabled by 
> default in the operating system.

FFmpeg isn't bundled by default either. And not everyone has rights to download 
and run
arbitrary software on their machines.

> What is the value of adding a capability where it will be a lottery
> game whether it will work or not on each system?

Windows 10 > 1607 + registry key = it works. Otherwise it doesn't. There is no 
lottery.



___
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 v11 1/6] libavutil/wchar_filename.h: Add whcartoutf8, wchartoansi and utf8toansi

2022-04-29 Thread nil-admirari
> What I'm saying is that prepending the long path prefix is the better way 
> for supporting long paths and I mentioned our experience with it only to 
> confirm that it's working well.

Maybe you'll even provide a patchset for such a wonderful approach?

> The .NET/corefx runtime uses the prefix method internally, rclone is using it,
> the Java runtime is using it, just to name a few examples.

They all have uniform IO, FFmpeg does not. av_fopen_utf8 vs plain fopen,
and forward slash conversion have already been mentioned in this very 
conversation,
but probably you haven't followed.



___
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 v11 1/6] libavutil/wchar_filename.h: Add whcartoutf8, wchartoansi and utf8toansi

2022-04-29 Thread nil-admirari
> A code change for which no use case exists and does not provide
> any benefit is not relevant. That's my point.

You've deleted me saying

>> You're talking as if MAX_PATH limited library loader is self-evidently
>> superior, and it is the loader that has no such limitation that has to 
>> justify
>> its existence. As far as I'm concerned it just the other way around.

and now claim that code change is irrelevant.

> Imagine, you are creating a software (no matter whether you're big or small,
> open or closed source, targeting business or home users, using a custom or 
> public built ffmpeg) and you bundle ffmpeg.exe with your software like many 
> are doing. Now, re-read my comments, maybe it will make more sense to you.

They do not. Customer ask for long path support and gets two responses:

1. Enable long path support via registry once, and never care about it again.
2. Convert path to absolute and prefix it with \\?\ every time you use our 
software.

I don't see how second workaround can be any good at all. With the first option,
customers can at least pressure Microsoft into making it a default, if registry 
tweak
is too much a hassle for them; with the second they're stuck with 
workarounds—forever.

> ffmpeg is already working pretty well in handling long file paths (also with 
> Unicode characters) when pre-fixing paths with \\?\

It handles them most of the time, but not always. I already mentioned that the 
code from
https://ffmpeg.org/pipermail/ffmpeg-devel/2022-April/295568.html
explicitly converts all backslashes into forward slashes for unknown reasons,
and that code will not work with \\?\ paths because //?/ is not a valid prefix.
There are probably other places like that. Examples you've given simply
do not exercise such code paths, but it does mean they do not exists.



___
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/2] avcodec/alacdsp: Make intermediates unsigned

2022-04-29 Thread Michael Niedermayer
Fixes: signed integer overflow: -14914387 + -2147418648 cannot be represented 
in type 'int'
Fixes: 
46464/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-474307197311385

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

diff --git a/libavcodec/alacdsp.c b/libavcodec/alacdsp.c
index 8718d1b6b1..b3c1c424f3 100644
--- a/libavcodec/alacdsp.c
+++ b/libavcodec/alacdsp.c
@@ -29,12 +29,12 @@ static void decorrelate_stereo(int32_t *buffer[2], int 
nb_samples,
 int i;
 
 for (i = 0; i < nb_samples; i++) {
-int32_t a, b;
+uint32_t a, b;
 
 a = buffer[0][i];
 b = buffer[1][i];
 
-a -= (int)(b * (unsigned)decorr_left_weight) >> decorr_shift;
+a -= (int)(b * decorr_left_weight) >> decorr_shift;
 b += a;
 
 buffer[0][i] = b;
-- 
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 2/2] avcodec/mpeg4videodec: Check pixel size against packet size

2022-04-29 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
46866/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-5114397204283392

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

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index e2bde73639..267a79a62f 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -2337,8 +2337,14 @@ static int decode_studio_vol_header(Mpeg4DecContext 
*ctx, GetBitContext *gb)
 /* Do the same check as non-studio profile */
 if (width && height) {
 if (s->width && s->height &&
-(s->width != width || s->height != height))
+(s->width != width || s->height != height)) {
+if (width*height / 256 > get_bits_left(gb)) {
+av_log(s->avctx, AV_LOG_ERROR, "Impossible size for this 
frame\n");
+return AVERROR_INVALIDDATA;
+}
+
 s->context_reinit = 1;
+}
 s->width  = width;
 s->height = height;
 }
@@ -2485,8 +2491,13 @@ static int decode_vol_header(Mpeg4DecContext *ctx, 
GetBitContext *gb)
 if (width && height &&  /* they should be non zero but who knows */
 !(s->width && s->codec_tag == AV_RL32("MP4S"))) {
 if (s->width && s->height &&
-(s->width != width || s->height != height))
+(s->width != width || s->height != height)) {
+if (width*height/256 > get_bits_left(gb)) {
+av_log(s->avctx, AV_LOG_ERROR, "Impossible size for 
this frame\n");
+return AVERROR_INVALIDDATA;
+}
 s->context_reinit = 1;
+}
 s->width  = width;
 s->height = height;
 }
-- 
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 v11 5/6] fftools: Enable long path support on Windows (fixes #8885)

2022-04-29 Thread nil-admirari
> What is the effect of the version attribute here? Would it be meaningful 
> to replace the static dummy value with something more realistic like 
> "5.1.n" or similar?

Version is a required attribute, see 
https://docs.microsoft.com/en-us/windows/win32/sbscs/application-manifests. It 
does not have any meaning, but some value has to be provided, and "1.0.0.0" is 
as good a value as any (version must be in major.minor.build.revision format: 
https://docs.microsoft.com/en-us/windows/win32/sbscs/assembly-versions).

"5.1.n.m" must be either manually updated or regenerated with something like 
"ffmpeg/tools/gen-rc". Both approaches are more laborious than just "1.0.0.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 3/3] avformat/movenc: Add support for AVIF muxing

2022-04-29 Thread Vignesh Venkatasubramanian
On Thu, Apr 21, 2022 at 9:38 AM Vignesh Venkatasubramanian
 wrote:
>
> On Wed, Apr 13, 2022 at 2:35 PM Vignesh Venkatasubramanian
>  wrote:
> >
> > On Wed, Apr 13, 2022 at 2:04 PM Andreas Rheinhardt
> >  wrote:
> > >
> > > Vignesh Venkatasubramanian:
> > > > On Mon, Mar 21, 2022 at 1:46 PM Andreas Rheinhardt
> > > >  wrote:
> > > >>
> > > >> Vignesh Venkatasubramanian:
> > > >>> Add an AVIF muxer by re-using the existing the mov/mp4 muxer.
> > > >>>
> > > >>> AVIF Specifiation: https://aomediacodec.github.io/av1-avif
> > > >>>
> > > >>> Sample usage for still image:
> > > >>> ffmpeg -i image.png -c:v libaom-av1 -avif-image 1 image.avif
> > > >>>
> > > >>> Sample usage for animated AVIF image:
> > > >>> ffmpeg -i video.mp4 animated.avif
> > > >>>
> > > >>> We can re-use any of the AV1 encoding options that will make
> > > >>> sense for image encoding (like bitrate, tiles, encoding speed,
> > > >>> etc).
> > > >>>
> > > >>> The files generated by this muxer has been verified to be valid
> > > >>> AVIF files by the following:
> > > >>> 1) Displays on Chrome (both still and animated images).
> > > >>> 2) Displays on Firefox (only still images, firefox does not support
> > > >>>animated AVIF yet).
> > > >>> 3) Verfied to be valid by Compliance Warden:
> > > >>>https://github.com/gpac/ComplianceWarden
> > > >>>
> > > >>> Fixes the encoder/muxer part of Trac Ticket #7621
> > > >>>
> > > >>> Signed-off-by: Vignesh Venkatasubramanian 
> > > >>> ---
> > > >>>  configure|   1 +
> > > >>>  libavformat/allformats.c |   1 +
> > > >>>  libavformat/movenc.c | 341 
> > > >>> ---
> > > >>>  libavformat/movenc.h |   5 +
> > > >>>  4 files changed, 322 insertions(+), 26 deletions(-)
> > > >>>
> > > >>> diff --git a/configure b/configure
> > > >>> index 8c69ab0c86..6d7020e96b 100755
> > > >>> --- a/configure
> > > >>> +++ b/configure
> > > >>> @@ -3390,6 +3390,7 @@ asf_stream_muxer_select="asf_muxer"
> > > >>>  av1_demuxer_select="av1_frame_merge_bsf av1_parser"
> > > >>>  avi_demuxer_select="riffdec exif"
> > > >>>  avi_muxer_select="riffenc"
> > > >>> +avif_muxer_select="mov_muxer"
> > > >>>  caf_demuxer_select="iso_media"
> > > >>>  caf_muxer_select="iso_media"
> > > >>>  dash_muxer_select="mp4_muxer"
> > > >>> diff --git a/libavformat/allformats.c b/libavformat/allformats.c
> > > >>> index d066a7745b..400c17afbd 100644
> > > >>> --- a/libavformat/allformats.c
> > > >>> +++ b/libavformat/allformats.c
> > > >>> @@ -81,6 +81,7 @@ extern const AVOutputFormat ff_au_muxer;
> > > >>>  extern const AVInputFormat  ff_av1_demuxer;
> > > >>>  extern const AVInputFormat  ff_avi_demuxer;
> > > >>>  extern const AVOutputFormat ff_avi_muxer;
> > > >>> +extern const AVOutputFormat ff_avif_muxer;
> > > >>>  extern const AVInputFormat  ff_avisynth_demuxer;
> > > >>>  extern const AVOutputFormat ff_avm2_muxer;
> > > >>>  extern const AVInputFormat  ff_avr_demuxer;
> > > >>> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> > > >>> index 1a746a67fd..ff41579300 100644
> > > >>> --- a/libavformat/movenc.c
> > > >>> +++ b/libavformat/movenc.c
> > > >>> @@ -1303,7 +1303,7 @@ static int mov_write_av1c_tag(AVIOContext *pb, 
> > > >>> MOVTrack *track)
> > > >>>
> > > >>>  avio_wb32(pb, 0);
> > > >>>  ffio_wfourcc(pb, "av1C");
> > > >>> -ff_isom_write_av1c(pb, track->vos_data, track->vos_len, 1);
> > > >>> +ff_isom_write_av1c(pb, track->vos_data, track->vos_len, 
> > > >>> track->mode != MODE_AVIF);
> > > >>>  return update_size(pb, pos);
> > > >>>  }
> > > >>>
> > > >>> @@ -2004,12 +2004,13 @@ static int mov_write_colr_tag(AVIOContext 
> > > >>> *pb, MOVTrack *track, int prefer_icc)
> > > >>>  }
> > > >>>  }
> > > >>>
> > > >>> -/* We should only ever be called by MOV or MP4. */
> > > >>> -av_assert0(track->mode == MODE_MOV || track->mode == MODE_MP4);
> > > >>> +/* We should only ever be called for MOV, MP4 and AVIF. */
> > > >>> +av_assert0(track->mode == MODE_MOV || track->mode == MODE_MP4 ||
> > > >>> +   track->mode == MODE_AVIF);
> > > >>>
> > > >>>  avio_wb32(pb, 0); /* size */
> > > >>>  ffio_wfourcc(pb, "colr");
> > > >>> -if (track->mode == MODE_MP4)
> > > >>> +if (track->mode == MODE_MP4 || track->mode == MODE_AVIF)
> > > >>>  ffio_wfourcc(pb, "nclx");
> > > >>>  else
> > > >>>  ffio_wfourcc(pb, "nclc");
> > > >>> @@ -2019,7 +2020,7 @@ static int mov_write_colr_tag(AVIOContext *pb, 
> > > >>> MOVTrack *track, int prefer_icc)
> > > >>>  avio_wb16(pb, track->par->color_primaries);
> > > >>>  avio_wb16(pb, track->par->color_trc);
> > > >>>  avio_wb16(pb, track->par->color_space);
> > > >>> -if (track->mode == MODE_MP4) {
> > > >>> +if (track->mode == MODE_MP4 || track->mode == MODE_AVIF) {
> > > >>>  int full_range = track->par->color_range == AVCOL_RANGE_JPEG;
> > > >>>  avio_w8(pb, full_range << 7);
> > > >>>  }
> > > >>> @@ -2085

[FFmpeg-devel] [PATCH v2] avformat/avio: use av_match_name to match protocol whitelist

2022-04-29 Thread Leo Izen
This swaps av_match_list to av_match_name inside ffurl_connect,
which allows ALL to be treated as a valid value on the whitelist
in accordance with the behavior described in the documentation.
---
 libavformat/avio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/avio.c b/libavformat/avio.c
index 4846bbd8c6..1c033c6667 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -178,7 +178,7 @@ int ffurl_connect(URLContext *uc, AVDictionary **options)
 av_assert0(!(e=av_dict_get(*options, "protocol_blacklist", NULL, 0)) ||
(uc->protocol_blacklist && !strcmp(uc->protocol_blacklist, 
e->value)));
 
-if (uc->protocol_whitelist && av_match_list(uc->prot->name, 
uc->protocol_whitelist, ',') <= 0) {
+if (uc->protocol_whitelist && av_match_name(uc->prot->name, 
uc->protocol_whitelist) <= 0) {
 av_log(uc, AV_LOG_ERROR, "Protocol '%s' not on whitelist '%s'!\n", 
uc->prot->name, uc->protocol_whitelist);
 return AVERROR(EINVAL);
 }
-- 
2.36.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/flacdec: Increase residual limit from INT_MAX to UINT_MAX

2022-04-29 Thread Martijn van Beurden
Op wo 6 apr. 2022 om 09:12 schreef Martijn van Beurden :
>
> Op di 5 apr. 2022 om 15:37 schreef Martijn van Beurden :
> >
> > ---
> >  libavcodec/flacdec.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
> > index dd6026f9de..cb32d7cae8 100644
> > --- a/libavcodec/flacdec.c
> > +++ b/libavcodec/flacdec.c
> > @@ -260,7 +260,7 @@ static int decode_residuals(FLACContext *s, int32_t 
> > *decoded, int pred_order)
> >  for (; i < samples; i++)
> >  *decoded++ = get_sbits_long(&gb, tmp);
> >  } else {
> > -int real_limit = tmp ? (INT_MAX >> tmp) + 2 : INT_MAX;
> > +int real_limit = (tmp > 1) ? (INT_MAX >> (tmp - 1)) + 2 : 
> > INT_MAX;
> >  for (; i < samples; i++) {
> >  int v = get_sr_golomb_flac(&gb, tmp, real_limit, 1);
> >  if (v == 0x8000){
> > --
> > 2.30.2
> >
>
> A file needing this patch to decode properly can be found here:
> https://github.com/ktmf01/flac-test-files/blob/main/subset/63%20-%20predictor%20overflow%20check%2C%2024-bit.flac
>
> Kind regards, Martijn van Beurden

Hereby I'd like to once more bring this patch to the attention of the
mailinglist.
___
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] avfilter: Add blockdetect filter

2022-04-29 Thread Thilo Borgmann

Hi,

$subject based on 
http://www.eurasip.org/Proceedings/Eusipco/Eusipco2005/defevent/papers/cr1042.pdf

-ThiloFrom e69095b17619454e671e401ec5c01f130c308a76 Mon Sep 17 00:00:00 2001
From: Thilo Borgmann 
Date: Fri, 29 Apr 2022 15:58:11 +0200
Subject: [PATCH] avfilter: Add blockdetect filter

---
 doc/filters.texi |  29 
 libavfilter/Makefile |   1 +
 libavfilter/allfilters.c |   1 +
 libavfilter/vf_blockdetect.c | 294 +++
 4 files changed, 325 insertions(+)
 create mode 100644 libavfilter/vf_blockdetect.c

diff --git a/doc/filters.texi b/doc/filters.texi
index 52c40833eb..e550eb8824 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -7997,6 +7997,35 @@ tblend=all_mode=grainextract
 @subsection Commands
 This filter supports same @ref{commands} as options.
 
+@anchor{blockdetect}
+@section blockdetect
+
+Determines blockiness of frames without altering the input frames.
+
+Based on Remco Muijs and Ihor Kirenko: "A no-reference blocking artifact 
measure for adaptive video processing." 2005 13th European signal processing 
conference. 
+
+The filter accepts the following options:
+
+@table @option
+@item period_min
+@item period_max
+Set minimum and maximum values for determining pixel grids (periods).
+Default values are [3,24].
+
+@item planes
+Set planes to filter. Default is first only.
+@end table
+
+@subsection Examples
+
+@itemize
+@item
+Determine blockiness for the first plane and search for periods within [8,32]:
+@example
+blockdetect=period_min=8:period_max=32:planes=1
+@end example
+@end itemize
+
 @anchor{blurdetect}
 @section blurdetect
 
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 1db097b464..35a430878f 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -195,6 +195,7 @@ OBJS-$(CONFIG_BLACKDETECT_FILTER)+= 
vf_blackdetect.o
 OBJS-$(CONFIG_BLACKFRAME_FILTER) += vf_blackframe.o
 OBJS-$(CONFIG_BLEND_FILTER)  += vf_blend.o framesync.o
 OBJS-$(CONFIG_BLEND_VULKAN_FILTER)   += vf_blend_vulkan.o framesync.o 
vulkan.o vulkan_filter.o
+OBJS-$(CONFIG_BLOCKDETECT_FILTER)+= vf_blockdetect.o
 OBJS-$(CONFIG_BLURDETECT_FILTER) += vf_blurdetect.o edge_common.o
 OBJS-$(CONFIG_BM3D_FILTER)   += vf_bm3d.o framesync.o
 OBJS-$(CONFIG_BOXBLUR_FILTER)+= vf_boxblur.o boxblur.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 2ad523fd0f..30936392ce 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -183,6 +183,7 @@ extern const AVFilter ff_vf_blackdetect;
 extern const AVFilter ff_vf_blackframe;
 extern const AVFilter ff_vf_blend;
 extern const AVFilter ff_vf_blend_vulkan;
+extern const AVFilter ff_vf_blockdetect;
 extern const AVFilter ff_vf_blurdetect;
 extern const AVFilter ff_vf_bm3d;
 extern const AVFilter ff_vf_boxblur;
diff --git a/libavfilter/vf_blockdetect.c b/libavfilter/vf_blockdetect.c
new file mode 100644
index 00..f15dd19646
--- /dev/null
+++ b/libavfilter/vf_blockdetect.c
@@ -0,0 +1,294 @@
+/*
+ * Copyright (c) 2021 Thilo Borgmann 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * No-reference blockdetect filter
+ *
+ * Implementing:
+ * Remco Muijs and Ihor Kirenko: "A no-reference blocking artifact measure for 
adaptive video processing." 2005 13th European signal processing conference. 
IEEE, 2005. 
+ * 
http://www.eurasip.org/Proceedings/Eusipco/Eusipco2005/defevent/papers/cr1042.pdf
+ *
+ * @author Thilo Borgmann 
+ */
+
+#include "libavutil/imgutils.h"
+#include "libavutil/opt.h"
+#include "internal.h"
+
+typedef struct BLKContext {
+const AVClass *class;
+
+int hsub, vsub;
+int nb_planes;
+
+int period_min;// minimum period to search for
+int period_max;// maximum period to search for
+int planes;// number of planes to filter
+
+double block_total;
+uint64_t nb_frames;
+
+float *gradients;
+} BLKContext;
+
+#define OFFSET(x) offsetof(BLKContext, x)
+#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
+static const AVOption blockdetect_options[] = {
+{ "period_min", "Minimum period to search for", OFFSET(period_min), 
AV_OPT_TYPE_INT, {.i64=3

Re: [FFmpeg-devel] [PATCH] avformat/mov: skip call ff_codec_get_id if possible

2022-04-29 Thread Andreas Rheinhardt
"zhilizhao(赵志立)":
> 
> 
>> On Apr 19, 2022, at 1:12 PM, Zhao Zhili  wrote:
>>
>> ff_codec_get_id loops over ff_codec_movvideo_tags (which is a large
>> array) two times. The result is unused most of the cases.
>> ---
>> libavformat/mov.c | 4 +---
>> 1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>> index 6c847de164..bdc8c84bae 100644
>> --- a/libavformat/mov.c
>> +++ b/libavformat/mov.c
>> @@ -2487,8 +2487,6 @@ static int mov_skip_multiple_stsd(MOVContext *c, 
>> AVIOContext *pb,
>>   int codec_tag, int format,
>>   int64_t size)
>> {
>> -int video_codec_id = ff_codec_get_id(ff_codec_movvideo_tags, format);
>> -
>> if (codec_tag &&
>>  (codec_tag != format &&
>>   // AVID 1:1 samples with differing data format and codec tag exist
>> @@ -2497,7 +2495,7 @@ static int mov_skip_multiple_stsd(MOVContext *c, 
>> AVIOContext *pb,
>>   codec_tag != AV_RL32("apcn") && codec_tag != AV_RL32("apch") &&
>>   // so is dv (sigh)
>>   codec_tag != AV_RL32("dvpp") && codec_tag != AV_RL32("dvcp") &&
>> -  (c->fc->video_codec_id ? video_codec_id != c->fc->video_codec_id
>> +  (c->fc->video_codec_id ? ff_codec_get_id(ff_codec_movvideo_tags, 
>> format) != c->fc->video_codec_id
>>  : codec_tag != MKTAG('j','p','e','g' {
>> /* Multiple fourcc, we skip JPEG. This is not correct, we should
>>  * export it as a separate AVStream but this needs a few changes
>> -- 
>> 2.35.3
>>
> 
> Do we care about such micro-optimization, or just let compiler do it’s job?

A compiler could currently only optimize this on its own if you were
using LTO; it might also be able to optimize this if ff_codec_get_id
were marked as av_pure. Of course, there is no guarantee that this is
optimized in these cases, but you could check whether e.g. GCC/Clang do it.
And I don't see anything wrong with micro-optimizations.

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


[FFmpeg-devel] [PATCH v2 5/5] avutil/hwcontext_qsv: map D3D11VA frames to QSV frames

2022-04-29 Thread Tong Wu
Fixes:
$ ffmpeg.exe -init_hw_device d3d11va=d3d11 -f lavfi -i
yuvtestsrc -vf
"format=nv12,hwupload=extra_hw_frames=16,hwmap=derive_device=qsv,format=qsv
,hwdownload,format=nv12" -f null -

Signed-off-by: Tong Wu 
---
 libavutil/hwcontext_qsv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
index 6bc920ef59..1bdffee4a4 100644
--- a/libavutil/hwcontext_qsv.c
+++ b/libavutil/hwcontext_qsv.c
@@ -1363,7 +1363,8 @@ static int qsv_map_to(AVHWFramesContext *dst_ctx,
 {
 mfxHDLPair *pair = (mfxHDLPair*)hwctx->surfaces[i].Data.MemId;
 if (pair->first == src->data[0]
-&& pair->second == src->data[1]) {
+&& (pair->second == src->data[1]
+|| (pair->second == (mfxMemId)MFX_INFINITE && src->data[1] 
== (uint8_t *)0))) {
 index = i;
 break;
 }
-- 
2.35.1

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

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


[FFmpeg-devel] [PATCH v2 4/5] avutil/hwcontext_qsv: map QSV frames to D3D11VA frames

2022-04-29 Thread Tong Wu
When input is a rawvideo, after mapping QSV frames to D3D11VA frames,
the output will have green frames. Now fix it.

Fixes:
$ ffmpeg.exe -y -init_hw_device d3d11va=d3d11 \
-init_hw_device qsv=qsv@d3d11 -s:v WxH -pix_fmt nv12 -i input.yuv \
-vf "format=nv12,hwupload=extra_hw_frames=16,\
hwmap=derive_device=d3d11va,format=d3d11,hwdownload,format=nv12" \
-f rawvideo output.yuv

Signed-off-by: Tong Wu 
---
 libavutil/hwcontext_qsv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
index d9d05e936a..6bc920ef59 100644
--- a/libavutil/hwcontext_qsv.c
+++ b/libavutil/hwcontext_qsv.c
@@ -915,7 +915,7 @@ static int qsv_map_from(AVHWFramesContext *ctx,
if (child_frames_ctx->device_ctx->type == AV_HWDEVICE_TYPE_D3D11VA) {
 mfxHDLPair *pair = (mfxHDLPair*)surf->Data.MemId;
 dst->data[0] = pair->first;
-dst->data[1] = pair->second;
+dst->data[1] = pair->second == (mfxMemId)MFX_INFINITE ? (uint8_t 
*)0 : pair->second;
 } else {
 dst->data[3] = child_data;
 }
@@ -945,7 +945,7 @@ static int qsv_map_from(AVHWFramesContext *ctx,
 if (child_frames_ctx->device_ctx->type == AV_HWDEVICE_TYPE_D3D11VA) {
 mfxHDLPair *pair = (mfxHDLPair*)surf->Data.MemId;
 dummy->data[0] = pair->first;
-dummy->data[1] = pair->second;
+dummy->data[1] = pair->second == (mfxMemId)MFX_INFINITE ? (uint8_t *)0 
: pair->second;
 } else {
 dummy->data[3] = child_data;
 }
-- 
2.35.1

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

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


[FFmpeg-devel] [PATCH v2 3/5] avutil/hwcontext_d3d11va: add a format check for staging texture

2022-04-29 Thread Tong Wu
The texDesc.Format needs to be filled in with a corresponding format. I
add a format check to initialize the format in case sometimes the
ctx->internal->priv is not initialized, such as during the hwmap
process.

$ ffmpeg.exe -y -hwaccel qsv -init_hw_device d3d11va=d3d11 \
-init_hw_device qsv=qsv@d3d11 -c:v h264_qsv \
-i input.h264 -vf 
"hwmap=derive_device=d3d11va,format=d3d11,hwdownload,format=nv12" \
-f null -

Signed-off-by: Tong Wu 
---
 libavutil/hwcontext_d3d11va.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c
index db529acbb4..0ec0e07d3a 100644
--- a/libavutil/hwcontext_d3d11va.c
+++ b/libavutil/hwcontext_d3d11va.c
@@ -349,6 +349,8 @@ static int d3d11va_create_staging_texture(AVHWFramesContext 
*ctx)
 AVD3D11VADeviceContext *device_hwctx = ctx->device_ctx->hwctx;
 D3D11VAFramesContext  *s = ctx->internal->priv;
 HRESULT hr;
+int i;
+
 D3D11_TEXTURE2D_DESC texDesc = {
 .Width  = ctx->width,
 .Height = ctx->height,
@@ -360,6 +362,20 @@ static int 
d3d11va_create_staging_texture(AVHWFramesContext *ctx)
 .CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE,
 };
 
+if (!texDesc.Format) {
+for (i = 0; i < FF_ARRAY_ELEMS(supported_formats); i++) {
+if (ctx->sw_format == supported_formats[i].pix_fmt) {
+texDesc.Format = supported_formats[i].d3d_format;
+break;
+}
+}
+if (i == FF_ARRAY_ELEMS(supported_formats)) {
+av_log(ctx, AV_LOG_ERROR, "Unsupported pixel format: %s\n",
+av_get_pix_fmt_name(ctx->sw_format));
+return AVERROR(EINVAL);
+}
+}
+
 hr = ID3D11Device_CreateTexture2D(device_hwctx->device, &texDesc, NULL, 
&s->staging_texture);
 if (FAILED(hr)) {
 av_log(ctx, AV_LOG_ERROR, "Could not create the staging texture 
(%lx)\n", (long)hr);
-- 
2.35.1

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

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


[FFmpeg-devel] [PATCH v2 2/5] avutil/hwcontext_qsv: derive QSV frames to D3D11VA frames

2022-04-29 Thread Tong Wu
Fixes:
$ ffmpeg.exe -y -hwaccel qsv -init_hw_device d3d11va=d3d11 \
-init_hw_device qsv=qsv@d3d11 -c:v h264_qsv -i input.h264 \
-vf "hwmap=derive_device=d3d11va,format=d3d11" -f null -

Signed-off-by: Tong Wu 
---
 libavutil/hwcontext_qsv.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
index 66c0e38955..d9d05e936a 100644
--- a/libavutil/hwcontext_qsv.c
+++ b/libavutil/hwcontext_qsv.c
@@ -808,12 +808,23 @@ static int qsv_frames_derive_from(AVHWFramesContext 
*dst_ctx,
 #if CONFIG_D3D11VA
 case AV_HWDEVICE_TYPE_D3D11VA:
 {
+dst_ctx->initial_pool_size = src_ctx->initial_pool_size;
 AVD3D11VAFramesContext *dst_hwctx = dst_ctx->hwctx;
-mfxHDLPair *pair = (mfxHDLPair*)src_hwctx->surfaces[i].Data.MemId;
-dst_hwctx->texture = (ID3D11Texture2D*)pair->first;
+dst_hwctx->texture_infos = av_calloc(src_hwctx->nb_surfaces,
+ 
sizeof(*dst_hwctx->texture_infos));
 if (src_hwctx->frame_type & MFX_MEMTYPE_SHARED_RESOURCE)
 dst_hwctx->MiscFlags = D3D11_RESOURCE_MISC_SHARED;
 dst_hwctx->BindFlags = 
qsv_get_d3d11va_bind_flags(src_hwctx->frame_type);
+for (i = 0; i < src_hwctx->nb_surfaces; i++) {
+mfxHDLPair* pair = 
(mfxHDLPair*)src_hwctx->surfaces[i].Data.MemId;
+dst_hwctx->texture_infos[i].texture = 
(ID3D11Texture2D*)pair->first;
+if (dst_hwctx->BindFlags & D3D11_BIND_RENDER_TARGET) {
+dst_hwctx->texture_infos[i].index = 0;
+}
+else {
+dst_hwctx->texture_infos[i].index = (intptr_t)pair->second;
+}
+}
 }
 break;
 #endif
-- 
2.35.1

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

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


[FFmpeg-devel] [PATCH v2 1/5] avutil/hwcontext_d3d11va: fix the uninitialized texture bindflag

2022-04-29 Thread Tong Wu
When uploading rawvideos using d3d11va hardware framecontext, the bindflag
is not initialized and will cause creating texture failure. Now fix it,
assign it the value of D3D11_BIND_RENDER_TARGET.

Fixes:
$ ffmpeg.exe -init_hw_device d3d11va=d3d11 -f lavfi -i yuvtestsrc -vf \
"format=nv12,hwupload=extra_hw_frames=16" -f null -

Signed-off-by: Tong Wu 
---
 libavutil/hwcontext_d3d11va.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c
index 8ab96bad25..db529acbb4 100644
--- a/libavutil/hwcontext_d3d11va.c
+++ b/libavutil/hwcontext_d3d11va.c
@@ -254,6 +254,11 @@ static int d3d11va_frames_init(AVHWFramesContext *ctx)
 return AVERROR(EINVAL);
 }
 
+if (!hwctx->BindFlags) {
+av_log(ctx, AV_LOG_DEBUG, "Add render target bindflag for texture\n");
+hwctx->BindFlags = D3D11_BIND_RENDER_TARGET;
+}
+
 texDesc = (D3D11_TEXTURE2D_DESC){
 .Width  = ctx->width,
 .Height = ctx->height,
-- 
2.35.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] avformat/mov: skip call ff_codec_get_id if possible

2022-04-29 Thread zhilizhao(赵志立)


> On Apr 19, 2022, at 1:12 PM, Zhao Zhili  wrote:
> 
> ff_codec_get_id loops over ff_codec_movvideo_tags (which is a large
> array) two times. The result is unused most of the cases.
> ---
> libavformat/mov.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 6c847de164..bdc8c84bae 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -2487,8 +2487,6 @@ static int mov_skip_multiple_stsd(MOVContext *c, 
> AVIOContext *pb,
>   int codec_tag, int format,
>   int64_t size)
> {
> -int video_codec_id = ff_codec_get_id(ff_codec_movvideo_tags, format);
> -
> if (codec_tag &&
>  (codec_tag != format &&
>   // AVID 1:1 samples with differing data format and codec tag exist
> @@ -2497,7 +2495,7 @@ static int mov_skip_multiple_stsd(MOVContext *c, 
> AVIOContext *pb,
>   codec_tag != AV_RL32("apcn") && codec_tag != AV_RL32("apch") &&
>   // so is dv (sigh)
>   codec_tag != AV_RL32("dvpp") && codec_tag != AV_RL32("dvcp") &&
> -  (c->fc->video_codec_id ? video_codec_id != c->fc->video_codec_id
> +  (c->fc->video_codec_id ? ff_codec_get_id(ff_codec_movvideo_tags, 
> format) != c->fc->video_codec_id
>  : codec_tag != MKTAG('j','p','e','g' {
> /* Multiple fourcc, we skip JPEG. This is not correct, we should
>  * export it as a separate AVStream but this needs a few changes
> -- 
> 2.35.3
> 

Do we care about such micro-optimization, or just let compiler do it’s job?
___
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 v1 4/4] examples: seperate vaapi_decode from hw_decode

2022-04-29 Thread Fei Wang
Now vaapi_decode can be used to test vaapi decode and vaapi decode
with sub frame.

decode example:
$ vaapi_decode 1920x1080.h265 out.yuv

decode with sub frame example:
$ vaapi_decode 1920x1080.h265 out.yuv width=640:height=480:format=argb 
sub_out.argb

Signed-off-by: Fei Wang 
---
 configure   |   2 +
 doc/examples/Makefile   |   1 +
 doc/examples/vaapi_decode.c | 296 
 3 files changed, 299 insertions(+)
 create mode 100644 doc/examples/vaapi_decode.c

diff --git a/configure b/configure
index 196873c4aa..73ed62eae7 100755
--- a/configure
+++ b/configure
@@ -1744,6 +1744,7 @@ EXAMPLE_LIST="
 scaling_video_example
 transcode_aac_example
 transcoding_example
+vaapi_decode_example
 vaapi_encode_example
 vaapi_transcode_example
 "
@@ -3779,6 +3780,7 @@ resampling_audio_example_deps="avutil swresample"
 scaling_video_example_deps="avutil swscale"
 transcode_aac_example_deps="avcodec avformat swresample"
 transcoding_example_deps="avfilter avcodec avformat avutil"
+vaapi_decode_example_deps="avcodec avformat avutil"
 vaapi_encode_example_deps="avcodec avutil h264_vaapi_encoder"
 vaapi_transcode_example_deps="avcodec avformat avutil h264_vaapi_encoder"
 
diff --git a/doc/examples/Makefile b/doc/examples/Makefile
index 81bfd34d5d..f1b18028c5 100644
--- a/doc/examples/Makefile
+++ b/doc/examples/Makefile
@@ -19,6 +19,7 @@ EXAMPLES-$(CONFIG_RESAMPLING_AUDIO_EXAMPLE)  += 
resampling_audio
 EXAMPLES-$(CONFIG_SCALING_VIDEO_EXAMPLE) += scaling_video
 EXAMPLES-$(CONFIG_TRANSCODE_AAC_EXAMPLE) += transcode_aac
 EXAMPLES-$(CONFIG_TRANSCODING_EXAMPLE)   += transcoding
+EXAMPLES-$(CONFIG_VAAPI_DECODE_EXAMPLE)  += vaapi_decode
 EXAMPLES-$(CONFIG_VAAPI_ENCODE_EXAMPLE)  += vaapi_encode
 EXAMPLES-$(CONFIG_VAAPI_TRANSCODE_EXAMPLE)   += vaapi_transcode
 
diff --git a/doc/examples/vaapi_decode.c b/doc/examples/vaapi_decode.c
new file mode 100644
index 00..a9c8d48240
--- /dev/null
+++ b/doc/examples/vaapi_decode.c
@@ -0,0 +1,296 @@
+/*
+ * Video Acceleration API (video decoding) decode sample
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/**
+ * @file
+ * VAAPI-accelerated decoding example.
+ *
+ * @example vaapi_decode.c
+ * This example shows how to do VAAPI-accelerated decoding with output
+ * frames from the HW video surfaces. Also support decoding with sub frame.
+ */
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static AVBufferRef *hw_device_ctx = NULL;
+static enum AVPixelFormat hw_pix_fmt;
+static FILE *output_file = NULL;
+static FILE *sub_frame_output = NULL;
+
+static int hw_decoder_init(AVCodecContext *ctx, const enum AVHWDeviceType type)
+{
+int err = 0;
+
+if ((err = av_hwdevice_ctx_create(&hw_device_ctx, type,
+  NULL, NULL, 0)) < 0) {
+fprintf(stderr, "Failed to create specified HW device.\n");
+return err;
+}
+ctx->hw_device_ctx = av_buffer_ref(hw_device_ctx);
+
+return err;
+}
+
+static enum AVPixelFormat get_hw_format(AVCodecContext *ctx,
+const enum AVPixelFormat *pix_fmts)
+{
+const enum AVPixelFormat *p;
+
+for (p = pix_fmts; *p != -1; p++) {
+if (*p == hw_pix_fmt)
+return *p;
+}
+
+fprintf(stderr, "Failed to get HW surface format.\n");
+return AV_PIX_FMT_NONE;
+}
+
+static int retrieve_write(AVFrame *frame, AVFrame *sw_frame, FILE *file)
+{
+AVFrame *tmp_frame = NULL;
+uint8_t *buffer = NULL;
+int size;
+int ret = 0;
+
+if (frame->format == hw_pix_fmt) {
+/* retrieve data from GPU to CPU */
+if ((ret = av_hwframe_transfer_data(sw_frame, frame, 0)) < 0) {
+fprintf(stderr, "Error transferring the data to system memory\n");
+goto fail;
+}
+tmp_frame = sw_frame;
+} else
+tmp_frame = fram

[FFmpeg-devel] [PATCH v1 3/4] lavc/hevc_vaapi: enable sub frame support

2022-04-29 Thread Fei Wang
Intel HW provide a feature that allows decoder output another scaled
frame beside original frame. And the scaled frame will attach to main
frame as sub frame side data.

The use case is mainly for video analysis. For example, scaled down
frame can be used for analysis, and the result can be applied back
to main frame.

Normally, we use scale_vaapi for scaling in vaapi transcode pipeline
if want to get a smaller resolution frame. While now sub frame can
be used instead. For some platforms, the sub frame scaling is much
more faster than scale_vaapi. For example, the decode + sub frame
cmd will improve ~50% performance than decode + scaling on my DG2
i3-11100B@3.6GHz.

decode + sub frame cmd:
ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128\
-hwaccel_output_format vaapi -export_side_data sub_frame \
-sub_frame_opts "width=300:height=300:format=nv12"   \
-i 1920x1080.h265 -f null - &

decode + scaling cmd:
ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128\
-hwaccel_output_format vaapi -i 1920x1080.h265   \
-vf 'scale_vaapi=w=300:h=300:format=nv12' -f null - &

Signed-off-by: Fei Wang 
---
 libavcodec/vaapi_decode.c   | 46 ++-
 libavcodec/vaapi_decode.h   |  4 +++
 libavcodec/vaapi_hevc.c | 32 ++-
 libavutil/hwcontext_vaapi.c | 62 +++--
 libavutil/hwcontext_vaapi.h | 15 -
 5 files changed, 153 insertions(+), 6 deletions(-)

diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
index a7abddb06b..920bab1ef4 100644
--- a/libavcodec/vaapi_decode.c
+++ b/libavcodec/vaapi_decode.c
@@ -160,6 +160,10 @@ int ff_vaapi_decode_issue(AVCodecContext *avctx,
 av_log(avctx, AV_LOG_DEBUG, "Decode to surface %#x.\n",
pic->output_surface);
 
+if (ctx->hwfc->enable_sub_frame)
+av_log(avctx, AV_LOG_DEBUG, "Decode sub frame to surface %#x.\n",
+   pic->sub_frame_surface);
+
 vas = vaBeginPicture(ctx->hwctx->display, ctx->va_context,
  pic->output_surface);
 if (vas != VA_STATUS_SUCCESS) {
@@ -440,6 +444,9 @@ static int vaapi_decode_make_config(AVCodecContext *avctx,
 AVHWDeviceContext*device = (AVHWDeviceContext*)device_ref->data;
 AVVAAPIDeviceContext *hwctx = device->hwctx;
 
+VAConfigAttrib attr;
+int attr_num = 0, support_dec_processing = 0;
+
 codec_desc = avcodec_descriptor_get(avctx->codec_id);
 if (!codec_desc) {
 err = AVERROR(EINVAL);
@@ -518,8 +525,23 @@ static int vaapi_decode_make_config(AVCodecContext *avctx,
 }
 }
 
+if (avctx->export_side_data & AV_CODEC_EXPORT_DATA_SUB_FRAME) {
+attr.type = VAConfigAttribDecProcessing;
+vas = vaGetConfigAttributes(hwctx->display, matched_va_profile,
+VAEntrypointVLD, &attr, 1);
+if (vas != VA_STATUS_SUCCESS) {
+av_log(avctx, AV_LOG_ERROR, "Failed to query decode process "
+   "attributes: %d (%s).\n", vas, vaErrorStr(vas));
+return AVERROR_EXTERNAL;
+} else if (attr.value | VA_DEC_PROCESSING) {
+support_dec_processing = 1;
+attr_num++;
+} else
+av_log(avctx, AV_LOG_WARNING, "Hardware doesn't support decode 
processing.\n");
+}
+
 vas = vaCreateConfig(hwctx->display, matched_va_profile,
- VAEntrypointVLD, NULL, 0,
+ VAEntrypointVLD, &attr, attr_num,
  va_config);
 if (vas != VA_STATUS_SUCCESS) {
 av_log(avctx, AV_LOG_ERROR, "Failed to create decode "
@@ -564,10 +586,32 @@ static int vaapi_decode_make_config(AVCodecContext *avctx,
 
 if (frames_ref) {
 AVHWFramesContext *frames = (AVHWFramesContext *)frames_ref->data;
+AVVAAPIFramesContext *avfc = frames->hwctx;
 
 frames->format = AV_PIX_FMT_VAAPI;
 frames->width = avctx->coded_width;
 frames->height = avctx->coded_height;
+avfc->enable_sub_frame = support_dec_processing;
+
+if (avfc->enable_sub_frame) {
+avfc->sub_frame_width = avctx->coded_width;
+avfc->sub_frame_height = avctx->coded_height;
+avfc->sub_frame_sw_format = AV_PIX_FMT_NV12;
+if (avctx->sub_frame_opts) {
+AVDictionaryEntry *e = NULL;
+while ((e = av_dict_get(avctx->sub_frame_opts, "", e, 
AV_DICT_IGNORE_SUFFIX))) {
+if (!strcmp(e->key, "width"))
+avfc->sub_frame_width= atoi(e->value);
+else if (!strcmp(e->key, "height"))
+avfc->sub_frame_height = atoi(e->value);
+else if (!strcmp(e->key, "format"))
+avfc->sub_frame_sw_format = av_get_pix_fmt(e->value);
+}
+}
+av_log(avctx, AV_LOG_DEBUG, "Sub frame set with width:%d, 
he

[FFmpeg-devel] [PATCH v1 2/4] lavc: add sub frame options and flag

2022-04-29 Thread Fei Wang
Signed-off-by: Fei Wang 
---
 doc/codecs.texi|  9 +
 libavcodec/avcodec.h   | 15 +++
 libavcodec/options_table.h |  2 ++
 libavcodec/version.h   |  2 +-
 4 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/doc/codecs.texi b/doc/codecs.texi
index 5e10020900..d74678a5eb 100644
--- a/doc/codecs.texi
+++ b/doc/codecs.texi
@@ -662,6 +662,9 @@ for codecs that support it. At present, those are H.264 and 
VP9.
 @item film_grain
 Export film grain parameters through frame side data (see 
@code{AV_FRAME_DATA_FILM_GRAIN_PARAMS}).
 Supported at present by AV1 decoders.
+@item sub_frame
+Export sub frame through frame side data (see @code{AV_FRAME_DATA_SUB_FRAME}).
+Supported at present by hevc VAAPI decoder.
 @end table
 
 @item threads @var{integer} (@emph{decoding/encoding,video})
@@ -1018,6 +1021,12 @@ Note: The required alignment depends on if 
@code{AV_CODEC_FLAG_UNALIGNED} is set
 CPU. @code{AV_CODEC_FLAG_UNALIGNED} cannot be changed from the command line. 
Also hardware
 decoders will not apply left/top Cropping.
 
+@item sub_frame_opts @var{dict} (@emph{decoding,video})
+Sub frames parameters, like width/height/format etc.
+@example
+-sub_frame_opts "width=640:height=480:format=nv12"
+@end example
+
 
 @end table
 
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 4dae23d06e..3b1ab39f0c 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -361,6 +361,12 @@ typedef struct RcOverride{
  */
 #define AV_CODEC_EXPORT_DATA_FILM_GRAIN (1 << 3)
 
+/**
+ * Decoding only.
+ * export sub frame through frame side data.
+ */
+#define AV_CODEC_EXPORT_DATA_SUB_FRAME (1 << 4)
+
 /**
  * The decoder will keep a reference to the frame and may reuse it later.
  */
@@ -2055,6 +2061,15 @@ typedef struct AVCodecContext {
  * The decoder can then override during decoding as needed.
  */
 AVChannelLayout ch_layout;
+
+
+/**
+ * Set sub frame's parameters like: width/height/format etc.
+ *
+ * - decoding: set by user
+ * - encoding: unused
+ */
+AVDictionary *sub_frame_opts;
 } AVCodecContext;
 
 /**
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index e72b4d12b6..b6bcbd251e 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -88,6 +88,7 @@ static const AVOption avcodec_options[] = {
 {"prft", "export Producer Reference Time through packet side data", 0, 
AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_EXPORT_DATA_PRFT}, INT_MIN, INT_MAX, 
A|V|S|E, "export_side_data"},
 {"venc_params", "export video encoding parameters through frame side data", 0, 
AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_EXPORT_DATA_VIDEO_ENC_PARAMS}, INT_MIN, 
INT_MAX, V|D, "export_side_data"},
 {"film_grain", "export film grain parameters through frame side data", 0, 
AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_EXPORT_DATA_FILM_GRAIN}, INT_MIN, INT_MAX, 
V|D, "export_side_data"},
+{"sub_frame", "export sub frame through frame side data", 0, 
AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_EXPORT_DATA_SUB_FRAME}, INT_MIN, INT_MAX, 
V|D, "export_side_data"},
 {"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, 0, 
INT_MAX},
 {"g", "set the group of picture (GOP) size", OFFSET(gop_size), 
AV_OPT_TYPE_INT, {.i64 = 12 }, INT_MIN, INT_MAX, V|E},
 {"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), 
AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|D|E},
@@ -399,6 +400,7 @@ static const AVOption avcodec_options[] = {
 {"allow_profile_mismatch", "attempt to decode anyway if HW accelerated 
decoder's supported profiles do not exactly match the stream", 0, 
AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH }, INT_MIN, 
INT_MAX, V | D, "hwaccel_flags"},
 {"extra_hw_frames", "Number of extra hardware frames to allocate for the 
user", OFFSET(extra_hw_frames), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, 
V|D },
 {"discard_damaged_percentage", "Percentage of damaged samples to discard a 
frame", OFFSET(discard_damaged_percentage), AV_OPT_TYPE_INT, {.i64 = 95 }, 0, 
100, V|D },
+{"sub_frame_opts", "set sub frame opts", OFFSET(sub_frame_opts), 
AV_OPT_TYPE_DICT, {.str = NULL}, -1, INT_MAX, V|D},
 {NULL},
 };
 
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 735c8b813c..87b7284a95 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #include "version_major.h"
 
-#define LIBAVCODEC_VERSION_MINOR  27
+#define LIBAVCODEC_VERSION_MINOR  28
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
-- 
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 v1 1/4] lavu: add sub frame side data

2022-04-29 Thread Fei Wang
Sub frame side data allows attach another AVFrame as side data into
the target AVFrame.

Signed-off-by: Fei Wang 
---
 libavutil/Makefile |  2 ++
 libavutil/frame.c  |  5 ++-
 libavutil/frame.h  |  5 +++
 libavutil/sub_frame_metadata.c | 61 ++
 libavutil/sub_frame_metadata.h | 35 +++
 libavutil/version.h|  4 +--
 6 files changed, 109 insertions(+), 3 deletions(-)
 create mode 100644 libavutil/sub_frame_metadata.c
 create mode 100644 libavutil/sub_frame_metadata.h

diff --git a/libavutil/Makefile b/libavutil/Makefile
index 81df3b0640..09333a0b48 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -88,6 +88,7 @@ HEADERS = adler32.h   
  \
   tea.h \
   tx.h  \
   film_grain_params.h   \
+  sub_frame_metadata.h  \
 
 ARCH_HEADERS = bswap.h  \
intmath.h\
@@ -176,6 +177,7 @@ OBJS = adler32.o
\
tx_int32.o   \
video_enc_params.o   \
film_grain_params.o  \
+   sub_frame_metadata.o \
 
 
 OBJS-$(CONFIG_CUDA) += hwcontext_cuda.o
diff --git a/libavutil/frame.c b/libavutil/frame.c
index fbb869fffa..b21a15e652 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -315,7 +315,9 @@ static int frame_copy_props(AVFrame *dst, const AVFrame 
*src, int force_copy)
 if (   sd_src->type == AV_FRAME_DATA_PANSCAN
 && (src->width != dst->width || src->height != dst->height))
 continue;
-if (force_copy) {
+/* Don't copy sub frame side data, otherwise sub frame's pointers in
+ * dst may be invalid. */
+if (force_copy && sd_src->type != AV_FRAME_DATA_SUB_FRAME) {
 sd_dst = av_frame_new_side_data(dst, sd_src->type,
 sd_src->size);
 if (!sd_dst) {
@@ -815,6 +817,7 @@ const char *av_frame_side_data_name(enum 
AVFrameSideDataType type)
 case AV_FRAME_DATA_DETECTION_BBOXES:return "Bounding boxes for 
object detection and classification";
 case AV_FRAME_DATA_DOVI_RPU_BUFFER: return "Dolby Vision RPU 
Data";
 case AV_FRAME_DATA_DOVI_METADATA:   return "Dolby Vision 
Metadata";
+case AV_FRAME_DATA_SUB_FRAME:   return "Sub frame 
Metadata";
 }
 return NULL;
 }
diff --git a/libavutil/frame.h b/libavutil/frame.h
index 33fac2054c..9ae1286100 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -209,6 +209,11 @@ enum AVFrameSideDataType {
  * volume transform - CUVA 005.1-2021.
  */
 AV_FRAME_DATA_DYNAMIC_HDR_VIVID,
+
+/**
+ * Sub frame of a target frame, as described by AVFrame.
+ */
+AV_FRAME_DATA_SUB_FRAME,
 };
 
 enum AVActiveFormatDescription {
diff --git a/libavutil/sub_frame_metadata.c b/libavutil/sub_frame_metadata.c
new file mode 100644
index 00..82ea32383f
--- /dev/null
+++ b/libavutil/sub_frame_metadata.c
@@ -0,0 +1,61 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "sub_frame_metadata.h"
+
+static void sub_frame_free(void *opaque, uint8_t *data)
+{
+AVFrame *frame = (AVFrame*)data;
+
+av_frame_free(&frame);
+}
+
+static AVFrame *sub_frame_alloc(size_t *out_size)
+{
+AVFrame *sub_frame = av_frame_alloc();
+if (!sub_frame)
+return NULL;
+
+*out_size = sizeof(*sub_frame);
+
+return sub_frame;
+}
+
+AVFrame *av_sub_frame_create_side_data(AVFrame *frame)
+{
+AVBufferRef *buf;
+AVFrame *sub_frame;
+size_t size;
+
+sub_frame = sub_frame_alloc(&size);
+if (!sub_frame)
+return NULL;
+
+buf = av_buffer_create((uint8_t *)sub_frame, size, &su

Re: [FFmpeg-devel] [PATCH v5 1/2] lavc/vaapi_encode: add support for maxframesize

2022-04-29 Thread Wang, Fei W



> -Original Message-
> From: Xiang, Haihao 
> Sent: Friday, April 29, 2022 1:18 PM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Wang, Fei W ; linjie...@intel.com
> Subject: Re: [FFmpeg-devel] [PATCH v5 1/2] lavc/vaapi_encode: add support for
> maxframesize
> 
> On Fri, 2022-04-22 at 13:36 +0800, Fei Wang wrote:
> > From: Linjie Fu 
> >
> > Add support for max frame size:
> > - max_frame_size (bytes) to indicate the max allowed size for frame.
> >
> > If the frame size exceeds the limitation, encoder will to control the
> > frame size by adjusting QP value.
> >
> > ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -f rawvideo \
> > -v verbose -s:v 352x288 -i ./input.yuv -vf format=nv12,hwupload \
> > -c:v h264_vaapi -profile:v main -g 30 -rc_mode VBR -b:v 500k   \
> > -bf 3 -max_frame_size 4 -vframes 100 -y
> > ./max_frame_size.h264
> >
> > Max frame size was enabled since VA-API version (0, 33, 0), but query
> > is available since (1, 5, 0). It will be passed as a parameter in
> > picParam and should be set for each frame.
> >
> > Signed-off-by: Linjie Fu 
> > Signed-off-by: Fei Wang 
> > ---
> > Change:
> > 1. use VAEncMiscParameterTypeMaxFrameSize to set max frame
> > parameters, which is a more generic way.
> >
> >  libavcodec/vaapi_encode.c | 65
> > +++
> >  libavcodec/vaapi_encode.h | 10 +-
> >  2 files changed, 74 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
> > index 0e2f5ed447..c2a39bc4ed 100644
> > --- a/libavcodec/vaapi_encode.c
> > +++ b/libavcodec/vaapi_encode.c
> > @@ -365,6 +365,17 @@ static int vaapi_encode_issue(AVCodecContext
> *avctx,
> >  goto fail;
> >  }
> >
> > +#if VA_CHECK_VERSION(1, 5, 0)
> > +if (ctx->max_frame_size) {
> > +err = vaapi_encode_make_misc_param_buffer(avctx, pic,
> > +
> > +VAEncMiscParameterTypeMaxFr
> > ameSize,
> > +  &ctx->mfs_params,
> > +  sizeof(ctx->mfs_params));
> > +if (err < 0)
> > +goto fail;
> > +}
> > +#endif
> > +
> >  if (pic->type == PICTURE_TYPE_IDR) {
> >  if (ctx->va_packed_headers & VA_ENC_PACKED_HEADER_SEQUENCE &&
> >  ctx->codec->write_sequence_header) { @@ -1869,6 +1880,54
> > @@ rc_mode_found:
> >  return 0;
> >  }
> >
> > +static av_cold int vaapi_encode_init_max_frame_size(AVCodecContext
> > +*avctx) { #if VA_CHECK_VERSION(1, 5, 0)
> > +VAAPIEncodeContext  *ctx = avctx->priv_data;
> > +VAConfigAttrib  attr = { VAConfigAttribMaxFrameSize };
> > +VAStatus vas;
> > +
> > +vas = vaGetConfigAttributes(ctx->hwctx->display,
> > +ctx->va_profile,
> > +ctx->va_entrypoint,
> > +&attr, 1);
> > +if (vas != VA_STATUS_SUCCESS) {
> > +ctx->max_frame_size = 0;
> > +av_log(avctx, AV_LOG_ERROR, "Failed to query max frame size "
> > +   "config attribute: %d (%s).\n", vas, vaErrorStr(vas));
> > +return AVERROR_EXTERNAL;
> > +}
> > +
> > +if (attr.value == VA_ATTRIB_NOT_SUPPORTED) {
> > +ctx->max_frame_size = 0;
> > +av_log(avctx, AV_LOG_WARNING, "Max frame size attribute "
> > +   "is not supported.\n");
> > +} else {
> > +VAConfigAttribValMaxFrameSize attr_mfs;
> > +attr_mfs.value = attr.value;
> > +// Prefer to use VAEncMiscParameterTypeMaxFrameSize for max
> > + frame
> > size.
> > +if (!attr_mfs.bits.max_frame_size && attr_mfs.bits.multiple_pass) {
> > +ctx->max_frame_size = 0;
> > +av_log(avctx, AV_LOG_WARNING, "Driver only support
> > + multiple pass
> > "
> > +   "max frame size which have not been implemented in
> > FFmpeg.\n");
> > +return 0;
> > +}
> > +
> > +ctx->mfs_params = (VAEncMiscParameterBufferMaxFrameSize){
> > +.max_frame_size = ctx->max_frame_size * 8,
> > +};
> > +
> > +av_log(avctx, AV_LOG_VERBOSE, "Max Frame Size: %d bytes.\n",
> > +   ctx->max_frame_size);
> > +}
> > +#else
> > +av_log(avctx, AV_LOG_WARNING, "Max Frame Size is not support with "
> > +   "this VA version.\n");
> > +#endif
> > +
> > +return 0;
> > +}
> > +
> >  static av_cold int vaapi_encode_init_gop_structure(AVCodecContext
> > *avctx)  {
> >  VAAPIEncodeContext *ctx = avctx->priv_data; @@ -2548,6 +2607,12
> > @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
> >  goto fail;
> >  }
> >
> > +if (ctx->va_rc_mode != VA_RC_CQP && ctx->max_frame_size) {
> > +err = vaapi_encode_init_max_frame_size(avctx);
> > +if (err < 0)
> > +goto fail;
> > +}
> 
> Set ctx->max_frame_size to 0 for CQP, otherwise
> VAEncMiscParameterTypeMaxFrameSize will be passed to 

[FFmpeg-devel] [PATCH v6 2/2] doc/vaapi_encode: add documentations for max_frame_size

2022-04-29 Thread Fei Wang
From: Linjie Fu 

Add docs for max_frame_size option.

Signed-off-by: Linjie Fu 
Signed-off-by: Fei Wang 
---
 doc/encoders.texi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 966032a720..43f6288e33 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -3665,6 +3665,11 @@ performance. This option doesn't work if driver doesn't 
implement vaSyncBuffer
 function. Please make sure there are enough hw_frames allocated if a large
 number of async_depth is used.
 
+@item max_frame_size
+Set the allowed max size in bytes for each frame. If the frame size exceeds
+the limitation, encoder will adjust the QP value to control the frame size.
+Invalid in CQP rate control mode.
+
 @item rc_mode
 Set the rate control mode to use.  A given driver may only support a subset of
 modes.
-- 
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 v6 1/2] lavc/vaapi_encode: add support for maxframesize

2022-04-29 Thread Fei Wang
From: Linjie Fu 

Add support for max frame size:
- max_frame_size (bytes) to indicate the max allowed size for frame.

If the frame size exceeds the limitation, encoder will to control the frame
size by adjusting QP value.

ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -f rawvideo \
-v verbose -s:v 352x288 -i ./input.yuv -vf format=nv12,hwupload \
-c:v h264_vaapi -profile:v main -g 30 -rc_mode VBR -b:v 500k   \
-bf 3 -max_frame_size 4 -vframes 100 -y ./max_frame_size.h264

Max frame size was enabled since VA-API version (0, 33, 0), but query is 
available
since (1, 5, 0). It will be passed as a parameter in picParam and should be set
for each frame.

Signed-off-by: Linjie Fu 
Signed-off-by: Fei Wang 
---
update:
Set ctx->max_frame_size to 0 in CQP mode to avoid to pass
VAEncMiscParameterTypeMaxFrameSize type VABuffer.

 libavcodec/vaapi_encode.c | 72 +++
 libavcodec/vaapi_encode.h | 10 +-
 2 files changed, 81 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 0e2f5ed447..3b96d4c671 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -365,6 +365,17 @@ static int vaapi_encode_issue(AVCodecContext *avctx,
 goto fail;
 }
 
+#if VA_CHECK_VERSION(1, 5, 0)
+if (ctx->max_frame_size) {
+err = vaapi_encode_make_misc_param_buffer(avctx, pic,
+  
VAEncMiscParameterTypeMaxFrameSize,
+  &ctx->mfs_params,
+  sizeof(ctx->mfs_params));
+if (err < 0)
+goto fail;
+}
+#endif
+
 if (pic->type == PICTURE_TYPE_IDR) {
 if (ctx->va_packed_headers & VA_ENC_PACKED_HEADER_SEQUENCE &&
 ctx->codec->write_sequence_header) {
@@ -1869,6 +1880,61 @@ rc_mode_found:
 return 0;
 }
 
+static av_cold int vaapi_encode_init_max_frame_size(AVCodecContext *avctx)
+{
+#if VA_CHECK_VERSION(1, 5, 0)
+VAAPIEncodeContext  *ctx = avctx->priv_data;
+VAConfigAttrib  attr = { VAConfigAttribMaxFrameSize };
+VAStatus vas;
+
+if (ctx->va_rc_mode == VA_RC_CQP) {
+ctx->max_frame_size = 0;
+av_log(avctx, AV_LOG_WARNING, "Max frame size is invalid in CQP rate "
+   "control mode.\n");
+return 0;
+}
+
+vas = vaGetConfigAttributes(ctx->hwctx->display,
+ctx->va_profile,
+ctx->va_entrypoint,
+&attr, 1);
+if (vas != VA_STATUS_SUCCESS) {
+ctx->max_frame_size = 0;
+av_log(avctx, AV_LOG_ERROR, "Failed to query max frame size "
+   "config attribute: %d (%s).\n", vas, vaErrorStr(vas));
+return AVERROR_EXTERNAL;
+}
+
+if (attr.value == VA_ATTRIB_NOT_SUPPORTED) {
+ctx->max_frame_size = 0;
+av_log(avctx, AV_LOG_WARNING, "Max frame size attribute "
+   "is not supported.\n");
+} else {
+VAConfigAttribValMaxFrameSize attr_mfs;
+attr_mfs.value = attr.value;
+// Prefer to use VAEncMiscParameterTypeMaxFrameSize for max frame size.
+if (!attr_mfs.bits.max_frame_size && attr_mfs.bits.multiple_pass) {
+ctx->max_frame_size = 0;
+av_log(avctx, AV_LOG_WARNING, "Driver only support multiple pass "
+   "max frame size which have not been implemented in 
FFmpeg.\n");
+return 0;
+}
+
+ctx->mfs_params = (VAEncMiscParameterBufferMaxFrameSize){
+.max_frame_size = ctx->max_frame_size * 8,
+};
+
+av_log(avctx, AV_LOG_VERBOSE, "Max Frame Size: %d bytes.\n",
+   ctx->max_frame_size);
+}
+#else
+av_log(avctx, AV_LOG_WARNING, "Max Frame Size is not support with "
+   "this VA version.\n");
+#endif
+
+return 0;
+}
+
 static av_cold int vaapi_encode_init_gop_structure(AVCodecContext *avctx)
 {
 VAAPIEncodeContext *ctx = avctx->priv_data;
@@ -2548,6 +2614,12 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
 goto fail;
 }
 
+if (ctx->max_frame_size) {
+err = vaapi_encode_init_max_frame_size(avctx);
+if (err < 0)
+goto fail;
+}
+
 vas = vaCreateConfig(ctx->hwctx->display,
  ctx->va_profile, ctx->va_entrypoint,
  ctx->config_attributes, ctx->nb_config_attributes,
diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h
index af0588c30b..359f954fff 100644
--- a/libavcodec/vaapi_encode.h
+++ b/libavcodec/vaapi_encode.h
@@ -191,6 +191,9 @@ typedef struct VAAPIEncodeContext {
 // Desired B frame reference depth.
 int desired_b_depth;
 
+// Max Frame Size
+int max_frame_size;
+
 // Explicitly set RC mode (otherwise attempt to pick from
 // available modes).
 int  

Re: [FFmpeg-devel] [PATCH 4/4] avfilter/vf_colormap: Avoid allocation of small array

2022-04-29 Thread Paul B Mahol
whole set lgtm
___
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".