Re: [FFmpeg-devel] [PATCH] qsv: check for libmfx.pc instead of mfx.pc

2022-05-26 Thread Xiang, Haihao
On Thu, 2022-05-26 at 10:32 +0800, Haihao Xiang wrote:
> This fixed the regression caused by commit 478e1a98a
> 
> Reported-by: Timo Rothenpieler 
> Signed-off-by: Haihao Xiang 
> ---
>  configure | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 6cf7d89674..5a167613a4 100755
> --- a/configure
> +++ b/configure
> @@ -6565,7 +6565,7 @@ enabled liblensfun&& require_pkg_config
> liblensfun lensfun lensfun.h lf_
>  # Media SDK or Intel Media Server Studio, these don't come with
>  # pkg-config support.  Instead, users should make sure that the build
>  # can find the libraries and headers through other means.
> -enabled libmfx&& { check_pkg_config libmfx "mfx >= 1.28"
> "mfx/mfxvideo.h" MFXInit ||
> +enabled libmfx&& { check_pkg_config libmfx "libmfx >= 1.28"
> "mfx/mfxvideo.h" MFXInit ||
> { require libmfx "mfx/mfxvideo.h
> mfx/mfxdefs.h" MFXInit "-llibmfx $advapi32_extralibs" &&
>   { test_cpp_condition mfx/mfxdefs.h
> "MFX_VERSION >= 1028" || die "ERROR: libmfx version must be >= 1.28"; }  &&
>   warn "using libmfx without pkg-config"; } }

Will apply,

-Haihao

___
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 v8 0/3] Support long file names on Windows

2022-05-26 Thread Martin Storsjö

On Thu, 26 May 2022, ffmpegagent wrote:


This patchset adds support for long file and directory paths on Windows. The
implementation follows the same logic that .NET is using internally, with
the only exception that it doesn't expand short path components in 8.3
format. .NET does this as the same function is also used for other purposes,
but in our case, that's not required. Short (8.3) paths are working as well
with the extended path prefix, even when longer than 260.

Successfully tested:

* Regular paths wth drive letter
* Regular UNC paths
* Long paths wth drive letter
* Long paths wth drive letter and forward slashes
* Long UNC paths
* Prefixed paths wth drive letter
* Prefixed UNC paths

I have kept the individual functions separate on purpose, to make it easy to
compare with the .NET impl. (compilers should inlinie those anyway)

v2

* wchar_filename: Improve comments and function documentation
* os_support: adjust defines to use win32_stat

v3

* removed length check in path_is_extended()
* added path_is_device_path() check in add_extended_prefix()
* add_extended_prefix(): clarified doc and add checks
* clarified string allocation length calculation
* replaced 260 with MAX_PATH
* removed redundant checks after normalization

v4

* rebased. no changes

v5

* resolved the ugly struct duplication
* compatible with _USE_32BIT_TIME_T

v6

* wchar_filename.h: added links to .NET source code
* wchar_filename.h: free allocations on error
* os_support.hs: use clean and safe way to redirect stat() calls

v7

* os_support.h: remapped fstat with win32_stat structure
* os_support.h: use int64_t for some members
* avformat/file: remove _WIN32 condition

v8

* os_support.h: documented win32_stat structure
* os_support.h: renamed function parameters

softworkz (3):
 avutil/wchar_filename,file_open: Support long file names on Windows
 avformat/os_support: Support long file names on Windows
 avformat/file: remove _WIN32 condition

libavformat/file.c |   4 -
libavformat/os_support.h   | 116 ++--
libavutil/file_open.c  |   2 +-
libavutil/wchar_filename.h | 180 +
4 files changed, 272 insertions(+), 30 deletions(-)


This is still ok with me, fwiw.

// Martin

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

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


Re: [FFmpeg-devel] [PATCH v3 0/2] checkasm: added additional dstW tests for hscale

2022-05-26 Thread Martin Storsjö

On Thu, 26 May 2022, Swinney, Jonathan wrote:


I have fixed the test to work correctly on x86 and addressed the other small 
issues. Thanks for reviewing!



Thanks - this iteration seems fine to me! (I can touch up minor details 
like changing "add #-32" into "sub #32" before pushing.) I'll push these 
two patches in a day or two unless anything else comes up.


// Martin

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

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


Re: [FFmpeg-devel] [PATCH v3 2/2] swscale/aarch64: add hscale specializations

2022-05-26 Thread Martin Storsjö

On Thu, 26 May 2022, J. Dekker wrote:


+
+// gather random access data from src into contiguous memory
+ldr w8, [x3, w8, UXTW]  // src[filterPos[idx + 
0]][0..3]

Current asm code has lowercase uxtw, would prefer to keep it consistent.

+ldr w9, [x3, w9, UXTW]  // src[filterPos[idx + 
1]][0..3]
+ldr w10, [x3, w10, UXTW]// src[filterPos[idx + 
2]][0..3]
+ldr w11, [x3, w11, UXTW]// src[filterPos[idx + 
3]][0..3]
+ldr w12, [x3, w12, UXTW]// src[filterPos[idx + 
4]][0..3]
+ldr w13, [x3, w13, UXTW]// src[filterPos[idx + 
5]][0..3]
+ldr w14, [x3, w14, UXTW]// src[filterPos[idx + 
6]][0..3]
+ldr w15, [x3, w15, UXTW]// src[filterPos[idx + 
7]][0..3]
+stp w8, w9, [sp]// *scratch_mem = { 
src[filterPos[idx + 0]][0..3], src[filterPos[idx + 1]][0..3] }
+stp w10, w11, [sp, #8]  // *scratch_mem = { 
src[filterPos[idx + 2]][0..3], src[filterPos[idx + 3]][0..3] }
+stp w12, w13, [sp, #16] // *scratch_mem = { 
src[filterPos[idx + 4]][0..3], src[filterPos[idx + 5]][0..3] }
+stp w14, w15, [sp, #24] // *scratch_mem = { 
src[filterPos[idx + 6]][0..3], src[filterPos[idx + 7]][0..3] }
+
+1:
+ld4 {v16.8B, v17.8B, v18.8B, v19.8B}, [sp] // 
transpose 8 bytes each from src into 4 registers

Same with format specifiers being lower case, i.e. v16.8b


That's indeed the convention for most of our code, but we do have some 
amount of code using uppercase for these too. In particular, this file 
itself uses uppercase for such things so far.


Ideally we would reformat those files to use consistent styles, but until 
then I don't have a very strong opinion about it (we can add it matching 
the surrounding code and then reformat it all later, or add the new code 
in the generally preferred style).


// Martin

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

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


Re: [FFmpeg-devel] [PATCH] libavformat/avformat: Check codec whitelist

2022-05-26 Thread Eric Juteau
Friendly ping for feedback on this patch.

Thank you in advance.

-Original Message-
From: ffmpeg-devel  On Behalf Of Eric Juteau
Sent: Tuesday, May 17, 2022 3:09 PM
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH] libavformat/avformat: Check codec whitelist

Modified the function av_find_best_stream() such that, when a list of allowed 
codecs is supplied in the format context, and when the caller is requesting a 
decoder be returned, the function will select the best stream that has a 
decoder in the allowed decoders list.

Signed-off-by: Eric Juteau 
---
 libavformat/avformat.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/avformat.c b/libavformat/avformat.c index 
