Mercurial > mplayer.hg
changeset 34493:da31318562d9
vd_theora: Skip th_decode_ycbcr_out() for packets representing dropped frames.
In case of 0-byte packets we do not need to call th_decode_ycbcr_out() to decode
the frame because we have a duplicated frame, and so we can use the last frame.
patch by Giorgio Vazzana, mywing81 gmail com
author | diego |
---|---|
date | Thu, 19 Jan 2012 14:36:17 +0000 |
parents | 1495455e6d22 |
children | fede902a408c |
files | libmpcodecs/vd_theora.c |
diffstat | 1 files changed, 18 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpcodecs/vd_theora.c Thu Jan 19 14:36:15 2012 +0000 +++ b/libmpcodecs/vd_theora.c Thu Jan 19 14:36:17 2012 +0000 @@ -48,6 +48,7 @@ th_dec_ctx *tctx; th_comment tc; th_info ti; + th_ycbcr_buffer ycbcrbuf; } theora_struct_t; /** Convert Theora pixelformat to the corresponding IMGFMT_ */ @@ -169,7 +170,6 @@ theora_struct_t *context = sh->context; int errorCode = 0; ogg_packet op; - th_ycbcr_buffer ycbcrbuf; mp_image_t* mpi; // no delayed frames @@ -189,23 +189,26 @@ return NULL; } - errorCode = th_decode_ycbcr_out (context->tctx, ycbcrbuf); - if (errorCode < 0) - { - mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Theora decode YUVout failed: %i \n", - errorCode); - return NULL; - } + if (errorCode != TH_DUPFRAME) { + errorCode = th_decode_ycbcr_out(context->tctx, context->ycbcrbuf); + if (errorCode != 0) { + mp_msg(MSGT_DECVIDEO, MSGL_ERR, + "Theora decode YUVout failed: %i \n", errorCode); + return NULL; + } + } - mpi = mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, ycbcrbuf[0].width, ycbcrbuf[0].height); + mpi = mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, 0, + context->ycbcrbuf[0].width, + context->ycbcrbuf[0].height); if(!mpi) return NULL; - mpi->planes[0]=ycbcrbuf[0].data; - mpi->stride[0]=ycbcrbuf[0].stride; - mpi->planes[1]=ycbcrbuf[1].data; - mpi->stride[1]=ycbcrbuf[1].stride; - mpi->planes[2]=ycbcrbuf[2].data; - mpi->stride[2]=ycbcrbuf[2].stride; + mpi->planes[0] = context->ycbcrbuf[0].data; + mpi->stride[0] = context->ycbcrbuf[0].stride; + mpi->planes[1] = context->ycbcrbuf[1].data; + mpi->stride[1] = context->ycbcrbuf[1].stride; + mpi->planes[2] = context->ycbcrbuf[2].data; + mpi->stride[2] = context->ycbcrbuf[2].stride; return mpi; }