mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-02-04 06:08:26 +02:00
error_resilience: initialize s->block_index[].
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org
This commit is contained in:
parent
11b940a1a8
commit
6193ff6854
@ -419,9 +419,14 @@ static void guess_mv(MpegEncContext *s)
|
|||||||
if ((!(s->avctx->error_concealment&FF_EC_GUESS_MVS)) ||
|
if ((!(s->avctx->error_concealment&FF_EC_GUESS_MVS)) ||
|
||||||
num_avail <= mb_width / 2) {
|
num_avail <= mb_width / 2) {
|
||||||
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
|
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
|
||||||
|
s->mb_x = 0;
|
||||||
|
s->mb_y = mb_y;
|
||||||
|
ff_init_block_index(s);
|
||||||
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
|
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
|
||||||
const int mb_xy = mb_x + mb_y * s->mb_stride;
|
const int mb_xy = mb_x + mb_y * s->mb_stride;
|
||||||
|
|
||||||
|
ff_update_block_index(s);
|
||||||
|
|
||||||
if (IS_INTRA(s->current_picture.f.mb_type[mb_xy]))
|
if (IS_INTRA(s->current_picture.f.mb_type[mb_xy]))
|
||||||
continue;
|
continue;
|
||||||
if (!(s->error_status_table[mb_xy] & ER_MV_ERROR))
|
if (!(s->error_status_table[mb_xy] & ER_MV_ERROR))
|
||||||
@ -456,6 +461,9 @@ static void guess_mv(MpegEncContext *s)
|
|||||||
|
|
||||||
changed = 0;
|
changed = 0;
|
||||||
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
|
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
|
||||||
|
s->mb_x = 0;
|
||||||
|
s->mb_y = mb_y;
|
||||||
|
ff_init_block_index(s);
|
||||||
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
|
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
|
||||||
const int mb_xy = mb_x + mb_y * s->mb_stride;
|
const int mb_xy = mb_x + mb_y * s->mb_stride;
|
||||||
int mv_predictor[8][2] = { { 0 } };
|
int mv_predictor[8][2] = { { 0 } };
|
||||||
@ -467,6 +475,8 @@ static void guess_mv(MpegEncContext *s)
|
|||||||
const int mot_index = (mb_x + mb_y * mot_stride) * mot_step;
|
const int mot_index = (mb_x + mb_y * mot_stride) * mot_step;
|
||||||
int prev_x, prev_y, prev_ref;
|
int prev_x, prev_y, prev_ref;
|
||||||
|
|
||||||
|
ff_update_block_index(s);
|
||||||
|
|
||||||
if ((mb_x ^ mb_y ^ pass) & 1)
|
if ((mb_x ^ mb_y ^ pass) & 1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -1072,11 +1082,16 @@ void ff_er_frame_end(MpegEncContext *s)
|
|||||||
|
|
||||||
/* handle inter blocks with damaged AC */
|
/* handle inter blocks with damaged AC */
|
||||||
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
|
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
|
||||||
|
s->mb_x = 0;
|
||||||
|
s->mb_y = mb_y;
|
||||||
|
ff_init_block_index(s);
|
||||||
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
|
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
|
||||||
const int mb_xy = mb_x + mb_y * s->mb_stride;
|
const int mb_xy = mb_x + mb_y * s->mb_stride;
|
||||||
const int mb_type = s->current_picture.f.mb_type[mb_xy];
|
const int mb_type = s->current_picture.f.mb_type[mb_xy];
|
||||||
int dir = !s->last_picture.f.data[0];
|
int dir = !s->last_picture.f.data[0];
|
||||||
|
|
||||||
|
ff_update_block_index(s);
|
||||||
|
|
||||||
error = s->error_status_table[mb_xy];
|
error = s->error_status_table[mb_xy];
|
||||||
|
|
||||||
if (IS_INTRA(mb_type))
|
if (IS_INTRA(mb_type))
|
||||||
@ -1114,11 +1129,16 @@ void ff_er_frame_end(MpegEncContext *s)
|
|||||||
/* guess MVs */
|
/* guess MVs */
|
||||||
if (s->pict_type == AV_PICTURE_TYPE_B) {
|
if (s->pict_type == AV_PICTURE_TYPE_B) {
|
||||||
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
|
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
|
||||||
|
s->mb_x = 0;
|
||||||
|
s->mb_y = mb_y;
|
||||||
|
ff_init_block_index(s);
|
||||||
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
|
for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
|
||||||
int xy = mb_x * 2 + mb_y * 2 * s->b8_stride;
|
int xy = mb_x * 2 + mb_y * 2 * s->b8_stride;
|
||||||
const int mb_xy = mb_x + mb_y * s->mb_stride;
|
const int mb_xy = mb_x + mb_y * s->mb_stride;
|
||||||
const int mb_type = s->current_picture.f.mb_type[mb_xy];
|
const int mb_type = s->current_picture.f.mb_type[mb_xy];
|
||||||
|
|
||||||
|
ff_update_block_index(s);
|
||||||
|
|
||||||
error = s->error_status_table[mb_xy];
|
error = s->error_status_table[mb_xy];
|
||||||
|
|
||||||
if (IS_INTRA(mb_type))
|
if (IS_INTRA(mb_type))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user