]> git.sesse.net Git - ffmpeg/commitdiff
Merge commit 'f6f36ca8ca1b2526d3abff7d7c627322d3bce912'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 5 Jul 2013 09:49:56 +0000 (11:49 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 5 Jul 2013 09:50:46 +0000 (11:50 +0200)
* commit 'f6f36ca8ca1b2526d3abff7d7c627322d3bce912':
  indeo: Refactor ff_ivi_dec_huff_desc

Conflicts:
libavcodec/ivi_common.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/ivi_common.c

index 32da5c651e3dbd5b379c88df584d4b15644eb2f6,7e49d52dfc8c458e2f844c083af177b466d17489..f4f2bf2fe4658dde1a5a0a7326f3b4911c5d7be4
@@@ -156,41 -156,43 +156,43 @@@ int ff_ivi_dec_huff_desc(GetBitContext 
      if (!desc_coded) {
          /* select default table */
          huff_tab->tab = (which_tab) ? &ivi_blk_vlc_tabs[7]
-             : &ivi_mb_vlc_tabs [7];
-     } else {
-         huff_tab->tab_sel = get_bits(gb, 3);
-         if (huff_tab->tab_sel == 7) {
-             /* custom huffman table (explicitly encoded) */
-             new_huff.num_rows = get_bits(gb, 4);
-             if (!new_huff.num_rows) {
-                 av_log(avctx, AV_LOG_ERROR, "Empty custom Huffman table!\n");
-                 return AVERROR_INVALIDDATA;
-             }
+                                     : &ivi_mb_vlc_tabs [7];
+         return 0;
+     }
  
-             for (i = 0; i < new_huff.num_rows; i++)
-                 new_huff.xbits[i] = get_bits(gb, 4);
-             /* Have we got the same custom table? Rebuild if not. */
-             if (ivi_huff_desc_cmp(&new_huff, &huff_tab->cust_desc) || !huff_tab->cust_tab.table) {
-                 ivi_huff_desc_copy(&huff_tab->cust_desc, &new_huff);
-                 if (huff_tab->cust_tab.table)
-                     ff_free_vlc(&huff_tab->cust_tab);
-                 result = ivi_create_huff_from_desc(&huff_tab->cust_desc,
-                         &huff_tab->cust_tab, 0);
-                 if (result) {
-                     huff_tab->cust_desc.num_rows = 0; // reset faulty description
-                     av_log(avctx, AV_LOG_ERROR,
-                            "Error while initializing custom vlc table!\n");
-                     return result;
-                 }
+     huff_tab->tab_sel = get_bits(gb, 3);
+     if (huff_tab->tab_sel == 7) {
+         /* custom huffman table (explicitly encoded) */
+         new_huff.num_rows = get_bits(gb, 4);
+         if (!new_huff.num_rows) {
+             av_log(avctx, AV_LOG_ERROR, "Empty custom Huffman table!\n");
+             return AVERROR_INVALIDDATA;
+         }
+         for (i = 0; i < new_huff.num_rows; i++)
+             new_huff.xbits[i] = get_bits(gb, 4);
+         /* Have we got the same custom table? Rebuild if not. */
 -        if (ivi_huff_desc_cmp(&new_huff, &huff_tab->cust_desc)) {
++        if (ivi_huff_desc_cmp(&new_huff, &huff_tab->cust_desc) || !huff_tab->cust_tab.table) {
+             ivi_huff_desc_copy(&huff_tab->cust_desc, &new_huff);
+             if (huff_tab->cust_tab.table)
+                 ff_free_vlc(&huff_tab->cust_tab);
+             result = ivi_create_huff_from_desc(&huff_tab->cust_desc,
+                     &huff_tab->cust_tab, 0);
+             if (result) {
+                 // reset faulty description
+                 huff_tab->cust_desc.num_rows = 0;
+                 av_log(avctx, AV_LOG_ERROR,
+                        "Error while initializing custom vlc table!\n");
+                 return result;
              }
-             huff_tab->tab = &huff_tab->cust_tab;
-         } else {
-             /* select one of predefined tables */
-             huff_tab->tab = (which_tab) ? &ivi_blk_vlc_tabs[huff_tab->tab_sel]
-                 : &ivi_mb_vlc_tabs [huff_tab->tab_sel];
          }
+         huff_tab->tab = &huff_tab->cust_tab;
+     } else {
+         /* select one of predefined tables */
+         huff_tab->tab = (which_tab) ? &ivi_blk_vlc_tabs[huff_tab->tab_sel]
+             : &ivi_mb_vlc_tabs [huff_tab->tab_sel];
      }
  
      return 0;