[FFmpeg-cvslog] libx265: Only use one memcpy for headers

Derek Buitenhuis git at videolan.org
Mon Mar 24 21:33:03 CET 2014


ffmpeg | branch: master | Derek Buitenhuis <derek.buitenhuis at gmail.com> | Sun Mar 23 14:31:06 2014 +0000| [21a561176e5ed44208a4438a1b0c28a91dd6f4b6] | committer: Derek Buitenhuis

libx265: Only use one memcpy for headers

They're guaranteed by the x265 API to be contiguous in memory.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=21a561176e5ed44208a4438a1b0c28a91dd6f4b6
---

 libavcodec/libx265.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index b779c37..b124070 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;
@@ -198,11 +197,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(ctx->header, nal[0].payload, ctx->header_size);
 
     if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
         avctx->extradata_size = ctx->header_size;



More information about the ffmpeg-cvslog mailing list