diff mbox

[FFmpeg-devel,v2,4/6] lavc/qsvdec: remove orignal parser code since not needed now

Message ID 20190220025821.31346-5-zhong.li@intel.com
State Superseded
Headers show

Commit Message

Zhong Li Feb. 20, 2019, 2:58 a.m. UTC
Signed-off-by: Zhong Li <zhong.li@intel.com>
---
 configure           | 10 +++++-----
 libavcodec/qsvdec.c | 16 +---------------
 libavcodec/qsvdec.h |  2 --
 3 files changed, 6 insertions(+), 22 deletions(-)

Comments

Mark Thompson Feb. 20, 2019, 9:22 p.m. UTC | #1
On 20/02/2019 02:58, Zhong Li wrote:
> Signed-off-by: Zhong Li <zhong.li@intel.com>
> ---
>  configure           | 10 +++++-----
>  libavcodec/qsvdec.c | 16 +---------------
>  libavcodec/qsvdec.h |  2 --
>  3 files changed, 6 insertions(+), 22 deletions(-)

You can't remove this, it's still needed - the stream properties must be determined before the get_format() callback.

Similarly, you will need to extend the VP9 parser to return the relevant information for the following patch so that it works in general rather than only in cases where the user can supply it externally.  It should be quite straightforward; see 182cf170a544bce069c8690c90b49381150a1f10.

- Mark
Zhong Li Feb. 21, 2019, 4:56 a.m. UTC | #2
> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf

> Of Mark Thompson

> Sent: Thursday, February 21, 2019 5:23 AM

> To: ffmpeg-devel@ffmpeg.org

> Subject: Re: [FFmpeg-devel] [PATCH v2 4/6] lavc/qsvdec: remove orignal

> parser code since not needed now

> 

> On 20/02/2019 02:58, Zhong Li wrote:

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

> > ---

> >  configure           | 10 +++++-----

> >  libavcodec/qsvdec.c | 16 +---------------  libavcodec/qsvdec.h |  2

> > --

> >  3 files changed, 6 insertions(+), 22 deletions(-)

> 

> You can't remove this, it's still needed - the stream properties must be

> determined before the get_format() callback.

> 

> Similarly, you will need to extend the VP9 parser to return the relevant

> information for the following patch so that it works in general rather than

> only in cases where the user can supply it externally.  It should be quite

> straightforward; see 182cf170a544bce069c8690c90b49381150a1f10.

> 

> - Mark


There are something different from vp8 for vp9. 
VP9 frame resolution probably can't be got from bitstream but may be referred from reference frames, see: https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/vp9.c#L565 
If parsing header is separated form decoding process, it will be a problem how to get the reference list information.
diff mbox

Patch

diff --git a/configure b/configure
index bf40c1dcb9..eaa56c07cf 100755
--- a/configure
+++ b/configure
@@ -2973,7 +2973,7 @@  h264_mediacodec_decoder_select="h264_mp4toannexb_bsf h264_parser"
 h264_mmal_decoder_deps="mmal"
 h264_nvenc_encoder_deps="nvenc"
 h264_omx_encoder_deps="omx"
-h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec"
+h264_qsv_decoder_select="h264_mp4toannexb_bsf qsvdec"
 h264_qsv_encoder_select="qsvenc"
 h264_rkmpp_decoder_deps="rkmpp"
 h264_rkmpp_decoder_select="h264_mp4toannexb_bsf"
@@ -2987,7 +2987,7 @@  hevc_cuvid_decoder_select="hevc_mp4toannexb_bsf"
 hevc_mediacodec_decoder_deps="mediacodec"
 hevc_mediacodec_decoder_select="hevc_mp4toannexb_bsf hevc_parser"
 hevc_nvenc_encoder_deps="nvenc"
-hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser qsvdec"
+hevc_qsv_decoder_select="hevc_mp4toannexb_bsf qsvdec"
 hevc_qsv_encoder_select="hevcparse qsvenc"
 hevc_rkmpp_decoder_deps="rkmpp"
 hevc_rkmpp_decoder_select="hevc_mp4toannexb_bsf"
