| 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 | 11 | 
| 12 #include <stdio.h> | 12 #include <stdio.h> | 
| 13 | 13 | 
| 14 #include "entropy.h" | 14 #include "entropy.h" | 
| 15 #include "string.h" | 15 #include "string.h" | 
| 16 #include "blockd.h" | 16 #include "blockd.h" | 
| 17 #include "onyxc_int.h" | 17 #include "onyxc_int.h" | 
| 18 | 18 | 
| 19 #define uchar unsigned char     /* typedefs can clash */ | 19 #define uchar unsigned char     /* typedefs can clash */ | 
| 20 #define uint  unsigned int | 20 #define uint  unsigned int | 
| 21 | 21 | 
| 22 typedef const uchar cuchar; | 22 typedef const uchar cuchar; | 
| 23 typedef const uint cuint; | 23 typedef const uint cuint; | 
| 24 | 24 | 
| 25 typedef vp8_prob Prob; | 25 typedef vp8_prob Prob; | 
| 26 | 26 | 
| 27 #include "coefupdateprobs.h" | 27 #include "coefupdateprobs.h" | 
| 28 | 28 | 
| 29 DECLARE_ALIGNED(16, cuchar, vp8_coef_bands[16]) = { 0, 1, 2, 3, 6, 4, 5, 6, 6, 6
     , 6, 6, 6, 6, 6, 7}; | 29 DECLARE_ALIGNED(16, const unsigned char, vp8_norm[256]) = | 
