diff mbox

[FFmpeg-devel] avcodec: increase AV_INPUT_BUFFER_PADDING_SIZE to 64

Message ID 20180107042238.10728-1-jamrial@gmail.com
State Accepted
Commit 6e80079a2840ee407c5d126030eb1066bcbfdfc5
Headers show

Commit Message

James Almer Jan. 7, 2018, 4:22 a.m. UTC
AVX-512 support has been introduced, and even if no functions currently
use zmm registers (able to load as much as 64 bytes of consecutive data
per instruction), they will be added eventually.

Signed-off-by: James Almer <jamrial@gmail.com>
---
Same rationale as when it was increased to 32 back in commit
67d29da4bd23057a1f646568442a77b844cb2d1b.

 libavcodec/avcodec.h              | 2 +-
 libavcodec/x86/hevc_sao.asm       | 2 +-
 libavcodec/x86/hevc_sao_10bit.asm | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Comments

Rostislav Pehlivanov Jan. 7, 2018, 6:06 p.m. UTC | #1
On 7 January 2018 at 04:22, James Almer <jamrial@gmail.com> wrote:

> AVX-512 support has been introduced, and even if no functions currently
> use zmm registers (able to load as much as 64 bytes of consecutive data
> per instruction), they will be added eventually.
>
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> Same rationale as when it was increased to 32 back in commit
> 67d29da4bd23057a1f646568442a77b844cb2d1b.
>
>  libavcodec/avcodec.h              | 2 +-
>  libavcodec/x86/hevc_sao.asm       | 2 +-
>  libavcodec/x86/hevc_sao_10bit.asm | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index c13deb599f..8fbbc798a2 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -767,7 +767,7 @@ typedef struct AVCodecDescriptor {
>   * Note: If the first 23 bits of the additional bytes are not 0, then
> damaged
>   * MPEG bitstreams could cause overread and segfault.
>   */
> -#define AV_INPUT_BUFFER_PADDING_SIZE 32
> +#define AV_INPUT_BUFFER_PADDING_SIZE 64
>
>  /**
>   * @ingroup lavc_encoding
> diff --git a/libavcodec/x86/hevc_sao.asm b/libavcodec/x86/hevc_sao.asm
> index 888a28afa7..756adfee57 100644
> --- a/libavcodec/x86/hevc_sao.asm
> +++ b/libavcodec/x86/hevc_sao.asm
> @@ -198,7 +198,7 @@ HEVC_SAO_BAND_FILTER 64, 2
>  ;***********************************************************
> *******************
>
>  %define MAX_PB_SIZE  64
> -%define PADDING_SIZE 32 ; AV_INPUT_BUFFER_PADDING_SIZE
> +%define PADDING_SIZE 64 ; AV_INPUT_BUFFER_PADDING_SIZE
>  %define EDGE_SRCSTRIDE 2 * MAX_PB_SIZE + PADDING_SIZE
>
>  %macro HEVC_SAO_EDGE_FILTER_INIT 0
> diff --git a/libavcodec/x86/hevc_sao_10bit.asm b/libavcodec/x86/hevc_sao_
> 10bit.asm
> index f81e2d5033..b30583dd2f 100644
> --- a/libavcodec/x86/hevc_sao_10bit.asm
> +++ b/libavcodec/x86/hevc_sao_10bit.asm
> @@ -190,7 +190,7 @@ HEVC_SAO_BAND_FILTER 12, 64, 4
>  ;***********************************************************
> *******************
>
>  %define MAX_PB_SIZE  64
> -%define PADDING_SIZE 32 ; AV_INPUT_BUFFER_PADDING_SIZE
> +%define PADDING_SIZE 64 ; AV_INPUT_BUFFER_PADDING_SIZE
>  %define EDGE_SRCSTRIDE 2 * MAX_PB_SIZE + PADDING_SIZE
>
>  %macro PMINUW 4
> --
> 2.15.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

Looks good to me
Michael Niedermayer Jan. 8, 2018, 2:06 a.m. UTC | #2
On Sun, Jan 07, 2018 at 01:22:38AM -0300, James Almer wrote:
> AVX-512 support has been introduced, and even if no functions currently
> use zmm registers (able to load as much as 64 bytes of consecutive data
> per instruction), they will be added eventually.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> Same rationale as when it was increased to 32 back in commit
> 67d29da4bd23057a1f646568442a77b844cb2d1b.
> 
>  libavcodec/avcodec.h              | 2 +-
>  libavcodec/x86/hevc_sao.asm       | 2 +-
>  libavcodec/x86/hevc_sao_10bit.asm | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)

causes assertion failure:
./ffmpeg -i bgc.sub.dub.ogm x.webm

Assertion 64 <= 52 failed at libavformat/oggparseogm.c:109
Aborted (core dumped)

[...]
James Almer Jan. 8, 2018, 2:42 a.m. UTC | #3
On 1/7/2018 11:06 PM, Michael Niedermayer wrote:
> On Sun, Jan 07, 2018 at 01:22:38AM -0300, James Almer wrote:
>> AVX-512 support has been introduced, and even if no functions currently
>> use zmm registers (able to load as much as 64 bytes of consecutive data
>> per instruction), they will be added eventually.
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>> Same rationale as when it was increased to 32 back in commit
>> 67d29da4bd23057a1f646568442a77b844cb2d1b.
>>
>>  libavcodec/avcodec.h              | 2 +-
>>  libavcodec/x86/hevc_sao.asm       | 2 +-
>>  libavcodec/x86/hevc_sao_10bit.asm | 2 +-
>>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> causes assertion failure:
> ./ffmpeg -i bgc.sub.dub.ogm x.webm
> 
> Assertion 64 <= 52 failed at libavformat/oggparseogm.c:109
> Aborted (core dumped)

How do you say this should be fixed? Why should
AV_INPUT_BUFFER_PADDING_SIZE be lower or equal to 52?

I have no idea about OGM, so i could use some help.
Michael Niedermayer Jan. 8, 2018, 3:14 a.m. UTC | #4
On Sun, Jan 07, 2018 at 11:42:25PM -0300, James Almer wrote:
> On 1/7/2018 11:06 PM, Michael Niedermayer wrote:
> > On Sun, Jan 07, 2018 at 01:22:38AM -0300, James Almer wrote:
> >> AVX-512 support has been introduced, and even if no functions currently
> >> use zmm registers (able to load as much as 64 bytes of consecutive data
> >> per instruction), they will be added eventually.
> >>
> >> Signed-off-by: James Almer <jamrial@gmail.com>
> >> ---
> >> Same rationale as when it was increased to 32 back in commit
> >> 67d29da4bd23057a1f646568442a77b844cb2d1b.
> >>
> >>  libavcodec/avcodec.h              | 2 +-
> >>  libavcodec/x86/hevc_sao.asm       | 2 +-
> >>  libavcodec/x86/hevc_sao_10bit.asm | 2 +-
> >>  3 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > causes assertion failure:
> > ./ffmpeg -i bgc.sub.dub.ogm x.webm
> > 
> > Assertion 64 <= 52 failed at libavformat/oggparseogm.c:109
> > Aborted (core dumped)
> 
> How do you say this should be fixed? Why should
> AV_INPUT_BUFFER_PADDING_SIZE be lower or equal to 52?
> 
> I have no idea about OGM, so i could use some help.

cc-ing reimar, maybe he remembers, the assert seems to come from:

commit 7c8d477299c9b5e89fc30ed22f9e42b50761342c
Author: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Date:   Mon Feb 6 22:04:46 2012 +0100

    Make AAC in Ogg (ogm) work.

[...]
Reimar Döffinger Jan. 8, 2018, 10:44 a.m. UTC | #5
On Mon, Jan 08, 2018 at 04:14:22AM +0100, Michael Niedermayer wrote:
> On Sun, Jan 07, 2018 at 11:42:25PM -0300, James Almer wrote:
> > On 1/7/2018 11:06 PM, Michael Niedermayer wrote:
> > > On Sun, Jan 07, 2018 at 01:22:38AM -0300, James Almer wrote:
> > >> AVX-512 support has been introduced, and even if no functions currently
> > >> use zmm registers (able to load as much as 64 bytes of consecutive data
> > >> per instruction), they will be added eventually.
> > >>
> > >> Signed-off-by: James Almer <jamrial@gmail.com>
> > >> ---
> > >> Same rationale as when it was increased to 32 back in commit
> > >> 67d29da4bd23057a1f646568442a77b844cb2d1b.
> > >>
> > >>  libavcodec/avcodec.h              | 2 +-
> > >>  libavcodec/x86/hevc_sao.asm       | 2 +-
> > >>  libavcodec/x86/hevc_sao_10bit.asm | 2 +-
> > >>  3 files changed, 3 insertions(+), 3 deletions(-)
> > > 
> > > causes assertion failure:
> > > ./ffmpeg -i bgc.sub.dub.ogm x.webm
> > > 
> > > Assertion 64 <= 52 failed at libavformat/oggparseogm.c:109
> > > Aborted (core dumped)
> > 
> > How do you say this should be fixed? Why should
> > AV_INPUT_BUFFER_PADDING_SIZE be lower or equal to 52?
> > 
> > I have no idea about OGM, so i could use some help.
> 
> cc-ing reimar, maybe he remembers, the assert seems to come from:
> 
> commit 7c8d477299c9b5e89fc30ed22f9e42b50761342c
> Author: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
> Date:   Mon Feb 6 22:04:46 2012 +0100
> 
>     Make AAC in Ogg (ogm) work.

The assert probably never made sense (probably left-over from an early
try that would do the allocation earlier on, in that case we wouldn't have
needed to reallocate the data to add the padding before storing in
extradata), but it should have been removed at the latest when the code
was switched to use ff_alloc_extradata.
Either way, it should no longer be relevant.
Carl Eugen Hoyos Jan. 8, 2018, 12:21 p.m. UTC | #6
2018-01-08 11:44 GMT+01:00 Reimar Döffinger <Reimar.Doeffinger@gmx.de>:
> On Mon, Jan 08, 2018 at 04:14:22AM +0100, Michael Niedermayer wrote:
>> On Sun, Jan 07, 2018 at 11:42:25PM -0300, James Almer wrote:
>> > On 1/7/2018 11:06 PM, Michael Niedermayer wrote:
>> > > On Sun, Jan 07, 2018 at 01:22:38AM -0300, James Almer wrote:
>> > >> AVX-512 support has been introduced, and even if no functions currently
>> > >> use zmm registers (able to load as much as 64 bytes of consecutive data
>> > >> per instruction), they will be added eventually.
>> > >>
>> > >> Signed-off-by: James Almer <jamrial@gmail.com>
>> > >> ---
>> > >> Same rationale as when it was increased to 32 back in commit
>> > >> 67d29da4bd23057a1f646568442a77b844cb2d1b.
>> > >>
>> > >>  libavcodec/avcodec.h              | 2 +-
>> > >>  libavcodec/x86/hevc_sao.asm       | 2 +-
>> > >>  libavcodec/x86/hevc_sao_10bit.asm | 2 +-
>> > >>  3 files changed, 3 insertions(+), 3 deletions(-)
>> > >
>> > > causes assertion failure:
>> > > ./ffmpeg -i bgc.sub.dub.ogm x.webm
>> > >
>> > > Assertion 64 <= 52 failed at libavformat/oggparseogm.c:109
>> > > Aborted (core dumped)
>> >
>> > How do you say this should be fixed? Why should
>> > AV_INPUT_BUFFER_PADDING_SIZE be lower or equal to 52?
>> >
>> > I have no idea about OGM, so i could use some help.
>>
>> cc-ing reimar, maybe he remembers, the assert seems to come from:
>>
>> commit 7c8d477299c9b5e89fc30ed22f9e42b50761342c
>> Author: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
>> Date:   Mon Feb 6 22:04:46 2012 +0100
>>
>>     Make AAC in Ogg (ogm) work.
>
> The assert probably never made sense (probably left-over from an early
> try that would do the allocation earlier on, in that case we wouldn't have
> needed to reallocate the data to add the padding before storing in
> extradata), but it should have been removed at the latest when the code
> was switched to use ff_alloc_extradata.
> Either way, it should no longer be relevant.

I removed the assert.

Thank you, Carl Eugen
James Almer Jan. 12, 2018, 2:46 a.m. UTC | #7
On 1/7/2018 3:06 PM, Rostislav Pehlivanov wrote:
> On 7 January 2018 at 04:22, James Almer <jamrial@gmail.com> wrote:
> 
>> AVX-512 support has been introduced, and even if no functions currently
>> use zmm registers (able to load as much as 64 bytes of consecutive data
>> per instruction), they will be added eventually.
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>> Same rationale as when it was increased to 32 back in commit
>> 67d29da4bd23057a1f646568442a77b844cb2d1b.
>>
>>  libavcodec/avcodec.h              | 2 +-
>>  libavcodec/x86/hevc_sao.asm       | 2 +-
>>  libavcodec/x86/hevc_sao_10bit.asm | 2 +-
>>  3 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
>> index c13deb599f..8fbbc798a2 100644
>> --- a/libavcodec/avcodec.h
>> +++ b/libavcodec/avcodec.h
>> @@ -767,7 +767,7 @@ typedef struct AVCodecDescriptor {
>>   * Note: If the first 23 bits of the additional bytes are not 0, then
>> damaged
>>   * MPEG bitstreams could cause overread and segfault.
>>   */
>> -#define AV_INPUT_BUFFER_PADDING_SIZE 32
>> +#define AV_INPUT_BUFFER_PADDING_SIZE 64
>>
>>  /**
>>   * @ingroup lavc_encoding
>> diff --git a/libavcodec/x86/hevc_sao.asm b/libavcodec/x86/hevc_sao.asm
>> index 888a28afa7..756adfee57 100644
>> --- a/libavcodec/x86/hevc_sao.asm
>> +++ b/libavcodec/x86/hevc_sao.asm
>> @@ -198,7 +198,7 @@ HEVC_SAO_BAND_FILTER 64, 2
>>  ;***********************************************************
>> *******************
>>
>>  %define MAX_PB_SIZE  64
>> -%define PADDING_SIZE 32 ; AV_INPUT_BUFFER_PADDING_SIZE
>> +%define PADDING_SIZE 64 ; AV_INPUT_BUFFER_PADDING_SIZE
>>  %define EDGE_SRCSTRIDE 2 * MAX_PB_SIZE + PADDING_SIZE
>>
>>  %macro HEVC_SAO_EDGE_FILTER_INIT 0
>> diff --git a/libavcodec/x86/hevc_sao_10bit.asm b/libavcodec/x86/hevc_sao_
>> 10bit.asm
>> index f81e2d5033..b30583dd2f 100644
>> --- a/libavcodec/x86/hevc_sao_10bit.asm
>> +++ b/libavcodec/x86/hevc_sao_10bit.asm
>> @@ -190,7 +190,7 @@ HEVC_SAO_BAND_FILTER 12, 64, 4
>>  ;***********************************************************
>> *******************
>>
>>  %define MAX_PB_SIZE  64
>> -%define PADDING_SIZE 32 ; AV_INPUT_BUFFER_PADDING_SIZE
>> +%define PADDING_SIZE 64 ; AV_INPUT_BUFFER_PADDING_SIZE
>>  %define EDGE_SRCSTRIDE 2 * MAX_PB_SIZE + PADDING_SIZE
>>
>>  %macro PMINUW 4
>> --
>> 2.15.0
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
> 
> Looks good to me

Pushed.
diff mbox

Patch

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index c13deb599f..8fbbc798a2 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -767,7 +767,7 @@  typedef struct AVCodecDescriptor {
  * Note: If the first 23 bits of the additional bytes are not 0, then damaged
  * MPEG bitstreams could cause overread and segfault.
  */
-#define AV_INPUT_BUFFER_PADDING_SIZE 32
+#define AV_INPUT_BUFFER_PADDING_SIZE 64
 
 /**
  * @ingroup lavc_encoding
diff --git a/libavcodec/x86/hevc_sao.asm b/libavcodec/x86/hevc_sao.asm
index 888a28afa7..756adfee57 100644
--- a/libavcodec/x86/hevc_sao.asm
+++ b/libavcodec/x86/hevc_sao.asm
@@ -198,7 +198,7 @@  HEVC_SAO_BAND_FILTER 64, 2
 ;******************************************************************************
 
 %define MAX_PB_SIZE  64
-%define PADDING_SIZE 32 ; AV_INPUT_BUFFER_PADDING_SIZE
+%define PADDING_SIZE 64 ; AV_INPUT_BUFFER_PADDING_SIZE
 %define EDGE_SRCSTRIDE 2 * MAX_PB_SIZE + PADDING_SIZE
 
 %macro HEVC_SAO_EDGE_FILTER_INIT 0
diff --git a/libavcodec/x86/hevc_sao_10bit.asm b/libavcodec/x86/hevc_sao_10bit.asm
index f81e2d5033..b30583dd2f 100644
--- a/libavcodec/x86/hevc_sao_10bit.asm
+++ b/libavcodec/x86/hevc_sao_10bit.asm
@@ -190,7 +190,7 @@  HEVC_SAO_BAND_FILTER 12, 64, 4
 ;******************************************************************************
 
 %define MAX_PB_SIZE  64
-%define PADDING_SIZE 32 ; AV_INPUT_BUFFER_PADDING_SIZE
+%define PADDING_SIZE 64 ; AV_INPUT_BUFFER_PADDING_SIZE
 %define EDGE_SRCSTRIDE 2 * MAX_PB_SIZE + PADDING_SIZE
 
 %macro PMINUW 4