Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: source/libvpx/vp8/decoder/decodframe.c

Issue 12077056: libvpx: Pull from upstream (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/libs.mk ('k') | source/libvpx/vp8/decoder/onyxd_if.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 } 821 }
822 822
823 823
824 static void setup_token_decoder(VP8D_COMP *pbi, 824 static void setup_token_decoder(VP8D_COMP *pbi,
825 const unsigned char* token_part_sizes) 825 const unsigned char* token_part_sizes)
826 { 826 {
827 vp8_reader *bool_decoder = &pbi->mbc[0]; 827 vp8_reader *bool_decoder = &pbi->mbc[0];
828 unsigned int partition_idx; 828 unsigned int partition_idx;
829 unsigned int fragment_idx; 829 unsigned int fragment_idx;
830 unsigned int num_token_partitions; 830 unsigned int num_token_partitions;
831 const unsigned char *first_fragment_end = pbi->fragments[0] + 831 const unsigned char *first_fragment_end = pbi->fragments.ptrs[0] +
832 pbi->fragment_sizes[0]; 832 pbi->fragments.sizes[0];
833 833
834 TOKEN_PARTITION multi_token_partition = 834 TOKEN_PARTITION multi_token_partition =
835 (TOKEN_PARTITION)vp8_read_literal(&pbi->mbc[8], 2); 835 (TOKEN_PARTITION)vp8_read_literal(&pbi->mbc[8], 2);
836 if (!vp8dx_bool_error(&pbi->mbc[8])) 836 if (!vp8dx_bool_error(&pbi->mbc[8]))
837 pbi->common.multi_token_partition = multi_token_partition; 837 pbi->common.multi_token_partition = multi_token_partition;
838 num_token_partitions = 1 << pbi->common.multi_token_partition; 838 num_token_partitions = 1 << pbi->common.multi_token_partition;
839 839
840 /* Check for partitions within the fragments and unpack the fragments 840 /* Check for partitions within the fragments and unpack the fragments
841 * so that each fragment pointer points to its corresponding partition. */ 841 * so that each fragment pointer points to its corresponding partition. */
842 for (fragment_idx = 0; fragment_idx < pbi->num_fragments; ++fragment_idx) 842 for (fragment_idx = 0; fragment_idx < pbi->fragments.count; ++fragment_idx)
843 { 843 {
844 unsigned int fragment_size = pbi->fragment_sizes[fragment_idx]; 844 unsigned int fragment_size = pbi->fragments.sizes[fragment_idx];
845 const unsigned char *fragment_end = pbi->fragments[fragment_idx] + 845 const unsigned char *fragment_end = pbi->fragments.ptrs[fragment_idx] +
846 fragment_size; 846 fragment_size;
847 /* Special case for handling the first partition since we have already 847 /* Special case for handling the first partition since we have already
848 * read its size. */ 848 * read its size. */
849 if (fragment_idx == 0) 849 if (fragment_idx == 0)
850 { 850 {
851 /* Size of first partition + token partition sizes element */ 851 /* Size of first partition + token partition sizes element */
852 ptrdiff_t ext_first_part_size = token_part_sizes - 852 ptrdiff_t ext_first_part_size = token_part_sizes -
853 pbi->fragments[0] + 3 * (num_token_partitions - 1); 853 pbi->fragments.ptrs[0] + 3 * (num_token_partitions - 1);
854 fragment_size -= (unsigned int)ext_first_part_size; 854 fragment_size -= (unsigned int)ext_first_part_size;
855 if (fragment_size > 0) 855 if (fragment_size > 0)
856 { 856 {
857 pbi->fragment_sizes[0] = (unsigned int)ext_first_part_size; 857 pbi->fragments.sizes[0] = (unsigned int)ext_first_part_size;
858 /* The fragment contains an additional partition. Move to 858 /* The fragment contains an additional partition. Move to
859 * next. */ 859 * next. */
860 fragment_idx++; 860 fragment_idx++;
861 pbi->fragments[fragment_idx] = pbi->fragments[0] + 861 pbi->fragments.ptrs[fragment_idx] = pbi->fragments.ptrs[0] +
862 pbi->fragment_sizes[0]; 862 pbi->fragments.sizes[0];
863 } 863 }
864 } 864 }
865 /* Split the chunk into partitions read from the bitstream */ 865 /* Split the chunk into partitions read from the bitstream */
866 while (fragment_size > 0) 866 while (fragment_size > 0)
867 { 867 {
868 ptrdiff_t partition_size = read_available_partition_size( 868 ptrdiff_t partition_size = read_available_partition_size(
869 pbi, 869 pbi,
870 token_part_sizes, 870 token_part_sizes,
871 pbi->fragments[fragment_idx], 871 pbi->fragments.ptrs[fragment_id x],
872 first_fragment_end, 872 first_fragment_end,
873 fragment_end, 873 fragment_end,
874 fragment_idx - 1, 874 fragment_idx - 1,
875 num_token_partitions); 875 num_token_partitions);
876 pbi->fragment_sizes[fragment_idx] = (unsigned int)partition_size; 876 pbi->fragments.sizes[fragment_idx] = (unsigned int)partition_size;
877 fragment_size -= (unsigned int)partition_size; 877 fragment_size -= (unsigned int)partition_size;
878 assert(fragment_idx <= num_token_partitions); 878 assert(fragment_idx <= num_token_partitions);
879 if (fragment_size > 0) 879 if (fragment_size > 0)
880 { 880 {
881 /* The fragment contains an additional partition. 881 /* The fragment contains an additional partition.
882 * Move to next. */ 882 * Move to next. */
883 fragment_idx++; 883 fragment_idx++;
884 pbi->fragments[fragment_idx] = 884 pbi->fragments.ptrs[fragment_idx] =
885 pbi->fragments[fragment_idx - 1] + partition_size; 885 pbi->fragments.ptrs[fragment_idx - 1] + partition_size;
886 } 886 }
887 } 887 }
888 } 888 }
889 889
890 pbi->num_fragments = num_token_partitions + 1; 890 pbi->fragments.count = num_token_partitions + 1;
891 891
892 for (partition_idx = 1; partition_idx < pbi->num_fragments; ++partition_idx) 892 for (partition_idx = 1; partition_idx < pbi->fragments.count; ++partition_id x)
893 { 893 {
894 if (vp8dx_start_decode(bool_decoder, 894 if (vp8dx_start_decode(bool_decoder,
895 pbi->fragments[partition_idx], 895 pbi->fragments.ptrs[partition_idx],
896 pbi->fragment_sizes[partition_idx])) 896 pbi->fragments.sizes[partition_idx]))
897 vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR, 897 vpx_internal_error(&pbi->common.error, VPX_CODEC_MEM_ERROR,
898 "Failed to allocate bool decoder %d", 898 "Failed to allocate bool decoder %d",
899 partition_idx); 899 partition_idx);
900 900
901 bool_decoder++; 901 bool_decoder++;
902 } 902 }
903 903
904 #if CONFIG_MULTITHREAD 904 #if CONFIG_MULTITHREAD
905 /* Clamp number of decoder threads */ 905 /* Clamp number of decoder threads */
906 if (pbi->decoding_thread_count > num_token_partitions - 1) 906 if (pbi->decoding_thread_count > num_token_partitions - 1)
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 if(pc->full_pixel) 976 if(pc->full_pixel)
977 xd->fullpixel_mask = 0xfffffff8; 977 xd->fullpixel_mask = 0xfffffff8;
978 978
979 } 979 }
980 980
981 int vp8_decode_frame(VP8D_COMP *pbi) 981 int vp8_decode_frame(VP8D_COMP *pbi)
982 { 982 {
983 vp8_reader *const bc = & pbi->mbc[8]; 983 vp8_reader *const bc = & pbi->mbc[8];
984 VP8_COMMON *const pc = & pbi->common; 984 VP8_COMMON *const pc = & pbi->common;
985 MACROBLOCKD *const xd = & pbi->mb; 985 MACROBLOCKD *const xd = & pbi->mb;
986 const unsigned char *data = pbi->fragments[0]; 986 const unsigned char *data = pbi->fragments.ptrs[0];
987 const unsigned char *data_end = data + pbi->fragment_sizes[0]; 987 const unsigned char *data_end = data + pbi->fragments.sizes[0];
988 ptrdiff_t first_partition_length_in_bytes; 988 ptrdiff_t first_partition_length_in_bytes;
989 989
990 int i, j, k, l; 990 int i, j, k, l;
991 const int *const mb_feature_data_bits = vp8_mb_feature_data_bits; 991 const int *const mb_feature_data_bits = vp8_mb_feature_data_bits;
992 int corrupt_tokens = 0; 992 int corrupt_tokens = 0;
993 int prev_independent_partitions = pbi->independent_partitions; 993 int prev_independent_partitions = pbi->independent_partitions;
994 994
995 YV12_BUFFER_CONFIG *yv12_fb_new = pbi->dec_fb_ref[INTRA_FRAME]; 995 YV12_BUFFER_CONFIG *yv12_fb_new = pbi->dec_fb_ref[INTRA_FRAME];
996 996
997 /* start with no corruption of current frame */ 997 /* start with no corruption of current frame */
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 FILE *f = fopen("decompressor.VP8", "ab"); 1377 FILE *f = fopen("decompressor.VP8", "ab");
1378 unsigned int size = pbi->bc2.pos + pbi->bc.pos + 8; 1378 unsigned int size = pbi->bc2.pos + pbi->bc.pos + 8;
1379 fwrite((void *) &size, 4, 1, f); 1379 fwrite((void *) &size, 4, 1, f);
1380 fwrite((void *) pbi->Source, size, 1, f); 1380 fwrite((void *) pbi->Source, size, 1, f);
1381 fclose(f); 1381 fclose(f);
1382 } 1382 }
1383 #endif 1383 #endif
1384 1384
1385 return 0; 1385 return 0;
1386 } 1386 }
OLDNEW
« no previous file with comments | « source/libvpx/libs.mk ('k') | source/libvpx/vp8/decoder/onyxd_if.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698