diff options
author | Jerome Jiang <jianj@google.com> | 2017-11-01 16:58:01 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-11-01 16:58:01 +0000 |
commit | 3ba9a2c8b2341430b001ed531f1eedf7c9b0384f (patch) | |
tree | e9375238b9f6df4b8a17ced5c2908303fda65035 /vp9 | |
parent | 0c84b9b7030515b51d08038a6a2c3105b4881b4d (diff) | |
parent | 34805d6d0d09845f83f90fd5ce558f531db22352 (diff) | |
download | libvpx-3ba9a2c8b2341430b001ed531f1eedf7c9b0384f.tar libvpx-3ba9a2c8b2341430b001ed531f1eedf7c9b0384f.tar.gz libvpx-3ba9a2c8b2341430b001ed531f1eedf7c9b0384f.tar.bz2 libvpx-3ba9a2c8b2341430b001ed531f1eedf7c9b0384f.zip |
Merge "vp9: Move allocation of vt2 after early exits."
Diffstat (limited to 'vp9')
-rw-r--r-- | vp9/encoder/vp9_encodeframe.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index e8117afb9..f60c0d326 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -1113,8 +1113,6 @@ static int choose_partitioning(VP9_COMP *cpi, const TileInfo *const tile, // For non keyframes, disable 4x4 average for low resolution when speed = 8 threshold_4x4avg = (cpi->oxcf.speed < 8) ? thresholds[1] << 1 : INT64_MAX; - if (low_res && threshold_4x4avg < INT64_MAX) - CHECK_MEM_ERROR(cm, vt2, vpx_calloc(16, sizeof(*vt2))); memset(x->variance_low, 0, sizeof(x->variance_low)); if (xd->mb_to_right_edge < 0) pixels_wide += (xd->mb_to_right_edge >> 3); @@ -1224,7 +1222,6 @@ static int choose_partitioning(VP9_COMP *cpi, const TileInfo *const tile, set_block_size(cpi, x, xd, mi_row, mi_col, BLOCK_64X64); x->variance_low[0] = 1; chroma_check(cpi, x, bsize, y_sad, is_key_frame); - if (vt2) vpx_free(vt2); return 0; } } @@ -1236,7 +1233,6 @@ static int choose_partitioning(VP9_COMP *cpi, const TileInfo *const tile, if (cpi->sf.copy_partition_flag && y_sad_last < cpi->vbp_threshold_copy && copy_partitioning(cpi, x, xd, mi_row, mi_col, segment_id, sb_offset)) { chroma_check(cpi, x, bsize, y_sad, is_key_frame); - if (vt2) vpx_free(vt2); return 0; } } else { @@ -1254,6 +1250,8 @@ static int choose_partitioning(VP9_COMP *cpi, const TileInfo *const tile, #endif // CONFIG_VP9_HIGHBITDEPTH } + if (low_res && threshold_4x4avg < INT64_MAX) + CHECK_MEM_ERROR(cm, vt2, vpx_calloc(16, sizeof(*vt2))); // Fill in the entire tree of 8x8 (or 4x4 under some conditions) variances // for splits. for (i = 0; i < 4; i++) { |