~ubuntu-branches/ubuntu/trusty/libav/trusty-proposed

« back to all changes in this revision

Viewing changes to libavcodec/eatgq.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2013-10-22 23:24:08 UTC
  • mfrom: (1.3.36 sid)
  • Revision ID: package-import@ubuntu.com-20131022232408-b8tvvn4pyzri9mi3
Tags: 6:9.10-1ubuntu1
* Build all -extra flavors from this source package, as libav got demoted
  from main to universe, cf LP: #1243235
* Simplify debian/rules to follow exactly the code that debian executes
* New upstream (LP: #1180288) fixes lots of security issues (LP: #1242802)
* Merge from unstable, remaining changes:
  - build-depend on libtiff5-dev rather than libtiff4-dev,
    avoids FTBFS caused by imlib
  - follow the regular debian codepaths

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
#include "bytestream.h"
35
35
#include "dsputil.h"
36
36
#include "aandcttab.h"
 
37
#include "eaidct.h"
 
38
#include "internal.h"
37
39
 
38
40
typedef struct TgqContext {
39
41
    AVCodecContext *avctx;
40
 
    DSPContext dsp;
41
42
    AVFrame frame;
42
43
    int width,height;
43
44
    ScanTable scantable;
48
49
 
49
50
static av_cold int tgq_decode_init(AVCodecContext *avctx){
50
51
    TgqContext *s = avctx->priv_data;
 
52
    uint8_t idct_permutation[64];
51
53
    s->avctx = avctx;
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;
58
58
    return 0;
59
59
}
60
60
 
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;
111
111
 
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]);
119
119
    }
120
120
}
121
121
 
180
180
    const int b = (11*(100-quant))/100 + 4;
181
181
    for(j=0;j<8;j++)
182
182
    for(i=0;i<8;i++)
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);
185
 
        else
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);
187
184
}
188
185
 
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");
225
222
            return -1;
226
223
        }
230
227
        for (x = 0; x < FFALIGN(avctx->width, 16) >> 4; x++)
231
228
            tgq_decode_mb(s, y, x);
232
229
 
233
 
    *data_size = sizeof(AVFrame);
 
230
    *got_frame = 1;
234
231
    *(AVFrame*)data = s->frame;
235
232
 
236
233
    return avpkt->size;
246
243
AVCodec ff_eatgq_decoder = {
247
244
    .name           = "eatgq",
248
245
    .type           = AVMEDIA_TYPE_VIDEO,
249
 
    .id             = CODEC_ID_TGQ,
 
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"),
256
253
};