aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-30 16:39:35 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-03-14 04:57:44 +0100
commite44f89371c3af7e881d7795d3c7e58b68348d421 (patch)
tree6c55bc3b75d98da4a04eaaaa1caeb5248488d28f
parente586e4d93bfb66ccfcfa9c2aa48649f85470b6a1 (diff)
downloadffmpeg-e44f89371c3af7e881d7795d3c7e58b68348d421.tar.gz
msrledec: move loop into switch
speeds up code and allows more simplifications Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit dbaae33c2c71862b8eaea978ed6dccc5ec03db89) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/msrledec.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/libavcodec/msrledec.c b/libavcodec/msrledec.c
index 44371f0a1f..e46b99bfbf 100644
--- a/libavcodec/msrledec.c
+++ b/libavcodec/msrledec.c
@@ -218,21 +218,30 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic,
case 32: pix32 = bytestream2_get_le32(gb);
break;
}
- for(i = 0; i < p1; i++) {
- switch(depth){
- case 8: *output++ = pix[0];
- break;
- case 16: *(uint16_t*)output = pix16;
- output += 2;
- break;
- case 24: *output++ = pix[0];
- *output++ = pix[1];
- *output++ = pix[2];
- break;
- case 32: *(uint32_t*)output = pix32;
- output += 4;
- break;
+ switch(depth){
+ case 8:
+ for(i = 0; i < p1; i++)
+ *output++ = pix[0];
+ break;
+ case 16:
+ for(i = 0; i < p1; i++) {
+ *(uint16_t*)output = pix16;
+ output += 2;
+ }
+ break;
+ case 24:
+ for(i = 0; i < p1; i++) {
+ *output++ = pix[0];
+ *output++ = pix[1];
+ *output++ = pix[2];
+ }
+ break;
+ case 32:
+ for(i = 0; i < p1; i++) {
+ *(uint32_t*)output = pix32;
+ output += 4;
}
+ break;
}
pos += p1;
}