| 30 DECLARE_ALIGNED(16, cuchar, vp8_prev_token_class[MAX_ENTROPY_TOKENS]) = { 0, 1, 
     2, 2, 2, 2, 2, 2, 2, 2, 2, 0}; | 30 { | 
|  | 31     0, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, | 
|  | 32     3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, | 
|  | 33     2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 
|  | 34     2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | 
|  | 35     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 
|  | 36     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 
|  | 37     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 
|  | 38     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 
|  | 39     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 
|  | 40     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 
|  | 41     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 
|  | 42     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 
|  | 43     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 
|  | 44     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 
|  | 45     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 
|  | 46     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 | 
|  | 47 }; | 
|  | 48 | 
|  | 49 DECLARE_ALIGNED(16, cuchar, vp8_coef_bands[16]) = | 
|  | 50 { 0, 1, 2, 3, 6, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7}; | 
|  | 51 | 
|  | 52 DECLARE_ALIGNED(16, cuchar, vp8_prev_token_class[MAX_ENTROPY_TOKENS]) = | 
|  | 53 { 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0}; | 
|  | 54 | 
| 31 DECLARE_ALIGNED(16, const int, vp8_default_zig_zag1d[16]) = | 55 DECLARE_ALIGNED(16, const int, vp8_default_zig_zag1d[16]) = | 
| 32 { | 56 { | 
| 33     0,  1,  4,  8, | 57     0,  1,  4,  8, | 
| 34     5,  2,  3,  6, | 58     5,  2,  3,  6, | 
| 35     9, 12, 13, 10, | 59     9, 12, 13, 10, | 
| 36     7, 11, 14, 15, | 60     7, 11, 14, 15, | 
| 37 }; | 61 }; | 
| 38 | 62 | 
| 39 DECLARE_ALIGNED(16, const short, vp8_default_inv_zig_zag[16]) = | 63 DECLARE_ALIGNED(16, const short, vp8_default_inv_zig_zag[16]) = | 
| 40 { | 64 { | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
| 58     8, 12,                                      /* 3 = LOW_VAL */ | 82     8, 12,                                      /* 3 = LOW_VAL */ | 
| 59     -TWO_TOKEN, 10,                            /* 4 = TWO */ | 83     -TWO_TOKEN, 10,                            /* 4 = TWO */ | 
| 60     -THREE_TOKEN, -FOUR_TOKEN,                /* 5 = THREE */ | 84     -THREE_TOKEN, -FOUR_TOKEN,                /* 5 = THREE */ | 
| 61     14, 16,                                    /* 6 = HIGH_LOW */ | 85     14, 16,                                    /* 6 = HIGH_LOW */ | 
| 62     -DCT_VAL_CATEGORY1, -DCT_VAL_CATEGORY2,   /* 7 = CAT_ONE */ | 86     -DCT_VAL_CATEGORY1, -DCT_VAL_CATEGORY2,   /* 7 = CAT_ONE */ | 
| 63     18, 20,                                   /* 8 = CAT_THREEFOUR */ | 87     18, 20,                                   /* 8 = CAT_THREEFOUR */ | 
| 64     -DCT_VAL_CATEGORY3, -DCT_VAL_CATEGORY4,  /* 9 = CAT_THREE */ | 88     -DCT_VAL_CATEGORY3, -DCT_VAL_CATEGORY4,  /* 9 = CAT_THREE */ | 
| 65     -DCT_VAL_CATEGORY5, -DCT_VAL_CATEGORY6   /* 10 = CAT_FIVE */ | 89     -DCT_VAL_CATEGORY5, -DCT_VAL_CATEGORY6   /* 10 = CAT_FIVE */ | 
| 66 }; | 90 }; | 
| 67 | 91 | 
| 68 struct vp8_token_struct vp8_coef_encodings[vp8_coef_tokens]; | 92 struct vp8_token_struct vp8_coef_encodings[MAX_ENTROPY_TOKENS]; | 
| 69 | 93 | 
| 70 /* Trees for extra bits.  Probabilities are constant and | 94 /* Trees for extra bits.  Probabilities are constant and | 
| 71    do not depend on previously encoded bits */ | 95    do not depend on previously encoded bits */ | 
| 72 | 96 | 
| 73 static const Prob Pcat1[] = { 159}; | 97 static const Prob Pcat1[] = { 159}; | 
| 74 static const Prob Pcat2[] = { 165, 145}; | 98 static const Prob Pcat2[] = { 165, 145}; | 
| 75 static const Prob Pcat3[] = { 173, 148, 140}; | 99 static const Prob Pcat3[] = { 173, 148, 140}; | 
| 76 static const Prob Pcat4[] = { 176, 155, 140, 135}; | 100 static const Prob Pcat4[] = { 176, 155, 140, 135}; | 
| 77 static const Prob Pcat5[] = { 180, 157, 141, 134, 130}; | 101 static const Prob Pcat5[] = { 180, 157, 141, 134, 130}; | 
| 78 static const Prob Pcat6[] = | 102 static const Prob Pcat6[] = | 
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 138     do | 162     do | 
| 139     { | 163     { | 
| 140         int i = 0; | 164         int i = 0; | 
| 141 | 165 | 
| 142         do | 166         do | 
| 143         { | 167         { | 
| 144             int k = 0; | 168             int k = 0; | 
| 145 | 169 | 
| 146             do | 170             do | 
| 147             { | 171             { | 
| 148                 unsigned int branch_ct [vp8_coef_tokens-1] [2]; | 172                 unsigned int branch_ct [ENTROPY_NODES] [2]; | 
| 149                 vp8_tree_probs_from_distribution( | 173                 vp8_tree_probs_from_distribution( | 
| 150                     vp8_coef_tokens, vp8_coef_encodings, vp8_coef_tree, | 174                     MAX_ENTROPY_TOKENS, vp8_coef_encodings, vp8_coef_tree, | 
| 151                     pc->fc.coef_probs [h][i][k], branch_ct, default_coef_counts 
     [h][i][k], | 175                     pc->fc.coef_probs[h][i][k], | 
|  | 176                     branch_ct, | 
|  | 177                     vp8_default_coef_counts[h][i][k], | 
| 152                     256, 1); | 178                     256, 1); | 
| 153 | 179 | 
| 154             } | 180             } | 
| 155             while (++k < PREV_COEF_CONTEXTS); | 181             while (++k < PREV_COEF_CONTEXTS); | 
| 156         } | 182         } | 
| 157         while (++i < COEF_BANDS); | 183         while (++i < COEF_BANDS); | 
| 158     } | 184     } | 
| 159     while (++h < BLOCK_TYPES); | 185     while (++h < BLOCK_TYPES); | 
| 160 } | 186 } | 
| 161 | 187 | 
| 162 | 188 | 
| 163 void vp8_coef_tree_initialize() | 189 void vp8_coef_tree_initialize() | 
| 164 { | 190 { | 
| 165     init_bit_trees(); | 191     init_bit_trees(); | 
| 166     vp8_tokens_from_tree(vp8_coef_encodings, vp8_coef_tree); | 192     vp8_tokens_from_tree(vp8_coef_encodings, vp8_coef_tree); | 
| 167 } | 193 } | 
| OLD | NEW | 
|---|