Re: [FFmpeg-devel] configure error: pkg not found even though it is available

2022-01-25 Thread Helmut K. C. Tessarek
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512


On 2022-01-26 02:36, Gyan Doshi wrote:
> Confirm that /Users/Shared/ffmpeg/sw/include/libvmaf  has current header
> which declares vmaf_init()

Yes, the header file exists in the directory and the function vmaf_init() is
declared.

The vmaf version commit hash is aa1dd0b3. I compiled this version right
before ffmpeg and all libvmaf files have the correct timestamp (todays).

I can only say that the compile run worked a few days ago.

Cheers,
  K. C.

P.S.: Heading to bed. Will be up in 5-6 hours.


- -- 
regards Helmut K. C. Tessarek  KeyID 0x172380A011EF4944
Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723 80A0 11EF 4944

/*
   Thou shalt not follow the NULL pointer for chaos and madness
   await thee at its end.
*/
-BEGIN PGP SIGNATURE-

iQIzBAEBCgAdFiEE191csiqpm8f5Ln9WvgmFNJ1E3QAFAmHw/wUACgkQvgmFNJ1E
3QAJ+g/+KD2+s5BMjr3UkZL+qkBqt7wV5DpZ84U3q9DvO1UnBlUnTKh5FT+3Zu6t
CY13bcQimYtRB9TPGvJ95mTUSMlNIOK4wTCEqumlfwuy5Me7fTZfnv34gNLDSucd
izJL6CG/G6om9prROgVQFMsEizunEFBJnWmSxq+GZsj0VOm0HKHYLmMik0VZmt4N
tnVF5uX2NXZGG9he028KUgw3bIj0+v70lewzSPYwcbn+NVK5V3dV4pGK8l76HwMR
1VOOnB9qUdEbZ3+1kEESJ0X9YqbF26Yv/8xb2L/2NW6v4adQUAr97ARuPuMFglMF
jdBLJR3jOgOJ+HNezQy0ml0L/Xc7sHxCVhbgmg0CoLIsNQIFmjyt7Nv2zHhK/USy
Kxp7iddH3K62emQbLx68CLthBJMYJJqcPPZ7ujA5JS3Yuaatqq4JehcBI6mxwlzm
7moE8XzG6M8HQJsQCDAIt/a7IvguiAp/Gm7P9u6n9idgUlUmZxn2Sr7HejCn5unY
ZB5sx/uVnyyIAEHVNFgDUNKHv6aWzov02s87PjHGdM3THLJpyZZ9zJumvzXw5Xsn
USLQ/4FTZumNBWbDmHzyFjwaTC/yXjWNCtUmKJyQOMD2m0lJUHOfvlWMWR++yfTp
1SNfEeoApW5ZSkxLdCm55BzQ0uGtpbP1QfeA9tyQTRPZBxXbrxI=
=s28/
-END 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] configure error: pkg not found even though it is available

2022-01-25 Thread Gyan Doshi



On 2022-01-26 12:55 pm, Helmut K. C. Tessarek wrote:

Hello,

I compile the static binaries for macOS and just got a configure error:

ERROR: libvmaf >= 2.0.0 not found using pkg-config

The file looks as follows:

$ cat libvmaf.pc
prefix=/Users/Shared/ffmpeg/sw
libdir=${prefix}/lib
includedir=${prefix}/include

Name: libvmaf
Description: VMAF, Video Multimethod Assessment Fusion
Version: 2.3.0
Libs: -L${libdir} -lvmaf -lm
Cflags: -I${includedir} -I${includedir}/libvmaf

And the library also exists in the lib directory.

The full config.log is here: https://evermeet.cx/pub/tmp/config.log


Specific error is

    error: use of undeclared identifier 'vmaf_init'

The filter includes  

Confirm that /Users/Shared/ffmpeg/sw/include/libvmaf  has current header 
which declares vmaf_init()



This commit broke it: 3d29724c00


It builds here.

Regards,
Gyan
___
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] configure error: pkg not found even though it is available

2022-01-25 Thread Helmut K. C. Tessarek
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Hello,

I compile the static binaries for macOS and just got a configure error:

ERROR: libvmaf >= 2.0.0 not found using pkg-config

The file looks as follows:

$ cat libvmaf.pc
prefix=/Users/Shared/ffmpeg/sw
libdir=${prefix}/lib
includedir=${prefix}/include

Name: libvmaf
Description: VMAF, Video Multimethod Assessment Fusion
Version: 2.3.0
Libs: -L${libdir} -lvmaf -lm
Cflags: -I${includedir} -I${includedir}/libvmaf

And the library also exists in the lib directory.

The full config.log is here: https://evermeet.cx/pub/tmp/config.log

This commit broke it: 3d29724c00

Cheers,
  K. C.

- -- 
regards Helmut K. C. Tessarek  KeyID 0x172380A011EF4944
Key fingerprint = 8A55 70C1 BD85 D34E ADBC 386C 1723 80A0 11EF 4944

/*
   Thou shalt not follow the NULL pointer for chaos and madness
   await thee at its end.
*/
-BEGIN PGP SIGNATURE-

iQIzBAEBCgAdFiEE191csiqpm8f5Ln9WvgmFNJ1E3QAFAmHw94cACgkQvgmFNJ1E
3QBHOxAAsb5hqhnHZb9pGAaln+DywL/YgnCUsvpgMGIqHPdi6aa2/ivcuuuXtVjv
Bi0+JevJ8FkDcNGjhjy0bz1zeV1iVqkRTk+rpGgHI1v9XlTCVE/Jxtx9//F8J8cj
fpVFSp13Dy2LCDGLC5CNHhAMKJ8hamFskF0D0W47E1ICW8nGa/1F4Dm8RHKnvMiz
OodBHuWl3aejojQSrNDh1jYDi11pFIscSCQviiZWghYFjswPnRCIy93PfWUcKOZD
06GhLJv2QXCXJmKbrc2i/fupdw0jUF0bdAYLWBxR29pBd+ug0Ler0StZslp2Jnc2
kwmqcioO8HCokC4p1CjhWrPVKjpgXmJ1ZHhHcNJFTnOFQKmNeVgOGU2jLaaaTrIb
+KWXUsgF9c1HR4IX2Uy/BWbDDpsGHvbdDkmq0ZOTE80h1IiQNttN7Z3fL4wj26ys
RqPT69DlvIC/Z6F9vt5uTIg+Y5hLWDOShVVZ44ZEJ/1DPfOBvWHZMzPROeSSKWXd
eG3TkWpQ5TcZD80Pdh/IM0GtHCUFWJMbW/aZXpZ3enrmcxlOl4+hfJ7kFnDXGyuT
be7sTmx+BnrvxDha6xrsU+Ami0NI9B/UfBDMM9Diqn9tmtusPu3SqTRc94ln5O6F
zuTeEd8gYtvZ5XYkiFGIcum/kN3WxLGUWxIdybPWQCnp6qRzBvo=
=eINl
-END 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] lavu/tx: rewrite internal code as a tree-based codelet constructor

2022-01-25 Thread Lynne
25 Jan 2022, 18:17 by one...@gmail.com:

> On Tue, Jan 25, 2022 at 11:46 AM Lynne  wrote:
>
>> 21 Jan 2022, 09:51 by d...@lynne.ee:
>>
>> > 21 Jan 2022, 09:33 by d...@lynne.ee:
>> >
>> >> This commit rewrites the internal transform code into a constructor
>> >> that stitches transforms (codelets).
>> >> This allows for transforms to reuse arbitrary parts of other
>> >> transforms, and allows transforms to be stacked onto one
>> >> another (such as a full iMDCT using a half-iMDCT which in turn
>> >> uses an FFT). It also permits for each step to be individually
>> >> replaced by assembly or a custom implementation (such as an ASIC).
>> >>
>> >> Patch attached.
>> >>
>> >
>> > Forgot that I disabled double and int32 transforms to speed up
>> > testing, reenabled locally and on my github tx_tree branch.
>> > Also removed some inactive debug code.
>> > https://github.com/cyanreg/FFmpeg/tree/tx_tree
>> >
>>
>> I fixed bugs and improved to code more, and I think it's ready
>> for merging now.
>> The rdft is no longer bound by any convention, and its
>> scale may be changed by the user, eliminating after-transform
>> multiplies that are used pretty much everywhere in our code.
>>
>> If someone (looks at Paul) gives it a test or converts a filter,
>> would be nice. I've only tested it on my synthetic benchmarks:
>> https://github.com/cyanreg/lavu_fft_test
>>
>
>
> Will try it once its applied. Thanks.
>

Applied.
It's around 20% faster than lavc's rdft for powers of two lengths.
Non-power-of-two lengths are partially SIMD'd, so they're usable too.
I'll SIMD the small O(n) rdft loop once I'm done with NEON's and
PFA's SIMD. If you find bugs ping me on IRC.
___
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 1/2] libavcodec/vaapi_decode: fix the problem that init_pool_size < nb_surface

2022-01-25 Thread Xiang, Haihao
On Tue, 2022-01-11 at 14:55 +0800, Wenbin Chen wrote:
> For vaapi if the init_pool_size is not zero, the pool size is fixed.
> This means max surfaces is init_pool_size, but when mapping vaapi
> frame to qsv frame, the init_pool_size < nb_surface. The cause is that
> vaapi_decode_make_config() config the init_pool_size and it is called
> twice. The first time is to init frame_context and the second time is to
> init codec. On the second time the init_pool_size is changed to original
> value so the init_pool_size is lower than the reall size because
> pool_size used to initialize frame_context need to plus thread_count and
> 3 (guarantee 4 base work surfaces). Now add code to make sure
> init_pool_size is only set once. Now the following commandline works:
> 
> ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 \
> -hwaccel_output_format vaapi -i input.264 \
> -vf "hwmap=derive_device=qsv,format=qsv" \
> -c:v h264_qsv output.264
> 
> Signed-off-by: Wenbin Chen 
> ---
>  libavcodec/vaapi_decode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
> index 665af370ed..da0e72b10b 100644
> --- a/libavcodec/vaapi_decode.c
> +++ b/libavcodec/vaapi_decode.c
> @@ -650,7 +650,7 @@ int ff_vaapi_decode_init(AVCodecContext *avctx)
>  ctx->hwctx  = ctx->device->hwctx;
>  
>  err = vaapi_decode_make_config(avctx, ctx->frames->device_ref,
> -   >va_config, avctx->hw_frames_ctx);
> +   >va_config, NULL);
>  if (err)
>  goto fail;
>  

LGTM, and the command works well for me now. 

Will aplly

Thanks
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] Fix setsockopt IP_MULTICAST_TTL on OpenBSD

2022-01-25 Thread lance . lmwang
On Tue, Jan 25, 2022 at 04:28:33PM -0800, Chad Fraleigh wrote:
> Since apparently linux will auto-detect (as mentioned by Marton Balint), 
> based on the optlen parameter, just using unsigned char in all cases seems to 
> be the cleanest. However, I would advise including a comment in the code to 
> that effect which says to ignore the [outdated] linux documentation (so 
> someone doesn't needlessly "correct" it in the future).
> 

I agree with, use unsigned char is preferable for all system I think.

> I looked at the kernel source and it does work both ways:
> 
> static int do_ip_setsockopt(struct sock *sk, int level, int optname,
> sockptr_t optval, unsigned int optlen)
> {
>  ...
> switch (optname) {
>  ...
> case IP_MULTICAST_TTL:
>  ...
> if (optlen >= sizeof(int)) {
> if (copy_from_sockptr(, optval, sizeof(val)))
> return -EFAULT;
> } else if (optlen >= sizeof(char)) {
> unsigned char ucval;
> 
> if (copy_from_sockptr(, optval, sizeof(ucval)))
> return -EFAULT;
> val = (int) ucval;
> }
> }
> ...
> }
> 
> This check has been in the kernel since at least 2.6.12-rc2 (from Apr 2005). 
> It should work fine, unless newer ffmpeg builds support is needed on older 
> systems. So the only question is how old are the kernels in IoT and android 
> devices which might use the current ffmpeg?
> 
> 
> On 1/24/2022 11:25 PM, lance.lmw...@gmail.com wrote:
> > On Wed, Jan 12, 2022 at 12:13:13AM -0500, Brad Smith wrote:
> >> Fix setsockopt() usage on OpenBSD with IP_MULTICAST_TTL. The field
> >> type should be an unsigned char on anything but Linux.
> >>
> >>
> >> diff --git a/libavformat/udp.c b/libavformat/udp.c
> >> index 180d96a988..29aa865fff 100644
> >> --- a/libavformat/udp.c
> >> +++ b/libavformat/udp.c
> >> @@ -163,7 +163,13 @@ static int udp_set_multicast_ttl(int sockfd, int 
> >> mcastTTL,
> >>  {
> >>  #ifdef IP_MULTICAST_TTL
> >>  if (addr->sa_family == AF_INET) {
> >> -if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
> >> sizeof(mcastTTL)) < 0) {
> >> +#ifdef __linux__
> >> +int ttl = mcastTTL;
> >> +#else
> >> +unsigned char ttl = mcastTTL;
> >> +#endif
> > 
> > 
> > I don't have BSD system for test, but I prefer to use socklen_t, please try 
> > with my proposal patch:
> > 
> > ---
> >  libavformat/udp.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libavformat/udp.c b/libavformat/udp.c
> > index 83c042d079..b9baa0a803 100644
> > --- a/libavformat/udp.c
> > +++ b/libavformat/udp.c
> > @@ -164,7 +164,9 @@ static int udp_set_multicast_ttl(int sockfd, int 
> > mcastTTL,
> >  {
> >  #ifdef IP_MULTICAST_TTL
> >  if (addr->sa_family == AF_INET) {
> > -if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
> > sizeof(mcastTTL)) < 0) {
> > +socklen_t ttl = mcastTTL;
> > +
> > +if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
> > sizeof(ttl)) < 0) {
> >  ff_log_net_error(logctx, AV_LOG_ERROR, 
> > "setsockopt(IP_MULTICAST_TTL)");
> >  return ff_neterrno();
> > 
> > 
> >> +
> >> +if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
> >> sizeof(ttl)) < 0) {
> >>  ff_log_net_error(NULL, AV_LOG_ERROR, 
> >> "setsockopt(IP_MULTICAST_TTL)");
> >>  return ff_neterrno();
> >>  }
> >> ___
> >> 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".

-- 
Thanks,
Limin Wang
___
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] Fix setsockopt IP_MULTICAST_TTL on OpenBSD

2022-01-25 Thread Brad Smith

On 1/25/2022 7:28 PM, Chad Fraleigh wrote:


Since apparently linux will auto-detect (as mentioned by Marton Balint), based on the 
optlen parameter, just using unsigned char in all cases seems to be the cleanest. 
However, I would advise including a comment in the code to that effect which says to 
ignore the [outdated] linux documentation (so someone doesn't needlessly 
"correct" it in the future).

I looked at the kernel source and it does work both ways:

static int do_ip_setsockopt(struct sock *sk, int level, int optname,
 sockptr_t optval, unsigned int optlen)
{
  ...
 switch (optname) {
  ...
 case IP_MULTICAST_TTL:
  ...
 if (optlen >= sizeof(int)) {
 if (copy_from_sockptr(, optval, sizeof(val)))
 return -EFAULT;
 } else if (optlen >= sizeof(char)) {
 unsigned char ucval;

 if (copy_from_sockptr(, optval, sizeof(ucval)))
 return -EFAULT;
 val = (int) ucval;
 }
 }
...
}

This check has been in the kernel since at least 2.6.12-rc2 (from Apr 2005). It 
should work fine, unless newer ffmpeg builds support is needed on older 
systems. So the only question is how old are the kernels in IoT and android 
devices which might use the current ffmpeg?


Thanks. This would he much simpler.

The oldest Android, 1.5, uses the 2.6.27 kernel. The oldest still 
supported Android, 4.4, uses the
3.10 kernel. I cannot imagine anyone shipping anything older than a 3.x 
(something like 3.18) kernel
on anything IoT that is still supported and wanting to ship up to date 
software.


___
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] Fix setsockopt IP_MULTICAST_TTL on OpenBSD

