aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorStefan Gehrer <stefan.gehrer@gmx.de>2008-06-26 16:39:21 +0000
committerStefan Gehrer <stefan.gehrer@gmx.de>2008-06-26 16:39:21 +0000
commitb3bf98aa56f6985e86d97a975c954370c47ca8d6 (patch)
treef62be16b8bab87eb4a5d2f05dbcf6d98601acf5c /libavcodec
parentdd7a68b6dad4bfa24c4c3954066cb8e1805c1c88 (diff)
downloadffmpeg-b3bf98aa56f6985e86d97a975c954370c47ca8d6.tar.gz
move ff_log2_run to bitstream.c and reuse in ffv1.c
Originally committed as revision 13989 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/bitstream.c7
-rw-r--r--libavcodec/ffv1.c22
-rw-r--r--libavcodec/jpegls.c7
3 files changed, 16 insertions, 20 deletions
diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index b69d3cb452..57f139138e 100644
--- a/libavcodec/bitstream.c
+++ b/libavcodec/bitstream.c
@@ -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 --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
index 133347ee0c..c1fac104b3 100644
--- a/libavcodec/ffv1.c
+++ b/libavcodec/ffv1.c
@@ -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 @@ static const int8_t quant13[256]={
-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 @@ static inline int encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], in
if(run_mode){
if(diff){
- while(run_count >= 1<<log2_run[run_index]){
- run_count -= 1<<log2_run[run_index];
+ while(run_count >= 1<<ff_log2_run[run_index]){
+ run_count -= 1<<ff_log2_run[run_index];
run_index++;
put_bits(&s->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 @@ static inline int encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], in
}
}
if(run_mode){
- while(run_count >= 1<<log2_run[run_index]){
- run_count -= 1<<log2_run[run_index];
+ while(run_count >= 1<<ff_log2_run[run_index]){
+ run_count -= 1<<ff_log2_run[run_index];
run_index++;
put_bits(&s->pb, 1, 1);
}
@@ -735,10 +731,10 @@ static inline void decode_line(FFV1Context *s, int w, int_fast16_t *sample[2], i
if(run_mode){
if(run_count==0 && run_mode==1){
if(get_bits1(&s->gb)){
- run_count = 1<<log2_run[run_index];
+ run_count = 1<<ff_log2_run[run_index];
if(x + run_count <= w) run_index++;
}else{
- if(log2_run[run_index]) run_count = get_bits(&s->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 --git a/libavcodec/jpegls.c b/libavcodec/jpegls.c
index 8a6f5065c2..352183bcd7 100644
--- a/libavcodec/jpegls.c
+++ b/libavcodec/jpegls.c
@@ -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;