# HG changeset patch # User stefang # Date 1214498361 0 # Node ID d3a1ac3e227bd9c63ed804b9f944f1b67f7bb450 # Parent 8c367046eb81bcb8b1e96ab5c8df51e09bbdb1b9 move ff_log2_run to bitstream.c and reuse in ffv1.c diff -r 8c367046eb81 -r d3a1ac3e227b bitstream.c --- a/bitstream.c Thu Jun 26 11:25:42 2008 +0000 +++ b/bitstream.c Thu Jun 26 16:39:21 2008 +0000 @@ -30,6 +30,13 @@ #include "avcodec.h" #include "bitstream.h" +const uint8_t ff_log2_run[32]={ + 0, 0, 0, 0, 1, 1, 1, 1, + 2, 2, 2, 2, 3, 3, 3, 3, + 4, 4, 5, 5, 6, 6, 7, 7, + 8, 9,10,11,12,13,14,15 +}; + /** * Same as av_mallocz_static(), but does a realloc. * diff -r 8c367046eb81 -r d3a1ac3e227b ffv1.c --- a/ffv1.c Thu Jun 26 11:25:42 2008 +0000 +++ b/ffv1.c Thu Jun 26 16:39:21 2008 +0000 @@ -34,6 +34,8 @@ #define MAX_PLANES 4 #define CONTEXT_SIZE 32 +extern const uint8_t ff_log2_run[32]; + static const int8_t quant3[256]={ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -143,12 +145,6 @@ -4,-4,-4,-4,-4,-4,-4,-4,-4,-3,-3,-3,-3,-2,-2,-1, }; -static const uint8_t log2_run[32]={ - 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, - 4, 4, 5, 5, 6, 6, 7, 7, - 8, 9,10,11,12,13,14,15, -}; - typedef struct VlcState{ int16_t drift; uint16_t error_sum; @@ -396,13 +392,13 @@ if(run_mode){ if(diff){ - while(run_count >= 1<= 1<pb, 1, 1); } - put_bits(&s->pb, 1 + log2_run[run_index], run_count); + put_bits(&s->pb, 1 + ff_log2_run[run_index], run_count); if(run_index) run_index--; run_count=0; run_mode=0; @@ -419,8 +415,8 @@ } } if(run_mode){ - while(run_count >= 1<= 1<pb, 1, 1); } @@ -735,10 +731,10 @@ if(run_mode){ if(run_count==0 && run_mode==1){ if(get_bits1(&s->gb)){ - run_count = 1<gb, log2_run[run_index]); + if(ff_log2_run[run_index]) run_count = get_bits(&s->gb, ff_log2_run[run_index]); else run_count=0; if(run_index) run_index--; run_mode=2; diff -r 8c367046eb81 -r d3a1ac3e227b jpegls.c --- a/jpegls.c Thu Jun 26 11:25:42 2008 +0000 +++ b/jpegls.c Thu Jun 26 16:39:21 2008 +0000 @@ -27,13 +27,6 @@ #include "jpegls.h" -const uint8_t ff_log2_run[32]={ - 0, 0, 0, 0, 1, 1, 1, 1, - 2, 2, 2, 2, 3, 3, 3, 3, - 4, 4, 5, 5, 6, 6, 7, 7, - 8, 9,10,11,12,13,14,15 -}; - void ff_jpegls_init_state(JLSState *state){ int i;