comparison dv.c @ 11195:d464f498e19f libavcodec

Use LOCAL_ALIGNED macro for local arrays
author mru
date Wed, 17 Feb 2010 20:36:20 +0000
parents 34a65026fa06
children 85d679e0b591
comparison
equal deleted inserted replaced
11194:7b3f6955462b 11195:d464f498e19f
530 uint8_t *y_ptr; 530 uint8_t *y_ptr;
531 const uint8_t *buf_ptr; 531 const uint8_t *buf_ptr;
532 PutBitContext pb, vs_pb; 532 PutBitContext pb, vs_pb;
533 GetBitContext gb; 533 GetBitContext gb;
534 BlockInfo mb_data[5 * DV_MAX_BPM], *mb, *mb1; 534 BlockInfo mb_data[5 * DV_MAX_BPM], *mb, *mb1;
535 DECLARE_ALIGNED_16(DCTELEM, sblock)[5*DV_MAX_BPM][64]; 535 LOCAL_ALIGNED_16(DCTELEM, sblock, [5*DV_MAX_BPM], [64]);
536 DECLARE_ALIGNED_16(uint8_t, mb_bit_buffer)[80 + 4]; /* allow some slack */ 536 LOCAL_ALIGNED_16(uint8_t, mb_bit_buffer, [80 + 4]); /* allow some slack */
537 DECLARE_ALIGNED_16(uint8_t, vs_bit_buffer)[5 * 80 + 4]; /* allow some slack */ 537 LOCAL_ALIGNED_16(uint8_t, vs_bit_buffer, [5 * 80 + 4]); /* allow some slack */
538 const int log2_blocksize = 3-s->avctx->lowres; 538 const int log2_blocksize = 3-s->avctx->lowres;
539 int is_field_mode[5]; 539 int is_field_mode[5];
540 540
541 assert((((int)mb_bit_buffer) & 7) == 0); 541 assert((((int)mb_bit_buffer) & 7) == 0);
542 assert((((int)vs_bit_buffer) & 7) == 0); 542 assert((((int)vs_bit_buffer) & 7) == 0);
543 543
544 memset(sblock, 0, sizeof(sblock)); 544 memset(sblock, 0, 5*DV_MAX_BPM*sizeof(*sblock));
545 545
546 /* pass 1 : read DC and AC coefficients in blocks */ 546 /* pass 1 : read DC and AC coefficients in blocks */
547 buf_ptr = &s->buf[work_chunk->buf_offset*80]; 547 buf_ptr = &s->buf[work_chunk->buf_offset*80];
548 block1 = &sblock[0][0]; 548 block1 = &sblock[0][0];
549 mb1 = mb_data; 549 mb1 = mb_data;
831 831
832 static av_always_inline int dv_init_enc_block(EncBlockInfo* bi, uint8_t *data, int linesize, DVVideoContext *s, int bias) 832 static av_always_inline int dv_init_enc_block(EncBlockInfo* bi, uint8_t *data, int linesize, DVVideoContext *s, int bias)
833 { 833 {
834 const int *weight; 834 const int *weight;
835 const uint8_t* zigzag_scan; 835 const uint8_t* zigzag_scan;
836 DECLARE_ALIGNED_16(DCTELEM, blk)[64]; 836 LOCAL_ALIGNED_16(DCTELEM, blk, [64]);
837 int i, area; 837 int i, area;
838 /* We offer two different methods for class number assignment: the 838 /* We offer two different methods for class number assignment: the
839 method suggested in SMPTE 314M Table 22, and an improved 839 method suggested in SMPTE 314M Table 22, and an improved
840 method. The SMPTE method is very conservative; it assigns class 840 method. The SMPTE method is very conservative; it assigns class
841 3 (i.e. severe quantization) to any block where the largest AC 841 3 (i.e. severe quantization) to any block where the largest AC
864 s->get_pixels(blk, data, linesize); 864 s->get_pixels(blk, data, linesize);
865 s->fdct[bi->dct_mode](blk); 865 s->fdct[bi->dct_mode](blk);
866 } else { 866 } else {
867 /* We rely on the fact that encoding all zeros leads to an immediate EOB, 867 /* We rely on the fact that encoding all zeros leads to an immediate EOB,
868 which is precisely what the spec calls for in the "dummy" blocks. */ 868 which is precisely what the spec calls for in the "dummy" blocks. */
869 memset(blk, 0, sizeof(blk)); 869 memset(blk, 0, 64*sizeof(*blk));
870 bi->dct_mode = 0; 870 bi->dct_mode = 0;
871 } 871 }
872 bi->mb[0] = blk[0]; 872 bi->mb[0] = blk[0];
873 873
874 zigzag_scan = bi->dct_mode ? ff_zigzag248_direct : ff_zigzag_direct; 874 zigzag_scan = bi->dct_mode ? ff_zigzag248_direct : ff_zigzag_direct;