diff options
author | Sreerenj Balachandran <sreerenj.balachandran@intel.com> | 2015-11-13 19:23:05 +0200 |
---|---|---|
committer | Sreerenj Balachandran <sreerenj.balachandran@intel.com> | 2015-11-13 19:23:05 +0200 |
commit | a48eebefd63b37b842f45d2e8a040a0e2c57a36f (patch) | |
tree | 26b9041f1704b9b30efef96d6dfbf3daaef477d2 | |
parent | 4aa523f8b426eadd16990978a75c73404b4ecce0 (diff) | |
download | gst-vaapi-a48eebefd63b37b842f45d2e8a040a0e2c57a36f.tar.gz |
decoder: vp9: Fix the context and surface pool reset for multi resolution video
Unlike other decoders, vp9 decoder doesn't need to reset the
whole context and surfaces for each resolution change. Context
reset only needed if resolution of any frame is greater than
what actullay configured. There are streams where a bigger
resolution set in ivf header or webm header but actual resolution
of all frames are less. Also it is possible to have inter-prediction
between these multi resolution frames.
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapidecoder_vp9.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_vp9.c b/gst-libs/gst/vaapi/gstvaapidecoder_vp9.c index 39834eca..508805e4 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_vp9.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_vp9.c @@ -504,14 +504,28 @@ parse_frame_header (GstVaapiDecoderVp9 * decoder, const guchar * buf, { GstVaapiDecoderVp9Private *const priv = &decoder->priv; GstVp9ParserResult result; + guint width, height; result = gst_vp9_parser_parse_frame_header (priv->parser, frame_hdr, buf, buf_size); if (result != GST_VP9_PARSER_OK) return get_status (result); - if ((frame_hdr->frame_type == GST_VP9_KEY_FRAME) && - (frame_hdr->width != priv->width || frame_hdr->height != priv->height)) { + /* Unlike other decoders, vp9 decoder doesn't need to reset the + * whole context and surfaces for each resolution change. context + * reset only needed if resolution of any frame is greater than + * what actullay configured. There are streams where a bigger + * resolution set in ivf header or webm header but actual resolution + * of all frames are less. Also it is possible to have inter-prediction + * between these multi resolution frames */ + width = GST_VAAPI_DECODER_WIDTH (decoder); + height = GST_VAAPI_DECODER_HEIGHT (decoder); + if (priv->width < width || priv->height < height) { + priv->width = GST_VAAPI_DECODER_WIDTH (decoder); + priv->height = GST_VAAPI_DECODER_HEIGHT (decoder); + priv->size_changed = TRUE; + } + if ((frame_hdr->width > priv->width || frame_hdr->height > priv->height)) { priv->width = frame_hdr->width; priv->height = frame_hdr->height; priv->size_changed = TRUE; |