@@ -3007,7 +3007,7 @@  mpeg2_crystalhd_decoder_select="crystalhd"
 mpeg2_cuvid_decoder_deps="cuvid"
 mpeg2_mmal_decoder_deps="mmal"
 mpeg2_mediacodec_decoder_deps="mediacodec"
-mpeg2_qsv_decoder_select="qsvdec mpegvideo_parser"
+mpeg2_qsv_decoder_select="qsvdec"
 mpeg2_qsv_encoder_select="qsvenc"
 mpeg2_vaapi_encoder_select="cbs_mpeg2 vaapi_encode"
 mpeg2_v4l2m2m_decoder_deps="v4l2_m2m mpeg2_v4l2_m2m"
@@ -3024,11 +3024,11 @@  nvenc_hevc_encoder_select="hevc_nvenc_encoder"
 vc1_crystalhd_decoder_select="crystalhd"
 vc1_cuvid_decoder_deps="cuvid"
 vc1_mmal_decoder_deps="mmal"
-vc1_qsv_decoder_select="qsvdec vc1_parser"
+vc1_qsv_decoder_select="qsvdec"
 vc1_v4l2m2m_decoder_deps="v4l2_m2m vc1_v4l2_m2m"
 vp8_cuvid_decoder_deps="cuvid"
 vp8_mediacodec_decoder_deps="mediacodec"
-vp8_qsv_decoder_select="qsvdec vp8_parser"
+vp8_qsv_decoder_select="qsvdec"
 vp8_rkmpp_decoder_deps="rkmpp"
 vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8"
 vp8_vaapi_encoder_select="vaapi_encode"
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index efe054f5c5..d776bd87ff 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -499,7 +499,6 @@  int ff_qsv_decode_close(QSVContext *q)
     av_fifo_free(q->async_fifo);
     q->async_fifo = NULL;
 
-    av_parser_close(q->parser);
     avcodec_free_context(&q->avctx_internal);
 
     if (q->internal_session)
@@ -529,25 +528,12 @@  int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q,
             return AVERROR(ENOMEM);
 
         q->avctx_internal->codec_id = avctx->codec_id;
-
-        q->parser = av_parser_init(avctx->codec_id);
-        if (!q->parser)
-            return AVERROR(ENOMEM);
-
-        q->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;
         q->orig_pix_fmt   = AV_PIX_FMT_NONE;
     }
 
     if (!pkt->size)
         return qsv_decode(avctx, q, frame, got_frame, pkt);
 
-    /* we assume the packets are already split properly and want
-     * just the codec parameters here */
-    av_parser_parse2(q->parser, q->avctx_internal,
-                     &dummy_data, &dummy_size,
-                     pkt->data, pkt->size, pkt->pts, pkt->dts,
-                     pkt->pos);
-
     /* TODO: flush delayed frames on reinit */
 
     ret = qsv_decode_header(avctx, q, pkt, pix_fmts, &param);
@@ -585,7 +571,7 @@  int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q,
     return qsv_decode(avctx, q, frame, got_frame, pkt);
 
 reinit_fail:
-    q->orig_pix_fmt = q->parser->format = avctx->pix_fmt = AV_PIX_FMT_NONE;
+    q->orig_pix_fmt = avctx->pix_fmt = AV_PIX_FMT_NONE;
     return ret;
 }
 
diff --git a/libavcodec/qsvdec.h b/libavcodec/qsvdec.h
index 4812fb2a6b..8e64839ca6 100644
--- a/libavcodec/qsvdec.h
+++ b/libavcodec/qsvdec.h
@@ -56,8 +56,6 @@  typedef struct QSVContext {
     int buffered_count;
     int reinit_flag;
 
-    // the internal parser and codec context for parsing the data
-    AVCodecParserContext *parser;
     AVCodecContext *avctx_internal;
     enum AVPixelFormat orig_pix_fmt;
     uint32_t fourcc;