]> git.sesse.net Git - ffmpeg/commitdiff
libx265: Only use one memcpy for headers
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>
Sun, 23 Mar 2014 14:31:06 +0000 (14:31 +0000)
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>
Mon, 24 Mar 2014 15:27:41 +0000 (15:27 +0000)
They're guaranteed by the x265 API to be contiguous in memory.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
libavcodec/libx265.c

index b779c373c550e193dda33e60ade39fa3495ba768..b12407030e21db4360b9f9919a8a63630ec9dcab 100644 (file)
@@ -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;