2022-01-25 Thread Chad Fraleigh
Since apparently linux will auto-detect (as mentioned by Marton Balint), based 
on the optlen parameter, just using unsigned char in all cases seems to be the 
cleanest. However, I would advise including a comment in the code to that 
effect which says to ignore the [outdated] linux documentation (so someone 
doesn't needlessly "correct" it in the future).

I looked at the kernel source and it does work both ways:

static int do_ip_setsockopt(struct sock *sk, int level, int optname,
sockptr_t optval, unsigned int optlen)
{
 ...
switch (optname) {
 ...
case IP_MULTICAST_TTL:
 ...
if (optlen >= sizeof(int)) {
if (copy_from_sockptr(, optval, sizeof(val)))
return -EFAULT;
} else if (optlen >= sizeof(char)) {
unsigned char ucval;

if (copy_from_sockptr(, optval, sizeof(ucval)))
return -EFAULT;
val = (int) ucval;
}
}
...
}

This check has been in the kernel since at least 2.6.12-rc2 (from Apr 2005). It 
should work fine, unless newer ffmpeg builds support is needed on older 
systems. So the only question is how old are the kernels in IoT and android 
devices which might use the current ffmpeg?


On 1/24/2022 11:25 PM, lance.lmw...@gmail.com wrote:
> On Wed, Jan 12, 2022 at 12:13:13AM -0500, Brad Smith wrote:
>> Fix setsockopt() usage on OpenBSD with IP_MULTICAST_TTL. The field
>> type should be an unsigned char on anything but Linux.
>>
>>
>> diff --git a/libavformat/udp.c b/libavformat/udp.c
>> index 180d96a988..29aa865fff 100644
>> --- a/libavformat/udp.c
>> +++ b/libavformat/udp.c
>> @@ -163,7 +163,13 @@ static int udp_set_multicast_ttl(int sockfd, int 
>> mcastTTL,
>>  {
>>  #ifdef IP_MULTICAST_TTL
>>  if (addr->sa_family == AF_INET) {
>> -if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
>> sizeof(mcastTTL)) < 0) {
>> +#ifdef __linux__
>> +int ttl = mcastTTL;
>> +#else
>> +unsigned char ttl = mcastTTL;
>> +#endif
> 
> 
> I don't have BSD system for test, but I prefer to use socklen_t, please try 
> with my proposal patch:
> 
> ---
>  libavformat/udp.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/udp.c b/libavformat/udp.c
> index 83c042d079..b9baa0a803 100644
> --- a/libavformat/udp.c
> +++ b/libavformat/udp.c
> @@ -164,7 +164,9 @@ static int udp_set_multicast_ttl(int sockfd, int mcastTTL,
>  {
>  #ifdef IP_MULTICAST_TTL
>  if (addr->sa_family == AF_INET) {
> -if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
> sizeof(mcastTTL)) < 0) {
> +socklen_t ttl = mcastTTL;
> +
> +if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
> sizeof(ttl)) < 0) {
>  ff_log_net_error(logctx, AV_LOG_ERROR, 
> "setsockopt(IP_MULTICAST_TTL)");
>  return ff_neterrno();
> 
> 
>> +
>> +if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , 
>> sizeof(ttl)) < 0) {
>>  ff_log_net_error(NULL, AV_LOG_ERROR, 
>> "setsockopt(IP_MULTICAST_TTL)");
>>  return ff_neterrno();
>>  }
>> ___
>> 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 21/21] avcodec/mpegvideo: Move frame_rate_index to (Mpeg1|MPEG12Enc)Context

2022-01-25 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpeg12dec.c | 15 ---
 libavcodec/mpeg12enc.c | 11 ++-
 libavcodec/mpegvideo.h |  1 -
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 0c5eddb7f1..4a7bd6d466 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -70,6 +70,7 @@ typedef struct Mpeg1Context {
 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;
@@ -1297,7 +1298,7 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
 
 if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO) {
 // MPEG-1 fps
-avctx->framerate = ff_mpeg12_frame_rate_tab[s->frame_rate_index];
+avctx->framerate = ff_mpeg12_frame_rate_tab[s1->frame_rate_index];
 avctx->ticks_per_frame = 1;
 
 avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
@@ -1305,8 +1306,8 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
 // MPEG-2 fps
 av_reduce(>avctx->framerate.num,
   >avctx->framerate.den,
-  ff_mpeg12_frame_rate_tab[s->frame_rate_index].num * 
s1->frame_rate_ext.num,
-  ff_mpeg12_frame_rate_tab[s->frame_rate_index].den * 
s1->frame_rate_ext.den,
+  ff_mpeg12_frame_rate_tab[s1->frame_rate_index].num * 
s1->frame_rate_ext.num,
+  ff_mpeg12_frame_rate_tab[s1->frame_rate_index].den * 
s1->frame_rate_ext.den,
   1 << 30);
 avctx->ticks_per_frame = 2;
 
@@ -2110,11 +2111,11 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx,
 if (avctx->err_recognition & (AV_EF_BITSTREAM | AV_EF_COMPLIANT))
 return AVERROR_INVALIDDATA;
 }
-s->frame_rate_index = get_bits(>gb, 4);
-if (s->frame_rate_index == 0 || s->frame_rate_index > 13) {
+s1->frame_rate_index = get_bits(>gb, 4);
+if (s1->frame_rate_index == 0 || s1->frame_rate_index > 13) {
 av_log(avctx, AV_LOG_WARNING,
-   "frame_rate_index %d is invalid\n", s->frame_rate_index);
-s->frame_rate_index = 1;
+   "frame_rate_index %d is invalid\n", s1->frame_rate_index);
+s1->frame_rate_index = 1;
 }
 s->bit_rate = get_bits(>gb, 18) * 400LL;
 if (check_marker(s->avctx, >gb, "in sequence header") == 0) {
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index eaab968425..ecb90d1a41 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -65,6 +65,7 @@ static uint32_t mpeg1_chr_dc_uni[512];
 typedef struct MPEG12EncContext {
 MpegEncContext mpeg;
 AVRational frame_rate_ext;
+unsigned frame_rate_index;
 
 int gop_picture_number;  ///< index of the first picture of a GOP based on 
fake_pic_num
 
@@ -144,7 +145,7 @@ static int find_frame_rate_index(MPEG12EncContext *mpeg12)
 || av_nearer_q(target, bestq, q) < 0
 || ext.num==1 && ext.den==1 && av_nearer_q(target, bestq, 
q) == 0) {
 bestq   = q;
-s->frame_rate_index = i;
+mpeg12->frame_rate_index   = i;
 mpeg12->frame_rate_ext.num = ext.num;
 mpeg12->frame_rate_ext.den = ext.den;
 }
@@ -233,14 +234,14 @@ static av_cold int encode_init(AVCodecContext *avctx)
 mpeg12->drop_frame_timecode = mpeg12->drop_frame_timecode || 
!!(avctx->flags2 & AV_CODEC_FLAG2_DROP_FRAME_TIMECODE);
 if (mpeg12->drop_frame_timecode)
 mpeg12->tc.flags |= AV_TIMECODE_FLAG_DROPFRAME;
-if (mpeg12->drop_frame_timecode && s->frame_rate_index != 4) {
+if (mpeg12->drop_frame_timecode && mpeg12->frame_rate_index != 4) {
 av_log(avctx, AV_LOG_ERROR,
"Drop frame time code only allowed with 1001/3 fps\n");
 return AVERROR(EINVAL);
 }
 
 if (mpeg12->tc_opt_str) {
-AVRational rate = ff_mpeg12_frame_rate_tab[s->frame_rate_index];
+AVRational rate = ff_mpeg12_frame_rate_tab[mpeg12->frame_rate_index];
 int ret = av_timecode_init_from_string(>tc, rate, 
mpeg12->tc_opt_str, s);
 if (ret < 0)
 return ret;
@@ -266,7 +267,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
 MPEG12EncContext *const mpeg12 = (MPEG12EncContext*)s;
 unsigned int vbv_buffer_size, fps, v;
 int constraint_parameter_flag;
-AVRational framerate = ff_mpeg12_frame_rate_tab[s->frame_rate_index];
+AVRational framerate = ff_mpeg12_frame_rate_tab[mpeg12->frame_rate_index];
 uint64_t time_code;
 int64_t best_aspect_error = INT64_MAX;
 AVRational aspect_ratio = 

[FFmpeg-devel] [PATCH 20/21] avcodec/speedhqenc: Add SpeedHQEncContext and move slice_start to it

2022-01-25 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpegvideo.h  |  3 ---
 libavcodec/speedhqenc.c | 19 ++-
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index e5a4cc9b81..9243edefce 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -425,9 +425,6 @@ typedef struct MpegEncContext {
 int inter_intra_pred;
 int mspel;
 
-/* SpeedHQ specific */
-int slice_start;
-
 /* decompression specific */
 GetBitContext gb;
 
diff --git a/libavcodec/speedhqenc.c b/libavcodec/speedhqenc.c
index 967774931c..9a03876fbf 100644
--- a/libavcodec/speedhqenc.c
+++ b/libavcodec/speedhqenc.c
@@ -54,6 +54,12 @@ static uint32_t speedhq_chr_dc_uni[512];
 
 static uint8_t uni_speedhq_ac_vlc_len[64 * 64 * 2];
 
+typedef struct SpeedHQEncContext {
+MpegEncContext m;
+
+int slice_start;
+} SpeedHQEncContext;
+
 static av_cold void speedhq_init_static_data(void)
 {
 ff_rl_init(_rl_speedhq, speedhq_static_rl_table_store);
@@ -123,24 +129,27 @@ av_cold int ff_speedhq_encode_init(MpegEncContext *s)
 
 void ff_speedhq_encode_picture_header(MpegEncContext *s)
 {
+SpeedHQEncContext *ctx = (SpeedHQEncContext*)s;
+
 put_bits_le(>pb, 8, 100 - s->qscale * 2);  /* FIXME why doubled */
 put_bits_le(>pb, 24, 4);  /* no second field */
 
+ctx->slice_start = 4;
 /* length of first slice, will be filled out later */
-s->slice_start = 4;
 put_bits_le(>pb, 24, 0);
 }
 
 void ff_speedhq_end_slice(MpegEncContext *s)
 {
+SpeedHQEncContext *ctx = (SpeedHQEncContext*)s;
 int slice_len;
 
 flush_put_bits_le(>pb);
-slice_len = s->pb.buf_ptr - (s->pb.buf + s->slice_start);
-AV_WL24(s->pb.buf + s->slice_start, slice_len);
+slice_len = put_bytes_output(>pb) - ctx->slice_start;
+AV_WL24(s->pb.buf + ctx->slice_start, slice_len);
 
 /* length of next slice, will be filled out later */
-s->slice_start = s->pb.buf_ptr - s->pb.buf;
+ctx->slice_start = put_bytes_output(>pb);
 put_bits_le(>pb, 24, 0);
 }
 
@@ -273,7 +282,7 @@ const AVCodec ff_speedhq_encoder = {
 .type   = AVMEDIA_TYPE_VIDEO,
 .id = AV_CODEC_ID_SPEEDHQ,
 .priv_class = _mpv_enc_class,
-.priv_data_size = sizeof(MpegEncContext),
+.priv_data_size = sizeof(SpeedHQEncContext),
 .init   = ff_mpv_encode_init,
 .encode2= ff_mpv_encode_picture,
 .close  = ff_mpv_encode_end,
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 19/21] avcodec/mpegvideo_enc: Move H.263p? encoders to ituh263enc.c

2022-01-25 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/ituh263enc.c| 72 ++
 libavcodec/mpegvideo_enc.c | 72 --
 2 files changed, 72 insertions(+), 72 deletions(-)

diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c
index bd2deba210..9253d60a16 100644
--- a/libavcodec/ituh263enc.c
+++ b/libavcodec/ituh263enc.c
@@ -874,3 +874,75 @@ void ff_h263_encode_mba(MpegEncContext *s)
 mb_pos= s->mb_x + s->mb_width*s->mb_y;
 put_bits(>pb, ff_mba_length[i], mb_pos);
 }
+
+#define OFFSET(x) offsetof(MpegEncContext, x)
+#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
+static const AVOption h263_options[] = {
+{ "obmc", "use overlapped block motion compensation.", 
OFFSET(obmc), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
+{ "mb_info",  "emit macroblock info for RFC 2190 packetization, the 
parameter value is the maximum payload size", OFFSET(mb_info), AV_OPT_TYPE_INT, 
{ .i64 = 0 }, 0, INT_MAX, VE },
+FF_MPV_COMMON_OPTS
+#if FF_API_MPEGVIDEO_OPTS
+FF_MPV_DEPRECATED_MPEG_QUANT_OPT
+FF_MPV_DEPRECATED_A53_CC_OPT
+FF_MPV_DEPRECATED_MATRIX_OPT
+FF_MPV_DEPRECATED_BFRAME_OPTS
+#endif
+{ NULL },
+};
+
+static const AVClass h263_class = {
+.class_name = "H.263 encoder",
+.item_name  = av_default_item_name,
+.option = h263_options,
+.version= LIBAVUTIL_VERSION_INT,
+};
+
+const AVCodec ff_h263_encoder = {
+.name   = "h263",
+.long_name  = NULL_IF_CONFIG_SMALL("H.263 / H.263-1996"),
+.type   = AVMEDIA_TYPE_VIDEO,
+.id = AV_CODEC_ID_H263,
+.pix_fmts= (const enum AVPixelFormat[]){AV_PIX_FMT_YUV420P, 
AV_PIX_FMT_NONE},
+.priv_class = _class,
+.caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
+.priv_data_size = sizeof(MpegEncContext),
+.init   = ff_mpv_encode_init,
+.encode2= ff_mpv_encode_picture,
+.close  = ff_mpv_encode_end,
+};
+
+static const AVOption h263p_options[] = {
+{ "umv","Use unlimited motion vectors.",OFFSET(umvplus),   
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
+{ "aiv","Use alternative inter VLC.",   OFFSET(alt_inter_vlc), 
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
+{ "obmc",   "use overlapped block motion compensation.", OFFSET(obmc), 
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
+{ "structured_slices", "Write slice start position at every GOB header 
instead of just GOB number.", OFFSET(h263_slice_structured), AV_OPT_TYPE_BOOL, 
{ .i64 = 0 }, 0, 1, VE},
+FF_MPV_COMMON_OPTS
+#if FF_API_MPEGVIDEO_OPTS
+FF_MPV_DEPRECATED_MPEG_QUANT_OPT
+FF_MPV_DEPRECATED_A53_CC_OPT
+FF_MPV_DEPRECATED_MATRIX_OPT
+FF_MPV_DEPRECATED_BFRAME_OPTS
+#endif
+{ NULL },
+};
+static const AVClass h263p_class = {
+.class_name = "H.263p encoder",
+.item_name  = av_default_item_name,
+.option = h263p_options,
+.version= LIBAVUTIL_VERSION_INT,
+};
+
+const AVCodec ff_h263p_encoder = {
+.name   = "h263p",
+.long_name  = NULL_IF_CONFIG_SMALL("H.263+ / H.263-1998 / H.263 
version 2"),
+.type   = AVMEDIA_TYPE_VIDEO,
+.id = AV_CODEC_ID_H263P,
+.pix_fmts   = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, 
AV_PIX_FMT_NONE },
+.priv_class = _class,
+.capabilities   = AV_CODEC_CAP_SLICE_THREADS,
+.caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
+.priv_data_size = sizeof(MpegEncContext),
+.init   = ff_mpv_encode_init,
+.encode2= ff_mpv_encode_picture,
+.close  = ff_mpv_encode_end,
+};
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 4c3c870013..044c675014 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -4556,75 +4556,3 @@ int ff_dct_quantize_c(MpegEncContext *s,
 
 return last_non_zero;
 }
-
-#define OFFSET(x) offsetof(MpegEncContext, x)
-#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
-static const AVOption h263_options[] = {
-{ "obmc", "use overlapped block motion compensation.", 
OFFSET(obmc), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
-{ "mb_info",  "emit macroblock info for RFC 2190 packetization, the 
parameter value is the maximum payload size", OFFSET(mb_info), AV_OPT_TYPE_INT, 
{ .i64 = 0 }, 0, INT_MAX, VE },
-FF_MPV_COMMON_OPTS
-#if FF_API_MPEGVIDEO_OPTS
-FF_MPV_DEPRECATED_MPEG_QUANT_OPT
-FF_MPV_DEPRECATED_A53_CC_OPT
-FF_MPV_DEPRECATED_MATRIX_OPT
-FF_MPV_DEPRECATED_BFRAME_OPTS
-#endif
-{ NULL },
-};
-
-static const AVClass h263_class = {
-.class_name = "H.263 encoder",
-.item_name  = av_default_item_name,
-.option = h263_options,
-.version= LIBAVUTIL_VERSION_INT,
-};
-
-const AVCodec ff_h263_encoder = {
-.name   = "h263",
-.long_name  = 

[FFmpeg-devel] [PATCH 18/21] avcodec/mpegvideo_enc: Move msmpeg4/wmv1 encoders to msmpeg4enc.c

2022-01-25 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpegvideo_enc.c | 42 --
 libavcodec/msmpeg4enc.c| 42 ++
 2 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 93deded66c..4c3c870013 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -4628,45 +4628,3 @@ const AVCodec ff_h263p_encoder = {
 .pix_fmts   = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, 
AV_PIX_FMT_NONE },
 .priv_class = _class,
 };
-
-const AVCodec ff_msmpeg4v2_encoder = {
-.name   = "msmpeg4v2",
-.long_name  = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant 
version 2"),
-.type   = AVMEDIA_TYPE_VIDEO,
-.id = AV_CODEC_ID_MSMPEG4V2,
-.priv_class = _mpv_enc_class,
-.priv_data_size = sizeof(MpegEncContext),
-.init   = ff_mpv_encode_init,
-.encode2= ff_mpv_encode_picture,
-.close  = ff_mpv_encode_end,
-.caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
-.pix_fmts   = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, 
AV_PIX_FMT_NONE },
-};
-
-const AVCodec ff_msmpeg4v3_encoder = {
-.name   = "msmpeg4",
-.long_name  = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant 
version 3"),
-.type   = AVMEDIA_TYPE_VIDEO,
-.id = AV_CODEC_ID_MSMPEG4V3,
-.priv_class = _mpv_enc_class,
-.priv_data_size = sizeof(MpegEncContext),
-.init   = ff_mpv_encode_init,
-.encode2= ff_mpv_encode_picture,
-.close  = ff_mpv_encode_end,
-.caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
-.pix_fmts   = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, 
AV_PIX_FMT_NONE },
-};
-
-const AVCodec ff_wmv1_encoder = {
-.name   = "wmv1",
-.long_name  = NULL_IF_CONFIG_SMALL("Windows Media Video 7"),
-.type   = AVMEDIA_TYPE_VIDEO,
-.id = AV_CODEC_ID_WMV1,
-.priv_class = _mpv_enc_class,
-.priv_data_size = sizeof(MpegEncContext),
-.init   = ff_mpv_encode_init,
-.encode2= ff_mpv_encode_picture,
-.close  = ff_mpv_encode_end,
-.caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
-.pix_fmts   = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, 
AV_PIX_FMT_NONE },
-};
diff --git a/libavcodec/msmpeg4enc.c b/libavcodec/msmpeg4enc.c
index a4efbd34e6..2c619e1210 100644
--- a/libavcodec/msmpeg4enc.c
+++ b/libavcodec/msmpeg4enc.c
@@ -669,3 +669,45 @@ void ff_msmpeg4_encode_block(MpegEncContext * s, int16_t * 
block, int n)
 }
 }
 }
+
+const AVCodec ff_msmpeg4v2_encoder = {
+.name   = "msmpeg4v2",
+.long_name  = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant 
version 2"),
+.type   = AVMEDIA_TYPE_VIDEO,
+.id = AV_CODEC_ID_MSMPEG4V2,
+.pix_fmts   = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, 
AV_PIX_FMT_NONE },
+.priv_class = _mpv_enc_class,
+.caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
+.priv_data_size = sizeof(MpegEncContext),
+.init   = ff_mpv_encode_init,
+.encode2= ff_mpv_encode_picture,
+.close  = ff_mpv_encode_end,
+};
+
+const AVCodec ff_msmpeg4v3_encoder = {
+.name   = "msmpeg4",
+.long_name  = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant 
version 3"),
+.type   = AVMEDIA_TYPE_VIDEO,
+.id = AV_CODEC_ID_MSMPEG4V3,
+.pix_fmts   = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, 
AV_PIX_FMT_NONE },
+.priv_class = _mpv_enc_class,
+.caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
+.priv_data_size = sizeof(MpegEncContext),
+.init   = ff_mpv_encode_init,
+.encode2= ff_mpv_encode_picture,
+.close  = ff_mpv_encode_end,
+};
+
+const AVCodec ff_wmv1_encoder = {
+.name   = "wmv1",
+.long_name  = NULL_IF_CONFIG_SMALL("Windows Media Video 7"),
+.type   = AVMEDIA_TYPE_VIDEO,
+.id = AV_CODEC_ID_WMV1,
+.pix_fmts   = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, 
AV_PIX_FMT_NONE },
+.priv_class = _mpv_enc_class,
+.caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
+.priv_data_size = sizeof(MpegEncContext),
+.init   = ff_mpv_encode_init,
+.encode2= ff_mpv_encode_picture,
+.close  = ff_mpv_encode_end,
+};
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 17/21] avcodec/mpegvideo: Move gop_picture_number to MPEG12EncContext

2022-01-25 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpeg12enc.c | 9 ++---
 libavcodec/mpegvideo.h | 1 -
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index bec522d8e7..eaab968425 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -66,6 +66,8 @@ typedef struct MPEG12EncContext {
 MpegEncContext mpeg;
 AVRational frame_rate_ext;
 
+int gop_picture_number;  ///< index of the first picture of a GOP based on 
fake_pic_num
+
 int64_t timecode_frame_start; ///< GOP timecode frame start number, in non 
drop frame format
 AVTimecode tc;   ///< timecode context
 char *tc_opt_str;///< timecode option string
@@ -402,7 +404,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
 time_code = s->current_picture_ptr->f->coded_picture_number +
 mpeg12->timecode_frame_start;
 
-s->gop_picture_number = s->current_picture_ptr->f->coded_picture_number;
+mpeg12->gop_picture_number = 
s->current_picture_ptr->f->coded_picture_number;
 
 av_assert0(mpeg12->drop_frame_timecode == !!(mpeg12->tc.flags & 
AV_TIMECODE_FLAG_DROPFRAME));
 if (mpeg12->drop_frame_timecode)
@@ -413,7 +415,8 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
 put_bits(>pb, 1, 1);
 put_bits(>pb, 6, (uint32_t)((time_code / fps) % 60));
 put_bits(>pb, 6, (uint32_t)((time_code % fps)));
-put_bits(>pb, 1, !!(s->avctx->flags & AV_CODEC_FLAG_CLOSED_GOP) || 
s->intra_only || !s->gop_picture_number);
+put_bits(>pb, 1, !!(s->avctx->flags & AV_CODEC_FLAG_CLOSED_GOP) ||
+s->intra_only || !mpeg12->gop_picture_number);
 put_bits(>pb, 1, 0); // broken link
 }
 
@@ -458,7 +461,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s, int 
picture_number)
 
 // RAL: s->picture_number instead of s->fake_picture_number
 put_bits(>pb, 10,
- (s->picture_number - s->gop_picture_number) & 0x3ff);
+ (s->picture_number - mpeg12->gop_picture_number) & 0x3ff);
 put_bits(>pb, 3, s->pict_type);
 
 s->vbv_delay_ptr = s->pb.buf + put_bytes_count(>pb, 0);
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index fd9d60b03e..e5a4cc9b81 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -432,7 +432,6 @@ typedef struct MpegEncContext {
 GetBitContext gb;
 
 /* MPEG-1 specific */
-int gop_picture_number;  ///< index of the first picture of a GOP based on 
fake_pic_num & MPEG-1 specific
 int last_mv_dir; ///< last mv_dir, used for B-frame encoding
 uint8_t *vbv_delay_ptr;  ///< pointer to vbv_delay in the bitstream
 
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 16/21] avcodec/mpegvideo_enc: Don't sync gop_picture_number among slice threads

2022-01-25 Thread Andreas Rheinhardt
It is only used by the main thread.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpegvideo_enc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 35f0f79d4e..93deded66c 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -258,7 +258,6 @@ static void 
update_duplicate_context_after_me(MpegEncContext *dst,
 COPY(lambda);
 COPY(lambda2);
 COPY(picture_in_gop_number);
-COPY(gop_picture_number);
 COPY(frame_pred_frame_dct); // FIXME don't set in encode_header
 COPY(progressive_frame);// FIXME don't set in encode_header
 COPY(partitioned_frame);// FIXME don't set in encode_header
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 15/21] avcodec/mpegvideo: Move timecode_frame_start to Mpeg1Context

