summaryrefslogtreecommitdiff
path: root/libavcodec/ffv1.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2010-10-16 21:31:16 +0000
committerMichael Niedermayer <michaelni@gmx.at>2010-10-16 21:31:16 +0000
commitd721141f544be6e4ec78a8731db8f2e0e1fb5c15 (patch)
tree206dd2a1cf6c756a63f0f942bdba40c3e821308c /libavcodec/ffv1.c
parent3f2a7e42778c86dbf573c85fdbea0a3499a499b2 (diff)
downloadffmpeg-d721141f544be6e4ec78a8731db8f2e0e1fb5c15.tar.gz
Move shared functions out of CONFIG_FFV1_ENCODER ifdef
Originally committed as revision 25511 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ffv1.c')
-rw-r--r--libavcodec/ffv1.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
index 69fc9ddebc..c526414a2c 100644
--- a/libavcodec/ffv1.c
+++ b/libavcodec/ffv1.c
@@ -676,43 +676,6 @@ static av_cold int common_init(AVCodecContext *avctx){
return 0;
}
-#if CONFIG_FFV1_ENCODER
-static int write_extra_header(FFV1Context *f){
- RangeCoder * const c= &f->c;
- uint8_t state[CONTEXT_SIZE];
- int i;
- memset(state, 128, sizeof(state));
-
- f->avctx->extradata= av_malloc(f->avctx->extradata_size= 10000);
- ff_init_range_encoder(c, f->avctx->extradata, f->avctx->extradata_size);
- ff_build_rac_states(c, 0.05*(1LL<<32), 256-8);
-
- put_symbol(c, state, f->version, 0);
- put_symbol(c, state, f->ac, 0);
- if(f->ac>1){
- for(i=1; i<256; i++){
- f->state_transition[i]=ver2_state[i];
- put_symbol(c, state, ver2_state[i] - c->one_state[i], 1);
- }
- }
- put_symbol(c, state, f->colorspace, 0); //YUV cs type
- put_symbol(c, state, f->avctx->bits_per_raw_sample, 0);
- put_rac(c, state, 1); //chroma planes
- put_symbol(c, state, f->chroma_h_shift, 0);
- put_symbol(c, state, f->chroma_v_shift, 0);
- put_rac(c, state, 0); //no transparency plane
- put_symbol(c, state, f->num_h_slices-1, 0);
- put_symbol(c, state, f->num_v_slices-1, 0);
-
- put_symbol(c, state, f->quant_table_count, 0);
- for(i=0; i<f->quant_table_count; i++)
- write_quant_tables(c, f->quant_tables[i]);
-
- f->avctx->extradata_size= ff_rac_terminate(c);
-
- return 0;
-}
-
static int init_slice_state(FFV1Context *f){
int i, j;
@@ -772,6 +735,43 @@ static av_cold int init_slice_contexts(FFV1Context *f){
return 0;
}
+#if CONFIG_FFV1_ENCODER
+static int write_extra_header(FFV1Context *f){
+ RangeCoder * const c= &f->c;
+ uint8_t state[CONTEXT_SIZE];
+ int i;
+ memset(state, 128, sizeof(state));
+
+ f->avctx->extradata= av_malloc(f->avctx->extradata_size= 10000);
+ ff_init_range_encoder(c, f->avctx->extradata, f->avctx->extradata_size);
+ ff_build_rac_states(c, 0.05*(1LL<<32), 256-8);
+
+ put_symbol(c, state, f->version, 0);
+ put_symbol(c, state, f->ac, 0);
+ if(f->ac>1){
+ for(i=1; i<256; i++){
+ f->state_transition[i]=ver2_state[i];
+ put_symbol(c, state, ver2_state[i] - c->one_state[i], 1);
+ }
+ }
+ put_symbol(c, state, f->colorspace, 0); //YUV cs type
+ put_symbol(c, state, f->avctx->bits_per_raw_sample, 0);
+ put_rac(c, state, 1); //chroma planes
+ put_symbol(c, state, f->chroma_h_shift, 0);
+ put_symbol(c, state, f->chroma_v_shift, 0);
+ put_rac(c, state, 0); //no transparency plane
+ put_symbol(c, state, f->num_h_slices-1, 0);
+ put_symbol(c, state, f->num_v_slices-1, 0);
+
+ put_symbol(c, state, f->quant_table_count, 0);
+ for(i=0; i<f->quant_table_count; i++)
+ write_quant_tables(c, f->quant_tables[i]);
+
+ f->avctx->extradata_size= ff_rac_terminate(c);
+
+ return 0;
+}
+
static av_cold int encode_init(AVCodecContext *avctx)
{
FFV1Context *s = avctx->priv_data;