Re: [FFmpeg-devel] [PATCH v2 05/31] avcodec/libvpxenc: use av_dict_iterate

2022-11-30 Thread James Zern
On Sat, Nov 26, 2022 at 6:47 AM Marvin Scholz  wrote:
>
> ---
>  libavcodec/libvpxenc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>

lgtm.

> diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
> index 667cffc200..9aa5510c28 100644
> --- a/libavcodec/libvpxenc.c
> +++ b/libavcodec/libvpxenc.c
> @@ -900,7 +900,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
>  vpx_codec_caps_t codec_caps = vpx_codec_get_caps(iface);
>  vpx_svc_extra_cfg_t svc_params;
>  #endif
> -AVDictionaryEntry* en = NULL;
> +const AVDictionaryEntry* en = NULL;
>
>  av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str());
>  av_log(avctx, AV_LOG_VERBOSE, "%s\n", vpx_codec_build_config());
> @@ -1072,7 +1072,7 @@ static av_cold int vpx_init(AVCodecContext *avctx,
>
>  enccfg.g_error_resilient = ctx->error_resilient || ctx->flags & 
> VP8F_ERROR_RESILIENT;
>
> -while ((en = av_dict_get(ctx->vpx_ts_parameters, "", en, 
> AV_DICT_IGNORE_SUFFIX))) {
> +while ((en = av_dict_iterate(ctx->vpx_ts_parameters, en))) {
>  if (vpx_ts_param_parse(ctx, &enccfg, en->key, en->value, 
> avctx->codec_id) < 0)
>  av_log(avctx, AV_LOG_WARNING,
> "Error parsing option '%s = %s'.\n",
> --
> 2.37.0 (Apple Git-136)
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 2/5] avcodec/wavpack: Fix overflow in k=31

2022-11-30 Thread Michael Niedermayer
On Sun, Sep 11, 2022 at 04:27:18PM +0200, Michael Niedermayer wrote:
> Untested with "non fuzzed" samples as i have no such file
> 
> Fixes: shift exponent 32 is too large for 32-bit type 'int'
> Fixes: 
> 50930/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-6319201949712384
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/wavpack.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

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

Dictatorship: All citizens are under surveillance, all their steps and
actions recorded, for the politicians to enforce control.
Democracy: All politicians are under surveillance, all their steps and
actions recorded, for the citizens to enforce control.


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

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


Re: [FFmpeg-devel] [PATCH 3/5] avcodec/wavpack: Check for end of input in wv_unpack_dsd_high()

2022-11-30 Thread Michael Niedermayer
On Sun, Sep 11, 2022 at 04:27:19PM +0200, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 
> 50793/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-4980185027444736
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/wavpack.c | 4 
>  1 file changed, 4 insertions(+)

will apply

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

If you drop bombs on a foreign country and kill a hundred thousand
innocent people, expect your government to call the consequence
"unprovoked inhuman terrorist attacks" and use it to justify dropping
more bombs and killing more people. The technology changed, the idea is old.


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

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


Re: [FFmpeg-devel] [PATCH 2/5] avcodec/wavpack: Fix overflow in k=31

2022-11-30 Thread Paul B Mahol
On 9/11/22, Michael Niedermayer  wrote:
> Untested with "non fuzzed" samples as i have no such file
>

Then create it.

> Fixes: shift exponent 32 is too large for 32-bit type 'int'
> Fixes:
> 50930/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-6319201949712384
>
> Found-by: continuous fuzzing process
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/wavpack.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
> index 7aa1f65e17b..b4d19df7ea2 100644
> --- a/libavcodec/wavpack.c
> +++ b/libavcodec/wavpack.c
> @@ -126,7 +126,7 @@ static av_always_inline unsigned get_tail(GetBitContext
> *gb, unsigned k)
>  if (k < 1)
>  return 0;
>  p   = av_log2(k);
> -e   = (1 << (p + 1)) - k - 1;
> +e   = (1LL << (p + 1)) - k - 1;
>  res = get_bits_long(gb, p);
>  if (res >= e)
>  res = (res << 1) - e + get_bits1(gb);
> --
> 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 mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH] avcodec/h274: fix include

2022-11-30 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libavcodec/h274.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/h274.h b/libavcodec/h274.h
index 807b3a016a..920f6991fb 100644
--- a/libavcodec/h274.h
+++ b/libavcodec/h274.h
@@ -28,7 +28,7 @@
 #ifndef AVCODEC_H274_H
 #define AVCODEC_H274_H
 
-#include 
+#include "libavutil/film_grain_params.h"
 
 // Must be initialized to {0} prior to first usage
 typedef struct H274FilmGrainDatabase {
-- 
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 07/31] avutil: use av_dict_iterate

2022-11-30 Thread Marvin Scholz
On 27 Nov 2022, at 16:06, James Almer wrote:

> On 11/26/2022 11:46 AM, Marvin Scholz wrote:
>> ---
>>   libavutil/opt.c| 12 ++--
>>   libavutil/tests/dict.c |  2 +-
>>   2 files changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/libavutil/opt.c b/libavutil/opt.c
>> index a3940f47fb..0a909a8b22 100644
>> --- a/libavutil/opt.c
>> +++ b/libavutil/opt.c
>> @@ -1742,14 +1742,14 @@ void av_opt_free(void *obj)
>>int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
>>   {
>> -AVDictionaryEntry *t = NULL;
>> +const AVDictionaryEntry *t = NULL;
>>   AVDictionary*tmp = NULL;
>>   int ret;
>>if (!options)
>>   return 0;
>>  -while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) {
>> +while ((t = av_dict_iterate(*options, t))) {
>>   ret = av_opt_set(obj, t->key, t->value, search_flags);
>>   if (ret == AVERROR_OPTION_NOT_FOUND)
>>   ret = av_dict_set(&tmp, t->key, t->value, 0);
>> @@ -2137,16 +2137,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
>>   case AV_OPT_TYPE_DICT: {
>>   AVDictionary *dict1 = NULL;
>>   AVDictionary *dict2 = *(AVDictionary **)dst;
>> -AVDictionaryEntry *en1 = NULL;
>> -AVDictionaryEntry *en2 = NULL;
>> +const AVDictionaryEntry *en1 = NULL;
>> +const AVDictionaryEntry *en2 = NULL;
>>   ret = av_dict_parse_string(&dict1, o->default_val.str, "=", ":", 
>> 0);
>>   if (ret < 0) {
>>   av_dict_free(&dict1);
>>   return ret;
>>   }
>>   do {
>> -en1 = av_dict_get(dict1, "", en1, AV_DICT_IGNORE_SUFFIX);
>> -en2 = av_dict_get(dict2, "", en2, AV_DICT_IGNORE_SUFFIX);
>> +en1 = av_dict_iterate(dict1, en1);
>> +en2 = av_dict_iterate(dict2, en2);
>>   } while (en1 && en2 && !strcmp(en1->key, en2->key) && 
>> !strcmp(en1->value, en2->value));
>>   av_dict_free(&dict1);
>>   return (!en1 && !en2);
>> diff --git a/libavutil/tests/dict.c b/libavutil/tests/dict.c
>> index d053545f4d..91567289c2 100644
>> --- a/libavutil/tests/dict.c
>> +++ b/libavutil/tests/dict.c
>> @@ -52,7 +52,7 @@ static void test_separators(const AVDictionary *m, const 
>> char pair, const char v
>>   int main(void)
>>   {
>>   AVDictionary *dict = NULL;
>> -AVDictionaryEntry *e;
>> +const AVDictionaryEntry *e;
>
> Spurious change? You're not touching the test otherwise.

Oh indeed!.

>
> In any case, feel free to add the following to this patch:
>
>> diff --git a/libavutil/tests/dict.c b/libavutil/tests/dict.c
>> index d053545f4d..468391a9f3 100644
>> --- a/libavutil/tests/dict.c
>> +++ b/libavutil/tests/dict.c
>> @@ -52,7 +52,7 @@ static void test_separators(const AVDictionary *m, const 
>> char pair, const char v
>>  int main(void)
>>  {
>>  AVDictionary *dict = NULL;
>> -AVDictionaryEntry *e;
>> +const AVDictionaryEntry *e;
>>  char *buffer = NULL;
>>
>>  printf("Testing av_dict_get_string() and av_dict_parse_string()\n");
>> @@ -94,8 +94,13 @@ int main(void)
>>  if (av_dict_get(dict, NULL, NULL, 0))
>>  printf("av_dict_get() does not correctly handle NULL key.\n");
>>  e = NULL;
>> +printf("Iterating with av_dict_get()\n");
>>  while ((e = av_dict_get(dict, "", e, AV_DICT_IGNORE_SUFFIX)))
>>  printf("%s %s\n", e->key, e->value);
>> +e = NULL;
>> +printf("Iterating with av_dict_iterate()\n");
>> +while ((e = av_dict_iterate(dict, e)))
>> +printf("%s %s\n", e->key, e->value);
>>  av_dict_free(&dict);
>>
>>  if (av_dict_set(&dict, NULL, "a", 0) >= 0 ||
>> diff --git a/tests/ref/fate/dict b/tests/ref/fate/dict
>> index 7205e4c845..a519b49163 100644
>> --- a/tests/ref/fate/dict
>> +++ b/tests/ref/fate/dict
>> @@ -30,6 +30,14 @@ ret 0
>>  aaa aaa   bbb bbb   ccc ccc   \,='" \,='"
>>
>>  Testing av_dict_set()
>> +Iterating with av_dict_get()
>> +a a
>> +b b
>> +c c
>> +d d
>> +e e
>> +ff ff
>> +Iterating with av_dict_iterate()
>>  a a
>>  b b
>>  c c
>
> That should be enough to compare the output of both functions.

I see, thanks. Do you want to apply this change to the patch
when merging saving an unnecessary round trip to the ML?

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

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


Re: [FFmpeg-devel] [PATCH 3/3] tools/target_dec_fuzzer: Adjust threshold for RSCC

2022-11-30 Thread Michael Niedermayer
On Sun, Nov 27, 2022 at 11:34:35PM +0100, Michael Niedermayer wrote:
> Fixes: Timeout
> Fixes: 
> 53681/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_RSCC_fuzzer-6627455180079104
> 
> 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 | 1 +
>  1 file changed, 1 insertion(+)

will apply

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

The worst form of inequality is to try to make unequal things equal.
-- Aristotle


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

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


[FFmpeg-devel] [PATCH] avcodec/mpeg12dec: Check input size

2022-11-30 Thread Michael Niedermayer
Fixes: Timeout
Fixes: 
53599/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IPU_fuzzer-4950102511058944

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

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 914516bbd9..fb20e3c313 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -2969,6 +2969,10 @@ static int ipu_decode_frame(AVCodecContext *avctx, 
AVFrame *frame,
 GetBitContext *gb = &m->gb;
 int ret;
 
+// Check for minimal intra MB size (considering mb header, luma & chroma 
dc VLC, ac EOB VLC)
+if (avpkt->size*8LL < (avctx->width+15)/16 * ((avctx->height+15)/16) * (2 
+ 3*4 + 2*2 + 2*6))
+return AVERROR_INVALIDDATA;
+
 ret = ff_get_buffer(avctx, frame, 0);
 if (ret < 0)
 return ret;
-- 
2.17.1

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

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


Re: [FFmpeg-devel] [PATCH v5 2/2] lavc/vaapi_decode: add support for HWACCEL_CAP_RESET_WITHOUT_UNINIT

2022-11-30 Thread Wang, Fei W
On Mon, 2022-11-28 at 13:20 +, Mark Thompson wrote:
> On 14/11/2022 01:16, Fei Wang wrote:
> > This can fix vp9 decode image corruption when the frame size is
> > change,
> > but the pervious frames still be referenced.
> > 
> > Surfaces don't need to be bound to vaContext only after VAAPI
> > 1.0.0:
> > https://github.com/intel/libva/commit/492b692005ccd0d8da190209d5b3ae7b7825f4b8
> > 
> > Signed-off-by: Fei Wang 
> > ---
> >   libavcodec/vaapi_decode.c | 11 ---
> >   libavcodec/vaapi_decode.h |  1 +
> >   libavcodec/vaapi_vp9.c|  4 
> >   3 files changed, 13 insertions(+), 3 deletions(-)
> 
> This always segfaults immediately on anything unsupported.  E.g. with
> fate/hevc/paramchange_yuv420p_yuv420p10.hevc:
> 
> [hevc @ 0x57c0e7c0] Format vaapi chosen by get_format().
> [hevc @ 0x57c0e7c0] Format vaapi requires hwaccel initialisation.
> [hevc @ 0x57c0e7c0] Hardware does not support image size
> 1056x8440 (constraints: width 0-4096 height 0-4096).
> 
> Thread 20 "av:hevc:df0" received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x7fffb4ff9700 (LWP 509456)]
> ff_vaapi_decode_uninit (avctx=0x57c0e7c0) at
> src/libavcodec/vaapi_decode.c:714
> 714 vas = vaDestroyContext(ctx->hwctx->display, ctx-
> >va_context);
> (gdb) bt
> #0  ff_vaapi_decode_uninit (avctx=0x57c0e7c0) at
> src/libavcodec/vaapi_decode.c:714
> #1  0x563073d7 in ff_vaapi_decode_init (avctx=0x57c0e7c0)
> at src/libavcodec/vaapi_decode.c:704
> #2  0x55e62fee in hwaccel_init (avctx=0x57c0e7c0,
> hw_config=0x5728f770 <__compound_literal.0>) at
> src/libavcodec/decode.c:1121
> #3  0x55e634ec in ff_get_format (avctx=0x57c0e7c0,
> fmt=0x7fffb4ff8ccc) at src/libavcodec/decode.c:1261
> #4  0x561ca829 in ff_thread_get_format (avctx=0x57c0e7c0,
> fmt=0x7fffb4ff8ccc) at src/libavcodec/pthread_frame.c:1048
> #5  0x55f68f37 in get_format (s=0x57c3e6c0,
> sps=0x57c21f80) at src/libavcodec/hevcdec.c:505
> #6  0x55f69621 in hls_slice_header (s=0x57c3e6c0) at
> src/libavcodec/hevcdec.c:618
> #7  0x55f7472d in decode_nal_unit (s=0x57c3e6c0,
> nal=0x7fff8802e920) at src/libavcodec/hevcdec.c:3173
> #8  0x55f7508a in decode_nal_units (s=0x57c3e6c0,
> buf=0x7637c010 "", length=159280) at
> src/libavcodec/hevcdec.c:3355
> #9  0x55f756d6 in hevc_decode_frame (avctx=0x57c0e7c0,
> rframe=0x57c0ecc0, got_output=0x57c0d690,
> avpkt=0x57c0ef40) at src/libavcodec/hevcdec.c:3497
> #10 0x561c839c in frame_worker_thread (arg=0x57c0d580) at
> src/libavcodec/pthread_frame.c:241
> #11 0x768ccea7 in start_thread (arg=) at
> pthread_create.c:477
> #12 0x767ecaef in clone () at
> ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
> (gdb)

Thanks, will fix this in next version.

> 
> 
> Also, I don't see how this is testing whether the driver supports
> changing the resolution at runtime?  The note in libva that you cite
> allows new switching render targets in the context, but I don't see
> why different resolution would be allowed given that it's a parameter
> passed to vaCreateContext()?
> 
> Looking at the Mesa driver it appears that the internally-allocated
> references are not going to allow size changes (where does the
> template width get updated?).  I don't have any hardware to test
> that, though - are you able to try this on recent AMD hardware with
> VP9 support?

I checked on AMD RX6700XT, it can get correct output when decoding
multi-resolution vp9 clips only after apply this patchset. For example,
by using clip from:
https://storage.googleapis.com/downloads.webmproject.org/vp9/decoder-test-streams/Profile_0_8bit.zip

VP9 native decode result:
ffmpeg -i
Profile_0_8bit/frm_resize/crowd_run_1080X512_fr30_bd8_frm_resize_l3.web
m -pix_fmt yuv420p -autoscale 0 -f md5 -y -
[...]
MD5=51b3393fa98ad9ab99c0b45ef705ebc4
[...]

Without this patchset:
ffmpeg -v verbose -hwaccel vaapi -i
Profile_0_8bit/frm_resize/crowd_run_1080X512_fr30_bd8_frm_resize_l3.web
m -pix_fmt yuv420p -autoscale 0 -f md5 -y -
[...]
[AVHWDeviceContext @ 0x56526336a000] VAAPI driver: Mesa Gallium driver
22.3.0-rc4 for AMD Radeon RX 6700 XT (navi22, LLVM 11.0.0, DRM 3.44,
5.13.0-40-generic).
[...]
MD5=2e799f0f916195f86a356907f7e4eae1 (change from time to time, but
never same with native decode result)
[...]

With this patchset:
ffmpeg -v verbose -hwaccel vaapi -i
Profile_0_8bit/frm_resize/crowd_run_1080X512_fr30_bd8_frm_resize_l3.web
m -pix_fmt yuv420p -autoscale 0 -f md5 -y -
[...]
[AVHWDeviceContext @ 0x561c08e7a000] VAAPI driver: Mesa Gallium driver
22.3.0-rc4 for AMD Radeon RX 6700 XT (navi22, LLVM 11.0.0, DRM 3.44,
5.13.0-40-generic).
[...]
MD5=51b3393fa98ad9ab99c0b45ef705ebc4
[...]

That means both Intel and AMD driver implementation doesn't limit
surface's resolution must be same with vacontext. So I think we can add
some description to libva to declare that.

> 
> What have you done to 

[FFmpeg-devel] [PATCH v2] libavfilter/qsvvpp: Use different alignment for YUV420P format

2022-11-30 Thread wenbin . chen-at-intel . com
From: Wenbin Chen 

When process yuv420 frames, FFmpeg uses same alignment on Y/U/V
planes. VPL and MSDK use Y plane's pitch / 2 as U/V planes's
pitch, which makes U/V planes 16-bytes aligned. We need to set
a separate alignment to meet runtime's behaviour.

Now alignment is changed to 16 so that the linesizes of U/V planes
meet the requirment of VPL/MSDK. Add get_buffer.video callback to
qsv filters to change the default get_buffer behaviour.

Now the commandline works fine:
ffmpeg -f rawvideo -pix_fmt yuv420p -s:v 3082x1884 \
-i ./3082x1884.yuv -vf 'vpp_qsv=w=2466:h=1508' -f rawvideo \
-pix_fmt yuv420p 2466_1508.yuv

Signed-off-by: Wenbin Chen 
---
 libavfilter/qsvvpp.c | 13 +
 libavfilter/qsvvpp.h |  1 +
 libavfilter/vf_deinterlace_qsv.c |  1 +
 libavfilter/vf_overlay_qsv.c |  2 ++
 libavfilter/vf_scale_qsv.c   |  1 +
 libavfilter/vf_vpp_qsv.c |  1 +
 6 files changed, 19 insertions(+)

diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index 8428ee89ab..d5cfeab402 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -1003,3 +1003,16 @@ int ff_qsvvpp_create_mfx_session(void *ctx,
 }
 
 #endif
+
+AVFrame *ff_qsvvpp_get_video_buffer(AVFilterLink *inlink, int w, int h)
+{
+/* When process YUV420 frames, FFmpeg uses same alignment on Y/U/V
+ * planes. VPL and MSDK use Y plane's pitch / 2 as U/V planes's
+ * pitch, which makes U/V planes 16-bytes aligned. We need to set a
+ * separate alignment to meet runtime's behaviour.
+*/
+return ff_default_get_video_buffer2(inlink,
+FFALIGN(inlink->w, 32),
+FFALIGN(inlink->h, 32),
+16);
+}
diff --git a/libavfilter/qsvvpp.h b/libavfilter/qsvvpp.h
index a8cfcc565a..6f7c9bfc15 100644
--- a/libavfilter/qsvvpp.h
+++ b/libavfilter/qsvvpp.h
@@ -127,4 +127,5 @@ int ff_qsvvpp_print_warning(void *log_ctx, mfxStatus err,
 int ff_qsvvpp_create_mfx_session(void *ctx, void *loader, mfxIMPL 
implementation,
  mfxVersion *pver, mfxSession *psession);
 
+AVFrame *ff_qsvvpp_get_video_buffer(AVFilterLink *inlink, int w, int h);
 #endif /* AVFILTER_QSVVPP_H */
diff --git a/libavfilter/vf_deinterlace_qsv.c b/libavfilter/vf_deinterlace_qsv.c
index 98ed7283ad..6c94923f02 100644
--- a/libavfilter/vf_deinterlace_qsv.c
+++ b/libavfilter/vf_deinterlace_qsv.c
@@ -581,6 +581,7 @@ static const AVFilterPad qsvdeint_inputs[] = {
 .name = "default",
 .type = AVMEDIA_TYPE_VIDEO,
 .filter_frame = qsvdeint_filter_frame,
+.get_buffer.video = ff_qsvvpp_get_video_buffer,
 },
 };
 
diff --git a/libavfilter/vf_overlay_qsv.c b/libavfilter/vf_overlay_qsv.c
index d947a1faa1..1a2c1b1e96 100644
--- a/libavfilter/vf_overlay_qsv.c
+++ b/libavfilter/vf_overlay_qsv.c
@@ -399,11 +399,13 @@ static const AVFilterPad overlay_qsv_inputs[] = {
 .name  = "main",
 .type  = AVMEDIA_TYPE_VIDEO,
 .config_props  = config_main_input,
+.get_buffer.video = ff_qsvvpp_get_video_buffer,
 },
 {
 .name  = "overlay",
 .type  = AVMEDIA_TYPE_VIDEO,
 .config_props  = config_overlay_input,
+.get_buffer.video = ff_qsvvpp_get_video_buffer,
 },
 };
 
diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c
index 758e730f78..36d5f3a6ec 100644
--- a/libavfilter/vf_scale_qsv.c
+++ b/libavfilter/vf_scale_qsv.c
@@ -641,6 +641,7 @@ static const AVFilterPad qsvscale_inputs[] = {
 .name = "default",
 .type = AVMEDIA_TYPE_VIDEO,
 .filter_frame = qsvscale_filter_frame,
+.get_buffer.video = ff_qsvvpp_get_video_buffer,
 },
 };
 
diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c
index 4a053f9145..b26d19c3bc 100644
--- a/libavfilter/vf_vpp_qsv.c
+++ b/libavfilter/vf_vpp_qsv.c
@@ -634,6 +634,7 @@ static const AVFilterPad vpp_inputs[] = {
 .name  = "default",
 .type  = AVMEDIA_TYPE_VIDEO,
 .config_props  = config_input,
+.get_buffer.video = ff_qsvvpp_get_video_buffer,
 },
 };
 
-- 
2.34.1

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

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


Re: [FFmpeg-devel] [PATCH v2 0/3] Some small ASS conversion fixes

2022-11-30 Thread Oneric
On Sun, Nov 20, 2022 at 01:15:33 +0100, Oneric wrote:
> On Sun, Nov 13, 2022 at 20:57:15 +0100, Oneric wrote:
> > This fixes colours and font selection for files converted to ASS
> 
> Ping.
> 
> As a reminder v1 and v2 are equivalent and patchwork is buggy and can
> thus neither apply v1 or v2 and its results can be ignored and its patch
> or diff downloads should not be used, because they are corrupted.
> 
> v1 can be applied from the mails received from the list, v2 can be applied
> the same way for patch one and two, but you may need to use --keep-cr and
> because it turns out not only patchwork but also the mailinglist software
> mangles the transfer encoding, patch three of v2 cannot applied from the
> Mail received by the list.
> As an alternative I previously attached an archive (so the list won’t
> mangle it again) containing the three format-patch files, see:
>   https://ffmpeg.org/pipermail/ffmpeg-devel/2022-November/303904.html
> 
> As before, if you’d prefer to get a v3 where all mails can be applied from
> the list directly and no binary diff is used, tell me and I’ll send a v3
> forcing base64-encoding from git send-email and including some non-ASCII
> characters in the patch comment, since this appeared to make the list keep
> the base64 transfer-encoding for patch 2 v2.

