aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/qtrleenc.c
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2009-05-23 05:55:29 +0000
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2009-05-23 05:55:29 +0000
commit9867a14f6ca324e918369af52d6dbcc97721e94e (patch)
tree2359c9905996997a8cc4d4b8f9cec59add13315a /libavcodec/qtrleenc.c
parentb10d7e4e3afd21d10bd53d3c839cf3eb151c63d7 (diff)
downloadffmpeg-9867a14f6ca324e918369af52d6dbcc97721e94e.tar.gz
fix qtrle encoding when previous frame linesize differs, fix #998
Originally committed as revision 18908 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/qtrleenc.c')
-rw-r--r--libavcodec/qtrleenc.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/libavcodec/qtrleenc.c b/libavcodec/qtrleenc.c
index 3f0cc8735e..b302964b98 100644
--- a/libavcodec/qtrleenc.c
+++ b/libavcodec/qtrleenc.c
@@ -126,8 +126,10 @@ static void qtrle_encode_line(QtrleEncContext *s, AVFrame *p, int line, uint8_t
int temp_cost;
int j;
- uint8_t *this_line = p-> data[0] + line*p->linesize[0] + (width - 1)*s->pixel_size;
- uint8_t *prev_line = s->previous_frame.data[0] + line*p->linesize[0] + (width - 1)*s->pixel_size;
+ uint8_t *this_line = p-> data[0] + line*p-> linesize[0] +
+ (width - 1)*s->pixel_size;
+ uint8_t *prev_line = s->previous_frame.data[0] + line*s->previous_frame.linesize[0] +
+ (width - 1)*s->pixel_size;
s->length_table[width] = 0;
skipcount = 0;
@@ -239,16 +241,17 @@ static int encode_frame(QtrleEncContext *s, AVFrame *p, uint8_t *buf)
uint8_t *orig_buf = buf;
if (!s->frame.key_frame) {
+ unsigned line_size = s->avctx->width * s->pixel_size;
for (start_line = 0; start_line < s->avctx->height; start_line++)
if (memcmp(p->data[0] + start_line*p->linesize[0],
- s->previous_frame.data[0] + start_line*p->linesize[0],
- p->linesize[0]))
+ s->previous_frame.data[0] + start_line*s->previous_frame.linesize[0],
+ line_size))
break;
for (end_line=s->avctx->height; end_line > start_line; end_line--)
if (memcmp(p->data[0] + (end_line - 1)*p->linesize[0],
- s->previous_frame.data[0] + (end_line - 1)*p->linesize[0],
- p->linesize[0]))
+ s->previous_frame.data[0] + (end_line - 1)*s->previous_frame.linesize[0],
+ line_size))
break;
}