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

Side by Side Diff: source/libvpx/vp8/vp8_cx_iface.c

Issue 3417017: Update libvpx sources to v0.9.2-35-ga8a38bc. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 10 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vp8/vp8_common.mk ('k') | source/libvpx/vp8/vp8_dx_iface.c » ('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 VP8 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
11 11
12 #include "vpx/vpx_codec.h" 12 #include "vpx/vpx_codec.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 #define ERROR(str) do {\ 106 #define ERROR(str) do {\
107 ctx->base.err_detail = str;\ 107 ctx->base.err_detail = str;\
108 return VPX_CODEC_INVALID_PARAM;\ 108 return VPX_CODEC_INVALID_PARAM;\
109 } while(0) 109 } while(0)
110 110
111 #define RANGE_CHECK(p,memb,lo,hi) do {\ 111 #define RANGE_CHECK(p,memb,lo,hi) do {\
112 if(!(((p)->memb == lo || (p)->memb > (lo)) && (p)->memb <= hi)) \ 112 if(!(((p)->memb == lo || (p)->memb > (lo)) && (p)->memb <= hi)) \
113 ERROR(#memb " out of range ["#lo".."#hi"]");\ 113 ERROR(#memb " out of range ["#lo".."#hi"]");\
114 } while(0) 114 } while(0)
115 115
116 #define RANGE_CHECK_HI(p,memb,hi) do {\
117 if(!((p)->memb <= (hi))) \
118 ERROR(#memb " out of range [.."#hi"]");\
119 } while(0)
120
116 #define RANGE_CHECK_LO(p,memb,lo) do {\ 121 #define RANGE_CHECK_LO(p,memb,lo) do {\
117 if(!((p)->memb >= (lo))) \ 122 if(!((p)->memb >= (lo))) \
118 ERROR(#memb " out of range ["#lo"..]");\ 123 ERROR(#memb " out of range ["#lo"..]");\
119 } while(0) 124 } while(0)
120 125
121 #define RANGE_CHECK_BOOL(p,memb) do {\ 126 #define RANGE_CHECK_BOOL(p,memb) do {\
122 if(!!((p)->memb) != (p)->memb) ERROR(#memb " expected boolean");\ 127 if(!!((p)->memb) != (p)->memb) ERROR(#memb " expected boolean");\
123 } while(0) 128 } while(0)
124 129
125 static vpx_codec_err_t validate_config(vpx_codec_alg_priv_t *ctx, 130 static vpx_codec_err_t validate_config(vpx_codec_alg_priv_t *ctx,
126 const vpx_codec_enc_cfg_t *cfg, 131 const vpx_codec_enc_cfg_t *cfg,
127 const struct vp8_extracfg *vp8_cfg) 132 const struct vp8_extracfg *vp8_cfg)
128 { 133 {
129 RANGE_CHECK(cfg, g_w, 2, 16384); 134 RANGE_CHECK(cfg, g_w, 2, 16384);
130 RANGE_CHECK(cfg, g_h, 2, 16384); 135 RANGE_CHECK(cfg, g_h, 2, 16384);
131 RANGE_CHECK(cfg, g_timebase.den, 1, 1000000000); 136 RANGE_CHECK(cfg, g_timebase.den, 1, 1000000000);
132 RANGE_CHECK(cfg, g_timebase.num, 1, cfg->g_timebase.den); 137 RANGE_CHECK(cfg, g_timebase.num, 1, cfg->g_timebase.den);
133 RANGE_CHECK(cfg, g_profile, 0, 3); 138 RANGE_CHECK_HI(cfg, g_profile, 3);
134 RANGE_CHECK(cfg, rc_min_quantizer, 0, 63); 139 RANGE_CHECK_HI(cfg, rc_min_quantizer, 63);
135 RANGE_CHECK(cfg, rc_max_quantizer, 0, 63); 140 RANGE_CHECK_HI(cfg, rc_max_quantizer, 63);
136 RANGE_CHECK(cfg, g_threads, 0, 64); 141 RANGE_CHECK_HI(cfg, g_threads, 64);
137 #if !(CONFIG_REALTIME_ONLY) 142 #if !(CONFIG_REALTIME_ONLY)
138 RANGE_CHECK(cfg, g_lag_in_frames, 0, 25); 143 RANGE_CHECK_HI(cfg, g_lag_in_frames, 25);
139 #else 144 #else
140 RANGE_CHECK(cfg, g_lag_in_frames, 0, 0); 145 RANGE_CHECK_HI(cfg, g_lag_in_frames, 0);
141 #endif 146 #endif
142 RANGE_CHECK(cfg, rc_end_usage, VPX_VBR, VPX_CBR); 147 RANGE_CHECK(cfg, rc_end_usage, VPX_VBR, VPX_CBR);
143 RANGE_CHECK(cfg, rc_undershoot_pct, 0, 100); 148 RANGE_CHECK_HI(cfg, rc_undershoot_pct, 100);
144 RANGE_CHECK(cfg, rc_2pass_vbr_bias_pct, 0, 100); 149 RANGE_CHECK_HI(cfg, rc_2pass_vbr_bias_pct, 100);
145 RANGE_CHECK(cfg, kf_mode, VPX_KF_DISABLED, VPX_KF_AUTO); 150 RANGE_CHECK(cfg, kf_mode, VPX_KF_DISABLED, VPX_KF_AUTO);
146 //RANGE_CHECK_BOOL(cfg, g_delete_firstpassfile); 151 //RANGE_CHECK_BOOL(cfg, g_delete_firstpassfile);
147 RANGE_CHECK_BOOL(cfg, rc_resize_allowed); 152 RANGE_CHECK_BOOL(cfg, rc_resize_allowed);
148 RANGE_CHECK(cfg, rc_dropframe_thresh, 0, 100); 153 RANGE_CHECK_HI(cfg, rc_dropframe_thresh, 100);
149 RANGE_CHECK(cfg, rc_resize_up_thresh, 0, 100); 154 RANGE_CHECK_HI(cfg, rc_resize_up_thresh, 100);
150 RANGE_CHECK(cfg, rc_resize_down_thresh, 0, 100); 155 RANGE_CHECK_HI(cfg, rc_resize_down_thresh, 100);
151 #if !(CONFIG_REALTIME_ONLY) 156 #if !(CONFIG_REALTIME_ONLY)
152 RANGE_CHECK(cfg, g_pass, VPX_RC_ONE_PASS, VPX_RC_LAST_PASS); 157 RANGE_CHECK(cfg, g_pass, VPX_RC_ONE_PASS, VPX_RC_LAST_PASS);
153 #else 158 #else
154 RANGE_CHECK(cfg, g_pass, VPX_RC_ONE_PASS, VPX_RC_ONE_PASS); 159 RANGE_CHECK(cfg, g_pass, VPX_RC_ONE_PASS, VPX_RC_ONE_PASS);
155 #endif 160 #endif
156 161
157 /* VP8 does not support a lower bound on the keyframe interval in 162 /* VP8 does not support a lower bound on the keyframe interval in
158 * automatic keyframe placement mode. 163 * automatic keyframe placement mode.
159 */ 164 */
160 if (cfg->kf_mode != VPX_KF_DISABLED && cfg->kf_min_dist != cfg->kf_max_dist 165 if (cfg->kf_mode != VPX_KF_DISABLED && cfg->kf_min_dist != cfg->kf_max_dist
161 && cfg->kf_min_dist > 0) 166 && cfg->kf_min_dist > 0)
162 ERROR("kf_min_dist not supported in auto mode, use 0 " 167 ERROR("kf_min_dist not supported in auto mode, use 0 "
163 "or kf_max_dist instead."); 168 "or kf_max_dist instead.");
164 169
165 RANGE_CHECK_BOOL(vp8_cfg, enable_auto_alt_ref); 170 RANGE_CHECK_BOOL(vp8_cfg, enable_auto_alt_ref);
166 #if !(CONFIG_REALTIME_ONLY) 171 #if !(CONFIG_REALTIME_ONLY)
167 RANGE_CHECK(vp8_cfg, encoding_mode, VP8_BEST_QUALITY_ENCODING, VP8_REAL _TIME_ENCODING); 172 RANGE_CHECK(vp8_cfg, encoding_mode, VP8_BEST_QUALITY_ENCODING, VP8_REAL _TIME_ENCODING);
168 RANGE_CHECK(vp8_cfg, cpu_used, -16, 16); 173 RANGE_CHECK(vp8_cfg, cpu_used, -16, 16);
169 RANGE_CHECK(vp8_cfg, noise_sensitivity, 0, 6); 174 RANGE_CHECK_HI(vp8_cfg, noise_sensitivity, 6);
170 #else 175 #else
171 RANGE_CHECK(vp8_cfg, encoding_mode, VP8_REAL_TIME_ENCODING, VP8_REAL_TI ME_ENCODING); 176 RANGE_CHECK(vp8_cfg, encoding_mode, VP8_REAL_TIME_ENCODING, VP8_REAL_TI ME_ENCODING);
172 177
173 if (!((vp8_cfg->cpu_used >= -16 && vp8_cfg->cpu_used <= -4) || (vp8_cfg->cpu _used >= 4 && vp8_cfg->cpu_used <= 16))) 178 if (!((vp8_cfg->cpu_used >= -16 && vp8_cfg->cpu_used <= -4) || (vp8_cfg->cpu _used >= 4 && vp8_cfg->cpu_used <= 16)))
174 ERROR("cpu_used out of range [-16..-4] or [4..16]"); 179 ERROR("cpu_used out of range [-16..-4] or [4..16]");
175 180
176 RANGE_CHECK(vp8_cfg, noise_sensitivity, 0, 0); 181 RANGE_CHECK(vp8_cfg, noise_sensitivity, 0, 0);
177 #endif 182 #endif
178 183
179 RANGE_CHECK(vp8_cfg, token_partitions, VP8_ONE_TOKENPARTITION, VP8_EIGHT_T OKENPARTITION); 184 RANGE_CHECK(vp8_cfg, token_partitions, VP8_ONE_TOKENPARTITION, VP8_EIGHT_T OKENPARTITION);
180 RANGE_CHECK(vp8_cfg, Sharpness, 0, 7); 185 RANGE_CHECK_HI(vp8_cfg, Sharpness, 7);
181 RANGE_CHECK(vp8_cfg, arnr_max_frames, 0, 15); 186 RANGE_CHECK_HI(vp8_cfg, arnr_max_frames, 15);
182 RANGE_CHECK(vp8_cfg, arnr_strength, 0, 6); 187 RANGE_CHECK_HI(vp8_cfg, arnr_strength, 6);
183 RANGE_CHECK(vp8_cfg, arnr_type, 0, 0xffffffff); 188 RANGE_CHECK_HI(vp8_cfg, arnr_type, 0xffffffff);
184 189
185 if (cfg->g_pass == VPX_RC_LAST_PASS) 190 if (cfg->g_pass == VPX_RC_LAST_PASS)
186 { 191 {
187 int n_doubles = cfg->rc_twopass_stats_in.sz / sizeof(double); 192 int n_doubles = cfg->rc_twopass_stats_in.sz / sizeof(double);
188 int n_packets = cfg->rc_twopass_stats_in.sz / sizeof(FIRSTPASS_STATS); 193 int n_packets = cfg->rc_twopass_stats_in.sz / sizeof(FIRSTPASS_STATS);
189 double frames; 194 double frames;
190 195
191 if (!cfg->rc_twopass_stats_in.buf) 196 if (!cfg->rc_twopass_stats_in.buf)
192 ERROR("rc_twopass_stats_in.buf not set."); 197 ERROR("rc_twopass_stats_in.buf not set.");
193 198
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 {NOT_IMPLEMENTED}, /* decoder functions */ 1182 {NOT_IMPLEMENTED}, /* decoder functions */
1178 { 1183 {
1179 vp8e_usage_cfg_map, /* vpx_codec_enc_cfg_map_t peek_si; */ 1184 vp8e_usage_cfg_map, /* vpx_codec_enc_cfg_map_t peek_si; */
1180 api1_encode, /* vpx_codec_encode_fn_t encode; */ 1185 api1_encode, /* vpx_codec_encode_fn_t encode; */
1181 vp8e_get_cxdata, /* vpx_codec_get_cx_data_fn_t frame_get; */ 1186 vp8e_get_cxdata, /* vpx_codec_get_cx_data_fn_t frame_get; */
1182 vp8e_set_config, 1187 vp8e_set_config,
1183 NOT_IMPLEMENTED, 1188 NOT_IMPLEMENTED,
1184 vp8e_get_preview, 1189 vp8e_get_preview,
1185 } /* encoder functions */ 1190 } /* encoder functions */
1186 }; 1191 };
OLDNEW
« no previous file with comments | « source/libvpx/vp8/vp8_common.mk ('k') | source/libvpx/vp8/vp8_dx_iface.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698