00001 #ifndef MNT_MPEG_MACROBLOCK_H 00002 #define MNT_MPEG_MACROBLOCK_H 00003 00004 #define PARSE_I_MACROBLOCK_HDR(bp, prev_mb_addr, curr_mb_addr, quant_scale) \ 00005 { \ 00006 int code, index, quantize; \ 00007 int mb_addr_incr = 0; \ 00008 do { \ 00009 Bp_PeekBits(bp, 11, index); \ 00010 code = mbai[index].value; \ 00011 Bp_FlushBits(bp, mbai[index].numOfBits); \ 00012 if (mbai[index].numOfBits == 0) { \ 00013 } \ 00014 if (code == MACRO_BLOCK_ESCAPE) { \ 00015 mb_addr_incr += 33; \ 00016 } \ 00017 } while (code == MACRO_BLOCK_ESCAPE || code == MACRO_BLOCK_STUFFING); \ 00018 mb_addr_incr += code; \ 00019 curr_mb_addr = prev_mb_addr + mb_addr_incr; \ 00020 prev_mb_addr = curr_mb_addr; \ 00021 Bp_PeekBits(bp, 2, code); \ 00022 quantize = quantizeTable[code]; \ 00023 if (code) \ 00024 Bp_FlushBits(bp, 1 + quantize); \ 00025 if (quantize) { \ 00026 Bp_GetBits(bp, 5, code); \ 00027 quant_scale = code; \ 00028 } \ 00029 } 00030 00031 #define PARSE_P_MACROBLOCK_HDR(bp, prev_mb_addr, curr_mb_addr, index, quant_scale) {\ 00032 int code; \ 00033 int mb_addr_incr = 0; \ 00034 do { \ 00035 Bp_PeekBits(bp, 11, index); \ 00036 code = mbai[index].value; \ 00037 Bp_FlushBits(bp, mbai[index].numOfBits); \ 00038 if (mbai[index].numOfBits == 0) { \ 00039 } \ 00040 if (code == MACRO_BLOCK_ESCAPE) { \ 00041 mb_addr_incr += 33; \ 00042 } \ 00043 } while (code == MACRO_BLOCK_ESCAPE || code == MACRO_BLOCK_STUFFING); \ 00044 mb_addr_incr += code; \ 00045 curr_mb_addr = prev_mb_addr + mb_addr_incr; \ 00046 prev_mb_addr = curr_mb_addr; \ 00047 Bp_PeekBits(bp, 6, code); \ 00048 index = code; \ 00049 Bp_FlushBits(bp, mbp[code].num_of_bits); \ 00050 if (mbp[code].quantize) { \ 00051 Bp_GetBits(bp, 5, code); \ 00052 quant_scale = code; \ 00053 } \ 00054 } 00055 00056 #define PARSE_B_MACROBLOCK_HDR(bp, prev_mb_addr, curr_mb_addr, index, quant_scale) {\ 00057 int code; \ 00058 int mb_addr_incr = 0; \ 00059 do { \ 00060 Bp_PeekBits(bp, 11, index); \ 00061 code = mbai[index].value; \ 00062 Bp_FlushBits(bp, mbai[index].numOfBits); \ 00063 if (mbai[index].numOfBits == 0) { \ 00064 } \ 00065 if (code == MACRO_BLOCK_ESCAPE) { \ 00066 mb_addr_incr += 33; \ 00067 } \ 00068 } while (code == MACRO_BLOCK_ESCAPE || code == MACRO_BLOCK_STUFFING); \ 00069 mb_addr_incr += code; \ 00070 curr_mb_addr = prev_mb_addr + mb_addr_incr; \ 00071 prev_mb_addr = curr_mb_addr; \ 00072 Bp_PeekBits(bp, 6, code); \ 00073 index = code; \ 00074 Bp_FlushBits(bp, mbb[code].num_of_bits); \ 00075 if (mbb[code].quantize) { \ 00076 Bp_GetBits(bp, 5, code); \ 00077 quant_scale = code; \ 00078 } \ 00079 } 00080 00081 00082 #endif