aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/msrledec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-30 16:41:33 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-03-14 04:58:01 +0100
commit3ee967c1d8756fa4448772a02accc16df72bb59e (patch)
tree09e34b7b4d6aafc4c67f6669de9aef4938b01b7b /libavcodec/msrledec.c
parente44f89371c3af7e881d7795d3c7e58b68348d421 (diff)
downloadffmpeg-3ee967c1d8756fa4448772a02accc16df72bb59e.tar.gz
msrledec: merge switches
More speedup and fixes 'may be used uninitialized in this function' warnings Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit d2e0a276d593ded94401e687f60bee266f3e725e) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/msrledec.c')
-rw-r--r--libavcodec/msrledec.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/libavcodec/msrledec.c b/libavcodec/msrledec.c
index e46b99bfbf..cd0a73decf 100644
--- a/libavcodec/msrledec.c
+++ b/libavcodec/msrledec.c
@@ -206,30 +206,24 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic,
if ((pic->linesize[0] > 0 && output + p1 * (depth >> 3) > output_end) ||
(pic->linesize[0] < 0 && output + p1 * (depth >> 3) < output_end))
continue;
- switch(depth){
- case 8: pix[0] = bytestream2_get_byte(gb);
- break;
- case 16: pix16 = bytestream2_get_le16(gb);
- break;
- case 24: pix[0] = bytestream2_get_byte(gb);
- pix[1] = bytestream2_get_byte(gb);
- pix[2] = bytestream2_get_byte(gb);
- break;
- case 32: pix32 = bytestream2_get_le32(gb);
- break;
- }
+
switch(depth){
case 8:
+ pix[0] = bytestream2_get_byte(gb);
for(i = 0; i < p1; i++)
*output++ = pix[0];
break;
case 16:
+ pix16 = bytestream2_get_le16(gb);
for(i = 0; i < p1; i++) {
*(uint16_t*)output = pix16;
output += 2;
}
break;
case 24:
+ pix[0] = bytestream2_get_byte(gb);
+ pix[1] = bytestream2_get_byte(gb);
+ pix[2] = bytestream2_get_byte(gb);
for(i = 0; i < p1; i++) {
*output++ = pix[0];
*output++ = pix[1];
@@ -237,6 +231,7 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic,
}
break;
case 32:
+ pix32 = bytestream2_get_le32(gb);
for(i = 0; i < p1; i++) {
*(uint32_t*)output = pix32;
output += 4;