Ping #2


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

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


[FFmpeg-devel] [PATCH] avcodec/mathops: Optimize generic mid_pred function

2022-11-30 Thread Junxian Zhu
From: Junxian Zhu 

Rewrite mid_pred function in generic mathops.h, reduce branch jump to improve 
performance. And because nowadays new version compiler can compile enough short 
asmbbely code as handwritting in these function, so remove specified optimized 
mips inline asmbbely mathops.h.

Signed-off-by: Junxian Zhu 
---
 libavcodec/mathops.h  | 20 
 libavcodec/mips/mathops.h | 67 ---
 2 files changed, 6 insertions(+), 81 deletions(-)
 delete mode 100644 libavcodec/mips/mathops.h

diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h
index c89054d6ed..526ffe0eec 100644
--- a/libavcodec/mathops.h
+++ b/libavcodec/mathops.h
@@ -41,8 +41,6 @@ extern const uint8_t ff_zigzag_scan[16+1];
 #   include "arm/mathops.h"
 #elif ARCH_AVR32
 #   include "avr32/mathops.h"
-#elif ARCH_MIPS
-#   include "mips/mathops.h"
 #elif ARCH_PPC
 #   include "ppc/mathops.h"
 #elif ARCH_X86
@@ -98,18 +96,12 @@ static av_always_inline unsigned UMULH(unsigned a, unsigned 
b){
 #define mid_pred mid_pred
 static inline av_const int mid_pred(int a, int b, int c)
 {
-if(a>b){
-if(c>b){
-if(c>a) b=a;
-elseb=c;
-}
-}else{
-if(b>c){
-if(c>a) b=c;
-elseb=a;
-}
-}
-return b;
+int t0,t1,t2,t3;
+t0 = (a > b) ? b : a ;
+t1 = (a > b) ? a : b ;
+t2 = (t0 > c) ? t0 : c;
+t3 = (t1 > t2) ? t2 : t1;
+return t3; 
 }
 #endif
 
diff --git a/libavcodec/mips/mathops.h b/libavcodec/mips/mathops.h
deleted file mode 100644
index bb9dc8375a..00
--- a/libavcodec/mips/mathops.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2009 Mans Rullgard 
- * Copyright (c) 2015 Zhou Xiaoyong 
- *
- * 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
- */
-
-#ifndef AVCODEC_MIPS_MATHOPS_H
-#define AVCODEC_MIPS_MATHOPS_H
-
-#include 
-#include "config.h"
-#include "libavutil/common.h"
-
-#if HAVE_INLINE_ASM
-
-#if HAVE_LOONGSON3
-
-#define MULH MULH
-static inline av_const int MULH(int a, int b)
-{
-int c;
-__asm__ ("dmult %1, %2  \n\t"
- "mflo %0   \n\t"
- "dsrl %0, %0, 32   \n\t"
- : "=r"(c)
- : "r"(a),"r"(b)
- : "hi", "lo");
-return c;
-}
-
-#define mid_pred mid_pred
-static inline av_const int mid_pred(int a, int b, int c)
-{
-int t = b;
-__asm__ ("sgt $8, %1, %2\n\t"
- "movn %0, %1, $8   \n\t"
- "movn %1, %2, $8   \n\t"
- "sgt $8, %1, %3\n\t"
- "movz %1, %3, $8   \n\t"
- "sgt $8, %0, %1\n\t"
- "movn %0, %1, $8   \n\t"
- : "+&r"(t),"+&r"(a)
- : "r"(b),"r"(c)
- : "$8");
-return t;
-}
-
-#endif /* HAVE_LOONGSON3 */
-
-#endif /* HAVE_INLINE_ASM */
-
-#endif /* AVCODEC_MIPS_MATHOPS_H */
-- 
2.38.1.windows.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] mips: fix build fail on MIPS R6

