Archived
1
0
This repository has been archived on 2024-10-17. You can view files and clone it, but cannot push or open issues or pull requests.
winamp/Src/h264dec/ldecod/inc/macroblock.h
2024-09-24 14:54:57 +02:00

178 lines
4.7 KiB
C

/*!
************************************************************************
* \file macroblock.h
*
* \brief
* Arrays for macroblock encoding
*
* \author
* Inge Lille-Langoy <inge.lille-langoy@telenor.com>
* Copyright (C) 1999 Telenor Satellite Services, Norway
************************************************************************
*/
#ifndef _MACROBLOCK_H_
#define _MACROBLOCK_H_
#include "global.h"
#include "mbuffer.h"
#include "block.h"
//! single scan pattern
static const byte SNGL_SCAN[16][2] =
{
{0,0},{1,0},{0,1},{0,2},
{1,1},{2,0},{3,0},{2,1},
{1,2},{0,3},{1,3},{2,2},
{3,1},{3,2},{2,3},{3,3}
};
static const byte SNGL_SCAN_1D[16] = { 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15};
static const byte SNGL_SCAN_DC[16] = { 0, 1, 2, 8, 3, 4, 5, 6, 9, 10, 11, 12, 7, 13, 14, 15};
//! field scan pattern
static const byte FIELD_SCAN[16][2] =
{
{0,0},{0,1},{1,0},{0,2},
{0,3},{1,1},{1,2},{1,3},
{2,0},{2,1},{2,2},{2,3},
{3,0},{3,1},{3,2},{3,3}
};
static const byte FIELD_SCAN_1D[16] = {0, 4, 1, 8, 12, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15};
static const byte FIELD_SCAN_DC[16] = {0, 2, 1, 8, 10, 3, 9, 11, 4, 6, 12, 14, 5, 7, 13, 15};
//! used to control block sizes : Not used/16x16/16x8/8x16/8x8/8x4/4x8/4x4
static const int BLOCK_STEP[8][2]=
{
{0,0},{4,4},{4,2},{2,4},{2,2},{2,1},{1,2},{1,1}
};
//! single scan pattern
static const byte SNGL_SCAN8x8[64][2] = {
{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},
{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},
{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},
{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}
};
static const byte SNGL_SCAN8x8_1D[64] =
{
0, 1, 8, 16, 9, 2, 3, 10,
17, 24, 32, 25, 18, 11, 4, 5,
12, 19, 26, 33, 40, 48, 41, 34,
27, 20, 13, 6, 7, 14, 21, 28,
35, 42, 49, 56, 57, 50, 43, 36,
29, 22, 15, 23, 30, 37, 44, 51,
58, 59, 52, 45, 38, 31, 39, 46,
53, 60, 61, 54, 47, 55, 62, 63
};
//! field scan pattern
static const byte FIELD_SCAN8x8[64][2] = { // 8x8
{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},
{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},
{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},
{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}
};
static const byte FIELD_SCAN8x8_1D[64] =
{
0, 8, 16, 1, 9, 24, 32, 17,
2, 25, 40, 48, 56, 33, 10, 3,
18, 41, 49, 57, 26, 11, 4, 19,
34, 42, 50, 58, 27, 12, 5, 20,
35, 43, 51, 59, 28, 13, 6, 21,
36, 44, 52, 60, 29, 14, 22, 37,
45, 53, 61, 30, 7, 15, 38, 46,
54, 62, 23, 31, 39, 47, 55, 63
};
//! single scan pattern
static const byte SCAN_YUV422[8][2] =
{
{0,0},{0,1},
{1,0},{0,2},
{0,3},{1,1},
{1,2},{1,3}
};
static const unsigned char cbp_blk_chroma[8][4] =
{ {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}
};
static const unsigned char cofuv_blk_x[3][8][4] =
{ { {0, 1, 0, 1},
{0, 1, 0, 1},
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0} },
{ {0, 1, 0, 1},
{0, 1, 0, 1},
{0, 1, 0, 1},
{0, 1, 0, 1},
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0},
{0, 0, 0, 0} },
{ {0, 1, 0, 1},
{2, 3, 2, 3},
{0, 1, 0, 1},
{2, 3, 2, 3},
{0, 1, 0, 1},
{2, 3, 2, 3},
{0, 1, 0, 1},
{2, 3, 2, 3} }
};
static const unsigned char cofuv_blk_y[3][8][4] =
{
{ { 0, 0, 1, 1},
{ 0, 0, 1, 1},
{ 0, 0, 0, 0},
{ 0, 0, 0, 0},
{ 0, 0, 0, 0},
{ 0, 0, 0, 0},
{ 0, 0, 0, 0},
{ 0, 0, 0, 0} },
{ { 0, 0, 1, 1},
{ 2, 2, 3, 3},
{ 0, 0, 1, 1},
{ 2, 2, 3, 3},
{ 0, 0, 0, 0},
{ 0, 0, 0, 0},
{ 0, 0, 0, 0},
{ 0, 0, 0, 0} },
{ { 0, 0, 1, 1},
{ 0, 0, 1, 1},
{ 2, 2, 3, 3},
{ 2, 2, 3, 3},
{ 0, 0, 1, 1},
{ 0, 0, 1, 1},
{ 2, 2, 3, 3},
{ 2, 2, 3, 3}}
};
extern void setup_slice_methods(Slice *currSlice);
extern void get_neighbors(Macroblock *currMB, PixelPos *block, int mb_x, int mb_y, int blockshape_x);
extern void get_neighbors0016(Macroblock *currMB, PixelPos *block);
extern void start_macroblock (Slice *currSlice, Macroblock **currMB);
extern int decode_one_macroblock(Macroblock *currMB, StorablePicture *dec_picture);
extern Boolean exit_macroblock (Slice *currSlice, int eos_bit);
#endif