49
50
static av_cold int tgq_decode_init(AVCodecContext *avctx){
50
51
TgqContext *s = avctx->priv_data;
52
uint8_t idct_permutation[64];
52
if(avctx->idct_algo==FF_IDCT_AUTO)
53
avctx->idct_algo=FF_IDCT_EA;
54
dsputil_init(&s->dsp, avctx);
55
ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct);
54
ff_init_scantable_permutation(idct_permutation, FF_NO_IDCT_PERM);
55
ff_init_scantable(idct_permutation, &s->scantable, ff_zigzag_direct);
56
56
avctx->time_base = (AVRational){1, 15};
57
avctx->pix_fmt = PIX_FMT_YUV420P;
57
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
109
109
uint8_t *dest_cb = s->frame.data[1] + (mb_y * 8 * s->frame.linesize[1]) + mb_x * 8;
110
110
uint8_t *dest_cr = s->frame.data[2] + (mb_y * 8 * s->frame.linesize[2]) + mb_x * 8;
112
s->dsp.idct_put(dest_y , linesize, block[0]);
113
s->dsp.idct_put(dest_y + 8, linesize, block[1]);
114
s->dsp.idct_put(dest_y + 8*linesize , linesize, block[2]);
115
s->dsp.idct_put(dest_y + 8*linesize + 8, linesize, block[3]);
112
ff_ea_idct_put_c(dest_y , linesize, block[0]);
113
ff_ea_idct_put_c(dest_y + 8, linesize, block[1]);
114
ff_ea_idct_put_c(dest_y + 8*linesize , linesize, block[2]);
115
ff_ea_idct_put_c(dest_y + 8*linesize + 8, linesize, block[3]);
116
116
if(!(s->avctx->flags&CODEC_FLAG_GRAY)){
117
s->dsp.idct_put(dest_cb, s->frame.linesize[1], block[4]);
118
s->dsp.idct_put(dest_cr, s->frame.linesize[2], block[5]);
117
ff_ea_idct_put_c(dest_cb, s->frame.linesize[1], block[4]);
118
ff_ea_idct_put_c(dest_cr, s->frame.linesize[2], block[5]);
180
180
const int b = (11*(100-quant))/100 + 4;
183
if (s->avctx->idct_algo==FF_IDCT_EA)
184
s->qtable[j*8+i] = ((a*(j+i)/(7+7) + b)*ff_inv_aanscales[j*8+i])>>(14-4);
186
s->qtable[j*8+i] = (a*(j+i)/(7+7) + b)<<3;
183
s->qtable[j*8+i] = ((a*(j+i)/(7+7) + b)*ff_inv_aanscales[j*8+i])>>(14-4);
189
186
static int tgq_decode_frame(AVCodecContext *avctx,
190
void *data, int *data_size,
187
void *data, int *got_frame,
191
188
AVPacket *avpkt){
192
189
const uint8_t *buf = avpkt->data;
193
190
int buf_size = avpkt->size;
220
217
s->frame.key_frame = 1;
221
218
s->frame.pict_type = AV_PICTURE_TYPE_I;
222
219
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID;
223
if (avctx->get_buffer(avctx, &s->frame)) {
220
if (ff_get_buffer(avctx, &s->frame)) {
224
221
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
246
243
AVCodec ff_eatgq_decoder = {
248
245
.type = AVMEDIA_TYPE_VIDEO,
246
.id = AV_CODEC_ID_TGQ,
250
247
.priv_data_size = sizeof(TgqContext),
251
248
.init = tgq_decode_init,
252
249
.close = tgq_decode_end,
253
250
.decode = tgq_decode_frame,
254
251
.capabilities = CODEC_CAP_DR1,
255
.long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TGQ video"),
252
.long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TGQ video"),