[FFmpeg-devel] [PATCH] dxva2: bump maximum number of slieces for mpeg2

compn tempn at twmi.rr.com
Mon Jan 27 15:13:49 CET 2014


On Mon, 27 Jan 2014 09:23:47 +0100
Hendrik Leppkes <h.leppkes at gmail.com> wrote:

> On Mon, Jan 27, 2014 at 8:22 AM, Rainer Hochecker
> <fernetmenta at online.de> wrote:
> > ---
> >  libavcodec/dxva2_mpeg2.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c
> > index 1827dd5..e2f6b70 100644
> > --- a/libavcodec/dxva2_mpeg2.c
> > +++ b/libavcodec/dxva2_mpeg2.c
> > @@ -22,7 +22,7 @@
> >
> >  #include "dxva2_internal.h"
> >
> > -#define MAX_SLICES (SLICE_MAX_START_CODE - SLICE_MIN_START_CODE +
> > 1) +#define MAX_SLICES 1024
> >  struct dxva2_picture_context {
> >      DXVA_PictureParameters pp;
> >      DXVA_QmatrixData       qm;
> > --
> > 1.8.3.2
> >
> 
> Note that this value was empirically chosen, and there is no "spec" to
> dictate the value.
> The old MAX_SLICES was OK for SD content, but with HD and UHD content
> files will have more slices, and so far 1024 was a safe limit with
> plenty headroom to work on every file found.
> 
> Another solution would be to dynamically allocate the slice array,
> however since HWAccels don't have a global state to store the
> information about the number of slices in, it would mean every frame
> has to re-allocate the slice array hundreds of times, which is not
> ideal.
> The struct is  small enough to not worry about a few KB of memory
> usage by the fixed-size array.

+100 bonus points if you mention something like this in a comment in the
patch.

-compn


More information about the ffmpeg-devel mailing list