# HG changeset patch # User vitor # Date 1188680597 0 # Node ID cf88751d8ab7a7da6b93cf1edf60a690eef7fc85 # Parent a920d9b58f19fd08ff7891f39cdd6a930d3e850b Remove reimplementation of get_unary. Based on a patch by Alex Beregszaszi. diff -r a920d9b58f19 -r cf88751d8ab7 alac.c --- a/alac.c Sat Sep 01 14:00:47 2007 +0000 +++ b/alac.c Sat Sep 01 21:03:17 2007 +0000 @@ -55,6 +55,7 @@ #include "avcodec.h" #include "bitstream.h" #include "bytestream.h" +#include "unary.h" #define ALAC_EXTRADATA_SIZE 36 #define MAX_CHANNELS 2 @@ -159,14 +160,12 @@ int sign_modifier = 0; for (output_count = 0; output_count < output_size; output_count++) { - int32_t x = 0; + int32_t x; int32_t x_modified; int32_t final_val; /* read x - number of 1s before 0 represent the rice */ - while (x <= 8 && get_bits1(&alac->gb)) { - x++; - } + x = get_unary_0_9(&alac->gb); if (x > 8) { /* RICE THRESHOLD */ /* use alternative encoding */ @@ -227,10 +226,7 @@ sign_modifier = 1; - x = 0; - while (x <= 8 && get_bits1(&alac->gb)) { - x++; - } + x = get_unary_0_9(&alac->gb); if (x > 8) { block_size = get_bits(&alac->gb, 16); diff -r a920d9b58f19 -r cf88751d8ab7 unary.h --- a/unary.h Sat Sep 01 14:00:47 2007 +0000 +++ b/unary.h Sat Sep 01 21:03:17 2007 +0000 @@ -48,4 +48,9 @@ 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 */