|
|
@ -229,16 +229,19 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, |
|
|
|
break; |
|
|
|
break; |
|
|
|
case COMP_MSZH_NOCOMP: { |
|
|
|
case COMP_MSZH_NOCOMP: { |
|
|
|
int bppx2; |
|
|
|
int bppx2; |
|
|
|
|
|
|
|
int aligned_width = width; |
|
|
|
switch (c->imgtype) { |
|
|
|
switch (c->imgtype) { |
|
|
|
case IMGTYPE_YUV111: |
|
|
|
case IMGTYPE_YUV111: |
|
|
|
case IMGTYPE_RGB24: |
|
|
|
case IMGTYPE_RGB24: |
|
|
|
bppx2 = 6; |
|
|
|
bppx2 = 6; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case IMGTYPE_YUV422: |
|
|
|
case IMGTYPE_YUV422: |
|
|
|
|
|
|
|
aligned_width &= ~3; |
|
|
|
case IMGTYPE_YUV211: |
|
|
|
case IMGTYPE_YUV211: |
|
|
|
bppx2 = 4; |
|
|
|
bppx2 = 4; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case IMGTYPE_YUV411: |
|
|
|
case IMGTYPE_YUV411: |
|
|
|
|
|
|
|
aligned_width &= ~3; |
|
|
|
case IMGTYPE_YUV420: |
|
|
|
case IMGTYPE_YUV420: |
|
|
|
bppx2 = 3; |
|
|
|
bppx2 = 3; |
|
|
|
break; |
|
|
|
break; |
|
|
@ -246,7 +249,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, |
|
|
|
bppx2 = 0; // will error out below
|
|
|
|
bppx2 = 0; // will error out below
|
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (len < ((width * height * bppx2) >> 1)) |
|
|
|
if (len < ((aligned_width * height * bppx2) >> 1)) |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
return AVERROR_INVALIDDATA; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
@ -312,8 +315,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case IMGTYPE_YUV422: |
|
|
|
case IMGTYPE_YUV422: |
|
|
|
|
|
|
|
pixel_ptr = 0; |
|
|
|
for (row = 0; row < height; row++) { |
|
|
|
for (row = 0; row < height; row++) { |
|
|
|
pixel_ptr = row * width * 2; |
|
|
|
|
|
|
|
yq = uq = vq =0; |
|
|
|
yq = uq = vq =0; |
|
|
|
for (col = 0; col < width/4; col++) { |
|
|
|
for (col = 0; col < width/4; col++) { |
|
|
|
encoded[pixel_ptr] = yq -= encoded[pixel_ptr]; |
|
|
|
encoded[pixel_ptr] = yq -= encoded[pixel_ptr]; |
|
|
@ -329,8 +332,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case IMGTYPE_YUV411: |
|
|
|
case IMGTYPE_YUV411: |
|
|
|
|
|
|
|
pixel_ptr = 0; |
|
|
|
for (row = 0; row < height; row++) { |
|
|
|
for (row = 0; row < height; row++) { |
|
|
|
pixel_ptr = row * width / 2 * 3; |
|
|
|
|
|
|
|
yq = uq = vq =0; |
|
|
|
yq = uq = vq =0; |
|
|
|
for (col = 0; col < width/4; col++) { |
|
|
|
for (col = 0; col < width/4; col++) { |
|
|
|
encoded[pixel_ptr] = yq -= encoded[pixel_ptr]; |
|
|
|
encoded[pixel_ptr] = yq -= encoded[pixel_ptr]; |
|
|
|