[FFmpeg-devel] [PATCH 2/2] libx265: Only use one memcpy for headers

Michael Niedermayer michaelni at gmx.at
Sun Mar 23 15:45:20 CET 2014


On Sun, Mar 23, 2014 at 02:41:00PM +0000, Derek Buitenhuis wrote:
> They're guaranteed by the x265 API to be contiguous in memory.
> 
> Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> ---
>  libavcodec/libx265.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
> index ba738c6..c377dec 100644
> --- a/libavcodec/libx265.c
> +++ b/libavcodec/libx265.c
> @@ -80,7 +80,6 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
>  {
>      libx265Context *ctx = avctx->priv_data;
>      x265_nal *nal;
> -    uint8_t *buf;
>      int sar_num, sar_den;
>      int nnal;
>      int ret;
> @@ -199,11 +198,7 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
>          return AVERROR(ENOMEM);
>      }
>  
> -    buf = ctx->header;
> -    for (i = 0; i < nnal; i++) {
> -        memcpy(buf, nal[i].payload, nal[i].sizeBytes);
> -        buf += nal[i].sizeBytes;
> -    }

> +    memcpy(buf, nal[0].payload, ctx->header_size);

this uses buf, but buf is removed by this patch

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- 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/20140323/ad4d8aae/attachment.asc>


More information about the ffmpeg-devel mailing list