00001
00014 #ifndef _MACROBLOCK_H_
00015 #define _MACROBLOCK_H_
00016
00017 #include "block.h"
00018
00020 static const byte SNGL_SCAN[16][2] =
00021 {
00022 {0,0},{1,0},{0,1},{0,2},
00023 {1,1},{2,0},{3,0},{2,1},
00024 {1,2},{0,3},{1,3},{2,2},
00025 {3,1},{3,2},{2,3},{3,3}
00026 };
00027
00029 static const byte FIELD_SCAN[16][2] =
00030 {
00031 {0,0},{0,1},{1,0},{0,2},
00032 {0,3},{1,1},{1,2},{1,3},
00033 {2,0},{2,1},{2,2},{2,3},
00034 {3,0},{3,1},{3,2},{3,3}
00035 };
00036
00038 static const int BLOCK_STEP[8][2]=
00039 {
00040 {0,0},{4,4},{4,2},{2,4},{2,2},{2,1},{1,2},{1,1}
00041 };
00042
00044 static const byte SNGL_SCAN8x8[64][2] = {
00045 {0,0}, {1,0}, {0,1}, {0,2}, {1,1}, {2,0}, {3,0}, {2,1}, {1,2}, {0,3}, {0,4}, {1,3}, {2,2}, {3,1}, {4,0}, {5,0},
00046 {4,1}, {3,2}, {2,3}, {1,4}, {0,5}, {0,6}, {1,5}, {2,4}, {3,3}, {4,2}, {5,1}, {6,0}, {7,0}, {6,1}, {5,2}, {4,3},
00047 {3,4}, {2,5}, {1,6}, {0,7}, {1,7}, {2,6}, {3,5}, {4,4}, {5,3}, {6,2}, {7,1}, {7,2}, {6,3}, {5,4}, {4,5}, {3,6},
00048 {2,7}, {3,7}, {4,6}, {5,5}, {6,4}, {7,3}, {7,4}, {6,5}, {5,6}, {4,7}, {5,7}, {6,6}, {7,5}, {7,6}, {6,7}, {7,7}
00049 };
00050
00051
00053 static const byte FIELD_SCAN8x8[64][2] = {
00054 {0,0}, {0,1}, {0,2}, {1,0}, {1,1}, {0,3}, {0,4}, {1,2}, {2,0}, {1,3}, {0,5}, {0,6}, {0,7}, {1,4}, {2,1}, {3,0},
00055 {2,2}, {1,5}, {1,6}, {1,7}, {2,3}, {3,1}, {4,0}, {3,2}, {2,4}, {2,5}, {2,6}, {2,7}, {3,3}, {4,1}, {5,0}, {4,2},
00056 {3,4}, {3,5}, {3,6}, {3,7}, {4,3}, {5,1}, {6,0}, {5,2}, {4,4}, {4,5}, {4,6}, {4,7}, {5,3}, {6,1}, {6,2}, {5,4},
00057 {5,5}, {5,6}, {5,7}, {6,3}, {7,0}, {7,1}, {6,4}, {6,5}, {6,6}, {6,7}, {7,2}, {7,3}, {7,4}, {7,5}, {7,6}, {7,7}
00058 };
00059
00061 static const byte SCAN_YUV422[8][2] =
00062 {
00063 {0,0},{0,1},
00064 {1,0},{0,2},
00065 {0,3},{1,1},
00066 {1,2},{1,3}
00067 };
00068
00069 static const unsigned char cbp_blk_chroma[8][4] =
00070 { {16, 17, 18, 19},
00071 {20, 21, 22, 23},
00072 {24, 25, 26, 27},
00073 {28, 29, 30, 31},
00074 {32, 33, 34, 35},
00075 {36, 37, 38, 39},
00076 {40, 41, 42, 43},
00077 {44, 45, 46, 47}
00078 };
00079
00080 static const unsigned char cofuv_blk_x[3][8][4] =
00081 { { {0, 1, 0, 1},
00082 {0, 1, 0, 1},
00083 {0, 0, 0, 0},
00084 {0, 0, 0, 0},
00085 {0, 0, 0, 0},
00086 {0, 0, 0, 0},
00087 {0, 0, 0, 0},
00088 {0, 0, 0, 0} },
00089
00090 { {0, 1, 0, 1},
00091 {0, 1, 0, 1},
00092 {0, 1, 0, 1},
00093 {0, 1, 0, 1},
00094 {0, 0, 0, 0},
00095 {0, 0, 0, 0},
00096 {0, 0, 0, 0},
00097 {0, 0, 0, 0} },
00098
00099 { {0, 1, 0, 1},
00100 {2, 3, 2, 3},
00101 {0, 1, 0, 1},
00102 {2, 3, 2, 3},
00103 {0, 1, 0, 1},
00104 {2, 3, 2, 3},
00105 {0, 1, 0, 1},
00106 {2, 3, 2, 3} }
00107 };
00108
00109 static const unsigned char cofuv_blk_y[3][8][4] =
00110 {
00111 { { 0, 0, 1, 1},
00112 { 0, 0, 1, 1},
00113 { 0, 0, 0, 0},
00114 { 0, 0, 0, 0},
00115 { 0, 0, 0, 0},
00116 { 0, 0, 0, 0},
00117 { 0, 0, 0, 0},
00118 { 0, 0, 0, 0} },
00119
00120 { { 0, 0, 1, 1},
00121 { 2, 2, 3, 3},
00122 { 0, 0, 1, 1},
00123 { 2, 2, 3, 3},
00124 { 0, 0, 0, 0},
00125 { 0, 0, 0, 0},
00126 { 0, 0, 0, 0},
00127 { 0, 0, 0, 0} },
00128
00129 { { 0, 0, 1, 1},
00130 { 0, 0, 1, 1},
00131 { 2, 2, 3, 3},
00132 { 2, 2, 3, 3},
00133 { 0, 0, 1, 1},
00134 { 0, 0, 1, 1},
00135 { 2, 2, 3, 3},
00136 { 2, 2, 3, 3}}
00137 };
00138
00139
00140 extern void setup_slice_methods(Slice *currSlice);
00141 extern void get_neighbors(Macroblock *currMB, PixelPos *block, int mb_x, int mb_y, int blockshape_x);
00142
00143 extern void start_macroblock (Slice *currSlice, Macroblock **currMB);
00144 extern int decode_one_macroblock(Macroblock *currMB, StorablePicture *dec_picture);
00145 extern Boolean exit_macroblock (Slice *currSlice, int eos_bit);
00146 #endif
00147