aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/smcenc.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2022-11-13 00:48:38 +0100
committerPaul B Mahol <onemda@gmail.com>2022-11-13 00:52:19 +0100
commit2d25f33a7ed36003de9a62c9cb165db183663d1c (patch)
tree4ab5f44bdd29f5b66105631c7ecc1b378627a1ba /libavcodec/smcenc.c
parent163f1949ed1eac8598737ba0e917449f20ef2b2d (diff)
downloadffmpeg-2d25f33a7ed36003de9a62c9cb165db183663d1c.tar.gz
avcodec/smcenc: unbreak skip blocks for inter coding
When using frames with different linesize.
Diffstat (limited to 'libavcodec/smcenc.c')
-rw-r--r--libavcodec/smcenc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavcodec/smcenc.c b/libavcodec/smcenc.c
index 59b9d9e0ff..a2d224bd09 100644
--- a/libavcodec/smcenc.c
+++ b/libavcodec/smcenc.c
@@ -116,6 +116,7 @@ static void smc_encode_stream(SMCContext *s, const AVFrame *frame,
const uint8_t *src_pixels = (const uint8_t *)frame->data[0];
const int stride = frame->linesize[0];
const uint8_t *prev_pixels = (const uint8_t *)s->prev_frame->data[0];
+ const int prev_stride = s->prev_frame->linesize[0];
uint8_t *distinct_values = s->distinct_values;
const uint8_t *pixel_ptr, *row_ptr;
const int height = frame->height;
@@ -155,10 +156,10 @@ static void smc_encode_stream(SMCContext *s, const AVFrame *frame,
int compare = 0;
for (int y = 0; y < y_size; y++) {
- const ptrdiff_t offset = pixel_ptr - src_pixels;
- const uint8_t *prev_pixel_ptr = prev_pixels + offset;
+ const ptrdiff_t offset = pixel_ptr - row_ptr;
+ const uint8_t *prev_pixel_ptr = prev_pixels + cur_y * prev_stride + offset;
- compare |= memcmp(prev_pixel_ptr + y * stride, pixel_ptr + y * stride, 4);
+ compare |= memcmp(prev_pixel_ptr + y * prev_stride, pixel_ptr + y * stride, 4);
if (compare)
break;
}