25 #include "../tools_common.h" 26 #include "../video_writer.h" 28 #include "../vpx_ports/vpx_timer.h" 29 #include "vpx/svc_context.h" 32 #include "../vpxstats.h" 33 #include "vp9/encoder/vp9_encoder.h" 34 #define OUTPUT_RC_STATS 1 36 static const arg_def_t skip_frames_arg =
37 ARG_DEF(
"s",
"skip-frames", 1,
"input frames to skip");
38 static const arg_def_t frames_arg =
39 ARG_DEF(
"f",
"frames", 1,
"number of frames to encode");
40 static const arg_def_t threads_arg =
41 ARG_DEF(
"th",
"threads", 1,
"number of threads to use");
43 static const arg_def_t output_rc_stats_arg =
44 ARG_DEF(
"rcstat",
"output_rc_stats", 1,
"output rc stats");
46 static const arg_def_t width_arg = ARG_DEF(
"w",
"width", 1,
"source width");
47 static const arg_def_t height_arg = ARG_DEF(
"h",
"height", 1,
"source height");
48 static const arg_def_t timebase_arg =
49 ARG_DEF(
"t",
"timebase", 1,
"timebase (num/den)");
50 static const arg_def_t bitrate_arg = ARG_DEF(
51 "b",
"target-bitrate", 1,
"encoding bitrate, in kilobits per second");
52 static const arg_def_t spatial_layers_arg =
53 ARG_DEF(
"sl",
"spatial-layers", 1,
"number of spatial SVC layers");
54 static const arg_def_t temporal_layers_arg =
55 ARG_DEF(
"tl",
"temporal-layers", 1,
"number of temporal SVC layers");
56 static const arg_def_t temporal_layering_mode_arg =
57 ARG_DEF(
"tlm",
"temporal-layering-mode", 1,
"temporal layering scheme." 58 "VP9E_TEMPORAL_LAYERING_MODE");
59 static const arg_def_t kf_dist_arg =
60 ARG_DEF(
"k",
"kf-dist", 1,
"number of frames between keyframes");
61 static const arg_def_t scale_factors_arg =
62 ARG_DEF(
"r",
"scale-factors", 1,
"scale factors (lowest to highest layer)");
63 static const arg_def_t passes_arg =
64 ARG_DEF(
"p",
"passes", 1,
"Number of passes (1/2)");
65 static const arg_def_t pass_arg =
66 ARG_DEF(NULL,
"pass", 1,
"Pass to execute (1/2)");
67 static const arg_def_t fpf_name_arg =
68 ARG_DEF(NULL,
"fpf", 1,
"First pass statistics file name");
69 static const arg_def_t min_q_arg =
70 ARG_DEF(NULL,
"min-q", 1,
"Minimum quantizer");
71 static const arg_def_t max_q_arg =
72 ARG_DEF(NULL,
"max-q", 1,
"Maximum quantizer");
73 static const arg_def_t min_bitrate_arg =
74 ARG_DEF(NULL,
"min-bitrate", 1,
"Minimum bitrate");
75 static const arg_def_t max_bitrate_arg =
76 ARG_DEF(NULL,
"max-bitrate", 1,
"Maximum bitrate");
77 static const arg_def_t lag_in_frame_arg =
78 ARG_DEF(NULL,
"lag-in-frames", 1,
"Number of frame to input before " 79 "generating any outputs");
80 static const arg_def_t rc_end_usage_arg =
81 ARG_DEF(NULL,
"rc-end-usage", 1,
"0 - 3: VBR, CBR, CQ, Q");
82 static const arg_def_t speed_arg =
83 ARG_DEF(
"sp",
"speed", 1,
"speed configuration");
84 static const arg_def_t aqmode_arg =
85 ARG_DEF(
"aq",
"aqmode", 1,
"aq-mode off/on");
87 #if CONFIG_VP9_HIGHBITDEPTH 88 static const struct arg_enum_list bitdepth_enum[] = {
95 static const arg_def_t bitdepth_arg =
96 ARG_DEF_ENUM(
"d",
"bit-depth", 1,
"Bit depth for codec 8, 10 or 12. ",
98 #endif // CONFIG_VP9_HIGHBITDEPTH 101 static const arg_def_t *svc_args[] = {
102 &frames_arg, &width_arg, &height_arg,
103 &timebase_arg, &bitrate_arg, &skip_frames_arg, &spatial_layers_arg,
104 &kf_dist_arg, &scale_factors_arg, &passes_arg, &pass_arg,
105 &fpf_name_arg, &min_q_arg, &max_q_arg, &min_bitrate_arg,
106 &max_bitrate_arg, &temporal_layers_arg, &temporal_layering_mode_arg,
107 &lag_in_frame_arg, &threads_arg, &aqmode_arg,
109 &output_rc_stats_arg,
112 #if CONFIG_VP9_HIGHBITDEPTH 116 &rc_end_usage_arg, NULL
119 static const uint32_t default_frames_to_skip = 0;
120 static const uint32_t default_frames_to_code = 60 * 60;
121 static const uint32_t default_width = 1920;
122 static const uint32_t default_height = 1080;
123 static const uint32_t default_timebase_num = 1;
124 static const uint32_t default_timebase_den = 60;
125 static const uint32_t default_bitrate = 1000;
126 static const uint32_t default_spatial_layers = 5;
127 static const uint32_t default_temporal_layers = 1;
128 static const uint32_t default_kf_dist = 100;
129 static const uint32_t default_temporal_layering_mode = 0;
130 static const uint32_t default_output_rc_stats = 0;
131 static const int32_t default_speed = -1;
132 static const uint32_t default_threads = 0;
135 const char *input_filename;
136 const char *output_filename;
137 uint32_t frames_to_code;
138 uint32_t frames_to_skip;
139 struct VpxInputContext input_ctx;
145 static const char *exec_name;
147 void usage_exit(
void) {
148 fprintf(stderr,
"Usage: %s <options> input_filename output_filename\n",
150 fprintf(stderr,
"Options:\n");
151 arg_show_usage(stderr, svc_args);
155 static void parse_command_line(
int argc,
const char **argv_,
156 AppInput *app_input, SvcContext *svc_ctx,
158 struct arg arg = {0};
165 const char *fpf_file_name = NULL;
166 unsigned int min_bitrate = 0;
167 unsigned int max_bitrate = 0;
168 char string_options[1024] = {0};
171 svc_ctx->log_level = SVC_LOG_DEBUG;
172 svc_ctx->spatial_layers = default_spatial_layers;
173 svc_ctx->temporal_layers = default_temporal_layers;
174 svc_ctx->temporal_layering_mode = default_temporal_layering_mode;
176 svc_ctx->output_rc_stat = default_output_rc_stats;
178 svc_ctx->speed = default_speed;
179 svc_ctx->threads = default_threads;
187 enc_cfg->
g_w = default_width;
188 enc_cfg->
g_h = default_height;
197 app_input->frames_to_code = default_frames_to_code;
198 app_input->frames_to_skip = default_frames_to_skip;
201 argv = argv_dup(argc - 1, argv_ + 1);
202 for (argi = argj = argv; (*argj = *argi); argi += arg.argv_step) {
205 if (arg_match(&arg, &frames_arg, argi)) {
206 app_input->frames_to_code = arg_parse_uint(&arg);
207 }
else if (arg_match(&arg, &width_arg, argi)) {
208 enc_cfg->
g_w = arg_parse_uint(&arg);
209 }
else if (arg_match(&arg, &height_arg, argi)) {
210 enc_cfg->
g_h = arg_parse_uint(&arg);
211 }
else if (arg_match(&arg, &timebase_arg, argi)) {
212 enc_cfg->
g_timebase = arg_parse_rational(&arg);
213 }
else if (arg_match(&arg, &bitrate_arg, argi)) {
215 }
else if (arg_match(&arg, &skip_frames_arg, argi)) {
216 app_input->frames_to_skip = arg_parse_uint(&arg);
217 }
else if (arg_match(&arg, &spatial_layers_arg, argi)) {
218 svc_ctx->spatial_layers = arg_parse_uint(&arg);
219 }
else if (arg_match(&arg, &temporal_layers_arg, argi)) {
220 svc_ctx->temporal_layers = arg_parse_uint(&arg);
222 }
else if (arg_match(&arg, &output_rc_stats_arg, argi)) {
223 svc_ctx->output_rc_stat = arg_parse_uint(&arg);
225 }
else if (arg_match(&arg, &speed_arg, argi)) {
226 svc_ctx->speed = arg_parse_uint(&arg);
227 }
else if (arg_match(&arg, &aqmode_arg, argi)) {
228 svc_ctx->aqmode = arg_parse_uint(&arg);
229 }
else if (arg_match(&arg, &threads_arg, argi)) {
230 svc_ctx->threads = arg_parse_uint(&arg);
231 }
else if (arg_match(&arg, &temporal_layering_mode_arg, argi)) {
232 svc_ctx->temporal_layering_mode =
234 if (svc_ctx->temporal_layering_mode) {
237 }
else if (arg_match(&arg, &kf_dist_arg, argi)) {
240 }
else if (arg_match(&arg, &scale_factors_arg, argi)) {
241 snprintf(string_options,
sizeof(string_options),
"%s scale-factors=%s",
242 string_options, arg.val);
243 }
else if (arg_match(&arg, &passes_arg, argi)) {
244 passes = arg_parse_uint(&arg);
245 if (passes < 1 || passes > 2) {
246 die(
"Error: Invalid number of passes (%d)\n", passes);
248 }
else if (arg_match(&arg, &pass_arg, argi)) {
249 pass = arg_parse_uint(&arg);
250 if (pass < 1 || pass > 2) {
251 die(
"Error: Invalid pass selected (%d)\n", pass);
253 }
else if (arg_match(&arg, &fpf_name_arg, argi)) {
254 fpf_file_name = arg.val;
255 }
else if (arg_match(&arg, &min_q_arg, argi)) {
256 snprintf(string_options,
sizeof(string_options),
"%s min-quantizers=%s",
257 string_options, arg.val);
258 }
else if (arg_match(&arg, &max_q_arg, argi)) {
259 snprintf(string_options,
sizeof(string_options),
"%s max-quantizers=%s",
260 string_options, arg.val);
261 }
else if (arg_match(&arg, &min_bitrate_arg, argi)) {
262 min_bitrate = arg_parse_uint(&arg);
263 }
else if (arg_match(&arg, &max_bitrate_arg, argi)) {
264 max_bitrate = arg_parse_uint(&arg);
265 }
else if (arg_match(&arg, &lag_in_frame_arg, argi)) {
267 }
else if (arg_match(&arg, &rc_end_usage_arg, argi)) {
269 #if CONFIG_VP9_HIGHBITDEPTH 270 }
else if (arg_match(&arg, &bitdepth_arg, argi)) {
271 enc_cfg->
g_bit_depth = arg_parse_enum_or_int(&arg);
286 die(
"Error: Invalid bit depth selected (%d)\n", enc_cfg->
g_bit_depth);
289 #endif // CONFIG_VP9_HIGHBITDEPTH 296 if (strlen(string_options) > 0)
297 vpx_svc_set_options(svc_ctx, string_options + 1);
299 if (passes == 0 || passes == 1) {
301 fprintf(stderr,
"pass is ignored since there's only one pass\n");
306 die(
"pass must be specified when passes is 2\n");
309 if (fpf_file_name == NULL) {
310 die(
"fpf must be specified when passes is 2\n");
315 if (!stats_open_file(&app_input->rc_stats, fpf_file_name, 0)) {
316 fatal(
"Failed to open statistics store");
320 if (!stats_open_file(&app_input->rc_stats, fpf_file_name, 1)) {
321 fatal(
"Failed to open statistics store");
325 app_input->passes = passes;
326 app_input->pass = pass;
330 if (min_bitrate > 0) {
334 if (max_bitrate > 0) {
341 for (argi = argv; *argi; ++argi)
342 if (argi[0][0] ==
'-' && strlen(argi[0]) > 1)
343 die(
"Error: Unrecognized option %s\n", *argi);
345 if (argv[0] == NULL || argv[1] == 0) {
348 app_input->input_filename = argv[0];
349 app_input->output_filename = argv[1];
352 if (enc_cfg->
g_w < 16 || enc_cfg->
g_w % 2 || enc_cfg->
g_h < 16 ||
354 die(
"Invalid resolution: %d x %d\n", enc_cfg->
g_w, enc_cfg->
g_h);
357 "Codec %s\nframes: %d, skip: %d\n" 359 "width %d, height: %d,\n" 360 "num: %d, den: %d, bitrate: %d,\n" 363 app_input->frames_to_skip,
364 svc_ctx->spatial_layers, enc_cfg->
g_w, enc_cfg->
g_h,
371 struct RateControlStats {
390 double avg_st_encoding_bitrate;
392 double variance_st_encoding_bitrate;
401 static void set_rate_control_stats(
struct RateControlStats *rc,
413 rc->layer_framerate[layer] = framerate;
415 rc->layer_framerate[layer] =
418 rc->layer_pfb[layer] = 1000.0 *
421 (rc->layer_framerate[layer] -
422 rc->layer_framerate[layer - 1]);
424 rc->layer_pfb[tlayer0] = 1000.0 *
426 rc->layer_framerate[tlayer0];
428 rc->layer_input_frames[layer] = 0;
429 rc->layer_enc_frames[layer] = 0;
430 rc->layer_tot_enc_frames[layer] = 0;
431 rc->layer_encoding_bitrate[layer] = 0.0;
432 rc->layer_avg_frame_size[layer] = 0.0;
433 rc->layer_avg_rate_mismatch[layer] = 0.0;
436 rc->window_count = 0;
437 rc->window_size = 15;
438 rc->avg_st_encoding_bitrate = 0.0;
439 rc->variance_st_encoding_bitrate = 0.0;
442 static void printout_rate_control_summary(
struct RateControlStats *rc,
446 int tot_num_frames = 0;
447 double perc_fluctuation = 0.0;
448 printf(
"Total number of processed frames: %d\n\n", frame_cnt - 1);
449 printf(
"Rate control layer stats for sl%d tl%d layer(s):\n\n",
454 const int num_dropped = (tl > 0) ?
455 (rc->layer_input_frames[layer] - rc->layer_enc_frames[layer]) :
456 (rc->layer_input_frames[layer] - rc->layer_enc_frames[layer] - 1);
458 tot_num_frames += rc->layer_input_frames[layer];
459 rc->layer_encoding_bitrate[layer] = 0.001 * rc->layer_framerate[layer] *
460 rc->layer_encoding_bitrate[layer] / tot_num_frames;
461 rc->layer_avg_frame_size[layer] = rc->layer_avg_frame_size[layer] /
462 rc->layer_enc_frames[layer];
463 rc->layer_avg_rate_mismatch[layer] =
464 100.0 * rc->layer_avg_rate_mismatch[layer] /
465 rc->layer_enc_frames[layer];
466 printf(
"For layer#: sl%d tl%d \n", sl, tl);
467 printf(
"Bitrate (target vs actual): %d %f.0 kbps\n",
469 rc->layer_encoding_bitrate[layer]);
470 printf(
"Average frame size (target vs actual): %f %f bits\n",
471 rc->layer_pfb[layer], rc->layer_avg_frame_size[layer]);
472 printf(
"Average rate_mismatch: %f\n",
473 rc->layer_avg_rate_mismatch[layer]);
474 printf(
"Number of input frames, encoded (non-key) frames, " 475 "and percent dropped frames: %d %d %f.0 \n",
476 rc->layer_input_frames[layer], rc->layer_enc_frames[layer],
477 100.0 * num_dropped / rc->layer_input_frames[layer]);
481 rc->avg_st_encoding_bitrate = rc->avg_st_encoding_bitrate / rc->window_count;
482 rc->variance_st_encoding_bitrate =
483 rc->variance_st_encoding_bitrate / rc->window_count -
484 (rc->avg_st_encoding_bitrate * rc->avg_st_encoding_bitrate);
485 perc_fluctuation = 100.0 * sqrt(rc->variance_st_encoding_bitrate) /
486 rc->avg_st_encoding_bitrate;
487 printf(
"Short-time stats, for window of %d frames: \n", rc->window_size);
488 printf(
"Average, rms-variance, and percent-fluct: %f %f %f \n",
489 rc->avg_st_encoding_bitrate,
490 sqrt(rc->variance_st_encoding_bitrate),
492 if (frame_cnt != tot_num_frames)
493 die(
"Error: Number of input frames not equal to output encoded frames != " 494 "%d tot_num_frames = %d\n", frame_cnt, tot_num_frames);
499 uint32_t sizes[8],
int *count) {
508 marker = *(data + data_sz - 1);
512 if ((marker & 0xe0) == 0xc0) {
513 const uint32_t frames = (marker & 0x7) + 1;
514 const uint32_t mag = ((marker >> 3) & 0x3) + 1;
515 const size_t index_sz = 2 + mag * frames;
519 if (data_sz < index_sz)
523 const uint8_t marker2 = *(data + data_sz - index_sz);
528 if (marker != marker2)
535 const uint8_t *x = &data[data_sz - index_sz + 1];
537 for (i = 0; i < frames; ++i) {
538 uint32_t this_sz = 0;
540 for (j = 0; j < mag; ++j)
541 this_sz |= (*x++) << (j * 8);
555 void set_frame_flags_bypass_mode(
int sl,
int tl,
int num_spatial_layers,
558 for (sl = 0; sl < num_spatial_layers; ++sl) {
577 }
else if (tl == 1) {
596 }
else if (tl == 1) {
598 ref_frame_config->
gld_fb_idx[sl] = num_spatial_layers + sl - 1;
599 ref_frame_config->
alt_fb_idx[sl] = num_spatial_layers + sl;
604 int main(
int argc,
const char **argv) {
605 AppInput app_input = {0};
606 VpxVideoWriter *writer = NULL;
607 VpxVideoInfo info = {0};
612 uint32_t frame_cnt = 0;
616 int frame_duration = 1;
618 int end_of_stream = 0;
619 int frames_received = 0;
622 struct RateControlStats rc;
626 double sum_bitrate = 0.0;
627 double sum_bitrate2 = 0.0;
628 double framerate = 30.0;
630 struct vpx_usec_timer timer;
632 memset(&svc_ctx, 0,
sizeof(svc_ctx));
633 svc_ctx.log_print = 1;
635 parse_command_line(argc, argv, &app_input, &svc_ctx, &enc_cfg);
638 #if CONFIG_VP9_HIGHBITDEPTH 641 enc_cfg.
g_w, enc_cfg.
g_h, 32)) {
642 die(
"Failed to allocate image %dx%d\n", enc_cfg.
g_w, enc_cfg.
g_h);
646 die(
"Failed to allocate image %dx%d\n", enc_cfg.
g_w, enc_cfg.
g_h);
648 #endif // CONFIG_VP9_HIGHBITDEPTH 650 if (!(infile = fopen(app_input.input_filename,
"rb")))
651 die(
"Failed to open %s for reading\n", app_input.input_filename);
654 if (vpx_svc_init(&svc_ctx, &codec, vpx_codec_vp9_cx(), &enc_cfg) !=
656 die(
"Failed to initialize encoder\n");
659 if (svc_ctx.output_rc_stat) {
660 set_rate_control_stats(&rc, &enc_cfg);
665 info.codec_fourcc = VP9_FOURCC;
669 if (!(app_input.passes == 2 && app_input.pass == 1)) {
671 writer = vpx_video_writer_open(app_input.output_filename, kContainerIVF,
674 die(
"Failed to open %s for writing\n", app_input.output_filename);
679 if (svc_ctx.output_rc_stat) {
681 char file_name[PATH_MAX];
683 snprintf(file_name,
sizeof(file_name),
"%s_t%d.ivf",
684 app_input.output_filename, tl);
685 outfile[tl] = vpx_video_writer_open(file_name, kContainerIVF, &info);
687 die(
"Failed to open %s for writing", file_name);
693 for (i = 0; i < app_input.frames_to_skip; ++i)
694 vpx_img_read(&raw, infile);
696 if (svc_ctx.speed != -1)
700 if (svc_ctx.speed >= 5 && svc_ctx.aqmode == 1)
705 while (!end_of_stream) {
708 if (frame_cnt >= app_input.frames_to_code || !vpx_img_read(&raw, infile)) {
721 layer_id.spatial_layer_id = 0;
723 if (frame_cnt % 2 == 0)
724 layer_id.temporal_layer_id = 0;
726 layer_id.temporal_layer_id = 1;
731 set_frame_flags_bypass_mode(sl, layer_id.temporal_layer_id,
732 svc_ctx.spatial_layers,
741 layer_id.temporal_layer_id];
745 vpx_usec_timer_start(&timer);
746 res = vpx_svc_encode(&svc_ctx, &codec, (end_of_stream ? NULL : &raw),
747 pts, frame_duration, svc_ctx.speed >= 5 ?
749 vpx_usec_timer_mark(&timer);
750 cx_time += vpx_usec_timer_elapsed(&timer);
752 printf(
"%s", vpx_svc_get_message(&svc_ctx));
755 die_codec(&codec,
"Failed to encode frame");
759 switch (cx_pkt->
kind) {
761 SvcInternal_t *
const si = (SvcInternal_t *)svc_ctx.internal;
767 vpx_video_writer_write_frame(writer,
773 if (svc_ctx.output_rc_stat) {
775 parse_superframe_index(cx_pkt->
data.
frame.buf,
781 if (svc_ctx.temporal_layering_mode !=
785 layer_id.temporal_layer_id];
788 for (tl = layer_id.temporal_layer_id;
790 vpx_video_writer_write_frame(outfile[tl],
797 for (tl = layer_id.temporal_layer_id;
800 ++rc.layer_tot_enc_frames[layer];
801 rc.layer_encoding_bitrate[layer] += 8.0 * sizes[sl];
804 if (tl == layer_id.temporal_layer_id &&
806 rc.layer_avg_frame_size[layer] += 8.0 * sizes[sl];
807 rc.layer_avg_rate_mismatch[layer] +=
808 fabs(8.0 * sizes[sl] - rc.layer_pfb[layer]) /
810 ++rc.layer_enc_frames[layer];
818 if (frame_cnt > rc.window_size) {
819 tl = layer_id.temporal_layer_id;
821 sum_bitrate += 0.001 * 8.0 * sizes[sl] * framerate;
823 if (frame_cnt % rc.window_size == 0) {
824 rc.window_count += 1;
825 rc.avg_st_encoding_bitrate += sum_bitrate / rc.window_size;
826 rc.variance_st_encoding_bitrate +=
827 (sum_bitrate / rc.window_size) *
828 (sum_bitrate / rc.window_size);
834 if (frame_cnt > rc.window_size + rc.window_size / 2) {
835 tl = layer_id.temporal_layer_id;
837 sum_bitrate2 += 0.001 * 8.0 * sizes[sl] * framerate;
840 if (frame_cnt > 2 * rc.window_size &&
841 frame_cnt % rc.window_size == 0) {
842 rc.window_count += 1;
843 rc.avg_st_encoding_bitrate += sum_bitrate2 / rc.window_size;
844 rc.variance_st_encoding_bitrate +=
845 (sum_bitrate2 / rc.window_size) *
846 (sum_bitrate2 / rc.window_size);
854 printf(
"SVC frame: %d, kf: %d, size: %d, pts: %d\n", frames_received,
858 si->bytes_sum[0] += (int)cx_pkt->
data.
frame.sz;
863 stats_write(&app_input.rc_stats,
874 if (!end_of_stream) {
876 pts += frame_duration;
884 layer_id.temporal_layer_id;
885 --rc.layer_input_frames[layer];
889 printf(
"Processed %d frames\n", frame_cnt);
892 if (svc_ctx.output_rc_stat) {
893 printout_rate_control_summary(&rc, &enc_cfg, frame_cnt);
898 if (app_input.passes == 2)
899 stats_close(&app_input.rc_stats, 1);
901 vpx_video_writer_close(writer);
904 if (svc_ctx.output_rc_stat) {
906 vpx_video_writer_close(outfile[tl]);
910 printf(
"Frame cnt and encoding time/FPS stats for encoding: %d %f %f \n",
912 1000 * (
float)cx_time / (
double)(frame_cnt * 1000000),
913 1000000 * (
double)frame_cnt / (
double)cx_time);
916 printf(
"%s", vpx_svc_dump_statistics(&svc_ctx));
917 vpx_svc_release(&svc_ctx);
vpx_fixed_buf_t twopass_stats
Definition: vpx_encoder.h:214
unsigned int ts_number_layers
Number of temporal coding layers.
Definition: vpx_encoder.h:715
Codec control function to set encoder internal speed settings.
Definition: vp8cx.h:164
#define VPX_MAX_LAYERS
Definition: vpx_encoder.h:46
#define VP8_EFLAG_NO_REF_LAST
Don't reference the last frame.
Definition: vp8cx.h:58
#define VP8_EFLAG_NO_UPD_GF
Don't update the golden frame.
Definition: vp8cx.h:92
Image Descriptor.
Definition: vpx_image.h:88
Describes the encoder algorithm interface to applications.
const char * vpx_codec_iface_name(vpx_codec_iface_t *iface)
Return the name for a given interface.
const char * vpx_codec_err_to_string(vpx_codec_err_t err)
Convert error number to printable string.
int lst_fb_idx[5]
Definition: vp8cx.h:699
#define VPX_TS_MAX_LAYERS
Definition: vpx_encoder.h:40
struct vpx_rational g_timebase
Stream timebase units.
Definition: vpx_encoder.h:397
unsigned int layer_target_bitrate[12]
Target bitrate for each spatial/temporal layer.
Definition: vpx_encoder.h:755
#define VP8_EFLAG_NO_REF_GF
Don't reference the golden frame.
Definition: vp8cx.h:67
unsigned int g_input_bit_depth
Bit-depth of the input frames.
Definition: vpx_encoder.h:383
int den
Definition: vpx_encoder.h:261
Definition: vpx_encoder.h:177
unsigned int kf_max_dist
Keyframe maximum interval.
Definition: vpx_encoder.h:685
unsigned int g_lag_in_frames
Allow lagged encoding.
Definition: vpx_encoder.h:429
Encoder configuration structure.
Definition: vpx_encoder.h:314
The coded data for this stream is corrupt or incomplete.
Definition: vpx_codec.h:129
Encoder output packet.
Definition: vpx_encoder.h:195
void * buf
Definition: vpx_encoder.h:109
unsigned int ts_rate_decimator[5]
Frame rate decimation factor for each temporal layer.
Definition: vpx_encoder.h:729
unsigned int kf_min_dist
Keyframe minimum interval.
Definition: vpx_encoder.h:675
Definition: vpx_encoder.h:268
unsigned int g_profile
Bitstream profile to use.
Definition: vpx_encoder.h:346
Definition: vpx_encoder.h:269
Codec control function to set number of tile columns.
Definition: vp8cx.h:353
struct vpx_codec_cx_pkt::@1::@2 frame
int frame_flags[5]
Definition: vp8cx.h:698
vpx_image_t * vpx_img_alloc(vpx_image_t *img, vpx_img_fmt_t fmt, unsigned int d_w, unsigned int d_h, unsigned int align)
Open a descriptor, allocating storage for the underlying image.
Definition: vpx_image.h:56
unsigned int g_w
Width of the frame.
Definition: vpx_encoder.h:357
Codec control function to set adaptive quantization mode.
Definition: vp8cx.h:400
Codec control function to get svc layer ID.
Definition: vp8cx.h:466
unsigned int g_h
Height of the frame.
Definition: vpx_encoder.h:367
enum vpx_codec_cx_pkt_kind kind
Definition: vpx_encoder.h:196
vp9 svc layer parameters
Definition: vp8cx.h:684
Operation completed without error.
Definition: vpx_codec.h:91
#define VP8_EFLAG_NO_UPD_LAST
Don't update the last frame.
Definition: vp8cx.h:84
void vpx_img_free(vpx_image_t *img)
Close an image descriptor.
unsigned int rc_target_bitrate
Target data rate.
Definition: vpx_encoder.h:525
#define VPX_DL_REALTIME
Definition: vpx_encoder.h:911
int num
Definition: vpx_encoder.h:260
Definition: vpx_codec.h:222
Codec control function to set the frame flags and buffer indices for spatial layers. The frame flags and buffer indices are set using the struct vpx_svc_ref_frame_config defined below.
Definition: vp8cx.h:539
enum vpx_enc_pass g_pass
Multi-pass Encoding Mode.
Definition: vpx_encoder.h:414
#define VPX_DL_GOOD_QUALITY
Definition: vpx_encoder.h:914
unsigned int ss_number_layers
Number of spatial coding layers.
Definition: vpx_encoder.h:695
vpx_bit_depth_t g_bit_depth
Bit-depth of the codec.
Definition: vpx_encoder.h:375
Provides definitions for using VP8 or VP9 encoder algorithm within the vpx Codec Interface.
Bypass mode. Used when application needs to control temporal layering. This will only work when the n...
Definition: vp8cx.h:592
vpx_codec_err_t
Algorithm return codes.
Definition: vpx_codec.h:89
const vpx_codec_cx_pkt_t * vpx_codec_get_cx_data(vpx_codec_ctx_t *ctx, vpx_codec_iter_t *iter)
Encoded data iterator.
union vpx_codec_cx_pkt::@1 data
int temporal_layering_mode
Temporal layering mode indicating which temporal layering scheme to use.
Definition: vpx_encoder.h:763
vpx_fixed_buf_t rc_twopass_stats_in
Two-pass stats buffer.
Definition: vpx_encoder.h:512
vpx_codec_err_t vpx_codec_enc_config_default(vpx_codec_iface_t *iface, vpx_codec_enc_cfg_t *cfg, unsigned int reserved)
Get a default configuration.
Definition: vpx_encoder.h:277
#define vpx_codec_control(ctx, id, data)
vpx_codec_control wrapper macro
Definition: vpx_codec.h:407
#define VP8_EFLAG_NO_REF_ARF
Don't reference the alternate reference frame.
Definition: vp8cx.h:76
vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx)
Destroy a codec instance.
size_t sz
Definition: vpx_encoder.h:110
Definition: vpx_codec.h:220
vp9 svc frame flag parameters.
Definition: vp8cx.h:697
#define VPX_FRAME_IS_KEY
Definition: vpx_encoder.h:130
Definition: vpx_codec.h:221
int alt_fb_idx[5]
Definition: vp8cx.h:701
const void * vpx_codec_iter_t
Iterator.
Definition: vpx_codec.h:188
Definition: vpx_encoder.h:176
unsigned int rc_2pass_vbr_maxsection_pct
Two-pass mode per-GOP maximum bitrate.
Definition: vpx_encoder.h:652
vpx_codec_er_flags_t g_error_resilient
Enable error resilient modes.
Definition: vpx_encoder.h:406
#define VP8_EFLAG_NO_UPD_ARF
Don't update the alternate reference frame.
Definition: vp8cx.h:100
unsigned int rc_2pass_vbr_minsection_pct
Two-pass mode per-GOP minimum bitrate.
Definition: vpx_encoder.h:644
int gld_fb_idx[5]
Definition: vp8cx.h:700
Codec control function to set svc layer for spatial and temporal.
Definition: vp8cx.h:449
enum vpx_rc_mode rc_end_usage
Rate control algorithm to use.
Definition: vpx_encoder.h:504
Definition: vpx_encoder.h:267
Codec context structure.
Definition: vpx_codec.h:199