[FFmpeg-devel] [PATCH] h264: don't store intra pcm samples in h->mb.

Michael Niedermayer michaelni at gmx.at
Mon Feb 18 01:44:55 CET 2013


On Sun, Feb 17, 2013 at 02:52:24PM -0800, Ronald S. Bultje wrote:
> From: "Ronald S. Bultje" <rsbultje at gmail.com>
> 
> Instead, keep them in the bitstream buffer until we read them verbatim,
> this saves a memcpy() and a subsequent clearing of the target buffer.
> decode_cabac+decode_mb for a sample file (CAPM3_Sony_D.jsv) goes from
> 6121.4 to 6095.5 cycles, i.e. 26 cycles faster.
> ---
>  libavcodec/h264.c             |  4 +++-
>  libavcodec/h264.h             |  1 +
>  libavcodec/h264_cabac.c       |  3 ++-
>  libavcodec/h264_cavlc.c       | 11 +++--------
>  libavcodec/h264_mb_template.c | 29 +++++++++++++++--------------
>  5 files changed, 24 insertions(+), 24 deletions(-)
> 
> diff --git a/libavcodec/h264.c b/libavcodec/h264.c
> index 0644dad..41146df 100644
> --- a/libavcodec/h264.c
> +++ b/libavcodec/h264.c
> @@ -1528,7 +1528,9 @@ static int decode_update_thread_context(AVCodecContext *dst,
>          for (i = 0; i < MAX_PPS_COUNT; i++)
>              av_freep(h->pps_buffers + i);
>  
> -        memcpy(h, h1, offsetof(H264Context, mb));
> +        // copy all fields after MpegEnc, except mb
> +        memcpy(h, h1, offsetof(H264Context, intra_pcm_ptr));
> +        av_assert0(&h->cabac == &h->mb_padding + 1);
>          memcpy(&h->cabac, &h1->cabac,
>                 sizeof(H264Context) - offsetof(H264Context, cabac));
>          av_assert0(&h->cabac == &h->mb_padding + 1);

the comment is outdated, the assert duplciate
i removed these 2 and applied

thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130218/13c659cb/attachment.asc>


More information about the ffmpeg-devel mailing list