30d6ea6a49..396c1affa1 100644
--- a/libavformat/avformat.c
+++ b/libavformat/avformat.c
@@ -376,7 +376,8 @@ int av_find_best_stream(AVFormatContext *ic, enum 
AVMediaType type,
 continue;
 if (decoder_ret) {
 decoder = ff_find_decoder(ic, st, par->codec_id);
-if (!decoder) {
+if ((!decoder) ||
+(ic->codec_whitelist && av_match_list(decoder->name, 
+ ic->codec_whitelist, ',') <= 0)) {
 if (ret < 0)
 ret = AVERROR_DECODER_NOT_FOUND;
 continue;
--
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".


Re: [FFmpeg-devel] Issue - Error Due to higher number of threads

2022-05-26 Thread Srihari Sridhar
Hi,

Any updates or new ideas on the issue?

Yours truly,
S Srihari

On Mon, 23 May 2022 at 18:00, Srihari Sridhar  wrote:

> Hi,
>
> I tried on AMD ThreadRipper 3990x machine. It has 64 cores and 128 logical
> processors. The windows make starts failing with 64 threads.It worked
> successfully until 32 and even 48 threads.
>
> Regards,
> S Srihari
>
> On Thu, 19 May 2022 at 15:42, Wolfgang Haupt 
> wrote:
>
>> > Hi,
>> >
>> > Thanks for the reply. I checked the memory usage while building ffmpeg
>> with
>> > 64 threads. The machine I tested has 128 GB ram. While I tested it I
>> found
>> > that maximum memory utilized by the build of ffmpeg was 17GB.  Still the
>> > build throws up error semaphore or child process wait (Error 87 : The
>> > parameter is incorrect). Hence could you check on the same please. I
>> have
>> > attached screenshots of memory utilized from the task manager.
>>
>> What CPU are you on?
>> There is some complexity regarding the amount of threads and
>> process groups on windows, see:
>>
>> https://www.windowscentral.com/windows-10-pro-cant-handle-amd-threadripper-3990xs-128-threads
>>
>> Do you even have a processor that will utilize 64 cores?
>> I recommend trying with smaller values and see where "windows make"
>> starts to fail.
>>
>> >
>> > Regards,
>> > S Srihari
>> >
>> > On Thu, 12 May 2022 at 16:45, Timo Rothenpieler 
>> > wrote:
>> >
>> >> On 12.05.2022 04:22, Srihari Sridhar wrote:
>> >>> Hi,
>> >>>
>> >>> I was building ffmpeg through windows. While I was able to
>> successfully
>> >>> able to build for smaller number of threads, for larger number of
>> >> threads I
>> >>> faced an issue
>> >>>
>> >>> The commands I used were
>> >>> bash ./configure --arch=x86 --target-os=mingw32 --disable-x86asm
>> >>> make -j 
>> >>>
>> >>> While building with 4 Threads the build was successful
>> >>> Screenshot:
>> >>> [image: image.png]
>> >>>
>> >>> While building with 64 threads, I faced the following error,
>> >>> Screenshot :
>> >>> [image: image.png]
>> >>>semaphore or child process wait (Error 87 : The parameter is
>> incorrect)
>> >> Please don't use images for plain text. It's hard to access and barely
>> >> legible.
>> >>
>> >>> Please could you check this issue. Thanks
>> >> You probably just ran out of RAM or something. Highly unlikely that
>> this
>> >> is an issue with ffmpeg.
>> >> ___
>> >> 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 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] libx264: Set min build version to 158

2022-05-26 Thread Matt Oliver
From: Matt Oliver 

Was "[PATCH] libx264: Do not explicitly set X264_API_IMPORTS"

Setting X264_API_IMPORTS only affects msvc builds and it breaks
linking to static builds (although is required for shared builds).
This flag is set by x264 in its pkgconfig as required since build
158 (a615f027ed172e2dd5380e736d487aa858a0c4ff) from July 2019.
So this patch updates configure to require a newer x264 build that
correctly sets the imports flag.

The requirement for 158 is applied for msvc builds only,
no change is made for all other cases.

Co-authored-by: softworkz 
Signed-off-by: softworkz 
Signed-off-by: Matt Oliver 
---
libx264: Set min build version to 158

I'm submitting this patch on behalf of Matt with his permission.

There was agreement that the >= 158 version requirement should be
applied to MSVC builds only.

v2: restrict the version requirement to msvc builds
v3: fix unintended author change
v4: add missing braces
v5: fixed condition (again ;-)
v6: hope I got it now..

Published-As: 
https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-30%2Fsoftworkz%2Fsubmit_x264_api_imports_matt-v6
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg 
pr-ffstaging-30/softworkz/submit_x264_api_imports_matt-v6
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/30

Range-diff vs v5:

 1:  8c4fe7ffc2 ! 1:  47843fb51e libx264: Set min build version to 158
 @@ configure: enabled libvpx&& {
  - check_cpp_condition libx262 x264.h 
"X264_MPEG2"
  +enabled libx264   && check_pkg_config libx264 x264 "stdint.h 
x264.h" x264_encoder_encode &&
  + require_cpp_condition libx264 x264.h 
"X264_BUILD >= 118" && {
 -+ "$toolchain" != msvc || 
require_cpp_condition libx264 x264.h "X264_BUILD >= 158"; }
 ++ [ "$toolchain" != "msvc" ] ||
 ++ require_cpp_condition libx264 x264.h 
"X264_BUILD >= 158"; }
   enabled libx265   && require_pkg_config libx265 x265 x265.h 
x265_api_get &&
require_cpp_condition libx265 x265.h 
"X265_BUILD >= 70"
   enabled libxavs   && require libxavs "stdint.h xavs.h" 
xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"


 configure| 9 -
 libavcodec/libx264.c | 4 
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index f115b21064..d17361f37f 100755
--- a/configure
+++ b/configure
@@ -6656,11 +6656,10 @@ enabled libvpx&& {
 enabled libwebp   && {
 enabled libwebp_encoder  && require_pkg_config libwebp "libwebp >= 
0.2.0" webp/encode.h WebPGetEncoderVersion
 enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder 
"libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
-enabled libx264   && { check_pkg_config libx264 x264 "stdint.h x264.h" 
x264_encoder_encode ||
-   { require libx264 "stdint.h x264.h" 
x264_encoder_encode "-lx264 $pthreads_extralibs $libm_extralibs" &&
- warn "using libx264 without pkg-config"; } } 
&&
- require_cpp_condition libx264 x264.h "X264_BUILD 
>= 118" &&
- check_cpp_condition libx262 x264.h "X264_MPEG2"
+enabled libx264   && check_pkg_config libx264 x264 "stdint.h x264.h" 
x264_encoder_encode &&
+ require_cpp_condition libx264 x264.h "X264_BUILD 
>= 118" && {
+ [ "$toolchain" != "msvc" ] ||
+ require_cpp_condition libx264 x264.h "X264_BUILD 
>= 158"; }
 enabled libx265   && require_pkg_config libx265 x265 x265.h 
x265_api_get &&
  require_cpp_condition libx265 x265.h "X265_BUILD 
>= 70"
 enabled libxavs   && require libxavs "stdint.h xavs.h" 
xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 4ce3791ae8..14177b3016 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -37,10 +37,6 @@
 #include "atsc_a53.h"
 #include "sei.h"
 
-#if defined(_MSC_VER)
-#define X264_API_IMPORTS 1
-#endif
-
 #include 
 #include 
 #include 

base-commit: b033913d1c5998a29dfd13e9906dd707ff6eff12
-- 
ffmpeg-codebot
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


Re: [FFmpeg-devel] [PATCH 1/2] ffmpeg: add display_{rotation, hflip, vflip} options

2022-05-26 Thread Jan Ekström
On Thu, May 19, 2022 at 9:27 AM Jan Ekström  wrote:
>
> On Thu, May 19, 2022, 07:21 Gyan Doshi  wrote:
>>
>>
>>
>> On 2022-05-18 11:34 pm, Jan Ekström wrote:
>> > This enables overriding the rotation as well as horizontal/vertical
>> > flip state of a specific video stream on either the input or output
>> > side.
>>
>> Since rotation, flip and scale are stored in a single data structure,
>> how about a single option i.e. -display "rotate=90,flip=hv,scale=2"
>
>
> I did think about that, and I even implemented AVDict based options for 
> ffmpeg.c in a branch. But then pretty much got tired of lack of AVOption 
> automation (f.ex. for the flip flagging etc), and decided that since these 
> are relatively basic and simple, the non-generic option for this could be 
> just three options in the initial submission.

In the end I did implement this with a single dict-based thing in a
branch but never got to posting it to this thread:
https://github.com/jeeb/ffmpeg/commits/ffmpeg_c_display_matrix_with_dicts

So for the positive: Now it's all in a single option so it's clear
that it's defining a single structure.
And the negative: Needs a struct definition, struct, AVOption list,
AVClass and actually if you already made a dict out of the options
before, as the functions will free the original after usage and
generate a new one, it destroys the life time expectations of the dict
and thus it is just simpler to copy the dict when entering the
function (I think there is an arguments string based API which might
or might not actually be simpler for this case).

So yea, not sure if I prefer this version.

Jan
___
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] libx264: Set min build version to 158

2022-05-26 Thread Soft Works



> -Original Message-
> From: ffmpeg-devel  On Behalf Of Michael
> Niedermayer
> Sent: Thursday, May 26, 2022 12:51 PM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v5] libx264: Set min build version to
> 158
> 
> On Thu, May 26, 2022 at 07:28:10AM +, Matt Oliver wrote:
> > From: Matt Oliver 
> >
> > Was "[PATCH] libx264: Do not explicitly set X264_API_IMPORTS"
> >
> > Setting X264_API_IMPORTS only affects msvc builds and it breaks
> > linking to static builds (although is required for shared builds).
> > This flag is set by x264 in its pkgconfig as required since build
> > 158 (a615f027ed172e2dd5380e736d487aa858a0c4ff) from July 2019.
> > So this patch updates configure to require a newer x264 build that
> > correctly sets the imports flag.
> >
> > The requirement for 158 is applied for msvc builds only,
> > no change is made for all other cases.
> >
> > Co-authored-by: softworkz 
> > Signed-off-by: softworkz 
> > Signed-off-by: Matt Oliver 
> > ---
> > libx264: Set min build version to 158
> >
> > I'm submitting this patch on behalf of Matt with his permission.
> >
> > There was agreement that the >= 158 version requirement should be
> > applied to MSVC builds only.
> >
> > v2: restrict the version requirement to msvc builds
> > v3: fix unintended author change
> > v4: add missing braces
> > v5: fixed condition (again ;-)
> >
> > Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-
> ffstaging-30%2Fsoftworkz%2Fsubmit_x264_api_imports_matt-v5
> > Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-
> ffstaging-30/softworkz/submit_x264_api_imports_matt-v5
> > Pull-Request: https://github.com/ffstaging/FFmpeg/pull/30
> >
> > Range-diff vs v4:
> >
> >  1:  0d1bee35b0 ! 1:  8c4fe7ffc2 libx264: Set min build version to 158
> >  @@ configure: enabled libvpx&& {
> >   - require_cpp_condition libx264 x264.h
> "X264_BUILD >= 118" &&
> >   - check_cpp_condition libx262 x264.h
> "X264_MPEG2"
> >   +enabled libx264   && check_pkg_config libx264 x264
> "stdint.h x264.h" x264_encoder_encode &&
> >  -+ { require_cpp_condition libx264
> x264.h "X264_BUILD >= 158" ||
> >  -+ { "$toolchain" != msvc &&
> require_cpp_condition libx264 x264.h "X264_BUILD >= 118"; }; }
> >  ++ require_cpp_condition libx264 x264.h
> "X264_BUILD >= 118" && {
> >  ++ "$toolchain" != msvc ||
> require_cpp_condition libx264 x264.h "X264_BUILD >= 158"; }
> >enabled libx265   && require_pkg_config libx265 x265
> x265.h x265_api_get &&
> > require_cpp_condition libx265 x265.h
> "X265_BUILD >= 70"
> >enabled libxavs   && require libxavs "stdint.h xavs.h"
> xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"
> >
> >
> >  configure| 8 +++-
> >  libavcodec/libx264.c | 4 
> >  2 files changed, 3 insertions(+), 9 deletions(-)
> >
> > diff --git a/configure b/configure
> > index f115b21064..e46d362b04 100755
> > --- a/configure
> > +++ b/configure
> > @@ -6656,11 +6656,9 @@ enabled libvpx&& {
> >  enabled libwebp   && {
> >  enabled libwebp_encoder  && require_pkg_config libwebp "libwebp
> >= 0.2.0" webp/encode.h WebPGetEncoderVersion
> >  enabled libwebp_anim_encoder && check_pkg_config
> libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h
> WebPAnimEncoderOptionsInit; }
> > -enabled libx264   && { check_pkg_config libx264 x264 "stdint.h
> x264.h" x264_encoder_encode ||
> > -   { require libx264 "stdint.h x264.h"
> x264_encoder_encode "-lx264 $pthreads_extralibs $libm_extralibs" &&
> > - warn "using libx264 without pkg-
> config"; } } &&
> > - require_cpp_condition libx264 x264.h
> "X264_BUILD >= 118" &&
> > - check_cpp_condition libx262 x264.h
> "X264_MPEG2"
> > +enabled libx264   && check_pkg_config libx264 x264 "stdint.h
> x264.h" x264_encoder_encode &&
> > + require_cpp_condition libx264 x264.h
> "X264_BUILD >= 118" && {
> > + "$toolchain" != msvc ||
> require_cpp_condition libx264 x264.h "X264_BUILD >= 158"; }
> >  enabled libx265   && require_pkg_config libx265 x265 x265.h
> x265_api_get &&
> >   require_cpp_condition libx265 x265.h
> "X265_BUILD >= 70"
> >  enabled libxavs   && require libxavs "stdint.h xavs.h"
> xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"
> 
> ./configure: 6663: ./configure: : Permission denied
> ERROR: X264_BUILD >= 158 not satisfied

Thanks! I installed x264 and could reproduce. 
Seems it need to go into square brackets:

Re: [FFmpeg-devel] [PATCH v3 2/2] swscale/aarch64: add hscale specializations

2022-05-26 Thread J. Dekker
I was working on an improvement for this function but seems you finished before 
me. To avoid duplicating further work, do you have plans to implement hscale 
9-16 to 15, and hscale 8-16 to 19? Or may I base those further functions on 
this patch (given your version is faster than mine currently)?

And a few stylistic comments:

On 26 May 2022, at 4:02, Swinney, Jonathan wrote:

> This patch adds code to support specializations of the hscale function
> and adds a specialization for filterSize == 4.
>
> ff_hscale8to15_4_neon is a complete rewrite. Since the main bottleneck
> here is loading the data from src, this data is loaded a whole block
> ahead and stored back to the stack to be loaded again with ld4. This
> arranges the data for most efficient use of the vector instructions and
> removes the need for completion adds at the end. The number of
> iterations of the C per iteration of the assembly is increased from 4 to
> 8, but because of the prefetching, there must be a special section
> without prefetching when dstW < 16.
>
> This improves speed on Graviton 2 (Neoverse N1) dramatically in the case
> where previously fs=8 would have been required.
>
> before: hscale_8_to_15__fs_8_dstW_512_neon: 1962.8
> after : hscale_8_to_15__fs_4_dstW_512_neon: 1220.9
>
> Signed-off-by: Jonathan Swinney 
> ---
>  libswscale/aarch64/hscale.S  | 172 ++-
>  libswscale/aarch64/swscale.c |  39 ++--
>  libswscale/utils.c   |   2 +-
>  3 files changed, 202 insertions(+), 11 deletions(-)
>
> diff --git a/libswscale/aarch64/hscale.S b/libswscale/aarch64/hscale.S
> index da34f1cb8d..c5fa146bcf 100644
> --- a/libswscale/aarch64/hscale.S
> +++ b/libswscale/aarch64/hscale.S
> @@ -1,5 +1,7 @@
>  /*
>   * Copyright (c) 2016 Clément Bœsch 
> + * Copyright (c) 2019-2021 Sebastian Pop 
> + * Copyright (c) 2022 Jonathan Swinney 
>   *
>   * This file is part of FFmpeg.
>   *
> @@ -20,7 +22,25 @@
>
>  #include "libavutil/aarch64/asm.S"
>
> -function ff_hscale_8_to_15_neon, export=1
> +/*
> +;-
> +; horizontal line scaling
> +;
> +; void hscaleto__
> +;   (SwsContext *c, int{16,32}_t *dst,
> +;int dstW, const uint{8,16}_t *src,
> +;const int16_t *filter,
> +;const int32_t *filterPos, int filterSize);
> +;
> +; Scale one horizontal line. Input is either 8-bit width or 16-bit width
> +; ($source_width can be either 8, 9, 10 or 16, difference is whether we have 
> to
> +; downscale before multiplying). Filter is 14 bits. Output is either 15 bits
> +; (in int16_t) or 19 bits (in int32_t), as given in $intermediate_nbits. Each
> +; output pixel is generated from $filterSize input pixels, the position of
> +; the first pixel is given in filterPos[nOutputPixel].
> +;-
>  */
> +
> +function ff_hscale8to15_X8_neon, export=1
>  sbfiz   x7, x6, #1, #32 // filterSize*2 (*2 
> because int16)
>  1:  ldr w8, [x5], #4// filterPos[idx]
>  ldr w0, [x5], #4// filterPos[idx + 1]
> @@ -70,3 +90,153 @@ function ff_hscale_8_to_15_neon, export=1
>  b.gt1b  // loop until end of 
> line
>  ret
>  endfunc
> +
> +function ff_hscale8to15_4_neon, export=1
> +// x0  SwsContext *c (not used)
> +// x1  int16_t *dst
> +// x2  int dstW
> +// x3  const uint8_t *src
> +// x4  const int16_t *filter
> +// x5  const int32_t *filterPos
> +// x6  int filterSize
> +// x8-x15 registers for gathering src data
> +
> +// v0  madd accumulator 4S
> +// v1-v4   filter values (16 bit) 8H
> +// v5  madd accumulator 4S
> +// v16-v19 src values (8 bit) 8B
> +
> +// This implementation has 4 sections:
> +//  1. Prefetch src data
> +//  2. Interleaved prefetching src data and madd
> +//  3. Complete madd
> +//  4. Complete remaining iterations when dstW % 8 != 0
> +
> +add sp, sp, #-32// allocate 32 bytes
Why not just use sub here?
> on the stack
> +cmp w2, #16 // if dstW <16, skip 
> to the last block used for wrapping up
> +b.lt2f
> +
> +// load 8 values from filterPos to be used as offsets into src
> +ldp w8, w9,  [x5]   // filterPos[idx + 
> 0], [idx + 1]
> +ldp w10, w11, [x5, #8]  // filterPos[idx + 
> 2], [idx + 3]
> +ldp w12, w13, [x5, #16] // filterPos[idx + 
> 4], [idx + 5]
> +ldp w14, w15, [x5, #24] // filterPos[idx + 
> 6], [idx + 7]
> +add x5, x5, #32 // advance filterPos
> +
> +// gather random access data 

Re: [FFmpeg-devel] [PATCH v5] libx264: Set min build version to 158

2022-05-26 Thread Michael Niedermayer
On Thu, May 26, 2022 at 07:28:10AM +, Matt Oliver wrote:
> From: Matt Oliver 
> 
> Was "[PATCH] libx264: Do not explicitly set X264_API_IMPORTS"
> 
> Setting X264_API_IMPORTS only affects msvc builds and it breaks
> linking to static builds (although is required for shared builds).
> This flag is set by x264 in its pkgconfig as required since build
> 158 (a615f027ed172e2dd5380e736d487aa858a0c4ff) from July 2019.
> So this patch updates configure to require a newer x264 build that
> correctly sets the imports flag.
> 
> The requirement for 158 is applied for msvc builds only,
> no change is made for all other cases.
> 
> Co-authored-by: softworkz 
> Signed-off-by: softworkz 
> Signed-off-by: Matt Oliver 
> ---
> libx264: Set min build version to 158
> 
> I'm submitting this patch on behalf of Matt with his permission.
> 
> There was agreement that the >= 158 version requirement should be
> applied to MSVC builds only.
> 
> v2: restrict the version requirement to msvc builds
> v3: fix unintended author change
> v4: add missing braces
> v5: fixed condition (again ;-)
> 
> Published-As: 
> https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-30%2Fsoftworkz%2Fsubmit_x264_api_imports_matt-v5
> Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg 
> pr-ffstaging-30/softworkz/submit_x264_api_imports_matt-v5
> Pull-Request: https://github.com/ffstaging/FFmpeg/pull/30
> 
> Range-diff vs v4:
> 
>  1:  0d1bee35b0 ! 1:  8c4fe7ffc2 libx264: Set min build version to 158
>  @@ configure: enabled libvpx&& {
>   - require_cpp_condition libx264 x264.h 
> "X264_BUILD >= 118" &&
>   - check_cpp_condition libx262 x264.h 
> "X264_MPEG2"
>   +enabled libx264   && check_pkg_config libx264 x264 "stdint.h 
> x264.h" x264_encoder_encode &&
>  -+ { require_cpp_condition libx264 x264.h 
> "X264_BUILD >= 158" ||
>  -+ { "$toolchain" != msvc && 
> require_cpp_condition libx264 x264.h "X264_BUILD >= 118"; }; }
>  ++ require_cpp_condition libx264 x264.h 
> "X264_BUILD >= 118" && {
>  ++ "$toolchain" != msvc || 
> require_cpp_condition libx264 x264.h "X264_BUILD >= 158"; }
>enabled libx265   && require_pkg_config libx265 x265 x265.h 
> x265_api_get &&
> require_cpp_condition libx265 x265.h 
> "X265_BUILD >= 70"
>enabled libxavs   && require libxavs "stdint.h xavs.h" 
> xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"
> 
> 
>  configure| 8 +++-
>  libavcodec/libx264.c | 4 
>  2 files changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/configure b/configure
> index f115b21064..e46d362b04 100755
> --- a/configure
> +++ b/configure
> @@ -6656,11 +6656,9 @@ enabled libvpx&& {
>  enabled libwebp   && {
>  enabled libwebp_encoder  && require_pkg_config libwebp "libwebp >= 
> 0.2.0" webp/encode.h WebPGetEncoderVersion
>  enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder 
> "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
> -enabled libx264   && { check_pkg_config libx264 x264 "stdint.h 
> x264.h" x264_encoder_encode ||
> -   { require libx264 "stdint.h x264.h" 
> x264_encoder_encode "-lx264 $pthreads_extralibs $libm_extralibs" &&
> - warn "using libx264 without pkg-config"; } 
> } &&
> - require_cpp_condition libx264 x264.h 
> "X264_BUILD >= 118" &&
> - check_cpp_condition libx262 x264.h "X264_MPEG2"
> +enabled libx264   && check_pkg_config libx264 x264 "stdint.h x264.h" 
> x264_encoder_encode &&
> + require_cpp_condition libx264 x264.h 
> "X264_BUILD >= 118" && {
> + "$toolchain" != msvc || require_cpp_condition 
> libx264 x264.h "X264_BUILD >= 158"; }
>  enabled libx265   && require_pkg_config libx265 x265 x265.h 
> x265_api_get &&
>   require_cpp_condition libx265 x265.h 
> "X265_BUILD >= 70"
>  enabled libxavs   && require libxavs "stdint.h xavs.h" 
> xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"

./configure: 6663: ./configure: : Permission denied
ERROR: X264_BUILD >= 158 not satisfied

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
ffmpeg-u...@ffmpeg.org mailing list or IRC #ffmpeg on irc.libera.chat.
Include the log file "ffbuild/config.log" produced by configure as this will 
help
solve the problem.

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

In fact, the RIAA has been known to suggest that students 

[FFmpeg-devel] [PATCH v8 3/3] avformat/file: remove _WIN32 condition

2022-05-26 Thread softworkz
From: softworkz 

stat is now re-mapped with long path support
in os_support.h

Signed-off-by: softworkz 
---
 libavformat/file.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/libavformat/file.c b/libavformat/file.c
index 063d7c5aa2..98c9e81bcb 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -154,11 +154,7 @@ static int file_check(URLContext *h, int mask)
 ret |= AVIO_FLAG_WRITE;
 #else
 struct stat st;
-#   ifndef _WIN32
 ret = stat(filename, );
-#   else
-ret = win32_stat(filename, );
-#   endif
 if (ret < 0)
 return AVERROR(errno);
 
-- 
ffmpeg-codebot
___
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 v8 2/3] avformat/os_support: Support long file names on Windows

2022-05-26 Thread softworkz
From: softworkz 

Signed-off-by: softworkz 
---
 libavformat/os_support.h | 116 ++-
 1 file changed, 91 insertions(+), 25 deletions(-)

diff --git a/libavformat/os_support.h b/libavformat/os_support.h
index 5e6b32d2dc..958976cc6f 100644
--- a/libavformat/os_support.h
+++ b/libavformat/os_support.h
@@ -49,11 +49,38 @@
 #  ifdef stat
 #   undef stat
 #  endif
-#  define stat _stati64
+
+#  define stat win32_stat
+
+/*
+ * The POSIX definition for the stat() function uses a struct of the
+ * same name (struct stat), that why it takes this extra effort  for
+ * redirecting/replacing the stat() function with our own one which
+ * is capable to handle long path names on Windows.
+ * The struct below roughly follows the POSIX definition. Time values
+ * are 64bit, but in cases when _USE_32BIT_TIME_T is defined, they
+ * will be set to values no larger than INT32_MAX which corresponds
+ * to file times up to the year 2038.
+ */
+struct win32_stat
+{
+_dev_t st_dev; /* ID of device containing file */
+_ino_t st_ino; /* inode number */
+unsigned short st_mode;/* protection */
+short  st_nlink;   /* number of hard links */
+short  st_uid; /* user ID of owner */
+short  st_gid; /* group ID of owner */
+_dev_t st_rdev;/* device ID (if special file) */
+int64_tst_size;/* total size, in bytes */
+int64_tst_atime;   /* time of last access */
+int64_tst_mtime;   /* time of last modification */
+int64_tst_ctime;   /* time of last status change */
+};
+
 #  ifdef fstat
 #   undef fstat
 #  endif
-#  define fstat(f,s) _fstati64((f), (s))
+#  define fstat win32_fstat
 #endif /* defined(_WIN32) */
 
 
@@ -153,7 +180,7 @@ static inline int win32_##name(const char *filename_utf8) \
 wchar_t *filename_w;  \
 int ret;  \
   \
-if (utf8towchar(filename_utf8, _w))  \
+if (get_extended_win32_path(filename_utf8, _w)) \
 return -1;\
 if (!filename_w)  \
 goto fallback;\
@@ -171,37 +198,76 @@ DEF_FS_FUNCTION(unlink, _wunlink, _unlink)
 DEF_FS_FUNCTION(mkdir,  _wmkdir,  _mkdir)
 DEF_FS_FUNCTION(rmdir,  _wrmdir , _rmdir)
 
-#define DEF_FS_FUNCTION2(name, wfunc, afunc, partype) \
-static inline int win32_##name(const char *filename_utf8, partype par) \
-{ \
-wchar_t *filename_w;  \
-int ret;  \
-  \
-if (utf8towchar(filename_utf8, _w))  \
-return -1;\
-if (!filename_w)  \
-goto fallback;\
-  \
-ret = wfunc(filename_w, par); \
-av_free(filename_w);  \
-return ret;   \
-  \
-fallback: \
-/* filename may be be in CP_ACP */\
-return afunc(filename_utf8, par); \
+static inline int win32_access(const char *filename_utf8, int mode)
+{
+wchar_t *filename_w;
+int ret;
+if (get_extended_win32_path(filename_utf8, _w))
+return -1;
+if (!filename_w)
+goto fallback;
+ret = _waccess(filename_w, mode);
+av_free(filename_w);
+return ret;
+fallback:
+return _access(filename_utf8, mode);
+}
+
+static inline void copy_stat(struct _stati64 *crtstat, struct win32_stat *buf)
+{
+buf->st_dev   = crtstat->st_dev;
+buf->st_ino   = crtstat->st_ino;
+buf->st_mode  = crtstat->st_mode;
+buf->st_nlink = crtstat->st_nlink;
+buf->st_uid   = crtstat->st_uid;
+buf->st_gid   = crtstat->st_gid;
+buf->st_rdev  = crtstat->st_rdev;
+buf->st_size  = crtstat->st_size;
+buf->st_atime = crtstat->st_atime;
+buf->st_mtime = crtstat->st_mtime;
+buf->st_ctime = crtstat->st_ctime;
 }
 
-DEF_FS_FUNCTION2(access, _waccess, _access, int)
-DEF_FS_FUNCTION2(stat, _wstati64, _stati64, struct stat*)
+static inline int win32_stat(const char *filename_utf8, struct win32_stat *buf)
+{
+struct _stati64 crtstat = { 0 };
+wchar_t *filename_w;
+int ret;
+
+if (get_extended_win32_path(filename_utf8, _w))
+return -1;
+
+if (filename_w) {
+ret = _wstat64(filename_w, );
+ 

[FFmpeg-devel] [PATCH v8 1/3] avutil/wchar_filename, file_open: Support long file names on Windows

2022-05-26 Thread softworkz
From: softworkz 

Signed-off-by: softworkz 
---
 libavutil/file_open.c  |   2 +-
 libavutil/wchar_filename.h | 180 +
 2 files changed, 181 insertions(+), 1 deletion(-)

diff --git a/libavutil/file_open.c b/libavutil/file_open.c
index fb64c2e4ee..58a6073353 100644
--- a/libavutil/file_open.c
+++ b/libavutil/file_open.c
@@ -45,7 +45,7 @@ static int win32_open(const char *filename_utf8, int oflag, 
int pmode)
 wchar_t *filename_w;
 
 /* convert UTF-8 to wide chars */
-if (utf8towchar(filename_utf8, _w))
+if (get_extended_win32_path(filename_utf8, _w))
 return -1;
 if (!filename_w)
 goto fallback;
diff --git a/libavutil/wchar_filename.h b/libavutil/wchar_filename.h
index 90f082452c..f36d9dfea3 100644
--- a/libavutil/wchar_filename.h
+++ b/libavutil/wchar_filename.h
@@ -40,6 +40,186 @@ static inline int utf8towchar(const char *filename_utf8, 
wchar_t **filename_w)
 MultiByteToWideChar(CP_UTF8, 0, filename_utf8, -1, *filename_w, num_chars);
 return 0;
 }
+
+/**
+ * Checks for extended path prefixes for which normalization needs to be 
skipped.
+ * see .NET6: PathInternal.IsExtended()
+ * 
https://github.com/dotnet/runtime/blob/9260c249140ef90b4299d0fe1aa3037e25228518/src/libraries/Common/src/System/IO/PathInternal.Windows.cs#L165
+ */
+static inline int path_is_extended(const wchar_t *path)
+{
+if (path[0] == L'\\' && (path[1] == L'\\' || path[1] == L'?') && path[2] 
== L'?' && path[3] == L'\\')
+return 1;
+
+return 0;
+}
+
+/**
+ * Checks for a device path prefix.
+ * see .NET6: PathInternal.IsDevice()
+ * we don't check forward slashes and extended paths (as already done)
+ * 
https://github.com/dotnet/runtime/blob/9260c249140ef90b4299d0fe1aa3037e25228518/src/libraries/Common/src/System/IO/PathInternal.Windows.cs#L132
+ */
+static inline int path_is_device_path(const wchar_t *path)
+{
+if (path[0] == L'\\' && path[1] == L'\\' && path[2] == L'.' && path[3] == 
L'\\')
+return 1;
+
+return 0;
+}
+
+/**
+ * Performs path normalization by calling GetFullPathNameW().
+ * see .NET6: PathHelper.GetFullPathName()
+ * 
https://github.com/dotnet/runtime/blob/2a99e18eedabcf1add064c099da59d9301ce45e0/src/libraries/System.Private.CoreLib/src/System/IO/PathHelper.Windows.cs#L70
+ */
+static inline int get_full_path_name(wchar_t **ppath_w)
+{
+int num_chars;
+wchar_t *temp_w;
+
+num_chars = GetFullPathNameW(*ppath_w, 0, NULL, NULL);
+if (num_chars <= 0) {
+errno = EINVAL;
+return -1;
+}
+
+temp_w = (wchar_t *)av_calloc(num_chars, sizeof(wchar_t));
+if (!temp_w) {
+errno = ENOMEM;
+return -1;
+}
+
+num_chars = GetFullPathNameW(*ppath_w, num_chars, temp_w, NULL);
+if (num_chars <= 0) {
+av_free(temp_w);
+errno = EINVAL;
+return -1;
+}
+
+av_freep(ppath_w);
+*ppath_w = temp_w;
+
+return 0;
+}
+
+/**
+ * Normalizes a Windows file or folder path.
+ * Expansion of short paths (with 8.3 path components) is currently omitted
+ * as it is not required for accessing long paths.
+ * see .NET6: PathHelper.Normalize()
+ * 
https://github.com/dotnet/runtime/blob/2a99e18eedabcf1add064c099da59d9301ce45e0/src/libraries/System.Private.CoreLib/src/System/IO/PathHelper.Windows.cs#L25
+ */
+static inline int path_normalize(wchar_t **ppath_w)
+{
+int ret;
+
+if ((ret = get_full_path_name(ppath_w)) < 0)
+return ret;
+
+/* What .NET does at this point is to call 
PathHelper.TryExpandShortFileName()
+ * in case the path contains a '~' character.
+ * We don't need to do this as we don't need to normalize the file name
+ * for presentation, and the extended path prefix works with 8.3 path
+ * components as well
+ */
+return 0;
+}
+
+/**
+ * Adds an extended path or UNC prefix to longs paths or paths ending
+ * with a space or a dot. (' ' or '.').
+ * This function expects that the path has been normalized before by
+ * calling path_normalize() and it doesn't check whether the path is
+ * actually long (> MAX_PATH).
+ * see .NET6: PathInternal.EnsureExtendedPrefix()
+ * 
https://github.com/dotnet/runtime/blob/9260c249140ef90b4299d0fe1aa3037e25228518/src/libraries/Common/src/System/IO/PathInternal.Windows.cs#L107
+ */
+static inline int add_extended_prefix(wchar_t **ppath_w)
+{
+const wchar_t *unc_prefix   = L"?\\UNC\\";
+const wchar_t *extended_path_prefix = L"?\\";
+const wchar_t *path_w   = *ppath_w;
+const size_t len= wcslen(path_w);
+wchar_t *temp_w;
+
+/* We're skipping the check IsPartiallyQualified() because
+ * we expect to have called GetFullPathNameW() already. */
+if (len < 2 || path_is_extended(*ppath_w) || 
path_is_device_path(*ppath_w)) {
+return 0;
+}
+
+if (path_w[0] == L'\\' && path_w[1] == L'\\') {
+/* unc_prefix length is 8 plus 1 for terminating zeros,
+ * 

[FFmpeg-devel] [PATCH v8 0/3] Support long file names on Windows

2022-05-26 Thread ffmpegagent
This patchset adds support for long file and directory paths on Windows. The
implementation follows the same logic that .NET is using internally, with
the only exception that it doesn't expand short path components in 8.3
format. .NET does this as the same function is also used for other purposes,
but in our case, that's not required. Short (8.3) paths are working as well
with the extended path prefix, even when longer than 260.

Successfully tested:

 * Regular paths wth drive letter
 * Regular UNC paths
 * Long paths wth drive letter
 * Long paths wth drive letter and forward slashes
 * Long UNC paths
 * Prefixed paths wth drive letter
 * Prefixed UNC paths

I have kept the individual functions separate on purpose, to make it easy to
compare with the .NET impl. (compilers should inlinie those anyway)

v2

 * wchar_filename: Improve comments and function documentation
 * os_support: adjust defines to use win32_stat

v3

 * removed length check in path_is_extended()
 * added path_is_device_path() check in add_extended_prefix()
 * add_extended_prefix(): clarified doc and add checks
 * clarified string allocation length calculation
 * replaced 260 with MAX_PATH
 * removed redundant checks after normalization

v4

 * rebased. no changes

v5

 * resolved the ugly struct duplication
 * compatible with _USE_32BIT_TIME_T

v6

 * wchar_filename.h: added links to .NET source code
 * wchar_filename.h: free allocations on error
 * os_support.hs: use clean and safe way to redirect stat() calls

v7

 * os_support.h: remapped fstat with win32_stat structure
 * os_support.h: use int64_t for some members
 * avformat/file: remove _WIN32 condition

v8

 * os_support.h: documented win32_stat structure
 * os_support.h: renamed function parameters

softworkz (3):
  avutil/wchar_filename,file_open: Support long file names on Windows
  avformat/os_support: Support long file names on Windows
  avformat/file: remove _WIN32 condition

 libavformat/file.c |   4 -
 libavformat/os_support.h   | 116 ++--
 libavutil/file_open.c  |   2 +-
 libavutil/wchar_filename.h | 180 +
 4 files changed, 272 insertions(+), 30 deletions(-)


base-commit: 6076dbcb55d0c9b6693d1acad12a63f7268301aa
Published-As: 
https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-28%2Fsoftworkz%2Fsubmit_long_filenames-v8
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg 
pr-ffstaging-28/softworkz/submit_long_filenames-v8
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/28

Range-diff vs v7:

 1:  960aa795ff = 1:  960aa795ff avutil/wchar_filename,file_open: Support long 
file names on Windows
 2:  7751335906 ! 2:  d0cc40a0d4 avformat/os_support: Support long file names 
on Windows
 @@ libavformat/os_support.h
  +
  +#  define stat win32_stat
  +
 ++/*
 ++ * The POSIX definition for the stat() function uses a struct of the
 ++ * same name (struct stat), that why it takes this extra effort  for
 ++ * redirecting/replacing the stat() function with our own one which
 ++ * is capable to handle long path names on Windows.
 ++ * The struct below roughly follows the POSIX definition. Time values
 ++ * are 64bit, but in cases when _USE_32BIT_TIME_T is defined, they
 ++ * will be set to values no larger than INT32_MAX which corresponds
 ++ * to file times up to the year 2038.
 ++ */
  +struct win32_stat
  +{
  +_dev_t st_dev; /* ID of device containing file */
 @@ libavformat/os_support.h: DEF_FS_FUNCTION(unlink, _wunlink, _unlink)
  -fallback: \
  -/* filename may be be in CP_ACP */\
  -return afunc(filename_utf8, par); \
 -+static inline int win32_access(const char *filename_utf8, int par)
 ++static inline int win32_access(const char *filename_utf8, int mode)
  +{
  +wchar_t *filename_w;
  +int ret;
 @@ libavformat/os_support.h: DEF_FS_FUNCTION(unlink, _wunlink, _unlink)
  +return -1;
  +if (!filename_w)
  +goto fallback;
 -+ret = _waccess(filename_w, par);
 ++ret = _waccess(filename_w, mode);
  +av_free(filename_w);
  +return ret;
  +fallback:
 -+return _access(filename_utf8, par);
 ++return _access(filename_utf8, mode);
  +}
  +
 -+static inline void copy_stat(struct _stati64 *winstat, struct win32_stat 
*par)
 ++static inline void copy_stat(struct _stati64 *crtstat, struct win32_stat 
*buf)
  +{
 -+par->st_dev   = winstat->st_dev;
 -+par->st_ino   = winstat->st_ino;
 -+par->st_mode  = winstat->st_mode;
 -+par->st_nlink = winstat->st_nlink;
 -+par->st_uid   = winstat->st_uid;
 -+par->st_gid   = winstat->st_gid;
 -+par->st_rdev  = winstat->st_rdev;
 

Re: [FFmpeg-devel] [PATCH 1/3] avformat/jpegxl_probe: Check init_get_bits8() for failure

2022-05-26 Thread Michael Niedermayer
On Mon, May 16, 2022 at 03:16:03AM +0200, Michael Niedermayer wrote:
> Fixes: missing error check
> Fixes: CID1504270
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/jpegxl_probe.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)

will apply

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

Those who are best at talking, realize last or never when they are wrong.


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/3] avformat/act: Check ff_get_wav_header() for failure

2022-05-26 Thread Michael Niedermayer
On Mon, May 16, 2022 at 03:16:04AM +0200, Michael Niedermayer wrote:
> Fixes: missing error check
> Fixes: CID717495
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/act.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)

will apply

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

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras


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] Changelog: Add line for IPFS

2022-05-26 Thread Michael Niedermayer
On Mon, May 23, 2022 at 10:23:45PM +0200, Mark Gaiser wrote:
> On Thu, May 19, 2022 at 5:01 PM Michael Niedermayer 
> wrote:
> 
> > Noticed-and-suggested-by: Mark Gaiser 
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  Changelog | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/Changelog b/Changelog
> > index 4d42a0f681..869f05de34 100644
> > --- a/Changelog
> > +++ b/Changelog
> > @@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest
> > within each release,
> >  releases are sorted from youngest to oldest.
> >
> >  version 5.1:
> > +- add ipfs/ipns protocol support
> >  - dialogue enhance audio filter
> >  - dropped obsolete XvMC hwaccel
> >  - pcm-bluray encoder
> > --
> > 2.17.1
> >
> 
> Ah, so a diff for this too, oke.
> +1 from me

will apply

thx

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

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


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

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


Re: [FFmpeg-devel] [PATCH 1/2] avformat/matroskadec: assert non NULL buf

2022-05-26 Thread Michael Niedermayer
On Fri, May 20, 2022 at 09:17:50AM +0200, Andreas Rheinhardt wrote:
> Michael Niedermayer:
> > The code is only called if size is > 0 so buf should not be NULL
> > 
> > Helps: CID610554
> > 
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavformat/matroskadec.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> > index 4715f1b7d4..de73f97aca 100644
> > --- a/libavformat/matroskadec.c
> > +++ b/libavformat/matroskadec.c
> > @@ -3701,6 +3701,8 @@ static int matroska_parse_block(MatroskaDemuxContext 
> > *matroska, AVBufferRef *buf
> >  uint64_t num;
> >  int trust_default_duration;
> >  
> > +av_assert1(buf);
> > +
> >  ffio_init_context(, data, size, 0, NULL, NULL, NULL, NULL);
> >  
> >  if ((n = ebml_read_num(matroska, , 8, , 1)) < 0)
> 
> Ok.

will apply

thx

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

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides


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 6/6] avcodec/qsvdec: Implement SEI parsing for QSV decoders

2022-05-26 Thread softworkz
From: softworkz 

Signed-off-by: softworkz 
---
 libavcodec/qsvdec.c | 233 
 1 file changed, 233 insertions(+)

diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 5fc5bed4c8..7d6a491aa0 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -49,6 +49,12 @@
 #include "hwconfig.h"
 #include "qsv.h"
 #include "qsv_internal.h"
+#include "h264dec.h"
+#include "h264_sei.h"
+#include "hevcdec.h"
+#include "hevc_ps.h"
+#include "hevc_sei.h"
+#include "mpeg12.h"
 
 static const AVRational mfx_tb = { 1, 9 };
 
@@ -60,6 +66,8 @@ static const AVRational mfx_tb = { 1, 9 };
 AV_NOPTS_VALUE : pts_tb.num ? \
 av_rescale_q(mfx_pts, mfx_tb, pts_tb) : mfx_pts)
 
+#define PAYLOAD_BUFFER_SIZE 65535
+
 typedef struct QSVAsyncFrame {
 mfxSyncPoint *sync;
 QSVFrame *frame;
@@ -101,6 +109,9 @@ typedef struct QSVContext {
 
 mfxExtBuffer **ext_buffers;
 int nb_ext_buffers;
+
+mfxU8 payload_buffer[PAYLOAD_BUFFER_SIZE];
+Mpeg1Context mpeg_ctx;
 } QSVContext;
 
 static const AVCodecHWConfigInternal *const qsv_hw_configs[] = {
@@ -599,6 +610,208 @@ static int qsv_export_film_grain(AVCodecContext *avctx, 
mfxExtAV1FilmGrainParam
 return 0;
 }
 #endif
+static int find_start_offset(mfxU8 data[4])
+{
+if (data[0] == 0 && data[1] == 0 && data[2] == 1)
+return 3;
+
+if (data[0] == 0 && data[1] == 0 && data[2] == 0 && data[3] == 1)
+return 4;
+
+return 0;
+}
+
+static int parse_sei_h264(AVCodecContext* avctx, QSVContext* q, AVFrame* out)
+{
+H264SEIContext sei = { 0 };
+GetBitContext gb = { 0 };
+mfxPayload payload = { 0, .Data = >payload_buffer[0], .BufSize = 
sizeof(q->payload_buffer) };
+mfxU64 ts;
+int ret;
+
+while (1) {
+int start;
+memset(payload.Data, 0, payload.BufSize);
+
+ret = MFXVideoDECODE_GetPayload(q->session, , );
+if (ret != MFX_ERR_NONE) {
+av_log(avctx, AV_LOG_WARNING, "error getting SEI payload: %d \n", 
ret);
+return ret;
+}
+
+if (payload.NumBit == 0 || payload.NumBit >= payload.BufSize * 8) {
+break;
+}
+
+start = find_start_offset(payload.Data);
+
+switch (payload.Type) {
+case SEI_TYPE_BUFFERING_PERIOD:
+case SEI_TYPE_PIC_TIMING:
+continue;
+}
+
+if (init_get_bits(, [start], payload.NumBit - start * 
8) < 0)
+av_log(avctx, AV_LOG_ERROR, "Error initializing bitstream reader");
+else
+ret = ff_h264_sei_decode(, , NULL, avctx);
+
+if (ret < 0)
+av_log(avctx, AV_LOG_WARNING, "Error parsing SEI type: %d  Numbits 
%d error: %d\n", payload.Type, payload.NumBit, ret);
+else
+av_log(avctx, AV_LOG_DEBUG, "mfxPayload Type: %d  Numbits %d\n", 
payload.Type, payload.NumBit);
+}
+
+if (out)
+return ff_h264_export_frame_props(avctx, , NULL, out);
+
+return 0;
+}
+
+static int parse_sei_hevc(AVCodecContext* avctx, QSVContext* q, QSVFrame* out)
+{
+HEVCSEI sei = { 0 };
+HEVCParamSets ps = { 0 };
+GetBitContext gb = { 0 };
+mfxPayload payload = { 0, .Data = >payload_buffer[0], .BufSize = 
sizeof(q->payload_buffer) };
+mfxFrameSurface1 *surface = >surface;
+mfxU64 ts;
+int ret, has_logged = 0;
+
+while (1) {
+int start;
+memset(payload.Data, 0, payload.BufSize);
+
+ret = MFXVideoDECODE_GetPayload(q->session, , );
+if (ret != MFX_ERR_NONE) {
+av_log(avctx, AV_LOG_WARNING, "error getting SEI payload: %d \n", 
ret);
+return 0;
+}
+
+if (payload.NumBit == 0 || payload.NumBit >= payload.BufSize * 8) {
+break;
+}
+
+if (!has_logged) {
+has_logged = 1;
+av_log(avctx, AV_LOG_VERBOSE, 
"-\n");
+av_log(avctx, AV_LOG_VERBOSE, "Start reading SEI - payload 
timestamp: %llu - surface timestamp: %llu\n", ts, surface->Data.TimeStamp);
+}
+
+if (ts != surface->Data.TimeStamp) {
+av_log(avctx, AV_LOG_WARNING, "GetPayload timestamp (%llu) does 
not match surface timestamp: (%llu)\n", ts, surface->Data.TimeStamp);
+}
+
+start = find_start_offset(payload.Data);
+
+av_log(avctx, AV_LOG_VERBOSE, "parsing SEI type: %3d  Numbits %3d  
Start: %d\n", payload.Type, payload.NumBit, start);
+
+switch (payload.Type) {
+case SEI_TYPE_BUFFERING_PERIOD:
+case SEI_TYPE_PIC_TIMING:
+continue;
+case SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME:
+// There seems to be a bug in MSDK
+payload.NumBit -= 8;
+
+break;
+case SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO:
+// There seems to be a bug in MSDK
+payload.NumBit = 48;
+
+break;
+case 

[FFmpeg-devel] [PATCH 5/6] avcodec/h264dec: make h264_export_frame_props() accessible

2022-05-26 Thread softworkz
From: softworkz 

Signed-off-by: softworkz 
---
 libavcodec/h264_slice.c | 98 +
 libavcodec/h264dec.h|  2 +
 2 files changed, 52 insertions(+), 48 deletions(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index d56722a5c2..f2a4c1c657 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1157,11 +1157,10 @@ static int h264_init_ps(H264Context *h, const 
H264SliceContext *sl, int first_sl
 return 0;
 }
 
-static int h264_export_frame_props(H264Context *h)
+int ff_h264_export_frame_props(AVCodecContext *logctx, H264SEIContext *sei, 
H264Context *h, AVFrame *out)
 {
-const SPS *sps = h->ps.sps;
-H264Picture *cur = h->cur_pic_ptr;
-AVFrame *out = cur->f;
+const SPS *sps = h ? h->ps.sps : NULL;
+H264Picture *cur = h ? h->cur_pic_ptr : NULL;
 
 out->interlaced_frame = 0;
 out->repeat_pict  = 0;
@@ -1169,19 +1168,19 @@ static int h264_export_frame_props(H264Context *h)
 /* Signal interlacing information externally. */
 /* Prioritize picture timing SEI information over used
  * decoding process if it exists. */
-if (h->sei.picture_timing.present) {
-int ret = ff_h264_sei_process_picture_timing(>sei.picture_timing, 
sps,
- h->avctx);
+if (sps && sei->picture_timing.present) {
+int ret = ff_h264_sei_process_picture_timing(>picture_timing, sps,
+ logctx);
 if (ret < 0) {
-av_log(h->avctx, AV_LOG_ERROR, "Error processing a picture timing 
SEI\n");
-if (h->avctx->err_recognition & AV_EF_EXPLODE)
+av_log(logctx, AV_LOG_ERROR, "Error processing a picture timing 
SEI\n");
+if (logctx->err_recognition & AV_EF_EXPLODE)
 return ret;
-h->sei.picture_timing.present = 0;
+sei->picture_timing.present = 0;
 }
 }
 
-if (sps->pic_struct_present_flag && h->sei.picture_timing.present) {
-H264SEIPictureTiming *pt = >sei.picture_timing;
+if (h && sps && sps->pic_struct_present_flag && 
sei->picture_timing.present) {
+H264SEIPictureTiming *pt = >picture_timing;
 switch (pt->pic_struct) {
 case H264_SEI_PIC_STRUCT_FRAME:
 break;
@@ -1215,21 +1214,23 @@ static int h264_export_frame_props(H264Context *h)
 if ((pt->ct_type & 3) &&
 pt->pic_struct <= H264_SEI_PIC_STRUCT_BOTTOM_TOP)
 out->interlaced_frame = (pt->ct_type & (1 << 1)) != 0;
-} else {
+} else if (h) {
 /* Derive interlacing flag from used decoding process. */
 out->interlaced_frame = FIELD_OR_MBAFF_PICTURE(h);
 }
-h->prev_interlaced_frame = out->interlaced_frame;
 
-if (cur->field_poc[0] != cur->field_poc[1]) {
+if (h)
+h->prev_interlaced_frame = out->interlaced_frame;
+
+if (sps && cur->field_poc[0] != cur->field_poc[1]) {
 /* Derive top_field_first from field pocs. */
 out->top_field_first = cur->field_poc[0] < cur->field_poc[1];
-} else {
-if (sps->pic_struct_present_flag && h->sei.picture_timing.present) {
+} else if (sps) {
+if (sps->pic_struct_present_flag && sei->picture_timing.present) {
 /* Use picture timing SEI information. Even if it is a
  * information of a past frame, better than nothing. */
-if (h->sei.picture_timing.pic_struct == 
H264_SEI_PIC_STRUCT_TOP_BOTTOM ||
-h->sei.picture_timing.pic_struct == 
H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP)
+if (sei->picture_timing.pic_struct == 
H264_SEI_PIC_STRUCT_TOP_BOTTOM ||
+sei->picture_timing.pic_struct == 
H264_SEI_PIC_STRUCT_TOP_BOTTOM_TOP)
 out->top_field_first = 1;
 else
 out->top_field_first = 0;
@@ -1243,11 +1244,11 @@ static int h264_export_frame_props(H264Context *h)
 }
 }
 
-if (h->sei.frame_packing.present &&
-h->sei.frame_packing.arrangement_type <= 6 &&
-h->sei.frame_packing.content_interpretation_type > 0 &&
-h->sei.frame_packing.content_interpretation_type < 3) {
-H264SEIFramePacking *fp = >sei.frame_packing;
+if (sei->frame_packing.present &&
+sei->frame_packing.arrangement_type <= 6 &&
+sei->frame_packing.content_interpretation_type > 0 &&
+sei->frame_packing.content_interpretation_type < 3) {
+H264SEIFramePacking *fp = >frame_packing;
 AVStereo3D *stereo = av_stereo3d_create_side_data(out);
 if (stereo) {
 switch (fp->arrangement_type) {
@@ -1289,11 +1290,11 @@ static int h264_export_frame_props(H264Context *h)
 }
 }
 
-if (h->sei.display_orientation.present &&
-(h->sei.display_orientation.anticlockwise_rotation ||
- h->sei.display_orientation.hflip ||
- h->sei.display_orientation.vflip)) {
-

[FFmpeg-devel] [PATCH 4/6] avcodec/hevcdec: make set_side_data() accessible

2022-05-26 Thread softworkz
From: softworkz 

Signed-off-by: softworkz 
---
 libavcodec/hevcdec.c | 117 +--
 libavcodec/hevcdec.h |   2 +
 2 files changed, 60 insertions(+), 59 deletions(-)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index f782ea6394..ff22081b46 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2726,23 +2726,22 @@ error:
 return res;
 }
 
-static int set_side_data(HEVCContext *s)
+int ff_set_side_data(AVCodecContext *logctx, HEVCSEI *sei, HEVCContext *s, 
AVFrame *out)
 {
-AVFrame *out = s->ref->frame;
-int ret;
+int ret = 0;
 
-if (s->sei.frame_packing.present &&
-s->sei.frame_packing.arrangement_type >= 3 &&
-s->sei.frame_packing.arrangement_type <= 5 &&
-s->sei.frame_packing.content_interpretation_type > 0 &&
-s->sei.frame_packing.content_interpretation_type < 3) {
+if (sei->frame_packing.present &&
+sei->frame_packing.arrangement_type >= 3 &&
+sei->frame_packing.arrangement_type <= 5 &&
+sei->frame_packing.content_interpretation_type > 0 &&
+sei->frame_packing.content_interpretation_type < 3) {
 AVStereo3D *stereo = av_stereo3d_create_side_data(out);
 if (!stereo)
 return AVERROR(ENOMEM);
 
-switch (s->sei.frame_packing.arrangement_type) {
+switch (sei->frame_packing.arrangement_type) {
 case 3:
-if (s->sei.frame_packing.quincunx_subsampling)
+if (sei->frame_packing.quincunx_subsampling)
 stereo->type = AV_STEREO3D_SIDEBYSIDE_QUINCUNX;
 else
 stereo->type = AV_STEREO3D_SIDEBYSIDE;
@@ -2755,21 +2754,21 @@ static int set_side_data(HEVCContext *s)
 break;
 }
 
-if (s->sei.frame_packing.content_interpretation_type == 2)
+if (sei->frame_packing.content_interpretation_type == 2)
 stereo->flags = AV_STEREO3D_FLAG_INVERT;
 
-if (s->sei.frame_packing.arrangement_type == 5) {
-if (s->sei.frame_packing.current_frame_is_frame0_flag)
+if (sei->frame_packing.arrangement_type == 5) {
+if (sei->frame_packing.current_frame_is_frame0_flag)
 stereo->view = AV_STEREO3D_VIEW_LEFT;
 else
 stereo->view = AV_STEREO3D_VIEW_RIGHT;
 }
 }
 
-if (s->sei.display_orientation.present &&
-(s->sei.display_orientation.anticlockwise_rotation ||
- s->sei.display_orientation.hflip || 
s->sei.display_orientation.vflip)) {
-double angle = s->sei.display_orientation.anticlockwise_rotation * 360 
/ (double) (1 << 16);
+if (sei->display_orientation.present &&
+(sei->display_orientation.anticlockwise_rotation ||
+ sei->display_orientation.hflip || sei->display_orientation.vflip)) {
+double angle = sei->display_orientation.anticlockwise_rotation * 360 / 
(double) (1 << 16);
 AVFrameSideData *rotation = av_frame_new_side_data(out,

AV_FRAME_DATA_DISPLAYMATRIX,
sizeof(int32_t) * 
9);
@@ -2788,17 +2787,17 @@ static int set_side_data(HEVCContext *s)
* (1 - 2 * !!s->sei.display_orientation.vflip);
 av_display_rotation_set((int32_t *)rotation->data, angle);
 av_display_matrix_flip((int32_t *)rotation->data,
-   s->sei.display_orientation.hflip,
-   s->sei.display_orientation.vflip);
+   sei->display_orientation.hflip,
+   sei->display_orientation.vflip);
 }
 
 // Decrement the mastering display flag when IRAP frame has 
no_rasl_output_flag=1
 // so the side data persists for the entire coded video sequence.
-if (s->sei.mastering_display.present > 0 &&
+if (s && sei->mastering_display.present > 0 &&
 IS_IRAP(s) && s->no_rasl_output_flag) {
-s->sei.mastering_display.present--;
+sei->mastering_display.present--;
 }
-if (s->sei.mastering_display.present) {
+if (sei->mastering_display.present) {
 // HEVC uses a g,b,r ordering, which we convert to a more natural r,g,b
 const int mapping[3] = {2, 0, 1};
 const int chroma_den = 5;
@@ -2811,25 +2810,25 @@ static int set_side_data(HEVCContext *s)
 
 for (i = 0; i < 3; i++) {
 const int j = mapping[i];
-metadata->display_primaries[i][0].num = 
s->sei.mastering_display.display_primaries[j][0];
+metadata->display_primaries[i][0].num = 
sei->mastering_display.display_primaries[j][0];
 metadata->display_primaries[i][0].den = chroma_den;
-metadata->display_primaries[i][1].num = 
s->sei.mastering_display.display_primaries[j][1];
+metadata->display_primaries[i][1].num = 
sei->mastering_display.display_primaries[j][1];
 

[FFmpeg-devel] [PATCH 3/6] avcodec/mpeg12dec: make mpeg_decode_user_data() accessible

2022-05-26 Thread softworkz
From: softworkz 

Signed-off-by: softworkz 
---
 libavcodec/mpeg12.h| 28 
 libavcodec/mpeg12dec.c | 40 +---
 2 files changed, 33 insertions(+), 35 deletions(-)

diff --git a/libavcodec/mpeg12.h b/libavcodec/mpeg12.h
index e0406b32d9..84a829cdd3 100644
--- a/libavcodec/mpeg12.h
+++ b/libavcodec/mpeg12.h
@@ -23,6 +23,7 @@
 #define AVCODEC_MPEG12_H
 
 #include "mpegvideo.h"
+#include "libavutil/stereo3d.h"
 
 /* Start codes. */
 #define SEQ_END_CODE0x01b7
@@ -34,6 +35,31 @@
 #define EXT_START_CODE  0x01b5
 #define USER_START_CODE 0x01b2
 
+typedef struct Mpeg1Context {
+MpegEncContext mpeg_enc_ctx;
+int mpeg_enc_ctx_allocated; /* true if decoding context allocated */
+int repeat_field;   /* true if we must repeat the field */
+AVPanScan pan_scan; /* some temporary storage for the panscan */
+AVStereo3D stereo3d;
+int has_stereo3d;
+AVBufferRef *a53_buf_ref;
+uint8_t afd;
+int has_afd;
+int slice_count;
+unsigned aspect_ratio_info;
+AVRational save_aspect;
+int save_width, save_height, save_progressive_seq;
+int rc_buffer_size;
+AVRational frame_rate_ext;  /* MPEG-2 specific framerate modificator */
+unsigned frame_rate_index;
+int sync;   /* Did we reach a sync point like a 
GOP/SEQ/KEYFrame? */
+int closed_gop;
+int tmpgexs;
+int first_slice;
+int extradata_decoded;
+int64_t timecode_frame_start;  /*< GOP timecode frame start number, in non 
drop frame format */
+} Mpeg1Context;
+
 void ff_mpeg12_common_init(MpegEncContext *s);
 
 void ff_mpeg1_clean_buffers(MpegEncContext *s);
@@ -45,4 +71,6 @@ void ff_mpeg12_find_best_frame_rate(AVRational frame_rate,
 int *code, int *ext_n, int *ext_d,
 int nonstandard);
 
+void ff_mpeg_decode_user_data(AVCodecContext *avctx, Mpeg1Context *s1, const 
uint8_t *p, int buf_size);
+
 #endif /* AVCODEC_MPEG12_H */
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index e9bde48f7a..11d2b58185 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -58,31 +58,6 @@
 
 #define A53_MAX_CC_COUNT 2000
 
-typedef struct Mpeg1Context {
-MpegEncContext mpeg_enc_ctx;
-int mpeg_enc_ctx_allocated; /* true if decoding context allocated */
-int repeat_field;   /* true if we must repeat the field */
-AVPanScan pan_scan; /* some temporary storage for the panscan */
-AVStereo3D stereo3d;
-int has_stereo3d;
-AVBufferRef *a53_buf_ref;
-uint8_t afd;
-int has_afd;
-int slice_count;
-unsigned aspect_ratio_info;
-AVRational save_aspect;
-int save_width, save_height, save_progressive_seq;
-int rc_buffer_size;
-AVRational frame_rate_ext;  /* MPEG-2 specific framerate modificator */
-unsigned frame_rate_index;
-int sync;   /* Did we reach a sync point like a 
GOP/SEQ/KEYFrame? */
-int closed_gop;
-int tmpgexs;
-int first_slice;
-int extradata_decoded;
-int64_t timecode_frame_start;  /*< GOP timecode frame start number, in non 
drop frame format */
-} Mpeg1Context;
-
 #define MB_TYPE_ZERO_MV   0x2000
 
 static const uint32_t ptype2mb_type[7] = {
@@ -2198,11 +2173,9 @@ static int vcr2_init_sequence(AVCodecContext *avctx)
 return 0;
 }
 
-static int mpeg_decode_a53_cc(AVCodecContext *avctx,
+static int mpeg_decode_a53_cc(AVCodecContext *avctx, Mpeg1Context *s1,
   const uint8_t *p, int buf_size)
 {
-Mpeg1Context *s1 = avctx->priv_data;
-
 if (buf_size >= 6 &&
 p[0] == 'G' && p[1] == 'A' && p[2] == '9' && p[3] == '4' &&
 p[4] == 3 && (p[5] & 0x40)) {
@@ -2333,12 +2306,9 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
 return 0;
 }
 
-static void mpeg_decode_user_data(AVCodecContext *avctx,
-  const uint8_t *p, int buf_size)
+void ff_mpeg_decode_user_data(AVCodecContext *avctx, Mpeg1Context *s1, const 
uint8_t *p, int buf_size)
 {
-Mpeg1Context *s = avctx->priv_data;
 const uint8_t *buf_end = p + buf_size;
-Mpeg1Context *s1 = avctx->priv_data;
 
 #if 0
 int i;
@@ -2352,7 +2322,7 @@ static void mpeg_decode_user_data(AVCodecContext *avctx,
 int i;
 for(i=0; i<20; i++)
 if (!memcmp(p+i, "\0TMPGEXS\0", 9)){
-s->tmpgexs= 1;
+s1->tmpgexs= 1;
 }
 }
 /* we parse the DTG active format information */
@@ -2398,7 +2368,7 @@ static void mpeg_decode_user_data(AVCodecContext *avctx,
 break;
 }
 }
-} else if (mpeg_decode_a53_cc(avctx, p, buf_size)) {
+} else if (mpeg_decode_a53_cc(avctx, s1, p, buf_size)) {
 return;
 }
 }
@@ -2590,7 +2560,7 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame 
*picture,
 }
 

[FFmpeg-devel] [PATCH 2/6] avcodec/vpp_qsv: Copy side data from input to output frame

2022-05-26 Thread softworkz
From: softworkz 

Signed-off-by: softworkz 
---
 libavfilter/qsvvpp.c |  6 ++
 libavfilter/vf_overlay_qsv.c | 19 +++
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index 954f882637..f4bf628073 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -843,6 +843,12 @@ int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink 
*inlink, AVFrame *picr
 return AVERROR(EAGAIN);
 break;
 }
+
+av_frame_remove_all_side_data(out_frame->frame);
+ret = av_frame_copy_side_data(out_frame->frame, in_frame->frame, 0);
+if (ret < 0)
+return ret;
+
 out_frame->frame->pts = av_rescale_q(out_frame->surface.Data.TimeStamp,
  default_tb, outlink->time_base);
 
diff --git a/libavfilter/vf_overlay_qsv.c b/libavfilter/vf_overlay_qsv.c
index 7e76b39aa9..e15214dbf2 100644
--- a/libavfilter/vf_overlay_qsv.c
+++ b/libavfilter/vf_overlay_qsv.c
@@ -231,13 +231,24 @@ static int process_frame(FFFrameSync *fs)
 {
 AVFilterContext  *ctx = fs->parent;
 QSVOverlayContext  *s = fs->opaque;
+AVFrame   *frame0 = NULL;
 AVFrame*frame = NULL;
-int   ret = 0, i;
+int   ret = 0;
 
-for (i = 0; i < ctx->nb_inputs; i++) {
+for (unsigned i = 0; i < ctx->nb_inputs; i++) {
 ret = ff_framesync_get_frame(fs, i, , 0);
-if (ret == 0)
-ret = ff_qsvvpp_filter_frame(s->qsv, ctx->inputs[i], frame);
+
+if (ret == 0) {
+if (i == 0)
+frame0 = frame;
+else {
+av_frame_remove_all_side_data(frame);
+ret = av_frame_copy_side_data(frame, frame0, 0);
+}
+
+ret = ret < 0 ? ret : ff_qsvvpp_filter_frame(s->qsv, 
ctx->inputs[i], frame);
+}
+
 if (ret < 0 && ret != AVERROR(EAGAIN))
 break;
 }
-- 
ffmpeg-codebot

___
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/6] avutil/frame: Add av_frame_copy_side_data() and av_frame_remove_all_side_data()

2022-05-26 Thread softworkz
From: softworkz 

Signed-off-by: softworkz 
Signed-off-by: Anton Khirnov 
---
 doc/APIchanges  |  4 +++
 libavutil/frame.c   | 67 +++--
 libavutil/frame.h   | 32 ++
 libavutil/version.h |  2 +-
 4 files changed, 78 insertions(+), 27 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 337f1466d8..e5dd6f1e83 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,10 @@ libavutil: 2021-04-27
 
 API changes, most recent first:
 
+2022-05-26 - x - lavu 57.26.100 - frame.h
+  Add av_frame_remove_all_side_data(), av_frame_copy_side_data(),
+  AV_FRAME_TRANSFER_SD_COPY, and AV_FRAME_TRANSFER_SD_FILTER.
+
 2022-05-23 - x - lavu 57.25.100 - avutil.h
   Deprecate av_fopen_utf8() without replacement.
 
diff --git a/libavutil/frame.c b/libavutil/frame.c
index fbb869fffa..bfe575612d 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -271,9 +271,45 @@ FF_ENABLE_DEPRECATION_WARNINGS
 return AVERROR(EINVAL);
 }
 
+void av_frame_remove_all_side_data(AVFrame *frame)
+{
+wipe_side_data(frame);
+}
+
+int av_frame_copy_side_data(AVFrame* dst, const AVFrame* src, int flags)
+{
+for (unsigned i = 0; i < src->nb_side_data; i++) {
+const AVFrameSideData *sd_src = src->side_data[i];
+AVFrameSideData *sd_dst;
+if ((flags & AV_FRAME_TRANSFER_SD_FILTER) &&
+sd_src->type == AV_FRAME_DATA_PANSCAN &&
+(src->width != dst->width || src->height != dst->height))
+continue;
+if (flags & AV_FRAME_TRANSFER_SD_COPY) {
+sd_dst = av_frame_new_side_data(dst, sd_src->type,
+sd_src->size);
+if (!sd_dst) {
+wipe_side_data(dst);
+return AVERROR(ENOMEM);
+}
+memcpy(sd_dst->data, sd_src->data, sd_src->size);
+} else {
+AVBufferRef *ref = av_buffer_ref(sd_src->buf);
+sd_dst = av_frame_new_side_data_from_buf(dst, sd_src->type, ref);
+if (!sd_dst) {
+av_buffer_unref();
+wipe_side_data(dst);
+return AVERROR(ENOMEM);
+}
+}
+av_dict_copy(_dst->metadata, sd_src->metadata, 0);
+}
+return 0;
+}
+
 static int frame_copy_props(AVFrame *dst, const AVFrame *src, int force_copy)
 {
-int ret, i;
+int ret;
 
 dst->key_frame  = src->key_frame;
 dst->pict_type  = src->pict_type;
@@ -309,31 +345,10 @@ static int frame_copy_props(AVFrame *dst, const AVFrame 
*src, int force_copy)
 
 av_dict_copy(>metadata, src->metadata, 0);
 
-for (i = 0; i < src->nb_side_data; i++) {
-const AVFrameSideData *sd_src = src->side_data[i];
-AVFrameSideData *sd_dst;
-if (   sd_src->type == AV_FRAME_DATA_PANSCAN
-&& (src->width != dst->width || src->height != dst->height))
-continue;
-if (force_copy) {
-sd_dst = av_frame_new_side_data(dst, sd_src->type,
-sd_src->size);
-if (!sd_dst) {
-wipe_side_data(dst);
-return AVERROR(ENOMEM);
-}
-memcpy(sd_dst->data, sd_src->data, sd_src->size);
-} else {
-AVBufferRef *ref = av_buffer_ref(sd_src->buf);
-sd_dst = av_frame_new_side_data_from_buf(dst, sd_src->type, ref);
-if (!sd_dst) {
-av_buffer_unref();
-wipe_side_data(dst);
-return AVERROR(ENOMEM);
-}
-}
-av_dict_copy(_dst->metadata, sd_src->metadata, 0);
-}
+if ((ret = av_frame_copy_side_data(dst, src,
+(force_copy ? AV_FRAME_TRANSFER_SD_COPY : 0) |
+AV_FRAME_TRANSFER_SD_FILTER) < 0))
+return ret;
 
 ret = av_buffer_replace(>opaque_ref, src->opaque_ref);
 ret |= av_buffer_replace(>private_ref, src->private_ref);
diff --git a/libavutil/frame.h b/libavutil/frame.h
index 33fac2054c..a868fa70d7 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -850,6 +850,30 @@ int av_frame_copy(AVFrame *dst, const AVFrame *src);
  */
 int av_frame_copy_props(AVFrame *dst, const AVFrame *src);
 
+
+/**
+ * Copy side data, rather than creating new references.
+ */
+#define AV_FRAME_TRANSFER_SD_COPY  (1 << 0)
+/**
+ * Filter out side data that does not match dst properties.
+ */
+#define AV_FRAME_TRANSFER_SD_FILTER(1 << 1)
+
+/**
+ * Copy all side-data from src to dst.
+ *
+ * @param dst a frame to which the side data should be copied.
+ * @param src a frame from which to copy the side data.
+ * @param flags a combination of AV_FRAME_TRANSFER_SD_*
+ *
+ * @return >= 0 on success, a negative AVERROR on error.
+ *
+ * @note This function will create new references to side data buffers in src,
+ * unless the AV_FRAME_TRANSFER_SD_COPY flag is passed.
+ */
+int av_frame_copy_side_data(AVFrame* 

[FFmpeg-devel] [PATCH 0/6] Implement SEI parsing for QSV decoders

2022-05-26 Thread ffmpegagent
Missing SEI information has always been a major drawback when using the QSV
decoders. I used to think that there's no chance to get at the data without
explicit implementation from the MSDK side (or doing something weird like
parsing in parallel). It turned out that there's a hardly known api method
that provides access to all SEI (h264/hevc) or user data (mpeg2video).

This allows to get things like closed captions, frame packing, display
orientation, HDR data (mastering display, content light level, etc.) without
having to rely on those data being provided by the MSDK as extended buffers.

The commit "Implement SEI parsing for QSV decoders" includes some hard-coded
workarounds for MSDK bugs which I reported:
https://github.com/Intel-Media-SDK/MediaSDK/issues/2597#issuecomment-1072795311

But that doesn't help. Those bugs exist and I'm sharing my workarounds,
which are empirically determined by testing a range of files. If someone is
interested, I can provide private access to a repository where we have been
testing this. Alternatively, I could also leave those workarounds out, and
just skip those SEI types.

In a previous version of this patchset, there was a concern that payload
data might need to be re-ordered. Meanwhile I have researched this carefully
and the conclusion is that this is not required.

My detailed analysis can be found here:
https://gist.github.com/softworkz/36c49586a8610813a32270ee3947a932

softworkz (6):
  avutil/frame: Add av_frame_copy_side_data() and
av_frame_remove_all_side_data()
  avcodec/vpp_qsv: Copy side data from input to output frame
  avcodec/mpeg12dec: make mpeg_decode_user_data() accessible
  avcodec/hevcdec: make set_side_data() accessible
  avcodec/h264dec: make h264_export_frame_props() accessible
  avcodec/qsvdec: Implement SEI parsing for QSV decoders

 doc/APIchanges   |   4 +
 libavcodec/h264_slice.c  |  98 +++
 libavcodec/h264dec.h |   2 +
 libavcodec/hevcdec.c | 117 +-
 libavcodec/hevcdec.h |   2 +
 libavcodec/mpeg12.h  |  28 +
 libavcodec/mpeg12dec.c   |  40 +-
 libavcodec/qsvdec.c  | 233 +++
 libavfilter/qsvvpp.c |   6 +
 libavfilter/vf_overlay_qsv.c |  19 ++-
 libavutil/frame.c|  67 ++
 libavutil/frame.h|  32 +
 libavutil/version.h  |   2 +-
 13 files changed, 477 insertions(+), 173 deletions(-)


base-commit: b033913d1c5998a29dfd13e9906dd707ff6eff12
Published-As: 
https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-31%2Fsoftworkz%2Fsubmit_qsv_sei-v1
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg 
pr-ffstaging-31/softworkz/submit_qsv_sei-v1
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/31
-- 
ffmpeg-codebot
___
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 v5] libx264: Set min build version to 158

2022-05-26 Thread Matt Oliver
From: Matt Oliver 

Was "[PATCH] libx264: Do not explicitly set X264_API_IMPORTS"

Setting X264_API_IMPORTS only affects msvc builds and it breaks
linking to static builds (although is required for shared builds).
This flag is set by x264 in its pkgconfig as required since build
158 (a615f027ed172e2dd5380e736d487aa858a0c4ff) from July 2019.
So this patch updates configure to require a newer x264 build that
correctly sets the imports flag.

The requirement for 158 is applied for msvc builds only,
no change is made for all other cases.

Co-authored-by: softworkz 
Signed-off-by: softworkz 
Signed-off-by: Matt Oliver 
---
libx264: Set min build version to 158

I'm submitting this patch on behalf of Matt with his permission.

There was agreement that the >= 158 version requirement should be
applied to MSVC builds only.

v2: restrict the version requirement to msvc builds
v3: fix unintended author change
v4: add missing braces
v5: fixed condition (again ;-)

Published-As: 
https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-30%2Fsoftworkz%2Fsubmit_x264_api_imports_matt-v5
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg 
pr-ffstaging-30/softworkz/submit_x264_api_imports_matt-v5
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/30

Range-diff vs v4:

 1:  0d1bee35b0 ! 1:  8c4fe7ffc2 libx264: Set min build version to 158
 @@ configure: enabled libvpx&& {
  - require_cpp_condition libx264 x264.h 
"X264_BUILD >= 118" &&
  - check_cpp_condition libx262 x264.h 
"X264_MPEG2"
  +enabled libx264   && check_pkg_config libx264 x264 "stdint.h 
x264.h" x264_encoder_encode &&
 -+ { require_cpp_condition libx264 x264.h 
"X264_BUILD >= 158" ||
 -+ { "$toolchain" != msvc && 
require_cpp_condition libx264 x264.h "X264_BUILD >= 118"; }; }
 ++ require_cpp_condition libx264 x264.h 
"X264_BUILD >= 118" && {
 ++ "$toolchain" != msvc || 
require_cpp_condition libx264 x264.h "X264_BUILD >= 158"; }
   enabled libx265   && require_pkg_config libx265 x265 x265.h 
x265_api_get &&
require_cpp_condition libx265 x265.h 
"X265_BUILD >= 70"
   enabled libxavs   && require libxavs "stdint.h xavs.h" 
xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"


 configure| 8 +++-
 libavcodec/libx264.c | 4 
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index f115b21064..e46d362b04 100755
--- a/configure
+++ b/configure
@@ -6656,11 +6656,9 @@ enabled libvpx&& {
 enabled libwebp   && {
 enabled libwebp_encoder  && require_pkg_config libwebp "libwebp >= 
0.2.0" webp/encode.h WebPGetEncoderVersion
 enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder 
"libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
-enabled libx264   && { check_pkg_config libx264 x264 "stdint.h x264.h" 
x264_encoder_encode ||
-   { require libx264 "stdint.h x264.h" 
x264_encoder_encode "-lx264 $pthreads_extralibs $libm_extralibs" &&
- warn "using libx264 without pkg-config"; } } 
&&
- require_cpp_condition libx264 x264.h "X264_BUILD 
>= 118" &&
- check_cpp_condition libx262 x264.h "X264_MPEG2"
+enabled libx264   && check_pkg_config libx264 x264 "stdint.h x264.h" 
x264_encoder_encode &&
+ require_cpp_condition libx264 x264.h "X264_BUILD 
>= 118" && {
+ "$toolchain" != msvc || require_cpp_condition 
libx264 x264.h "X264_BUILD >= 158"; }
 enabled libx265   && require_pkg_config libx265 x265 x265.h 
x265_api_get &&
  require_cpp_condition libx265 x265.h "X265_BUILD 
>= 70"
 enabled libxavs   && require libxavs "stdint.h xavs.h" 
xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 4ce3791ae8..14177b3016 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -37,10 +37,6 @@
 #include "atsc_a53.h"
 #include "sei.h"
 
-#if defined(_MSC_VER)
-#define X264_API_IMPORTS 1
-#endif
-
 #include 
 #include 
 #include 

base-commit: b033913d1c5998a29dfd13e9906dd707ff6eff12
-- 
ffmpeg-codebot
___
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] avcodec/mfenc: Dynamically load MFPlat.DLL

2022-05-26 Thread Trystan Mata
> In testing of it, I noted that you still need to link against -lmfuuid
> when building with MSVC (but in mingw, those UUIDs are defined inline in
> headers I think).

Ah, I just used used mingw for my testing, sorry.

> Additionally, I realized I do prefer to keep using plain LoadLibraryA
> and FreeLibrary instead of using the wrapper, as this file is all quite
> Windows specific code; using the direct Windows APIs makes it clearer
> what's going on.

I'm not used at all to the Windows APIs, 

> Finally, I removed the extra "" in the GetProcAddress call - I don't
> remember if you ever responded to why that was there.

I didn't see the "Why the extra "" here?", it was the first time that I
did a macro with conversion to text. I just thought that at least a ""
was required to text convert with #.

> As the patch seemed fine otherwise, I went ahead and pushed it. Thanks!

Thank for your reviews !

// Trystan
___
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/aarch64: hevc_sao reschedule slightly

2022-05-26 Thread J. Dekker


On 25 May 2022, at 12:23, Martin Storsjö wrote:

> On Wed, 25 May 2022, J. Dekker wrote:
>
>> Signed-off-by: J. Dekker 
>> ---
>> libavcodec/aarch64/hevcdsp_sao_neon.S | 30 +++
>> 1 file changed, 17 insertions(+), 13 deletions(-)
>>
>> diff --git a/libavcodec/aarch64/hevcdsp_sao_neon.S 
>> b/libavcodec/aarch64/hevcdsp_sao_neon.S
>> index efd8112af4..39056d76ee 100644
>> --- a/libavcodec/aarch64/hevcdsp_sao_neon.S
>> +++ b/libavcodec/aarch64/hevcdsp_sao_neon.S
>> @@ -24,6 +24,10 @@
>>
>> #include "libavutil/aarch64/asm.S"
>>
>> +#define MAX_PB_SIZE 64
>> +#define AV_INPUT_BUFFER_PADDING_SIZE 64
>> +#define SAO_STRIDE (2*MAX_PB_SIZE + AV_INPUT_BUFFER_PADDING_SIZE)
>> +
>> // void sao_band_filter(uint8_t *_dst, uint8_t *_src,
>> //  ptrdiff_t stride_dst, ptrdiff_t stride_src,
>> //  int16_t *sao_offset_val, int sao_left_class,
>> @@ -56,6 +60,7 @@ function ff_hevc_sao_band_filter_8x8_8_neon, export=1
>> // |xDE#xAD|xCA#xFE|xBE#xEF|xFE#xED|
>> // +--->
>> //i-0 i-1 i-2 i-3
>> +subsw8, w8,  #8
>> ld1 {v2.8b}, [x1], #8  // dst[x] = 
>> av_clip_pixel(src[x] + offset_table[src[x] >> shift]);
>
> For cases like this, it's usually better to place the subs after the ld1, 
> because the ld1 will take a couple cycles before the result is available 
> (which the next instruction needs).
>
>> uxtlv0.8h,  v2.8b  // load src[x]
>> ushrv2.8h,  v0.8h, #3  // >> BIT_DEPTH - 3
>> @@ -66,7 +71,7 @@ function ff_hevc_sao_band_filter_8x8_8_neon, export=1
>> add v1.8h,  v0.8h, v2.8h   // src[x] + table
>> sqxtun  v4.8b,  v1.8h  // clip + narrow
>> st1 {v4.8b}, [x0], #8  // store
>> -subsw8, w8,  #8// done 8 pixels
>> +// done 8 pixels
>> bne 2b
>> subsw7, w7,  #1// finished line, prep. 
>> new
>> add x0, x0,  x2// dst += stride_dst
>> @@ -75,12 +80,11 @@ function ff_hevc_sao_band_filter_8x8_8_neon, export=1
>> ret
>> endfunc
>>
>> -// ASSUMES STRIDE_SRC = 192
>> .Lsao_edge_pos:
>> .word 1 // horizontal
>> -.word 192 // vertical
>> -.word 192 + 1 // 45 degree
>> -.word 192 - 1 // 135 degree
>> +.word SAO_STRIDE // vertical
>> +.word SAO_STRIDE + 1 // 45 degree
>> +.word SAO_STRIDE - 1 // 135 degree
>>
>> // ff_hevc_sao_edge_filter_16x16_8_neon(char *dst, char *src, ptrdiff 
>> stride_dst,
>> //  int16 *sao_offset_val, int eo, int 
>> width, int height)
>> @@ -98,7 +102,7 @@ function ff_hevc_sao_edge_filter_16x16_8_neon, export=1
>> uzp2v1.16b, v3.16b, v3.16b // sao_offset_val -> upper
>> uzp1v0.16b, v3.16b, v3.16b // sao_offset_val -> lower
>> moviv2.16b, #2
>> -mov x15, #192
>> +mov x15, #SAO_STRIDE
>> // strides between end of line and next src/dst
>> sub x15, x15, x5   // stride_src - width
>> sub x16, x2, x5// stride_dst - width
>> @@ -108,6 +112,7 @@ function ff_hevc_sao_edge_filter_16x16_8_neon, export=1
>> sub x12, x11, x4   // src_a (prev) = src - 
>> sao_edge_pos
>> add x13, x11, x4   // src_b (next) = src + 
>> sao_edge_pos
>> 2:  // process 16 bytes
>> +subsx14, x14, #16
>> ld1 {v3.16b}, [x11], #16   // load src
>> ld1 {v4.16b}, [x12], #16   // load src_a (prev)
>> ld1 {v5.16b}, [x13], #16   // load src_b (next)
>
> Same thing here, it's better to do the subs after firing off all loads.
>
>> @@ -130,12 +135,12 @@ function ff_hevc_sao_edge_filter_16x16_8_neon, export=1
>> sqxtun  v3.8b, v20.8h
>> sqxtun2 v3.16b, v21.8h
>> st1 {v3.16b}, [x0], #16
>> -subsx14, x14, #16  // filtered 16 bytes
>> +// filtered 16 bytes
>> b.ne2b // do we have width to 
>> filter?
>> // no width to filter, setup next line
>> +subsw6, w6, #1 // filtered line
>> add x11, x11, x15  // stride src to next line
>> add x0, x0, x16// stride dst to next line
>> -subsw6, w6, #1 // filtered line
>> b.ne1b // do we have lines to 
>> process?
>
> This looks good!
>
>> // no lines to filter
>> ret
>> @@ -156,12 +161,12 @@ function ff_hevc_sao_edge_filter_8x8_8_neon, export=1
>>