~ubuntu-branches/ubuntu/utopic/ffmpeg-debian/utopic

« back to all changes in this revision

Viewing changes to libavcodec/mpegvideo.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2009-01-20 09:20:53 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090120092053-izz63p40hc98qfgp
Tags: 3:0.svn20090119-1ubuntu1
* merge from debian. LP: #318501
* new version fixes CVE-2008-3230, LP: #253767

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
static void dct_unquantize_h263_inter_c(MpegEncContext *s,
55
55
                                  DCTELEM *block, int n, int qscale);
56
56
 
57
 
extern int  XVMC_field_start(MpegEncContext*s, AVCodecContext *avctx);
58
 
extern void XVMC_field_end(MpegEncContext *s);
59
 
extern void XVMC_decode_mb(MpegEncContext *s);
 
57
int  XVMC_field_start(MpegEncContext*s, AVCodecContext *avctx);
 
58
void XVMC_field_end(MpegEncContext *s);
 
59
void XVMC_decode_mb(MpegEncContext *s);
60
60
 
61
61
 
62
62
/* enable all paranoid tests for rounding, overflows, etc... */
121
121
        s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_bitexact;
122
122
    s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_c;
123
123
 
124
 
#if defined(HAVE_MMX)
 
124
#if   HAVE_MMX
125
125
    MPV_common_init_mmx(s);
126
 
#elif defined(ARCH_ALPHA)
 
126
#elif ARCH_ALPHA
127
127
    MPV_common_init_axp(s);
128
 
#elif defined(CONFIG_MLIB)
 
128
#elif CONFIG_MLIB
129
129
    MPV_common_init_mlib(s);
130
 
#elif defined(HAVE_MMI)
 
130
#elif HAVE_MMI
131
131
    MPV_common_init_mmi(s);
132
 
#elif defined(ARCH_ARMV4L)
133
 
    MPV_common_init_armv4l(s);
134
 
#elif defined(HAVE_ALTIVEC)
 
132
#elif ARCH_ARM
 
133
    MPV_common_init_arm(s);
 
134
#elif HAVE_ALTIVEC
135
135
    MPV_common_init_altivec(s);
136
 
#elif defined(ARCH_BFIN)
 
136
#elif ARCH_BFIN
137
137
    MPV_common_init_bfin(s);
138
138
#endif
139
139
 
289
289
 
290
290
     //FIXME should be linesize instead of s->width*2 but that is not known before get_buffer()
291
291
    CHECKED_ALLOCZ(s->me.scratchpad,  (s->width+64)*4*16*2*sizeof(uint8_t))
 
292
    s->me.temp=         s->me.scratchpad;
292
293
    s->rd_scratchpad=   s->me.scratchpad;
293
294
    s->b_scratchpad=    s->me.scratchpad;
294
295
    s->obmc_scratchpad= s->me.scratchpad + 16;
315
316
 
316
317
    av_freep(&s->allocated_edge_emu_buffer); s->edge_emu_buffer= NULL;
317
318
    av_freep(&s->me.scratchpad);
 
319
    s->me.temp=
318
320
    s->rd_scratchpad=
319
321
    s->b_scratchpad=
320
322
    s->obmc_scratchpad= NULL;
331
333
    COPY(allocated_edge_emu_buffer);
332
334
    COPY(edge_emu_buffer);
333
335
    COPY(me.scratchpad);
 
336
    COPY(me.temp);
334
337
    COPY(rd_scratchpad);
335
338
    COPY(b_scratchpad);
336
339
    COPY(obmc_scratchpad);
936
939
        update_noise_reduction(s);
937
940
    }
938
941
 
939
 
#ifdef HAVE_XVMC
 
942
#if CONFIG_XVMC
940
943
    if(s->avctx->xvmc_acceleration)
941
944
        return XVMC_field_start(s, avctx);
