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

Jun Zhao mypopydev at gmail.com
Thu Sep 21 08:01:22 EEST 2017



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 at 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



More information about the ffmpeg-devel mailing list