aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/libopenjpegdec.c
diff options
context:
space:
mode:
authorMichael Bradshaw <mbradshaw@sorensonmedia.com>2011-12-03 12:14:03 -0700
committerMichael Niedermayer <michaelni@gmx.at>2012-01-03 06:15:33 +0100
commitd1669e5fe3d61dc4181f96138eb4355aaaf231ea (patch)
tree79138bce50ec05961716c517d96ff077a6f23e2d /libavcodec/libopenjpegdec.c
parent69d766daa0fdb85410bcb926d2b9ace0aaba34d0 (diff)
downloadffmpeg-d1669e5fe3d61dc4181f96138eb4355aaaf231ea.tar.gz
Fixed openjpeg decoding bug with width/linesize issue
The original code wasn't taking into account the fact that linesize may not equal the frame's width. This is to correct that. Signed-off-by: Michael Bradshaw <mbradshaw@sorensonmedia.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/libopenjpegdec.c')
-rw-r--r--libavcodec/libopenjpegdec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c
index 6344ad0c74..8cab41e124 100644
--- a/libavcodec/libopenjpegdec.c
+++ b/libavcodec/libopenjpegdec.c
@@ -139,8 +139,8 @@ static inline void libopenjpeg_copyto8(AVFrame *picture, opj_image_t *image) {
for(index = 0; index < image->numcomps; index++) {
comp_data = image->comps[index].data;
- img_ptr = picture->data[index];
for(y = 0; y < image->comps[index].h; y++) {
+ img_ptr = picture->data[index] + y * picture->linesize[index];
for(x = 0; x < image->comps[index].w; x++) {
*img_ptr = (uint8_t) *comp_data;
img_ptr++;
@@ -156,8 +156,8 @@ static inline void libopenjpeg_copyto16(AVFrame *picture, opj_image_t *image) {
int index, x, y;
for(index = 0; index < image->numcomps; index++) {
comp_data = image->comps[index].data;
- img_ptr = (uint16_t*) picture->data[index];
for(y = 0; y < image->comps[index].h; y++) {
+ img_ptr = (uint16_t*) (picture->data[index] + y * picture->linesize[index]);
for(x = 0; x < image->comps[index].w; x++) {
*img_ptr = *comp_data;
img_ptr++;