本文整理汇总了C++中bs_init函数的典型用法代码示例。如果您正苦于以下问题:C++ bs_init函数的具体用法?C++ bs_init怎么用?C++ bs_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bs_init函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: add_vui
int add_vui(void *srcPtr, size_t srcSize, void *dstPtr, size_t dstSize, int color)
{
sps_t sps;
bs_t b;
memset(&b, 0, sizeof(bs_t));
bs_init(&b, srcPtr, srcSize);
read_seq_parameter_set_rbsp(&sps, &b);
sps.vui_parameters_present_flag = 1;
{
sps.vui.video_signal_type_present_flag = 1;
{
sps.vui.video_format = 5;
sps.vui.video_full_range_flag = 1;
}
sps.vui.colour_description_present_flag = 1;
{
sps.vui.colour_primaries = 1;
}
sps.vui.transfer_characteristics = 1;
sps.vui.matrix_coefficients = 1;
}
switch (color)
{
case BT601_LIMITED:
sps.vui.colour_primaries = 5;
sps.vui.video_full_range_flag = 0;
sps.vui.transfer_characteristics = 6;
sps.vui.matrix_coefficients = 5;
break;
case BT601_FULL:
sps.vui.colour_primaries = 5;
sps.vui.transfer_characteristics = 6;
sps.vui.matrix_coefficients = 5;
break;
case BT601_FULL_YCbCr:
sps.vui.colour_primaries = 5;
sps.vui.transfer_characteristics = 8;
sps.vui.matrix_coefficients = 5;
break;
case BT709_LIMITED:
sps.vui.video_full_range_flag = 0;
break;
case BT709_FULL:
break;
case BT709_ALT1_LIMITED:
sps.vui.video_full_range_flag = 0;
break;
default:
sps.vui_parameters_present_flag = 0;
break;
}
bs_init(&b, dstPtr, dstSize);
write_seq_parameter_set_rbsp(&sps, &b);
return bs_pos_byte(&b);
}
开发者ID:elgamar,项目名称:openencodevfw,代码行数:60,代码来源:bitstream.cpp
示例2: ParseWMV3
/* Parse WMV3 packet and extract frame type information */
static void ParseWMV3( decoder_t *p_dec, block_t *p_block )
{
bs_t s;
/* Parse Sequence header */
bs_init( &s, p_dec->fmt_in.p_extra, p_dec->fmt_in.i_extra );
if( bs_read( &s, 2 ) == 3 )
return;
bs_skip( &s, 22 );
const bool b_range_reduction = bs_read( &s, 1 );
const bool b_has_frames = bs_read( &s, 3 ) > 0;
bs_skip( &s, 2 );
const bool b_frame_interpolation = bs_read( &s, 1 );
if( bs_eof( &s ) )
return;
/* Parse frame type */
bs_init( &s, p_block->p_buffer, p_block->i_buffer );
bs_skip( &s, b_frame_interpolation +
2 +
b_range_reduction );
p_block->i_flags &= ~BLOCK_FLAG_TYPE_MASK;
if( bs_read( &s, 1 ) )
p_block->i_flags |= BLOCK_FLAG_TYPE_P;
else if( !b_has_frames || bs_read( &s, 1 ) )
p_block->i_flags |= BLOCK_FLAG_TYPE_I;
else
p_block->i_flags |= BLOCK_FLAG_TYPE_B;
}
开发者ID:CSRedRat,项目名称:vlc,代码行数:31,代码来源:copy.c
示例3: write_rtcp_pkt
static int write_rtcp_pkt( hnd_t handle )
{
obe_rtp_ctx *p_rtp = handle;
uint64_t ntp_time = obe_ntp_time();
uint8_t pkt[100];
bs_t s;
bs_init( &s, pkt, RTCP_PACKET_SIZE );
bs_write( &s, 2, RTP_VERSION ); // version
bs_write1( &s, 0 ); // padding
bs_write( &s, 5, 0 ); // reception report count
bs_write( &s, 8, RTCP_SR_PACKET_TYPE ); // packet type
bs_write( &s, 8, 6 ); // length (length in words - 1)
bs_write32( &s, p_rtp->ssrc ); // ssrc
bs_write32( &s, ntp_time / 1000000 ); // NTP timestamp, most significant word
bs_write32( &s, ((ntp_time % 1000000) << 32) / 1000000 ); // NTP timestamp, least significant word
bs_write32( &s, 0 ); // RTP timestamp FIXME
bs_write32( &s, p_rtp->pkt_cnt ); // sender's packet count
bs_write32( &s, p_rtp->octet_cnt ); // sender's octet count
bs_flush( &s );
if( udp_write( p_rtp->udp_handle, pkt, RTCP_PACKET_SIZE ) < 0 )
return -1;
return 0;
}
开发者ID:gz818,项目名称:obe-rt,代码行数:26,代码来源:ip.c
示例4: write_rtp_pkt
static int write_rtp_pkt( hnd_t handle, uint8_t *data, int len, int64_t timestamp )
{
obe_rtp_ctx *p_rtp = handle;
uint8_t pkt[RTP_HEADER_SIZE+TS_PACKETS_SIZE];
bs_t s;
bs_init( &s, pkt, RTP_HEADER_SIZE+TS_PACKETS_SIZE );
bs_write( &s, 2, RTP_VERSION ); // version
bs_write1( &s, 0 ); // padding
bs_write1( &s, 0 ); // extension
bs_write( &s, 4, 0 ); // CSRC count
bs_write1( &s, 0 ); // marker
bs_write( &s, 7, MPEG_TS_PAYLOAD_TYPE ); // payload type
bs_write( &s, 16, p_rtp->seq++ ); // sequence number
bs_write32( &s, timestamp / 300 ); // timestamp
bs_write32( &s, p_rtp->ssrc ); // ssrc
bs_flush( &s );
memcpy( &pkt[RTP_HEADER_SIZE], data, len );
if( udp_write( p_rtp->udp_handle, pkt, RTP_HEADER_SIZE+TS_PACKETS_SIZE ) < 0 )
return -1;
p_rtp->pkt_cnt++;
p_rtp->octet_cnt += len;
return 0;
}
开发者ID:gz818,项目名称:obe-rt,代码行数:28,代码来源:ip.c
示例5: kzalloc
/* initialize encoder */
struct drm_encoder *mdp5_encoder_init(struct drm_device *dev, int intf,
enum mdp5_intf intf_id)
{
struct drm_encoder *encoder = NULL;
struct mdp5_encoder *mdp5_encoder;
int ret;
mdp5_encoder = kzalloc(sizeof(*mdp5_encoder), GFP_KERNEL);
if (!mdp5_encoder) {
ret = -ENOMEM;
goto fail;
}
mdp5_encoder->intf = intf;
mdp5_encoder->intf_id = intf_id;
encoder = &mdp5_encoder->base;
drm_encoder_init(dev, encoder, &mdp5_encoder_funcs,
DRM_MODE_ENCODER_TMDS);
drm_encoder_helper_add(encoder, &mdp5_encoder_helper_funcs);
bs_init(mdp5_encoder);
return encoder;
fail:
if (encoder)
mdp5_encoder_destroy(encoder);
return ERR_PTR(ret);
}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:32,代码来源:mdp5_encoder.c
示例6: x264_sei_pic_timing_write
void x264_sei_pic_timing_write( x264_t *h, bs_t *s )
{
x264_sps_t *sps = h->sps;
bs_t q;
uint8_t tmp_buf[100];
bs_init( &q, tmp_buf, 100 );
bs_realign( &q );
if( sps->vui.b_nal_hrd_parameters_present || sps->vui.b_vcl_hrd_parameters_present )
{
bs_write( &q, sps->vui.hrd.i_cpb_removal_delay_length, h->fenc->i_cpb_delay - h->i_cpb_delay_pir_offset );
bs_write( &q, sps->vui.hrd.i_dpb_output_delay_length, h->fenc->i_dpb_output_delay );
}
if( sps->vui.b_pic_struct_present )
{
bs_write( &q, 4, h->fenc->i_pic_struct-1 ); // We use index 0 for "Auto"
// These clock timestamps are not standardised so we don't set them
// They could be time of origin, capture or alternative ideal display
for( int i = 0; i < num_clock_ts[h->fenc->i_pic_struct]; i++ )
bs_write1( &q, 0 ); // clock_timestamp_flag
}
bs_align_10( &q );
bs_flush( &q );
x264_sei_write( s, tmp_buf, bs_pos( &q ) / 8, SEI_PIC_TIMING );
}
开发者ID:submux,项目名称:obe-vod,代码行数:30,代码来源:set.c
示例7: read_sei_type_0
// D.1.1 SEI buffering period syntax
static void read_sei_type_0(h264_stream_t* h, sei_t* s) {
int sched_sel_idx;
bs_t bs;
sps_t *sps = h->sps;
sei_type_0 *bp = malloc(sizeof(sei_type_0));
bs_init(&bs, s->payload, s->payloadSize);
bp->seq_parameter_set_id = bs_read_ue(&bs);
if(sps->vui.nal_hrd_parameters_present_flag) {
for (sched_sel_idx = 0; sched_sel_idx < sps->hrd.cpb_cnt_minus1 + 1; sched_sel_idx++) {
bp->initial_cbp_removal_delay[sched_sel_idx] = bs_read_u(&bs, sps->hrd.initial_cpb_removal_delay_length_minus1 + 1);
bp->initial_cbp_removal_delay_offset[sched_sel_idx] = bs_read_u(&bs, sps->hrd.initial_cpb_removal_delay_length_minus1 + 1);
}
}
if (sps->vui.vcl_hrd_parameters_present_flag) {
for (sched_sel_idx = 0; sched_sel_idx < sps->hrd.cpb_cnt_minus1 + 1; sched_sel_idx++) {
bp->initial_cbp_removal_delay[sched_sel_idx] = bs_read_u(&bs, sps->hrd.initial_cpb_removal_delay_length_minus1 + 1);
bp->initial_cbp_removal_delay_offset[sched_sel_idx] = bs_read_u(&bs, sps->hrd.initial_cpb_removal_delay_length_minus1 + 1);
}
}
s->sei_type_struct = bp;
}
开发者ID:mobdim,项目名称:TapIn-iOS,代码行数:26,代码来源:h264_sei.c
示例8: read_sei_type_1
// D.1.2 SEI picture timing syntax
static void read_sei_type_1(h264_stream_t* h, sei_t* s) {
bs_t bs;
sps_t *sps = h->sps;
uint32_t pict_struct, num_clock_ticks;
bs_init(&bs, s->payload, s->payloadSize);
sei_type_1 *pt_struct = NULL;
if(sps->vui.nal_hrd_parameters_present_flag || sps->vui.vcl_hrd_parameters_present_flag) {
pt_struct = calloc(sizeof(sei_type_1), 1);
pt_struct->cpb_removal_delay = bs_read_u(&bs, sps->hrd.cpb_removal_delay_length_minus1 + 1);
pt_struct->dpb_output_delay = bs_read_u(&bs, sps->hrd.dpb_output_delay_length_minus1 + 1);
}
if (sps->vui.pic_struct_present_flag) {
pict_struct = bs_read_u(&bs, 4);
if (pict_struct > SEI_PIC_STRUCT_FRAME_TRIPLING) {
return;
}
num_clock_ticks = sei_num_clock_ts_table[pict_struct];
pt_struct->timings = calloc(sizeof(sei_type_1_pic_timing) * num_clock_ticks, 1);
pt_struct->NumClockTS = num_clock_ticks;
pt_struct->pic_struct = pict_struct;
for (int i = 0; i < num_clock_ticks; i++) {
sei_type_1_pic_timing *pt = &pt_struct->timings[i];
pt->clock_timestamp_flag = bs_read_u(&bs, 1);
if (pt->clock_timestamp_flag) {
pt->ct_type = bs_read_u(&bs, 2);
pt->nuit_field_based_flag = bs_read_u(&bs, 1);
pt->counting_type = bs_read_u(&bs, 5);
pt->full_timestamp_flag = bs_read_u(&bs, 1);
pt->discontinuity_flag = bs_read_u(&bs, 1);
pt->cnt_dropped_flag = bs_read_u(&bs, 1);
pt->n_frames = bs_read_u(&bs, 8);
if (pt->full_timestamp_flag) {
pt->seconds_value = bs_read_u(&bs, 6);
pt->minutes_value = bs_read_u(&bs, 6);
pt->hours_value = bs_read_u(&bs, 5);
}else {
pt->seconds_flag = bs_read_u(&bs, 1);
if (pt->seconds_flag) {
pt->seconds_value = bs_read_u(&bs, 6);
pt->minutes_flag = bs_read_u(&bs, 1);
if(pt->minutes_flag) {
pt->minutes_value = bs_read_u(&bs, 6);
pt->hours_flag = bs_read_u(&bs, 1);
if (pt->hours_flag) {
pt->hours_value = bs_read_u(&bs, 5);
}
}
}
}
if (sps->hrd.time_offset_length > 0) {
pt->time_offset = bs_read_u(&bs, sps->hrd.time_offset_length);
}
}
}
}
s->sei_type_struct = pt_struct;
}
开发者ID:mobdim,项目名称:TapIn-iOS,代码行数:61,代码来源:h264_sei.c
示例9: test_bs_init
void test_bs_init() {
bitset bs;
bs_init(&bs, 2, g_heap);
bs_set_range(&bs, 0, 1);
assert_equal(bs.m_bc[0], 0xC000000000000000);
assert_equal(bs.m_bc[1], 0x0);
}
开发者ID:hanjoes,项目名称:runtime,代码行数:7,代码来源:bitset_basic_tests.c
示例10: calloc
static INDX_ROOT *_indx_parse(BD_FILE_H *fp)
{
BITSTREAM bs;
INDX_ROOT *index = calloc(1, sizeof(INDX_ROOT));
int indexes_start, extension_data_start;
if (!index) {
BD_DEBUG(DBG_CRIT, "out of memory\n");
return NULL;
}
bs_init(&bs, fp);
if (!_parse_header(&bs, &indexes_start, &extension_data_start) ||
!_parse_app_info(&bs, &index->app_info)) {
indx_free(&index);
return NULL;
}
bs_seek_byte(&bs, indexes_start);
if (!_parse_index(&bs, index)) {
indx_free(&index);
return NULL;
}
if (extension_data_start) {
BD_DEBUG(DBG_NAV | DBG_CRIT, "index.bdmv: unknown extension data at %d\n", extension_data_start);
}
return index;
}
开发者ID:EdwardNewK,项目名称:libbluray,代码行数:32,代码来源:index_parse.c
示例11: getFPS
static int32_t getFPS( demux_t *p_demux, block_t * p_block )
{
demux_sys_t *p_sys = p_demux->p_sys;
bs_t bs;
uint8_t * p_decoded_nal;
int i_decoded_nal;
if( p_block->i_buffer < 5 )
return -1;
p_decoded_nal = CreateDecodedNAL(&i_decoded_nal,
p_block->p_buffer+4, p_block->i_buffer-4);
if( !p_decoded_nal )
return -1;
bs_init( &bs, p_decoded_nal, i_decoded_nal );
bs_skip( &bs, 12 );
int32_t max_sub_layer_minus1 = bs_read( &bs, 3 );
bs_skip( &bs, 17 );
hevc_skip_profile_tiers_level( &bs, max_sub_layer_minus1 );
int32_t vps_sub_layer_ordering_info_present_flag = bs_read1( &bs );
int32_t i = vps_sub_layer_ordering_info_present_flag? 0 : max_sub_layer_minus1;
for( ; i <= max_sub_layer_minus1; i++ )
{
bs_read_ue( &bs );
bs_read_ue( &bs );
bs_read_ue( &bs );
}
uint32_t vps_max_layer_id = bs_read( &bs, 6);
uint32_t vps_num_layer_sets_minus1 = bs_read_ue( &bs );
bs_skip( &bs, vps_max_layer_id * vps_num_layer_sets_minus1 );
if( bs_read1( &bs ))
{
uint32_t num_units_in_tick = bs_read( &bs, 32 );
uint32_t time_scale = bs_read( &bs, 32 );
if( num_units_in_tick )
{
p_sys->f_fps = ( (float) time_scale )/( (float) num_units_in_tick );
msg_Dbg(p_demux,"Using framerate %f fps from VPS",
(double) p_sys->f_fps);
}
else
{
msg_Err( p_demux, "vps_num_units_in_tick null defaulting to 25 fps");
p_sys->f_fps = 25.0f;
}
}
else
{
msg_Err( p_demux, "No timing info in VPS defaulting to 25 fps");
p_sys->f_fps = 25.0f;
}
free(p_decoded_nal);
return 0;
}
开发者ID:lustigepepe,项目名称:pVLC,代码行数:60,代码来源:hevc.c
示例12: PutPPS
static void PutPPS( decoder_t *p_dec, block_t *p_frag )
{
decoder_sys_t *p_sys = p_dec->p_sys;
bs_t s;
int i_pps_id;
int i_sps_id;
bs_init( &s, &p_frag->p_buffer[5], p_frag->i_buffer - 5 );
i_pps_id = bs_read_ue( &s ); // pps id
i_sps_id = bs_read_ue( &s ); // sps id
if( i_pps_id >= PPS_MAX || i_sps_id >= SPS_MAX )
{
msg_Warn( p_dec, "invalid PPS (pps_id=%d sps_id=%d)", i_pps_id, i_sps_id );
block_Release( p_frag );
return;
}
bs_skip( &s, 1 ); // entropy coding mode flag
p_sys->i_pic_order_present_flag = bs_read( &s, 1 );
/* TODO */
/* We have a new PPS */
if( !p_sys->b_pps )
msg_Dbg( p_dec, "found NAL_PPS (pps_id=%d sps_id=%d)", i_pps_id, i_sps_id );
p_sys->b_pps = true;
if( p_sys->pp_pps[i_pps_id] )
block_Release( p_sys->pp_pps[i_pps_id] );
p_sys->pp_pps[i_pps_id] = p_frag;
}
开发者ID:5UN5H1N3,项目名称:vlc,代码行数:29,代码来源:h264.c
示例13: main
int main() {
char *d;
struct bs s;
bs_init(&s,10);
bs_add(&s,"aa");
bs_add(&s,"ab");
bs_add(&s,"ac");
bs_add(&s,"ad123456789");
bs_get(&s,&d);
printf("ret \"%s\"\n",d);
bs_get(&s,&d);
printf("ret \"%s\"\n",d);
bs_get(&s,&d);
printf("ret \"%s\"\n",d);
bs_get(&s,&d);
printf("ret \"%s\"\n",d);
bs_get(&s,&d);
printf("ret \"%s\"\n",d);
bs_get(&s,&d);
printf("ret \"%s\"\n",d);
bs_get(&s,&d);
printf("ret \"%s\"\n",d);
}
开发者ID:FlavioFalcao,项目名称:enterprise-search,代码行数:26,代码来源:test.c
示例14: ui_main
/* returns boolean, non zero is ok */
int
ui_main(void)
{
uint32 flags;
/* try to connect */
flags = RDP_LOGON_NORMAL;
if (g_password[0] != 0)
{
flags |= RDP_INFO_AUTOLOGON;
}
if (!rdp_connect(g_servername, flags, g_domain, g_password,
g_shell, g_directory, FALSE))
{
return 0;
}
/* init backingstore */
bs_init(g_width, g_height, g_server_depth);
/* create the window */
if (!mi_create_window())
{
return 0;
}
/* if all ok, enter main loop */
return mi_main_loop();
}
开发者ID:CSRedRat,项目名称:reactos-playground,代码行数:27,代码来源:uimain.c
示例15: test_bs_nrun_from
void test_bs_nrun_from() {
bitset bs;
// 8 chks right covers 4096 bytes (our heap size).
bs_init(&bs, 8, g_heap);
bs_set_range(&bs, 0, 7);
// we need one full byte to cover 8 chunks
assert_equal(bs.m_bc[0], 0xFF00000000000000);
size_t index = bs_nrun_from(&bs, 311, 8);
assert_equal(8, index);
for (int i = 0; i < 4; ++i) {
assert_equal(bs.m_bc[i], ~0x0);
}
// the first 5 chunks except for one bit should be occupied.
assert_equal(bs.m_bc[4], 0xFFFFFFFFFFFFFFFE);
// should exhaust all remaining bits and start over
index = bs_nrun_from(&bs, 193, 320);
assert_equal(319, index);
// build a bit board with "holes"
bs_set_range(&bs, 0, 511);
bs_clear_range(&bs, 10, 73);
bs_clear_range(&bs, 100, 162);
index = bs_nrun_from(&bs, 64, 100);
assert_equal(10, index);
}
开发者ID:hanjoes,项目名称:runtime,代码行数:28,代码来源:bitset_basic_tests.c
示例16: test_next_one
void test_next_one() {
bitset bs;
bs_init(&bs, 2, g_heap);
bs_set_range(&bs, 0, 1);
// test normal usage
size_t next_pos = bs_next_one(&bs, 0);
assert_equal(0, next_pos);
bs_set_range(&bs, 63, 64);
next_pos = bs_next_one(&bs, 62);
assert_equal(63, next_pos);
next_pos = bs_next_one(&bs, 63);
assert_equal(63, next_pos);
// test when there is no one
bs_clear_range(&bs, 0, 127);
assert_equal(0x0, bs.m_bc[0]);
assert_equal(0x0, bs.m_bc[1]);
next_pos = bs_next_one(&bs, 0);
assert_equal(next_pos, BITSET_NON);
// test starts from second chunk
bs_set_range(&bs, 66, 69);
next_pos = bs_next_one(&bs, 65);
assert_equal(66, next_pos);
// test start point off zero
bs_clear_range(&bs, 66, 69);
bs_set(&bs, 0);
next_pos = bs_next_one(&bs, 0);
assert_equal(0, next_pos);
next_pos = bs_next_one(&bs, 1);// off by 1
assert_equal(BITSET_NON, next_pos);
}
开发者ID:hanjoes,项目名称:runtime,代码行数:34,代码来源:bitset_basic_tests.c
示例17: test_bs_set1_same_chk
void test_bs_set1_same_chk() {
bitset bs;
bs_init(&bs, 2, g_heap);
bs_set_range(&bs, 0, 1);
assert_equal(bs.m_bc[0], 0xC000000000000000);
bs_set_range(&bs, 2, 3);
assert_equal(bs.m_bc[0], 0xF000000000000000);
}
开发者ID:hanjoes,项目名称:runtime,代码行数:8,代码来源:bitset_basic_tests.c
示例18: test_bs_set1_right_boundary_lo
void test_bs_set1_right_boundary_lo() {
bitset bs;
bs_init(&bs, 2, g_heap);
bs_set_range(&bs, 0, 1);
bs_set_range(&bs, 63, 77);
assert_equal(bs.m_bc[0], 0xC000000000000001);
assert_equal(bs.m_bc[1], 0xFFFC000000000000);
}
开发者ID:hanjoes,项目名称:runtime,代码行数:8,代码来源:bitset_basic_tests.c
示例19: test_bs_set1_right_boundary_hi
void test_bs_set1_right_boundary_hi() {
bitset bs;
bs_init(&bs, 2, g_heap);
bs_set_range(&bs, 0, 1);
bs_set_range(&bs, 23, 63);
assert_equal(bs.m_bc[0], 0xC00001FFFFFFFFFF);
assert_equal(bs.m_bc[1], 0x0);
}
开发者ID:hanjoes,项目名称:runtime,代码行数:8,代码来源:bitset_basic_tests.c
示例20: test_bs_set1_left_boundary
void test_bs_set1_left_boundary() {
bitset bs;
bs_init(&bs, 2, g_heap);
bs_set_range(&bs, 0, 1);
bs_set_range(&bs, 64, 80);
assert_equal(bs.m_bc[0], 0xC000000000000000);
assert_equal(bs.m_bc[1], 0xFFFF800000000000);
}
开发者ID:hanjoes,项目名称:runtime,代码行数:8,代码来源:bitset_basic_tests.c
注:本文中的bs_init函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论