~ubuntu-branches/ubuntu/oneiric/libav/oneiric

« back to all changes in this revision

Viewing changes to libavcodec/vc1.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2011-04-30 14:27:42 UTC
  • mfrom: (1.1.2 experimental)
  • Revision ID: james.westby@ubuntu.com-20110430142742-quvblxk1tj6adlh5
Tags: 4:0.7~b1-1ubuntu1
* Merge from debian. Remaining changes:
  - don't build against libfaad, libdirac, librtmp and libopenjpeg
    (all in universe)
  - explicitly --enable-pic on powerpc, cf. LP #654666
  - different arm configure bits that should probably better be
    merged into debian
* Cherry-picked from git: 
  - install doc/APIChanges and refer to them in NEWS.Debian (Closes: #623682)
  - don't try to install non-existing documentation, fixes FTBFS on powerpc

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 * Copyright (c) 2006-2007 Konstantin Shishkov
4
4
 * Partly based on vc9.c (c) 2005 Anonymous, Alex Beregszaszi, Michael Niedermayer
5
5
 *
6
 
 * This file is part of FFmpeg.
 
6
 * This file is part of Libav.
7
7
 *
8
 
 * FFmpeg is free software; you can redistribute it and/or
 
8
 * Libav is free software; you can redistribute it and/or
9
9
 * modify it under the terms of the GNU Lesser General Public
10
10
 * License as published by the Free Software Foundation; either
11
11
 * version 2.1 of the License, or (at your option) any later version.
12
12
 *
13
 
 * FFmpeg is distributed in the hope that it will be useful,
 
13
 * Libav is distributed in the hope that it will be useful,
14
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
16
 * Lesser General Public License for more details.
17
17
 *
18
18
 * You should have received a copy of the GNU Lesser General Public
19
 
 * License along with FFmpeg; if not, write to the Free Software
 
19
 * License along with Libav; if not, write to the Free Software
20
20
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
21
 */
22
22
 
280
280
 
281
281
static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb);
282
282
 
 
283
static void simple_idct_put_rangered(uint8_t *dest, int line_size, DCTELEM *block)
 
284
{
 
285
    int i;
 
286
    ff_simple_idct(block);
 
287
    for (i = 0; i < 64; i++) block[i] = (block[i] - 64) << 1;
 
288
    ff_put_pixels_clamped_c(block, dest, line_size);
 
289
}
 
290
 
 
291
static void simple_idct_put_signed(uint8_t *dest, int line_size, DCTELEM *block)
 
292
{
 
293
    ff_simple_idct(block);
 
294
    ff_put_signed_pixels_clamped_c(block, dest, line_size);
 
295
}
 
296
 
 
297
static void simple_idct_put_signed_rangered(uint8_t *dest, int line_size, DCTELEM *block)
 
298
{
 
299
    int i;
 
300
    ff_simple_idct(block);
 
301
    for (i = 0; i < 64; i++) block[i] <<= 1;
 
302
    ff_put_signed_pixels_clamped_c(block, dest, line_size);
 
303
}
 
304
 
