summaryrefslogtreecommitdiff
path: root/apps/codecs/libffmpegFLAC/bitstream.c
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2010-07-15 16:19:17 +0000
committerNils Wallménius <nils@rockbox.org>2010-07-15 16:19:17 +0000
commita87c61854ef614b258ca7d4d0b40db017884e63e (patch)
tree4f0129350a8a2d25ee5e5d218aa787ae2dbbeca3 /apps/codecs/libffmpegFLAC/bitstream.c
parent328f2f9c285dd9ccec4ddabe4d64a508b0e498fa (diff)
downloadrockbox-a87c61854ef614b258ca7d4d0b40db017884e63e.tar.gz
rockbox-a87c61854ef614b258ca7d4d0b40db017884e63e.zip
Sync codeclib bitstream code with upstream ffmpeg code. Build ffmpeg_bitstream.c as a part of the codec lib. Use this codeclib implementation in libffmpegFLAC. Implement adapted version of the unaligned longword reading optimization for coldfire from the libwma version of this code. Speeds up cook decoding by 2-3% on h300 and flac by 25% on h300, also speeds up flac decoding by 2% on c200 (decoding speed of cook on c200 is unchanged).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27430 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libffmpegFLAC/bitstream.c')
-rw-r--r--apps/codecs/libffmpegFLAC/bitstream.c62
1 files changed, 0 insertions, 62 deletions
diff --git a/apps/codecs/libffmpegFLAC/bitstream.c b/apps/codecs/libffmpegFLAC/bitstream.c
deleted file mode 100644
index e53ec0fd46..0000000000
--- a/apps/codecs/libffmpegFLAC/bitstream.c
+++ /dev/null
@@ -1,62 +0,0 @@
1/*
2 * Common bit i/o utils
3 * Copyright (c) 2000, 2001 Fabrice Bellard.
4 * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * alternative bitstream reader & writer by Michael Niedermayer <michaelni@gmx.at>
21 */
22
23/**
24 * @file bitstream.c
25 * bitstream api.
26 */
27
28#include <stdio.h>
29#include "bitstream.h"
30
31/* bit input functions */
32
33/**
34 * reads 0-32 bits.
35 */
36unsigned int get_bits_long(GetBitContext *s, int n){
37 if(n<=17) return get_bits(s, n);
38 else{
39 int ret= get_bits(s, 16) << (n-16);
40 return ret | get_bits(s, n-16);
41 }
42}
43
44/**
45 * shows 0-32 bits.
46 */
47unsigned int show_bits_long(GetBitContext *s, int n){
48 if(n<=17) return show_bits(s, n);
49 else{
50 GetBitContext gb= *s;
51 int ret= get_bits_long(s, n);
52 *s= gb;
53 return ret;
54 }
55}
56
57void align_get_bits(GetBitContext *s)
58{
59 int n= (-get_bits_count(s)) & 7;
60 if(n) skip_bits(s, n);
61}
62