comparison eatqi.c @ 9702:3dcbde0de577 libavcodec

eatqi: move "block" variable into context to ensure sufficient alignment for idct_put for compilers/architectures that can not align stack variables that much. This is also consistent with similar code in eatgq.c
author reimar
date Sun, 24 May 2009 09:14:19 +0000
parents 0dce4fe6e6f3
children 34a65026fa06
comparison
equal deleted inserted replaced
9701:31f48c034eae 9702:3dcbde0de577
38 typedef struct TqiContext { 38 typedef struct TqiContext {
39 MpegEncContext s; 39 MpegEncContext s;
40 AVFrame frame; 40 AVFrame frame;
41 void *bitstream_buf; 41 void *bitstream_buf;
42 unsigned int bitstream_buf_size; 42 unsigned int bitstream_buf_size;
43 DECLARE_ALIGNED_16(DCTELEM, block[6][64]);
43 } TqiContext; 44 } TqiContext;
44 45
45 static av_cold int tqi_decode_init(AVCodecContext *avctx) 46 static av_cold int tqi_decode_init(AVCodecContext *avctx)
46 { 47 {
47 TqiContext *t = avctx->priv_data; 48 TqiContext *t = avctx->priv_data;
106 const uint8_t *buf = avpkt->data; 107 const uint8_t *buf = avpkt->data;
107 int buf_size = avpkt->size; 108 int buf_size = avpkt->size;
108 const uint8_t *buf_end = buf+buf_size; 109 const uint8_t *buf_end = buf+buf_size;
109 TqiContext *t = avctx->priv_data; 110 TqiContext *t = avctx->priv_data;
110 MpegEncContext *s = &t->s; 111 MpegEncContext *s = &t->s;
111 DECLARE_ALIGNED_16(DCTELEM, block[6][64]);
112 112
113 s->width = AV_RL16(&buf[0]); 113 s->width = AV_RL16(&buf[0]);
114 s->height = AV_RL16(&buf[2]); 114 s->height = AV_RL16(&buf[2]);
115 tqi_calculate_qtable(s, buf[4]); 115 tqi_calculate_qtable(s, buf[4]);
116 buf += 8; 116 buf += 8;
134 134
135 s->last_dc[0] = s->last_dc[1] = s->last_dc[2] = 0; 135 s->last_dc[0] = s->last_dc[1] = s->last_dc[2] = 0;
136 for (s->mb_y=0; s->mb_y<(avctx->height+15)/16; s->mb_y++) 136 for (s->mb_y=0; s->mb_y<(avctx->height+15)/16; s->mb_y++)
137 for (s->mb_x=0; s->mb_x<(avctx->width+15)/16; s->mb_x++) 137 for (s->mb_x=0; s->mb_x<(avctx->width+15)/16; s->mb_x++)
138 { 138 {
139 tqi_decode_mb(s, block); 139 tqi_decode_mb(s, t->block);
140 tqi_idct_put(t, block); 140 tqi_idct_put(t, t->block);
141 } 141 }
142 142
143 *data_size = sizeof(AVFrame); 143 *data_size = sizeof(AVFrame);
144 *(AVFrame*)data = t->frame; 144 *(AVFrame*)data = t->frame;
145 return buf_size; 145 return buf_size;