annotate bfin/vp3_bfin.c @ 12391:4be72e19ab0e libavcodec

imc: fix undefined float to int conversion Conversion of an out of range float to int is undefined. Clipping to the final range first avoids such problems. This fixes decoding on MIPS, which handles these conversions differently from many other CPUs.
author mru
date Thu, 19 Aug 2010 16:51:26 +0000
parents 43e39953f4f9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5776
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
1 /*
5777
95916a621536 license header consistency cosmetics.
diego
parents: 5776
diff changeset
2 * Copyright (C) 2007 Marc Hoffman <marc.hoffman@analog.com>
95916a621536 license header consistency cosmetics.
diego
parents: 5776
diff changeset
3 *
5776
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
4 * This file is part of FFmpeg.
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
5 *
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
10 *
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
14 * Lesser General Public License for more details.
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
15 *
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
19 */
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
20
6763
f7cbb7733146 Use full path for #includes from another directory.
diego
parents: 5777
diff changeset
21 #include "libavcodec/avcodec.h"
f7cbb7733146 Use full path for #includes from another directory.
diego
parents: 5777
diff changeset
22 #include "libavcodec/dsputil.h"
5776
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
23 #include "dsputil_bfin.h"
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
24
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
25 /* Intra iDCT offset 128 */
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
26 void ff_bfin_vp3_idct_put (uint8_t *dest, int line_size, DCTELEM *block)
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
27 {
11926
43e39953f4f9 Improve some uses of ff_cropTbl with constant offset
mru
parents: 11398
diff changeset
28 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP + 128;
5776
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
29 int i,j;
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
30
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
31 ff_bfin_vp3_idct (block);
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
32
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
33 for (i=0;i<8;i++)
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
34 for (j=0;j<8;j++)
11926
43e39953f4f9 Improve some uses of ff_cropTbl with constant offset
mru
parents: 11398
diff changeset
35 dest[line_size*i+j]=cm[block[i*8+j]];
5776
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
36 }
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
37
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
38 /* Inter iDCT */
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
39 void ff_bfin_vp3_idct_add (uint8_t *dest, int line_size, DCTELEM *block)
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
40 {
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
41 ff_bfin_vp3_idct (block);
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
42 ff_bfin_add_pixels_clamped (block, dest, line_size);
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
43 }
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
44
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff changeset
45