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@gmail.com>
This commit is contained in:
Derek Buitenhuis 2014-03-23 14:31:06 +00:00
parent 206d5330f6
commit ecb5b9c098
1 changed files with 1 additions and 6 deletions

View File

@ -80,7 +80,6 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
{ {
libx265Context *ctx = avctx->priv_data; libx265Context *ctx = avctx->priv_data;
x265_nal *nal; x265_nal *nal;
uint8_t *buf;
int sar_num, sar_den; int sar_num, sar_den;
int nnal; int nnal;
int ret; int ret;
@ -198,11 +197,7 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
buf = ctx->header; memcpy(ctx->header, nal[0].payload, ctx->header_size);
for (i = 0; i < nnal; i++) {
memcpy(buf, nal[i].payload, nal[i].sizeBytes);
buf += nal[i].sizeBytes;
}
if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) { if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) {
avctx->extradata_size = ctx->header_size; avctx->extradata_size = ctx->header_size;