| 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 |
| 11 #include <stdlib.h> |
| 12 #include <string.h> |
| 11 | 13 |
| 12 #include "vpx/vpx_codec.h" | 14 #include "vpx/vpx_codec.h" |
| 13 #include "vpx/internal/vpx_codec_internal.h" | 15 #include "vpx/internal/vpx_codec_internal.h" |
| 14 #include "vpx_version.h" | 16 #include "./vpx_version.h" |
| 15 #include "vp9/encoder/vp9_onyx_int.h" | 17 #include "vp9/encoder/vp9_onyx_int.h" |
| 16 #include "vpx/vp8cx.h" | 18 #include "vpx/vp8cx.h" |
| 17 #include "vp9/encoder/vp9_firstpass.h" | 19 #include "vp9/encoder/vp9_firstpass.h" |
| 18 #include "vp9/common/vp9_onyx.h" | 20 #include "vp9/common/vp9_onyx.h" |
| 19 #include "vp9/vp9_iface_common.h" | 21 #include "vp9/vp9_iface_common.h" |
| 20 #include <stdlib.h> | |
| 21 #include <string.h> | |
| 22 | 22 |
| 23 struct vp9_extracfg { | 23 struct vp9_extracfg { |
| 24 struct vpx_codec_pkt_list *pkt_list; | 24 struct vpx_codec_pkt_list *pkt_list; |
| 25 int cpu_used; /** available cpu per
centage in 1/16*/ | 25 int cpu_used; /* available cpu percentage in 1/16 */ |
| 26 unsigned int enable_auto_alt_ref; /** if encoder deci
des to uses alternate reference frame */ | 26 unsigned int enable_auto_alt_ref; |
| 27 unsigned int noise_sensitivity; | 27 unsigned int noise_sensitivity; |
| 28 unsigned int Sharpness; | 28 unsigned int Sharpness; |
| 29 unsigned int static_thresh; | 29 unsigned int static_thresh; |
| 30 unsigned int tile_columns; | 30 unsigned int tile_columns; |
| 31 unsigned int tile_rows; | 31 unsigned int tile_rows; |
| 32 unsigned int arnr_max_frames; /* alt_ref Noise Reduction Max
Frame Count */ | 32 unsigned int arnr_max_frames; |
| 33 unsigned int arnr_strength; /* alt_ref Noise Reduction Stren
gth */ | 33 unsigned int arnr_strength; |
| 34 unsigned int arnr_type; /* alt_ref filter 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 }; | 41 }; |
| 42 | 42 |
| 43 struct extraconfig_map { | 43 struct extraconfig_map { |
| 44 int usage; | 44 int usage; |
| 45 struct vp9_extracfg cfg; | 45 struct vp9_extracfg cfg; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 static const struct extraconfig_map extracfg_map[] = { | 48 static const struct extraconfig_map extracfg_map[] = { |
| 49 { | 49 { |
| 50 0, | 50 0, |
| 51 { | 51 { // NOLINT |
| 52 NULL, | 52 NULL, |
| 53 0, /* cpu_used */ | 53 0, /* cpu_used */ |
| 54 1, /* enable_auto_alt_ref */ | 54 1, /* enable_auto_alt_ref */ |
| 55 0, /* noise_sensitivity */ | 55 0, /* noise_sensitivity */ |
| 56 0, /* Sharpness */ | 56 0, /* Sharpness */ |
| 57 0, /* static_thresh */ | 57 0, /* static_thresh */ |
| 58 0, /* tile_columns */ | 58 0, /* tile_columns */ |
| 59 0, /* tile_rows */ | 59 0, /* tile_rows */ |
| 60 7, /* arnr_max_frames */ | 60 7, /* arnr_max_frames */ |
| 61 5, /* arnr_strength */ | 61 5, /* arnr_strength */ |
| (...skipping 16 matching lines...) Expand all Loading... |
| 78 VP9_PTR cpi; | 78 VP9_PTR cpi; |
| 79 unsigned char *cx_data; | 79 unsigned char *cx_data; |
| 80 unsigned int cx_data_sz; | 80 unsigned int cx_data_sz; |
| 81 unsigned char *pending_cx_data; | 81 unsigned char *pending_cx_data; |
| 82 unsigned int pending_cx_data_sz; | 82 unsigned int pending_cx_data_sz; |
| 83 int pending_frame_count; | 83 int pending_frame_count; |
| 84 uint32_t pending_frame_sizes[8]; | 84 uint32_t pending_frame_sizes[8]; |
| 85 uint32_t pending_frame_magnitude; | 85 uint32_t pending_frame_magnitude; |
| 86 vpx_image_t preview_img; | 86 vpx_image_t preview_img; |
| 87 vp8_postproc_cfg_t preview_ppcfg; | 87 vp8_postproc_cfg_t preview_ppcfg; |
| 88 vpx_codec_pkt_list_decl(64) pkt_list; // changed to accomendate t
he maximum number of lagged frames allowed | 88 vpx_codec_pkt_list_decl(64) pkt_list; |
| 89 unsigned int fixed_kf_cntr; | 89 unsigned int fixed_kf_cntr; |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 static const VP9_REFFRAME ref_frame_to_vp9_reframe(vpx_ref_frame_type_t frame) { | 92 static VP9_REFFRAME ref_frame_to_vp9_reframe(vpx_ref_frame_type_t frame) { |
| 93 switch (frame) { | 93 switch (frame) { |
| 94 case VP8_LAST_FRAME: | 94 case VP8_LAST_FRAME: |
| 95 return VP9_LAST_FLAG; | 95 return VP9_LAST_FLAG; |
| 96 case VP8_GOLD_FRAME: | 96 case VP8_GOLD_FRAME: |
| 97 return VP9_GOLD_FLAG; | 97 return VP9_GOLD_FLAG; |
| 98 case VP8_ALTR_FRAME: | 98 case VP8_ALTR_FRAME: |
| 99 return VP9_ALT_FLAG; | 99 return VP9_ALT_FLAG; |
| 100 } | 100 } |
| 101 assert(!"Invalid Reference Frame"); | 101 assert(!"Invalid Reference Frame"); |
| 102 return VP9_LAST_FLAG; | 102 return VP9_LAST_FLAG; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 113 : NULL; | 113 : NULL; |
| 114 | 114 |
| 115 return res; | 115 return res; |
| 116 } | 116 } |
| 117 | 117 |
| 118 | 118 |
| 119 #undef ERROR | 119 #undef ERROR |
| 120 #define ERROR(str) do {\ | 120 #define ERROR(str) do {\ |
| 121 ctx->base.err_detail = str;\ | 121 ctx->base.err_detail = str;\ |
| 122 return VPX_CODEC_INVALID_PARAM;\ | 122 return VPX_CODEC_INVALID_PARAM;\ |
| 123 } while(0) | 123 } while (0) |
| 124 | 124 |
| 125 #define RANGE_CHECK(p,memb,lo,hi) do {\ | 125 #define RANGE_CHECK(p, memb, lo, hi) do {\ |
| 126 if(!(((p)->memb == lo || (p)->memb > (lo)) && (p)->memb <= hi)) \ | 126 if (!(((p)->memb == lo || (p)->memb > (lo)) && (p)->memb <= hi)) \ |
| 127 ERROR(#memb " out of range ["#lo".."#hi"]");\ | 127 ERROR(#memb " out of range ["#lo".."#hi"]");\ |
| 128 } while(0) | 128 } while (0) |
| 129 | 129 |
| 130 #define RANGE_CHECK_HI(p,memb,hi) do {\ | 130 #define RANGE_CHECK_HI(p, memb, hi) do {\ |
| 131 if(!((p)->memb <= (hi))) \ | 131 if (!((p)->memb <= (hi))) \ |
| 132 ERROR(#memb " out of range [.."#hi"]");\ | 132 ERROR(#memb " out of range [.."#hi"]");\ |
| 133 } while(0) | 133 } while (0) |
| 134 | 134 |
| 135 #define RANGE_CHECK_LO(p,memb,lo) do {\ | 135 #define RANGE_CHECK_LO(p, memb, lo) do {\ |
| 136 if(!((p)->memb >= (lo))) \ | 136 if (!((p)->memb >= (lo))) \ |
| 137 ERROR(#memb " out of range ["#lo"..]");\ | 137 ERROR(#memb " out of range ["#lo"..]");\ |
| 138 } while(0) | 138 } while (0) |
| 139 | 139 |
| 140 #define RANGE_CHECK_BOOL(p,memb) do {\ | 140 #define RANGE_CHECK_BOOL(p, memb) do {\ |
| 141 if(!!((p)->memb) != (p)->memb) ERROR(#memb " expected boolean");\ | 141 if (!!((p)->memb) != (p)->memb) ERROR(#memb " expected boolean");\ |
| 142 } while(0) | 142 } while (0) |
| 143 | 143 |
| 144 static vpx_codec_err_t validate_config(vpx_codec_alg_priv_t *ctx, | 144 static vpx_codec_err_t validate_config(vpx_codec_alg_priv_t *ctx, |
| 145 const vpx_codec_enc_cfg_t *cfg, | 145 const vpx_codec_enc_cfg_t *cfg, |
| 146 const struct vp9_extracfg *vp8_cfg) { | 146 const struct vp9_extracfg *vp8_cfg) { |
| 147 RANGE_CHECK(cfg, g_w, 1, 65535); /* 16 bits available */ | 147 RANGE_CHECK(cfg, g_w, 1, 65535); /* 16 bits available */ |
| 148 RANGE_CHECK(cfg, g_h, 1, 65535); /* 16 bits available */ | 148 RANGE_CHECK(cfg, g_h, 1, 65535); /* 16 bits available */ |
| 149 RANGE_CHECK(cfg, g_timebase.den, 1, 1000000000); | 149 RANGE_CHECK(cfg, g_timebase.den, 1, 1000000000); |
| 150 RANGE_CHECK(cfg, g_timebase.num, 1, cfg->g_timebase.den); | 150 RANGE_CHECK(cfg, g_timebase.num, 1, cfg->g_timebase.den); |
| 151 RANGE_CHECK_HI(cfg, g_profile, 3); | 151 RANGE_CHECK_HI(cfg, g_profile, 3); |
| 152 | 152 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 } | 240 } |
| 241 | 241 |
| 242 | 242 |
| 243 static vpx_codec_err_t set_vp9e_config(VP9_CONFIG *oxcf, | 243 static vpx_codec_err_t set_vp9e_config(VP9_CONFIG *oxcf, |
| 244 vpx_codec_enc_cfg_t cfg, | 244 vpx_codec_enc_cfg_t cfg, |
| 245 struct vp9_extracfg vp8_cfg) { | 245 struct vp9_extracfg vp8_cfg) { |
| 246 oxcf->version = cfg.g_profile | (vp8_cfg.experimental ? 0x4 : 0); | 246 oxcf->version = cfg.g_profile | (vp8_cfg.experimental ? 0x4 : 0); |
| 247 oxcf->width = cfg.g_w; | 247 oxcf->width = cfg.g_w; |
| 248 oxcf->height = cfg.g_h; | 248 oxcf->height = cfg.g_h; |
| 249 /* guess a frame rate if out of whack, use 30 */ | 249 /* guess a frame rate if out of whack, use 30 */ |
| 250 oxcf->framerate = (double)(cfg.g_timebase.den) / (double)(cfg.g_ti
mebase.num); | 250 oxcf->framerate = (double)(cfg.g_timebase.den) |
| 251 / (double)(cfg.g_timebase.num); |
| 251 | 252 |
| 252 if (oxcf->framerate > 180) { | 253 if (oxcf->framerate > 180) { |
| 253 oxcf->framerate = 30; | 254 oxcf->framerate = 30; |
| 254 } | 255 } |
| 255 | 256 |
| 256 switch (cfg.g_pass) { | 257 switch (cfg.g_pass) { |
| 257 case VPX_RC_ONE_PASS: | 258 case VPX_RC_ONE_PASS: |
| 258 oxcf->Mode = MODE_BESTQUALITY; | 259 oxcf->Mode = MODE_GOODQUALITY; |
| 259 break; | 260 break; |
| 260 case VPX_RC_FIRST_PASS: | 261 case VPX_RC_FIRST_PASS: |
| 261 oxcf->Mode = MODE_FIRSTPASS; | 262 oxcf->Mode = MODE_FIRSTPASS; |
| 262 break; | 263 break; |
| 263 case VPX_RC_LAST_PASS: | 264 case VPX_RC_LAST_PASS: |
| 264 oxcf->Mode = MODE_SECONDPASS_BEST; | 265 oxcf->Mode = MODE_SECONDPASS_BEST; |
| 265 break; | 266 break; |
| 266 } | 267 } |
| 267 | 268 |
| 268 if (cfg.g_pass == VPX_RC_FIRST_PASS) { | 269 if (cfg.g_pass == VPX_RC_FIRST_PASS) { |
| 269 oxcf->allow_lag = 0; | 270 oxcf->allow_lag = 0; |
| 270 oxcf->lag_in_frames = 0; | 271 oxcf->lag_in_frames = 0; |
| 271 } else { | 272 } else { |
| 272 oxcf->allow_lag = (cfg.g_lag_in_frames) > 0; | 273 oxcf->allow_lag = (cfg.g_lag_in_frames) > 0; |
| 273 oxcf->lag_in_frames = cfg.g_lag_in_frames; | 274 oxcf->lag_in_frames = cfg.g_lag_in_frames; |
| 274 } | 275 } |
| 275 | 276 |
| 276 // VBR only supported for now. | 277 // VBR only supported for now. |
| 277 // CBR code has been deprectated for experimental phase. | 278 // CBR code has been deprectated for experimental phase. |
| 278 // CQ mode not yet tested | 279 // CQ mode not yet tested |
| 279 oxcf->end_usage = USAGE_LOCAL_FILE_PLAYBACK; | 280 oxcf->end_usage = USAGE_LOCAL_FILE_PLAYBACK; |
| 280 /* | |
| 281 if (cfg.rc_end_usage == VPX_CQ) | 281 if (cfg.rc_end_usage == VPX_CQ) |
| 282 oxcf->end_usage = USAGE_CONSTRAINED_QUALITY; | 282 oxcf->end_usage = USAGE_CONSTRAINED_QUALITY; |
| 283 */ | 283 else if (cfg.rc_end_usage == VPX_Q) |
| 284 if (cfg.rc_end_usage == VPX_Q) | |
| 285 oxcf->end_usage = USAGE_CONSTANT_QUALITY; | 284 oxcf->end_usage = USAGE_CONSTANT_QUALITY; |
| 285 else if (cfg.rc_end_usage == VPX_CBR) |
| 286 oxcf->end_usage = USAGE_STREAM_FROM_SERVER; |
| 286 | 287 |
| 287 oxcf->target_bandwidth = cfg.rc_target_bitrate; | 288 oxcf->target_bandwidth = cfg.rc_target_bitrate; |
| 288 oxcf->rc_max_intra_bitrate_pct = vp8_cfg.rc_max_intra_bitrate_pct; | 289 oxcf->rc_max_intra_bitrate_pct = vp8_cfg.rc_max_intra_bitrate_pct; |
| 289 | 290 |
| 290 oxcf->best_allowed_q = cfg.rc_min_quantizer; | 291 oxcf->best_allowed_q = cfg.rc_min_quantizer; |
| 291 oxcf->worst_allowed_q = cfg.rc_max_quantizer; | 292 oxcf->worst_allowed_q = cfg.rc_max_quantizer; |
| 292 oxcf->cq_level = vp8_cfg.cq_level; | 293 oxcf->cq_level = vp8_cfg.cq_level; |
| 293 oxcf->fixed_q = -1; | 294 oxcf->fixed_q = -1; |
| 294 | 295 |
| 295 oxcf->under_shoot_pct = cfg.rc_undershoot_pct; | 296 oxcf->under_shoot_pct = cfg.rc_undershoot_pct; |
| 296 oxcf->over_shoot_pct = cfg.rc_overshoot_pct; | 297 oxcf->over_shoot_pct = cfg.rc_overshoot_pct; |
| 297 | 298 |
| 298 oxcf->maximum_buffer_size = cfg.rc_buf_sz; | 299 oxcf->maximum_buffer_size = cfg.rc_buf_sz; |
| 299 oxcf->starting_buffer_level = cfg.rc_buf_initial_sz; | 300 oxcf->starting_buffer_level = cfg.rc_buf_initial_sz; |
| 300 oxcf->optimal_buffer_level = cfg.rc_buf_optimal_sz; | 301 oxcf->optimal_buffer_level = cfg.rc_buf_optimal_sz; |
| 301 | 302 |
| 302 oxcf->two_pass_vbrbias = cfg.rc_2pass_vbr_bias_pct; | 303 oxcf->two_pass_vbrbias = cfg.rc_2pass_vbr_bias_pct; |
| 303 oxcf->two_pass_vbrmin_section = cfg.rc_2pass_vbr_minsection_pct; | 304 oxcf->two_pass_vbrmin_section = cfg.rc_2pass_vbr_minsection_pct; |
| 304 oxcf->two_pass_vbrmax_section = cfg.rc_2pass_vbr_maxsection_pct; | 305 oxcf->two_pass_vbrmax_section = cfg.rc_2pass_vbr_maxsection_pct; |
| 305 | 306 |
| 306 oxcf->auto_key = cfg.kf_mode == VPX_KF_AUTO | 307 oxcf->auto_key = cfg.kf_mode == VPX_KF_AUTO |
| 307 && cfg.kf_min_dist != cfg.kf_max_dist; | 308 && cfg.kf_min_dist != cfg.kf_max_dist; |
| 308 // oxcf->kf_min_dist = cfg.kf_min_dis; | 309 // oxcf->kf_min_dist = cfg.kf_min_dis; |
| 309 oxcf->key_freq = cfg.kf_max_dist; | 310 oxcf->key_freq = cfg.kf_max_dist; |
| 310 | 311 |
| 311 // oxcf->delete_first_pass_file = cfg.g_delete_firstpassfile; | 312 // oxcf->delete_first_pass_file = cfg.g_delete_firstpassfile; |
| 312 // strcpy(oxcf->first_pass_file, cfg.g_firstpass_file); | 313 // strcpy(oxcf->first_pass_file, cfg.g_firstpass_file); |
| 313 | 314 |
| 314 oxcf->cpu_used = vp8_cfg.cpu_used; | 315 oxcf->cpu_used = vp8_cfg.cpu_used; |
| 315 oxcf->encode_breakout = vp8_cfg.static_thresh; | 316 oxcf->encode_breakout = vp8_cfg.static_thresh; |
| 316 oxcf->play_alternate = vp8_cfg.enable_auto_alt_ref; | 317 oxcf->play_alternate = vp8_cfg.enable_auto_alt_ref; |
| 317 oxcf->noise_sensitivity = vp8_cfg.noise_sensitivity; | 318 oxcf->noise_sensitivity = vp8_cfg.noise_sensitivity; |
| 318 oxcf->Sharpness = vp8_cfg.Sharpness; | 319 oxcf->Sharpness = vp8_cfg.Sharpness; |
| 319 | 320 |
| 320 oxcf->two_pass_stats_in = cfg.rc_twopass_stats_in; | 321 oxcf->two_pass_stats_in = cfg.rc_twopass_stats_in; |
| 321 oxcf->output_pkt_list = vp8_cfg.pkt_list; | 322 oxcf->output_pkt_list = vp8_cfg.pkt_list; |
| 322 | 323 |
| 323 oxcf->arnr_max_frames = vp8_cfg.arnr_max_frames; | 324 oxcf->arnr_max_frames = vp8_cfg.arnr_max_frames; |
| 324 oxcf->arnr_strength = vp8_cfg.arnr_strength; | 325 oxcf->arnr_strength = vp8_cfg.arnr_strength; |
| 325 oxcf->arnr_type = vp8_cfg.arnr_type; | 326 oxcf->arnr_type = vp8_cfg.arnr_type; |
| 326 | 327 |
| 327 oxcf->tuning = vp8_cfg.tuning; | 328 oxcf->tuning = vp8_cfg.tuning; |
| 328 | 329 |
| 329 oxcf->tile_columns = vp8_cfg.tile_columns; | 330 oxcf->tile_columns = vp8_cfg.tile_columns; |
| 330 oxcf->tile_rows = vp8_cfg.tile_rows; | 331 oxcf->tile_rows = vp8_cfg.tile_rows; |
| 331 | 332 |
| 332 oxcf->lossless = vp8_cfg.lossless; | 333 oxcf->lossless = vp8_cfg.lossless; |
| 333 | 334 |
| 334 oxcf->error_resilient_mode = cfg.g_error_resilient; | 335 oxcf->error_resilient_mode = cfg.g_error_resilient; |
| 335 oxcf->frame_parallel_decoding_mode = vp8_cfg.frame_parallel_decoding_mode; | 336 oxcf->frame_parallel_decoding_mode = vp8_cfg.frame_parallel_decoding_mode; |
| 336 | 337 |
| 337 oxcf->ss_number_layers = cfg.ss_number_layers; | 338 oxcf->ss_number_layers = cfg.ss_number_layers; |
| 338 /* | 339 /* |
| 339 printf("Current VP9 Settings: \n"); | 340 printf("Current VP9 Settings: \n"); |
| 340 printf("target_bandwidth: %d\n", oxcf->target_bandwidth); | 341 printf("target_bandwidth: %d\n", oxcf->target_bandwidth); |
| 341 printf("noise_sensitivity: %d\n", oxcf->noise_sensitivity); | 342 printf("noise_sensitivity: %d\n", oxcf->noise_sensitivity); |
| 342 printf("Sharpness: %d\n", oxcf->Sharpness); | 343 printf("Sharpness: %d\n", oxcf->Sharpness); |
| 343 printf("cpu_used: %d\n", oxcf->cpu_used); | 344 printf("cpu_used: %d\n", oxcf->cpu_used); |
| 344 printf("Mode: %d\n", oxcf->Mode); | 345 printf("Mode: %d\n", oxcf->Mode); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 } | 494 } |
| 494 | 495 |
| 495 cfg = &ctx->priv->alg_priv->cfg; | 496 cfg = &ctx->priv->alg_priv->cfg; |
| 496 | 497 |
| 497 /* Select the extra vp6 configuration table based on the current | 498 /* Select the extra vp6 configuration table based on the current |
| 498 * usage value. If the current usage value isn't found, use the | 499 * usage value. If the current usage value isn't found, use the |
| 499 * values for usage case 0. | 500 * values for usage case 0. |
| 500 */ | 501 */ |
| 501 for (i = 0; | 502 for (i = 0; |
| 502 extracfg_map[i].usage && extracfg_map[i].usage != cfg->g_usage; | 503 extracfg_map[i].usage && extracfg_map[i].usage != cfg->g_usage; |
| 503 i++); | 504 i++) {} |
| 504 | 505 |
| 505 priv->vp8_cfg = extracfg_map[i].cfg; | 506 priv->vp8_cfg = extracfg_map[i].cfg; |
| 506 priv->vp8_cfg.pkt_list = &priv->pkt_list.head; | 507 priv->vp8_cfg.pkt_list = &priv->pkt_list.head; |
| 507 priv->vp8_cfg.experimental = experimental; | 508 priv->vp8_cfg.experimental = experimental; |
| 508 | 509 |
| 509 // TODO(agrange) Check the limits set on this buffer, or the check that is | 510 // TODO(agrange) Check the limits set on this buffer, or the check that is |
| 510 // applied in vp9e_encode. | 511 // applied in vp9e_encode. |
| 511 priv->cx_data_sz = priv->cfg.g_w * priv->cfg.g_h * 3 / 2 * 8; | 512 priv->cx_data_sz = priv->cfg.g_w * priv->cfg.g_h * 3 / 2 * 8; |
| 512 // priv->cx_data_sz = priv->cfg.g_w * priv->cfg.g_h * 3 / 2 * 2; | 513 // priv->cx_data_sz = priv->cfg.g_w * priv->cfg.g_h * 3 / 2 * 2; |
| 513 | 514 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 | 549 |
| 549 #if CONFIG_EXPERIMENTAL | 550 #if CONFIG_EXPERIMENTAL |
| 550 static vpx_codec_err_t vp9e_exp_init(vpx_codec_ctx_t *ctx, | 551 static vpx_codec_err_t vp9e_exp_init(vpx_codec_ctx_t *ctx, |
| 551 vpx_codec_priv_enc_mr_cfg_t *data) { | 552 vpx_codec_priv_enc_mr_cfg_t *data) { |
| 552 return vp9e_common_init(ctx, 1); | 553 return vp9e_common_init(ctx, 1); |
| 553 } | 554 } |
| 554 #endif | 555 #endif |
| 555 | 556 |
| 556 | 557 |
| 557 static vpx_codec_err_t vp9e_destroy(vpx_codec_alg_priv_t *ctx) { | 558 static vpx_codec_err_t vp9e_destroy(vpx_codec_alg_priv_t *ctx) { |
| 558 | |
| 559 free(ctx->cx_data); | 559 free(ctx->cx_data); |
| 560 vp9_remove_compressor(&ctx->cpi); | 560 vp9_remove_compressor(&ctx->cpi); |
| 561 free(ctx); | 561 free(ctx); |
| 562 return VPX_CODEC_OK; | 562 return VPX_CODEC_OK; |
| 563 } | 563 } |
| 564 | 564 |
| 565 static void pick_quickcompress_mode(vpx_codec_alg_priv_t *ctx, | 565 static void pick_quickcompress_mode(vpx_codec_alg_priv_t *ctx, |
| 566 unsigned long duration, | 566 unsigned long duration, |
| 567 unsigned long deadline) { | 567 unsigned long deadline) { |
| 568 unsigned int new_qc; | 568 unsigned int new_qc; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 if (ctx->base.init_flags & VPX_CODEC_USE_PSNR) | 707 if (ctx->base.init_flags & VPX_CODEC_USE_PSNR) |
| 708 ((VP9_COMP *)ctx->cpi)->b_calculate_psnr = 1; | 708 ((VP9_COMP *)ctx->cpi)->b_calculate_psnr = 1; |
| 709 | 709 |
| 710 // if (ctx->base.init_flags & VPX_CODEC_USE_OUTPUT_PARTITION) | 710 // if (ctx->base.init_flags & VPX_CODEC_USE_OUTPUT_PARTITION) |
| 711 // ((VP9_COMP *)ctx->cpi)->output_partition = 1; | 711 // ((VP9_COMP *)ctx->cpi)->output_partition = 1; |
| 712 | 712 |
| 713 /* Convert API flags to internal codec lib flags */ | 713 /* Convert API flags to internal codec lib flags */ |
| 714 lib_flags = (flags & VPX_EFLAG_FORCE_KF) ? FRAMEFLAGS_KEY : 0; | 714 lib_flags = (flags & VPX_EFLAG_FORCE_KF) ? FRAMEFLAGS_KEY : 0; |
| 715 | 715 |
| 716 /* vp8 use 10,000,000 ticks/second as time stamp */ | 716 /* vp8 use 10,000,000 ticks/second as time stamp */ |
| 717 dst_time_stamp = pts * 10000000 * ctx->cfg.g_timebase.num / ctx->cfg.g_ti
mebase.den; | 717 dst_time_stamp = pts * 10000000 * ctx->cfg.g_timebase.num |
| 718 dst_end_time_stamp = (pts + duration) * 10000000 * ctx->cfg.g_timebase.num /
ctx->cfg.g_timebase.den; | 718 / ctx->cfg.g_timebase.den; |
| 719 dst_end_time_stamp = (pts + duration) * 10000000 * ctx->cfg.g_timebase.num / |
| 720 ctx->cfg.g_timebase.den; |
| 719 | 721 |
| 720 if (img != NULL) { | 722 if (img != NULL) { |
| 721 res = image2yuvconfig(img, &sd); | 723 res = image2yuvconfig(img, &sd); |
| 722 | 724 |
| 723 if (vp9_receive_raw_frame(ctx->cpi, lib_flags, | 725 if (vp9_receive_raw_frame(ctx->cpi, lib_flags, |
| 724 &sd, dst_time_stamp, dst_end_time_stamp)) { | 726 &sd, dst_time_stamp, dst_end_time_stamp)) { |
| 725 VP9_COMP *cpi = (VP9_COMP *)ctx->cpi; | 727 VP9_COMP *cpi = (VP9_COMP *)ctx->cpi; |
| 726 res = update_error_state(ctx, &cpi->common.error); | 728 res = update_error_state(ctx, &cpi->common.error); |
| 727 } | 729 } |
| 728 } | 730 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 ctx->pending_cx_data = cx_data; | 764 ctx->pending_cx_data = cx_data; |
| 763 ctx->pending_cx_data_sz += size; | 765 ctx->pending_cx_data_sz += size; |
| 764 ctx->pending_frame_sizes[ctx->pending_frame_count++] = size; | 766 ctx->pending_frame_sizes[ctx->pending_frame_count++] = size; |
| 765 ctx->pending_frame_magnitude |= size; | 767 ctx->pending_frame_magnitude |= size; |
| 766 cx_data += size; | 768 cx_data += size; |
| 767 cx_data_sz -= size; | 769 cx_data_sz -= size; |
| 768 continue; | 770 continue; |
| 769 } | 771 } |
| 770 | 772 |
| 771 /* Add the frame packet to the list of returned packets. */ | 773 /* Add the frame packet to the list of returned packets. */ |
| 772 round = 1000000 * ctx->cfg.g_timebase.num / 2 - 1; | 774 round = (vpx_codec_pts_t)1000000 * ctx->cfg.g_timebase.num / 2 - 1; |
| 773 delta = (dst_end_time_stamp - dst_time_stamp); | 775 delta = (dst_end_time_stamp - dst_time_stamp); |
| 774 pkt.kind = VPX_CODEC_CX_FRAME_PKT; | 776 pkt.kind = VPX_CODEC_CX_FRAME_PKT; |
| 775 pkt.data.frame.pts = | 777 pkt.data.frame.pts = |
| 776 (dst_time_stamp * ctx->cfg.g_timebase.den + round) | 778 (dst_time_stamp * ctx->cfg.g_timebase.den + round) |
| 777 / ctx->cfg.g_timebase.num / 10000000; | 779 / ctx->cfg.g_timebase.num / 10000000; |
| 778 pkt.data.frame.duration = (unsigned long) | 780 pkt.data.frame.duration = (unsigned long) |
| 779 ((delta * ctx->cfg.g_timebase.den + round) | 781 ((delta * ctx->cfg.g_timebase.den + round) |
| 780 / ctx->cfg.g_timebase.num / 10000000); | 782 / ctx->cfg.g_timebase.num / 10000000); |
| 781 pkt.data.frame.flags = lib_flags << 16; | 783 pkt.data.frame.flags = lib_flags << 16; |
| 782 | 784 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 ctx->pending_frame_magnitude = 0; | 836 ctx->pending_frame_magnitude = 0; |
| 835 } else { | 837 } else { |
| 836 pkt.data.frame.buf = cx_data; | 838 pkt.data.frame.buf = cx_data; |
| 837 pkt.data.frame.sz = size; | 839 pkt.data.frame.sz = size; |
| 838 } | 840 } |
| 839 pkt.data.frame.partition_id = -1; | 841 pkt.data.frame.partition_id = -1; |
| 840 vpx_codec_pkt_list_add(&ctx->pkt_list.head, &pkt); | 842 vpx_codec_pkt_list_add(&ctx->pkt_list.head, &pkt); |
| 841 cx_data += size; | 843 cx_data += size; |
| 842 cx_data_sz -= size; | 844 cx_data_sz -= size; |
| 843 } | 845 } |
| 844 | |
| 845 // printf("timestamp: %lld, duration: %d\n", pkt->data.frame.pts, pkt->d
ata.frame.duration); | |
| 846 } | 846 } |
| 847 } | 847 } |
| 848 } | 848 } |
| 849 | 849 |
| 850 return res; | 850 return res; |
| 851 } | 851 } |
| 852 | 852 |
| 853 | 853 |
| 854 static const vpx_codec_cx_pkt_t *vp9e_get_cxdata(vpx_codec_alg_priv_t *ctx, | 854 static const vpx_codec_cx_pkt_t *vp9e_get_cxdata(vpx_codec_alg_priv_t *ctx, |
| 855 vpx_codec_iter_t *iter) { | 855 vpx_codec_iter_t *iter) { |
| 856 return vpx_codec_pkt_list_get(&ctx->pkt_list.head, iter); | 856 return vpx_codec_pkt_list_get(&ctx->pkt_list.head, iter); |
| 857 } | 857 } |
| 858 | 858 |
| 859 static vpx_codec_err_t vp9e_set_reference(vpx_codec_alg_priv_t *ctx, | 859 static vpx_codec_err_t vp9e_set_reference(vpx_codec_alg_priv_t *ctx, |
| 860 int ctr_id, | 860 int ctr_id, |
| 861 va_list args) { | 861 va_list args) { |
| 862 vpx_ref_frame_t *data = va_arg(args, vpx_ref_frame_t *); | 862 vpx_ref_frame_t *data = va_arg(args, vpx_ref_frame_t *); |
| 863 | 863 |
| 864 if (data) { | 864 if (data) { |
| 865 vpx_ref_frame_t *frame = (vpx_ref_frame_t *)data; | 865 vpx_ref_frame_t *frame = (vpx_ref_frame_t *)data; |
| 866 YV12_BUFFER_CONFIG sd; | 866 YV12_BUFFER_CONFIG sd; |
| 867 | 867 |
| 868 image2yuvconfig(&frame->img, &sd); | 868 image2yuvconfig(&frame->img, &sd); |
| 869 vp9_set_reference_enc(ctx->cpi, ref_frame_to_vp9_reframe(frame->frame_type), | 869 vp9_set_reference_enc(ctx->cpi, ref_frame_to_vp9_reframe(frame->frame_type), |
| 870 &sd); | 870 &sd); |
| 871 return VPX_CODEC_OK; | 871 return VPX_CODEC_OK; |
| 872 } else | 872 } else { |
| 873 return VPX_CODEC_INVALID_PARAM; | 873 return VPX_CODEC_INVALID_PARAM; |
| 874 | 874 } |
| 875 } | 875 } |
| 876 | 876 |
| 877 static vpx_codec_err_t vp9e_copy_reference(vpx_codec_alg_priv_t *ctx, | 877 static vpx_codec_err_t vp9e_copy_reference(vpx_codec_alg_priv_t *ctx, |
| 878 int ctr_id, | 878 int ctr_id, |
| 879 va_list args) { | 879 va_list args) { |
| 880 | |
| 881 vpx_ref_frame_t *data = va_arg(args, vpx_ref_frame_t *); | 880 vpx_ref_frame_t *data = va_arg(args, vpx_ref_frame_t *); |
| 882 | 881 |
| 883 if (data) { | 882 if (data) { |
| 884 vpx_ref_frame_t *frame = (vpx_ref_frame_t *)data; | 883 vpx_ref_frame_t *frame = (vpx_ref_frame_t *)data; |
| 885 YV12_BUFFER_CONFIG sd; | 884 YV12_BUFFER_CONFIG sd; |
| 886 | 885 |
| 887 image2yuvconfig(&frame->img, &sd); | 886 image2yuvconfig(&frame->img, &sd); |
| 888 vp9_copy_reference_enc(ctx->cpi, | 887 vp9_copy_reference_enc(ctx->cpi, |
| 889 ref_frame_to_vp9_reframe(frame->frame_type), &sd); | 888 ref_frame_to_vp9_reframe(frame->frame_type), &sd); |
| 890 return VPX_CODEC_OK; | 889 return VPX_CODEC_OK; |
| 891 } else | 890 } else { |
| 892 return VPX_CODEC_INVALID_PARAM; | 891 return VPX_CODEC_INVALID_PARAM; |
| 892 } |
| 893 } | 893 } |
| 894 | 894 |
| 895 static vpx_codec_err_t get_reference(vpx_codec_alg_priv_t *ctx, | 895 static vpx_codec_err_t get_reference(vpx_codec_alg_priv_t *ctx, |
| 896 int ctr_id, | 896 int ctr_id, |
| 897 va_list args) { | 897 va_list args) { |
| 898 vp9_ref_frame_t *data = va_arg(args, vp9_ref_frame_t *); | 898 vp9_ref_frame_t *data = va_arg(args, vp9_ref_frame_t *); |
| 899 | 899 |
| 900 if (data) { | 900 if (data) { |
| 901 YV12_BUFFER_CONFIG* fb; | 901 YV12_BUFFER_CONFIG* fb; |
| 902 | 902 |
| 903 vp9_get_reference_enc(ctx->cpi, data->idx, &fb); | 903 vp9_get_reference_enc(ctx->cpi, data->idx, &fb); |
| 904 yuvconfig2image(&data->img, fb, NULL); | 904 yuvconfig2image(&data->img, fb, NULL); |
| 905 return VPX_CODEC_OK; | 905 return VPX_CODEC_OK; |
| 906 } else { | 906 } else { |
| 907 return VPX_CODEC_INVALID_PARAM; | 907 return VPX_CODEC_INVALID_PARAM; |
| 908 } | 908 } |
| 909 } | 909 } |
| 910 | 910 |
| 911 static vpx_codec_err_t vp9e_set_previewpp(vpx_codec_alg_priv_t *ctx, | 911 static vpx_codec_err_t vp9e_set_previewpp(vpx_codec_alg_priv_t *ctx, |
| 912 int ctr_id, | 912 int ctr_id, |
| 913 va_list args) { | 913 va_list args) { |
| 914 #if CONFIG_VP9_POSTPROC | 914 #if CONFIG_VP9_POSTPROC |
| 915 vp8_postproc_cfg_t *data = va_arg(args, vp8_postproc_cfg_t *); | 915 vp8_postproc_cfg_t *data = va_arg(args, vp8_postproc_cfg_t *); |
| 916 (void)ctr_id; | 916 (void)ctr_id; |
| 917 | 917 |
| 918 if (data) { | 918 if (data) { |
| 919 ctx->preview_ppcfg = *((vp8_postproc_cfg_t *)data); | 919 ctx->preview_ppcfg = *((vp8_postproc_cfg_t *)data); |
| 920 return VPX_CODEC_OK; | 920 return VPX_CODEC_OK; |
| 921 } else | 921 } else { |
| 922 return VPX_CODEC_INVALID_PARAM; | 922 return VPX_CODEC_INVALID_PARAM; |
| 923 } |
| 923 #else | 924 #else |
| 924 (void)ctx; | 925 (void)ctx; |
| 925 (void)ctr_id; | 926 (void)ctr_id; |
| 926 (void)args; | 927 (void)args; |
| 927 return VPX_CODEC_INCAPABLE; | 928 return VPX_CODEC_INCAPABLE; |
| 928 #endif | 929 #endif |
| 929 } | 930 } |
| 930 | 931 |
| 931 | 932 |
| 932 static vpx_image_t *vp9e_get_preview(vpx_codec_alg_priv_t *ctx) { | 933 static vpx_image_t *vp9e_get_preview(vpx_codec_alg_priv_t *ctx) { |
| 933 | |
| 934 YV12_BUFFER_CONFIG sd; | 934 YV12_BUFFER_CONFIG sd; |
| 935 vp9_ppflags_t flags = {0}; | 935 vp9_ppflags_t flags = {0}; |
| 936 | 936 |
| 937 if (ctx->preview_ppcfg.post_proc_flag) { | 937 if (ctx->preview_ppcfg.post_proc_flag) { |
| 938 flags.post_proc_flag = ctx->preview_ppcfg.post_proc_flag; | 938 flags.post_proc_flag = ctx->preview_ppcfg.post_proc_flag; |
| 939 flags.deblocking_level = ctx->preview_ppcfg.deblocking_level; | 939 flags.deblocking_level = ctx->preview_ppcfg.deblocking_level; |
| 940 flags.noise_level = ctx->preview_ppcfg.noise_level; | 940 flags.noise_level = ctx->preview_ppcfg.noise_level; |
| 941 } | 941 } |
| 942 | 942 |
| 943 if (0 == vp9_get_preview_raw_frame(ctx->cpi, &sd, &flags)) { | 943 if (0 == vp9_get_preview_raw_frame(ctx->cpi, &sd, &flags)) { |
| 944 yuvconfig2image(&ctx->preview_img, &sd, NULL); | 944 yuvconfig2image(&ctx->preview_img, &sd, NULL); |
| 945 return &ctx->preview_img; | 945 return &ctx->preview_img; |
| 946 } else | 946 } else { |
| 947 return NULL; | 947 return NULL; |
| 948 } |
| 948 } | 949 } |
| 949 | 950 |
| 950 static vpx_codec_err_t vp9e_update_entropy(vpx_codec_alg_priv_t *ctx, | 951 static vpx_codec_err_t vp9e_update_entropy(vpx_codec_alg_priv_t *ctx, |
| 951 int ctr_id, | 952 int ctr_id, |
| 952 va_list args) { | 953 va_list args) { |
| 953 int update = va_arg(args, int); | 954 int update = va_arg(args, int); |
| 954 vp9_update_entropy(ctx->cpi, update); | 955 vp9_update_entropy(ctx->cpi, update); |
| 955 return VPX_CODEC_OK; | 956 return VPX_CODEC_OK; |
| 956 | |
| 957 } | 957 } |
| 958 | 958 |
| 959 static vpx_codec_err_t vp9e_update_reference(vpx_codec_alg_priv_t *ctx, | 959 static vpx_codec_err_t vp9e_update_reference(vpx_codec_alg_priv_t *ctx, |
| 960 int ctr_id, | 960 int ctr_id, |
| 961 va_list args) { | 961 va_list args) { |
| 962 int update = va_arg(args, int); | 962 int update = va_arg(args, int); |
| 963 vp9_update_reference(ctx->cpi, update); | 963 vp9_update_reference(ctx->cpi, update); |
| 964 return VPX_CODEC_OK; | 964 return VPX_CODEC_OK; |
| 965 } | 965 } |
| 966 | 966 |
| 967 static vpx_codec_err_t vp9e_use_reference(vpx_codec_alg_priv_t *ctx, | 967 static vpx_codec_err_t vp9e_use_reference(vpx_codec_alg_priv_t *ctx, |
| 968 int ctr_id, | 968 int ctr_id, |
| 969 va_list args) { | 969 va_list args) { |
| 970 int reference_flag = va_arg(args, int); | 970 int reference_flag = va_arg(args, int); |
| 971 vp9_use_as_reference(ctx->cpi, reference_flag); | 971 vp9_use_as_reference(ctx->cpi, reference_flag); |
| 972 return VPX_CODEC_OK; | 972 return VPX_CODEC_OK; |
| 973 } | 973 } |
| 974 | 974 |
| 975 static vpx_codec_err_t vp9e_set_roi_map(vpx_codec_alg_priv_t *ctx, | 975 static vpx_codec_err_t vp9e_set_roi_map(vpx_codec_alg_priv_t *ctx, |
| 976 int ctr_id, | 976 int ctr_id, |
| 977 va_list args) { | 977 va_list args) { |
| 978 vpx_roi_map_t *data = va_arg(args, vpx_roi_map_t *); | 978 // TODO(yaowu): Need to re-implement and test for VP9. |
| 979 | 979 return VPX_CODEC_INVALID_PARAM; |
| 980 if (data) { | |
| 981 vpx_roi_map_t *roi = (vpx_roi_map_t *)data; | |
| 982 | |
| 983 if (!vp9_set_roimap(ctx->cpi, roi->roi_map, roi->rows, roi->cols, | |
| 984 roi->delta_q, roi->delta_lf, roi->static_threshold)) | |
| 985 return VPX_CODEC_OK; | |
| 986 else | |
| 987 return VPX_CODEC_INVALID_PARAM; | |
| 988 } else | |
| 989 return VPX_CODEC_INVALID_PARAM; | |
| 990 } | 980 } |
| 991 | 981 |
| 992 | 982 |
| 993 static vpx_codec_err_t vp9e_set_activemap(vpx_codec_alg_priv_t *ctx, | 983 static vpx_codec_err_t vp9e_set_activemap(vpx_codec_alg_priv_t *ctx, |
| 994 int ctr_id, | 984 int ctr_id, |
| 995 va_list args) { | 985 va_list args) { |
| 996 vpx_active_map_t *data = va_arg(args, vpx_active_map_t *); | 986 // TODO(yaowu): Need to re-implement and test for VP9. |
| 997 | 987 return VPX_CODEC_INVALID_PARAM; |
| 998 if (data) { | |
| 999 | |
| 1000 vpx_active_map_t *map = (vpx_active_map_t *)data; | |
| 1001 | |
| 1002 if (!vp9_set_active_map(ctx->cpi, map->active_map, map->rows, map->cols)) | |
| 1003 return VPX_CODEC_OK; | |
| 1004 else | |
| 1005 return VPX_CODEC_INVALID_PARAM; | |
| 1006 } else | |
| 1007 return VPX_CODEC_INVALID_PARAM; | |
| 1008 } | 988 } |
| 1009 | 989 |
| 1010 static vpx_codec_err_t vp9e_set_scalemode(vpx_codec_alg_priv_t *ctx, | 990 static vpx_codec_err_t vp9e_set_scalemode(vpx_codec_alg_priv_t *ctx, |
| 1011 int ctr_id, | 991 int ctr_id, |
| 1012 va_list args) { | 992 va_list args) { |
| 1013 | |
| 1014 vpx_scaling_mode_t *data = va_arg(args, vpx_scaling_mode_t *); | 993 vpx_scaling_mode_t *data = va_arg(args, vpx_scaling_mode_t *); |
| 1015 | 994 |
| 1016 if (data) { | 995 if (data) { |
| 1017 int res; | 996 int res; |
| 1018 vpx_scaling_mode_t scalemode = *(vpx_scaling_mode_t *)data; | 997 vpx_scaling_mode_t scalemode = *(vpx_scaling_mode_t *)data; |
| 1019 res = vp9_set_internal_size(ctx->cpi, scalemode.h_scaling_mode, | 998 res = vp9_set_internal_size(ctx->cpi, |
| 1020 scalemode.v_scaling_mode); | 999 (VPX_SCALING)scalemode.h_scaling_mode, |
| 1000 (VPX_SCALING)scalemode.v_scaling_mode); |
| 1021 | 1001 |
| 1022 if (!res) { | 1002 if (!res) { |
| 1023 return VPX_CODEC_OK; | 1003 return VPX_CODEC_OK; |
| 1024 } else | 1004 } else { |
| 1025 return VPX_CODEC_INVALID_PARAM; | 1005 return VPX_CODEC_INVALID_PARAM; |
| 1026 } else | 1006 } |
| 1007 } else { |
| 1027 return VPX_CODEC_INVALID_PARAM; | 1008 return VPX_CODEC_INVALID_PARAM; |
| 1009 } |
| 1028 } | 1010 } |
| 1029 | 1011 |
| 1030 static vpx_codec_err_t vp9e_set_width(vpx_codec_alg_priv_t *ctx, int ctr_id, | 1012 static vpx_codec_err_t vp9e_set_width(vpx_codec_alg_priv_t *ctx, int ctr_id, |
| 1031 va_list args) { | 1013 va_list args) { |
| 1032 unsigned int *data = va_arg(args, unsigned int *); | 1014 unsigned int *data = va_arg(args, unsigned int *); |
| 1033 if (data) { | 1015 if (data) { |
| 1034 int res; | 1016 int res; |
| 1035 res = vp9_set_size_literal(ctx->cpi, *data, 0); | 1017 res = vp9_set_size_literal(ctx->cpi, *data, 0); |
| 1036 if (!res) { | 1018 if (!res) { |
| 1037 return VPX_CODEC_OK; | 1019 return VPX_CODEC_OK; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 {VP9E_SET_WIDTH, vp9e_set_width}, | 1105 {VP9E_SET_WIDTH, vp9e_set_width}, |
| 1124 {VP9E_SET_HEIGHT, vp9e_set_height}, | 1106 {VP9E_SET_HEIGHT, vp9e_set_height}, |
| 1125 {VP9E_SET_LAYER, vp9e_set_layer}, | 1107 {VP9E_SET_LAYER, vp9e_set_layer}, |
| 1126 {VP9E_SET_SVC, vp9e_set_svc}, | 1108 {VP9E_SET_SVC, vp9e_set_svc}, |
| 1127 { -1, NULL}, | 1109 { -1, NULL}, |
| 1128 }; | 1110 }; |
| 1129 | 1111 |
| 1130 static vpx_codec_enc_cfg_map_t vp9e_usage_cfg_map[] = { | 1112 static vpx_codec_enc_cfg_map_t vp9e_usage_cfg_map[] = { |
| 1131 { | 1113 { |
| 1132 0, | 1114 0, |
| 1133 { | 1115 { // NOLINT |
| 1134 0, /* g_usage */ | 1116 0, /* g_usage */ |
| 1135 0, /* g_threads */ | 1117 0, /* g_threads */ |
| 1136 0, /* g_profile */ | 1118 0, /* g_profile */ |
| 1137 | 1119 |
| 1138 320, /* g_width */ | 1120 320, /* g_width */ |
| 1139 240, /* g_height */ | 1121 240, /* g_height */ |
| 1140 {1, 30}, /* g_timebase */ | 1122 {1, 30}, /* g_timebase */ |
| 1141 | 1123 |
| 1142 0, /* g_error_resilient */ | 1124 0, /* g_error_resilient */ |
| 1143 | 1125 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 "WebM Project VP9 Encoder" VERSION_STRING, | 1174 "WebM Project VP9 Encoder" VERSION_STRING, |
| 1193 VPX_CODEC_INTERNAL_ABI_VERSION, | 1175 VPX_CODEC_INTERNAL_ABI_VERSION, |
| 1194 VPX_CODEC_CAP_ENCODER | VPX_CODEC_CAP_PSNR | | 1176 VPX_CODEC_CAP_ENCODER | VPX_CODEC_CAP_PSNR | |
| 1195 VPX_CODEC_CAP_OUTPUT_PARTITION, | 1177 VPX_CODEC_CAP_OUTPUT_PARTITION, |
| 1196 /* vpx_codec_caps_t caps; */ | 1178 /* vpx_codec_caps_t caps; */ |
| 1197 vp9e_init, /* vpx_codec_init_fn_t init; */ | 1179 vp9e_init, /* vpx_codec_init_fn_t init; */ |
| 1198 vp9e_destroy, /* vpx_codec_destroy_fn_t destroy; */ | 1180 vp9e_destroy, /* vpx_codec_destroy_fn_t destroy; */ |
| 1199 vp9e_ctf_maps, /* vpx_codec_ctrl_fn_map_t *ctrl_maps; */ | 1181 vp9e_ctf_maps, /* vpx_codec_ctrl_fn_map_t *ctrl_maps; */ |
| 1200 NOT_IMPLEMENTED, /* vpx_codec_get_mmap_fn_t get_mmap; */ | 1182 NOT_IMPLEMENTED, /* vpx_codec_get_mmap_fn_t get_mmap; */ |
| 1201 NOT_IMPLEMENTED, /* vpx_codec_set_mmap_fn_t set_mmap; */ | 1183 NOT_IMPLEMENTED, /* vpx_codec_set_mmap_fn_t set_mmap; */ |
| 1202 { | 1184 { // NOLINT |
| 1203 NOT_IMPLEMENTED, /* vpx_codec_peek_si_fn_t peek_si; */ | 1185 NOT_IMPLEMENTED, /* vpx_codec_peek_si_fn_t peek_si; */ |
| 1204 NOT_IMPLEMENTED, /* vpx_codec_get_si_fn_t get_si; */ | 1186 NOT_IMPLEMENTED, /* vpx_codec_get_si_fn_t get_si; */ |
| 1205 NOT_IMPLEMENTED, /* vpx_codec_decode_fn_t decode; */ | 1187 NOT_IMPLEMENTED, /* vpx_codec_decode_fn_t decode; */ |
| 1206 NOT_IMPLEMENTED, /* vpx_codec_frame_get_fn_t frame_get; */ | 1188 NOT_IMPLEMENTED, /* vpx_codec_frame_get_fn_t frame_get; */ |
| 1207 }, | 1189 }, |
| 1208 { | 1190 { // NOLINT |
| 1209 vp9e_usage_cfg_map, /* vpx_codec_enc_cfg_map_t peek_si; */ | 1191 vp9e_usage_cfg_map, /* vpx_codec_enc_cfg_map_t peek_si; */ |
| 1210 vp9e_encode, /* vpx_codec_encode_fn_t encode; */ | 1192 vp9e_encode, /* vpx_codec_encode_fn_t encode; */ |
| 1211 vp9e_get_cxdata, /* vpx_codec_get_cx_data_fn_t frame_get; */ | 1193 vp9e_get_cxdata, /* vpx_codec_get_cx_data_fn_t frame_get; */ |
| 1212 vp9e_set_config, | 1194 vp9e_set_config, |
| 1213 NOT_IMPLEMENTED, | 1195 NOT_IMPLEMENTED, |
| 1214 vp9e_get_preview, | 1196 vp9e_get_preview, |
| 1215 } /* encoder functions */ | 1197 } /* encoder functions */ |
| 1216 }; | 1198 }; |
| 1217 | 1199 |
| 1218 | 1200 |
| 1219 #if CONFIG_EXPERIMENTAL | 1201 #if CONFIG_EXPERIMENTAL |
| 1220 | 1202 |
| 1221 CODEC_INTERFACE(vpx_codec_vp9x_cx) = { | 1203 CODEC_INTERFACE(vpx_codec_vp9x_cx) = { |
| 1222 "VP8 Experimental Encoder" VERSION_STRING, | 1204 "VP8 Experimental Encoder" VERSION_STRING, |
| 1223 VPX_CODEC_INTERNAL_ABI_VERSION, | 1205 VPX_CODEC_INTERNAL_ABI_VERSION, |
| 1224 VPX_CODEC_CAP_ENCODER | VPX_CODEC_CAP_PSNR, | 1206 VPX_CODEC_CAP_ENCODER | VPX_CODEC_CAP_PSNR, |
| 1225 /* vpx_codec_caps_t caps; */ | 1207 /* vpx_codec_caps_t caps; */ |
| 1226 vp9e_exp_init, /* vpx_codec_init_fn_t init; */ | 1208 vp9e_exp_init, /* vpx_codec_init_fn_t init; */ |
| 1227 vp9e_destroy, /* vpx_codec_destroy_fn_t destroy; */ | 1209 vp9e_destroy, /* vpx_codec_destroy_fn_t destroy; */ |
| 1228 vp9e_ctf_maps, /* vpx_codec_ctrl_fn_map_t *ctrl_maps; */ | 1210 vp9e_ctf_maps, /* vpx_codec_ctrl_fn_map_t *ctrl_maps; */ |
| 1229 NOT_IMPLEMENTED, /* vpx_codec_get_mmap_fn_t get_mmap; */ | 1211 NOT_IMPLEMENTED, /* vpx_codec_get_mmap_fn_t get_mmap; */ |
| 1230 NOT_IMPLEMENTED, /* vpx_codec_set_mmap_fn_t set_mmap; */ | 1212 NOT_IMPLEMENTED, /* vpx_codec_set_mmap_fn_t set_mmap; */ |
| 1231 { | 1213 { // NOLINT |
| 1232 NOT_IMPLEMENTED, /* vpx_codec_peek_si_fn_t peek_si; */ | 1214 NOT_IMPLEMENTED, /* vpx_codec_peek_si_fn_t peek_si; */ |
| 1233 NOT_IMPLEMENTED, /* vpx_codec_get_si_fn_t get_si; */ | 1215 NOT_IMPLEMENTED, /* vpx_codec_get_si_fn_t get_si; */ |
| 1234 NOT_IMPLEMENTED, /* vpx_codec_decode_fn_t decode; */ | 1216 NOT_IMPLEMENTED, /* vpx_codec_decode_fn_t decode; */ |
| 1235 NOT_IMPLEMENTED, /* vpx_codec_frame_get_fn_t frame_get; */ | 1217 NOT_IMPLEMENTED, /* vpx_codec_frame_get_fn_t frame_get; */ |
| 1236 }, | 1218 }, |
| 1237 { | 1219 { // NOLINT |
| 1238 vp9e_usage_cfg_map, /* vpx_codec_enc_cfg_map_t peek_si; */ | 1220 vp9e_usage_cfg_map, /* vpx_codec_enc_cfg_map_t peek_si; */ |
| 1239 vp9e_encode, /* vpx_codec_encode_fn_t encode; */ | 1221 vp9e_encode, /* vpx_codec_encode_fn_t encode; */ |
| 1240 vp9e_get_cxdata, /* vpx_codec_get_cx_data_fn_t frame_get; */ | 1222 vp9e_get_cxdata, /* vpx_codec_get_cx_data_fn_t frame_get; */ |
| 1241 vp9e_set_config, | 1223 vp9e_set_config, |
| 1242 NOT_IMPLEMENTED, | 1224 NOT_IMPLEMENTED, |
| 1243 vp9e_get_preview, | 1225 vp9e_get_preview, |
| 1244 } /* encoder functions */ | 1226 } /* encoder functions */ |
| 1245 }; | 1227 }; |
| 1246 #endif | 1228 #endif |
| OLD | NEW |