⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bits.h

📁 MPEG-4编解码的实现(包括MPEG4视音频编解码)
💻 H
字号:
/*
 * FAAD - Freeware Advanced Audio Decoder
 * Copyright (C) 2001 Menno Bakker
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * $Id: bits.h,v 1.7 2002/07/01 20:44:18 wmay Exp $
 */

#ifndef __BITS_H__
#define __BITS_H__ 1
#include "all.h"
#ifdef __cplusplus
extern "C" {
#endif

typedef struct _bitfile2
{
	/* bit input */
  unsigned char *buffer;
  unsigned char *rdptr;
    int m_alignment_offset;
  int incnt;
  int bitcnt;
  int framebits;
  int maxbits;
} bitfile;

void faad_initbits(bitfile *ld, char *buffer, uint32_t buflen);
uint32_t faad_getbits(bitfile *ld, int n);
uint32_t faad_getbits_fast(bitfile *ld, int n);
uint32_t faad_get1bit(bitfile *ld);
uint32_t faad_byte_align(bitfile *ld);
int faad_get_processed_bits(bitfile *ld);
  int faad_bits_done(bitfile *ld);

  void faad_bitdump(bitfile *ld);

extern unsigned int faad_bit_msk[33];

#define _SWAP(a) ((a[0] << 24) | (a[1] << 16) | (a[2] << 8) | a[3])

static __inline uint32_t faad_showbits(bitfile *ld, int n)
{
        unsigned char *v;
	int rbit = 32 - ld->bitcnt;
	uint32_t b;

	v = ld->rdptr;
	b = _SWAP(v);
	return ((b & faad_bit_msk[rbit]) >> (rbit-n));
}

static __inline void faad_flushbits(bitfile *ld, int n)
{
	ld->bitcnt += n;

	if (ld->bitcnt >= 8) {
		ld->rdptr += (ld->bitcnt>>3);
		ld->bitcnt &= 7;
	}

	ld->framebits += n;
}

#ifdef __cplusplus
}
#endif
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -