| 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 14 matching lines...) Expand all Loading... |
| 25 #include "vp9/vp9_iface_common.h" | 25 #include "vp9/vp9_iface_common.h" |
| 26 | 26 |
| 27 #define VP9_CAP_POSTPROC (CONFIG_VP9_POSTPROC ? VPX_CODEC_CAP_POSTPROC : 0) | 27 #define VP9_CAP_POSTPROC (CONFIG_VP9_POSTPROC ? VPX_CODEC_CAP_POSTPROC : 0) |
| 28 | 28 |
| 29 typedef vpx_codec_stream_info_t vp9_stream_info_t; | 29 typedef vpx_codec_stream_info_t vp9_stream_info_t; |
| 30 | 30 |
| 31 struct vpx_codec_alg_priv { | 31 struct vpx_codec_alg_priv { |
| 32 vpx_codec_priv_t base; | 32 vpx_codec_priv_t base; |
| 33 vpx_codec_dec_cfg_t cfg; | 33 vpx_codec_dec_cfg_t cfg; |
| 34 vp9_stream_info_t si; | 34 vp9_stream_info_t si; |
| 35 int decoder_init; | |
| 36 struct VP9Decoder *pbi; | 35 struct VP9Decoder *pbi; |
| 37 int postproc_cfg_set; | 36 int postproc_cfg_set; |
| 38 vp8_postproc_cfg_t postproc_cfg; | 37 vp8_postproc_cfg_t postproc_cfg; |
| 39 #if CONFIG_POSTPROC_VISUALIZER | |
| 40 unsigned int dbg_postproc_flag; | |
| 41 int dbg_color_ref_frame_flag; | |
| 42 int dbg_color_mb_modes_flag; | |
| 43 int dbg_color_b_modes_flag; | |
| 44 int dbg_display_mv_flag; | |
| 45 #endif | |
| 46 vpx_decrypt_cb decrypt_cb; | 38 vpx_decrypt_cb decrypt_cb; |
| 47 void *decrypt_state; | 39 void *decrypt_state; |
| 48 vpx_image_t img; | 40 vpx_image_t img; |
| 49 int img_avail; | 41 int img_avail; |
| 50 int invert_tile_order; | 42 int invert_tile_order; |
| 51 | 43 |
| 52 // External frame buffer info to save for VP9 common. | 44 // External frame buffer info to save for VP9 common. |
| 53 void *ext_priv; // Private data associated with the external frame buffers. | 45 void *ext_priv; // Private data associated with the external frame buffers. |
| 54 vpx_get_frame_buffer_cb_fn_t get_ext_fb_cb; | 46 vpx_get_frame_buffer_cb_fn_t get_ext_fb_cb; |
| 55 vpx_release_frame_buffer_cb_fn_t release_ext_fb_cb; | 47 vpx_release_frame_buffer_cb_fn_t release_ext_fb_cb; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 210 |
| 219 static void set_default_ppflags(vp8_postproc_cfg_t *cfg) { | 211 static void set_default_ppflags(vp8_postproc_cfg_t *cfg) { |
| 220 cfg->post_proc_flag = VP8_DEBLOCK | VP8_DEMACROBLOCK; | 212 cfg->post_proc_flag = VP8_DEBLOCK | VP8_DEMACROBLOCK; |
| 221 cfg->deblocking_level = 4; | 213 cfg->deblocking_level = 4; |
| 222 cfg->noise_level = 0; | 214 cfg->noise_level = 0; |
| 223 } | 215 } |
| 224 | 216 |
| 225 static void set_ppflags(const vpx_codec_alg_priv_t *ctx, | 217 static void set_ppflags(const vpx_codec_alg_priv_t *ctx, |
| 226 vp9_ppflags_t *flags) { | 218 vp9_ppflags_t *flags) { |
| 227 flags->post_proc_flag = | 219 flags->post_proc_flag = |
| 228 #if CONFIG_POSTPROC_VISUALIZER | |
| 229 (ctx->dbg_color_ref_frame_flag ? VP9D_DEBUG_CLR_FRM_REF_BLKS : 0) | | |
| 230 (ctx->dbg_color_mb_modes_flag ? VP9D_DEBUG_CLR_BLK_MODES : 0) | | |
| 231 (ctx->dbg_color_b_modes_flag ? VP9D_DEBUG_CLR_BLK_MODES : 0) | | |
| 232 (ctx->dbg_display_mv_flag ? VP9D_DEBUG_DRAW_MV : 0) | | |
| 233 #endif | |
| 234 ctx->postproc_cfg.post_proc_flag; | 220 ctx->postproc_cfg.post_proc_flag; |
| 235 | 221 |
| 236 flags->deblocking_level = ctx->postproc_cfg.deblocking_level; | 222 flags->deblocking_level = ctx->postproc_cfg.deblocking_level; |
| 237 flags->noise_level = ctx->postproc_cfg.noise_level; | 223 flags->noise_level = ctx->postproc_cfg.noise_level; |
| 238 #if CONFIG_POSTPROC_VISUALIZER | |
| 239 flags->display_ref_frame_flag = ctx->dbg_color_ref_frame_flag; | |
| 240 flags->display_mb_modes_flag = ctx->dbg_color_mb_modes_flag; | |
| 241 flags->display_b_modes_flag = ctx->dbg_color_b_modes_flag; | |
| 242 flags->display_mv_flag = ctx->dbg_display_mv_flag; | |
| 243 #endif | |
| 244 } | 224 } |
| 245 | 225 |
| 246 static void init_decoder(vpx_codec_alg_priv_t *ctx) { | 226 static void init_decoder(vpx_codec_alg_priv_t *ctx) { |
| 247 ctx->pbi = vp9_decoder_create(); | 227 ctx->pbi = vp9_decoder_create(); |
| 248 if (ctx->pbi == NULL) | 228 if (ctx->pbi == NULL) |
| 249 return; | 229 return; |
| 250 | 230 |
| 251 ctx->pbi->max_threads = ctx->cfg.threads; | 231 ctx->pbi->max_threads = ctx->cfg.threads; |
| 252 ctx->pbi->inv_tile_order = ctx->invert_tile_order; | 232 ctx->pbi->inv_tile_order = ctx->invert_tile_order; |
| 253 | 233 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 277 // of the heap. | 257 // of the heap. |
| 278 if (!ctx->si.h) { | 258 if (!ctx->si.h) { |
| 279 const vpx_codec_err_t res = | 259 const vpx_codec_err_t res = |
| 280 decoder_peek_si_internal(*data, data_sz, &ctx->si, ctx->decrypt_cb, | 260 decoder_peek_si_internal(*data, data_sz, &ctx->si, ctx->decrypt_cb, |
| 281 ctx->decrypt_state); | 261 ctx->decrypt_state); |
| 282 if (res != VPX_CODEC_OK) | 262 if (res != VPX_CODEC_OK) |
| 283 return res; | 263 return res; |
| 284 } | 264 } |
| 285 | 265 |
| 286 // Initialize the decoder instance on the first frame | 266 // Initialize the decoder instance on the first frame |
| 287 if (!ctx->decoder_init) { | 267 if (ctx->pbi == NULL) { |
| 288 init_decoder(ctx); | 268 init_decoder(ctx); |
| 289 if (ctx->pbi == NULL) | 269 if (ctx->pbi == NULL) |
| 290 return VPX_CODEC_ERROR; | 270 return VPX_CODEC_ERROR; |
| 291 | |
| 292 ctx->decoder_init = 1; | |
| 293 } | 271 } |
| 294 | 272 |
| 295 // Set these even if already initialized. The caller may have changed the | 273 // Set these even if already initialized. The caller may have changed the |
| 296 // decrypt config between frames. | 274 // decrypt config between frames. |
| 297 ctx->pbi->decrypt_cb = ctx->decrypt_cb; | 275 ctx->pbi->decrypt_cb = ctx->decrypt_cb; |
| 298 ctx->pbi->decrypt_state = ctx->decrypt_state; | 276 ctx->pbi->decrypt_state = ctx->decrypt_state; |
| 299 | 277 |
| 300 cm = &ctx->pbi->common; | 278 cm = &ctx->pbi->common; |
| 301 | 279 |
| 302 if (vp9_receive_compressed_data(ctx->pbi, data_sz, data, deadline)) | 280 if (vp9_receive_compressed_data(ctx->pbi, data_sz, data, deadline)) |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 } else { | 509 } else { |
| 532 return VPX_CODEC_INVALID_PARAM; | 510 return VPX_CODEC_INVALID_PARAM; |
| 533 } | 511 } |
| 534 #else | 512 #else |
| 535 return VPX_CODEC_INCAPABLE; | 513 return VPX_CODEC_INCAPABLE; |
| 536 #endif | 514 #endif |
| 537 } | 515 } |
| 538 | 516 |
| 539 static vpx_codec_err_t ctrl_set_dbg_options(vpx_codec_alg_priv_t *ctx, | 517 static vpx_codec_err_t ctrl_set_dbg_options(vpx_codec_alg_priv_t *ctx, |
| 540 int ctrl_id, va_list args) { | 518 int ctrl_id, va_list args) { |
| 541 #if CONFIG_POSTPROC_VISUALIZER && CONFIG_POSTPROC | |
| 542 int data = va_arg(args, int); | |
| 543 | |
| 544 #define MAP(id, var) case id: var = data; break; | |
| 545 | |
| 546 switch (ctrl_id) { | |
| 547 MAP(VP8_SET_DBG_COLOR_REF_FRAME, ctx->dbg_color_ref_frame_flag); | |
| 548 MAP(VP8_SET_DBG_COLOR_MB_MODES, ctx->dbg_color_mb_modes_flag); | |
| 549 MAP(VP8_SET_DBG_COLOR_B_MODES, ctx->dbg_color_b_modes_flag); | |
| 550 MAP(VP8_SET_DBG_DISPLAY_MV, ctx->dbg_display_mv_flag); | |
| 551 } | |
| 552 | |
| 553 return VPX_CODEC_OK; | |
| 554 #else | |
| 555 return VPX_CODEC_INCAPABLE; | 519 return VPX_CODEC_INCAPABLE; |
| 556 #endif | |
| 557 } | 520 } |
| 558 | 521 |
| 559 static vpx_codec_err_t ctrl_get_last_ref_updates(vpx_codec_alg_priv_t *ctx, | 522 static vpx_codec_err_t ctrl_get_last_ref_updates(vpx_codec_alg_priv_t *ctx, |
| 560 int ctrl_id, va_list args) { | 523 int ctrl_id, va_list args) { |
| 561 int *const update_info = va_arg(args, int *); | 524 int *const update_info = va_arg(args, int *); |
| 562 | 525 |
| 563 if (update_info) { | 526 if (update_info) { |
| 564 if (ctx->pbi) | 527 if (ctx->pbi) |
| 565 *update_info = ctx->pbi->refresh_frame_flags; | 528 *update_info = ctx->pbi->refresh_frame_flags; |
| 566 else | 529 else |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 }, | 627 }, |
| 665 { // NOLINT | 628 { // NOLINT |
| 666 NOT_IMPLEMENTED, | 629 NOT_IMPLEMENTED, |
| 667 NOT_IMPLEMENTED, | 630 NOT_IMPLEMENTED, |
| 668 NOT_IMPLEMENTED, | 631 NOT_IMPLEMENTED, |
| 669 NOT_IMPLEMENTED, | 632 NOT_IMPLEMENTED, |
| 670 NOT_IMPLEMENTED, | 633 NOT_IMPLEMENTED, |
| 671 NOT_IMPLEMENTED | 634 NOT_IMPLEMENTED |
| 672 } | 635 } |
| 673 }; | 636 }; |
| OLD | NEW |