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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 917
918 static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t *ctx, 918 static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t *ctx,
919 const vpx_image_t *img, 919 const vpx_image_t *img,
920 vpx_codec_pts_t pts, 920 vpx_codec_pts_t pts,
921 unsigned long duration, 921 unsigned long duration,
922 vpx_enc_frame_flags_t flags, 922 vpx_enc_frame_flags_t flags,
923 unsigned long deadline) { 923 unsigned long deadline) {
924 vpx_codec_err_t res = VPX_CODEC_OK; 924 vpx_codec_err_t res = VPX_CODEC_OK;
925 VP9_COMP *const cpi = ctx->cpi; 925 VP9_COMP *const cpi = ctx->cpi;
926 const vpx_rational_t *const timebase = &ctx->cfg.g_timebase; 926 const vpx_rational_t *const timebase = &ctx->cfg.g_timebase;
927 size_t data_sz;
927 928
928 if (img != NULL) { 929 if (img != NULL) {
929 res = validate_img(ctx, img); 930 res = validate_img(ctx, img);
930 // TODO(jzern) the checks related to cpi's validity should be treated as a 931 // TODO(jzern) the checks related to cpi's validity should be treated as a
931 // failure condition, encoder setup is done fully in init() currently. 932 // failure condition, encoder setup is done fully in init() currently.
932 if (res == VPX_CODEC_OK && cpi != NULL && ctx->cx_data == NULL) { 933 if (res == VPX_CODEC_OK && cpi != NULL) {
933 // There's no codec control for multiple alt-refs so check the encoder 934 // There's no codec control for multiple alt-refs so check the encoder
934 // instance for its status to determine the compressed data size. 935 // instance for its status to determine the compressed data size.
935 ctx->cx_data_sz = ctx->cfg.g_w * ctx->cfg.g_h * 936 data_sz = ctx->cfg.g_w * ctx->cfg.g_h * get_image_bps(img) / 8 *
936 get_image_bps(img) / 8 * 937 (cpi->multi_arf_allowed ? 8 : 2);
937 (cpi->multi_arf_allowed ? 8 : 2); 938 if (data_sz < 4096)
938 if (ctx->cx_data_sz < 4096) ctx->cx_data_sz = 4096; 939 data_sz = 4096;
939 940 if (ctx->cx_data == NULL || ctx->cx_data_sz < data_sz) {
940 ctx->cx_data = (unsigned char *)malloc(ctx->cx_data_sz); 941 ctx->cx_data_sz = data_sz;
941 if (ctx->cx_data == NULL) { 942 free(ctx->cx_data);
942 return VPX_CODEC_MEM_ERROR; 943 ctx->cx_data = (unsigned char*)malloc(ctx->cx_data_sz);
944 if (ctx->cx_data == NULL) {
945 return VPX_CODEC_MEM_ERROR;
946 }
943 } 947 }
944 } 948 }
945 } 949 }
946 950
947 pick_quickcompress_mode(ctx, duration, deadline); 951 pick_quickcompress_mode(ctx, duration, deadline);
948 vpx_codec_pkt_list_init(&ctx->pkt_list); 952 vpx_codec_pkt_list_init(&ctx->pkt_list);
949 953
950 // Handle Flags 954 // Handle Flags
951 if (((flags & VP8_EFLAG_NO_UPD_GF) && (flags & VP8_EFLAG_FORCE_GF)) || 955 if (((flags & VP8_EFLAG_NO_UPD_GF) && (flags & VP8_EFLAG_FORCE_GF)) ||
952 ((flags & VP8_EFLAG_NO_UPD_ARF) && (flags & VP8_EFLAG_FORCE_ARF))) { 956 ((flags & VP8_EFLAG_NO_UPD_ARF) && (flags & VP8_EFLAG_FORCE_ARF))) {
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 1, // 1 cfg map 1504 1, // 1 cfg map
1501 encoder_usage_cfg_map, // vpx_codec_enc_cfg_map_t 1505 encoder_usage_cfg_map, // vpx_codec_enc_cfg_map_t
1502 encoder_encode, // vpx_codec_encode_fn_t 1506 encoder_encode, // vpx_codec_encode_fn_t
1503 encoder_get_cxdata, // vpx_codec_get_cx_data_fn_t 1507 encoder_get_cxdata, // vpx_codec_get_cx_data_fn_t
1504 encoder_set_config, // vpx_codec_enc_config_set_fn_t 1508 encoder_set_config, // vpx_codec_enc_config_set_fn_t
1505 NULL, // vpx_codec_get_global_headers_fn_t 1509 NULL, // vpx_codec_get_global_headers_fn_t
1506 encoder_get_preview, // vpx_codec_get_preview_frame_fn_t 1510 encoder_get_preview, // vpx_codec_get_preview_frame_fn_t
1507 NULL // vpx_codec_enc_mr_get_mem_loc_fn_t 1511 NULL // vpx_codec_enc_mr_get_mem_loc_fn_t
1508 } 1512 }
1509 }; 1513 };
OLDNEW
« 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