00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "libavutil/attributes.h"
00022 #include "wma_common.h"
00023
00031 av_cold int ff_wma_get_frame_len_bits(int sample_rate, int version,
00032 unsigned int decode_flags)
00033 {
00034
00035 int frame_len_bits;
00036
00037 if (sample_rate <= 16000) {
00038 frame_len_bits = 9;
00039 } else if (sample_rate <= 22050 ||
00040 (sample_rate <= 32000 && version == 1)) {
00041 frame_len_bits = 10;
00042 } else if (sample_rate <= 48000 || version < 3) {
00043 frame_len_bits = 11;
00044 } else if (sample_rate <= 96000) {
00045 frame_len_bits = 12;
00046 } else {
00047 frame_len_bits = 13;
00048 }
00049
00050 if (version == 3) {
00051 int tmp = decode_flags & 0x6;
00052 if (tmp == 0x2) {
00053 ++frame_len_bits;
00054 } else if (tmp == 0x4) {
00055 --frame_len_bits;
00056 } else if (tmp == 0x6) {
00057 frame_len_bits -= 2;
00058 }
00059 }
00060
00061 return frame_len_bits;
00062 }