5 |
|
|
6 |
#include "../utils/mbfunctions.h" |
#include "../utils/mbfunctions.h" |
7 |
|
|
8 |
|
#include <stdlib.h> /* malloc, free */ |
9 |
|
|
10 |
#define ESCAPE 7167 |
#define ESCAPE 7167 |
11 |
#define ABS(X) (((X)>0)?(X):-(X)) |
#define ABS(X) (((X)>0)?(X):-(X)) |
12 |
#define CLIP(X,A) (X > A) ? (A) : (X) |
#define CLIP(X,A) (X > A) ? (A) : (X) |
56 |
char *max_run_ptr = max_run[last + (intra << 1)]; |
char *max_run_ptr = max_run[last + (intra << 1)]; |
57 |
|
|
58 |
for(l = 0; l < 64; l++) { // run |
for(l = 0; l < 64; l++) { // run |
59 |
int32_t level = k, run = l; |
int32_t level = k; |
60 |
|
uint32_t run = l; |
61 |
|
|
62 |
if(abs(level) <= max_level_ptr[run] && run <= max_run_ptr[abs(level)]) { |
if(abs(level) <= max_level_ptr[run] && run <= max_run_ptr[abs(level)]) { |
63 |
|
|
266 |
{ |
{ |
267 |
uint32_t i, mcbpc, cbpy, bits; |
uint32_t i, mcbpc, cbpy, bits; |
268 |
|
|
|
mcbpc = pMB->cbp & 3; |
|
269 |
cbpy = pMB->cbp >> 2; |
cbpy = pMB->cbp >> 2; |
270 |
|
|
271 |
// write mcbpc |
// write mcbpc |
272 |
if(pParam->coding_type == I_VOP) |
if(pParam->coding_type == I_VOP) { |
273 |
BitstreamPutBits(bs, mcbpc_I[mcbpc].code, mcbpc_I[mcbpc].len); |
mcbpc = ((pMB->mode >> 1) & 3) | ((pMB->cbp & 3) << 2); |
274 |
else |
BitstreamPutBits(bs, mcbpc_intra_tab[mcbpc].code, mcbpc_intra_tab[mcbpc].len); |
275 |
BitstreamPutBits(bs, mcbpc_P_intra[mcbpc].code, mcbpc_P_intra[mcbpc].len); |
} |
276 |
|
else { |
277 |
|
mcbpc = (pMB->mode & 7) | ((pMB->cbp & 3) << 3); |
278 |
|
BitstreamPutBits(bs, mcbpc_inter_tab[mcbpc].code, mcbpc_inter_tab[mcbpc].len); |
279 |
|
} |
280 |
|
|
281 |
// ac prediction flag |
// ac prediction flag |
282 |
if(pMB->acpred_directions[0]) |
if(pMB->acpred_directions[0]) |
320 |
int32_t i; |
int32_t i; |
321 |
uint32_t bits, mcbpc, cbpy; |
uint32_t bits, mcbpc, cbpy; |
322 |
|
|
323 |
mcbpc = pMB->cbp & 3; |
mcbpc = (pMB->mode & 7) | ((pMB->cbp & 3) << 3); |
324 |
cbpy = 15 - (pMB->cbp >> 2); |
cbpy = 15 - (pMB->cbp >> 2); |
325 |
|
|
326 |
// write mcbpc |
// write mcbpc |
327 |
if(pMB->mode == MODE_INTER4V) |
BitstreamPutBits(bs, mcbpc_inter_tab[mcbpc].code, mcbpc_inter_tab[mcbpc].len); |
|
BitstreamPutBits(bs, mcbpc_P_inter4v[mcbpc].code, mcbpc_P_inter4v[mcbpc].len); |
|
|
else |
|
|
BitstreamPutBits(bs, mcbpc_P_inter[mcbpc].code, mcbpc_P_inter[mcbpc].len); |
|
328 |
|
|
329 |
// write cbpy |
// write cbpy |
330 |
BitstreamPutBits(bs, cbpy_tab[cbpy].code, cbpy_tab[cbpy].len); |
BitstreamPutBits(bs, cbpy_tab[cbpy].code, cbpy_tab[cbpy].len); |
377 |
|
|
378 |
|
|
379 |
/*************************************************************** |
/*************************************************************** |
380 |
/* decoding stuff starts here * |
* decoding stuff starts here * |
381 |
/***************************************************************/ |
***************************************************************/ |
382 |
|
|
383 |
int get_mcbpc_intra(Bitstream * bs) |
int get_mcbpc_intra(Bitstream * bs) |
384 |
{ |
{ |