OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM 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 |
(...skipping 20 matching lines...) Expand all Loading... |
31 unsigned int tile_rows; | 31 unsigned int tile_rows; |
32 unsigned int arnr_max_frames; | 32 unsigned int arnr_max_frames; |
33 unsigned int arnr_strength; | 33 unsigned int arnr_strength; |
34 unsigned int arnr_type; | 34 unsigned int arnr_type; |
35 unsigned int experimental; | 35 unsigned int experimental; |
36 vp8e_tuning tuning; | 36 vp8e_tuning tuning; |
37 unsigned int cq_level; /* constrained quality level */ | 37 unsigned int cq_level; /* constrained quality level */ |
38 unsigned int rc_max_intra_bitrate_pct; | 38 unsigned int rc_max_intra_bitrate_pct; |
39 unsigned int lossless; | 39 unsigned int lossless; |
40 unsigned int frame_parallel_decoding_mode; | 40 unsigned int frame_parallel_decoding_mode; |
| 41 unsigned int aq_mode; |
41 }; | 42 }; |
42 | 43 |
43 struct extraconfig_map { | 44 struct extraconfig_map { |
44 int usage; | 45 int usage; |
45 struct vp9_extracfg cfg; | 46 struct vp9_extracfg cfg; |
46 }; | 47 }; |
47 | 48 |
48 static const struct extraconfig_map extracfg_map[] = { | 49 static const struct extraconfig_map extracfg_map[] = { |
49 { | 50 { |
50 0, | 51 0, |
51 { // NOLINT | 52 { // NOLINT |
52 NULL, | 53 NULL, |
53 0, /* cpu_used */ | 54 0, /* cpu_used */ |
54 1, /* enable_auto_alt_ref */ | 55 1, /* enable_auto_alt_ref */ |
55 0, /* noise_sensitivity */ | 56 0, /* noise_sensitivity */ |
56 0, /* Sharpness */ | 57 0, /* Sharpness */ |
57 0, /* static_thresh */ | 58 0, /* static_thresh */ |
58 0, /* tile_columns */ | 59 0, /* tile_columns */ |
59 0, /* tile_rows */ | 60 0, /* tile_rows */ |
60 7, /* arnr_max_frames */ | 61 7, /* arnr_max_frames */ |
61 5, /* arnr_strength */ | 62 5, /* arnr_strength */ |
62 3, /* arnr_type*/ | 63 3, /* arnr_type*/ |
63 0, /* experimental mode */ | 64 0, /* experimental mode */ |
64 0, /* tuning*/ | 65 0, /* tuning*/ |
65 10, /* cq_level */ | 66 10, /* cq_level */ |
66 0, /* rc_max_intra_bitrate_pct */ | 67 0, /* rc_max_intra_bitrate_pct */ |
67 0, /* lossless */ | 68 0, /* lossless */ |
68 0, /* frame_parallel_decoding_mode */ | 69 0, /* frame_parallel_decoding_mode */ |
| 70 0, /* aq_mode */ |
69 } | 71 } |
70 } | 72 } |
71 }; | 73 }; |
72 | 74 |
73 struct vpx_codec_alg_priv { | 75 struct vpx_codec_alg_priv { |
74 vpx_codec_priv_t base; | 76 vpx_codec_priv_t base; |
75 vpx_codec_enc_cfg_t cfg; | 77 vpx_codec_enc_cfg_t cfg; |
76 struct vp9_extracfg vp8_cfg; | 78 struct vp9_extracfg vp8_cfg; |
77 VP9_CONFIG oxcf; | 79 VP9_CONFIG oxcf; |
78 VP9_PTR cpi; | 80 VP9_PTR cpi; |
79 unsigned char *cx_data; | 81 unsigned char *cx_data; |
80 unsigned int cx_data_sz; | 82 size_t cx_data_sz; |
81 unsigned char *pending_cx_data; | 83 unsigned char *pending_cx_data; |
82 unsigned int pending_cx_data_sz; | 84 size_t pending_cx_data_sz; |
83 int pending_frame_count; | 85 int pending_frame_count; |
84 uint32_t pending_frame_sizes[8]; | 86 size_t pending_frame_sizes[8]; |
85 uint32_t pending_frame_magnitude; | 87 size_t pending_frame_magnitude; |
86 vpx_image_t preview_img; | 88 vpx_image_t preview_img; |
87 vp8_postproc_cfg_t preview_ppcfg; | 89 vp8_postproc_cfg_t preview_ppcfg; |
88 vpx_codec_pkt_list_decl(64) pkt_list; | 90 vpx_codec_pkt_list_decl(64) pkt_list; |
89 unsigned int fixed_kf_cntr; | 91 unsigned int fixed_kf_cntr; |
90 }; | 92 }; |
91 | 93 |
92 static VP9_REFFRAME ref_frame_to_vp9_reframe(vpx_ref_frame_type_t frame) { | 94 static VP9_REFFRAME ref_frame_to_vp9_reframe(vpx_ref_frame_type_t frame) { |
93 switch (frame) { | 95 switch (frame) { |
94 case VP8_LAST_FRAME: | 96 case VP8_LAST_FRAME: |
95 return VP9_LAST_FLAG; | 97 return VP9_LAST_FLAG; |
96 case VP8_GOLD_FRAME: | 98 case VP8_GOLD_FRAME: |
97 return VP9_GOLD_FLAG; | 99 return VP9_GOLD_FLAG; |
98 case VP8_ALTR_FRAME: | 100 case VP8_ALTR_FRAME: |
99 return VP9_ALT_FLAG; | 101 return VP9_ALT_FLAG; |
100 } | 102 } |
101 assert(!"Invalid Reference Frame"); | 103 assert(0 && "Invalid Reference Frame"); |
102 return VP9_LAST_FLAG; | 104 return VP9_LAST_FLAG; |
103 } | 105 } |
104 | 106 |
105 static vpx_codec_err_t | 107 static vpx_codec_err_t |
106 update_error_state(vpx_codec_alg_priv_t *ctx, | 108 update_error_state(vpx_codec_alg_priv_t *ctx, |
107 const struct vpx_internal_error_info *error) { | 109 const struct vpx_internal_error_info *error) { |
108 vpx_codec_err_t res; | 110 vpx_codec_err_t res; |
109 | 111 |
110 if ((res = error->error_code)) | 112 if ((res = error->error_code)) |
111 ctx->base.err_detail = error->has_detail | 113 ctx->base.err_detail = error->has_detail |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 RANGE_CHECK(cfg, g_timebase.num, 1, cfg->g_timebase.den); | 152 RANGE_CHECK(cfg, g_timebase.num, 1, cfg->g_timebase.den); |
151 RANGE_CHECK_HI(cfg, g_profile, 3); | 153 RANGE_CHECK_HI(cfg, g_profile, 3); |
152 | 154 |
153 RANGE_CHECK_HI(cfg, rc_max_quantizer, 63); | 155 RANGE_CHECK_HI(cfg, rc_max_quantizer, 63); |
154 RANGE_CHECK_HI(cfg, rc_min_quantizer, cfg->rc_max_quantizer); | 156 RANGE_CHECK_HI(cfg, rc_min_quantizer, cfg->rc_max_quantizer); |
155 RANGE_CHECK_BOOL(vp8_cfg, lossless); | 157 RANGE_CHECK_BOOL(vp8_cfg, lossless); |
156 if (vp8_cfg->lossless) { | 158 if (vp8_cfg->lossless) { |
157 RANGE_CHECK_HI(cfg, rc_max_quantizer, 0); | 159 RANGE_CHECK_HI(cfg, rc_max_quantizer, 0); |
158 RANGE_CHECK_HI(cfg, rc_min_quantizer, 0); | 160 RANGE_CHECK_HI(cfg, rc_min_quantizer, 0); |
159 } | 161 } |
| 162 RANGE_CHECK(vp8_cfg, aq_mode, 0, AQ_MODES_COUNT - 1); |
160 | 163 |
161 RANGE_CHECK_HI(cfg, g_threads, 64); | 164 RANGE_CHECK_HI(cfg, g_threads, 64); |
162 RANGE_CHECK_HI(cfg, g_lag_in_frames, MAX_LAG_BUFFERS); | 165 RANGE_CHECK_HI(cfg, g_lag_in_frames, MAX_LAG_BUFFERS); |
163 RANGE_CHECK(cfg, rc_end_usage, VPX_VBR, VPX_Q); | 166 RANGE_CHECK(cfg, rc_end_usage, VPX_VBR, VPX_Q); |
164 RANGE_CHECK_HI(cfg, rc_undershoot_pct, 1000); | 167 RANGE_CHECK_HI(cfg, rc_undershoot_pct, 1000); |
165 RANGE_CHECK_HI(cfg, rc_overshoot_pct, 1000); | 168 RANGE_CHECK_HI(cfg, rc_overshoot_pct, 1000); |
166 RANGE_CHECK_HI(cfg, rc_2pass_vbr_bias_pct, 100); | 169 RANGE_CHECK_HI(cfg, rc_2pass_vbr_bias_pct, 100); |
167 RANGE_CHECK(cfg, kf_mode, VPX_KF_DISABLED, VPX_KF_AUTO); | 170 RANGE_CHECK(cfg, kf_mode, VPX_KF_DISABLED, VPX_KF_AUTO); |
168 // RANGE_CHECK_BOOL(cfg, g_delete_firstpassfile); | 171 // RANGE_CHECK_BOOL(cfg, g_delete_firstpassfile); |
169 RANGE_CHECK_BOOL(cfg, rc_resize_allowed); | 172 RANGE_CHECK_BOOL(cfg, rc_resize_allowed); |
(...skipping 18 matching lines...) Expand all Loading... |
188 RANGE_CHECK_HI(vp8_cfg, noise_sensitivity, 6); | 191 RANGE_CHECK_HI(vp8_cfg, noise_sensitivity, 6); |
189 | 192 |
190 RANGE_CHECK(vp8_cfg, tile_columns, 0, 6); | 193 RANGE_CHECK(vp8_cfg, tile_columns, 0, 6); |
191 RANGE_CHECK(vp8_cfg, tile_rows, 0, 2); | 194 RANGE_CHECK(vp8_cfg, tile_rows, 0, 2); |
192 RANGE_CHECK_HI(vp8_cfg, Sharpness, 7); | 195 RANGE_CHECK_HI(vp8_cfg, Sharpness, 7); |
193 RANGE_CHECK(vp8_cfg, arnr_max_frames, 0, 15); | 196 RANGE_CHECK(vp8_cfg, arnr_max_frames, 0, 15); |
194 RANGE_CHECK_HI(vp8_cfg, arnr_strength, 6); | 197 RANGE_CHECK_HI(vp8_cfg, arnr_strength, 6); |
195 RANGE_CHECK(vp8_cfg, arnr_type, 1, 3); | 198 RANGE_CHECK(vp8_cfg, arnr_type, 1, 3); |
196 RANGE_CHECK(vp8_cfg, cq_level, 0, 63); | 199 RANGE_CHECK(vp8_cfg, cq_level, 0, 63); |
197 | 200 |
| 201 // TODO(yaowu): remove this when ssim tuning is implemented for vp9 |
| 202 if (vp8_cfg->tuning == VP8_TUNE_SSIM) |
| 203 ERROR("Option --tune=ssim is not currently supported in VP9."); |
| 204 |
198 if (cfg->g_pass == VPX_RC_LAST_PASS) { | 205 if (cfg->g_pass == VPX_RC_LAST_PASS) { |
199 size_t packet_sz = sizeof(FIRSTPASS_STATS); | 206 size_t packet_sz = sizeof(FIRSTPASS_STATS); |
200 int n_packets = (int)(cfg->rc_twopass_stats_in.sz / packet_sz); | 207 int n_packets = (int)(cfg->rc_twopass_stats_in.sz / packet_sz); |
201 FIRSTPASS_STATS *stats; | 208 FIRSTPASS_STATS *stats; |
202 | 209 |
203 if (!cfg->rc_twopass_stats_in.buf) | 210 if (!cfg->rc_twopass_stats_in.buf) |
204 ERROR("rc_twopass_stats_in.buf not set."); | 211 ERROR("rc_twopass_stats_in.buf not set."); |
205 | 212 |
206 if (cfg->rc_twopass_stats_in.sz % packet_sz) | 213 if (cfg->rc_twopass_stats_in.sz % packet_sz) |
207 ERROR("rc_twopass_stats_in.sz indicates truncated packet."); | 214 ERROR("rc_twopass_stats_in.sz indicates truncated packet."); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 oxcf->tuning = vp8_cfg.tuning; | 335 oxcf->tuning = vp8_cfg.tuning; |
329 | 336 |
330 oxcf->tile_columns = vp8_cfg.tile_columns; | 337 oxcf->tile_columns = vp8_cfg.tile_columns; |
331 oxcf->tile_rows = vp8_cfg.tile_rows; | 338 oxcf->tile_rows = vp8_cfg.tile_rows; |
332 | 339 |
333 oxcf->lossless = vp8_cfg.lossless; | 340 oxcf->lossless = vp8_cfg.lossless; |
334 | 341 |
335 oxcf->error_resilient_mode = cfg.g_error_resilient; | 342 oxcf->error_resilient_mode = cfg.g_error_resilient; |
336 oxcf->frame_parallel_decoding_mode = vp8_cfg.frame_parallel_decoding_mode; | 343 oxcf->frame_parallel_decoding_mode = vp8_cfg.frame_parallel_decoding_mode; |
337 | 344 |
| 345 oxcf->aq_mode = vp8_cfg.aq_mode; |
| 346 |
338 oxcf->ss_number_layers = cfg.ss_number_layers; | 347 oxcf->ss_number_layers = cfg.ss_number_layers; |
339 /* | 348 /* |
340 printf("Current VP9 Settings: \n"); | 349 printf("Current VP9 Settings: \n"); |
341 printf("target_bandwidth: %d\n", oxcf->target_bandwidth); | 350 printf("target_bandwidth: %d\n", oxcf->target_bandwidth); |
342 printf("noise_sensitivity: %d\n", oxcf->noise_sensitivity); | 351 printf("noise_sensitivity: %d\n", oxcf->noise_sensitivity); |
343 printf("Sharpness: %d\n", oxcf->Sharpness); | 352 printf("Sharpness: %d\n", oxcf->Sharpness); |
344 printf("cpu_used: %d\n", oxcf->cpu_used); | 353 printf("cpu_used: %d\n", oxcf->cpu_used); |
345 printf("Mode: %d\n", oxcf->Mode); | 354 printf("Mode: %d\n", oxcf->Mode); |
346 // printf("delete_first_pass_file: %d\n", oxcf->delete_first_pass_file); | 355 // printf("delete_first_pass_file: %d\n", oxcf->delete_first_pass_file); |
347 printf("auto_key: %d\n", oxcf->auto_key); | 356 printf("auto_key: %d\n", oxcf->auto_key); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 MAP(VP8E_SET_NOISE_SENSITIVITY, xcfg.noise_sensitivity); | 444 MAP(VP8E_SET_NOISE_SENSITIVITY, xcfg.noise_sensitivity); |
436 MAP(VP8E_SET_SHARPNESS, xcfg.Sharpness); | 445 MAP(VP8E_SET_SHARPNESS, xcfg.Sharpness); |
437 MAP(VP8E_SET_STATIC_THRESHOLD, xcfg.static_thresh); | 446 MAP(VP8E_SET_STATIC_THRESHOLD, xcfg.static_thresh); |
438 MAP(VP9E_SET_TILE_COLUMNS, xcfg.tile_columns); | 447 MAP(VP9E_SET_TILE_COLUMNS, xcfg.tile_columns); |
439 MAP(VP9E_SET_TILE_ROWS, xcfg.tile_rows); | 448 MAP(VP9E_SET_TILE_ROWS, xcfg.tile_rows); |
440 MAP(VP8E_SET_ARNR_MAXFRAMES, xcfg.arnr_max_frames); | 449 MAP(VP8E_SET_ARNR_MAXFRAMES, xcfg.arnr_max_frames); |
441 MAP(VP8E_SET_ARNR_STRENGTH, xcfg.arnr_strength); | 450 MAP(VP8E_SET_ARNR_STRENGTH, xcfg.arnr_strength); |
442 MAP(VP8E_SET_ARNR_TYPE, xcfg.arnr_type); | 451 MAP(VP8E_SET_ARNR_TYPE, xcfg.arnr_type); |
443 MAP(VP8E_SET_TUNING, xcfg.tuning); | 452 MAP(VP8E_SET_TUNING, xcfg.tuning); |
444 MAP(VP8E_SET_CQ_LEVEL, xcfg.cq_level); | 453 MAP(VP8E_SET_CQ_LEVEL, xcfg.cq_level); |
445 MAP(VP9E_SET_MAX_Q, ctx->cfg.rc_max_quantizer); | |
446 MAP(VP9E_SET_MIN_Q, ctx->cfg.rc_min_quantizer); | |
447 MAP(VP8E_SET_MAX_INTRA_BITRATE_PCT, xcfg.rc_max_intra_bitrate_pct); | 454 MAP(VP8E_SET_MAX_INTRA_BITRATE_PCT, xcfg.rc_max_intra_bitrate_pct); |
448 MAP(VP9E_SET_LOSSLESS, xcfg.lossless); | 455 MAP(VP9E_SET_LOSSLESS, xcfg.lossless); |
449 MAP(VP9E_SET_FRAME_PARALLEL_DECODING, xcfg.frame_parallel_decoding_mode); | 456 MAP(VP9E_SET_FRAME_PARALLEL_DECODING, xcfg.frame_parallel_decoding_mode); |
| 457 MAP(VP9E_SET_AQ_MODE, xcfg.aq_mode); |
450 } | 458 } |
451 | 459 |
452 res = validate_config(ctx, &ctx->cfg, &xcfg); | 460 res = validate_config(ctx, &ctx->cfg, &xcfg); |
453 | 461 |
454 if (!res) { | 462 if (!res) { |
455 ctx->vp8_cfg = xcfg; | 463 ctx->vp8_cfg = xcfg; |
456 set_vp9e_config(&ctx->oxcf, ctx->cfg, ctx->vp8_cfg); | 464 set_vp9e_config(&ctx->oxcf, ctx->cfg, ctx->vp8_cfg); |
457 vp9_change_config(ctx->cpi, &ctx->oxcf); | 465 vp9_change_config(ctx->cpi, &ctx->oxcf); |
458 } | 466 } |
459 | 467 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 flags |= VPX_EFLAG_FORCE_KF; | 701 flags |= VPX_EFLAG_FORCE_KF; |
694 ctx->fixed_kf_cntr = 1; | 702 ctx->fixed_kf_cntr = 1; |
695 } | 703 } |
696 } | 704 } |
697 | 705 |
698 /* Initialize the encoder instance on the first frame*/ | 706 /* Initialize the encoder instance on the first frame*/ |
699 if (!res && ctx->cpi) { | 707 if (!res && ctx->cpi) { |
700 unsigned int lib_flags; | 708 unsigned int lib_flags; |
701 YV12_BUFFER_CONFIG sd; | 709 YV12_BUFFER_CONFIG sd; |
702 int64_t dst_time_stamp, dst_end_time_stamp; | 710 int64_t dst_time_stamp, dst_end_time_stamp; |
703 unsigned long size, cx_data_sz; | 711 size_t size, cx_data_sz; |
704 unsigned char *cx_data; | 712 unsigned char *cx_data; |
705 | 713 |
706 /* Set up internal flags */ | 714 /* Set up internal flags */ |
707 if (ctx->base.init_flags & VPX_CODEC_USE_PSNR) | 715 if (ctx->base.init_flags & VPX_CODEC_USE_PSNR) |
708 ((VP9_COMP *)ctx->cpi)->b_calculate_psnr = 1; | 716 ((VP9_COMP *)ctx->cpi)->b_calculate_psnr = 1; |
709 | 717 |
710 // if (ctx->base.init_flags & VPX_CODEC_USE_OUTPUT_PARTITION) | 718 // if (ctx->base.init_flags & VPX_CODEC_USE_OUTPUT_PARTITION) |
711 // ((VP9_COMP *)ctx->cpi)->output_partition = 1; | 719 // ((VP9_COMP *)ctx->cpi)->output_partition = 1; |
712 | 720 |
713 /* Convert API flags to internal codec lib flags */ | 721 /* Convert API flags to internal codec lib flags */ |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 if (!res) { | 1010 if (!res) { |
1003 return VPX_CODEC_OK; | 1011 return VPX_CODEC_OK; |
1004 } else { | 1012 } else { |
1005 return VPX_CODEC_INVALID_PARAM; | 1013 return VPX_CODEC_INVALID_PARAM; |
1006 } | 1014 } |
1007 } else { | 1015 } else { |
1008 return VPX_CODEC_INVALID_PARAM; | 1016 return VPX_CODEC_INVALID_PARAM; |
1009 } | 1017 } |
1010 } | 1018 } |
1011 | 1019 |
1012 static vpx_codec_err_t vp9e_set_width(vpx_codec_alg_priv_t *ctx, int ctr_id, | |
1013 va_list args) { | |
1014 unsigned int *data = va_arg(args, unsigned int *); | |
1015 if (data) { | |
1016 int res; | |
1017 res = vp9_set_size_literal(ctx->cpi, *data, 0); | |
1018 if (!res) { | |
1019 return VPX_CODEC_OK; | |
1020 } else { | |
1021 return VPX_CODEC_INVALID_PARAM; | |
1022 } | |
1023 } else { | |
1024 return VPX_CODEC_INVALID_PARAM; | |
1025 } | |
1026 } | |
1027 | |
1028 static vpx_codec_err_t vp9e_set_height(vpx_codec_alg_priv_t *ctx, | |
1029 int ctr_id, | |
1030 va_list args) { | |
1031 unsigned int *data = va_arg(args, unsigned int *); | |
1032 | |
1033 if (data) { | |
1034 int res; | |
1035 res = vp9_set_size_literal(ctx->cpi, 0, *data); | |
1036 | |
1037 if (!res) { | |
1038 return VPX_CODEC_OK; | |
1039 } else { | |
1040 return VPX_CODEC_INVALID_PARAM; | |
1041 } | |
1042 } else { | |
1043 return VPX_CODEC_INVALID_PARAM; | |
1044 } | |
1045 } | |
1046 | |
1047 static vpx_codec_err_t vp9e_set_layer(vpx_codec_alg_priv_t *ctx, | |
1048 int ctr_id, | |
1049 va_list args) { | |
1050 unsigned int *data = va_arg(args, unsigned int *); | |
1051 | |
1052 if (data) { | |
1053 int res; | |
1054 res = 0; | |
1055 | |
1056 res = vp9_switch_layer(ctx->cpi, *data); | |
1057 | |
1058 if (!res) { | |
1059 return VPX_CODEC_OK; | |
1060 } else { | |
1061 return VPX_CODEC_INVALID_PARAM; | |
1062 } | |
1063 } else { | |
1064 return VPX_CODEC_INVALID_PARAM; | |
1065 } | |
1066 } | |
1067 | |
1068 static vpx_codec_err_t vp9e_set_svc(vpx_codec_alg_priv_t *ctx, int ctr_id, | 1020 static vpx_codec_err_t vp9e_set_svc(vpx_codec_alg_priv_t *ctx, int ctr_id, |
1069 va_list args) { | 1021 va_list args) { |
1070 int data = va_arg(args, int); | 1022 int data = va_arg(args, int); |
1071 vp9_set_svc(ctx->cpi, data); | 1023 vp9_set_svc(ctx->cpi, data); |
1072 return VPX_CODEC_OK; | 1024 return VPX_CODEC_OK; |
1073 } | 1025 } |
1074 | 1026 |
| 1027 static vpx_codec_err_t vp9e_set_svc_parameters(vpx_codec_alg_priv_t *ctx, |
| 1028 int ctr_id, va_list args) { |
| 1029 vpx_svc_parameters_t *data = va_arg(args, vpx_svc_parameters_t *); |
| 1030 VP9_COMP *cpi = (VP9_COMP *)ctx->cpi; |
| 1031 vpx_svc_parameters_t params; |
| 1032 |
| 1033 if (data == NULL) { |
| 1034 return VPX_CODEC_INVALID_PARAM; |
| 1035 } |
| 1036 |
| 1037 params = *(vpx_svc_parameters_t *)data; |
| 1038 |
| 1039 cpi->current_layer = params.layer; |
| 1040 cpi->lst_fb_idx = params.lst_fb_idx; |
| 1041 cpi->gld_fb_idx = params.gld_fb_idx; |
| 1042 cpi->alt_fb_idx = params.alt_fb_idx; |
| 1043 |
| 1044 if (vp9_set_size_literal(ctx->cpi, params.width, params.height) != 0) { |
| 1045 return VPX_CODEC_INVALID_PARAM; |
| 1046 } |
| 1047 |
| 1048 ctx->cfg.rc_max_quantizer = params.max_quantizer; |
| 1049 ctx->cfg.rc_min_quantizer = params.min_quantizer; |
| 1050 |
| 1051 set_vp9e_config(&ctx->oxcf, ctx->cfg, ctx->vp8_cfg); |
| 1052 vp9_change_config(ctx->cpi, &ctx->oxcf); |
| 1053 |
| 1054 return VPX_CODEC_OK; |
| 1055 } |
| 1056 |
1075 static vpx_codec_ctrl_fn_map_t vp9e_ctf_maps[] = { | 1057 static vpx_codec_ctrl_fn_map_t vp9e_ctf_maps[] = { |
1076 {VP8_SET_REFERENCE, vp9e_set_reference}, | 1058 {VP8_SET_REFERENCE, vp9e_set_reference}, |
1077 {VP8_COPY_REFERENCE, vp9e_copy_reference}, | 1059 {VP8_COPY_REFERENCE, vp9e_copy_reference}, |
1078 {VP8_SET_POSTPROC, vp9e_set_previewpp}, | 1060 {VP8_SET_POSTPROC, vp9e_set_previewpp}, |
1079 {VP8E_UPD_ENTROPY, vp9e_update_entropy}, | 1061 {VP8E_UPD_ENTROPY, vp9e_update_entropy}, |
1080 {VP8E_UPD_REFERENCE, vp9e_update_reference}, | 1062 {VP8E_UPD_REFERENCE, vp9e_update_reference}, |
1081 {VP8E_USE_REFERENCE, vp9e_use_reference}, | 1063 {VP8E_USE_REFERENCE, vp9e_use_reference}, |
1082 {VP8E_SET_ROI_MAP, vp9e_set_roi_map}, | 1064 {VP8E_SET_ROI_MAP, vp9e_set_roi_map}, |
1083 {VP8E_SET_ACTIVEMAP, vp9e_set_activemap}, | 1065 {VP8E_SET_ACTIVEMAP, vp9e_set_activemap}, |
1084 {VP8E_SET_SCALEMODE, vp9e_set_scalemode}, | 1066 {VP8E_SET_SCALEMODE, vp9e_set_scalemode}, |
1085 {VP8E_SET_CPUUSED, set_param}, | 1067 {VP8E_SET_CPUUSED, set_param}, |
1086 {VP8E_SET_NOISE_SENSITIVITY, set_param}, | 1068 {VP8E_SET_NOISE_SENSITIVITY, set_param}, |
1087 {VP8E_SET_ENABLEAUTOALTREF, set_param}, | 1069 {VP8E_SET_ENABLEAUTOALTREF, set_param}, |
1088 {VP8E_SET_SHARPNESS, set_param}, | 1070 {VP8E_SET_SHARPNESS, set_param}, |
1089 {VP8E_SET_STATIC_THRESHOLD, set_param}, | 1071 {VP8E_SET_STATIC_THRESHOLD, set_param}, |
1090 {VP9E_SET_TILE_COLUMNS, set_param}, | 1072 {VP9E_SET_TILE_COLUMNS, set_param}, |
1091 {VP9E_SET_TILE_ROWS, set_param}, | 1073 {VP9E_SET_TILE_ROWS, set_param}, |
1092 {VP8E_GET_LAST_QUANTIZER, get_param}, | 1074 {VP8E_GET_LAST_QUANTIZER, get_param}, |
1093 {VP8E_GET_LAST_QUANTIZER_64, get_param}, | 1075 {VP8E_GET_LAST_QUANTIZER_64, get_param}, |
1094 {VP8E_SET_ARNR_MAXFRAMES, set_param}, | 1076 {VP8E_SET_ARNR_MAXFRAMES, set_param}, |
1095 {VP8E_SET_ARNR_STRENGTH, set_param}, | 1077 {VP8E_SET_ARNR_STRENGTH, set_param}, |
1096 {VP8E_SET_ARNR_TYPE, set_param}, | 1078 {VP8E_SET_ARNR_TYPE, set_param}, |
1097 {VP8E_SET_TUNING, set_param}, | 1079 {VP8E_SET_TUNING, set_param}, |
1098 {VP8E_SET_CQ_LEVEL, set_param}, | 1080 {VP8E_SET_CQ_LEVEL, set_param}, |
1099 {VP9E_SET_MAX_Q, set_param}, | |
1100 {VP9E_SET_MIN_Q, set_param}, | |
1101 {VP8E_SET_MAX_INTRA_BITRATE_PCT, set_param}, | 1081 {VP8E_SET_MAX_INTRA_BITRATE_PCT, set_param}, |
1102 {VP9E_SET_LOSSLESS, set_param}, | 1082 {VP9E_SET_LOSSLESS, set_param}, |
1103 {VP9E_SET_FRAME_PARALLEL_DECODING, set_param}, | 1083 {VP9E_SET_FRAME_PARALLEL_DECODING, set_param}, |
| 1084 {VP9E_SET_AQ_MODE, set_param}, |
1104 {VP9_GET_REFERENCE, get_reference}, | 1085 {VP9_GET_REFERENCE, get_reference}, |
1105 {VP9E_SET_WIDTH, vp9e_set_width}, | |
1106 {VP9E_SET_HEIGHT, vp9e_set_height}, | |
1107 {VP9E_SET_LAYER, vp9e_set_layer}, | |
1108 {VP9E_SET_SVC, vp9e_set_svc}, | 1086 {VP9E_SET_SVC, vp9e_set_svc}, |
| 1087 {VP9E_SET_SVC_PARAMETERS, vp9e_set_svc_parameters}, |
1109 { -1, NULL}, | 1088 { -1, NULL}, |
1110 }; | 1089 }; |
1111 | 1090 |
1112 static vpx_codec_enc_cfg_map_t vp9e_usage_cfg_map[] = { | 1091 static vpx_codec_enc_cfg_map_t vp9e_usage_cfg_map[] = { |
1113 { | 1092 { |
1114 0, | 1093 0, |
1115 { // NOLINT | 1094 { // NOLINT |
1116 0, /* g_usage */ | 1095 0, /* g_usage */ |
1117 0, /* g_threads */ | 1096 0, /* g_threads */ |
1118 0, /* g_profile */ | 1097 0, /* g_profile */ |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 { // NOLINT | 1198 { // NOLINT |
1220 vp9e_usage_cfg_map, /* vpx_codec_enc_cfg_map_t peek_si; */ | 1199 vp9e_usage_cfg_map, /* vpx_codec_enc_cfg_map_t peek_si; */ |
1221 vp9e_encode, /* vpx_codec_encode_fn_t encode; */ | 1200 vp9e_encode, /* vpx_codec_encode_fn_t encode; */ |
1222 vp9e_get_cxdata, /* vpx_codec_get_cx_data_fn_t frame_get; */ | 1201 vp9e_get_cxdata, /* vpx_codec_get_cx_data_fn_t frame_get; */ |
1223 vp9e_set_config, | 1202 vp9e_set_config, |
1224 NOT_IMPLEMENTED, | 1203 NOT_IMPLEMENTED, |
1225 vp9e_get_preview, | 1204 vp9e_get_preview, |
1226 } /* encoder functions */ | 1205 } /* encoder functions */ |
1227 }; | 1206 }; |
1228 #endif | 1207 #endif |
OLD | NEW |