Commit dbaae33c authored by Michael Niedermayer's avatar Michael Niedermayer

msrledec: move loop into switch

speeds up code and allows more simplifications
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent c2992b70
...@@ -218,21 +218,30 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, ...@@ -218,21 +218,30 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic,
case 32: pix32 = bytestream2_get_le32(gb); case 32: pix32 = bytestream2_get_le32(gb);
break; break;
} }
for(i = 0; i < p1; i++) { switch(depth){
switch(depth){ case 8:
case 8: *output++ = pix[0]; for(i = 0; i < p1; i++)
break; *output++ = pix[0];
case 16: *(uint16_t*)output = pix16; break;
output += 2; case 16:
break; for(i = 0; i < p1; i++) {
case 24: *output++ = pix[0]; *(uint16_t*)output = pix16;
*output++ = pix[1]; output += 2;
*output++ = pix[2]; }
break; break;
case 32: *(uint32_t*)output = pix32; case 24:
output += 4; for(i = 0; i < p1; i++) {
break; *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; pos += p1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment