Mercurial > libavcodec.hg
comparison rtjpeg.c @ 4145:a5fca6fd5e4c libavcodec
Move idct block array variable onto rtjpeg_decode_frame_yuv420 stack since
it is only used there and is only 128 byte large.
Also make it aligned to fix playback with altivec.
| author | reimar |
|---|---|
| date | Sun, 05 Nov 2006 16:18:37 +0000 |
| parents | c8c591fe26f8 |
| children | e283c82e10aa |
comparison
equal
deleted
inserted
replaced
| 4144:dc52a253f51b | 4145:a5fca6fd5e4c |
|---|---|
| 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 uint8_t *buf, int buf_size) { | 100 uint8_t *buf, int buf_size) { |
| 101 DECLARE_ALIGNED_16(DCTELEM, block[64]); | |
| 101 GetBitContext gb; | 102 GetBitContext gb; |
| 102 int w = c->w / 16, h = c->h / 16; | 103 int w = c->w / 16, h = c->h / 16; |
| 103 int x, y; | 104 int x, y; |
| 104 void *y1 = f->data[0], *y2 = f->data[0] + 8 * f->linesize[0]; | 105 void *y1 = f->data[0], *y2 = f->data[0] + 8 * f->linesize[0]; |
| 105 void *u = f->data[1], *v = f->data[2]; | 106 void *u = f->data[1], *v = f->data[2]; |
| 106 init_get_bits(&gb, buf, buf_size * 8); | 107 init_get_bits(&gb, buf, buf_size * 8); |
| 107 for (y = 0; y < h; y++) { | 108 for (y = 0; y < h; y++) { |
| 108 for (x = 0; x < w; x++) { | 109 for (x = 0; x < w; x++) { |
| 109 if (get_block(&gb, c->block, c->scan, c->lquant)) | 110 if (get_block(&gb, block, c->scan, c->lquant)) |
| 110 c->dsp->idct_put(y1, f->linesize[0], c->block); | 111 c->dsp->idct_put(y1, f->linesize[0], block); |
| 111 y1 += 8; | 112 y1 += 8; |
| 112 if (get_block(&gb, c->block, c->scan, c->lquant)) | 113 if (get_block(&gb, block, c->scan, c->lquant)) |
| 113 c->dsp->idct_put(y1, f->linesize[0], c->block); | 114 c->dsp->idct_put(y1, f->linesize[0], block); |
| 114 y1 += 8; | 115 y1 += 8; |
| 115 if (get_block(&gb, c->block, c->scan, c->lquant)) | 116 if (get_block(&gb, block, c->scan, c->lquant)) |
| 116 c->dsp->idct_put(y2, f->linesize[0], c->block); | 117 c->dsp->idct_put(y2, f->linesize[0], block); |
| 117 y2 += 8; | 118 y2 += 8; |
| 118 if (get_block(&gb, c->block, c->scan, c->lquant)) | 119 if (get_block(&gb, block, c->scan, c->lquant)) |
| 119 c->dsp->idct_put(y2, f->linesize[0], c->block); | 120 c->dsp->idct_put(y2, f->linesize[0], block); |
| 120 y2 += 8; | 121 y2 += 8; |
| 121 if (get_block(&gb, c->block, c->scan, c->cquant)) | 122 if (get_block(&gb, block, c->scan, c->cquant)) |
| 122 c->dsp->idct_put(u, f->linesize[1], c->block); | 123 c->dsp->idct_put(u, f->linesize[1], block); |
| 123 u += 8; | 124 u += 8; |
| 124 if (get_block(&gb, c->block, c->scan, c->cquant)) | 125 if (get_block(&gb, block, c->scan, c->cquant)) |
| 125 c->dsp->idct_put(v, f->linesize[2], c->block); | 126 c->dsp->idct_put(v, f->linesize[2], block); |
| 126 v += 8; | 127 v += 8; |
| 127 } | 128 } |
| 128 y1 += 2 * 8 * (f->linesize[0] - w); | 129 y1 += 2 * 8 * (f->linesize[0] - w); |
| 129 y2 += 2 * 8 * (f->linesize[0] - w); | 130 y2 += 2 * 8 * (f->linesize[0] - w); |
| 130 u += 8 * (f->linesize[1] - w); | 131 u += 8 * (f->linesize[1] - w); |
