| 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 ctx->postproc_cfg.noise_level = 0; | 379 ctx->postproc_cfg.noise_level = 0; |
| 380 } | 380 } |
| 381 | 381 |
| 382 res = vp8_create_decoder_instances(&ctx->yv12_frame_buffers, &oxcf); | 382 res = vp8_create_decoder_instances(&ctx->yv12_frame_buffers, &oxcf); |
| 383 ctx->decoder_init = 1; | 383 ctx->decoder_init = 1; |
| 384 } | 384 } |
| 385 | 385 |
| 386 /* Set these even if already initialized. The caller may have changed the | 386 /* Set these even if already initialized. The caller may have changed the |
| 387 * decrypt config between frames. | 387 * decrypt config between frames. |
| 388 */ | 388 */ |
| 389 ctx->yv12_frame_buffers.pbi[0]->decrypt_cb = ctx->decrypt_cb; | 389 if (ctx->decoder_init) { |
| 390 ctx->yv12_frame_buffers.pbi[0]->decrypt_state = ctx->decrypt_state; | 390 ctx->yv12_frame_buffers.pbi[0]->decrypt_cb = ctx->decrypt_cb; |
| 391 ctx->yv12_frame_buffers.pbi[0]->decrypt_state = ctx->decrypt_state; |
| 392 } |
| 391 | 393 |
| 392 if (!res) | 394 if (!res) |
| 393 { | 395 { |
| 394 VP8D_COMP *pbi = ctx->yv12_frame_buffers.pbi[0]; | 396 VP8D_COMP *pbi = ctx->yv12_frame_buffers.pbi[0]; |
| 395 if(resolution_change) | 397 if(resolution_change) |
| 396 { | 398 { |
| 397 VP8_COMMON *const pc = & pbi->common; | 399 VP8_COMMON *const pc = & pbi->common; |
| 398 MACROBLOCKD *const xd = & pbi->mb; | 400 MACROBLOCKD *const xd = & pbi->mb; |
| 399 #if CONFIG_MULTITHREAD | 401 #if CONFIG_MULTITHREAD |
| 400 int i; | 402 int i; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 | 569 |
| 568 yv12->y_stride = img->stride[VPX_PLANE_Y]; | 570 yv12->y_stride = img->stride[VPX_PLANE_Y]; |
| 569 yv12->uv_stride = img->stride[VPX_PLANE_U]; | 571 yv12->uv_stride = img->stride[VPX_PLANE_U]; |
| 570 | 572 |
| 571 yv12->border = (img->stride[VPX_PLANE_Y] - img->d_w) / 2; | 573 yv12->border = (img->stride[VPX_PLANE_Y] - img->d_w) / 2; |
| 572 return res; | 574 return res; |
| 573 } | 575 } |
| 574 | 576 |
| 575 | 577 |
| 576 static vpx_codec_err_t vp8_set_reference(vpx_codec_alg_priv_t *ctx, | 578 static vpx_codec_err_t vp8_set_reference(vpx_codec_alg_priv_t *ctx, |
| 577 int ctr_id, | 579 va_list args) |
| 578 va_list args) | |
| 579 { | 580 { |
| 580 | 581 |
| 581 vpx_ref_frame_t *data = va_arg(args, vpx_ref_frame_t *); | 582 vpx_ref_frame_t *data = va_arg(args, vpx_ref_frame_t *); |
| 582 | 583 |
| 583 if (data && !ctx->yv12_frame_buffers.use_frame_threads) | 584 if (data && !ctx->yv12_frame_buffers.use_frame_threads) |
| 584 { | 585 { |
| 585 vpx_ref_frame_t *frame = (vpx_ref_frame_t *)data; | 586 vpx_ref_frame_t *frame = (vpx_ref_frame_t *)data; |
| 586 YV12_BUFFER_CONFIG sd; | 587 YV12_BUFFER_CONFIG sd; |
| 587 | 588 |
| 588 image2yuvconfig(&frame->img, &sd); | 589 image2yuvconfig(&frame->img, &sd); |
| 589 | 590 |
| 590 return vp8dx_set_reference(ctx->yv12_frame_buffers.pbi[0], | 591 return vp8dx_set_reference(ctx->yv12_frame_buffers.pbi[0], |
| 591 frame->frame_type, &sd); | 592 frame->frame_type, &sd); |
| 592 } | 593 } |
| 593 else | 594 else |
| 594 return VPX_CODEC_INVALID_PARAM; | 595 return VPX_CODEC_INVALID_PARAM; |
| 595 | 596 |
| 596 } | 597 } |
| 597 | 598 |
| 598 static vpx_codec_err_t vp8_get_reference(vpx_codec_alg_priv_t *ctx, | 599 static vpx_codec_err_t vp8_get_reference(vpx_codec_alg_priv_t *ctx, |
| 599 int ctr_id, | 600 va_list args) |
| 600 va_list args) | |
| 601 { | 601 { |
| 602 | 602 |
| 603 vpx_ref_frame_t *data = va_arg(args, vpx_ref_frame_t *); | 603 vpx_ref_frame_t *data = va_arg(args, vpx_ref_frame_t *); |
| 604 | 604 |
| 605 if (data && !ctx->yv12_frame_buffers.use_frame_threads) | 605 if (data && !ctx->yv12_frame_buffers.use_frame_threads) |
| 606 { | 606 { |
| 607 vpx_ref_frame_t *frame = (vpx_ref_frame_t *)data; | 607 vpx_ref_frame_t *frame = (vpx_ref_frame_t *)data; |
| 608 YV12_BUFFER_CONFIG sd; | 608 YV12_BUFFER_CONFIG sd; |
| 609 | 609 |
| 610 image2yuvconfig(&frame->img, &sd); | 610 image2yuvconfig(&frame->img, &sd); |
| 611 | 611 |
| 612 return vp8dx_get_reference(ctx->yv12_frame_buffers.pbi[0], | 612 return vp8dx_get_reference(ctx->yv12_frame_buffers.pbi[0], |
| 613 frame->frame_type, &sd); | 613 frame->frame_type, &sd); |
| 614 } | 614 } |
| 615 else | 615 else |
| 616 return VPX_CODEC_INVALID_PARAM; | 616 return VPX_CODEC_INVALID_PARAM; |
| 617 | 617 |
| 618 } | 618 } |
| 619 | 619 |
| 620 static vpx_codec_err_t vp8_set_postproc(vpx_codec_alg_priv_t *ctx, | 620 static vpx_codec_err_t vp8_set_postproc(vpx_codec_alg_priv_t *ctx, |
| 621 int ctr_id, | |
| 622 va_list args) | 621 va_list args) |
| 623 { | 622 { |
| 624 #if CONFIG_POSTPROC | 623 #if CONFIG_POSTPROC |
| 625 vp8_postproc_cfg_t *data = va_arg(args, vp8_postproc_cfg_t *); | 624 vp8_postproc_cfg_t *data = va_arg(args, vp8_postproc_cfg_t *); |
| 626 | 625 |
| 627 if (data) | 626 if (data) |
| 628 { | 627 { |
| 629 ctx->postproc_cfg_set = 1; | 628 ctx->postproc_cfg_set = 1; |
| 630 ctx->postproc_cfg = *((vp8_postproc_cfg_t *)data); | 629 ctx->postproc_cfg = *((vp8_postproc_cfg_t *)data); |
| 631 return VPX_CODEC_OK; | 630 return VPX_CODEC_OK; |
| 632 } | 631 } |
| 633 else | 632 else |
| 634 return VPX_CODEC_INVALID_PARAM; | 633 return VPX_CODEC_INVALID_PARAM; |
| 635 | 634 |
| 636 #else | 635 #else |
| 637 return VPX_CODEC_INCAPABLE; | 636 return VPX_CODEC_INCAPABLE; |
| 638 #endif | 637 #endif |
| 639 } | 638 } |
| 640 | 639 |
| 641 static vpx_codec_err_t vp8_set_dbg_options(vpx_codec_alg_priv_t *ctx, | 640 |
| 642 int ctrl_id, | 641 static vpx_codec_err_t vp8_set_dbg_color_ref_frame(vpx_codec_alg_priv_t *ctx, |
| 643 va_list args) | 642 va_list args) { |
| 644 { | |
| 645 #if CONFIG_POSTPROC_VISUALIZER && CONFIG_POSTPROC | 643 #if CONFIG_POSTPROC_VISUALIZER && CONFIG_POSTPROC |
| 646 int data = va_arg(args, int); | 644 ctx->dbg_color_ref_frame_flag = va_arg(args, int); |
| 645 return VPX_CODEC_OK; |
| 646 #else |
| 647 (void)ctx; |
| 648 (void)args; |
| 649 return VPX_CODEC_INCAPABLE; |
| 650 #endif |
| 651 } |
| 647 | 652 |
| 648 #define MAP(id, var) case id: var = data; break; | 653 static vpx_codec_err_t vp8_set_dbg_color_mb_modes(vpx_codec_alg_priv_t *ctx, |
| 654 va_list args) { |
| 655 #if CONFIG_POSTPROC_VISUALIZER && CONFIG_POSTPROC |
| 656 ctx->dbg_color_mb_modes_flag = va_arg(args, int); |
| 657 return VPX_CODEC_OK; |
| 658 #else |
| 659 (void)ctx; |
| 660 (void)args; |
| 661 return VPX_CODEC_INCAPABLE; |
| 662 #endif |
| 663 } |
| 649 | 664 |
| 650 switch (ctrl_id) | 665 static vpx_codec_err_t vp8_set_dbg_color_b_modes(vpx_codec_alg_priv_t *ctx, |
| 651 { | 666 va_list args) { |
| 652 MAP (VP8_SET_DBG_COLOR_REF_FRAME, ctx->dbg_color_ref_frame_flag); | 667 #if CONFIG_POSTPROC_VISUALIZER && CONFIG_POSTPROC |
| 653 MAP (VP8_SET_DBG_COLOR_MB_MODES, ctx->dbg_color_mb_modes_flag); | 668 ctx->dbg_color_b_modes_flag = va_arg(args, int); |
| 654 MAP (VP8_SET_DBG_COLOR_B_MODES, ctx->dbg_color_b_modes_flag); | 669 return VPX_CODEC_OK; |
| 655 MAP (VP8_SET_DBG_DISPLAY_MV, ctx->dbg_display_mv_flag); | 670 #else |
| 656 } | 671 (void)ctx; |
| 672 (void)args; |
| 673 return VPX_CODEC_INCAPABLE; |
| 674 #endif |
| 675 } |
| 657 | 676 |
| 658 return VPX_CODEC_OK; | 677 static vpx_codec_err_t vp8_set_dbg_display_mv(vpx_codec_alg_priv_t *ctx, |
| 678 va_list args) { |
| 679 #if CONFIG_POSTPROC_VISUALIZER && CONFIG_POSTPROC |
| 680 ctx->dbg_display_mv_flag = va_arg(args, int); |
| 681 return VPX_CODEC_OK; |
| 659 #else | 682 #else |
| 660 return VPX_CODEC_INCAPABLE; | 683 (void)ctx; |
| 684 (void)args; |
| 685 return VPX_CODEC_INCAPABLE; |
| 661 #endif | 686 #endif |
| 662 } | 687 } |
| 663 | 688 |
| 664 static vpx_codec_err_t vp8_get_last_ref_updates(vpx_codec_alg_priv_t *ctx, | 689 static vpx_codec_err_t vp8_get_last_ref_updates(vpx_codec_alg_priv_t *ctx, |
| 665 int ctrl_id, | |
| 666 va_list args) | 690 va_list args) |
| 667 { | 691 { |
| 668 int *update_info = va_arg(args, int *); | 692 int *update_info = va_arg(args, int *); |
| 669 | 693 |
| 670 if (update_info && !ctx->yv12_frame_buffers.use_frame_threads) | 694 if (update_info && !ctx->yv12_frame_buffers.use_frame_threads) |
| 671 { | 695 { |
| 672 VP8D_COMP *pbi = (VP8D_COMP *)ctx->yv12_frame_buffers.pbi[0]; | 696 VP8D_COMP *pbi = (VP8D_COMP *)ctx->yv12_frame_buffers.pbi[0]; |
| 673 | 697 |
| 674 *update_info = pbi->common.refresh_alt_ref_frame * (int) VP8_ALTR_FRAME | 698 *update_info = pbi->common.refresh_alt_ref_frame * (int) VP8_ALTR_FRAME |
| 675 + pbi->common.refresh_golden_frame * (int) VP8_GOLD_FRAME | 699 + pbi->common.refresh_golden_frame * (int) VP8_GOLD_FRAME |
| 676 + pbi->common.refresh_last_frame * (int) VP8_LAST_FRAME; | 700 + pbi->common.refresh_last_frame * (int) VP8_LAST_FRAME; |
| 677 | 701 |
| 678 return VPX_CODEC_OK; | 702 return VPX_CODEC_OK; |
| 679 } | 703 } |
| 680 else | 704 else |
| 681 return VPX_CODEC_INVALID_PARAM; | 705 return VPX_CODEC_INVALID_PARAM; |
| 682 } | 706 } |
| 683 | 707 |
| 684 extern int vp8dx_references_buffer( VP8_COMMON *oci, int ref_frame ); | 708 extern int vp8dx_references_buffer( VP8_COMMON *oci, int ref_frame ); |
| 685 static vpx_codec_err_t vp8_get_last_ref_frame(vpx_codec_alg_priv_t *ctx, | 709 static vpx_codec_err_t vp8_get_last_ref_frame(vpx_codec_alg_priv_t *ctx, |
| 686 int ctrl_id, | |
| 687 va_list args) | 710 va_list args) |
| 688 { | 711 { |
| 689 int *ref_info = va_arg(args, int *); | 712 int *ref_info = va_arg(args, int *); |
| 690 | 713 |
| 691 if (ref_info && !ctx->yv12_frame_buffers.use_frame_threads) | 714 if (ref_info && !ctx->yv12_frame_buffers.use_frame_threads) |
| 692 { | 715 { |
| 693 VP8D_COMP *pbi = (VP8D_COMP *)ctx->yv12_frame_buffers.pbi[0]; | 716 VP8D_COMP *pbi = (VP8D_COMP *)ctx->yv12_frame_buffers.pbi[0]; |
| 694 VP8_COMMON *oci = &pbi->common; | 717 VP8_COMMON *oci = &pbi->common; |
| 695 *ref_info = | 718 *ref_info = |
| 696 (vp8dx_references_buffer( oci, ALTREF_FRAME )?VP8_ALTR_FRAME:0) | | 719 (vp8dx_references_buffer( oci, ALTREF_FRAME )?VP8_ALTR_FRAME:0) | |
| 697 (vp8dx_references_buffer( oci, GOLDEN_FRAME )?VP8_GOLD_FRAME:0) | | 720 (vp8dx_references_buffer( oci, GOLDEN_FRAME )?VP8_GOLD_FRAME:0) | |
| 698 (vp8dx_references_buffer( oci, LAST_FRAME )?VP8_LAST_FRAME:0); | 721 (vp8dx_references_buffer( oci, LAST_FRAME )?VP8_LAST_FRAME:0); |
| 699 | 722 |
| 700 return VPX_CODEC_OK; | 723 return VPX_CODEC_OK; |
| 701 } | 724 } |
| 702 else | 725 else |
| 703 return VPX_CODEC_INVALID_PARAM; | 726 return VPX_CODEC_INVALID_PARAM; |
| 704 } | 727 } |
| 705 | 728 |
| 706 static vpx_codec_err_t vp8_get_frame_corrupted(vpx_codec_alg_priv_t *ctx, | 729 static vpx_codec_err_t vp8_get_frame_corrupted(vpx_codec_alg_priv_t *ctx, |
| 707 int ctrl_id, | |
| 708 va_list args) | 730 va_list args) |
| 709 { | 731 { |
| 710 | 732 |
| 711 int *corrupted = va_arg(args, int *); | 733 int *corrupted = va_arg(args, int *); |
| 712 VP8D_COMP *pbi = (VP8D_COMP *)ctx->yv12_frame_buffers.pbi[0]; | 734 VP8D_COMP *pbi = (VP8D_COMP *)ctx->yv12_frame_buffers.pbi[0]; |
| 713 | 735 |
| 714 if (corrupted && pbi) | 736 if (corrupted && pbi) |
| 715 { | 737 { |
| 716 *corrupted = pbi->common.frame_to_show->corrupted; | 738 *corrupted = pbi->common.frame_to_show->corrupted; |
| 717 | 739 |
| 718 return VPX_CODEC_OK; | 740 return VPX_CODEC_OK; |
| 719 } | 741 } |
| 720 else | 742 else |
| 721 return VPX_CODEC_INVALID_PARAM; | 743 return VPX_CODEC_INVALID_PARAM; |
| 722 | 744 |
| 723 } | 745 } |
| 724 | 746 |
| 725 static vpx_codec_err_t vp8_set_decryptor(vpx_codec_alg_priv_t *ctx, | 747 static vpx_codec_err_t vp8_set_decryptor(vpx_codec_alg_priv_t *ctx, |
| 726 int ctrl_id, | |
| 727 va_list args) | 748 va_list args) |
| 728 { | 749 { |
| 729 vpx_decrypt_init *init = va_arg(args, vpx_decrypt_init *); | 750 vpx_decrypt_init *init = va_arg(args, vpx_decrypt_init *); |
| 730 | 751 |
| 731 if (init) | 752 if (init) |
| 732 { | 753 { |
| 733 ctx->decrypt_cb = init->decrypt_cb; | 754 ctx->decrypt_cb = init->decrypt_cb; |
| 734 ctx->decrypt_state = init->decrypt_state; | 755 ctx->decrypt_state = init->decrypt_state; |
| 735 } | 756 } |
| 736 else | 757 else |
| 737 { | 758 { |
| 738 ctx->decrypt_cb = NULL; | 759 ctx->decrypt_cb = NULL; |
| 739 ctx->decrypt_state = NULL; | 760 ctx->decrypt_state = NULL; |
| 740 } | 761 } |
| 741 return VPX_CODEC_OK; | 762 return VPX_CODEC_OK; |
| 742 } | 763 } |
| 743 | 764 |
| 744 vpx_codec_ctrl_fn_map_t vp8_ctf_maps[] = | 765 vpx_codec_ctrl_fn_map_t vp8_ctf_maps[] = |
| 745 { | 766 { |
| 746 {VP8_SET_REFERENCE, vp8_set_reference}, | 767 {VP8_SET_REFERENCE, vp8_set_reference}, |
| 747 {VP8_COPY_REFERENCE, vp8_get_reference}, | 768 {VP8_COPY_REFERENCE, vp8_get_reference}, |
| 748 {VP8_SET_POSTPROC, vp8_set_postproc}, | 769 {VP8_SET_POSTPROC, vp8_set_postproc}, |
| 749 {VP8_SET_DBG_COLOR_REF_FRAME, vp8_set_dbg_options}, | 770 {VP8_SET_DBG_COLOR_REF_FRAME, vp8_set_dbg_color_ref_frame}, |
| 750 {VP8_SET_DBG_COLOR_MB_MODES, vp8_set_dbg_options}, | 771 {VP8_SET_DBG_COLOR_MB_MODES, vp8_set_dbg_color_mb_modes}, |
| 751 {VP8_SET_DBG_COLOR_B_MODES, vp8_set_dbg_options}, | 772 {VP8_SET_DBG_COLOR_B_MODES, vp8_set_dbg_color_b_modes}, |
| 752 {VP8_SET_DBG_DISPLAY_MV, vp8_set_dbg_options}, | 773 {VP8_SET_DBG_DISPLAY_MV, vp8_set_dbg_display_mv}, |
| 753 {VP8D_GET_LAST_REF_UPDATES, vp8_get_last_ref_updates}, | 774 {VP8D_GET_LAST_REF_UPDATES, vp8_get_last_ref_updates}, |
| 754 {VP8D_GET_FRAME_CORRUPTED, vp8_get_frame_corrupted}, | 775 {VP8D_GET_FRAME_CORRUPTED, vp8_get_frame_corrupted}, |
| 755 {VP8D_GET_LAST_REF_USED, vp8_get_last_ref_frame}, | 776 {VP8D_GET_LAST_REF_USED, vp8_get_last_ref_frame}, |
| 756 {VPXD_SET_DECRYPTOR, vp8_set_decryptor}, | 777 {VPXD_SET_DECRYPTOR, vp8_set_decryptor}, |
| 757 { -1, NULL}, | 778 { -1, NULL}, |
| 758 }; | 779 }; |
| 759 | 780 |
| 760 | 781 |
| 761 #ifndef VERSION_STRING | 782 #ifndef VERSION_STRING |
| 762 #define VERSION_STRING | 783 #define VERSION_STRING |
| (...skipping 19 matching lines...) Expand all Loading... |
| 782 }, | 803 }, |
| 783 { /* encoder functions */ | 804 { /* encoder functions */ |
| 784 NOT_IMPLEMENTED, | 805 NOT_IMPLEMENTED, |
| 785 NOT_IMPLEMENTED, | 806 NOT_IMPLEMENTED, |
| 786 NOT_IMPLEMENTED, | 807 NOT_IMPLEMENTED, |
| 787 NOT_IMPLEMENTED, | 808 NOT_IMPLEMENTED, |
| 788 NOT_IMPLEMENTED, | 809 NOT_IMPLEMENTED, |
| 789 NOT_IMPLEMENTED | 810 NOT_IMPLEMENTED |
| 790 } | 811 } |
| 791 }; | 812 }; |
| OLD | NEW |