1 /********************************************************************
3 * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. *
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2003 *
9 * by the Xiph.Org Foundation http://www.xiph.org/ *
11 ********************************************************************
16 ********************************************************************/
18 #include "codec_internal.h"
20 #define MIN16 ((1<<16)-1)
21 #define SHIFT16 (1<<16)
23 #define MIN_LEGAL_QUANT_ENTRY 8
24 #define MIN_DEQUANT_VAL 2
25 #define IDCT_SCALE_FACTOR 2 /* Shift left bits to improve IDCT precision */
28 /* lookup table for DCT coefficient zig-zag ordering */
29 static const ogg_uint32_t dezigzag_index
[64] = {
30 0, 1, 8, 16, 9, 2, 3, 10,
31 17, 24, 32, 25, 18, 11, 4, 5,
32 12, 19, 26, 33, 40, 48, 41, 34,
33 27, 20, 13, 6, 7, 14, 21, 28,
34 35, 42, 49, 56, 57, 50, 43, 36,
35 29, 22, 15, 23, 30, 37, 44, 51,
36 58, 59, 52, 45, 38, 31, 39, 46,
37 53, 60, 61, 54, 47, 55, 62, 63