You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avcodec/smcenc: fix errors with using intra after inter skip
This commit is contained in:
@@ -127,6 +127,7 @@ static void smc_encode_stream(SMCContext *s, const AVFrame *frame,
|
|||||||
int color_pair_index = 0;
|
int color_pair_index = 0;
|
||||||
int color_quad_index = 0;
|
int color_quad_index = 0;
|
||||||
int color_octet_index = 0;
|
int color_octet_index = 0;
|
||||||
|
int prev_block_inter = 0;
|
||||||
int color_table_index; /* indexes to color pair, quad, or octet tables */
|
int color_table_index; /* indexes to color pair, quad, or octet tables */
|
||||||
int total_blocks;
|
int total_blocks;
|
||||||
int cur_y = 0;
|
int cur_y = 0;
|
||||||
@@ -182,10 +183,10 @@ static void smc_encode_stream(SMCContext *s, const AVFrame *frame,
|
|||||||
cur_y = frame_y;
|
cur_y = frame_y;
|
||||||
cur_x = frame_x;
|
cur_x = frame_x;
|
||||||
|
|
||||||
while (block_counter > 0 && block_counter + intra_skip_blocks < total_blocks) {
|
while (block_counter > 0 && prev_block_inter == 0 && block_counter + intra_skip_blocks < total_blocks) {
|
||||||
const int y_size = FFMIN(4, height - cur_y);
|
const int y_size = FFMIN(4, height - cur_y);
|
||||||
const int x_size = FFMIN(4, width - cur_x);
|
const int x_size = FFMIN(4, width - cur_x);
|
||||||
const ptrdiff_t offset = pixel_ptr - src_pixels;
|
const ptrdiff_t offset = xpixel_ptr - src_pixels;
|
||||||
const int sy = offset / stride;
|
const int sy = offset / stride;
|
||||||
const int sx = offset % stride;
|
const int sx = offset % stride;
|
||||||
const int ny = sx < 4 ? sy - 4 : sy;
|
const int ny = sx < 4 ? sy - 4 : sy;
|
||||||
@@ -194,7 +195,7 @@ static void smc_encode_stream(SMCContext *s, const AVFrame *frame,
|
|||||||
int compare = 0;
|
int compare = 0;
|
||||||
|
|
||||||
for (int y = 0; y < y_size; y++) {
|
for (int y = 0; y < y_size; y++) {
|
||||||
compare |= memcmp(old_pixel_ptr + y * stride, pixel_ptr + y * stride, x_size);
|
compare |= !!memcmp(old_pixel_ptr + y * stride, pixel_ptr + y * stride, x_size);
|
||||||
if (compare)
|
if (compare)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -271,6 +272,7 @@ static void smc_encode_stream(SMCContext *s, const AVFrame *frame,
|
|||||||
blocks = inter_skip_blocks;
|
blocks = inter_skip_blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prev_block_inter = distinct == 19 || distinct == 20;
|
||||||
switch (distinct) {
|
switch (distinct) {
|
||||||
case 1:
|
case 1:
|
||||||
if (blocks <= 16) {
|
if (blocks <= 16) {
|
||||||
|
Reference in New Issue
Block a user