avcodec/qtrle : 32bpp dec copy two raw argb value at the same time

benchmark on x86_64 :
38 fps -> 40 fps
This commit is contained in:
Martin Vignali 2019-02-26 10:38:10 +01:00
parent 5496a73488
commit 3278ea67c8
1 changed files with 10 additions and 5 deletions

View File

@ -346,7 +346,7 @@ static void qtrle_decode_24bpp(QtrleContext *s, int row_ptr, int lines_to_change
static void qtrle_decode_32bpp(QtrleContext *s, int row_ptr, int lines_to_change) static void qtrle_decode_32bpp(QtrleContext *s, int row_ptr, int lines_to_change)
{ {
int rle_code; int rle_code, rle_code_half;
int pixel_ptr; int pixel_ptr;
int row_inc = s->frame->linesize[0]; int row_inc = s->frame->linesize[0];
unsigned int argb; unsigned int argb;
@ -379,9 +379,14 @@ static void qtrle_decode_32bpp(QtrleContext *s, int row_ptr, int lines_to_change
CHECK_PIXEL_PTR(rle_code * 4); CHECK_PIXEL_PTR(rle_code * 4);
/* copy pixels directly to output */ /* copy pixels directly to output */
while (rle_code--) { rle_code_half = rle_code / 2;
argb = bytestream2_get_ne32(&s->g); while (rle_code_half--) { /* copy 2 argb raw value at the same time */
AV_WN32A(rgb + pixel_ptr, argb); AV_WN64A(rgb + pixel_ptr, bytestream2_get_ne64(&s->g));
pixel_ptr += 8;
}
if (rle_code % 2 != 0){ /* not even raw value */
AV_WN32A(rgb + pixel_ptr, bytestream2_get_ne32(&s->g));
pixel_ptr += 4; pixel_ptr += 4;
} }
} }