aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2012-02-11 23:42:58 +0100
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2012-02-11 23:42:58 +0100
commitcadd9ab6aaaa59477d73d0f884770de27cf9ef9a (patch)
tree0ca482fdbc84effe9e50e15fd003d844821df2eb /libavcodec
parentfd0b8d598669cb1426cc9819aeb1eb74a0b6281a (diff)
downloadffmpeg-cadd9ab6aaaa59477d73d0f884770de27cf9ef9a.tar.gz
Cosmetics: Move a block in ffv1's encode_init().
Makes the next patch smaller.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/ffv1.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
index 586a2963f4..eced9541da 100644
--- a/libavcodec/ffv1.c
+++ b/libavcodec/ffv1.c
@@ -874,44 +874,6 @@ static av_cold int encode_init(AVCodecContext *avctx)
s->state_transition[i]=ver2_state[i];
s->plane_count=3;
- for(i=0; i<256; i++){
- s->quant_table_count=2;
- if(avctx->bits_per_raw_sample <=8){
- s->quant_tables[0][0][i]= quant11[i];
- s->quant_tables[0][1][i]= 11*quant11[i];
- s->quant_tables[0][2][i]= 11*11*quant11[i];
- s->quant_tables[1][0][i]= quant11[i];
- s->quant_tables[1][1][i]= 11*quant11[i];
- s->quant_tables[1][2][i]= 11*11*quant5 [i];
- s->quant_tables[1][3][i]= 5*11*11*quant5 [i];
- s->quant_tables[1][4][i]= 5*5*11*11*quant5 [i];
- }else{
- s->quant_tables[0][0][i]= quant9_10bit[i];
- s->quant_tables[0][1][i]= 11*quant9_10bit[i];
- s->quant_tables[0][2][i]= 11*11*quant9_10bit[i];
- s->quant_tables[1][0][i]= quant9_10bit[i];
- s->quant_tables[1][1][i]= 11*quant9_10bit[i];
- s->quant_tables[1][2][i]= 11*11*quant5_10bit[i];
- s->quant_tables[1][3][i]= 5*11*11*quant5_10bit[i];
- s->quant_tables[1][4][i]= 5*5*11*11*quant5_10bit[i];
- }
- }
- s->context_count[0]= (11*11*11+1)/2;
- s->context_count[1]= (11*11*5*5*5+1)/2;
- memcpy(s->quant_table, s->quant_tables[avctx->context_model], sizeof(s->quant_table));
-
- for(i=0; i<s->plane_count; i++){
- PlaneContext * const p= &s->plane[i];
-
- memcpy(p->quant_table, s->quant_table, sizeof(p->quant_table));
- p->quant_table_index= avctx->context_model;
- p->context_count= s->context_count[p->quant_table_index];
- }
-
- if(allocate_initial_states(s) < 0)
- return AVERROR(ENOMEM);
-
- avctx->coded_frame= &s->picture;
switch(avctx->pix_fmt){
case PIX_FMT_YUV420P9:
case PIX_FMT_YUV420P10:
@@ -956,6 +918,44 @@ static av_cold int encode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "format not supported\n");
return -1;
}
+ for(i=0; i<256; i++){
+ s->quant_table_count=2;
+ if(avctx->bits_per_raw_sample <=8){
+ s->quant_tables[0][0][i]= quant11[i];
+ s->quant_tables[0][1][i]= 11*quant11[i];
+ s->quant_tables[0][2][i]= 11*11*quant11[i];
+ s->quant_tables[1][0][i]= quant11[i];
+ s->quant_tables[1][1][i]= 11*quant11[i];
+ s->quant_tables[1][2][i]= 11*11*quant5 [i];
+ s->quant_tables[1][3][i]= 5*11*11*quant5 [i];
+ s->quant_tables[1][4][i]= 5*5*11*11*quant5 [i];
+ }else{
+ s->quant_tables[0][0][i]= quant9_10bit[i];
+ s->quant_tables[0][1][i]= 11*quant9_10bit[i];
+ s->quant_tables[0][2][i]= 11*11*quant9_10bit[i];
+ s->quant_tables[1][0][i]= quant9_10bit[i];
+ s->quant_tables[1][1][i]= 11*quant9_10bit[i];
+ s->quant_tables[1][2][i]= 11*11*quant5_10bit[i];
+ s->quant_tables[1][3][i]= 5*11*11*quant5_10bit[i];
+ s->quant_tables[1][4][i]= 5*5*11*11*quant5_10bit[i];
+ }
+ }
+ s->context_count[0]= (11*11*11+1)/2;
+ s->context_count[1]= (11*11*5*5*5+1)/2;
+ memcpy(s->quant_table, s->quant_tables[avctx->context_model], sizeof(s->quant_table));
+
+ for(i=0; i<s->plane_count; i++){
+ PlaneContext * const p= &s->plane[i];
+
+ memcpy(p->quant_table, s->quant_table, sizeof(p->quant_table));
+ p->quant_table_index= avctx->context_model;
+ p->context_count= s->context_count[p->quant_table_index];
+ }
+
+ if(allocate_initial_states(s) < 0)
+ return AVERROR(ENOMEM);
+
+ avctx->coded_frame= &s->picture;
if(!s->transparency)
s->plane_count= 2;
avcodec_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_h_shift, &s->chroma_v_shift);