From d2499ead93dc4298c0882fe98902acb1b5209f99 Mon Sep 17 00:00:00 2001 From: trav90 Date: Fri, 19 Oct 2018 23:05:00 -0500 Subject: Update libaom to commit ID 1e227d41f0616de9548a673a83a21ef990b62591 --- third_party/aom/aom_scale/aom_scale.h | 6 +++--- third_party/aom/aom_scale/generic/yv12config.c | 24 ++++++++++++++++++++---- third_party/aom/aom_scale/yv12config.h | 10 +++++++--- 3 files changed, 30 insertions(+), 10 deletions(-) (limited to 'third_party/aom/aom_scale') diff --git a/third_party/aom/aom_scale/aom_scale.h b/third_party/aom/aom_scale/aom_scale.h index a4aef6c65..11812a145 100644 --- a/third_party/aom/aom_scale/aom_scale.h +++ b/third_party/aom/aom_scale/aom_scale.h @@ -9,8 +9,8 @@ * PATENTS file, you can obtain it at www.aomedia.org/license/patent. */ -#ifndef AOM_SCALE_AOM_SCALE_H_ -#define AOM_SCALE_AOM_SCALE_H_ +#ifndef AOM_AOM_SCALE_AOM_SCALE_H_ +#define AOM_AOM_SCALE_AOM_SCALE_H_ #include "aom_scale/yv12config.h" @@ -20,4 +20,4 @@ extern void aom_scale_frame(YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, unsigned int vscale, unsigned int vratio, unsigned int interlaced, const int num_planes); -#endif // AOM_SCALE_AOM_SCALE_H_ +#endif // AOM_AOM_SCALE_AOM_SCALE_H_ diff --git a/third_party/aom/aom_scale/generic/yv12config.c b/third_party/aom/aom_scale/generic/yv12config.c index ca5b69066..84705e2d8 100644 --- a/third_party/aom/aom_scale/generic/yv12config.c +++ b/third_party/aom/aom_scale/generic/yv12config.c @@ -14,6 +14,7 @@ #include "aom_mem/aom_mem.h" #include "aom_ports/mem.h" #include "aom_scale/yv12config.h" +#include "av1/common/enums.h" /**************************************************************************** * Exports @@ -50,11 +51,11 @@ int aom_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height, int border, int byte_alignment, aom_codec_frame_buffer_t *fb, aom_get_frame_buffer_cb_fn_t cb, void *cb_priv) { - if (ybf) { #if CONFIG_SIZE_LIMIT - if (width > DECODE_WIDTH_LIMIT || height > DECODE_HEIGHT_LIMIT) return -1; + if (width > DECODE_WIDTH_LIMIT || height > DECODE_HEIGHT_LIMIT) return -1; #endif + if (ybf) { const int aom_byte_align = (byte_alignment == 0) ? 1 : byte_alignment; const int aligned_width = (width + 7) & ~7; const int aligned_height = (height + 7) & ~7; @@ -74,6 +75,17 @@ int aom_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height, uint8_t *buf = NULL; +#if defined AOM_MAX_ALLOCABLE_MEMORY + // The size of ybf->buffer_alloc. + uint64_t alloc_size = frame_size; + // The size of ybf->y_buffer_8bit. + if (use_highbitdepth) alloc_size += yplane_size; + // The decoder may allocate REF_FRAMES frame buffers in the frame buffer + // pool. Bound the total amount of allocated memory as if these REF_FRAMES + // frame buffers were allocated in a single allocation. + if (alloc_size > AOM_MAX_ALLOCABLE_MEMORY / REF_FRAMES) return -1; +#endif + if (cb != NULL) { const int align_addr_extra_size = 31; const uint64_t external_frame_size = frame_size + align_addr_extra_size; @@ -94,7 +106,7 @@ int aom_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height, // This memset is needed for fixing the issue of using uninitialized // value in msan test. It will cause a perf loss, so only do this for // msan test. - memset(ybf->buffer_alloc, 0, (int)frame_size); + memset(ybf->buffer_alloc, 0, (size_t)frame_size); #endif #endif } else if (frame_size > (size_t)ybf->buffer_alloc_sz) { @@ -165,7 +177,11 @@ int aom_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, int width, int height, ybf->y_buffer_8bit = (uint8_t *)aom_memalign(32, (size_t)yplane_size); if (!ybf->y_buffer_8bit) return -1; } else { - assert(!ybf->y_buffer_8bit); + if (ybf->y_buffer_8bit) { + aom_free(ybf->y_buffer_8bit); + ybf->y_buffer_8bit = NULL; + ybf->buf_8bit_valid = 0; + } } ybf->corrupted = 0; /* assume not corrupted by errors */ diff --git a/third_party/aom/aom_scale/yv12config.h b/third_party/aom/aom_scale/yv12config.h index 2b4f597b0..2fb81acd7 100644 --- a/third_party/aom/aom_scale/yv12config.h +++ b/third_party/aom/aom_scale/yv12config.h @@ -9,8 +9,8 @@ * PATENTS file, you can obtain it at www.aomedia.org/license/patent. */ -#ifndef AOM_SCALE_YV12CONFIG_H_ -#define AOM_SCALE_YV12CONFIG_H_ +#ifndef AOM_AOM_SCALE_YV12CONFIG_H_ +#define AOM_AOM_SCALE_YV12CONFIG_H_ #ifdef __cplusplus extern "C" { @@ -28,7 +28,11 @@ extern "C" { // TODO(jingning): Use unified inter predictor for encoder and // decoder during the development process. Revisit the frame border // to improve the decoder performance. +#if CONFIG_REDUCED_ENCODER_BORDER +#define AOM_BORDER_IN_PIXELS 160 +#else #define AOM_BORDER_IN_PIXELS 288 +#endif // CONFIG_REDUCED_ENCODER_BORDER typedef struct yv12_buffer_config { union { @@ -136,4 +140,4 @@ int aom_free_frame_buffer(YV12_BUFFER_CONFIG *ybf); } #endif -#endif // AOM_SCALE_YV12CONFIG_H_ +#endif // AOM_AOM_SCALE_YV12CONFIG_H_ -- cgit v1.2.3