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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 | 403 |
404 return p; | 404 return p; |
405 } | 405 } |
406 | 406 |
407 static void decode_partition(VP9_COMMON *const cm, MACROBLOCKD *const xd, | 407 static void decode_partition(VP9_COMMON *const cm, MACROBLOCKD *const xd, |
408 const TileInfo *const tile, | 408 const TileInfo *const tile, |
409 int mi_row, int mi_col, | 409 int mi_row, int mi_col, |
410 vp9_reader* r, BLOCK_SIZE bsize) { | 410 vp9_reader* r, BLOCK_SIZE bsize) { |
411 const int hbs = num_8x8_blocks_wide_lookup[bsize] / 2; | 411 const int hbs = num_8x8_blocks_wide_lookup[bsize] / 2; |
412 PARTITION_TYPE partition; | 412 PARTITION_TYPE partition; |
413 BLOCK_SIZE subsize; | 413 BLOCK_SIZE subsize, uv_subsize; |
414 | 414 |
415 if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) | 415 if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) |
416 return; | 416 return; |
417 | 417 |
418 partition = read_partition(cm, xd, hbs, mi_row, mi_col, bsize, r); | 418 partition = read_partition(cm, xd, hbs, mi_row, mi_col, bsize, r); |
419 subsize = get_subsize(bsize, partition); | 419 subsize = get_subsize(bsize, partition); |
| 420 uv_subsize = ss_size_lookup[subsize][cm->subsampling_x][cm->subsampling_y]; |
| 421 if (subsize >= BLOCK_8X8 && uv_subsize == BLOCK_INVALID) |
| 422 vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME, |
| 423 "Invalid block size."); |
420 if (subsize < BLOCK_8X8) { | 424 if (subsize < BLOCK_8X8) { |
421 decode_block(cm, xd, tile, mi_row, mi_col, r, subsize); | 425 decode_block(cm, xd, tile, mi_row, mi_col, r, subsize); |
422 } else { | 426 } else { |
423 switch (partition) { | 427 switch (partition) { |
424 case PARTITION_NONE: | 428 case PARTITION_NONE: |
425 decode_block(cm, xd, tile, mi_row, mi_col, r, subsize); | 429 decode_block(cm, xd, tile, mi_row, mi_col, r, subsize); |
426 break; | 430 break; |
427 case PARTITION_HORZ: | 431 case PARTITION_HORZ: |
428 decode_block(cm, xd, tile, mi_row, mi_col, r, subsize); | 432 decode_block(cm, xd, tile, mi_row, mi_col, r, subsize); |
429 if (mi_row + hbs < cm->mi_rows) | 433 if (mi_row + hbs < cm->mi_rows) |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 width = buf->y_crop_width; | 664 width = buf->y_crop_width; |
661 height = buf->y_crop_height; | 665 height = buf->y_crop_height; |
662 found = 1; | 666 found = 1; |
663 break; | 667 break; |
664 } | 668 } |
665 } | 669 } |
666 | 670 |
667 if (!found) | 671 if (!found) |
668 read_frame_size(rb, &width, &height); | 672 read_frame_size(rb, &width, &height); |
669 | 673 |
670 if (width <= 0 || height <= 0) | 674 // Check that each of the frames that this frame references has valid |
671 vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME, | 675 // dimensions. |
672 "Referenced frame with invalid size"); | 676 for (i = 0; i < REFS_PER_FRAME; ++i) { |
| 677 RefBuffer *const ref_frame = &cm->frame_refs[i]; |
| 678 const int ref_width = ref_frame->buf->y_width; |
| 679 const int ref_height = ref_frame->buf->y_height; |
| 680 |
| 681 if (!valid_ref_frame_size(ref_width, ref_height, width, height)) |
| 682 vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME, |
| 683 "Referenced frame has invalid size"); |
| 684 } |
673 | 685 |
674 apply_frame_size(cm, width, height); | 686 apply_frame_size(cm, width, height); |
675 setup_display_size(cm, rb); | 687 setup_display_size(cm, rb); |
676 } | 688 } |
677 | 689 |
678 static void setup_tile_info(VP9_COMMON *cm, struct vp9_read_bit_buffer *rb) { | 690 static void setup_tile_info(VP9_COMMON *cm, struct vp9_read_bit_buffer *rb) { |
679 int min_log2_tile_cols, max_log2_tile_cols, max_ones; | 691 int min_log2_tile_cols, max_log2_tile_cols, max_ones; |
680 vp9_get_tile_n_bits(cm->mi_cols, &min_log2_tile_cols, &max_log2_tile_cols); | 692 vp9_get_tile_n_bits(cm->mi_cols, &min_log2_tile_cols, &max_log2_tile_cols); |
681 | 693 |
682 // columns | 694 // columns |
683 max_ones = max_log2_tile_cols - min_log2_tile_cols; | 695 max_ones = max_log2_tile_cols - min_log2_tile_cols; |
684 cm->log2_tile_cols = min_log2_tile_cols; | 696 cm->log2_tile_cols = min_log2_tile_cols; |
685 while (max_ones-- && vp9_rb_read_bit(rb)) | 697 while (max_ones-- && vp9_rb_read_bit(rb)) |
686 cm->log2_tile_cols++; | 698 cm->log2_tile_cols++; |
687 | 699 |
| 700 if (cm->log2_tile_cols > 6) |
| 701 vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME, |
| 702 "Invalid number of tile columns"); |
| 703 |
688 // rows | 704 // rows |
689 cm->log2_tile_rows = vp9_rb_read_bit(rb); | 705 cm->log2_tile_rows = vp9_rb_read_bit(rb); |
690 if (cm->log2_tile_rows) | 706 if (cm->log2_tile_rows) |
691 cm->log2_tile_rows += vp9_rb_read_bit(rb); | 707 cm->log2_tile_rows += vp9_rb_read_bit(rb); |
692 } | 708 } |
693 | 709 |
694 typedef struct TileBuffer { | 710 typedef struct TileBuffer { |
695 const uint8_t *data; | 711 const uint8_t *data; |
696 size_t size; | 712 size_t size; |
697 int col; // only used with multi-threaded decoding | 713 int col; // only used with multi-threaded decoding |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 get_tile_buffer(data_end, is_last, &pbi->common.error, &data, | 764 get_tile_buffer(data_end, is_last, &pbi->common.error, &data, |
749 pbi->decrypt_cb, pbi->decrypt_state, buf); | 765 pbi->decrypt_cb, pbi->decrypt_state, buf); |
750 } | 766 } |
751 } | 767 } |
752 } | 768 } |
753 | 769 |
754 static const uint8_t *decode_tiles(VP9Decoder *pbi, | 770 static const uint8_t *decode_tiles(VP9Decoder *pbi, |
755 const uint8_t *data, | 771 const uint8_t *data, |
756 const uint8_t *data_end) { | 772 const uint8_t *data_end) { |
757 VP9_COMMON *const cm = &pbi->common; | 773 VP9_COMMON *const cm = &pbi->common; |
| 774 const VP9WorkerInterface *const winterface = vp9_get_worker_interface(); |
758 const int aligned_cols = mi_cols_aligned_to_sb(cm->mi_cols); | 775 const int aligned_cols = mi_cols_aligned_to_sb(cm->mi_cols); |
759 const int tile_cols = 1 << cm->log2_tile_cols; | 776 const int tile_cols = 1 << cm->log2_tile_cols; |
760 const int tile_rows = 1 << cm->log2_tile_rows; | 777 const int tile_rows = 1 << cm->log2_tile_rows; |
761 TileBuffer tile_buffers[4][1 << 6]; | 778 TileBuffer tile_buffers[4][1 << 6]; |
762 int tile_row, tile_col; | 779 int tile_row, tile_col; |
763 int mi_row, mi_col; | 780 int mi_row, mi_col; |
764 TileData *tile_data = NULL; | 781 TileData *tile_data = NULL; |
765 | 782 |
766 if (cm->lf.filter_level && pbi->lf_worker.data1 == NULL) { | 783 if (cm->lf.filter_level && pbi->lf_worker.data1 == NULL) { |
767 CHECK_MEM_ERROR(cm, pbi->lf_worker.data1, | 784 CHECK_MEM_ERROR(cm, pbi->lf_worker.data1, |
768 vpx_memalign(32, sizeof(LFWorkerData))); | 785 vpx_memalign(32, sizeof(LFWorkerData))); |
769 pbi->lf_worker.hook = (VP9WorkerHook)vp9_loop_filter_worker; | 786 pbi->lf_worker.hook = (VP9WorkerHook)vp9_loop_filter_worker; |
770 if (pbi->max_threads > 1 && !vp9_worker_reset(&pbi->lf_worker)) { | 787 if (pbi->max_threads > 1 && !winterface->reset(&pbi->lf_worker)) { |
771 vpx_internal_error(&cm->error, VPX_CODEC_ERROR, | 788 vpx_internal_error(&cm->error, VPX_CODEC_ERROR, |
772 "Loop filter thread creation failed"); | 789 "Loop filter thread creation failed"); |
773 } | 790 } |
774 } | 791 } |
775 | 792 |
776 if (cm->lf.filter_level) { | 793 if (cm->lf.filter_level) { |
777 LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1; | 794 LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1; |
778 lf_data->frame_buffer = get_frame_new_buffer(cm); | 795 lf_data->frame_buffer = get_frame_new_buffer(cm); |
779 lf_data->cm = cm; | 796 lf_data->cm = cm; |
780 vp9_copy(lf_data->planes, pbi->mb.plane); | 797 vp9_copy(lf_data->planes, pbi->mb.plane); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 if (cm->lf.filter_level) { | 863 if (cm->lf.filter_level) { |
847 const int lf_start = mi_row - MI_BLOCK_SIZE; | 864 const int lf_start = mi_row - MI_BLOCK_SIZE; |
848 LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1; | 865 LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1; |
849 | 866 |
850 // delay the loopfilter by 1 macroblock row. | 867 // delay the loopfilter by 1 macroblock row. |
851 if (lf_start < 0) continue; | 868 if (lf_start < 0) continue; |
852 | 869 |
853 // decoding has completed: finish up the loop filter in this thread. | 870 // decoding has completed: finish up the loop filter in this thread. |
854 if (mi_row + MI_BLOCK_SIZE >= cm->mi_rows) continue; | 871 if (mi_row + MI_BLOCK_SIZE >= cm->mi_rows) continue; |
855 | 872 |
856 vp9_worker_sync(&pbi->lf_worker); | 873 winterface->sync(&pbi->lf_worker); |
857 lf_data->start = lf_start; | 874 lf_data->start = lf_start; |
858 lf_data->stop = mi_row; | 875 lf_data->stop = mi_row; |
859 if (pbi->max_threads > 1) { | 876 if (pbi->max_threads > 1) { |
860 vp9_worker_launch(&pbi->lf_worker); | 877 winterface->launch(&pbi->lf_worker); |
861 } else { | 878 } else { |
862 vp9_worker_execute(&pbi->lf_worker); | 879 winterface->execute(&pbi->lf_worker); |
863 } | 880 } |
864 } | 881 } |
865 } | 882 } |
866 } | 883 } |
867 | 884 |
868 // Loopfilter remaining rows in the frame. | 885 // Loopfilter remaining rows in the frame. |
869 if (cm->lf.filter_level) { | 886 if (cm->lf.filter_level) { |
870 LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1; | 887 LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1; |
871 vp9_worker_sync(&pbi->lf_worker); | 888 winterface->sync(&pbi->lf_worker); |
872 lf_data->start = lf_data->stop; | 889 lf_data->start = lf_data->stop; |
873 lf_data->stop = cm->mi_rows; | 890 lf_data->stop = cm->mi_rows; |
874 vp9_worker_execute(&pbi->lf_worker); | 891 winterface->execute(&pbi->lf_worker); |
875 } | 892 } |
876 | 893 |
877 // Get last tile data. | 894 // Get last tile data. |
878 tile_data = pbi->tile_data + tile_cols * tile_rows - 1; | 895 tile_data = pbi->tile_data + tile_cols * tile_rows - 1; |
879 | 896 |
880 return vp9_reader_find_end(&tile_data->bit_reader); | 897 return vp9_reader_find_end(&tile_data->bit_reader); |
881 } | 898 } |
882 | 899 |
883 static int tile_worker_hook(void *arg1, void *arg2) { | 900 static int tile_worker_hook(void *arg1, void *arg2) { |
884 TileWorkerData *const tile_data = (TileWorkerData*)arg1; | 901 TileWorkerData *const tile_data = (TileWorkerData*)arg1; |
(...skipping 23 matching lines...) Expand all Loading... |
908 return 0; | 925 return 0; |
909 } else { | 926 } else { |
910 return -1; | 927 return -1; |
911 } | 928 } |
912 } | 929 } |
913 | 930 |
914 static const uint8_t *decode_tiles_mt(VP9Decoder *pbi, | 931 static const uint8_t *decode_tiles_mt(VP9Decoder *pbi, |
915 const uint8_t *data, | 932 const uint8_t *data, |
916 const uint8_t *data_end) { | 933 const uint8_t *data_end) { |
917 VP9_COMMON *const cm = &pbi->common; | 934 VP9_COMMON *const cm = &pbi->common; |
| 935 const VP9WorkerInterface *const winterface = vp9_get_worker_interface(); |
918 const uint8_t *bit_reader_end = NULL; | 936 const uint8_t *bit_reader_end = NULL; |
919 const int aligned_mi_cols = mi_cols_aligned_to_sb(cm->mi_cols); | 937 const int aligned_mi_cols = mi_cols_aligned_to_sb(cm->mi_cols); |
920 const int tile_cols = 1 << cm->log2_tile_cols; | 938 const int tile_cols = 1 << cm->log2_tile_cols; |
921 const int tile_rows = 1 << cm->log2_tile_rows; | 939 const int tile_rows = 1 << cm->log2_tile_rows; |
922 const int num_workers = MIN(pbi->max_threads & ~1, tile_cols); | 940 const int num_workers = MIN(pbi->max_threads & ~1, tile_cols); |
923 TileBuffer tile_buffers[1][1 << 6]; | 941 TileBuffer tile_buffers[1][1 << 6]; |
924 int n; | 942 int n; |
925 int final_worker = -1; | 943 int final_worker = -1; |
926 | 944 |
927 assert(tile_cols <= (1 << 6)); | 945 assert(tile_cols <= (1 << 6)); |
928 assert(tile_rows == 1); | 946 assert(tile_rows == 1); |
929 (void)tile_rows; | 947 (void)tile_rows; |
930 | 948 |
931 // TODO(jzern): See if we can remove the restriction of passing in max | 949 // TODO(jzern): See if we can remove the restriction of passing in max |
932 // threads to the decoder. | 950 // threads to the decoder. |
933 if (pbi->num_tile_workers == 0) { | 951 if (pbi->num_tile_workers == 0) { |
934 const int num_threads = pbi->max_threads & ~1; | 952 const int num_threads = pbi->max_threads & ~1; |
935 int i; | 953 int i; |
936 // TODO(jzern): Allocate one less worker, as in the current code we only | 954 // TODO(jzern): Allocate one less worker, as in the current code we only |
937 // use num_threads - 1 workers. | 955 // use num_threads - 1 workers. |
938 CHECK_MEM_ERROR(cm, pbi->tile_workers, | 956 CHECK_MEM_ERROR(cm, pbi->tile_workers, |
939 vpx_malloc(num_threads * sizeof(*pbi->tile_workers))); | 957 vpx_malloc(num_threads * sizeof(*pbi->tile_workers))); |
940 for (i = 0; i < num_threads; ++i) { | 958 for (i = 0; i < num_threads; ++i) { |
941 VP9Worker *const worker = &pbi->tile_workers[i]; | 959 VP9Worker *const worker = &pbi->tile_workers[i]; |
942 ++pbi->num_tile_workers; | 960 ++pbi->num_tile_workers; |
943 | 961 |
944 vp9_worker_init(worker); | 962 winterface->init(worker); |
945 CHECK_MEM_ERROR(cm, worker->data1, | 963 CHECK_MEM_ERROR(cm, worker->data1, |
946 vpx_memalign(32, sizeof(TileWorkerData))); | 964 vpx_memalign(32, sizeof(TileWorkerData))); |
947 CHECK_MEM_ERROR(cm, worker->data2, vpx_malloc(sizeof(TileInfo))); | 965 CHECK_MEM_ERROR(cm, worker->data2, vpx_malloc(sizeof(TileInfo))); |
948 if (i < num_threads - 1 && !vp9_worker_reset(worker)) { | 966 if (i < num_threads - 1 && !winterface->reset(worker)) { |
949 vpx_internal_error(&cm->error, VPX_CODEC_ERROR, | 967 vpx_internal_error(&cm->error, VPX_CODEC_ERROR, |
950 "Tile decoder thread creation failed"); | 968 "Tile decoder thread creation failed"); |
951 } | 969 } |
952 } | 970 } |
953 } | 971 } |
954 | 972 |
955 // Reset tile decoding hook | 973 // Reset tile decoding hook |
956 for (n = 0; n < num_workers; ++n) { | 974 for (n = 0; n < num_workers; ++n) { |
957 pbi->tile_workers[n].hook = (VP9WorkerHook)tile_worker_hook; | 975 pbi->tile_workers[n].hook = (VP9WorkerHook)tile_worker_hook; |
958 } | 976 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 tile_data->xd.corrupted = 0; | 1019 tile_data->xd.corrupted = 0; |
1002 vp9_tile_init(tile, tile_data->cm, 0, buf->col); | 1020 vp9_tile_init(tile, tile_data->cm, 0, buf->col); |
1003 setup_token_decoder(buf->data, data_end, buf->size, &cm->error, | 1021 setup_token_decoder(buf->data, data_end, buf->size, &cm->error, |
1004 &tile_data->bit_reader, pbi->decrypt_cb, | 1022 &tile_data->bit_reader, pbi->decrypt_cb, |
1005 pbi->decrypt_state); | 1023 pbi->decrypt_state); |
1006 init_macroblockd(cm, &tile_data->xd); | 1024 init_macroblockd(cm, &tile_data->xd); |
1007 vp9_zero(tile_data->xd.dqcoeff); | 1025 vp9_zero(tile_data->xd.dqcoeff); |
1008 | 1026 |
1009 worker->had_error = 0; | 1027 worker->had_error = 0; |
1010 if (i == num_workers - 1 || n == tile_cols - 1) { | 1028 if (i == num_workers - 1 || n == tile_cols - 1) { |
1011 vp9_worker_execute(worker); | 1029 winterface->execute(worker); |
1012 } else { | 1030 } else { |
1013 vp9_worker_launch(worker); | 1031 winterface->launch(worker); |
1014 } | 1032 } |
1015 | 1033 |
1016 if (buf->col == tile_cols - 1) { | 1034 if (buf->col == tile_cols - 1) { |
1017 final_worker = i; | 1035 final_worker = i; |
1018 } | 1036 } |
1019 | 1037 |
1020 ++n; | 1038 ++n; |
1021 } | 1039 } |
1022 | 1040 |
1023 for (; i > 0; --i) { | 1041 for (; i > 0; --i) { |
1024 VP9Worker *const worker = &pbi->tile_workers[i - 1]; | 1042 VP9Worker *const worker = &pbi->tile_workers[i - 1]; |
1025 pbi->mb.corrupted |= !vp9_worker_sync(worker); | 1043 pbi->mb.corrupted |= !winterface->sync(worker); |
1026 } | 1044 } |
1027 if (final_worker > -1) { | 1045 if (final_worker > -1) { |
1028 TileWorkerData *const tile_data = | 1046 TileWorkerData *const tile_data = |
1029 (TileWorkerData*)pbi->tile_workers[final_worker].data1; | 1047 (TileWorkerData*)pbi->tile_workers[final_worker].data1; |
1030 bit_reader_end = vp9_reader_find_end(&tile_data->bit_reader); | 1048 bit_reader_end = vp9_reader_find_end(&tile_data->bit_reader); |
1031 final_worker = -1; | 1049 final_worker = -1; |
1032 } | 1050 } |
1033 } | 1051 } |
1034 | 1052 |
1035 return bit_reader_end; | 1053 return bit_reader_end; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 cm->reset_frame_context = cm->error_resilient_mode ? | 1149 cm->reset_frame_context = cm->error_resilient_mode ? |
1132 0 : vp9_rb_read_literal(rb, 2); | 1150 0 : vp9_rb_read_literal(rb, 2); |
1133 | 1151 |
1134 if (cm->intra_only) { | 1152 if (cm->intra_only) { |
1135 check_sync_code(cm, rb); | 1153 check_sync_code(cm, rb); |
1136 | 1154 |
1137 pbi->refresh_frame_flags = vp9_rb_read_literal(rb, REF_FRAMES); | 1155 pbi->refresh_frame_flags = vp9_rb_read_literal(rb, REF_FRAMES); |
1138 setup_frame_size(cm, rb); | 1156 setup_frame_size(cm, rb); |
1139 } else { | 1157 } else { |
1140 pbi->refresh_frame_flags = vp9_rb_read_literal(rb, REF_FRAMES); | 1158 pbi->refresh_frame_flags = vp9_rb_read_literal(rb, REF_FRAMES); |
1141 | |
1142 for (i = 0; i < REFS_PER_FRAME; ++i) { | 1159 for (i = 0; i < REFS_PER_FRAME; ++i) { |
1143 const int ref = vp9_rb_read_literal(rb, REF_FRAMES_LOG2); | 1160 const int ref = vp9_rb_read_literal(rb, REF_FRAMES_LOG2); |
1144 const int idx = cm->ref_frame_map[ref]; | 1161 const int idx = cm->ref_frame_map[ref]; |
1145 cm->frame_refs[i].idx = idx; | 1162 RefBuffer *const ref_frame = &cm->frame_refs[i]; |
1146 cm->frame_refs[i].buf = &cm->frame_bufs[idx].buf; | 1163 ref_frame->idx = idx; |
| 1164 ref_frame->buf = &cm->frame_bufs[idx].buf; |
1147 cm->ref_frame_sign_bias[LAST_FRAME + i] = vp9_rb_read_bit(rb); | 1165 cm->ref_frame_sign_bias[LAST_FRAME + i] = vp9_rb_read_bit(rb); |
1148 } | 1166 } |
1149 | 1167 |
1150 setup_frame_size_with_refs(cm, rb); | 1168 setup_frame_size_with_refs(cm, rb); |
1151 | 1169 |
1152 cm->allow_high_precision_mv = vp9_rb_read_bit(rb); | 1170 cm->allow_high_precision_mv = vp9_rb_read_bit(rb); |
1153 cm->interp_filter = read_interp_filter(rb); | 1171 cm->interp_filter = read_interp_filter(rb); |
1154 | 1172 |
1155 for (i = 0; i < REFS_PER_FRAME; ++i) { | 1173 for (i = 0; i < REFS_PER_FRAME; ++i) { |
1156 RefBuffer *const ref_buf = &cm->frame_refs[i]; | 1174 RefBuffer *const ref_buf = &cm->frame_refs[i]; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1315 rb->bit_buffer_end = data_end; | 1333 rb->bit_buffer_end = data_end; |
1316 } | 1334 } |
1317 return rb; | 1335 return rb; |
1318 } | 1336 } |
1319 | 1337 |
1320 void vp9_decode_frame(VP9Decoder *pbi, | 1338 void vp9_decode_frame(VP9Decoder *pbi, |
1321 const uint8_t *data, const uint8_t *data_end, | 1339 const uint8_t *data, const uint8_t *data_end, |
1322 const uint8_t **p_data_end) { | 1340 const uint8_t **p_data_end) { |
1323 VP9_COMMON *const cm = &pbi->common; | 1341 VP9_COMMON *const cm = &pbi->common; |
1324 MACROBLOCKD *const xd = &pbi->mb; | 1342 MACROBLOCKD *const xd = &pbi->mb; |
1325 struct vp9_read_bit_buffer rb = { 0 }; | 1343 struct vp9_read_bit_buffer rb = { NULL, NULL, 0, NULL, 0}; |
| 1344 |
1326 uint8_t clear_data[MAX_VP9_HEADER_SIZE]; | 1345 uint8_t clear_data[MAX_VP9_HEADER_SIZE]; |
1327 const size_t first_partition_size = read_uncompressed_header(pbi, | 1346 const size_t first_partition_size = read_uncompressed_header(pbi, |
1328 init_read_bit_buffer(pbi, &rb, data, data_end, clear_data)); | 1347 init_read_bit_buffer(pbi, &rb, data, data_end, clear_data)); |
1329 const int tile_rows = 1 << cm->log2_tile_rows; | 1348 const int tile_rows = 1 << cm->log2_tile_rows; |
1330 const int tile_cols = 1 << cm->log2_tile_cols; | 1349 const int tile_cols = 1 << cm->log2_tile_cols; |
1331 YV12_BUFFER_CONFIG *const new_fb = get_frame_new_buffer(cm); | 1350 YV12_BUFFER_CONFIG *const new_fb = get_frame_new_buffer(cm); |
1332 xd->cur_buf = new_fb; | 1351 xd->cur_buf = new_fb; |
1333 | 1352 |
1334 if (!first_partition_size) { | 1353 if (!first_partition_size) { |
1335 // showing a frame directly | 1354 // showing a frame directly |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 vp9_adapt_mv_probs(cm, cm->allow_high_precision_mv); | 1401 vp9_adapt_mv_probs(cm, cm->allow_high_precision_mv); |
1383 } | 1402 } |
1384 } else { | 1403 } else { |
1385 debug_check_frame_counts(cm); | 1404 debug_check_frame_counts(cm); |
1386 } | 1405 } |
1387 } | 1406 } |
1388 | 1407 |
1389 if (cm->refresh_frame_context) | 1408 if (cm->refresh_frame_context) |
1390 cm->frame_contexts[cm->frame_context_idx] = cm->fc; | 1409 cm->frame_contexts[cm->frame_context_idx] = cm->fc; |
1391 } | 1410 } |
OLD | NEW |