Mercurial > libavcodec.hg
comparison dv.c @ 7980:3b5964de95cd libavcodec
spelling cosmetics
author | diego |
---|---|
date | Thu, 02 Oct 2008 16:28:58 +0000 |
parents | dbcdd0165e55 |
children | 68f0d19ff0a2 |
comparison
equal
deleted
inserted
replaced
7979:5214daf6ce78 | 7980:3b5964de95cd |
---|---|
282 static inline int put_bits_left(PutBitContext* s) | 282 static inline int put_bits_left(PutBitContext* s) |
283 { | 283 { |
284 return (s->buf_end - s->buf) * 8 - put_bits_count(s); | 284 return (s->buf_end - s->buf) * 8 - put_bits_count(s); |
285 } | 285 } |
286 | 286 |
287 /* decode ac coefs */ | 287 /* decode ac coefficients */ |
288 static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block) | 288 static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block) |
289 { | 289 { |
290 int last_index = gb->size_in_bits; | 290 int last_index = gb->size_in_bits; |
291 const uint8_t *scan_table = mb->scan_table; | 291 const uint8_t *scan_table = mb->scan_table; |
292 const uint32_t *factor_table = mb->factor_table; | 292 const uint32_t *factor_table = mb->factor_table; |
491 v = *mb_pos_ptr++; | 491 v = *mb_pos_ptr++; |
492 mb_x = v & 0xff; | 492 mb_x = v & 0xff; |
493 mb_y = v >> 8; | 493 mb_y = v >> 8; |
494 /* We work with 720p frames split in half. The odd half-frame (chan==2,3) is displaced :-( */ | 494 /* We work with 720p frames split in half. The odd half-frame (chan==2,3) is displaced :-( */ |
495 if (s->sys->height == 720 && ((s->buf[1]>>2)&0x3) == 0) { | 495 if (s->sys->height == 720 && ((s->buf[1]>>2)&0x3) == 0) { |
496 mb_y -= (mb_y>17)?18:-72; /* shifting the Y coordinate down by 72/2 macro blocks */ | 496 mb_y -= (mb_y>17)?18:-72; /* shifting the Y coordinate down by 72/2 macroblocks */ |
497 } | 497 } |
498 | 498 |
499 /* idct_put'ting luminance */ | 499 /* idct_put'ting luminance */ |
500 if ((s->sys->pix_fmt == PIX_FMT_YUV420P) || | 500 if ((s->sys->pix_fmt == PIX_FMT_YUV420P) || |
501 (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x >= (704 / 8)) || | 501 (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x >= (704 / 8)) || |
661 int i, area; | 661 int i, area; |
662 /* We offer two different methods for class number assignment: the | 662 /* We offer two different methods for class number assignment: the |
663 method suggested in SMPTE 314M Table 22, and an improved | 663 method suggested in SMPTE 314M Table 22, and an improved |
664 method. The SMPTE method is very conservative; it assigns class | 664 method. The SMPTE method is very conservative; it assigns class |
665 3 (i.e. severe quantization) to any block where the largest AC | 665 3 (i.e. severe quantization) to any block where the largest AC |
666 component is greater than 36. ffmpeg's DV encoder tracks AC bit | 666 component is greater than 36. FFmpeg's DV encoder tracks AC bit |
667 consumption precisely, so there is no need to bias most blocks | 667 consumption precisely, so there is no need to bias most blocks |
668 towards strongly lossy compression. Instead, we assign class 2 | 668 towards strongly lossy compression. Instead, we assign class 2 |
669 to most blocks, and use class 3 only when strictly necessary | 669 to most blocks, and use class 3 only when strictly necessary |
670 (for blocks whose largest AC component exceeds 255). */ | 670 (for blocks whose largest AC component exceeds 255). */ |
671 | 671 |
672 #if 0 /* SMPTE spec method */ | 672 #if 0 /* SMPTE spec method */ |
673 static const int classes[] = {12, 24, 36, 0xffff}; | 673 static const int classes[] = {12, 24, 36, 0xffff}; |
674 #else /* improved ffmpeg method */ | 674 #else /* improved FFmpeg method */ |
675 static const int classes[] = {-1, -1, 255, 0xffff}; | 675 static const int classes[] = {-1, -1, 255, 0xffff}; |
676 #endif | 676 #endif |
677 int max=classes[0]; | 677 int max=classes[0]; |
678 int prev=0; | 678 int prev=0; |
679 | 679 |
1174 memset(buf, 0xff, 80); | 1174 memset(buf, 0xff, 80); |
1175 buf += dv_write_dif_id(dv_sect_audio, chan, i, j/15, buf); | 1175 buf += dv_write_dif_id(dv_sect_audio, chan, i, j/15, buf); |
1176 buf += 77; /* audio control & shuffled PCM audio */ | 1176 buf += 77; /* audio control & shuffled PCM audio */ |
1177 } | 1177 } |
1178 buf += dv_write_dif_id(dv_sect_video, chan, i, j, buf); | 1178 buf += dv_write_dif_id(dv_sect_video, chan, i, j, buf); |
1179 buf += 77; /* 1 video macro block: 1 bytes control | 1179 buf += 77; /* 1 video macroblock: 1 bytes control |
1180 4 * 14 bytes Y 8x8 data | 1180 4 * 14 bytes Y 8x8 data |
1181 10 bytes Cr 8x8 data | 1181 10 bytes Cr 8x8 data |
1182 10 bytes Cb 8x8 data */ | 1182 10 bytes Cb 8x8 data */ |
1183 } | 1183 } |
1184 } | 1184 } |