Mercurial > libavcodec.hg
annotate flac.c @ 10324:5bbe55451800 libavcodec
When BitsPerSample tag is not present in TIFF, that means file is
monochrome, so initialize picture before decoding.
This fixes decoding monochrome files produced by lavc TIFF encoder.
author | kostya |
---|---|
date | Wed, 30 Sep 2009 05:49:18 +0000 |
parents | 64246d9e583a |
children |
rev | line source |
---|---|
9216
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
1 /* |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
2 * FLAC common code |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
3 * Copyright (c) 2009 Justin Ruggles |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
4 * |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
5 * This file is part of FFmpeg. |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
6 * |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
9 * License as published by the Free Software Foundation; either |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
11 * |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
15 * Lesser General Public License for more details. |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
16 * |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
20 */ |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
21 |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
22 #include "flac.h" |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
23 |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
24 int ff_flac_get_max_frame_size(int blocksize, int ch, int bps) |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
25 { |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
26 /* Technically, there is no limit to FLAC frame size, but an encoder |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
27 should not write a frame that is larger than if verbatim encoding mode |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
28 were to be used. */ |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
29 |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
30 int count; |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
31 |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
32 count = 16; /* frame header */ |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
33 count += ch * ((7+bps+7)/8); /* subframe headers */ |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
34 if (ch == 2) { |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
35 /* for stereo, need to account for using decorrelation */ |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
36 count += (( 2*bps+1) * blocksize + 7) / 8; |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
37 } else { |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
38 count += ( ch*bps * blocksize + 7) / 8; |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
39 } |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
40 count += 2; /* frame footer */ |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
41 |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
42 return count; |
64246d9e583a
add a function to calculate a more accurate estimate for maximum FLAC
jbr
parents:
diff
changeset
|
43 } |