Mercurial > libavcodec.hg
comparison svq1dec.c @ 8318:bc36a075bf35 libavcodec
The POSIX namespace shall be held sacrosanct. To that end,
continue eliminating _t from structure names in FFmpeg.
author | melanson |
---|---|
date | Sun, 14 Dec 2008 03:29:33 +0000 |
parents | f693666fbf9f |
children | d6bab465b82c |
comparison
equal
deleted
inserted
replaced
8317:08b0f63a91c5 | 8318:bc36a075bf35 |
---|---|
54 | 54 |
55 /* motion vector (prediction) */ | 55 /* motion vector (prediction) */ |
56 typedef struct svq1_pmv_s { | 56 typedef struct svq1_pmv_s { |
57 int x; | 57 int x; |
58 int y; | 58 int y; |
59 } svq1_pmv_t; | 59 } svq1_pmv; |
60 | 60 |
61 static const uint16_t checksum_table[256] = { | 61 static const uint16_t checksum_table[256] = { |
62 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7, | 62 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7, |
63 0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF, | 63 0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF, |
64 0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6, | 64 0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6, |
299 SVQ1_DO_CODEBOOK_NONINTRA() | 299 SVQ1_DO_CODEBOOK_NONINTRA() |
300 } | 300 } |
301 return 0; | 301 return 0; |
302 } | 302 } |
303 | 303 |
304 static int svq1_decode_motion_vector (GetBitContext *bitbuf, svq1_pmv_t *mv, svq1_pmv_t **pmv) { | 304 static int svq1_decode_motion_vector (GetBitContext *bitbuf, svq1_pmv *mv, svq1_pmv **pmv) { |
305 int diff; | 305 int diff; |
306 int i; | 306 int i; |
307 | 307 |
308 for (i=0; i < 2; i++) { | 308 for (i=0; i < 2; i++) { |
309 | 309 |
340 } | 340 } |
341 } | 341 } |
342 | 342 |
343 static int svq1_motion_inter_block (MpegEncContext *s, GetBitContext *bitbuf, | 343 static int svq1_motion_inter_block (MpegEncContext *s, GetBitContext *bitbuf, |
344 uint8_t *current, uint8_t *previous, int pitch, | 344 uint8_t *current, uint8_t *previous, int pitch, |
345 svq1_pmv_t *motion, int x, int y) { | 345 svq1_pmv *motion, int x, int y) { |
346 uint8_t *src; | 346 uint8_t *src; |
347 uint8_t *dst; | 347 uint8_t *dst; |
348 svq1_pmv_t mv; | 348 svq1_pmv mv; |
349 svq1_pmv_t *pmv[3]; | 349 svq1_pmv *pmv[3]; |
350 int result; | 350 int result; |
351 | 351 |
352 /* predict and decode motion vector */ | 352 /* predict and decode motion vector */ |
353 pmv[0] = &motion[0]; | 353 pmv[0] = &motion[0]; |
354 if (y == 0) { | 354 if (y == 0) { |
392 return 0; | 392 return 0; |
393 } | 393 } |
394 | 394 |
395 static int svq1_motion_inter_4v_block (MpegEncContext *s, GetBitContext *bitbuf, | 395 static int svq1_motion_inter_4v_block (MpegEncContext *s, GetBitContext *bitbuf, |
396 uint8_t *current, uint8_t *previous, int pitch, | 396 uint8_t *current, uint8_t *previous, int pitch, |
397 svq1_pmv_t *motion,int x, int y) { | 397 svq1_pmv *motion,int x, int y) { |
398 uint8_t *src; | 398 uint8_t *src; |
399 uint8_t *dst; | 399 uint8_t *dst; |
400 svq1_pmv_t mv; | 400 svq1_pmv mv; |
401 svq1_pmv_t *pmv[4]; | 401 svq1_pmv *pmv[4]; |
402 int i, result; | 402 int i, result; |
403 | 403 |
404 /* predict and decode motion vector (0) */ | 404 /* predict and decode motion vector (0) */ |
405 pmv[0] = &motion[0]; | 405 pmv[0] = &motion[0]; |
406 if (y == 0) { | 406 if (y == 0) { |
482 return 0; | 482 return 0; |
483 } | 483 } |
484 | 484 |
485 static int svq1_decode_delta_block (MpegEncContext *s, GetBitContext *bitbuf, | 485 static int svq1_decode_delta_block (MpegEncContext *s, GetBitContext *bitbuf, |
486 uint8_t *current, uint8_t *previous, int pitch, | 486 uint8_t *current, uint8_t *previous, int pitch, |
487 svq1_pmv_t *motion, int x, int y) { | 487 svq1_pmv *motion, int x, int y) { |
488 uint32_t block_type; | 488 uint32_t block_type; |
489 int result = 0; | 489 int result = 0; |
490 | 490 |
491 /* get block type */ | 491 /* get block type */ |
492 block_type = get_vlc2(bitbuf, svq1_block_type.table, 2, 2); | 492 block_type = get_vlc2(bitbuf, svq1_block_type.table, 2, 2); |
725 } | 725 } |
726 } | 726 } |
727 current += 16*linesize; | 727 current += 16*linesize; |
728 } | 728 } |
729 } else { | 729 } else { |
730 svq1_pmv_t pmv[width/8+3]; | 730 svq1_pmv pmv[width/8+3]; |
731 /* delta frame */ | 731 /* delta frame */ |
732 memset (pmv, 0, ((width / 8) + 3) * sizeof(svq1_pmv_t)); | 732 memset (pmv, 0, ((width / 8) + 3) * sizeof(svq1_pmv)); |
733 | 733 |
734 for (y=0; y < height; y+=16) { | 734 for (y=0; y < height; y+=16) { |
735 for (x=0; x < width; x+=16) { | 735 for (x=0; x < width; x+=16) { |
736 result = svq1_decode_delta_block (s, &s->gb, ¤t[x], previous, | 736 result = svq1_decode_delta_block (s, &s->gb, ¤t[x], previous, |
737 linesize, pmv, x, y); | 737 linesize, pmv, x, y); |