283
305
/**
284
306
 * Decode Simple/Main Profiles sequence header
285
307
 * @see Figure 7-8, p16-17
293
315
    v->profile = get_bits(gb, 2);
294
316
    if (v->profile == PROFILE_COMPLEX)
295
317
    {
296
 
        av_log(avctx, AV_LOG_ERROR, "WMV3 Complex Profile is not fully supported\n");
 
318
        av_log(avctx, AV_LOG_WARNING, "WMV3 Complex Profile is not fully supported\n");
297
319
    }
298
320
 
299
321
    if (v->profile == PROFILE_ADVANCED)
306
328
    {
307
329
        v->zz_8x4 = wmv2_scantableA;
308
330
        v->zz_4x8 = wmv2_scantableB;
309
 
        v->res_sm = get_bits(gb, 2); //reserved
310
 
        if (v->res_sm)
 
331
        v->res_y411   = get_bits1(gb);
 
332
        v->res_sprite = get_bits1(gb);
 
333
        if (v->res_y411)
311
334
        {
312
335
            av_log(avctx, AV_LOG_ERROR,
313
 
                   "Reserved RES_SM=%i is forbidden\n", v->res_sm);
 
336
                   "Old interlaced mode is not supported\n");
314
337
            return -1;
315
338
        }
 
339
        if (v->res_sprite) {
 
340
            av_log(avctx, AV_LOG_ERROR, "WMVP is not fully supported\n");
 
341
        }
316
342
    }
317
343
 
318
344
    // (fps-2)/4 (->30)
333
359
    v->res_fasttx = get_bits1(gb);
334
360
    if (!v->res_fasttx)
335
361
    {
336
 
        v->s.dsp.vc1_inv_trans_8x8 = ff_simple_idct;
337
 
        v->s.dsp.vc1_inv_trans_8x4 = ff_simple_idct84_add;
338
 
        v->s.dsp.vc1_inv_trans_4x8 = ff_simple_idct48_add;
339
 
        v->s.dsp.vc1_inv_trans_4x4 = ff_simple_idct44_add;
340
 
        v->s.dsp.vc1_inv_trans_8x8_dc = ff_simple_idct_add;
341
 
        v->s.dsp.vc1_inv_trans_8x4_dc = ff_simple_idct84_add;
342
 
        v->s.dsp.vc1_inv_trans_4x8_dc = ff_simple_idct48_add;
343
 
        v->s.dsp.vc1_inv_trans_4x4_dc = ff_simple_idct44_add;
 
362
        v->vc1dsp.vc1_inv_trans_8x8_add = ff_simple_idct_add;
 
363
        v->vc1dsp.vc1_inv_trans_8x8_put[0] = ff_simple_idct_put;
 
364
        v->vc1dsp.vc1_inv_trans_8x8_put[1] = simple_idct_put_rangered;
 
365
        v->vc1dsp.vc1_inv_trans_8x8_put_signed[0] = simple_idct_put_signed;
 
366
        v->vc1dsp.vc1_inv_trans_8x8_put_signed[1] = simple_idct_put_signed_rangered;
 
367
        v->vc1dsp.vc1_inv_trans_8x4 = ff_simple_idct84_add;
 
368
        v->vc1dsp.vc1_inv_trans_4x8 = ff_simple_idct48_add;
 
369
        v->vc1dsp.vc1_inv_trans_4x4 = ff_simple_idct44_add;
 
370
        v->vc1dsp.vc1_inv_trans_8x8_dc = ff_simple_idct_add;
 
371
        v->vc1dsp.vc1_inv_trans_8x4_dc = ff_simple_idct84_add;
 
372
        v->vc1dsp.vc1_inv_trans_4x8_dc = ff_simple_idct48_add;
 
373
        v->vc1dsp.vc1_inv_trans_4x4_dc = ff_simple_idct44_add;
344
374
    }
345
375
 
346
376
    v->fastuvmc =  get_bits1(gb); //common
382
412
    v->quantizer_mode = get_bits(gb, 2); //common
383
413
 
384
414
    v->finterpflag = get_bits1(gb); //common
385
 
    v->res_rtm_flag = get_bits1(gb); //reserved
 
415
 
 
416
    if (v->res_sprite) {
 
417
        v->s.avctx->width  = v->s.avctx->coded_width  = get_bits(gb, 11);
 
418
        v->s.avctx->height = v->s.avctx->coded_height = get_bits(gb, 11);
 
419
        skip_bits(gb, 5); //frame rate
 
420
        v->res_x8 = get_bits1(gb);
 
421
        if (get_bits1(gb)) { // something to do with DC VLC selection
 
422
            av_log(avctx, AV_LOG_ERROR, "Unsupported sprite feature\n");
 
423
            return -1;
 
424
        }
 
425
        skip_bits(gb, 3); //slice code
 
426
        v->res_rtm_flag = 0;
 
427
    } else {
 
428
        v->res_rtm_flag = get_bits1(gb); //reserved
 
429
    }
386
430
    if (!v->res_rtm_flag)
387
431
    {
388
432
//            av_log(avctx, AV_LOG_ERROR,
389
433
//                   "0 for reserved RES_RTM_FLAG is forbidden\n");
390
434
        av_log(avctx, AV_LOG_ERROR,
391
 
               "Old WMV3 version detected, only I-frames will be decoded\n");
 
435
               "Old WMV3 version detected, some frames may be decoded incorrectly\n");
392
436
        //return -1;
393
437
    }
394
438
    //TODO: figure out what they mean (always 0x402F)
816
860
        }
817
861
    }
818
862
    if(v->panscanflag) {
 
863
        av_log_missing_feature(v->s.avctx, "Pan-scan", 0);
819
864
        //...
820
865
    }
821
866
    v->rnd = get_bits1(gb);