ref: 02a0c51e50aade80fba607a2fb03a6da42933b85
parent: c97f5e8b8644f21aeff6b6f7416347f5e60622f1
parent: 7897059e8bfbab57d997df8b0bb4821ce9612268
author: Dmitry Kovalev <dkovalev@google.com>
date: Fri Sep 5 06:31:41 EDT 2014
Merge "Adding temp cpi var."
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -836,6 +836,7 @@
vpx_enc_frame_flags_t flags,
unsigned long deadline) {
vpx_codec_err_t res = VPX_CODEC_OK;
+ VP9_COMP *const cpi = ctx->cpi;
const vpx_rational_t *const timebase = &ctx->cfg.g_timebase;
if (img != NULL) {
@@ -842,12 +843,12 @@
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 && ctx->cpi != NULL && ctx->cx_data == NULL) {
+ if (res == VPX_CODEC_OK && cpi != NULL && ctx->cx_data == 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 *
- (ctx->cpi->multi_arf_allowed ? 8 : 2);
+ (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);
@@ -867,7 +868,7 @@
return VPX_CODEC_INVALID_PARAM;
}
- vp9_apply_encoding_flags(ctx->cpi, flags);
+ vp9_apply_encoding_flags(cpi, flags);
// Handle fixed keyframe intervals
if (ctx->cfg.kf_mode == VPX_KF_AUTO &&
@@ -879,7 +880,7 @@
}
// Initialize the encoder instance on the first frame.
- if (res == VPX_CODEC_OK && ctx->cpi != NULL) {
+ if (res == VPX_CODEC_OK && cpi != NULL) {
unsigned int lib_flags = 0;
YV12_BUFFER_CONFIG sd;
int64_t dst_time_stamp = timebase_units_to_ticks(timebase, pts);
@@ -890,7 +891,7 @@
// Set up internal flags
if (ctx->base.init_flags & VPX_CODEC_USE_PSNR)
- ((VP9_COMP *)ctx->cpi)->b_calculate_psnr = 1;
+ cpi->b_calculate_psnr = 1;
if (img != NULL) {
res = image2yuvconfig(img, &sd);
@@ -897,9 +898,8 @@
// Store the original flags in to the frame buffer. Will extract the
// key frame flag when we actually encode this frame.
- if (vp9_receive_raw_frame(ctx->cpi, flags,
+ if (vp9_receive_raw_frame(cpi, flags,
&sd, dst_time_stamp, dst_end_time_stamp)) {
- VP9_COMP *cpi = (VP9_COMP *)ctx->cpi;
res = update_error_state(ctx, &cpi->common.error);
}
}
@@ -924,11 +924,10 @@
}
while (cx_data_sz >= ctx->cx_data_sz / 2 &&
- -1 != vp9_get_compressed_data(ctx->cpi, &lib_flags, &size,
+ -1 != vp9_get_compressed_data(cpi, &lib_flags, &size,
cx_data, &dst_time_stamp,
&dst_end_time_stamp, !img)) {
if (size) {
- VP9_COMP *const cpi = (VP9_COMP *)ctx->cpi;
vpx_codec_cx_pkt_t pkt;
#if CONFIG_SPATIAL_SVC
--
⑨