2022-11-30 Thread Junxian Zhu
From: Junxian Zhu 

Add macro define to avoid causing build fail with incompatible assembler code 
on MIPS R6.

Signed-off-by: Junxian Zhu 
---
 libavcodec/mips/cabac.h   | 2 ++
 libavcodec/mips/compute_antialias_fixed.h | 2 ++
 libavutil/mips/generic_macros_msa.h   | 6 +++---
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mips/cabac.h b/libavcodec/mips/cabac.h
index 39c308c7e0..20ecab4320 100644
--- a/libavcodec/mips/cabac.h
+++ b/libavcodec/mips/cabac.h
@@ -30,6 +30,7 @@
 #include "libavutil/mips/mmiutils.h"
 #include "config.h"
 
+#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
 #define get_cabac_inline get_cabac_inline_mips
 static av_always_inline int get_cabac_inline_mips(CABACContext *c,
   uint8_t * const state){
@@ -225,4 +226,5 @@ static av_always_inline int 
get_cabac_bypass_sign_mips(CABACContext *c, int val)
 
 return res;
 }
+#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
 #endif /* AVCODEC_MIPS_CABAC_H */
diff --git a/libavcodec/mips/compute_antialias_fixed.h 
b/libavcodec/mips/compute_antialias_fixed.h
index 1f395d2302..982002ad4c 100644
--- a/libavcodec/mips/compute_antialias_fixed.h
+++ b/libavcodec/mips/compute_antialias_fixed.h
@@ -56,6 +56,7 @@
 #define AVCODEC_MIPS_COMPUTE_ANTIALIAS_FIXED_H
 
 #if HAVE_INLINE_ASM
