de6d9b64 |
/* |
08aa2c9b |
* MPEG Audio common code |
406792e7 |
* Copyright (c) 2001, 2002 Fabrice Bellard |
de6d9b64 |
* |
b78e7197 |
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or |
ff4ec49e |
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either |
b78e7197 |
* version 2.1 of the License, or (at your option) any later version. |
de6d9b64 |
* |
b78e7197 |
* FFmpeg is distributed in the hope that it will be useful, |
de6d9b64 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
ff4ec49e |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. |
de6d9b64 |
* |
ff4ec49e |
* You should have received a copy of the GNU Lesser General Public |
b78e7197 |
* License along with FFmpeg; if not, write to the Free Software |
5509bffa |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
de6d9b64 |
*/ |
115329f1 |
|
983e3246 |
/** |
ba87f080 |
* @file |
08aa2c9b |
* MPEG Audio common code. |
983e3246 |
*/ |
115329f1 |
|
de6d9b64 |
#include "mpegaudio.h"
|
2456e28d |
|
08aa2c9b |
/* bitrate is in kb/s */
int ff_mpa_l2_select_table(int bitrate, int nb_channels, int freq, int lsf) |
de6d9b64 |
{ |
08aa2c9b |
int ch_bitrate, table; |
de6d9b64 |
|
08aa2c9b |
ch_bitrate = bitrate / nb_channels;
if (!lsf) {
if ((freq == 48000 && ch_bitrate >= 56) ||
(ch_bitrate >= 56 && ch_bitrate <= 80))
table = 0;
else if (freq != 48000 && ch_bitrate >= 96)
table = 1;
else if (freq != 32000 && ch_bitrate <= 48)
table = 2; |
de6d9b64 |
else |
08aa2c9b |
table = 3; |
de6d9b64 |
} else { |
08aa2c9b |
table = 4; |
de6d9b64 |
} |
08aa2c9b |
return table; |
492cd3a9 |
} |