comparison eatgq.c @ 9685:ab8b3b2e4d49 libavcodec

Move eatgq blocks array from the stack to the codec context and make sure it is aligned as necessary for DSPContext's idct_put. Just aligning it on the stack would have been possible but less reliable and without any real benefit.
author reimar
date Fri, 22 May 2009 18:39:00 +0000
parents b5bc4764ff7a
children 34a65026fa06
comparison
equal deleted inserted replaced
9684:c1ed557cd3b8 9685:ab8b3b2e4d49
40 DSPContext dsp; 40 DSPContext dsp;
41 AVFrame frame; 41 AVFrame frame;
42 int width,height; 42 int width,height;
43 ScanTable scantable; 43 ScanTable scantable;
44 int qtable[64]; 44 int qtable[64];
45 DECLARE_ALIGNED_16(DCTELEM, block[6][64]);
45 } TgqContext; 46 } TgqContext;
46 47
47 static av_cold int tgq_decode_init(AVCodecContext *avctx){ 48 static av_cold int tgq_decode_init(AVCodecContext *avctx){
48 TgqContext *s = avctx->priv_data; 49 TgqContext *s = avctx->priv_data;
49 s->avctx = avctx; 50 s->avctx = avctx;
142 143
143 static void tgq_decode_mb(TgqContext *s, int mb_y, int mb_x, const uint8_t **bs, const uint8_t *buf_end){ 144 static void tgq_decode_mb(TgqContext *s, int mb_y, int mb_x, const uint8_t **bs, const uint8_t *buf_end){
144 int mode; 145 int mode;
145 int i; 146 int i;
146 int8_t dc[6]; 147 int8_t dc[6];
147 DCTELEM block[6][64];
148 148
149 mode = bytestream_get_byte(bs); 149 mode = bytestream_get_byte(bs);
150 if (mode>buf_end-*bs) { 150 if (mode>buf_end-*bs) {
151 av_log(s->avctx, AV_LOG_ERROR, "truncated macroblock\n"); 151 av_log(s->avctx, AV_LOG_ERROR, "truncated macroblock\n");
152 return; 152 return;
154 154
155 if (mode>12) { 155 if (mode>12) {
156 GetBitContext gb; 156 GetBitContext gb;
157 init_get_bits(&gb, *bs, mode*8); 157 init_get_bits(&gb, *bs, mode*8);
158 for(i=0; i<6; i++) 158 for(i=0; i<6; i++)
159 tgq_decode_block(s, block[i], &gb); 159 tgq_decode_block(s, s->block[i], &gb);
160 tgq_idct_put_mb(s, block, mb_x, mb_y); 160 tgq_idct_put_mb(s, s->block, mb_x, mb_y);
161 }else{ 161 }else{
162 if (mode==3) { 162 if (mode==3) {
163 memset(dc, (*bs)[0], 4); 163 memset(dc, (*bs)[0], 4);
164 dc[4] = (*bs)[1]; 164 dc[4] = (*bs)[1];
165 dc[5] = (*bs)[2]; 165 dc[5] = (*bs)[2];