本文整理汇总了C++中skip_bits_long函数的典型用法代码示例。如果您正苦于以下问题:C++ skip_bits_long函数的具体用法?C++ skip_bits_long怎么用?C++ skip_bits_long使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了skip_bits_long函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ff_flac_parse_streaminfo
void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
const uint8_t *buffer)
{
GetBitContext gb;
init_get_bits(&gb, buffer, FLAC_STREAMINFO_SIZE*8);
skip_bits(&gb, 16); /* skip min blocksize */
s->max_blocksize = get_bits(&gb, 16);
if (s->max_blocksize < FLAC_MIN_BLOCKSIZE) {
av_log(avctx, AV_LOG_WARNING, "invalid max blocksize: %d\n",
s->max_blocksize);
s->max_blocksize = 16;
}
skip_bits(&gb, 24); /* skip min frame size */
s->max_framesize = get_bits_long(&gb, 24);
s->samplerate = get_bits_long(&gb, 20);
s->channels = get_bits(&gb, 3) + 1;
s->bps = get_bits(&gb, 5) + 1;
avctx->channels = s->channels;
avctx->sample_rate = s->samplerate;
avctx->bits_per_raw_sample = s->bps;
s->samples = get_bits_long(&gb, 32) << 4;
s->samples |= get_bits(&gb, 4);
skip_bits_long(&gb, 64); /* md5 sum */
skip_bits_long(&gb, 64); /* md5 sum */
dump_headers(avctx, s);
}
示例2: flac_header
static int
flac_header (AVFormatContext *s, int idx)
{
struct ogg *ogg = s->priv_data;
struct ogg_stream *os = ogg->streams + idx;
AVStream *st = s->streams[idx];
GetBitContext gb;
FLACStreaminfo si;
int mdt;
if (os->buf[os->pstart] == 0xff)
return 0;
init_get_bits(&gb, os->buf + os->pstart, os->psize * 8);
skip_bits1(&gb); /* metadata_last */
mdt = get_bits(&gb, 7);
if (mdt == OGG_FLAC_METADATA_TYPE_STREAMINFO)
{
uint8_t *streaminfo_start = os->buf + os->pstart + 5 + 4 + 4 + 4;
skip_bits_long(&gb, 4 * 8); /* "FLAC" */
if(get_bits(&gb, 8) != 1) /* unsupported major version */
return -1;
skip_bits_long(&gb, 8 + 16); /* minor version + header count */
skip_bits_long(&gb, 4 * 8); /* "fLaC" */
/* METADATA_BLOCK_HEADER */
if (get_bits_long(&gb, 32) != FLAC_STREAMINFO_SIZE)
return -1;
ff_flac_parse_streaminfo(st->codec, &si, streaminfo_start);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_FLAC;
st->codec->extradata =
av_malloc(FLAC_STREAMINFO_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
memcpy(st->codec->extradata, streaminfo_start, FLAC_STREAMINFO_SIZE);
st->codec->extradata_size = FLAC_STREAMINFO_SIZE;
av_set_pts_info(st, 64, 1, st->codec->sample_rate);
}
else if (mdt == FLAC_METADATA_TYPE_VORBIS_COMMENT)
{
ff_vorbis_comment (s, &st->metadata, os->buf + os->pstart + 4, os->psize - 4);
}
return 1;
}
示例3: decode_nal_sei_prefix
static int decode_nal_sei_prefix(GetBitContext *gb, void *logctx, HEVCSEI *s,
const HEVCParamSets *ps, int type, int size)
{
switch (type) {
case 256: // Mismatched value from HM 8.1
return decode_nal_sei_decoded_picture_hash(&s->picture_hash, gb);
case HEVC_SEI_TYPE_FRAME_PACKING:
return decode_nal_sei_frame_packing_arrangement(&s->frame_packing, gb);
case HEVC_SEI_TYPE_DISPLAY_ORIENTATION:
return decode_nal_sei_display_orientation(&s->display_orientation, gb);
case HEVC_SEI_TYPE_PICTURE_TIMING:
return decode_nal_sei_pic_timing(s, gb, ps, logctx, size);
case HEVC_SEI_TYPE_MASTERING_DISPLAY_INFO:
return decode_nal_sei_mastering_display_info(&s->mastering_display, gb);
case HEVC_SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO:
return decode_nal_sei_content_light_info(&s->content_light, gb);
case HEVC_SEI_TYPE_ACTIVE_PARAMETER_SETS:
return decode_nal_sei_active_parameter_sets(s, gb, logctx);
case HEVC_SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35:
return decode_nal_sei_user_data_registered_itu_t_t35(s, gb, size);
case HEVC_SEI_TYPE_ALTERNATIVE_TRANSFER_CHARACTERISTICS:
return decode_nal_sei_alternative_transfer(&s->alternative_transfer, gb);
default:
av_log(logctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", type);
skip_bits_long(gb, 8 * size);
return 0;
}
}
示例4: decode_nal_sei_pic_timing
static int decode_nal_sei_pic_timing(HEVCSEI *s, GetBitContext *gb, const HEVCParamSets *ps,
void *logctx, int size)
{
HEVCSEIPictureTiming *h = &s->picture_timing;
HEVCSPS *sps;
if (!ps->sps_list[s->active_seq_parameter_set_id])
return(AVERROR(ENOMEM));
sps = (HEVCSPS*)ps->sps_list[s->active_seq_parameter_set_id]->data;
if (sps->vui.frame_field_info_present_flag) {
int pic_struct = get_bits(gb, 4);
h->picture_struct = AV_PICTURE_STRUCTURE_UNKNOWN;
if (pic_struct == 2 || pic_struct == 10 || pic_struct == 12) {
av_log(logctx, AV_LOG_DEBUG, "BOTTOM Field\n");
h->picture_struct = AV_PICTURE_STRUCTURE_BOTTOM_FIELD;
} else if (pic_struct == 1 || pic_struct == 9 || pic_struct == 11) {
av_log(logctx, AV_LOG_DEBUG, "TOP Field\n");
h->picture_struct = AV_PICTURE_STRUCTURE_TOP_FIELD;
}
get_bits(gb, 2); // source_scan_type
get_bits(gb, 1); // duplicate_flag
skip_bits1(gb);
size--;
}
skip_bits_long(gb, 8 * size);
return 0;
}
示例5: decode_pic_timing
static int decode_pic_timing(HEVCContext *s, int size)
{
GetBitContext *gb = &s->HEVClc->gb;
HEVCSPS *sps;
if (!s->ps.sps_list[s->active_seq_parameter_set_id])
return(AVERROR(ENOMEM));
sps = (HEVCSPS*)s->ps.sps_list[s->active_seq_parameter_set_id]->data;
if (sps->vui.frame_field_info_present_flag) {
int pic_struct = get_bits(gb, 4);
s->picture_struct = AV_PICTURE_STRUCTURE_UNKNOWN;
if (pic_struct == 2) {
av_log(s->avctx, AV_LOG_DEBUG, "BOTTOM Field\n");
s->picture_struct = AV_PICTURE_STRUCTURE_BOTTOM_FIELD;
} else if (pic_struct == 1) {
av_log(s->avctx, AV_LOG_DEBUG, "TOP Field\n");
s->picture_struct = AV_PICTURE_STRUCTURE_TOP_FIELD;
}
get_bits(gb, 2); // source_scan_type
get_bits(gb, 1); // duplicate_flag
skip_bits1(gb);
size--;
}
skip_bits_long(gb, 8 * size);
return 0;
}
示例6: decode_nal_sei_prefix
static int decode_nal_sei_prefix(HEVCContext *s, int type, int size)
{
GetBitContext *gb = &s->HEVClc->gb;
switch (type) {
case 256: // Mismatched value from HM 8.1
return decode_nal_sei_decoded_picture_hash(s);
case SEI_TYPE_FRAME_PACKING:
return decode_nal_sei_frame_packing_arrangement(s);
case SEI_TYPE_DISPLAY_ORIENTATION:
return decode_nal_sei_display_orientation(s);
case SEI_TYPE_PICTURE_TIMING:
{
int ret = decode_pic_timing(s);
av_log(s->avctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", type);
skip_bits(gb, 8 * size);
return ret;
}
case SEI_TYPE_ACTIVE_PARAMETER_SETS:
active_parameter_sets(s);
av_log(s->avctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", type);
return 0;
case SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35:
return decode_nal_sei_user_data_registered_itu_t_t35(s, size);
default:
av_log(s->avctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", type);
skip_bits_long(gb, 8 * size);
return 0;
}
}
示例7: decode_nal_sei_user_data_registered_itu_t_t35
static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCContext *s, int size)
{
uint32_t country_code;
uint32_t user_identifier;
GetBitContext *gb = &s->HEVClc->gb;
if (size < 7)
return AVERROR(EINVAL);
size -= 7;
country_code = get_bits(gb, 8);
if (country_code == 0xFF) {
skip_bits(gb, 8);
size--;
}
skip_bits(gb, 8);
skip_bits(gb, 8);
user_identifier = get_bits_long(gb, 32);
switch (user_identifier) {
case MKBETAG('G', 'A', '9', '4'):
return decode_registered_user_data_closed_caption(s, size);
default:
skip_bits_long(gb, size * 8);
break;
}
return 0;
}
示例8: dca_parse_params
static int dca_parse_params(const uint8_t *buf, int buf_size, int *duration,
int *sample_rate, int *framesize)
{
GetBitContext gb;
uint8_t hdr[12 + AV_INPUT_BUFFER_PADDING_SIZE] = { 0 };
int ret, sample_blocks, sr_code;
if (buf_size < 12)
return AVERROR_INVALIDDATA;
if ((ret = avpriv_dca_convert_bitstream(buf, 12, hdr, 12)) < 0)
return ret;
init_get_bits(&gb, hdr, 96);
skip_bits_long(&gb, 39);
sample_blocks = get_bits(&gb, 7) + 1;
if (sample_blocks < 8)
return AVERROR_INVALIDDATA;
*duration = 256 * (sample_blocks / 8);
*framesize = get_bits(&gb, 14) + 1;
if (*framesize < 95)
return AVERROR_INVALIDDATA;
skip_bits(&gb, 6);
sr_code = get_bits(&gb, 4);
*sample_rate = avpriv_dca_sample_rates[sr_code];
if (*sample_rate == 0)
return AVERROR_INVALIDDATA;
return 0;
}
示例9: latm_decode_audio_specific_config
static int latm_decode_audio_specific_config(struct LATMContext *latmctx,
GetBitContext *gb, int asclen)
{
AACContext *ac = &latmctx->aac_ctx;
AVCodecContext *avctx = ac->avctx;
MPEG4AudioConfig m4ac = { 0 };
int config_start_bit = get_bits_count(gb);
int sync_extension = 0;
int bits_consumed, esize;
if (asclen) {
sync_extension = 1;
asclen = FFMIN(asclen, get_bits_left(gb));
} else
asclen = get_bits_left(gb);
if (config_start_bit % 8) {
avpriv_request_sample(latmctx->aac_ctx.avctx,
"Non-byte-aligned audio-specific config");
return AVERROR_PATCHWELCOME;
}
if (asclen <= 0)
return AVERROR_INVALIDDATA;
bits_consumed = decode_audio_specific_config(NULL, avctx, &m4ac,
gb->buffer + (config_start_bit / 8),
asclen, sync_extension);
if (bits_consumed < 0)
return AVERROR_INVALIDDATA;
if (!latmctx->initialized ||
ac->oc[1].m4ac.sample_rate != m4ac.sample_rate ||
ac->oc[1].m4ac.chan_config != m4ac.chan_config) {
if(latmctx->initialized) {
av_log(avctx, AV_LOG_INFO, "audio config changed\n");
} else {
av_log(avctx, AV_LOG_DEBUG, "initializing latmctx\n");
}
latmctx->initialized = 0;
esize = (bits_consumed+7) / 8;
if (avctx->extradata_size < esize) {
av_free(avctx->extradata);
avctx->extradata = av_malloc(esize + AV_INPUT_BUFFER_PADDING_SIZE);
if (!avctx->extradata)
return AVERROR(ENOMEM);
}
avctx->extradata_size = esize;
memcpy(avctx->extradata, gb->buffer + (config_start_bit/8), esize);
memset(avctx->extradata+esize, 0, AV_INPUT_BUFFER_PADDING_SIZE);
}
skip_bits_long(gb, bits_consumed);
return bits_consumed;
}
示例10: dca_exss_skip_mix_coeffs
/**
* Skip mixing coefficients of a single mix out configuration (HD)
*/
static void dca_exss_skip_mix_coeffs(GetBitContext *gb, int channels, int out_ch)
{
int i;
for (i = 0; i < channels; i++) {
int mix_map_mask = get_bits(gb, out_ch);
int num_coeffs = av_popcount(mix_map_mask);
skip_bits_long(gb, num_coeffs * 6);
}
}
示例11: nelly_decode_block
static void nelly_decode_block(NellyMoserDecodeContext *s,
const unsigned char block[NELLY_BLOCK_LEN],
float audio[NELLY_SAMPLES])
{
int i,j;
float buf[NELLY_FILL_LEN], pows[NELLY_FILL_LEN];
float *aptr, *bptr, *pptr, val, pval;
int bits[NELLY_BUF_LEN];
unsigned char v;
init_get_bits(&s->gb, block, NELLY_BLOCK_LEN * 8);
bptr = buf;
pptr = pows;
val = ff_nelly_init_table[get_bits(&s->gb, 6)];
for (i=0 ; i<NELLY_BANDS ; i++) {
if (i > 0)
val += ff_nelly_delta_table[get_bits(&s->gb, 5)];
pval = -pow(2, val/2048) * s->scale_bias;
for (j = 0; j < ff_nelly_band_sizes_table[i]; j++) {
*bptr++ = val;
*pptr++ = pval;
}
}
ff_nelly_get_sample_bits(buf, bits);
for (i = 0; i < 2; i++) {
aptr = audio + i * NELLY_BUF_LEN;
init_get_bits(&s->gb, block, NELLY_BLOCK_LEN * 8);
skip_bits_long(&s->gb, NELLY_HEADER_BITS + i*NELLY_DETAIL_BITS);
for (j = 0; j < NELLY_FILL_LEN; j++) {
if (bits[j] <= 0) {
aptr[j] = M_SQRT1_2*pows[j];
if (av_lfg_get(&s->random_state) & 1)
aptr[j] *= -1.0;
} else {
v = get_bits(&s->gb, bits[j]);
aptr[j] = ff_nelly_dequantization_table[(1<<bits[j])-1+v]*pows[j];
}
}
memset(&aptr[NELLY_FILL_LEN], 0,
(NELLY_BUF_LEN - NELLY_FILL_LEN) * sizeof(float));
s->imdct_ctx.imdct_calc(&s->imdct_ctx, s->imdct_out, aptr);
/* XXX: overlapping and windowing should be part of a more
generic imdct function */
s->dsp.vector_fmul_reverse(s->state, s->state, ff_sine_128, NELLY_BUF_LEN);
s->dsp.vector_fmul_add(aptr, s->imdct_out, ff_sine_128, s->state, NELLY_BUF_LEN);
memcpy(s->state, s->imdct_out + NELLY_BUF_LEN, sizeof(float)*NELLY_BUF_LEN);
}
}
示例12: decode_nal_sei_suffix
static int decode_nal_sei_suffix(GetBitContext *gb, void *logctx, HEVCSEI *s,
int type, int size)
{
switch (type) {
case HEVC_SEI_TYPE_DECODED_PICTURE_HASH:
return decode_nal_sei_decoded_picture_hash(&s->picture_hash, gb);
default:
av_log(logctx, AV_LOG_DEBUG, "Skipped SUFFIX SEI %d\n", type);
skip_bits_long(gb, 8 * size);
return 0;
}
}
示例13: decode_nal_sei_suffix
static int decode_nal_sei_suffix(HEVCContext *s, int type, int size)
{
GetBitContext *gb = &s->HEVClc->gb;
switch (type) {
case SEI_TYPE_DECODED_PICTURE_HASH:
return decode_nal_sei_decoded_picture_hash(s);
default:
av_log(s->avctx, AV_LOG_DEBUG, "Skipped SUFFIX SEI %d\n", type);
skip_bits_long(gb, 8 * size);
return 0;
}
}
示例14: ff_mpeg4audio_get_config
int ff_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, int buf_size)
{
GetBitContext gb;
int specific_config_bitindex;
init_get_bits(&gb, buf, buf_size*8);
c->object_type = get_object_type(&gb);
c->sample_rate = get_sample_rate(&gb, &c->sampling_index);
c->chan_config = get_bits(&gb, 4);
if (c->chan_config < FF_ARRAY_ELEMS(ff_mpeg4audio_channels))
c->channels = ff_mpeg4audio_channels[c->chan_config];
c->sbr = -1;
if (c->object_type == AOT_SBR) {
c->ext_object_type = c->object_type;
c->sbr = 1;
c->ext_sample_rate = get_sample_rate(&gb, &c->ext_sampling_index);
c->object_type = get_object_type(&gb);
if (c->object_type == AOT_ER_BSAC)
c->ext_chan_config = get_bits(&gb, 4);
} else {
c->ext_object_type = AOT_NULL;
c->ext_sample_rate = 0;
}
specific_config_bitindex = get_bits_count(&gb);
if (c->object_type == AOT_ALS) {
skip_bits(&gb, 5);
if (show_bits_long(&gb, 24) != MKBETAG('\0','A','L','S'))
skip_bits_long(&gb, 24);
specific_config_bitindex = get_bits_count(&gb);
if (parse_config_ALS(&gb, c))
return -1;
}
if (c->ext_object_type != AOT_SBR) {
int bits_left = buf_size*8 - get_bits_count(&gb);
for (; bits_left > 15; bits_left--) {
if (show_bits(&gb, 11) == 0x2b7) { // sync extension
get_bits(&gb, 11);
c->ext_object_type = get_object_type(&gb);
if (c->ext_object_type == AOT_SBR && (c->sbr = get_bits1(&gb)) == 1)
c->ext_sample_rate = get_sample_rate(&gb, &c->ext_sampling_index);
break;
} else
get_bits1(&gb); // skip 1 bit
}
}
return specific_config_bitindex;
}
示例15: decode_frame
static int decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
BinkAudioContext *s = avctx->priv_data;
AVFrame *frame = data;
GetBitContext *gb = &s->gb;
int ret, consumed = 0;
if (!get_bits_left(gb)) {
uint8_t *buf;
/* handle end-of-stream */
if (!avpkt->size) {
*got_frame_ptr = 0;
return 0;
}
if (avpkt->size < 4) {
av_log(avctx, AV_LOG_ERROR, "Packet is too small\n");
return AVERROR_INVALIDDATA;
}
buf = av_realloc(s->packet_buffer, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!buf)
return AVERROR(ENOMEM);
s->packet_buffer = buf;
memcpy(s->packet_buffer, avpkt->data, avpkt->size);
init_get_bits(gb, s->packet_buffer, avpkt->size * 8);
consumed = avpkt->size;
/* skip reported size */
skip_bits_long(gb, 32);
}
/* get output buffer */
frame->nb_samples = s->frame_len;
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
if (decode_block(s, (float **)frame->extended_data,
avctx->codec->id == AV_CODEC_ID_BINKAUDIO_DCT)) {
av_log(avctx, AV_LOG_ERROR, "Incomplete packet\n");
return AVERROR_INVALIDDATA;
}
get_bits_align32(gb);
frame->nb_samples = s->block_size / avctx->channels;
*got_frame_ptr = 1;
return consumed;
}