Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: source/libvpx/vp9/vp9_cx_iface.c

Issue 1019863002: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/libvpx/vp9/encoder/x86/vp9_dct_ssse3.c ('k') | source/libvpx/vpx_ports/asm_offsets.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/libvpx/vp9/vp9_cx_iface.c
diff --git a/source/libvpx/vp9/vp9_cx_iface.c b/source/libvpx/vp9/vp9_cx_iface.c
index 1908ffc7fc1c006ed201a7a941b584cf98b66f61..eb10da7ac11e8f73c31c783d3f6aea65ba9722a4 100644
--- a/source/libvpx/vp9/vp9_cx_iface.c
+++ b/source/libvpx/vp9/vp9_cx_iface.c
@@ -924,22 +924,26 @@ static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t *ctx,
vpx_codec_err_t res = VPX_CODEC_OK;
VP9_COMP *const cpi = ctx->cpi;
const vpx_rational_t *const timebase = &ctx->cfg.g_timebase;
+ size_t data_sz;
if (img != NULL) {
res = validate_img(ctx, img);
// TODO(jzern) the checks related to cpi's validity should be treated as a
// failure condition, encoder setup is done fully in init() currently.
- if (res == VPX_CODEC_OK && cpi != NULL && ctx->cx_data == NULL) {
+ if (res == VPX_CODEC_OK && cpi != NULL) {
// There's no codec control for multiple alt-refs so check the encoder
// instance for its status to determine the compressed data size.
- ctx->cx_data_sz = ctx->cfg.g_w * ctx->cfg.g_h *
- get_image_bps(img) / 8 *
- (cpi->multi_arf_allowed ? 8 : 2);
- if (ctx->cx_data_sz < 4096) ctx->cx_data_sz = 4096;
-
- ctx->cx_data = (unsigned char *)malloc(ctx->cx_data_sz);
- if (ctx->cx_data == NULL) {
- return VPX_CODEC_MEM_ERROR;
+ data_sz = ctx->cfg.g_w * ctx->cfg.g_h * get_image_bps(img) / 8 *
+ (cpi->multi_arf_allowed ? 8 : 2);
+ if (data_sz < 4096)
+ data_sz = 4096;
+ if (ctx->cx_data == NULL || ctx->cx_data_sz < data_sz) {
+ ctx->cx_data_sz = data_sz;
+ free(ctx->cx_data);
+ ctx->cx_data = (unsigned char*)malloc(ctx->cx_data_sz);
+ if (ctx->cx_data == NULL) {
+ return VPX_CODEC_MEM_ERROR;
+ }
}
}
}
« no previous file with comments | « source/libvpx/vp9/encoder/x86/vp9_dct_ssse3.c ('k') | source/libvpx/vpx_ports/asm_offsets.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698