summaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2018-04-23 23:39:54 -0300
committerJames Almer <jamrial@gmail.com>2018-04-25 16:45:43 -0300
commit0161d91db01ae0b5d516232d92764f5a898cedc6 (patch)
tree16bbb4404d124810e8d006ef1135920052cc598e /libavcodec
parentbd90a2ec04d7b3fc370501731f8978681e254645 (diff)
downloadffmpeg-streaming-0161d91db01ae0b5d516232d92764f5a898cedc6.zip
ffmpeg-streaming-0161d91db01ae0b5d516232d92764f5a898cedc6.tar.gz
avcodec/cbs_mpeg2: use memcpy when assembling fragments
before: 419022 decicycles in assemble_fragment, 2047 runs, 1 skips after: 104621 decicycles in assemble_fragment, 2045 runs, 3 skips Benched with a 2 minutes long 720x480 DVD mpeg2 sample. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/cbs_mpeg2.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/cbs_mpeg2.c b/libavcodec/cbs_mpeg2.c
index bfb64a0..94b9591 100644
--- a/libavcodec/cbs_mpeg2.c
+++ b/libavcodec/cbs_mpeg2.c
@@ -362,7 +362,7 @@ static int cbs_mpeg2_assemble_fragment(CodedBitstreamContext *ctx,
CodedBitstreamFragment *frag)
{
uint8_t *data;
- size_t size, dp, sp;
+ size_t size, dp;
int i;
size = 0;
@@ -382,8 +382,8 @@ static int cbs_mpeg2_assemble_fragment(CodedBitstreamContext *ctx,
data[dp++] = 0;
data[dp++] = 1;
- for (sp = 0; sp < unit->data_size; sp++)
- data[dp++] = unit->data[sp];
+ memcpy(data + dp, unit->data, unit->data_size);
+ dp += unit->data_size;
}
av_assert0(dp == size);
OpenPOWER on IntegriCloud