summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngie Chiang <angiebird@google.com>2019-08-30 16:20:36 -0700
committerAngie Chiang <angiebird@google.com>2019-08-30 16:20:36 -0700
commit101f370a426884e9a1fe2b327b437218a1d1de33 (patch)
tree628d6505d46b6006bde584f5ba82488ab9a48d53
parentdbe5a1a11117ba8f355b05615e6a1cabcbbeb602 (diff)
downloadlibvpx-101f370a426884e9a1fe2b327b437218a1d1de33.tar
libvpx-101f370a426884e9a1fe2b327b437218a1d1de33.tar.gz
libvpx-101f370a426884e9a1fe2b327b437218a1d1de33.tar.bz2
libvpx-101f370a426884e9a1fe2b327b437218a1d1de33.zip
Report failure of vp9_alloc_motion_field_info
Change-Id: I87f2a8dbf4e89b1cc8526307e82812aea6ac137e
-rw-r--r--vp9/encoder/vp9_encoder.c9
-rw-r--r--vp9/encoder/vp9_non_greedy_mv.c10
2 files changed, 13 insertions, 6 deletions
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c
index 1357573d2..25464b3b8 100644
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -7140,8 +7140,13 @@ static void init_tpl_buffer(VP9_COMP *cpi) {
// TODO(angiebird): This probably needs further modifications to support
// frame scaling later on.
- vp9_alloc_motion_field_info(&cpi->motion_field_info, MAX_ARF_GOP_SIZE,
- mi_rows, mi_cols);
+ Status status = vp9_alloc_motion_field_info(
+ &cpi->motion_field_info, MAX_ARF_GOP_SIZE, mi_rows, mi_cols);
+ if (status == STATUS_FAILED) {
+ vpx_internal_error(&(cm)->error, VPX_CODEC_MEM_ERROR,
+ "vp9_alloc_motion_field_info failed");
+ }
+
if (cpi->feature_score_loc_alloc == 0) {
// The smallest block size of motion field is 4x4, but the mi_unit is 8x8,
// therefore the number of units is "mi_rows * mi_cols * 4" here.
diff --git a/vp9/encoder/vp9_non_greedy_mv.c b/vp9/encoder/vp9_non_greedy_mv.c
index d21f4def2..4679d6c49 100644
--- a/vp9/encoder/vp9_non_greedy_mv.c
+++ b/vp9/encoder/vp9_non_greedy_mv.c
@@ -193,7 +193,6 @@ Status vp9_alloc_motion_field_info(MotionFieldInfo *motion_field_info,
Status status =
vp9_alloc_motion_field(motion_field, bsize, block_rows, block_cols);
if (status == STATUS_FAILED) {
- assert(0);
return STATUS_FAILED;
}
}
@@ -214,19 +213,22 @@ Status vp9_alloc_motion_field(MotionField *motion_field, BLOCK_SIZE bsize,
motion_field->mf =
vpx_calloc(motion_field->block_num, sizeof(*motion_field->mf));
if (motion_field->mf == NULL) {
- assert(0);
status = STATUS_FAILED;
}
motion_field->set_mv =
vpx_calloc(motion_field->block_num, sizeof(*motion_field->set_mv));
if (motion_field->set_mv == NULL) {
- assert(0);
+ vpx_free(motion_field->mf);
+ motion_field->mf = NULL;
status = STATUS_FAILED;
}
motion_field->local_structure = vpx_calloc(
motion_field->block_num, sizeof(*motion_field->local_structure));
if (motion_field->local_structure == NULL) {
- assert(0);
+ vpx_free(motion_field->mf);
+ motion_field->mf = NULL;
+ vpx_free(motion_field->set_mv);
+ motion_field->set_mv = NULL;
status = STATUS_FAILED;
}
return status;