2022-01-25 Thread Andreas Rheinhardt
It is only used there and only by the main thread.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpeg12dec.c | 11 ++-
 libavcodec/mpegvideo.h |  1 -
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index dbbf9bd819..0c5eddb7f1 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -75,6 +75,7 @@ typedef struct Mpeg1Context {
 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
@@ -2443,7 +2444,7 @@ static void mpeg_decode_gop(AVCodecContext *avctx,
 
 init_get_bits(>gb, buf, buf_size * 8);
 
-tc = s-> timecode_frame_start = get_bits(>gb, 25);
+tc = s1->timecode_frame_start = get_bits(>gb, 25);
 
 s1->closed_gop = get_bits1(>gb);
 /* broken_link indicates that after editing the
@@ -2854,19 +2855,19 @@ static int mpeg_decode_frame(AVCodecContext *avctx, 
void *data,
 if (ret<0 || *got_output) {
 s2->current_picture_ptr = NULL;
 
-if (s2->timecode_frame_start != -1 && *got_output) {
+if (s->timecode_frame_start != -1 && *got_output) {
 char tcbuf[AV_TIMECODE_STR_SIZE];
 AVFrameSideData *tcside = av_frame_new_side_data(picture,
  
AV_FRAME_DATA_GOP_TIMECODE,
  sizeof(int64_t));
 if (!tcside)
 return AVERROR(ENOMEM);
-memcpy(tcside->data, >timecode_frame_start, sizeof(int64_t));
+memcpy(tcside->data, >timecode_frame_start, sizeof(int64_t));
 
-av_timecode_make_mpeg_tc_string(tcbuf, s2->timecode_frame_start);
+av_timecode_make_mpeg_tc_string(tcbuf, s->timecode_frame_start);
 av_dict_set(>metadata, "timecode", tcbuf, 0);
 
-s2->timecode_frame_start = -1;
+s->timecode_frame_start = -1;
 }
 }
 
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index e093e8c04a..fd9d60b03e 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -443,7 +443,6 @@ typedef struct MpegEncContext {
 // picture structure defines are loaded from mpegutils.h
 int picture_structure;
 
-int64_t timecode_frame_start; ///< GOP timecode frame start number, in non 
drop frame format
 int intra_dc_precision;
 int frame_pred_frame_dct;
 int top_field_first;
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 14/21] avcodec/mpegvideo: Move aspect_ratio_info to Mpeg1Context

2022-01-25 Thread Andreas Rheinhardt
Only used there and only by the main thread.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpeg12dec.c | 23 ---
 libavcodec/mpegvideo.h |  1 -
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 6ad9fb245c..dbbf9bd819 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -65,6 +65,7 @@ typedef struct Mpeg1Context {
 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;
@@ -1205,13 +1206,13 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
 
 if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO) {
 // MPEG-1 aspect
-AVRational aspect_inv = av_d2q(ff_mpeg1_aspect[s->aspect_ratio_info], 
255);
+AVRational aspect_inv = av_d2q(ff_mpeg1_aspect[s1->aspect_ratio_info], 
255);
 avctx->sample_aspect_ratio = (AVRational) { aspect_inv.den, 
aspect_inv.num };
 } else { // MPEG-2
 // MPEG-2 aspect
-if (s->aspect_ratio_info > 1) {
+if (s1->aspect_ratio_info > 1) {
 AVRational dar =
-av_mul_q(av_div_q(ff_mpeg2_aspect[s->aspect_ratio_info],
+av_mul_q(av_div_q(ff_mpeg2_aspect[s1->aspect_ratio_info],
   (AVRational) { s1->pan_scan.width,
  s1->pan_scan.height }),
  (AVRational) { s->width, s->height });
@@ -1224,25 +1225,25 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
 (av_cmp_q(dar, (AVRational) { 4, 3 }) &&
  av_cmp_q(dar, (AVRational) { 16, 9 }))) {
 s->avctx->sample_aspect_ratio =
-av_div_q(ff_mpeg2_aspect[s->aspect_ratio_info],
+av_div_q(ff_mpeg2_aspect[s1->aspect_ratio_info],
  (AVRational) { s->width, s->height });
 } else {
 s->avctx->sample_aspect_ratio =
-av_div_q(ff_mpeg2_aspect[s->aspect_ratio_info],
+av_div_q(ff_mpeg2_aspect[s1->aspect_ratio_info],
  (AVRational) { s1->pan_scan.width, 
s1->pan_scan.height });
 // issue1613 4/3 16/9 -> 16/9
 // res_change_ffmpeg_aspect.ts 4/3 225/44 ->4/3
 // widescreen-issue562.mpg 4/3 16/9 -> 16/9
 //s->avctx->sample_aspect_ratio = 
av_mul_q(s->avctx->sample_aspect_ratio, (AVRational) {s->width, s->height});
 ff_dlog(avctx, "aspect A %d/%d\n",
-ff_mpeg2_aspect[s->aspect_ratio_info].num,
-ff_mpeg2_aspect[s->aspect_ratio_info].den);
+ff_mpeg2_aspect[s1->aspect_ratio_info].num,
+ff_mpeg2_aspect[s1->aspect_ratio_info].den);
 ff_dlog(avctx, "aspect B %d/%d\n", 
s->avctx->sample_aspect_ratio.num,
 s->avctx->sample_aspect_ratio.den);
 }
 } else {
 s->avctx->sample_aspect_ratio =
-ff_mpeg2_aspect[s->aspect_ratio_info];
+ff_mpeg2_aspect[s1->aspect_ratio_info];
 }
 } // MPEG-2
 
@@ -2102,8 +2103,8 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx,
 if (avctx->err_recognition & (AV_EF_BITSTREAM | AV_EF_COMPLIANT))
 return AVERROR_INVALIDDATA;
 }
-s->aspect_ratio_info = get_bits(>gb, 4);
-if (s->aspect_ratio_info == 0) {
+s1->aspect_ratio_info = get_bits(>gb, 4);
+if (s1->aspect_ratio_info == 0) {
 av_log(avctx, AV_LOG_ERROR, "aspect ratio has forbidden 0 value\n");
 if (avctx->err_recognition & (AV_EF_BITSTREAM | AV_EF_COMPLIANT))
 return AVERROR_INVALIDDATA;
@@ -2168,7 +2169,7 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx,
 
 if (s->avctx->debug & FF_DEBUG_PICT_INFO)
 av_log(s->avctx, AV_LOG_DEBUG, "vbv buffer: %d, bitrate:%"PRId64", 
aspect_ratio_info: %d \n",
-   s1->rc_buffer_size, s->bit_rate, s->aspect_ratio_info);
+   s1->rc_buffer_size, s->bit_rate, s1->aspect_ratio_info);
 
 return 0;
 }
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index e0aec532a6..e093e8c04a 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -384,7 +384,6 @@ typedef struct MpegEncContext {
 int mcsel;
 int quant_precision;
 int quarter_sample;  ///< 1->qpel, 0->half pel ME/MC
-int aspect_ratio_info; //FIXME remove
 int sprite_warping_accuracy;
 int data_partitioning;   ///< data partitioning flag from header
 int partitioned_frame;   ///< is current frame partitioned
-- 
2.32.0

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

To unsubscribe, visit link above, or email

[FFmpeg-devel] [PATCH 13/21] avcodec/mpeg4videodec: Use stack variable for aspect_ratio_info

2022-01-25 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpeg4videodec.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 00bf7b6c4a..bdd320b1df 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -2215,7 +2215,7 @@ static void extension_and_user_data(MpegEncContext *s, 
GetBitContext *gb, int id
 static int decode_studio_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
 {
 MpegEncContext *s = >m;
-int width, height;
+int width, height, aspect_ratio_info;
 int bits_per_raw_sample;
 int rgb, chroma_format;
 
@@ -2270,12 +2270,12 @@ static int decode_studio_vol_header(Mpeg4DecContext 
*ctx, GetBitContext *gb)
 s->height = height;
 }
 }
-s->aspect_ratio_info = get_bits(gb, 4);
-if (s->aspect_ratio_info == FF_ASPECT_EXTENDED) {
+aspect_ratio_info = get_bits(gb, 4);
+if (aspect_ratio_info == FF_ASPECT_EXTENDED) {
 s->avctx->sample_aspect_ratio.num = get_bits(gb, 8);  // par_width
 s->avctx->sample_aspect_ratio.den = get_bits(gb, 8);  // par_height
 } else {
-s->avctx->sample_aspect_ratio = 
ff_h263_pixel_aspect[s->aspect_ratio_info];
+s->avctx->sample_aspect_ratio = 
ff_h263_pixel_aspect[aspect_ratio_info];
 }
 skip_bits(gb, 4); /* frame_rate_code */
 skip_bits(gb, 15); /* first_half_bit_rate */
@@ -2301,7 +2301,7 @@ static int decode_studio_vol_header(Mpeg4DecContext *ctx, 
GetBitContext *gb)
 static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
 {
 MpegEncContext *s = >m;
-int width, height, vo_ver_id;
+int width, height, vo_ver_id, aspect_ratio_info;
 
 /* vol header */
 skip_bits(gb, 1);   /* random access */
@@ -2329,12 +2329,12 @@ static int decode_vol_header(Mpeg4DecContext *ctx, 
GetBitContext *gb)
 } else {
 vo_ver_id = 1;
 }
-s->aspect_ratio_info = get_bits(gb, 4);
-if (s->aspect_ratio_info == FF_ASPECT_EXTENDED) {
+aspect_ratio_info = get_bits(gb, 4);
+if (aspect_ratio_info == FF_ASPECT_EXTENDED) {
 s->avctx->sample_aspect_ratio.num = get_bits(gb, 8);  // par_width
 s->avctx->sample_aspect_ratio.den = get_bits(gb, 8);  // par_height
 } else {
-s->avctx->sample_aspect_ratio = 
ff_h263_pixel_aspect[s->aspect_ratio_info];
+s->avctx->sample_aspect_ratio = 
ff_h263_pixel_aspect[aspect_ratio_info];
 }
 
 if ((ctx->vol_control_parameters = get_bits1(gb))) { /* vol control 
parameter */
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 12/21] avcodec/ituh263dec: Use stack variable for aspect_ratio_info

2022-01-25 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/ituh263dec.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index 0a032ea54c..7d7a1f01a2 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -1222,8 +1222,8 @@ int ff_h263_decode_picture_header(MpegEncContext *s)
 if (ufep) {
 if (format == 6) {
 /* Custom Picture Format (CPFMT) */
-s->aspect_ratio_info = get_bits(>gb, 4);
-ff_dlog(s->avctx, "aspect: %d\n", s->aspect_ratio_info);
+int aspect_ratio_info = get_bits(>gb, 4);
+ff_dlog(s->avctx, "aspect: %d\n", aspect_ratio_info);
 /* aspect ratios:
 0 - forbidden
 1 - 1:1
@@ -1237,12 +1237,12 @@ int ff_h263_decode_picture_header(MpegEncContext *s)
 check_marker(s->avctx, >gb, "in dimensions");
 height = get_bits(>gb, 9) * 4;
 ff_dlog(s->avctx, "\nH.263+ Custom picture: 
%dx%d\n",width,height);
-if (s->aspect_ratio_info == FF_ASPECT_EXTENDED) {
+if (aspect_ratio_info == FF_ASPECT_EXTENDED) {
 /* expected dimensions */
 s->avctx->sample_aspect_ratio.num= get_bits(>gb, 8);
 s->avctx->sample_aspect_ratio.den= get_bits(>gb, 8);
 }else{
-s->avctx->sample_aspect_ratio= 
ff_h263_pixel_aspect[s->aspect_ratio_info];
+s->avctx->sample_aspect_ratio= 
ff_h263_pixel_aspect[aspect_ratio_info];
 }
 } else {
 width = ff_h263_format[format][0];
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 11/21] avcodec/ituh263enc: Use stack variable for aspect_ratio_info

2022-01-25 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/ituh263enc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c
index 069c6a9acf..bd2deba210 100644
--- a/libavcodec/ituh263enc.c
+++ b/libavcodec/ituh263enc.c
@@ -193,13 +193,13 @@ void ff_h263_encode_picture_header(MpegEncContext * s, 
int picture_number)
 
 if (format == 8) {
 /* Custom Picture Format (CPFMT) */
-s->aspect_ratio_info= 
ff_h263_aspect_to_info(s->avctx->sample_aspect_ratio);
+unsigned aspect_ratio_info = 
ff_h263_aspect_to_info(s->avctx->sample_aspect_ratio);
 
-put_bits(>pb,4,s->aspect_ratio_info);
+put_bits(>pb,4, aspect_ratio_info);
 put_bits(>pb,9,(s->width >> 2) - 1);
 put_bits(>pb,1,1); /* "1" to prevent start code emulation */
 put_bits(>pb,9,(s->height >> 2));
-if (s->aspect_ratio_info == FF_ASPECT_EXTENDED){
+if (aspect_ratio_info == FF_ASPECT_EXTENDED){
 put_bits(>pb, 8, s->avctx->sample_aspect_ratio.num);
 put_bits(>pb, 8, s->avctx->sample_aspect_ratio.den);
 }
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 10/21] avcodec/mpeg4videoenc: Use stack variable for aspect_ratio_info

2022-01-25 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpeg4videoenc.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c
index b3e697daf7..27e16c3b72 100644
--- a/libavcodec/mpeg4videoenc.c
+++ b/libavcodec/mpeg4videoenc.c
@@ -961,7 +961,7 @@ static void mpeg4_encode_vol_header(MpegEncContext *s,
 int vo_number,
 int vol_number)
 {
-int vo_ver_id, vo_type;
+int vo_ver_id, vo_type, aspect_ratio_info;
 
 if (s->max_b_frames || s->quarter_sample) {
 vo_ver_id  = 5;
@@ -986,10 +986,10 @@ static void mpeg4_encode_vol_header(MpegEncContext *s,
 put_bits(>pb, 3, 1); /* is obj layer priority */
 }
 
-s->aspect_ratio_info = 
ff_h263_aspect_to_info(s->avctx->sample_aspect_ratio);
+aspect_ratio_info = ff_h263_aspect_to_info(s->avctx->sample_aspect_ratio);
 
-put_bits(>pb, 4, s->aspect_ratio_info); /* aspect ratio info */
-if (s->aspect_ratio_info == FF_ASPECT_EXTENDED) {
+put_bits(>pb, 4, aspect_ratio_info); /* aspect ratio info */
+if (aspect_ratio_info == FF_ASPECT_EXTENDED) {
 av_reduce(>avctx->sample_aspect_ratio.num, 
>avctx->sample_aspect_ratio.den,
s->avctx->sample_aspect_ratio.num,  
s->avctx->sample_aspect_ratio.den, 255);
 put_bits(>pb, 8, s->avctx->sample_aspect_ratio.num);
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 09/21] avcodec/mpeg12enc: Reindent after the previous commit

2022-01-25 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpeg12enc.c | 255 -
 1 file changed, 127 insertions(+), 128 deletions(-)

diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index e30e41027c..bec522d8e7 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -263,7 +263,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
 {
 MPEG12EncContext *const mpeg12 = (MPEG12EncContext*)s;
 unsigned int vbv_buffer_size, fps, v;
-int i, constraint_parameter_flag;
+int constraint_parameter_flag;
 AVRational framerate = ff_mpeg12_frame_rate_tab[s->frame_rate_index];
 uint64_t time_code;
 int64_t best_aspect_error = INT64_MAX;
@@ -276,146 +276,145 @@ static void mpeg1_encode_sequence_header(MpegEncContext 
*s)
 if (aspect_ratio.num == 0 || aspect_ratio.den == 0)
 aspect_ratio = (AVRational){1,1}; // pixel aspect 1.1 (VGA)
 
+/* MPEG-1 header repeated every GOP */
+put_header(s, SEQ_START_CODE);
 
-/* MPEG-1 header repeated every GOP */
-put_header(s, SEQ_START_CODE);
+put_sbits(>pb, 12, s->width  & 0xFFF);
+put_sbits(>pb, 12, s->height & 0xFFF);
 
-put_sbits(>pb, 12, s->width  & 0xFFF);
-put_sbits(>pb, 12, s->height & 0xFFF);
-
-for (i = 1; i < 15; i++) {
-int64_t error = aspect_ratio.num * (1LL<<32) / aspect_ratio.den;
-if (s->codec_id == AV_CODEC_ID_MPEG1VIDEO || i <= 1)
-error -= (1LL<<32) / ff_mpeg1_aspect[i];
-else
-error -= (1LL<<32)*ff_mpeg2_aspect[i].num * s->height / 
s->width / ff_mpeg2_aspect[i].den;
+for (int i = 1; i < 15; i++) {
+int64_t error = aspect_ratio.num * (1LL<<32) / aspect_ratio.den;
+if (s->codec_id == AV_CODEC_ID_MPEG1VIDEO || i <= 1)
+error -= (1LL<<32) / ff_mpeg1_aspect[i];
+else
+error -= (1LL<<32)*ff_mpeg2_aspect[i].num * s->height / s->width / 
ff_mpeg2_aspect[i].den;
 
-error = FFABS(error);
+error = FFABS(error);
 
-if (error - 2 <= best_aspect_error) {
-best_aspect_error= error;
-aspect_ratio_info = i;
-}
+if (error - 2 <= best_aspect_error) {
+best_aspect_error = error;
+aspect_ratio_info = i;
 }
+}
 
-put_bits(>pb, 4, aspect_ratio_info);
-put_bits(>pb, 4, s->frame_rate_index);
+put_bits(>pb, 4, aspect_ratio_info);
+put_bits(>pb, 4, s->frame_rate_index);
 
-if (s->avctx->rc_max_rate) {
-v = (s->avctx->rc_max_rate + 399) / 400;
-if (v > 0x3 && s->codec_id == AV_CODEC_ID_MPEG1VIDEO)
-v = 0x3;
-} else {
-v = 0x3;
-}
+if (s->avctx->rc_max_rate) {
+v = (s->avctx->rc_max_rate + 399) / 400;
+if (v > 0x3 && s->codec_id == AV_CODEC_ID_MPEG1VIDEO)
+v = 0x3;
+} else {
+v = 0x3;
+}
 
-if (s->avctx->rc_buffer_size)
-vbv_buffer_size = s->avctx->rc_buffer_size;
-else
-/* VBV calculation: Scaled so that a VCD has the proper
- * VBV size of 40 kilobytes */
-vbv_buffer_size = ((20 * s->bit_rate) / (1151929 / 2)) * 8 * 1024;
-vbv_buffer_size = (vbv_buffer_size + 16383) / 16384;
-
-put_sbits(>pb, 18, v);
-put_bits(>pb, 1, 1); // marker
-put_sbits(>pb, 10, vbv_buffer_size);
-
-constraint_parameter_flag =
-s->width  <= 768&&
-s->height <= 576&&
-s->mb_width * s->mb_height <= 396   &&
-s->mb_width * s->mb_height * framerate.num <= 396 * 25 * 
framerate.den &&
-framerate.num <= framerate.den * 30 &&
-s->avctx->me_range  &&
-s->avctx->me_range < 128&&
-vbv_buffer_size <= 20   &&
-v <= 1856000 / 400  &&
-s->codec_id == AV_CODEC_ID_MPEG1VIDEO;
-
-put_bits(>pb, 1, constraint_parameter_flag);
-
-ff_write_quant_matrix(>pb, s->avctx->intra_matrix);
-ff_write_quant_matrix(>pb, s->avctx->inter_matrix);
-
-if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
-AVFrameSideData *side_data;
-int width = s->width;
-int height = s->height;
-int use_seq_disp_ext;
+if (s->avctx->rc_buffer_size)
+vbv_buffer_size = s->avctx->rc_buffer_size;
+else
+/* VBV calculation: Scaled so that a VCD has the proper
+ * VBV size of 40 kilobytes */
+vbv_buffer_size = ((20 * s->bit_rate) / (1151929 / 2)) * 8 * 1024;
+vbv_buffer_size = (vbv_buffer_size + 16383) / 16384;
+
+put_sbits(>pb, 18, 

[FFmpeg-devel] [PATCH 08/21] avcodec/mpeg12enc: Return early if no Sequence Header is written

2022-01-25 Thread Andreas Rheinhardt
Allows to avoid one level of indentation.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpeg12enc.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index a19100a42d..e30e41027c 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -264,16 +264,18 @@ static void mpeg1_encode_sequence_header(MpegEncContext 
*s)
 MPEG12EncContext *const mpeg12 = (MPEG12EncContext*)s;
 unsigned int vbv_buffer_size, fps, v;
 int i, constraint_parameter_flag;
+AVRational framerate = ff_mpeg12_frame_rate_tab[s->frame_rate_index];
 uint64_t time_code;
 int64_t best_aspect_error = INT64_MAX;
 AVRational aspect_ratio = s->avctx->sample_aspect_ratio;
+int aspect_ratio_info;
+
+if (!s->current_picture.f->key_frame)
+return;
 
 if (aspect_ratio.num == 0 || aspect_ratio.den == 0)
 aspect_ratio = (AVRational){1,1}; // pixel aspect 1.1 (VGA)
 
-if (s->current_picture.f->key_frame) {
-AVRational framerate = ff_mpeg12_frame_rate_tab[s->frame_rate_index];
-int aspect_ratio_info;
 
 /* MPEG-1 header repeated every GOP */
 put_header(s, SEQ_START_CODE);
@@ -414,7 +416,6 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
 put_bits(>pb, 6, (uint32_t)((time_code % fps)));
 put_bits(>pb, 1, !!(s->avctx->flags & AV_CODEC_FLAG_CLOSED_GOP) || 
s->intra_only || !s->gop_picture_number);
 put_bits(>pb, 1, 0); // broken link
-}
 }
 
 static inline void encode_mb_skip_run(MpegEncContext *s, int run)
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 07/21] avcodec/mpeg12enc: Use stack variable for aspect_ratio_info

2022-01-25 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpeg12enc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index e28aa809d2..a19100a42d 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -273,6 +273,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
 
 if (s->current_picture.f->key_frame) {
 AVRational framerate = ff_mpeg12_frame_rate_tab[s->frame_rate_index];
+int aspect_ratio_info;
 
 /* MPEG-1 header repeated every GOP */
 put_header(s, SEQ_START_CODE);
@@ -291,11 +292,11 @@ static void mpeg1_encode_sequence_header(MpegEncContext 
*s)
 
 if (error - 2 <= best_aspect_error) {
 best_aspect_error= error;
-s->aspect_ratio_info = i;
+aspect_ratio_info = i;
 }
 }
 
-put_bits(>pb, 4, s->aspect_ratio_info);
+put_bits(>pb, 4, aspect_ratio_info);
 put_bits(>pb, 4, s->frame_rate_index);
 
 if (s->avctx->rc_max_rate) {
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 06/21] avcodec/ituh263enc: Use stack variable for custom_pcf

2022-01-25 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/ituh263enc.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c
index 5a779e..069c6a9acf 100644
--- a/libavcodec/ituh263enc.c
+++ b/libavcodec/ituh263enc.c
@@ -106,6 +106,7 @@ void ff_h263_encode_picture_header(MpegEncContext * s, int 
picture_number)
 int best_clock_code=1;
 int best_divisor=60;
 int best_error= INT_MAX;
+int custom_pcf;
 
 if(s->h263_plus){
 for(i=0; i<2; i++){
@@ -120,7 +121,7 @@ void ff_h263_encode_picture_header(MpegEncContext * s, int 
picture_number)
 }
 }
 }
-s->custom_pcf= best_clock_code!=1 || best_divisor!=60;
+custom_pcf = best_clock_code != 1 || best_divisor != 60;
 coded_frame_rate= 180;
 coded_frame_rate_base= (1000+best_clock_code)*best_divisor;
 
@@ -165,7 +166,7 @@ void ff_h263_encode_picture_header(MpegEncContext * s, int 
picture_number)
 else
 put_bits(>pb, 3, format);
 
-put_bits(>pb,1, s->custom_pcf);
+put_bits(>pb,1, custom_pcf);
 put_bits(>pb,1, s->umvplus); /* Unrestricted Motion Vector */
 put_bits(>pb,1,0); /* SAC: off */
 put_bits(>pb,1,s->obmc); /* Advanced Prediction Mode */
@@ -203,7 +204,7 @@ void ff_h263_encode_picture_header(MpegEncContext * s, int 
picture_number)
 put_bits(>pb, 8, s->avctx->sample_aspect_ratio.den);
 }
 }
-if(s->custom_pcf){
+if (custom_pcf) {
 if(ufep){
 put_bits(>pb, 1, best_clock_code);
 put_bits(>pb, 7, best_divisor);
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 05/21] avcodec/mpeg4?video: Move vo_type to Mpeg4DecContext

2022-01-25 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpeg4video.h|  2 ++
 libavcodec/mpeg4videodec.c | 16 
 libavcodec/mpegvideo.h |  1 -
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/libavcodec/mpeg4video.h b/libavcodec/mpeg4video.h
index 87d9c9996e..fd6b6f2863 100644
--- a/libavcodec/mpeg4video.h
+++ b/libavcodec/mpeg4video.h
@@ -105,6 +105,8 @@ typedef struct Mpeg4DecContext {
 int xvid_build;
 int lavc_build;
 
+int vo_type;
+
 /// flag for having shown the warning about invalid Divx B-frames
 int showed_packed_warning;
 /** does the stream contain the low_delay flag,
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 33a0c97ba8..00bf7b6c4a 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -2305,15 +2305,15 @@ static int decode_vol_header(Mpeg4DecContext *ctx, 
GetBitContext *gb)
 
 /* vol header */
 skip_bits(gb, 1);   /* random access */
-s->vo_type = get_bits(gb, 8);
+ctx->vo_type = get_bits(gb, 8);
 
 /* If we are in studio profile (per vo_type), check if its all consistent
  * and if so continue pass control to decode_studio_vol_header().
  * elIf something is inconsistent, error out
  * else continue with (non studio) vol header decpoding.
  */
-if (s->vo_type == CORE_STUDIO_VO_TYPE ||
-s->vo_type == SIMPLE_STUDIO_VO_TYPE) {
+if (ctx->vo_type == CORE_STUDIO_VO_TYPE ||
+ctx->vo_type == SIMPLE_STUDIO_VO_TYPE) {
 if (s->avctx->profile != FF_PROFILE_UNKNOWN && s->avctx->profile != 
FF_PROFILE_MPEG4_SIMPLE_STUDIO)
 return AVERROR_INVALIDDATA;
 s->studio_profile = 1;
@@ -2360,7 +2360,7 @@ static int decode_vol_header(Mpeg4DecContext *ctx, 
GetBitContext *gb)
 /* is setting low delay flag only once the smartest thing to do?
  * low delay detection will not be overridden. */
 if (s->picture_number == 0) {
-switch(s->vo_type) {
+switch (ctx->vo_type) {
 case SIMPLE_VO_TYPE:
 case ADV_SIMPLE_VO_TYPE:
 s->low_delay = 1;
@@ -2745,7 +2745,7 @@ int ff_mpeg4_workaround_bugs(AVCodecContext *avctx)
 }
 
 if (ctx->xvid_build == -1 && ctx->divx_version == -1 && ctx->lavc_build == 
-1)
-if (s->codec_tag == AV_RL32("DIVX") && s->vo_type == 0 &&
+if (s->codec_tag == AV_RL32("DIVX") && ctx->vo_type == 0 &&
 ctx->vol_control_parameters == 0)
 ctx->divx_version = 400;  // divx 4
 
@@ -3084,7 +3084,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, 
GetBitContext *gb,
s->top_field_first, s->quarter_sample ? 'q' : 'h',
s->data_partitioning, ctx->resync_marker,
ctx->num_sprite_warping_points, s->sprite_warping_accuracy,
-   1 - s->no_rounding, s->vo_type,
+   1 - s->no_rounding, ctx->vo_type,
ctx->vol_control_parameters ? " VOLC" : " ", 
ctx->intra_dc_threshold,
ctx->cplx_estimation_trash_i, ctx->cplx_estimation_trash_p,
ctx->cplx_estimation_trash_b,
@@ -3111,7 +3111,7 @@ end:
 /* detect buggy encoders which don't set the low_delay flag
  * (divx4/xvid/opendivx). Note we cannot detect divx5 without B-frames
  * easily (although it's buggy too) */
-if (s->vo_type == 0 && ctx->vol_control_parameters == 0 &&
+if (ctx->vo_type == 0 && ctx->vol_control_parameters == 0 &&
 ctx->divx_version == -1 && s->picture_number == 0) {
 av_log(s->avctx, AV_LOG_WARNING,
"looks like this file was encoded with 
(divx4/(old)xvid/opendivx) -> forcing low_delay flag\n");
@@ -3471,7 +3471,7 @@ static int mpeg4_update_thread_context(AVCodecContext 
*dst,
 s->divx_build= s1->divx_build;
 s->xvid_build= s1->xvid_build;
 s->lavc_build= s1->lavc_build;
-s->m.vo_type = s1->m.vo_type;
+s->vo_type   = s1->vo_type;
 s->showed_packed_warning = s1->showed_packed_warning;
 s->vol_control_parameters= s1->vol_control_parameters;
 s->cplx_estimation_trash_i   = s1->cplx_estimation_trash_i;
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 448fe2cedc..e0aec532a6 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -389,7 +389,6 @@ typedef struct MpegEncContext {
 int data_partitioning;   ///< data partitioning flag from header
 int partitioned_frame;   ///< is current frame partitioned
 int low_delay;   ///< no reordering needed / has no 
B-frames
-int vo_type;
 PutBitContext tex_pb;///< used for data partitioned VOPs
 PutBitContext pb2;   ///< used for data partitioned VOPs
 int mpeg_quant;
-- 
2.32.0

___
ffmpeg-devel mailing list

[FFmpeg-devel] [PATCH 04/21] avcodec/mpeg4videodec: Keep vo_type in sync between threads

2022-01-25 Thread Andreas Rheinhardt
Otherwise one can get outdated values when setting FF_DEBUG_PICT_INFO.

Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpeg4videodec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 162048b604..33a0c97ba8 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -3471,6 +3471,7 @@ static int mpeg4_update_thread_context(AVCodecContext 
*dst,
 s->divx_build= s1->divx_build;
 s->xvid_build= s1->xvid_build;
 s->lavc_build= s1->lavc_build;
+s->m.vo_type = s1->m.vo_type;
 s->showed_packed_warning = s1->showed_packed_warning;
 s->vol_control_parameters= s1->vol_control_parameters;
 s->cplx_estimation_trash_i   = s1->cplx_estimation_trash_i;
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 03/21] avcodec/mpeg4videoenc: Use stack variable for vo_type

2022-01-25 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/mpeg4videoenc.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c
index 8871d83281..b3e697daf7 100644
--- a/libavcodec/mpeg4videoenc.c
+++ b/libavcodec/mpeg4videoenc.c
@@ -961,14 +961,14 @@ static void mpeg4_encode_vol_header(MpegEncContext *s,
 int vo_number,
 int vol_number)
 {
-int vo_ver_id;
+int vo_ver_id, vo_type;
 
 if (s->max_b_frames || s->quarter_sample) {
 vo_ver_id  = 5;
-s->vo_type = ADV_SIMPLE_VO_TYPE;
+vo_type = ADV_SIMPLE_VO_TYPE;
 } else {
 vo_ver_id  = 1;
-s->vo_type = SIMPLE_VO_TYPE;
+vo_type = SIMPLE_VO_TYPE;
 }
 
 put_bits(>pb, 16, 0);
@@ -977,7 +977,7 @@ static void mpeg4_encode_vol_header(MpegEncContext *s,
 put_bits(>pb, 16, 0x120 + vol_number);   /* video obj layer */
 
 put_bits(>pb, 1, 0); /* random access vol */
-put_bits(>pb, 8, s->vo_type);/* video obj type indication */
+put_bits(>pb, 8, vo_type);   /* video obj type indication */
 if (s->workaround_bugs & FF_BUG_MS) {
 put_bits(>pb, 1, 0); /* is obj layer id= no */
 } else {
-- 
2.32.0

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

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


[FFmpeg-devel] [PATCH 02/21] avcodec/h263: Move decoding-only stuff to a new header h263dec.h

2022-01-25 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
Soon to be followed by a H263DecContext.

 libavcodec/flvdec.c|  2 +-
 libavcodec/h263.h  | 40 ---
 libavcodec/h263dec.c   |  1 +
 libavcodec/h263dec.h   | 65 ++
 libavcodec/intelh263dec.c  |  3 +-
 libavcodec/ituh263dec.c|  1 +
 libavcodec/mpeg4videodec.c |  1 +
 libavcodec/msmpeg4dec.c|  1 +
 libavcodec/rv10.c  |  1 +
 libavcodec/wmv2dec.c   |  2 +-
 10 files changed, 74 insertions(+), 43 deletions(-)
 create mode 100644 libavcodec/h263dec.h

diff --git a/libavcodec/flvdec.c b/libavcodec/flvdec.c
index 2ddcf021fd..2bd86b5b47 100644
--- a/libavcodec/flvdec.c
+++ b/libavcodec/flvdec.c
@@ -21,7 +21,7 @@
 #include "libavutil/imgutils.h"
 
 #include "flv.h"
-#include "h263.h"
+#include "h263dec.h"
 #include "mpegvideo.h"
 #include "mpegvideodata.h"
 
diff --git a/libavcodec/h263.h b/libavcodec/h263.h
index 31836ebb95..6dd5d2295a 100644
--- a/libavcodec/h263.h
+++ b/libavcodec/h263.h
@@ -22,41 +22,14 @@
 
 #include 
 #include "libavutil/rational.h"
-#include "get_bits.h"
 #include "mpegvideo.h"
 #include "h263data.h"
-#include "rl.h"
 
 #define FF_ASPECT_EXTENDED 15
-#define INT_BIT (CHAR_BIT * sizeof(int))
-
-// The defines below define the number of bits that are read at once for
-// reading vlc values. Changing these may improve speed and data cache needs
-// be aware though that decreasing them may need the number of stages that is
-// passed to get_vlc* to be increased.
-#define H263_MV_VLC_BITS 9
-#define INTRA_MCBPC_VLC_BITS 6
-#define INTER_MCBPC_VLC_BITS 7
-#define CBPY_VLC_BITS 6
-#define TEX_VLC_BITS 9
 
 #define H263_GOB_HEIGHT(h) ((h) <= 400 ? 1 : (h) <= 800 ? 2 : 4)
 
-extern VLC ff_h263_intra_MCBPC_vlc;
-extern VLC ff_h263_inter_MCBPC_vlc;
-extern VLC ff_h263_cbpy_vlc;
-extern VLC ff_h263_mv_vlc;
-
-extern const enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[];
-
-
-int ff_h263_decode_motion(MpegEncContext * s, int pred, int f_code);
 av_const int ff_h263_aspect_to_info(AVRational aspect);
-int ff_h263_decode_init(AVCodecContext *avctx);
-int ff_h263_decode_frame(AVCodecContext *avctx,
- void *data, int *got_frame,
- AVPacket *avpkt);
-int ff_h263_decode_end(AVCodecContext *avctx);
 void ff_h263_encode_mb(MpegEncContext *s,
int16_t block[6][64],
int motion_x, int motion_y);
@@ -65,27 +38,14 @@ void ff_h263_encode_gob_header(MpegEncContext * s, int 
mb_line);
 int16_t *ff_h263_pred_motion(MpegEncContext * s, int block, int dir,
  int *px, int *py);
 void ff_h263_encode_init(MpegEncContext *s);
-void ff_h263_decode_init_vlc(void);
 void ff_h263_init_rl_inter(void);
-int ff_h263_decode_picture_header(MpegEncContext *s);
 void ff_h263_update_motion_val(MpegEncContext * s);
 void ff_h263_loop_filter(MpegEncContext * s);
-int ff_h263_decode_mba(MpegEncContext *s);
 void ff_h263_encode_mba(MpegEncContext *s);
 void ff_init_qscale_tab(MpegEncContext *s);
 
 
-/**
- * Print picture info if FF_DEBUG_PICT_INFO is set.
- */
-void ff_h263_show_pict_info(MpegEncContext *s);
-
-int ff_intel_h263_decode_picture_header(MpegEncContext *s);
-int ff_h263_decode_mb(MpegEncContext *s,
-  int16_t block[6][64]);
-
 void ff_clean_h263_qscales(MpegEncContext *s);
-int ff_h263_resync(MpegEncContext *s);
 void ff_h263_encode_motion(PutBitContext *pb, int val, int f_code);
 
 
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index ac48acf47a..3466027286 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -33,6 +33,7 @@
 #include "error_resilience.h"
 #include "flv.h"
 #include "h263.h"
+#include "h263dec.h"
 #if FF_API_FLAG_TRUNCATED
 #include "h263_parser.h"
 #endif
diff --git a/libavcodec/h263dec.h b/libavcodec/h263dec.h
new file mode 100644
index 00..8d5f9a7add
--- /dev/null
+++ b/libavcodec/h263dec.h
@@ -0,0 +1,65 @@
+/*
+ * H.263 decoder internal header
+ *
+ * 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_H263DEC_H
+#define AVCODEC_H263DEC_H
+
+#include "mpegvideo.h"
+#include "vlc.h"
+
+// The defines below define the number of bits that are read at once for
+// 

[FFmpeg-devel] [PATCH 01/21] avcodec/h263: Remove declaration for inexistent function

2022-01-25 Thread Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt 
---
 libavcodec/h263.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/h263.h b/libavcodec/h263.h
index 982e545491..31836ebb95 100644
--- a/libavcodec/h263.h
+++ b/libavcodec/h263.h
@@ -68,7 +68,6 @@ void ff_h263_encode_init(MpegEncContext *s);
 void ff_h263_decode_init_vlc(void);
 void ff_h263_init_rl_inter(void);
 int ff_h263_decode_picture_header(MpegEncContext *s);
-int ff_h263_decode_gob_header(MpegEncContext *s);
 void ff_h263_update_motion_val(MpegEncContext * s);
 void ff_h263_loop_filter(MpegEncContext * s);
 int ff_h263_decode_mba(MpegEncContext *s);
-- 
2.32.0

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

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


Re: [FFmpeg-devel] [PATCH 1/2] lavu/tx: rewrite internal code as a tree-based codelet constructor

2022-01-25 Thread Paul B Mahol
On Tue, Jan 25, 2022 at 11:46 AM Lynne  wrote:

> 21 Jan 2022, 09:51 by d...@lynne.ee:
>
> > 21 Jan 2022, 09:33 by d...@lynne.ee:
> >
> >> This commit rewrites the internal transform code into a constructor
> >> that stitches transforms (codelets).
> >> This allows for transforms to reuse arbitrary parts of other
> >> transforms, and allows transforms to be stacked onto one
> >> another (such as a full iMDCT using a half-iMDCT which in turn
> >> uses an FFT). It also permits for each step to be individually
> >> replaced by assembly or a custom implementation (such as an ASIC).
> >>
> >> Patch attached.
> >>
> >
> > Forgot that I disabled double and int32 transforms to speed up
> > testing, reenabled locally and on my github tx_tree branch.
> > Also removed some inactive debug code.
> > https://github.com/cyanreg/FFmpeg/tree/tx_tree
> >
>
> I fixed bugs and improved to code more, and I think it's ready
> for merging now.
> The rdft is no longer bound by any convention, and its
> scale may be changed by the user, eliminating after-transform
> multiplies that are used pretty much everywhere in our code.
>
> If someone (looks at Paul) gives it a test or converts a filter,
> would be nice. I've only tested it on my synthetic benchmarks:
> https://github.com/cyanreg/lavu_fft_test


Will try it once its applied. Thanks.

>
>
> I plan to push the patchset tomorrow unless there are comments.
> Mostly done with the aarch64's SIMD, patch coming soon, hopefully.
> ___
> 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] fix bs2b parameter description

2022-01-25 Thread Gyan Doshi




On 2022-01-25 03:25 pm, Yue Wang wrote:

Can someone review and approve this change? it's pretty trivial


Needs changes in doc/filters.texi too.
Since this is an ext library option, a link to reference is helpful.

Regards,
Gyan




On Sat, Jan 15, 2022 at 11:45 PM Yue Wang  wrote:


 From f0fdf5360ecd52d5f4031af9165b94c211defa03 Mon Sep 17 00:00:00 2001
From: Yue Wang 
Date: Sat, 15 Jan 2022 10:14:17 +0900
Subject: [PATCH] fix bs2b parameter description.

---
  libavfilter/af_bs2b.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/af_bs2b.c b/libavfilter/af_bs2b.c
index 90ae846d95..de2d6dd6c7 100644
--- a/libavfilter/af_bs2b.c
+++ b/libavfilter/af_bs2b.c
@@ -57,7 +57,7 @@ static const AVOption bs2b_options[] = {
  { "jmeier",  "Jan Meier circuit", 0, AV_OPT_TYPE_CONST, { .i64 =
BS2B_JMEIER_CLEVEL  }, 0, 0, A, "profile" },
  { "fcut", "Set cut frequency (in Hz)",
  OFFSET(fcut), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, BS2B_MAXFCUT,
A },
-{ "feed", "Set feed level (in Hz)",
+{ "feed", "Set feed level (in db * 10)",
  OFFSET(feed), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, BS2B_MAXFEED,
A },
  { NULL },
  };
--
2.34.1.703.g22d0c6ccf7-goog



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

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


___
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] lavu/tx: rewrite internal code as a tree-based codelet constructor

2022-01-25 Thread Lynne
21 Jan 2022, 09:51 by d...@lynne.ee:

> 21 Jan 2022, 09:33 by d...@lynne.ee:
>
>> This commit rewrites the internal transform code into a constructor
>> that stitches transforms (codelets).
>> This allows for transforms to reuse arbitrary parts of other
>> transforms, and allows transforms to be stacked onto one
>> another (such as a full iMDCT using a half-iMDCT which in turn
>> uses an FFT). It also permits for each step to be individually
>> replaced by assembly or a custom implementation (such as an ASIC).
>>
>> Patch attached.
>>
>
> Forgot that I disabled double and int32 transforms to speed up
> testing, reenabled locally and on my github tx_tree branch.
> Also removed some inactive debug code.
> https://github.com/cyanreg/FFmpeg/tree/tx_tree
>

I fixed bugs and improved to code more, and I think it's ready
for merging now.
The rdft is no longer bound by any convention, and its
scale may be changed by the user, eliminating after-transform
multiplies that are used pretty much everywhere in our code.

If someone (looks at Paul) gives it a test or converts a filter,
would be nice. I've only tested it on my synthetic benchmarks:
https://github.com/cyanreg/lavu_fft_test

I plan to push the patchset tomorrow unless there are comments.
Mostly done with the aarch64's SIMD, patch coming soon, hopefully.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH 1/2] avutil/random_seed: Speed up fate test

2022-01-25 Thread Michael Niedermayer
This decreases the quality of the seeds during the test, it does not affect
the seeds outside the test.
There is a small chance that this causes test failures, if that happens
the threshold needs adjusting

Testing on an idle x86_64 system shows that this passes even with the test 
strength
increased to 32768 from 256 with 0 retries
So test failures are not anticipated
Lowering the threshold from 3 to 2 causes failure at test strength of 32768

Signed-off-by: Michael Niedermayer 
---
 libavutil/random_seed.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c
index 70dc509d2f..509b74936c 100644
--- a/libavutil/random_seed.c
+++ b/libavutil/random_seed.c
@@ -95,7 +95,7 @@ static uint32_t get_generic_seed(void)
 last_td = t - last_t;
 buffer[++i & 511] += last_td % 3294638521U;
 if ((t - init_t) >= CLOCKS_PER_SEC>>5)
-if (last_i && i - last_i > 4 || i - last_i > 64 || TEST && i - 
last_i > 8)
+if (last_i && i - last_i > 4 || i - last_i > 64 || TEST && i - 
last_i > 3)
 break;
 }
 last_t = t;
-- 
2.17.1

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

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


[FFmpeg-devel] [PATCH 2/2] libavutil/random_seed: Skip testing generic seed twice

2022-01-25 Thread Michael Niedermayer
If no platform specific random seed is supported then the generic code
was tested twice, this is unneeded

Signed-off-by: Michael Niedermayer 
---
 libavutil/random_seed.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c
index 509b74936c..a8be2d4991 100644
--- a/libavutil/random_seed.c
+++ b/libavutil/random_seed.c
@@ -141,5 +141,11 @@ uint32_t av_get_random_seed(void)
 return seed;
 if (read_random(, "/dev/random")  == sizeof(seed))
 return seed;
+#if TEST
+{ // for testing we test get_generic_seed() seperatly so doing it here too 
is a waste of time
+static int x;
+return x++;
+}
+#endif
 return get_generic_seed();
 }
-- 
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] fix bs2b parameter description

2022-01-25 Thread Yue Wang
Can someone review and approve this change? it's pretty trivial

On Sat, Jan 15, 2022 at 11:45 PM Yue Wang  wrote:

> From f0fdf5360ecd52d5f4031af9165b94c211defa03 Mon Sep 17 00:00:00 2001
> From: Yue Wang 
> Date: Sat, 15 Jan 2022 10:14:17 +0900
> Subject: [PATCH] fix bs2b parameter description.
>
> ---
>  libavfilter/af_bs2b.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavfilter/af_bs2b.c b/libavfilter/af_bs2b.c
> index 90ae846d95..de2d6dd6c7 100644
> --- a/libavfilter/af_bs2b.c
> +++ b/libavfilter/af_bs2b.c
> @@ -57,7 +57,7 @@ static const AVOption bs2b_options[] = {
>  { "jmeier",  "Jan Meier circuit", 0, AV_OPT_TYPE_CONST, { .i64 =
> BS2B_JMEIER_CLEVEL  }, 0, 0, A, "profile" },
>  { "fcut", "Set cut frequency (in Hz)",
>  OFFSET(fcut), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, BS2B_MAXFCUT,
> A },
> -{ "feed", "Set feed level (in Hz)",
> +{ "feed", "Set feed level (in db * 10)",
>  OFFSET(feed), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, BS2B_MAXFEED,
> A },
>  { NULL },
>  };
> --
> 2.34.1.703.g22d0c6ccf7-goog
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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