comparison rtjpeg.c @ 9699:19c88aa29bec libavcodec

Move "block" variable in rtjpeg decoder to context to ensure sufficient alignment for idct_put on architectures/compilers that have problems aligning on the stack.
author reimar
date Sun, 24 May 2009 08:36:52 +0000
parents 0dce4fe6e6f3
children 1a8821c5d28d
comparison
equal deleted inserted replaced
9698:9c9342d1ce14 9699:19c88aa29bec
96 * \param buf_size length of input data in bytes 96 * \param buf_size length of input data in bytes
97 * \return number of bytes consumed from the input buffer 97 * \return number of bytes consumed from the input buffer
98 */ 98 */
99 int rtjpeg_decode_frame_yuv420(RTJpegContext *c, AVFrame *f, 99 int rtjpeg_decode_frame_yuv420(RTJpegContext *c, AVFrame *f,
100 const uint8_t *buf, int buf_size) { 100 const uint8_t *buf, int buf_size) {
101 DECLARE_ALIGNED_16(DCTELEM, block[64]);
102 GetBitContext gb; 101 GetBitContext gb;
103 int w = c->w / 16, h = c->h / 16; 102 int w = c->w / 16, h = c->h / 16;
104 int x, y; 103 int x, y;
105 uint8_t *y1 = f->data[0], *y2 = f->data[0] + 8 * f->linesize[0]; 104 uint8_t *y1 = f->data[0], *y2 = f->data[0] + 8 * f->linesize[0];
106 uint8_t *u = f->data[1], *v = f->data[2]; 105 uint8_t *u = f->data[1], *v = f->data[2];
107 init_get_bits(&gb, buf, buf_size * 8); 106 init_get_bits(&gb, buf, buf_size * 8);
108 for (y = 0; y < h; y++) { 107 for (y = 0; y < h; y++) {
109 for (x = 0; x < w; x++) { 108 for (x = 0; x < w; x++) {
109 DCTELEM *block = c->block;
110 if (get_block(&gb, block, c->scan, c->lquant)) 110 if (get_block(&gb, block, c->scan, c->lquant))
111 c->dsp->idct_put(y1, f->linesize[0], block); 111 c->dsp->idct_put(y1, f->linesize[0], block);
112 y1 += 8; 112 y1 += 8;
113 if (get_block(&gb, block, c->scan, c->lquant)) 113 if (get_block(&gb, block, c->scan, c->lquant))
114 c->dsp->idct_put(y1, f->linesize[0], block); 114 c->dsp->idct_put(y1, f->linesize[0], block);