Mercurial > libavcodec.hg
annotate bfin/vp3_bfin.c @ 12494:94eaea836bf4 libavcodec
Check avctx width/height more thoroughly (e.g. all values 0 except width would
have been accepted before).
Also do not fail if they are invalid but instead override them to 0.
This allows decoding e.g. MPEG video when only the container values are corrupted.
For encoding a value of 0,0 of course makes no sense, but was allowed
through before and will be caught by an extra check in the encode function.
author | reimar |
---|---|
date | Wed, 15 Sep 2010 04:46:55 +0000 |
parents | 43e39953f4f9 |
children |
rev | line source |
---|---|
5776
73ec16dbcbc1
blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents:
diff
changeset
|
1 /* |
5777 | 2 * Copyright (C) 2007 Marc Hoffman <marc.hoffman@analog.com> |
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 | 21 #include "libavcodec/avcodec.h" |
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 | 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 | 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 |