Originally committed as revision 25710 to svn://svn.ffmpeg.org/ffmpeg/trunk
| ... | ... |
@@ -203,7 +203,7 @@ typedef struct {
|
| 203 | 203 |
unsigned int num_blocks; ///< number of blocks used in the current frame |
| 204 | 204 |
unsigned int s_max; ///< maximum Rice parameter allowed in entropy coding |
| 205 | 205 |
uint8_t *bgmc_lut; ///< pointer at lookup tables used for BGMC |
| 206 |
- unsigned int *bgmc_lut_status; ///< pointer at lookup table status flags used for BGMC |
|
| 206 |
+ int *bgmc_lut_status; ///< pointer at lookup table status flags used for BGMC |
|
| 207 | 207 |
int ltp_lag_length; ///< number of bits used for ltp lag value |
| 208 | 208 |
int *use_ltp; ///< contains use_ltp flags for all channels |
| 209 | 209 |
int *ltp_lag; ///< contains ltp lag values for all channels |
| ... | ... |
@@ -749,7 +749,7 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd) |
| 749 | 749 |
|
| 750 | 750 |
// read all residuals |
| 751 | 751 |
if (sconf->bgmc) {
|
| 752 |
- unsigned int delta[8]; |
|
| 752 |
+ int delta[8]; |
|
| 753 | 753 |
unsigned int k [8]; |
| 754 | 754 |
unsigned int b = av_clip((av_ceil_log2(bd->block_length) - 3) >> 1, 0, 5); |
| 755 | 755 |
unsigned int i = start; |
| ... | ... |
@@ -426,8 +426,8 @@ static const uint16_t * const cf_table[16] = {
|
| 426 | 426 |
|
| 427 | 427 |
/** Initialize a given lookup table using a given delta |
| 428 | 428 |
*/ |
| 429 |
-static void bgmc_lut_fillp(uint8_t *lut, unsigned int *lut_status, |
|
| 430 |
- unsigned int delta) |
|
| 429 |
+static void bgmc_lut_fillp(uint8_t *lut, int *lut_status, |
|
| 430 |
+ int delta) |
|
| 431 | 431 |
{
|
| 432 | 432 |
unsigned int sx, i; |
| 433 | 433 |
|
| ... | ... |
@@ -448,8 +448,8 @@ static void bgmc_lut_fillp(uint8_t *lut, unsigned int *lut_status, |
| 448 | 448 |
|
| 449 | 449 |
/** Retune the index of a suitable lookup table for a given delta |
| 450 | 450 |
*/ |
| 451 |
-static uint8_t* bgmc_lut_getp(uint8_t *lut, unsigned int *lut_status, |
|
| 452 |
- unsigned int delta) |
|
| 451 |
+static uint8_t* bgmc_lut_getp(uint8_t *lut, int *lut_status, |
|
| 452 |
+ int delta) |
|
| 453 | 453 |
{
|
| 454 | 454 |
unsigned int i = av_clip(delta, 0, LUT_BUFF - 1); |
| 455 | 455 |
|
| ... | ... |
@@ -464,7 +464,7 @@ static uint8_t* bgmc_lut_getp(uint8_t *lut, unsigned int *lut_status, |
| 464 | 464 |
|
| 465 | 465 |
/** Initialize the lookup table arrays |
| 466 | 466 |
*/ |
| 467 |
-int ff_bgmc_init(AVCodecContext *avctx, uint8_t **cf_lut, unsigned int **cf_lut_status) |
|
| 467 |
+int ff_bgmc_init(AVCodecContext *avctx, uint8_t **cf_lut, int **cf_lut_status) |
|
| 468 | 468 |
{
|
| 469 | 469 |
*cf_lut = av_malloc(sizeof(*cf_lut ) * LUT_BUFF * 16 * LUT_SIZE); |
| 470 | 470 |
*cf_lut_status = av_malloc(sizeof(*cf_lut_status) * LUT_BUFF); |
| ... | ... |
@@ -473,6 +473,9 @@ int ff_bgmc_init(AVCodecContext *avctx, uint8_t **cf_lut, unsigned int **cf_lut_ |
| 473 | 473 |
ff_bgmc_end(cf_lut, cf_lut_status); |
| 474 | 474 |
av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n"); |
| 475 | 475 |
return AVERROR(ENOMEM); |
| 476 |
+ } else {
|
|
| 477 |
+ // initialize lut_status buffer to a value never used to compare against |
|
| 478 |
+ memset(*cf_lut_status, -1, sizeof(*cf_lut_status) * LUT_BUFF); |
|
| 476 | 479 |
} |
| 477 | 480 |
|
| 478 | 481 |
return 0; |
| ... | ... |
@@ -481,7 +484,7 @@ int ff_bgmc_init(AVCodecContext *avctx, uint8_t **cf_lut, unsigned int **cf_lut_ |
| 481 | 481 |
|
| 482 | 482 |
/** Release the lookup table arrays |
| 483 | 483 |
*/ |
| 484 |
-void ff_bgmc_end(uint8_t **cf_lut, unsigned int **cf_lut_status) |
|
| 484 |
+void ff_bgmc_end(uint8_t **cf_lut, int **cf_lut_status) |
|
| 485 | 485 |
{
|
| 486 | 486 |
av_freep(cf_lut); |
| 487 | 487 |
av_freep(cf_lut_status); |
| ... | ... |
@@ -510,9 +513,9 @@ void ff_bgmc_decode_end(GetBitContext *gb) |
| 510 | 510 |
/** Read and decode a block Gilbert-Moore coded symbol |
| 511 | 511 |
*/ |
| 512 | 512 |
void ff_bgmc_decode(GetBitContext *gb, unsigned int num, int32_t *dst, |
| 513 |
- unsigned int delta, unsigned int sx, |
|
| 513 |
+ int delta, unsigned int sx, |
|
| 514 | 514 |
unsigned int *h, unsigned int *l, unsigned int *v, |
| 515 |
- uint8_t *cf_lut, unsigned int *cf_lut_status) |
|
| 515 |
+ uint8_t *cf_lut, int *cf_lut_status) |
|
| 516 | 516 |
{
|
| 517 | 517 |
unsigned int i; |
| 518 | 518 |
uint8_t *lut = bgmc_lut_getp(cf_lut, cf_lut_status, delta); |
| ... | ... |
@@ -34,10 +34,10 @@ |
| 34 | 34 |
#include "get_bits.h" |
| 35 | 35 |
|
| 36 | 36 |
|
| 37 |
-int ff_bgmc_init(AVCodecContext *avctx, uint8_t **cf_lut, unsigned int **cf_lut_status); |
|
| 37 |
+int ff_bgmc_init(AVCodecContext *avctx, uint8_t **cf_lut, int **cf_lut_status); |
|
| 38 | 38 |
|
| 39 | 39 |
|
| 40 |
-void ff_bgmc_end(uint8_t **cf_lut, unsigned int **cf_lut_status); |
|
| 40 |
+void ff_bgmc_end(uint8_t **cf_lut, int **cf_lut_status); |
|
| 41 | 41 |
|
| 42 | 42 |
|
| 43 | 43 |
void ff_bgmc_decode_init(GetBitContext *gb, |
| ... | ... |
@@ -48,9 +48,9 @@ void ff_bgmc_decode_end(GetBitContext *gb); |
| 48 | 48 |
|
| 49 | 49 |
|
| 50 | 50 |
void ff_bgmc_decode(GetBitContext *gb, unsigned int num, int32_t *dst, |
| 51 |
- unsigned int delta, unsigned int sx, |
|
| 51 |
+ int delta, unsigned int sx, |
|
| 52 | 52 |
unsigned int *h, unsigned int *l, unsigned int *v, |
| 53 |
- uint8_t *cf_lut, unsigned int *cf_lut_status); |
|
| 53 |
+ uint8_t *cf_lut, int *cf_lut_status); |
|
| 54 | 54 |
|
| 55 | 55 |
|
| 56 | 56 |
#endif /* AVCODEC_BGMC_H */ |