summaryrefslogtreecommitdiff
path: root/libavcodec/error_resilience.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-12-25 21:21:31 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2016-12-25 22:58:52 +0100
commit6e26b6e43fec8032662e39c9d056b2d991f89ab4 (patch)
treeb47daea5c3d34457b10697c2667a9381fb9cddc2 /libavcodec/error_resilience.c
parent7b557bf63ff8549f68cd6a53adb78bf1954187c7 (diff)
downloadffmpeg-6e26b6e43fec8032662e39c9d056b2d991f89ab4.tar.gz
avcodec/error_resilience: Move variable initialization down, remove unneeded inits
This makes the code faster and easier to read Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/error_resilience.c')
-rw-r--r--libavcodec/error_resilience.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
index 741a9c8329..c7dbe17f90 100644
--- a/libavcodec/error_resilience.c
+++ b/libavcodec/error_resilience.c
@@ -452,14 +452,14 @@ static void guess_mv(ERContext *s)
for (mb_y = 0; mb_y < mb_height; mb_y++) {
for (mb_x = (mb_y ^ pass) & 1; mb_x < s->mb_width; mb_x+=2) {
const int mb_xy = mb_x + mb_y * s->mb_stride;
- int mv_predictor[8][2] = { { 0 } };
- int ref[8] = { 0 };
- int pred_count = 0;
+ int mv_predictor[8][2];
+ int ref[8];
+ int pred_count;
int j;
- int best_score = 256 * 256 * 256 * 64;
- int best_pred = 0;
- const int mot_index = (mb_x + mb_y * mot_stride) * mot_step;
- int prev_x = 0, prev_y = 0, prev_ref = 0;
+ int best_score;
+ int best_pred;
+ int mot_index;
+ int prev_x, prev_y, prev_ref;
if (fixed[mb_xy] == MV_FROZEN)
continue;
@@ -483,6 +483,8 @@ static void guess_mv(ERContext *s)
continue;
none_left = 0;
+ pred_count = 0;
+ mot_index = (mb_x + mb_y * mot_stride) * mot_step;
if (mb_x > 0 && fixed[mb_xy - 1]) {
mv_predictor[pred_count][0] =
@@ -569,6 +571,9 @@ static void guess_mv(ERContext *s)
skip_mean_and_median:
/* zero MV */
+ mv_predictor[pred_count][0] =
+ mv_predictor[pred_count][1] =
+ ref[pred_count] = 0;
pred_count++;
prev_x = s->cur_pic.motion_val[0][mot_index][0];
@@ -581,6 +586,8 @@ skip_mean_and_median:
ref[pred_count] = prev_ref;
pred_count++;
+ best_pred = 0;
+ best_score = 256 * 256 * 256 * 64;
for (j = 0; j < pred_count; j++) {
int *linesize = s->cur_pic.f->linesize;
int score = 0;