1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

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>
This commit is contained in:
James Almer 2018-04-23 23:39:54 -03:00
parent bd90a2ec04
commit 0161d91db0

View File

@ -362,7 +362,7 @@ static int cbs_mpeg2_assemble_fragment(CodedBitstreamContext *ctx,
CodedBitstreamFragment *frag) CodedBitstreamFragment *frag)
{ {
uint8_t *data; uint8_t *data;
size_t size, dp, sp; size_t size, dp;
int i; int i;
size = 0; size = 0;
@ -382,8 +382,8 @@ static int cbs_mpeg2_assemble_fragment(CodedBitstreamContext *ctx,
data[dp++] = 0; data[dp++] = 0;
data[dp++] = 1; data[dp++] = 1;
for (sp = 0; sp < unit->data_size; sp++) memcpy(data + dp, unit->data, unit->data_size);
data[dp++] = unit->data[sp]; dp += unit->data_size;
} }
av_assert0(dp == size); av_assert0(dp == size);