int end_of_stream = 0;
int frames_received = 0;
#if OUTPUT_RC_STATS
- VpxVideoWriter *outfile[VPX_TS_MAX_LAYERS] = { NULL };
+ VpxVideoWriter *outfile[VPX_SS_MAX_LAYERS] = { NULL };
struct RateControlStats rc;
vpx_svc_layer_id_t layer_id;
vpx_svc_ref_frame_config_t ref_frame_config;
struct vpx_usec_timer timer;
int64_t cx_time = 0;
memset(&svc_ctx, 0, sizeof(svc_ctx));
+ memset(&app_input, 0, sizeof(AppInput));
+ memset(&info, 0, sizeof(VpxVideoInfo));
exec_name = argv[0];
parse_command_line(argc, argv, &app_input, &svc_ctx, &enc_cfg);
die("Failed to open %s for writing\n", app_input.output_filename);
}
#if OUTPUT_RC_STATS
- // For now, just write temporal layer streams.
- // TODO(marpan): do spatial by re-writing superframe.
+ // Write out spatial layer stream.
+ // TODO(marpan/jianj): allow for writing each spatial and temporal stream.
if (svc_ctx.output_rc_stat) {
- for (tl = 0; tl < enc_cfg.ts_number_layers; ++tl) {
+ for (sl = 0; sl < enc_cfg.ss_number_layers; ++sl) {
char file_name[PATH_MAX];
- snprintf(file_name, sizeof(file_name), "%s_t%d.ivf",
- app_input.output_filename, tl);
- outfile[tl] = vpx_video_writer_open(file_name, kContainerIVF, &info);
- if (!outfile[tl]) die("Failed to open %s for writing", file_name);
+ snprintf(file_name, sizeof(file_name), "%s_s%d.ivf",
+ app_input.output_filename, sl);
+ outfile[sl] = vpx_video_writer_open(file_name, kContainerIVF, &info);
+ if (!outfile[sl]) die("Failed to open %s for writing", file_name);
}
}
#endif
vpx_codec_control(&codec, VP9E_SET_SVC_INTER_LAYER_PRED, 0);
+ vpx_codec_control(&codec, VP9E_SET_NOISE_SENSITIVITY, 0);
+
// Encode frames
while (!end_of_stream) {
vpx_codec_iter_t iter = NULL;
uint64_t sizes[8];
uint64_t sizes_parsed[8];
int count = 0;
+ int tot_size = 0;
vp9_zero(sizes);
vp9_zero(sizes_parsed);
#endif
num_layers_encoded++;
}
}
+ tot_size = 0;
+ for (sl = 0; sl < enc_cfg.ss_number_layers; ++sl) {
+ if (cx_pkt->data.frame.spatial_layer_encoded[sl]) {
+ tot_size += sizes[sl];
+ vpx_video_writer_write_frame(
+ outfile[sl], cx_pkt->data.frame.buf, tot_size,
+ cx_pkt->data.frame.pts);
+ }
+ }
}
- for (tl = layer_id.temporal_layer_id;
- tl < enc_cfg.ts_number_layers; ++tl) {
- vpx_video_writer_write_frame(
- outfile[tl], cx_pkt->data.frame.buf, cx_pkt->data.frame.sz,
- cx_pkt->data.frame.pts);
- }
-
for (sl = 0; sl < enc_cfg.ss_number_layers; ++sl) {
if (cx_pkt->data.frame.spatial_layer_encoded[sl]) {
for (tl = layer_id.temporal_layer_id;
}
#if OUTPUT_RC_STATS
if (svc_ctx.output_rc_stat) {
- for (tl = 0; tl < enc_cfg.ts_number_layers; ++tl) {
- vpx_video_writer_close(outfile[tl]);
+ for (sl = 0; sl < enc_cfg.ss_number_layers; ++sl) {
+ vpx_video_writer_close(outfile[sl]);
}
}
#endif