]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/ivi_common.c
Add bitexact versions of put_no_rnd_pixels8 _x2 and _y2 for vp3/theora
[ffmpeg] / libavcodec / ivi_common.c
index ad08b448b0cb1f56424b7e3f5b98a4e1d7c99ef6..5fcaca2c3e5d319d9deb0b63dfbcfa4ea9093138 100644 (file)
@@ -21,7 +21,7 @@
  */
 
 /**
- * @file libavcodec/ivi_common.c
+ * @file
  * This file contains functions and data shared by both Indeo4 and
  * Indeo5 decoders.
  */
@@ -256,6 +256,11 @@ int av_cold ff_ivi_init_tiles(IVIPlaneDesc *planes, int tile_width, int tile_hei
         t_width  = !p ? tile_width  : (tile_width  + 3) >> 2;
         t_height = !p ? tile_height : (tile_height + 3) >> 2;
 
+        if (!p && planes[0].num_bands == 4) {
+            t_width  >>= 1;
+            t_height >>= 1;
+        }
+
         for (b = 0; b < planes[p].num_bands; b++) {
             band = &planes[p].bands[b];
             x_tiles = IVI_NUM_TILES(band->width, t_width);
@@ -411,9 +416,9 @@ int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile)
 
                     q = (base_tab[pos] * scale_tab[quant]) >> 8;
                     if (q > 1)
-                        val = val * q + FFSIGN(val) * ((q >> 1) - (q & 1));
+                        val = val * q + FFSIGN(val) * (((q ^ 1) - 1) >> 1);
                     trvec[pos] = val;
-                    col_flags[pos & col_mask] |= val; /* track columns containing non-zero coeffs */
+                    col_flags[pos & col_mask] |= !!val; /* track columns containing non-zero coeffs */
                 }// while
 
                 if (scan_pos >= num_coeffs && sym != rvmap->eob_sym)
@@ -637,6 +642,36 @@ const IVIHuffDesc ff_ivi_blk_huff_desc[8] = {
 };
 
 
+/**
+ *  Scan patterns shared between indeo4 and indeo5
+ */
+const uint8_t ff_ivi_vertical_scan_8x8[64] = {
+    0,  8, 16, 24, 32, 40, 48, 56,
+    1,  9, 17, 25, 33, 41, 49, 57,
+    2, 10, 18, 26, 34, 42, 50, 58,
+    3, 11, 19, 27, 35, 43, 51, 59,
+    4, 12, 20, 28, 36, 44, 52, 60,
+    5, 13, 21, 29, 37, 45, 53, 61,
+    6, 14, 22, 30, 38, 46, 54, 62,
+    7, 15, 23, 31, 39, 47, 55, 63
+};
+
+const uint8_t ff_ivi_horizontal_scan_8x8[64] = {
+     0,  1,  2,  3,  4,  5,  6,  7,
+     8,  9, 10, 11, 12, 13, 14, 15,
+    16, 17, 18, 19, 20, 21, 22, 23,
+    24, 25, 26, 27, 28, 29, 30, 31,
+    32, 33, 34, 35, 36, 37, 38, 39,
+    40, 41, 42, 43, 44, 45, 46, 47,
+    48, 49, 50, 51, 52, 53, 54, 55,
+    56, 57, 58, 59, 60, 61, 62, 63
+};
+
+const uint8_t ff_ivi_direct_scan_4x4[16] = {
+    0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15
+};
+
+
 /**
  *  Run-value (RLE) tables.
  */