Commit 6b0f36d7 authored by vitor's avatar vitor

Remove reimplementation of get_unary.

Based on a patch by Alex Beregszaszi.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@10279 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent b769f221
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
#include "avcodec.h" #include "avcodec.h"
#include "bitstream.h" #include "bitstream.h"
#include "bytestream.h" #include "bytestream.h"
#include "unary.h"
#define ALAC_EXTRADATA_SIZE 36 #define ALAC_EXTRADATA_SIZE 36
#define MAX_CHANNELS 2 #define MAX_CHANNELS 2
...@@ -159,14 +160,12 @@ static void bastardized_rice_decompress(ALACContext *alac, ...@@ -159,14 +160,12 @@ static void bastardized_rice_decompress(ALACContext *alac,
int sign_modifier = 0; int sign_modifier = 0;
for (output_count = 0; output_count < output_size; output_count++) { for (output_count = 0; output_count < output_size; output_count++) {
int32_t x = 0; int32_t x;
int32_t x_modified; int32_t x_modified;
int32_t final_val; int32_t final_val;
/* read x - number of 1s before 0 represent the rice */ /* read x - number of 1s before 0 represent the rice */
while (x <= 8 && get_bits1(&alac->gb)) { x = get_unary_0_9(&alac->gb);
x++;
}
if (x > 8) { /* RICE THRESHOLD */ if (x > 8) { /* RICE THRESHOLD */
/* use alternative encoding */ /* use alternative encoding */
...@@ -227,10 +226,7 @@ static void bastardized_rice_decompress(ALACContext *alac, ...@@ -227,10 +226,7 @@ static void bastardized_rice_decompress(ALACContext *alac,
sign_modifier = 1; sign_modifier = 1;
x = 0; x = get_unary_0_9(&alac->gb);
while (x <= 8 && get_bits1(&alac->gb)) {
x++;
}
if (x > 8) { if (x > 8) {
block_size = get_bits(&alac->gb, 16); block_size = get_bits(&alac->gb, 16);
......
...@@ -48,4 +48,9 @@ static inline int get_unary_0_33(GetBitContext *gb) ...@@ -48,4 +48,9 @@ static inline int get_unary_0_33(GetBitContext *gb)
return get_unary(gb, 0, 33); return get_unary(gb, 0, 33);
} }
static inline int get_unary_0_9(GetBitContext *gb)
{
return get_unary(gb, 0, 9);
}
#endif /* AVCODEC_UNARY_H */ #endif /* AVCODEC_UNARY_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment