summaryrefslogtreecommitdiff
path: root/libavcodec/qtrle.c
diff options
context:
space:
mode:
authorMartin Vignali <martin.vignali@gmail.com>2019-02-26 10:38:10 +0100
committerMartin Vignali <martin.vignali@gmail.com>2019-03-04 13:03:42 +0100
commit3278ea67c8f2a7c1aea8fd3114b35983791e6732 (patch)
tree98f3743613449d8a1fb8758add482405d8beb210 /libavcodec/qtrle.c
parent5496a734882cad54fda2c3528f16488dcac3b0a1 (diff)
avcodec/qtrle : 32bpp dec copy two raw argb value at the same time
benchmark on x86_64 : 38 fps -> 40 fps
Diffstat (limited to 'libavcodec/qtrle.c')
-rw-r--r--libavcodec/qtrle.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c
index bb55ba8a86..febfea3029 100644
--- a/libavcodec/qtrle.c
+++ b/libavcodec/qtrle.c
@@ -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)
{
- int rle_code;
+ int rle_code, rle_code_half;
int pixel_ptr;
int row_inc = s->frame->linesize[0];
unsigned int argb;
@@ -379,10 +379,15 @@ static void qtrle_decode_32bpp(QtrleContext *s, int row_ptr, int lines_to_change
CHECK_PIXEL_PTR(rle_code * 4);
/* copy pixels directly to output */
- while (rle_code--) {
- argb = bytestream2_get_ne32(&s->g);
- AV_WN32A(rgb + pixel_ptr, argb);
- pixel_ptr += 4;
+ rle_code_half = rle_code / 2;
+ while (rle_code_half--) { /* copy 2 argb raw value at the same time */
+ 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;
}
}
}