]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/intrax8.c
Add channel layout support to the AC-3 encoder.
[ffmpeg] / libavcodec / intrax8.c
index c5a935b640e41b4aa1e502527efd558e4aaf0536..9971e6479b3cab117b659996eb0c5079e202a773 100644 (file)
  */
 
 /**
- * @file intrax8.c
+ * @file libavcodec/intrax8.c
  * @brief IntraX8 (J-Frame) subdecoder, used by WMV2 and VC-1
  */
 
 #include "avcodec.h"
-#include "bitstream.h"
+#include "get_bits.h"
 #include "mpegvideo.h"
 #include "msmpeg4data.h"
 #include "intrax8huf.h"
@@ -42,7 +42,7 @@ static VLC j_ac_vlc[2][2][8];  //[quant<13],[intra/inter],[select]
 static VLC j_dc_vlc[2][8];     //[quant], [select]
 static VLC j_orient_vlc[2][4]; //[quant], [select]
 
-static void x8_vlc_init(){
+static av_cold void x8_vlc_init(void){
     int i;
 
 #define  init_ac_vlc(dst,src) \
@@ -50,7 +50,7 @@ static void x8_vlc_init(){
               AC_VLC_BITS,77, \
               &src[1],4,2, \
               &src[0],4,2, \
-              1)
+              INIT_VLC_USE_STATIC)
 //set ac tables
     for(i=0;i<8;i++){
         init_ac_vlc( j_ac_vlc[0][0][i], x8_ac0_highquant_table[i][0] );
@@ -66,7 +66,7 @@ static void x8_vlc_init(){
         DC_VLC_BITS,34, \
         &src[1],4,2, \
         &src[0],4,2, \
-        1);
+        INIT_VLC_USE_STATIC);
     for(i=0;i<8;i++){
         init_dc_vlc( j_dc_vlc[0][i], x8_dc_highquant_table[i][0]);
         init_dc_vlc( j_dc_vlc[1][i], x8_dc_lowquant_table [i][0]);
@@ -79,7 +79,7 @@ static void x8_vlc_init(){
     OR_VLC_BITS,12, \
     &src[1],4,2, \
     &src[0],4,2, \
-    1);
+    INIT_VLC_USE_STATIC);
     for(i=0;i<2;i++){
         init_or_vlc( j_orient_vlc[0][i], x8_orient_highquant_table[i][0]);
     }
@@ -278,7 +278,7 @@ static int x8_setup_spatial_predictor(IntraX8Context * const w, const int chroma
     int sum;
     int quant;
 
-    s->dsp.x8_setup_spacial_compensation(s->dest[chroma], s->edge_emu_buffer,
+    s->dsp.x8_setup_spatial_compensation(s->dest[chroma], s->edge_emu_buffer,
                                           s->current_picture.linesize[chroma>0],
                                           &range, &sum, w->edges);
     if(chroma){
@@ -511,7 +511,7 @@ static int x8_decode_intra_mb(IntraX8Context* const w, const int chroma){
     int sign;
 
     assert(w->orient<12);
-    memset(s->block[0],0x00,64*sizeof(DCTELEM));
+    s->dsp.clear_block(s->block[0]);
 
     if(chroma){
         dc_mode=2;
@@ -614,7 +614,7 @@ static int x8_decode_intra_mb(IntraX8Context* const w, const int chroma){
     if(w->flat_dc){
         dsp_x8_put_solidcolor(w->predicted_dc, s->dest[chroma], s->current_picture.linesize[!!chroma]);
     }else{
-        s->dsp.x8_spacial_compensation[w->orient]( s->edge_emu_buffer,
+        s->dsp.x8_spatial_compensation[w->orient]( s->edge_emu_buffer,
                                             s->dest[chroma],
                                             s->current_picture.linesize[!!chroma] );
     }
@@ -664,7 +664,7 @@ static void x8_init_block_index(MpegEncContext *s){ //FIXME maybe merge with ff_
  * @param w pointer to IntraX8Context
  * @param s pointer to MpegEncContext of the parent codec
  */
-void ff_intrax8_common_init(IntraX8Context * w, MpegEncContext * const s){
+av_cold void ff_intrax8_common_init(IntraX8Context * w, MpegEncContext * const s){
 
     w->s=s;
     x8_vlc_init();
@@ -676,6 +676,15 @@ void ff_intrax8_common_init(IntraX8Context * w, MpegEncContext * const s){
     ff_init_scantable(s->dsp.idct_permutation, &w->scantable[2], wmv1_scantable[3]);
 }
 
+/**
+ * Destroy IntraX8 frame structure.
+ * @param w pointer to IntraX8Context
+ */
+av_cold void ff_intrax8_common_end(IntraX8Context * w)
+{
+    av_freep(&w->prediction_table);
+}
+
 /**
  * Decode single IntraX8 frame.
  * The parent codec must fill s->loopfilter and s->gb (bitstream).