942
945
#endif
948
951
{
949
952
    int i;
950
953
    /* draw edge for correct motion prediction if outside */
951
 
#ifdef HAVE_XVMC
 
954
#if CONFIG_XVMC
952
955
//just to make sure that all data is rendered.
953
956
    if(s->avctx->xvmc_acceleration){
954
957
        XVMC_field_end(s);
955
958
    }else
956
959
#endif
957
 
    if(s->unrestricted_mv && s->current_picture.reference && !s->intra_only && !(s->flags&CODEC_FLAG_EMU_EDGE)) {
 
960
    if(!(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
 
961
       && s->unrestricted_mv
 
962
       && s->current_picture.reference
 
963
       && !s->intra_only
 
964
       && !(s->flags&CODEC_FLAG_EMU_EDGE)) {
958
965
            s->dsp.draw_edges(s->current_picture.data[0], s->linesize  , s->h_edge_pos   , s->v_edge_pos   , EDGE_WIDTH  );
959
966
            s->dsp.draw_edges(s->current_picture.data[1], s->uvlinesize, s->h_edge_pos>>1, s->v_edge_pos>>1, EDGE_WIDTH/2);
960
967
            s->dsp.draw_edges(s->current_picture.data[2], s->uvlinesize, s->h_edge_pos>>1, s->v_edge_pos>>1, EDGE_WIDTH/2);
1441
1448
            ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based,
1442
1449
                             src_x, src_y<<field_based, h_edge_pos, v_edge_pos);
1443
1450
            ptr_y = s->edge_emu_buffer;
1444
 
            if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
 
1451
            if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
1445
1452
                uint8_t *uvbuf= s->edge_emu_buffer+18*s->linesize;
1446
1453
                ff_emulated_edge_mc(uvbuf  , ptr_cb, s->uvlinesize, 9, 9+field_based,
1447
1454
                                 uvsrc_x, uvsrc_y<<field_based, h_edge_pos>>1, v_edge_pos>>1);
1468
1475
    sy <<= 2 - lowres;
1469
1476
    pix_op[lowres-1](dest_y, ptr_y, linesize, h, sx, sy);
1470
1477
 
1471
 
    if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
 
1478
    if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
1472
1479
        uvsx <<= 2 - lowres;
1473
1480
        uvsy <<= 2 - lowres;
1474
1481
        pix_op[lowres](dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy);
1574
1581
                my += s->mv[dir][i][1];
1575
1582
            }
1576
1583
 
1577
 
        if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY))
 
1584
        if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY))
1578
1585
            chroma_4mv_motion_lowres(s, dest_cb, dest_cr, ref_picture, pix_op, mx, my);
1579
1586
        break;
1580
1587
    case MV_TYPE_FIELD:
1729
1736
{
1730
1737
    int mb_x, mb_y;
1731
1738
    const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;
1732
 
#ifdef HAVE_XVMC
 
1739
#if CONFIG_XVMC
1733
1740
    if(s->avctx->xvmc_acceleration){
1734
1741
        XVMC_decode_mb(s);//xvmc uses pblocks
1735
1742
        return;
1863
1870
                add_dequant_dct(s, block[2], 2, dest_y + dct_offset             , dct_linesize, s->qscale);
1864
1871
                add_dequant_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale);
1865
1872
 
1866
 
                if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
 
1873
                if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
1867
1874
                    if (s->chroma_y_shift){
1868
1875
                        add_dequant_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale);
1869
1876
                        add_dequant_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale);
1882
1889
                add_dct(s, block[2], 2, dest_y + dct_offset             , dct_linesize);
1883
1890
                add_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize);
1884
1891
 
1885
 
                if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
 
1892
                if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
1886
1893
                    if(s->chroma_y_shift){//Chroma420
1887
1894
                        add_dct(s, block[4], 4, dest_cb, uvlinesize);
1888
1895
                        add_dct(s, block[5], 5, dest_cr, uvlinesize);
1904
1911
                    }
1905
1912
                }//fi gray
1906
1913
            }
1907
 
            else if (ENABLE_WMV2) {
 
1914
            else if (CONFIG_WMV2) {
1908
1915
                ff_wmv2_add_mb(s, block, dest_y, dest_cb, dest_cr);
1909
1916
            }
1910
1917
        } else {
1915
1922
                put_dct(s, block[2], 2, dest_y + dct_offset             , dct_linesize, s->qscale);
1916
1923
                put_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale);
1917
1924
 
1918
 
                if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
 
1925
                if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
1919
1926
                    if(s->chroma_y_shift){
1920
1927
                        put_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale);
1921
1928
                        put_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale);
1934
1941
                s->dsp.idct_put(dest_y + dct_offset             , dct_linesize, block[2]);
1935
1942
                s->dsp.idct_put(dest_y + dct_offset + block_size, dct_linesize, block[3]);
1936
1943
 
1937
 
                if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
 
1944
                if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
1938
1945
                    if(s->chroma_y_shift){
1939
1946
                        s->dsp.idct_put(dest_cb, uvlinesize, block[4]);
1940
1947
                        s->dsp.idct_put(dest_cr, uvlinesize, block[5]);
1967
1974
}
1968
1975
 
1969
1976
void MPV_decode_mb(MpegEncContext *s, DCTELEM block[12][64]){
1970
 
#ifndef CONFIG_SMALL
 
1977
#if !CONFIG_SMALL
1971
1978
    if(s->out_format == FMT_MPEG1) {
1972
1979
        if(s->avctx->lowres) MPV_decode_mb_internal(s, block, 1, 1);
1973
1980
        else                 MPV_decode_mb_internal(s, block, 0, 1);