+#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
 static void compute_antialias_mips_fixed(MPADecodeContext *s,
 GranuleDef *g)
 {
@@ -246,6 +247,7 @@ static void compute_antialias_mips_fixed(MPADecodeContext 
*s,
 }
 }
 #define compute_antialias compute_antialias_mips_fixed
+#endif /* !HAVE_MIPS32R6 && !HAVE_MIPS64R6 */
 #endif /* HAVE_INLINE_ASM */
 
 #endif /* AVCODEC_MIPS_COMPUTE_ANTIALIAS_FIXED_H */
diff --git a/libavutil/mips/generic_macros_msa.h 
b/libavutil/mips/generic_macros_msa.h
index 1486f7296e..9beb0443ed 100644
--- a/libavutil/mips/generic_macros_msa.h
+++ b/libavutil/mips/generic_macros_msa.h
@@ -44,7 +44,7 @@
 #define ST_UW(...) ST_V(v4u32, __VA_ARGS__)
 #define ST_SW(...) ST_V(v4i32, __VA_ARGS__)
 
-#if (__mips_isa_rev >= 6)
+#if HAVE_MIPS32R6 || HAVE_MIPS64R6
 #define LH(psrc)  \
 ( {   \
 uint16_t val_lh_m = *(uint16_t *)(psrc);  \
@@ -85,7 +85,7 @@
 #define SW(val, pdst)  *(uint32_t *)(pdst) = (val);
 #define SD(val, pdst)  *(uint64_t *)(pdst) = (val);
 
-#else  // !(__mips_isa_rev >= 6)
+#else  // !HAVE_MIPS32R6 && !HAVE_MIPS64R6
 #define LH(psrc) \
 ( {  \
 uint8_t *psrc_lh_m = (uint8_t *) (psrc); \
@@ -188,7 +188,7 @@
 SW(val0_sd_m, pdst_sd_m); \
 SW(val1_sd_m, pdst_sd_m + 4); \
 }
-#endif // (__mips_isa_rev >= 6)
+#endif // HAVE_MIPS32R6 || HAVE_MIPS64R6
 
 /* Description : Load 4 words with stride
Arguments   : Inputs  - psrc(source pointer to load from)
-- 
2.38.1.windows.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".