| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 The WebRTC 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 #include "settings.h" | 11 #include "settings.h" |
| 12 #include "arith_routines.h" | 12 #include "arith_routines.h" |
| 13 | 13 |
| 14 | 14 |
| 15 /* | 15 /* |
| 16 * code symbols into arithmetic bytestream | 16 * code symbols into arithmetic bytestream |
| 17 */ | 17 */ |
| 18 void WebRtcIsac_EncHistMulti(Bitstr *streamdata, /* in-/output struct containing
bitstream */ | 18 void WebRtcIsac_EncHistMulti(Bitstr *streamdata, /* in-/output struct containing
bitstream */ |
| 19 const int *data, /* input: data vector */ | 19 const int *data, /* input: data vector */ |
| 20 const uint16_t **cdf, /* input: array of cdf arrays
*/ | 20 const uint16_t *const *cdf, /* input: array of cdf
arrays */ |
| 21 const int N) /* input: data vector length */ | 21 const int N) /* input: data vector length */ |
| 22 { | 22 { |
| 23 uint32_t W_lower, W_upper; | 23 uint32_t W_lower, W_upper; |
| 24 uint32_t W_upper_LSB, W_upper_MSB; | 24 uint32_t W_upper_LSB, W_upper_MSB; |
| 25 uint8_t *stream_ptr; | 25 uint8_t *stream_ptr; |
| 26 uint8_t *stream_ptr_carry; | 26 uint8_t *stream_ptr_carry; |
| 27 uint32_t cdf_lo, cdf_hi; | 27 uint32_t cdf_lo, cdf_hi; |
| 28 int k; | 28 int k; |
| 29 | 29 |
| 30 | 30 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 } | 77 } |
| 78 | 78 |
| 79 | 79 |
| 80 | 80 |
| 81 /* | 81 /* |
| 82 * function to decode more symbols from the arithmetic bytestream, using method
of bisection | 82 * function to decode more symbols from the arithmetic bytestream, using method
of bisection |
| 83 * cdf tables should be of size 2^k-1 (which corresponds to an alphabet size of
2^k-2) | 83 * cdf tables should be of size 2^k-1 (which corresponds to an alphabet size of
2^k-2) |
| 84 */ | 84 */ |
| 85 int WebRtcIsac_DecHistBisectMulti(int *data, /* output: data vector */ | 85 int WebRtcIsac_DecHistBisectMulti(int *data, /* output: data vector */ |
| 86 Bitstr *streamdata, /* in-/output struct con
taining bitstream */ | 86 Bitstr *streamdata, /* in-/output struct con
taining bitstream */ |
| 87 const uint16_t **cdf, /* input: array of cdf
arrays */ | 87 const uint16_t *const *cdf, /* input: array o
f cdf arrays */ |
| 88 const uint16_t *cdf_size, /* input: array of c
df table sizes+1 (power of two: 2^k) */ | 88 const uint16_t *cdf_size, /* input: array of c
df table sizes+1 (power of two: 2^k) */ |
| 89 const int N) /* input: data vector length *
/ | 89 const int N) /* input: data vector length *
/ |
| 90 { | 90 { |
| 91 uint32_t W_lower, W_upper; | 91 uint32_t W_lower, W_upper; |
| 92 uint32_t W_tmp; | 92 uint32_t W_tmp; |
| 93 uint32_t W_upper_LSB, W_upper_MSB; | 93 uint32_t W_upper_LSB, W_upper_MSB; |
| 94 uint32_t streamval; | 94 uint32_t streamval; |
| 95 const uint8_t *stream_ptr; | 95 const uint8_t *stream_ptr; |
| 96 const uint16_t *cdf_ptr; | 96 const uint16_t *cdf_ptr; |
| 97 int size_tmp; | 97 int size_tmp; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 185 |
| 186 | 186 |
| 187 | 187 |
| 188 /* | 188 /* |
| 189 * function to decode more symbols from the arithmetic bytestream, taking single
step up or | 189 * function to decode more symbols from the arithmetic bytestream, taking single
step up or |
| 190 * down at a time | 190 * down at a time |
| 191 * cdf tables can be of arbitrary size, but large tables may take a lot of itera
tions | 191 * cdf tables can be of arbitrary size, but large tables may take a lot of itera
tions |
| 192 */ | 192 */ |
| 193 int WebRtcIsac_DecHistOneStepMulti(int *data, /* output: data vector */ | 193 int WebRtcIsac_DecHistOneStepMulti(int *data, /* output: data vector */ |
| 194 Bitstr *streamdata, /* in-/output struct
containing bitstream */ | 194 Bitstr *streamdata, /* in-/output struct
containing bitstream */ |
| 195 const uint16_t **cdf, /* input: array of cd
f arrays */ | 195 const uint16_t *const *cdf, /* input: array
of cdf arrays */ |
| 196 const uint16_t *init_index, /* input: vector
of initial cdf table search entries */ | 196 const uint16_t *init_index, /* input: vector
of initial cdf table search entries */ |
| 197 const int N) /* input: data vector length
*/ | 197 const int N) /* input: data vector length
*/ |
| 198 { | 198 { |
| 199 uint32_t W_lower, W_upper; | 199 uint32_t W_lower, W_upper; |
| 200 uint32_t W_tmp; | 200 uint32_t W_tmp; |
| 201 uint32_t W_upper_LSB, W_upper_MSB; | 201 uint32_t W_upper_LSB, W_upper_MSB; |
| 202 uint32_t streamval; | 202 uint32_t streamval; |
| 203 const uint8_t *stream_ptr; | 203 const uint8_t *stream_ptr; |
| 204 const uint16_t *cdf_ptr; | 204 const uint16_t *cdf_ptr; |
| 205 int k; | 205 int k; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 streamdata->W_upper = W_upper; | 282 streamdata->W_upper = W_upper; |
| 283 streamdata->streamval = streamval; | 283 streamdata->streamval = streamval; |
| 284 | 284 |
| 285 | 285 |
| 286 /* find number of bytes in original stream (determined by current interval wid
th) */ | 286 /* find number of bytes in original stream (determined by current interval wid
th) */ |
| 287 if ( W_upper > 0x01FFFFFF ) | 287 if ( W_upper > 0x01FFFFFF ) |
| 288 return streamdata->stream_index - 2; | 288 return streamdata->stream_index - 2; |
| 289 else | 289 else |
| 290 return streamdata->stream_index - 1; | 290 return streamdata->stream_index - 1; |
| 291 } | 291 } |
| OLD | NEW |