Fix pp_sharp_mod calculation.
authorTim Terriberry <tterribe@xiph.org>
Tue, 8 May 2012 02:51:57 +0000 (02:51 +0000)
committerTim Terriberry <tterribe@xiph.org>
Tue, 8 May 2012 02:51:57 +0000 (02:51 +0000)
This was broken when the dequant_tables indexing changed in commit
 r16102, but it only affected post-processing quality, so we never
 noticed.
With gcc 4.8.0, this can now trigger a segfault during decoder
 initialization.

git-svn-id: http://svn.xiph.org/trunk/theora@18268 0101bb08-14d6-0310-b084-bc0e0c8e3800

lib/decode.c

index b803505..9f2516a 100644 (file)
@@ -400,10 +400,10 @@ static int oc_dec_init(oc_dec_ctx *_dec,const th_info *_info,
     int qsum;
     qsum=0;
     for(qti=0;qti<2;qti++)for(pli=0;pli<3;pli++){
-      qsum+=_dec->state.dequant_tables[qti][pli][qi][12]+
-       _dec->state.dequant_tables[qti][pli][qi][17]+
-       _dec->state.dequant_tables[qti][pli][qi][18]+
-       _dec->state.dequant_tables[qti][pli][qi][24]<<(pli==0);
+      qsum+=_dec->state.dequant_tables[qi][pli][qti][12]+
+       _dec->state.dequant_tables[qi][pli][qti][17]+
+       _dec->state.dequant_tables[qi][pli][qti][18]+
+       _dec->state.dequant_tables[qi][pli][qti][24]<<(pli==0);
     }
     _dec->pp_sharp_mod[qi]=-(qsum>>11);
   }