2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
12 #include "vpx/vpx_codec.h"
13 #include "vpx/internal/vpx_codec_internal.h"
14 #include "vpx_version.h"
15 #include "vp8/encoder/onyx_int.h"
17 #include "vp8/encoder/firstpass.h"
18 #include "vp8/common/onyx.h"
22 /* This value is a sentinel for determining whether the user has set a mode
23 * directly through the deprecated VP8E_SET_ENCODING_MODE control.
25 #define NO_MODE_SET 255
29 struct vpx_codec_pkt_list *pkt_list;
30 vp8e_encoding_mode encoding_mode; /** best, good, realtime */
31 int cpu_used; /** available cpu percentage in 1/16*/
32 unsigned int enable_auto_alt_ref; /** if encoder decides to uses alternate reference frame */
33 unsigned int noise_sensitivity;
34 unsigned int Sharpness;
35 unsigned int static_thresh;
36 unsigned int token_partitions;
37 unsigned int arnr_max_frames; /* alt_ref Noise Reduction Max Frame Count */
38 unsigned int arnr_strength; /* alt_ref Noise Reduction Strength */
39 unsigned int arnr_type; /* alt_ref filter type */
41 unsigned int cq_level; /* constrained quality level */
42 unsigned int rc_max_intra_bitrate_pct;
46 struct extraconfig_map
49 struct vp8_extracfg cfg;
52 static const struct extraconfig_map extracfg_map[] =
58 #if !(CONFIG_REALTIME_ONLY)
59 VP8_BEST_QUALITY_ENCODING, /* Encoding Mode */
62 VP8_REAL_TIME_ENCODING, /* Encoding Mode */
65 0, /* enable_auto_alt_ref */
66 0, /* noise_sensitivity */
68 0, /* static_thresh */
69 VP8_ONE_TOKENPARTITION, /* token_partitions */
70 0, /* arnr_max_frames */
71 3, /* arnr_strength */
75 0, /* rc_max_intra_bitrate_pct */
80 struct vpx_codec_alg_priv
82 vpx_codec_priv_t base;
83 vpx_codec_enc_cfg_t cfg;
84 struct vp8_extracfg vp8_cfg;
87 unsigned char *cx_data;
88 unsigned int cx_data_sz;
89 vpx_image_t preview_img;
90 unsigned int next_frame_flag;
91 vp8_postproc_cfg_t preview_ppcfg;
92 vpx_codec_pkt_list_decl(64) pkt_list; // changed to accomendate the maximum number of lagged frames allowed
94 unsigned int fixed_kf_cntr;
98 static vpx_codec_err_t
99 update_error_state(vpx_codec_alg_priv_t *ctx,
100 const struct vpx_internal_error_info *error)
104 if ((res = error->error_code))
105 ctx->base.err_detail = error->has_detail
114 #define ERROR(str) do {\
115 ctx->base.err_detail = str;\
116 return VPX_CODEC_INVALID_PARAM;\
119 #define RANGE_CHECK(p,memb,lo,hi) do {\
120 if(!(((p)->memb == lo || (p)->memb > (lo)) && (p)->memb <= hi)) \
121 ERROR(#memb " out of range ["#lo".."#hi"]");\
124 #define RANGE_CHECK_HI(p,memb,hi) do {\
125 if(!((p)->memb <= (hi))) \
126 ERROR(#memb " out of range [.."#hi"]");\
129 #define RANGE_CHECK_LO(p,memb,lo) do {\
130 if(!((p)->memb >= (lo))) \
131 ERROR(#memb " out of range ["#lo"..]");\
134 #define RANGE_CHECK_BOOL(p,memb) do {\
135 if(!!((p)->memb) != (p)->memb) ERROR(#memb " expected boolean");\
138 static vpx_codec_err_t validate_config(vpx_codec_alg_priv_t *ctx,
139 const vpx_codec_enc_cfg_t *cfg,
140 const struct vp8_extracfg *vp8_cfg,
143 RANGE_CHECK(cfg, g_w, 1, 16383); /* 14 bits available */
144 RANGE_CHECK(cfg, g_h, 1, 16383); /* 14 bits available */
145 RANGE_CHECK(cfg, g_timebase.den, 1, 1000000000);
146 RANGE_CHECK(cfg, g_timebase.num, 1, cfg->g_timebase.den);
147 RANGE_CHECK_HI(cfg, g_profile, 3);
148 RANGE_CHECK_HI(cfg, rc_max_quantizer, 63);
149 RANGE_CHECK_HI(cfg, rc_min_quantizer, cfg->rc_max_quantizer);
150 RANGE_CHECK_HI(cfg, g_threads, 64);
151 #if !(CONFIG_REALTIME_ONLY)
152 RANGE_CHECK_HI(cfg, g_lag_in_frames, 25);
154 RANGE_CHECK_HI(cfg, g_lag_in_frames, 0);
156 RANGE_CHECK(cfg, rc_end_usage, VPX_VBR, VPX_CQ);
157 RANGE_CHECK_HI(cfg, rc_undershoot_pct, 1000);
158 RANGE_CHECK_HI(cfg, rc_overshoot_pct, 1000);
159 RANGE_CHECK_HI(cfg, rc_2pass_vbr_bias_pct, 100);
160 RANGE_CHECK(cfg, kf_mode, VPX_KF_DISABLED, VPX_KF_AUTO);
161 //RANGE_CHECK_BOOL(cfg, g_delete_firstpassfile);
162 RANGE_CHECK_BOOL(cfg, rc_resize_allowed);
163 RANGE_CHECK_HI(cfg, rc_dropframe_thresh, 100);
164 RANGE_CHECK_HI(cfg, rc_resize_up_thresh, 100);
165 RANGE_CHECK_HI(cfg, rc_resize_down_thresh, 100);
166 #if !(CONFIG_REALTIME_ONLY)
167 RANGE_CHECK(cfg, g_pass, VPX_RC_ONE_PASS, VPX_RC_LAST_PASS);
169 RANGE_CHECK(cfg, g_pass, VPX_RC_ONE_PASS, VPX_RC_ONE_PASS);
172 /* VP8 does not support a lower bound on the keyframe interval in
173 * automatic keyframe placement mode.
175 if (cfg->kf_mode != VPX_KF_DISABLED && cfg->kf_min_dist != cfg->kf_max_dist
176 && cfg->kf_min_dist > 0)
177 ERROR("kf_min_dist not supported in auto mode, use 0 "
178 "or kf_max_dist instead.");
180 RANGE_CHECK_BOOL(vp8_cfg, enable_auto_alt_ref);
181 RANGE_CHECK(vp8_cfg, cpu_used, -16, 16);
183 #if !(CONFIG_REALTIME_ONLY)
184 RANGE_CHECK(vp8_cfg, encoding_mode, VP8_BEST_QUALITY_ENCODING, VP8_REAL_TIME_ENCODING);
185 RANGE_CHECK_HI(vp8_cfg, noise_sensitivity, 6);
187 RANGE_CHECK(vp8_cfg, encoding_mode, VP8_REAL_TIME_ENCODING, VP8_REAL_TIME_ENCODING);
188 RANGE_CHECK(vp8_cfg, noise_sensitivity, 0, 0);
191 RANGE_CHECK(vp8_cfg, token_partitions, VP8_ONE_TOKENPARTITION, VP8_EIGHT_TOKENPARTITION);
192 RANGE_CHECK_HI(vp8_cfg, Sharpness, 7);
193 RANGE_CHECK(vp8_cfg, arnr_max_frames, 0, 15);
194 RANGE_CHECK_HI(vp8_cfg, arnr_strength, 6);
195 RANGE_CHECK(vp8_cfg, arnr_type, 1, 3);
196 RANGE_CHECK(vp8_cfg, cq_level, 0, 63);
197 if(finalize && cfg->rc_end_usage == VPX_CQ)
198 RANGE_CHECK(vp8_cfg, cq_level,
199 cfg->rc_min_quantizer, cfg->rc_max_quantizer);
201 #if !(CONFIG_REALTIME_ONLY)
202 if (cfg->g_pass == VPX_RC_LAST_PASS)
204 size_t packet_sz = sizeof(FIRSTPASS_STATS);
205 int n_packets = cfg->rc_twopass_stats_in.sz / packet_sz;
206 FIRSTPASS_STATS *stats;
208 if (!cfg->rc_twopass_stats_in.buf)
209 ERROR("rc_twopass_stats_in.buf not set.");
211 if (cfg->rc_twopass_stats_in.sz % packet_sz)
212 ERROR("rc_twopass_stats_in.sz indicates truncated packet.");
214 if (cfg->rc_twopass_stats_in.sz < 2 * packet_sz)
215 ERROR("rc_twopass_stats_in requires at least two packets.");
217 stats = (void*)((char *)cfg->rc_twopass_stats_in.buf
218 + (n_packets - 1) * packet_sz);
220 if ((int)(stats->count + 0.5) != n_packets - 1)
221 ERROR("rc_twopass_stats_in missing EOS stats packet");
225 RANGE_CHECK(cfg, ts_number_layers, 1, 5);
227 if (cfg->ts_number_layers > 1)
230 RANGE_CHECK_HI(cfg, ts_periodicity, 16);
232 for (i=1; i<cfg->ts_number_layers; i++)
233 if (cfg->ts_target_bitrate[i] <= cfg->ts_target_bitrate[i-1])
234 ERROR("ts_target_bitrate entries are not strictly increasing");
236 RANGE_CHECK(cfg, ts_rate_decimator[cfg->ts_number_layers-1], 1, 1);
237 for (i=cfg->ts_number_layers-2; i>0; i--)
238 if (cfg->ts_rate_decimator[i-1] != 2*cfg->ts_rate_decimator[i])
239 ERROR("ts_rate_decimator factors are not powers of 2");
241 RANGE_CHECK_HI(cfg, ts_layer_id[i], cfg->ts_number_layers-1);
248 static vpx_codec_err_t validate_img(vpx_codec_alg_priv_t *ctx,
249 const vpx_image_t *img)
253 case VPX_IMG_FMT_YV12:
254 case VPX_IMG_FMT_I420:
255 case VPX_IMG_FMT_VPXI420:
256 case VPX_IMG_FMT_VPXYV12:
259 ERROR("Invalid image format. Only YV12 and I420 images are supported");
262 if ((img->d_w != ctx->cfg.g_w) || (img->d_h != ctx->cfg.g_h))
263 ERROR("Image size must match encoder init configuration size");
269 static vpx_codec_err_t set_vp8e_config(VP8_CONFIG *oxcf,
270 vpx_codec_enc_cfg_t cfg,
271 struct vp8_extracfg vp8_cfg,
272 vpx_codec_priv_enc_mr_cfg_t *mr_cfg)
274 oxcf->multi_threaded = cfg.g_threads;
275 oxcf->Version = cfg.g_profile;
277 oxcf->Width = cfg.g_w;
278 oxcf->Height = cfg.g_h;
279 oxcf->timebase = cfg.g_timebase;
281 oxcf->error_resilient_mode = cfg.g_error_resilient;
285 case VPX_RC_ONE_PASS:
286 oxcf->Mode = MODE_BESTQUALITY;
288 case VPX_RC_FIRST_PASS:
289 oxcf->Mode = MODE_FIRSTPASS;
291 case VPX_RC_LAST_PASS:
292 oxcf->Mode = MODE_SECONDPASS_BEST;
296 if (cfg.g_pass == VPX_RC_FIRST_PASS)
299 oxcf->lag_in_frames = 0;
303 oxcf->allow_lag = (cfg.g_lag_in_frames) > 0;
304 oxcf->lag_in_frames = cfg.g_lag_in_frames;
307 oxcf->allow_df = (cfg.rc_dropframe_thresh > 0);
308 oxcf->drop_frames_water_mark = cfg.rc_dropframe_thresh;
310 oxcf->allow_spatial_resampling = cfg.rc_resize_allowed;
311 oxcf->resample_up_water_mark = cfg.rc_resize_up_thresh;
312 oxcf->resample_down_water_mark = cfg.rc_resize_down_thresh;
314 if (cfg.rc_end_usage == VPX_VBR)
316 oxcf->end_usage = USAGE_LOCAL_FILE_PLAYBACK;
318 else if (cfg.rc_end_usage == VPX_CBR)
320 oxcf->end_usage = USAGE_STREAM_FROM_SERVER;
322 else if (cfg.rc_end_usage == VPX_CQ)
324 oxcf->end_usage = USAGE_CONSTRAINED_QUALITY;
327 oxcf->target_bandwidth = cfg.rc_target_bitrate;
328 oxcf->rc_max_intra_bitrate_pct = vp8_cfg.rc_max_intra_bitrate_pct;
330 oxcf->best_allowed_q = cfg.rc_min_quantizer;
331 oxcf->worst_allowed_q = cfg.rc_max_quantizer;
332 oxcf->cq_level = vp8_cfg.cq_level;
335 oxcf->under_shoot_pct = cfg.rc_undershoot_pct;
336 oxcf->over_shoot_pct = cfg.rc_overshoot_pct;
338 oxcf->maximum_buffer_size_in_ms = cfg.rc_buf_sz;
339 oxcf->starting_buffer_level_in_ms = cfg.rc_buf_initial_sz;
340 oxcf->optimal_buffer_level_in_ms = cfg.rc_buf_optimal_sz;
342 oxcf->maximum_buffer_size = cfg.rc_buf_sz;
343 oxcf->starting_buffer_level = cfg.rc_buf_initial_sz;
344 oxcf->optimal_buffer_level = cfg.rc_buf_optimal_sz;
346 oxcf->two_pass_vbrbias = cfg.rc_2pass_vbr_bias_pct;
347 oxcf->two_pass_vbrmin_section = cfg.rc_2pass_vbr_minsection_pct;
348 oxcf->two_pass_vbrmax_section = cfg.rc_2pass_vbr_maxsection_pct;
350 oxcf->auto_key = cfg.kf_mode == VPX_KF_AUTO
351 && cfg.kf_min_dist != cfg.kf_max_dist;
352 //oxcf->kf_min_dist = cfg.kf_min_dis;
353 oxcf->key_freq = cfg.kf_max_dist;
355 oxcf->number_of_layers = cfg.ts_number_layers;
356 oxcf->periodicity = cfg.ts_periodicity;
358 if (oxcf->number_of_layers > 1)
360 memcpy (oxcf->target_bitrate, cfg.ts_target_bitrate,
361 sizeof(cfg.ts_target_bitrate));
362 memcpy (oxcf->rate_decimator, cfg.ts_rate_decimator,
363 sizeof(cfg.ts_rate_decimator));
364 memcpy (oxcf->layer_id, cfg.ts_layer_id, sizeof(cfg.ts_layer_id));
367 #if CONFIG_MULTI_RES_ENCODING
368 /* When mr_cfg is NULL, oxcf->mr_total_resolutions and oxcf->mr_encoder_id
369 * are both memset to 0, which ensures the correct logic under this
374 oxcf->mr_total_resolutions = mr_cfg->mr_total_resolutions;
375 oxcf->mr_encoder_id = mr_cfg->mr_encoder_id;
376 oxcf->mr_down_sampling_factor.num = mr_cfg->mr_down_sampling_factor.num;
377 oxcf->mr_down_sampling_factor.den = mr_cfg->mr_down_sampling_factor.den;
378 oxcf->mr_low_res_mode_info = mr_cfg->mr_low_res_mode_info;
382 //oxcf->delete_first_pass_file = cfg.g_delete_firstpassfile;
383 //strcpy(oxcf->first_pass_file, cfg.g_firstpass_file);
385 oxcf->cpu_used = vp8_cfg.cpu_used;
386 oxcf->encode_breakout = vp8_cfg.static_thresh;
387 oxcf->play_alternate = vp8_cfg.enable_auto_alt_ref;
388 oxcf->noise_sensitivity = vp8_cfg.noise_sensitivity;
389 oxcf->Sharpness = vp8_cfg.Sharpness;
390 oxcf->token_partitions = vp8_cfg.token_partitions;
392 oxcf->two_pass_stats_in = cfg.rc_twopass_stats_in;
393 oxcf->output_pkt_list = vp8_cfg.pkt_list;
395 oxcf->arnr_max_frames = vp8_cfg.arnr_max_frames;
396 oxcf->arnr_strength = vp8_cfg.arnr_strength;
397 oxcf->arnr_type = vp8_cfg.arnr_type;
399 oxcf->tuning = vp8_cfg.tuning;
402 printf("Current VP8 Settings: \n");
403 printf("target_bandwidth: %d\n", oxcf->target_bandwidth);
404 printf("noise_sensitivity: %d\n", oxcf->noise_sensitivity);
405 printf("Sharpness: %d\n", oxcf->Sharpness);
406 printf("cpu_used: %d\n", oxcf->cpu_used);
407 printf("Mode: %d\n", oxcf->Mode);
408 printf("delete_first_pass_file: %d\n", oxcf->delete_first_pass_file);
409 printf("auto_key: %d\n", oxcf->auto_key);
410 printf("key_freq: %d\n", oxcf->key_freq);
411 printf("end_usage: %d\n", oxcf->end_usage);
412 printf("under_shoot_pct: %d\n", oxcf->under_shoot_pct);
413 printf("over_shoot_pct: %d\n", oxcf->over_shoot_pct);
414 printf("starting_buffer_level: %d\n", oxcf->starting_buffer_level);
415 printf("optimal_buffer_level: %d\n", oxcf->optimal_buffer_level);
416 printf("maximum_buffer_size: %d\n", oxcf->maximum_buffer_size);
417 printf("fixed_q: %d\n", oxcf->fixed_q);
418 printf("worst_allowed_q: %d\n", oxcf->worst_allowed_q);
419 printf("best_allowed_q: %d\n", oxcf->best_allowed_q);
420 printf("allow_spatial_resampling: %d\n", oxcf->allow_spatial_resampling);
421 printf("resample_down_water_mark: %d\n", oxcf->resample_down_water_mark);
422 printf("resample_up_water_mark: %d\n", oxcf->resample_up_water_mark);
423 printf("allow_df: %d\n", oxcf->allow_df);
424 printf("drop_frames_water_mark: %d\n", oxcf->drop_frames_water_mark);
425 printf("two_pass_vbrbias: %d\n", oxcf->two_pass_vbrbias);
426 printf("two_pass_vbrmin_section: %d\n", oxcf->two_pass_vbrmin_section);
427 printf("two_pass_vbrmax_section: %d\n", oxcf->two_pass_vbrmax_section);
428 printf("allow_lag: %d\n", oxcf->allow_lag);
429 printf("lag_in_frames: %d\n", oxcf->lag_in_frames);
430 printf("play_alternate: %d\n", oxcf->play_alternate);
431 printf("Version: %d\n", oxcf->Version);
432 printf("multi_threaded: %d\n", oxcf->multi_threaded);
433 printf("encode_breakout: %d\n", oxcf->encode_breakout);
438 static vpx_codec_err_t vp8e_set_config(vpx_codec_alg_priv_t *ctx,
439 const vpx_codec_enc_cfg_t *cfg)
443 if ((cfg->g_w != ctx->cfg.g_w) || (cfg->g_h != ctx->cfg.g_h))
444 ERROR("Cannot change width or height after initialization");
446 /* Prevent increasing lag_in_frames. This check is stricter than it needs
447 * to be -- the limit is not increasing past the first lag_in_frames
448 * value, but we don't track the initial config, only the last successful
451 if ((cfg->g_lag_in_frames > ctx->cfg.g_lag_in_frames))
452 ERROR("Cannot increase lag_in_frames");
454 res = validate_config(ctx, cfg, &ctx->vp8_cfg, 0);
459 set_vp8e_config(&ctx->oxcf, ctx->cfg, ctx->vp8_cfg, NULL);
460 vp8_change_config(ctx->cpi, &ctx->oxcf);
467 int vp8_reverse_trans(int);
470 static vpx_codec_err_t get_param(vpx_codec_alg_priv_t *ctx,
474 void *arg = va_arg(args, void *);
476 #define MAP(id, var) case id: *(RECAST(id, arg)) = var; break
479 return VPX_CODEC_INVALID_PARAM;
483 MAP(VP8E_GET_LAST_QUANTIZER, vp8_get_quantizer(ctx->cpi));
484 MAP(VP8E_GET_LAST_QUANTIZER_64, vp8_reverse_trans(vp8_get_quantizer(ctx->cpi)));
492 static vpx_codec_err_t set_param(vpx_codec_alg_priv_t *ctx,
496 vpx_codec_err_t res = VPX_CODEC_OK;
497 struct vp8_extracfg xcfg = ctx->vp8_cfg;
499 #define MAP(id, var) case id: var = CAST(id, args); break;
503 MAP(VP8E_SET_ENCODING_MODE, ctx->deprecated_mode);
504 MAP(VP8E_SET_CPUUSED, xcfg.cpu_used);
505 MAP(VP8E_SET_ENABLEAUTOALTREF, xcfg.enable_auto_alt_ref);
506 MAP(VP8E_SET_NOISE_SENSITIVITY, xcfg.noise_sensitivity);
507 MAP(VP8E_SET_SHARPNESS, xcfg.Sharpness);
508 MAP(VP8E_SET_STATIC_THRESHOLD, xcfg.static_thresh);
509 MAP(VP8E_SET_TOKEN_PARTITIONS, xcfg.token_partitions);
511 MAP(VP8E_SET_ARNR_MAXFRAMES, xcfg.arnr_max_frames);
512 MAP(VP8E_SET_ARNR_STRENGTH , xcfg.arnr_strength);
513 MAP(VP8E_SET_ARNR_TYPE , xcfg.arnr_type);
514 MAP(VP8E_SET_TUNING, xcfg.tuning);
515 MAP(VP8E_SET_CQ_LEVEL, xcfg.cq_level);
516 MAP(VP8E_SET_MAX_INTRA_BITRATE_PCT, xcfg.rc_max_intra_bitrate_pct);
520 res = validate_config(ctx, &ctx->cfg, &xcfg, 0);
525 set_vp8e_config(&ctx->oxcf, ctx->cfg, ctx->vp8_cfg, NULL);
526 vp8_change_config(ctx->cpi, &ctx->oxcf);
533 static vpx_codec_err_t vp8e_mr_alloc_mem(const vpx_codec_enc_cfg_t *cfg,
536 vpx_codec_err_t res = 0;
538 #if CONFIG_MULTI_RES_ENCODING
539 int mb_rows = ((cfg->g_w + 15) >>4);
540 int mb_cols = ((cfg->g_h + 15) >>4);
542 *mem_loc = calloc(mb_rows*mb_cols, sizeof(LOWER_RES_INFO));
546 res = VPX_CODEC_MEM_ERROR;
555 static vpx_codec_err_t vp8e_init(vpx_codec_ctx_t *ctx,
556 vpx_codec_priv_enc_mr_cfg_t *mr_cfg)
558 vpx_codec_err_t res = VPX_DEC_OK;
559 struct vpx_codec_alg_priv *priv;
560 vpx_codec_enc_cfg_t *cfg;
563 struct VP8_COMP *optr;
567 priv = calloc(1, sizeof(struct vpx_codec_alg_priv));
571 return VPX_CODEC_MEM_ERROR;
574 ctx->priv = &priv->base;
575 ctx->priv->sz = sizeof(*ctx->priv);
576 ctx->priv->iface = ctx->iface;
577 ctx->priv->alg_priv = priv;
578 ctx->priv->init_flags = ctx->init_flags;
582 /* Update the reference to the config structure to an
585 ctx->priv->alg_priv->cfg = *ctx->config.enc;
586 ctx->config.enc = &ctx->priv->alg_priv->cfg;
589 cfg = &ctx->priv->alg_priv->cfg;
591 /* Select the extra vp8 configuration table based on the current
592 * usage value. If the current usage value isn't found, use the
593 * values for usage case 0.
596 extracfg_map[i].usage && extracfg_map[i].usage != cfg->g_usage;
599 priv->vp8_cfg = extracfg_map[i].cfg;
600 priv->vp8_cfg.pkt_list = &priv->pkt_list.head;
602 priv->cx_data_sz = priv->cfg.g_w * priv->cfg.g_h * 3 / 2 * 2;
604 if (priv->cx_data_sz < 32768) priv->cx_data_sz = 32768;
606 priv->cx_data = malloc(priv->cx_data_sz);
610 return VPX_CODEC_MEM_ERROR;
613 priv->deprecated_mode = NO_MODE_SET;
617 res = validate_config(priv, &priv->cfg, &priv->vp8_cfg, 0);
622 ctx->priv->enc.total_encoders = mr_cfg->mr_total_resolutions;
624 ctx->priv->enc.total_encoders = 1;
626 set_vp8e_config(&ctx->priv->alg_priv->oxcf,
627 ctx->priv->alg_priv->cfg,
628 ctx->priv->alg_priv->vp8_cfg,
631 optr = vp8_create_compressor(&ctx->priv->alg_priv->oxcf);
634 res = VPX_CODEC_MEM_ERROR;
636 ctx->priv->alg_priv->cpi = optr;
643 static vpx_codec_err_t vp8e_destroy(vpx_codec_alg_priv_t *ctx)
645 #if CONFIG_MULTI_RES_ENCODING
646 /* Free multi-encoder shared memory */
647 if (ctx->oxcf.mr_total_resolutions > 0 && (ctx->oxcf.mr_encoder_id == ctx->oxcf.mr_total_resolutions-1))
648 free(ctx->oxcf.mr_low_res_mode_info);
652 vp8_remove_compressor(&ctx->cpi);
657 static vpx_codec_err_t image2yuvconfig(const vpx_image_t *img,
658 YV12_BUFFER_CONFIG *yv12)
660 vpx_codec_err_t res = VPX_CODEC_OK;
661 yv12->y_buffer = img->planes[VPX_PLANE_Y];
662 yv12->u_buffer = img->planes[VPX_PLANE_U];
663 yv12->v_buffer = img->planes[VPX_PLANE_V];
665 yv12->y_width = img->d_w;
666 yv12->y_height = img->d_h;
667 yv12->uv_width = (1 + yv12->y_width) / 2;
668 yv12->uv_height = (1 + yv12->y_height) / 2;
670 yv12->y_stride = img->stride[VPX_PLANE_Y];
671 yv12->uv_stride = img->stride[VPX_PLANE_U];
673 yv12->border = (img->stride[VPX_PLANE_Y] - img->w) / 2;
674 yv12->clrtype = (img->fmt == VPX_IMG_FMT_VPXI420 || img->fmt == VPX_IMG_FMT_VPXYV12); //REG_YUV = 0
678 static void pick_quickcompress_mode(vpx_codec_alg_priv_t *ctx,
679 unsigned long duration,
680 unsigned long deadline)
684 #if !(CONFIG_REALTIME_ONLY)
685 /* Use best quality mode if no deadline is given. */
686 new_qc = MODE_BESTQUALITY;
690 uint64_t duration_us;
692 /* Convert duration parameter from stream timebase to microseconds */
693 duration_us = (uint64_t)duration * 1000000
694 * (uint64_t)ctx->cfg.g_timebase.num
695 / (uint64_t)ctx->cfg.g_timebase.den;
697 /* If the deadline is more that the duration this frame is to be shown,
698 * use good quality mode. Otherwise use realtime mode.
700 new_qc = (deadline > duration_us) ? MODE_GOODQUALITY : MODE_REALTIME;
704 new_qc = MODE_REALTIME;
707 switch (ctx->deprecated_mode)
709 case VP8_BEST_QUALITY_ENCODING:
710 new_qc = MODE_BESTQUALITY;
712 case VP8_GOOD_QUALITY_ENCODING:
713 new_qc = MODE_GOODQUALITY;
715 case VP8_REAL_TIME_ENCODING:
716 new_qc = MODE_REALTIME;
720 if (ctx->cfg.g_pass == VPX_RC_FIRST_PASS)
721 new_qc = MODE_FIRSTPASS;
722 else if (ctx->cfg.g_pass == VPX_RC_LAST_PASS)
723 new_qc = (new_qc == MODE_BESTQUALITY)
724 ? MODE_SECONDPASS_BEST
727 if (ctx->oxcf.Mode != new_qc)
729 ctx->oxcf.Mode = new_qc;
730 vp8_change_config(ctx->cpi, &ctx->oxcf);
735 static vpx_codec_err_t vp8e_encode(vpx_codec_alg_priv_t *ctx,
736 const vpx_image_t *img,
738 unsigned long duration,
739 vpx_enc_frame_flags_t flags,
740 unsigned long deadline)
742 vpx_codec_err_t res = VPX_CODEC_OK;
745 res = validate_img(ctx, img);
748 res = validate_config(ctx, &ctx->cfg, &ctx->vp8_cfg, 1);
750 pick_quickcompress_mode(ctx, duration, deadline);
751 vpx_codec_pkt_list_init(&ctx->pkt_list);
754 if (((flags & VP8_EFLAG_NO_UPD_GF) && (flags & VP8_EFLAG_FORCE_GF))
755 || ((flags & VP8_EFLAG_NO_UPD_ARF) && (flags & VP8_EFLAG_FORCE_ARF)))
757 ctx->base.err_detail = "Conflicting flags.";
758 return VPX_CODEC_INVALID_PARAM;
761 if (flags & (VP8_EFLAG_NO_REF_LAST | VP8_EFLAG_NO_REF_GF
762 | VP8_EFLAG_NO_REF_ARF))
766 if (flags & VP8_EFLAG_NO_REF_LAST)
767 ref ^= VP8_LAST_FLAG;
769 if (flags & VP8_EFLAG_NO_REF_GF)
770 ref ^= VP8_GOLD_FLAG;
772 if (flags & VP8_EFLAG_NO_REF_ARF)
775 vp8_use_as_reference(ctx->cpi, ref);
778 if (flags & (VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF
779 | VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_FORCE_GF
780 | VP8_EFLAG_FORCE_ARF))
784 if (flags & VP8_EFLAG_NO_UPD_LAST)
785 upd ^= VP8_LAST_FLAG;
787 if (flags & VP8_EFLAG_NO_UPD_GF)
788 upd ^= VP8_GOLD_FLAG;
790 if (flags & VP8_EFLAG_NO_UPD_ARF)
793 vp8_update_reference(ctx->cpi, upd);
796 if (flags & VP8_EFLAG_NO_UPD_ENTROPY)
798 vp8_update_entropy(ctx->cpi, 0);
801 /* Handle fixed keyframe intervals */
802 if (ctx->cfg.kf_mode == VPX_KF_AUTO
803 && ctx->cfg.kf_min_dist == ctx->cfg.kf_max_dist)
805 if (++ctx->fixed_kf_cntr > ctx->cfg.kf_min_dist)
807 flags |= VPX_EFLAG_FORCE_KF;
808 ctx->fixed_kf_cntr = 1;
812 /* Initialize the encoder instance on the first frame*/
813 if (!res && ctx->cpi)
815 unsigned int lib_flags;
816 YV12_BUFFER_CONFIG sd;
817 int64_t dst_time_stamp, dst_end_time_stamp;
818 unsigned long size, cx_data_sz;
819 unsigned char *cx_data;
820 unsigned char *cx_data_end;
821 int comp_data_state = 0;
823 /* Set up internal flags */
824 if (ctx->base.init_flags & VPX_CODEC_USE_PSNR)
825 ((VP8_COMP *)ctx->cpi)->b_calculate_psnr = 1;
827 if (ctx->base.init_flags & VPX_CODEC_USE_OUTPUT_PARTITION)
828 ((VP8_COMP *)ctx->cpi)->output_partition = 1;
830 /* Convert API flags to internal codec lib flags */
831 lib_flags = (flags & VPX_EFLAG_FORCE_KF) ? FRAMEFLAGS_KEY : 0;
833 /* vp8 use 10,000,000 ticks/second as time stamp */
834 dst_time_stamp = pts * 10000000 * ctx->cfg.g_timebase.num / ctx->cfg.g_timebase.den;
835 dst_end_time_stamp = (pts + duration) * 10000000 * ctx->cfg.g_timebase.num / ctx->cfg.g_timebase.den;
839 res = image2yuvconfig(img, &sd);
841 if (vp8_receive_raw_frame(ctx->cpi, ctx->next_frame_flag | lib_flags,
842 &sd, dst_time_stamp, dst_end_time_stamp))
844 VP8_COMP *cpi = (VP8_COMP *)ctx->cpi;
845 res = update_error_state(ctx, &cpi->common.error);
848 /* reset for next frame */
849 ctx->next_frame_flag = 0;
852 cx_data = ctx->cx_data;
853 cx_data_sz = ctx->cx_data_sz;
854 cx_data_end = ctx->cx_data + cx_data_sz;
857 while (cx_data_sz >= ctx->cx_data_sz / 2)
859 comp_data_state = vp8_get_compressed_data(ctx->cpi,
868 if(comp_data_state == VPX_CODEC_CORRUPT_FRAME)
869 return VPX_CODEC_CORRUPT_FRAME;
870 else if(comp_data_state == -1)
875 vpx_codec_pts_t round, delta;
876 vpx_codec_cx_pkt_t pkt;
877 VP8_COMP *cpi = (VP8_COMP *)ctx->cpi;
879 /* Add the frame packet to the list of returned packets. */
880 round = 1000000 * ctx->cfg.g_timebase.num / 2 - 1;
881 delta = (dst_end_time_stamp - dst_time_stamp);
882 pkt.kind = VPX_CODEC_CX_FRAME_PKT;
884 (dst_time_stamp * ctx->cfg.g_timebase.den + round)
885 / ctx->cfg.g_timebase.num / 10000000;
886 pkt.data.frame.duration =
887 (delta * ctx->cfg.g_timebase.den + round)
888 / ctx->cfg.g_timebase.num / 10000000;
889 pkt.data.frame.flags = lib_flags << 16;
891 if (lib_flags & FRAMEFLAGS_KEY)
892 pkt.data.frame.flags |= VPX_FRAME_IS_KEY;
894 if (!cpi->common.show_frame)
896 pkt.data.frame.flags |= VPX_FRAME_IS_INVISIBLE;
898 // This timestamp should be as close as possible to the
899 // prior PTS so that if a decoder uses pts to schedule when
900 // to do this, we start right after last frame was decoded.
901 // Invisible frames have no duration.
902 pkt.data.frame.pts = ((cpi->last_time_stamp_seen
903 * ctx->cfg.g_timebase.den + round)
904 / ctx->cfg.g_timebase.num / 10000000) + 1;
905 pkt.data.frame.duration = 0;
909 pkt.data.frame.flags |= VPX_FRAME_IS_DROPPABLE;
911 if (cpi->output_partition)
914 const int num_partitions =
915 (1 << cpi->common.multi_token_partition) + 1;
917 pkt.data.frame.flags |= VPX_FRAME_IS_FRAGMENT;
919 for (i = 0; i < num_partitions; ++i)
921 pkt.data.frame.buf = cx_data;
922 pkt.data.frame.sz = cpi->partition_sz[i];
923 pkt.data.frame.partition_id = i;
924 /* don't set the fragment bit for the last partition */
925 if (i == (num_partitions - 1))
926 pkt.data.frame.flags &= ~VPX_FRAME_IS_FRAGMENT;
927 vpx_codec_pkt_list_add(&ctx->pkt_list.head, &pkt);
928 cx_data += cpi->partition_sz[i];
929 cx_data_sz -= cpi->partition_sz[i];
934 pkt.data.frame.buf = cx_data;
935 pkt.data.frame.sz = size;
936 pkt.data.frame.partition_id = -1;
937 vpx_codec_pkt_list_add(&ctx->pkt_list.head, &pkt);
942 //printf("timestamp: %lld, duration: %d\n", pkt->data.frame.pts, pkt->data.frame.duration);
951 static const vpx_codec_cx_pkt_t *vp8e_get_cxdata(vpx_codec_alg_priv_t *ctx,
952 vpx_codec_iter_t *iter)
954 return vpx_codec_pkt_list_get(&ctx->pkt_list.head, iter);
957 static vpx_codec_err_t vp8e_set_reference(vpx_codec_alg_priv_t *ctx,
961 vpx_ref_frame_t *data = va_arg(args, vpx_ref_frame_t *);
965 vpx_ref_frame_t *frame = (vpx_ref_frame_t *)data;
966 YV12_BUFFER_CONFIG sd;
968 image2yuvconfig(&frame->img, &sd);
969 vp8_set_reference(ctx->cpi, frame->frame_type, &sd);
973 return VPX_CODEC_INVALID_PARAM;
977 static vpx_codec_err_t vp8e_get_reference(vpx_codec_alg_priv_t *ctx,
982 vpx_ref_frame_t *data = va_arg(args, vpx_ref_frame_t *);
986 vpx_ref_frame_t *frame = (vpx_ref_frame_t *)data;
987 YV12_BUFFER_CONFIG sd;
989 image2yuvconfig(&frame->img, &sd);
990 vp8_get_reference(ctx->cpi, frame->frame_type, &sd);
994 return VPX_CODEC_INVALID_PARAM;
997 static vpx_codec_err_t vp8e_set_previewpp(vpx_codec_alg_priv_t *ctx,
1002 vp8_postproc_cfg_t *data = va_arg(args, vp8_postproc_cfg_t *);
1007 ctx->preview_ppcfg = *((vp8_postproc_cfg_t *)data);
1008 return VPX_CODEC_OK;
1011 return VPX_CODEC_INVALID_PARAM;
1016 return VPX_CODEC_INCAPABLE;
1021 static vpx_image_t *vp8e_get_preview(vpx_codec_alg_priv_t *ctx)
1024 YV12_BUFFER_CONFIG sd;
1025 vp8_ppflags_t flags = {0};
1027 if (ctx->preview_ppcfg.post_proc_flag)
1029 flags.post_proc_flag = ctx->preview_ppcfg.post_proc_flag;
1030 flags.deblocking_level = ctx->preview_ppcfg.deblocking_level;
1031 flags.noise_level = ctx->preview_ppcfg.noise_level;
1034 if (0 == vp8_get_preview_raw_frame(ctx->cpi, &sd, &flags))
1038 vpx_img_wrap(&ctx->preview_img, VPX_IMG_FMT_YV12,
1039 sd.y_width + 2*VP8BORDERINPIXELS,
1040 sd.y_height + 2*VP8BORDERINPIXELS,
1043 vpx_img_set_rect(&ctx->preview_img,
1044 VP8BORDERINPIXELS, VP8BORDERINPIXELS,
1045 sd.y_width, sd.y_height);
1048 ctx->preview_img.bps = 12;
1049 ctx->preview_img.planes[VPX_PLANE_Y] = sd.y_buffer;
1050 ctx->preview_img.planes[VPX_PLANE_U] = sd.u_buffer;
1051 ctx->preview_img.planes[VPX_PLANE_V] = sd.v_buffer;
1053 if (sd.clrtype == REG_YUV)
1054 ctx->preview_img.fmt = VPX_IMG_FMT_I420;
1056 ctx->preview_img.fmt = VPX_IMG_FMT_VPXI420;
1058 ctx->preview_img.x_chroma_shift = 1;
1059 ctx->preview_img.y_chroma_shift = 1;
1061 ctx->preview_img.d_w = sd.y_width;
1062 ctx->preview_img.d_h = sd.y_height;
1063 ctx->preview_img.stride[VPX_PLANE_Y] = sd.y_stride;
1064 ctx->preview_img.stride[VPX_PLANE_U] = sd.uv_stride;
1065 ctx->preview_img.stride[VPX_PLANE_V] = sd.uv_stride;
1066 ctx->preview_img.w = sd.y_width;
1067 ctx->preview_img.h = sd.y_height;
1069 return &ctx->preview_img;
1075 static vpx_codec_err_t vp8e_update_entropy(vpx_codec_alg_priv_t *ctx,
1079 int update = va_arg(args, int);
1080 vp8_update_entropy(ctx->cpi, update);
1081 return VPX_CODEC_OK;
1085 static vpx_codec_err_t vp8e_update_reference(vpx_codec_alg_priv_t *ctx,
1089 int update = va_arg(args, int);
1090 vp8_update_reference(ctx->cpi, update);
1091 return VPX_CODEC_OK;
1094 static vpx_codec_err_t vp8e_use_reference(vpx_codec_alg_priv_t *ctx,
1098 int reference_flag = va_arg(args, int);
1099 vp8_use_as_reference(ctx->cpi, reference_flag);
1100 return VPX_CODEC_OK;
1103 static vpx_codec_err_t vp8e_set_roi_map(vpx_codec_alg_priv_t *ctx,
1107 vpx_roi_map_t *data = va_arg(args, vpx_roi_map_t *);
1111 vpx_roi_map_t *roi = (vpx_roi_map_t *)data;
1113 if (!vp8_set_roimap(ctx->cpi, roi->roi_map, roi->rows, roi->cols, roi->delta_q, roi->delta_lf, roi->static_threshold))
1114 return VPX_CODEC_OK;
1116 return VPX_CODEC_INVALID_PARAM;
1119 return VPX_CODEC_INVALID_PARAM;
1123 static vpx_codec_err_t vp8e_set_activemap(vpx_codec_alg_priv_t *ctx,
1127 vpx_active_map_t *data = va_arg(args, vpx_active_map_t *);
1132 vpx_active_map_t *map = (vpx_active_map_t *)data;
1134 if (!vp8_set_active_map(ctx->cpi, map->active_map, map->rows, map->cols))
1135 return VPX_CODEC_OK;
1137 return VPX_CODEC_INVALID_PARAM;
1140 return VPX_CODEC_INVALID_PARAM;
1143 static vpx_codec_err_t vp8e_set_scalemode(vpx_codec_alg_priv_t *ctx,
1148 vpx_scaling_mode_t *data = va_arg(args, vpx_scaling_mode_t *);
1153 vpx_scaling_mode_t scalemode = *(vpx_scaling_mode_t *)data ;
1154 res = vp8_set_internal_size(ctx->cpi, scalemode.h_scaling_mode, scalemode.v_scaling_mode);
1158 /*force next frame a key frame to effect scaling mode */
1159 ctx->next_frame_flag |= FRAMEFLAGS_KEY;
1160 return VPX_CODEC_OK;
1163 return VPX_CODEC_INVALID_PARAM;
1166 return VPX_CODEC_INVALID_PARAM;
1170 static vpx_codec_ctrl_fn_map_t vp8e_ctf_maps[] =
1172 {VP8_SET_REFERENCE, vp8e_set_reference},
1173 {VP8_COPY_REFERENCE, vp8e_get_reference},
1174 {VP8_SET_POSTPROC, vp8e_set_previewpp},
1175 {VP8E_UPD_ENTROPY, vp8e_update_entropy},
1176 {VP8E_UPD_REFERENCE, vp8e_update_reference},
1177 {VP8E_USE_REFERENCE, vp8e_use_reference},
1178 {VP8E_SET_ROI_MAP, vp8e_set_roi_map},
1179 {VP8E_SET_ACTIVEMAP, vp8e_set_activemap},
1180 {VP8E_SET_SCALEMODE, vp8e_set_scalemode},
1181 {VP8E_SET_ENCODING_MODE, set_param},
1182 {VP8E_SET_CPUUSED, set_param},
1183 {VP8E_SET_NOISE_SENSITIVITY, set_param},
1184 {VP8E_SET_ENABLEAUTOALTREF, set_param},
1185 {VP8E_SET_SHARPNESS, set_param},
1186 {VP8E_SET_STATIC_THRESHOLD, set_param},
1187 {VP8E_SET_TOKEN_PARTITIONS, set_param},
1188 {VP8E_GET_LAST_QUANTIZER, get_param},
1189 {VP8E_GET_LAST_QUANTIZER_64, get_param},
1190 {VP8E_SET_ARNR_MAXFRAMES, set_param},
1191 {VP8E_SET_ARNR_STRENGTH , set_param},
1192 {VP8E_SET_ARNR_TYPE , set_param},
1193 {VP8E_SET_TUNING, set_param},
1194 {VP8E_SET_CQ_LEVEL, set_param},
1195 {VP8E_SET_MAX_INTRA_BITRATE_PCT, set_param},
1199 static vpx_codec_enc_cfg_map_t vp8e_usage_cfg_map[] =
1210 {1, 30}, /* g_timebase */
1212 0, /* g_error_resilient */
1214 VPX_RC_ONE_PASS, /* g_pass */
1216 0, /* g_lag_in_frames */
1218 0, /* rc_dropframe_thresh */
1219 0, /* rc_resize_allowed */
1220 60, /* rc_resize_down_thresold */
1221 30, /* rc_resize_up_thresold */
1223 VPX_VBR, /* rc_end_usage */
1224 #if VPX_ENCODER_ABI_VERSION > (1 + VPX_CODEC_ABI_VERSION)
1225 {0}, /* rc_twopass_stats_in */
1227 256, /* rc_target_bandwidth */
1228 4, /* rc_min_quantizer */
1229 63, /* rc_max_quantizer */
1230 100, /* rc_undershoot_pct */
1231 100, /* rc_overshoot_pct */
1233 6000, /* rc_max_buffer_size */
1234 4000, /* rc_buffer_initial_size; */
1235 5000, /* rc_buffer_optimal_size; */
1237 50, /* rc_two_pass_vbrbias */
1238 0, /* rc_two_pass_vbrmin_section */
1239 400, /* rc_two_pass_vbrmax_section */
1241 /* keyframing settings (kf) */
1242 VPX_KF_AUTO, /* g_kfmode*/
1243 0, /* kf_min_dist */
1244 128, /* kf_max_dist */
1246 #if VPX_ENCODER_ABI_VERSION == (1 + VPX_CODEC_ABI_VERSION)
1247 1, /* g_delete_first_pass_file */
1248 "vp8.fpf" /* first pass filename */
1251 1, /* ts_number_layers */
1252 {0}, /* ts_target_bitrate */
1253 {0}, /* ts_rate_decimator */
1254 0, /* ts_periodicity */
1255 {0}, /* ts_layer_id */
1257 { -1, {NOT_IMPLEMENTED}}
1261 #ifndef VERSION_STRING
1262 #define VERSION_STRING
1264 CODEC_INTERFACE(vpx_codec_vp8_cx) =
1266 "WebM Project VP8 Encoder" VERSION_STRING,
1267 VPX_CODEC_INTERNAL_ABI_VERSION,
1268 VPX_CODEC_CAP_ENCODER | VPX_CODEC_CAP_PSNR |
1269 VPX_CODEC_CAP_OUTPUT_PARTITION,
1270 /* vpx_codec_caps_t caps; */
1271 vp8e_init, /* vpx_codec_init_fn_t init; */
1272 vp8e_destroy, /* vpx_codec_destroy_fn_t destroy; */
1273 vp8e_ctf_maps, /* vpx_codec_ctrl_fn_map_t *ctrl_maps; */
1274 NOT_IMPLEMENTED, /* vpx_codec_get_mmap_fn_t get_mmap; */
1275 NOT_IMPLEMENTED, /* vpx_codec_set_mmap_fn_t set_mmap; */
1277 NOT_IMPLEMENTED, /* vpx_codec_peek_si_fn_t peek_si; */
1278 NOT_IMPLEMENTED, /* vpx_codec_get_si_fn_t get_si; */
1279 NOT_IMPLEMENTED, /* vpx_codec_decode_fn_t decode; */
1280 NOT_IMPLEMENTED, /* vpx_codec_frame_get_fn_t frame_get; */
1283 vp8e_usage_cfg_map, /* vpx_codec_enc_cfg_map_t peek_si; */
1284 vp8e_encode, /* vpx_codec_encode_fn_t encode; */
1285 vp8e_get_cxdata, /* vpx_codec_get_cx_data_fn_t frame_get; */
1290 } /* encoder functions */
1295 * BEGIN BACKWARDS COMPATIBILITY SHIM.
1298 static vpx_codec_err_t api1_control(vpx_codec_alg_priv_t *ctx,
1302 vpx_codec_ctrl_fn_map_t *entry;
1306 case VP8E_SET_FLUSHFLAG:
1307 /* VP8 sample code did VP8E_SET_FLUSHFLAG followed by
1308 * vpx_codec_get_cx_data() rather than vpx_codec_encode().
1310 return vp8e_encode(ctx, NULL, 0, 0, 0, 0);
1311 case VP8E_SET_FRAMETYPE:
1312 ctx->base.enc.tbd |= FORCE_KEY;
1313 return VPX_CODEC_OK;
1316 for (entry = vp8e_ctf_maps; entry && entry->fn; entry++)
1318 if (!entry->ctrl_id || entry->ctrl_id == ctrl_id)
1320 return entry->fn(ctx, ctrl_id, args);
1324 return VPX_CODEC_ERROR;
1328 static vpx_codec_ctrl_fn_map_t api1_ctrl_maps[] =
1335 static vpx_codec_err_t api1_encode(vpx_codec_alg_priv_t *ctx,
1336 const vpx_image_t *img,
1337 vpx_codec_pts_t pts,
1338 unsigned long duration,
1339 vpx_enc_frame_flags_t flags,
1340 unsigned long deadline)
1342 int force = ctx->base.enc.tbd;
1344 ctx->base.enc.tbd = 0;
1350 flags | ((force & FORCE_KEY) ? VPX_EFLAG_FORCE_KF : 0),
1355 vpx_codec_iface_t vpx_enc_vp8_algo =
1357 "WebM Project VP8 Encoder (Deprecated API)" VERSION_STRING,
1358 VPX_CODEC_INTERNAL_ABI_VERSION,
1359 VPX_CODEC_CAP_ENCODER,
1360 /* vpx_codec_caps_t caps; */
1361 vp8e_init, /* vpx_codec_init_fn_t init; */
1362 vp8e_destroy, /* vpx_codec_destroy_fn_t destroy; */
1363 api1_ctrl_maps, /* vpx_codec_ctrl_fn_map_t *ctrl_maps; */
1364 NOT_IMPLEMENTED, /* vpx_codec_get_mmap_fn_t get_mmap; */
1365 NOT_IMPLEMENTED, /* vpx_codec_set_mmap_fn_t set_mmap; */
1366 {NOT_IMPLEMENTED}, /* decoder functions */
1368 vp8e_usage_cfg_map, /* vpx_codec_enc_cfg_map_t peek_si; */
1369 api1_encode, /* vpx_codec_encode_fn_t encode; */
1370 vp8e_get_cxdata, /* vpx_codec_get_cx_data_fn_t frame_get; */
1375 } /* encoder functions */