diff mbox

[FFmpeg-devel] mpeg2_hwaccel: always submit twice for a frame with two fileds.

Message ID 20170921032609.26242-1-zhong.li@intel.com
State Superseded
Headers show

Commit Message

Zhong Li Sept. 21, 2017, 3:26 a.m. UTC
Though this patch to fix https://trac.ffmpeg.org/ticket/6668, and allows
to set the slice_flags option to decoder, I belive it is unnecessary to set
SLICE_FLAG_ALLOW_FIELD flag to other hwaccels(dxva, vdpau, etc).

Signed-off-by: Zhong Li <zhong.li@intel.com>
---
 libavcodec/mpeg12dec.c     | 3 +--
 libavcodec/options_table.h | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

Comments

Jun Zhao Sept. 21, 2017, 5:01 a.m. UTC | #1
On 2017/9/21 11:26, Zhong Li wrote:
> Though this patch to fix https://trac.ffmpeg.org/ticket/6668, and allows
> to set the slice_flags option to decoder, I belive it is unnecessary to set
> SLICE_FLAG_ALLOW_FIELD flag to other hwaccels(dxva, vdpau, etc).
>
> Signed-off-by: Zhong Li <zhong.li@intel.com>
> ---
>  libavcodec/mpeg12dec.c     | 3 +--
>  libavcodec/options_table.h | 2 +-
>  2 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
> index 22c29c1505..701845a46c 100644
> --- a/libavcodec/mpeg12dec.c
> +++ b/libavcodec/mpeg12dec.c
> @@ -1689,8 +1689,7 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
>              return AVERROR_INVALIDDATA;
>          }
>  
> -        if (s->avctx->hwaccel &&
> -            (s->avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD)) {
> +        if (s->avctx->hwaccel) {
>              if ((ret = s->avctx->hwaccel->end_frame(s->avctx)) < 0) {
>                  av_log(avctx, AV_LOG_ERROR,
>                         "hardware accelerator failed to decode first field\n");
> diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
> index 12712fb541..5b9e344554 100644
> --- a/libavcodec/options_table.h
> +++ b/libavcodec/options_table.h
> @@ -340,7 +340,7 @@ static const AVOption avcodec_options[] = {
>  #if FF_API_PRIVATE_OPT
>  {"context", "context model", OFFSET(context_model), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
>  #endif
> -{"slice_flags", NULL, OFFSET(slice_flags), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
> +{"slice_flags", NULL, OFFSET(slice_flags), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|D},
>  #if FF_API_XVMC
>  {"xvmc_acceleration", NULL, OFFSET(xvmc_acceleration), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
>  #endif /* FF_API_XVMC */
I think need to split 2 patches
1. enable the option "slice_flags" for decoder
2. fix ticket 6668
Zhong Li Sept. 21, 2017, 5:14 a.m. UTC | #2
> -----Original Message-----

> From: Jun Zhao [mailto:mypopydev@gmail.com]

> Sent: Thursday, September 21, 2017 1:01 PM

> To: FFmpeg development discussions and patches

> <ffmpeg-devel@ffmpeg.org>; Li, Zhong <zhong.li@intel.com>

> Cc: sw@jkqxz.net; Zhao, Jun <jun.zhao@intel.com>; nfxjfg@googlemail.com

> Subject: Re: [FFmpeg-devel] [PATCH] mpeg2_hwaccel: always submit twice

> for a frame with two fileds.

> 

> 

> 

> On 2017/9/21 11:26, Zhong Li wrote:

> > Though this patch to fix https://trac.ffmpeg.org/ticket/6668, and

> > allows to set the slice_flags option to decoder, I belive it is

> > unnecessary to set SLICE_FLAG_ALLOW_FIELD flag to other hwaccels(dxva,

> vdpau, etc).

> >

> > Signed-off-by: Zhong Li <zhong.li@intel.com>

> > ---

> >  libavcodec/mpeg12dec.c     | 3 +--

> >  libavcodec/options_table.h | 2 +-

> >  2 files changed, 2 insertions(+), 3 deletions(-)

> >

> > diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index

> > 22c29c1505..701845a46c 100644

> > --- a/libavcodec/mpeg12dec.c

> > +++ b/libavcodec/mpeg12dec.c

> > @@ -1689,8 +1689,7 @@ static int mpeg_field_start(MpegEncContext *s,

> const uint8_t *buf, int buf_size)

> >              return AVERROR_INVALIDDATA;

> >          }

> >

> > -        if (s->avctx->hwaccel &&

> > -            (s->avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD)) {

> > +        if (s->avctx->hwaccel) {

> >              if ((ret = s->avctx->hwaccel->end_frame(s->avctx)) < 0) {

> >                  av_log(avctx, AV_LOG_ERROR,

> >                         "hardware accelerator failed to decode first

> > field\n"); diff --git a/libavcodec/options_table.h

> > b/libavcodec/options_table.h index 12712fb541..5b9e344554 100644

> > --- a/libavcodec/options_table.h

> > +++ b/libavcodec/options_table.h

> > @@ -340,7 +340,7 @@ static const AVOption avcodec_options[] = {  #if

> > FF_API_PRIVATE_OPT  {"context", "context model",

> > OFFSET(context_model), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN,

> > INT_MAX, V|E},  #endif -{"slice_flags", NULL, OFFSET(slice_flags),

> > AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},

> > +{"slice_flags", NULL, OFFSET(slice_flags), AV_OPT_TYPE_INT, {.i64 =

> > +DEFAULT }, INT_MIN, INT_MAX, V|D},

> >  #if FF_API_XVMC

> >  {"xvmc_acceleration", NULL, OFFSET(xvmc_acceleration),

> > AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},  #endif /*

> > FF_API_XVMC */

> I think need to split 2 patches

> 1. enable the option "slice_flags" for decoder 2. fix ticket 6668

Ok, it makes sense, will update it later.
diff mbox

Patch

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 22c29c1505..701845a46c 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1689,8 +1689,7 @@  static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
             return AVERROR_INVALIDDATA;
         }
 
-        if (s->avctx->hwaccel &&
-            (s->avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD)) {
+        if (s->avctx->hwaccel) {
             if ((ret = s->avctx->hwaccel->end_frame(s->avctx)) < 0) {
                 av_log(avctx, AV_LOG_ERROR,
                        "hardware accelerator failed to decode first field\n");
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index 12712fb541..5b9e344554 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -340,7 +340,7 @@  static const AVOption avcodec_options[] = {
 #if FF_API_PRIVATE_OPT
 {"context", "context model", OFFSET(context_model), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
 #endif
-{"slice_flags", NULL, OFFSET(slice_flags), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"slice_flags", NULL, OFFSET(slice_flags), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|D},
 #if FF_API_XVMC
 {"xvmc_acceleration", NULL, OFFSET(xvmc_acceleration), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
 #endif /* FF_API_XVMC */