当前位置: 首页>>代码示例>>C++>>正文


C++ read_uint8函数代码示例

本文整理汇总了C++中read_uint8函数的典型用法代码示例。如果您正苦于以下问题:C++ read_uint8函数的具体用法?C++ read_uint8怎么用?C++ read_uint8使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了read_uint8函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: read_int32

static int32_t read_int32(ios_t *s)
{
    int b0 = read_uint8(s);
    int b1 = read_uint8(s);
    int b2 = read_uint8(s);
    int b3 = read_uint8(s);
    return b0 | (b1<<8) | (b2<<16) | (b3<<24);
}
开发者ID:AnthonyNystrom,项目名称:julia,代码行数:8,代码来源:dump.c

示例2: im

mapnik::raster_ptr pgraster_wkb_reader::read_rgba(mapnik::box2d<double> const& bbox,
                                                  uint16_t width, uint16_t height)
{
  mapnik::image_rgba8 im(width, height, true, true);
  // Start with plain white (ABGR or RGBA depending on endiannes)
  im.set(0xffffffff);

  uint8_t nodataval;
  for (int bn=0; bn<numBands_; ++bn) {
    uint8_t type = read_uint8(&ptr_);

    int pixtype = BANDTYPE_PIXTYPE(type);
    int offline = BANDTYPE_IS_OFFDB(type) ? 1 : 0;
    int hasnodata = BANDTYPE_HAS_NODATA(type) ? 1 : 0;

    MAPNIK_LOG_DEBUG(pgraster) << "pgraster_wkb_reader: band " << bn
          << " type:" << pixtype << " offline:" << offline
          << " hasnodata:" << hasnodata;

    if ( offline ) {
      MAPNIK_LOG_WARN(pgraster) << "pgraster_wkb_reader: offline band "
            << bn << " unsupported";
      continue;
    }

    if ( pixtype > PT_8BUI || pixtype < PT_8BSI ) {
      MAPNIK_LOG_WARN(pgraster) << "pgraster_wkb_reader: band " << bn
            << " type " << type << " unsupported";
      continue;
    }

    uint8_t tmp = read_uint8(&ptr_);
    if ( ! bn ) nodataval = tmp;
    else if ( tmp != nodataval ) {
      MAPNIK_LOG_WARN(pgraster) << "pgraster_wkb_reader: band " << bn
            << " nodataval " << tmp << " != band 0 nodataval " << nodataval;
    }

    int ps = 4; // sizeof(image::pixel_type)
    uint8_t * image_data = im.bytes();
    for (int y=0; y<height_; ++y) {
      for (int x=0; x<width_; ++x) {
        uint8_t val = read_uint8(&ptr_);
        // y * width_ * ps is the row (ps is pixel size)
        // x * ps is the column
        int off = y * width_ * ps + x * ps;
        // Pixel space is RGBA
        image_data[off+bn] = val;
      }
    }
  }
  mapnik::raster_ptr raster = std::make_shared<mapnik::raster>(bbox, im, 1.0);
  raster->set_nodata(0xffffffff);
  return raster;
}
开发者ID:gischen,项目名称:mapnik,代码行数:55,代码来源:pgraster_wkb_reader.cpp

示例3: parse_cliloc

static void parse_cliloc(const char *p, const char *end)
{
    int a = read_uint32_le(&p, end);
    int b = read_uint16_le(&p, end);

    const char *start = p;

    // first go through it one pass to count the number of strings and total string size
    int string_count = 0;
    int total_string_size = 0;
    while(p < end)
    {
        read_uint32_le(&p, end);
        read_uint8(&p, end);
        int length = read_uint16_le(&p, end);
        p += length;
        if (length > 0)
        {
            string_count += 1;
            total_string_size += length + 1; // include null terminator
        }
    }

    // rewind
    p = start;

    cliloc_entry_count = string_count;
    cliloc_entries = (ml_cliloc_entry *)malloc(sizeof(ml_cliloc_entry) * string_count);

    int next_index = 0;
    while(p < end)
    {
        int id = read_sint32_le(&p, end);
        read_uint8(&p, end);

        int length = read_uint16_le(&p, end);
        if (length > 0)
        {
            ml_cliloc_entry *entry = &cliloc_entries[next_index];
            entry->id = id;
            char *s = (char *)malloc(length+1);
            s[length-1] = '\0';
            read_ascii_fixed(&p, end, s, length);
            entry->s = s;
            next_index += 1;
        }
    }

    for (int i = 0; i < string_count; i++)
    {
        ml_cliloc_entry *entry = &cliloc_entries[i];
        //printf("%d, %d: %s\n", i, entry->id, entry->s);
    }
}
开发者ID:serpis,项目名称:uoc,代码行数:54,代码来源:mullib.cpp

示例4: parse_tiledata

static void parse_tiledata(const char *p, const char *end)
{
    int remaining_bytes = (int)(end - p);
    int block_count = (remaining_bytes-512*32*(8+2+20)) / (4 + 32*(8+1+1+4+2+2+2+1+20));
    item_data_entry_count = 32*block_count;

    tile_datas = (ml_tile_data_entry *)malloc(512*32*sizeof(ml_tile_data_entry));
    item_datas = (ml_item_data_entry *)malloc(item_data_entry_count * sizeof(ml_item_data_entry));

    // 512*4 + 512*32*(8+2+20) bytes
    // first, 512 land data
    for (int i = 0; i < 512*32; i++)
    {
        // every 32 entries have a header of unknown use
        if (i % 32 == 0)
        {
            read_uint32_le(&p, end);
        }
        ml_tile_data_entry *tile_data = &tile_datas[i];
        tile_data->flags = read_uint64_le(&p, end);
        tile_data->texture = read_uint16_le(&p, end); // hmm can this be used instead of the rotation of land gfx?
        read_ascii_fixed(&p, end, tile_data->name, 20);

        //printf("%d: %08llx %d %s\n", i, (unsigned long long)flags, texture, name);
    }

    int i = 0;
    while (p < end)
    {
        // every 32 entries have a header of unknown use
        if (i % 32 == 0)
        {
            read_uint32_le(&p, end);
        }

        ml_item_data_entry *item_data = &item_datas[i];

        item_data->flags = read_uint64_le(&p, end);
        item_data->weight = read_uint8(&p, end);
        item_data->quality = read_uint8(&p, end);
        item_data->quantity = read_uint32_le(&p, end);
        item_data->animation = read_uint16_le(&p, end);
        read_uint16_le(&p, end);
        read_uint16_le(&p, end);
        item_data->height = read_uint8(&p, end);
        read_ascii_fixed(&p, end, item_data->name, 20);
        //printf("%d: %08llx %d %s\n", i, (unsigned long long)flags, animation, name);

        i += 1;
    }
}
开发者ID:serpis,项目名称:uoc,代码行数:51,代码来源:mullib.cpp

示例5: read_uint8

void
Squeezer_chunk_header_t::read_from_file(FILE * in)
{
    chunk_mark[0] = read_uint8(in);
    chunk_mark[1] = read_uint8(in);
    chunk_mark[2] = read_uint8(in);
    chunk_mark[3] = read_uint8(in);

    number_of_bytes = read_uint64(in);
    number_of_samples = read_uint32(in);

    chunk_type = read_uint32(in);

    compression_error.read_from_file(in);
}
开发者ID:ziotom78,项目名称:squeezer,代码行数:15,代码来源:data_structures.cpp

示例6: printf

CMp4_stss_box CMp4_stss_box::mp4_read_stss_box(FILE *f, int size)  //level 8  关键帧列表
{
    CMp4_stss_box box_ss;
    printf("\t\t\t\t\t+%s\n", "stss");
    box_ss.size= size;
    box_ss.type= 's'|'t'<<8|'s'<<16|'s'<<24;
    box_ss.version= read_uint8(f);
    fread(box_ss.flags, sizeof(box_ss.flags), 1, f);
    box_ss.number_of_entries = read_uint32_lit(f);//关键帧的数目

    printf("\t\t\t\t\t\t\tflags: %u\n",
           box_ss.flags[0]|box_ss.flags[1]|box_ss.flags[2]);
    printf("number of entries: %u\n",box_ss.number_of_entries);

    printf("entries:\n");
    box_ss.sync_sample_table = new uint32_t[box_ss.number_of_entries];
    unsigned int cur_pos=_ftelli64(f);
    for(int i =0; i < box_ss.number_of_entries; ++i) {
        _fseeki64(f,cur_pos,SEEK_SET);
        box_ss.sync_sample_table[i] = read_uint32_lit(f);//关键帧的序号
        /*	if (i<10)*/
        //{
        printf("%6u ", box_ss.sync_sample_table[i]);
        if( (i)%10 == 0)printf("\n");
        //}

        cur_pos+=4;
    }
    printf("\n");

    return box_ss;
}
开发者ID:EasyDarwin,项目名称:EasyPusher,代码行数:32,代码来源:Mp4_stss_box.cpp

示例7: decode_adpcm_sample_frame

static __inline__ int decode_adpcm_sample_frame(Sound_Sample *sample)
{
    Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
    wav_t *w = (wav_t *) internal->decoder_private;
    fmt_t *fmt = w->fmt;
    ADPCMBLOCKHEADER *headers = fmt->fmt.adpcm.blockheaders;
    SDL_RWops *rw = internal->rw;
    int i;
    int max = fmt->wChannels;
    Sint32 delta;
    Uint8 nib = fmt->fmt.adpcm.nibble;

    for (i = 0; i < max; i++)
    {
        Uint8 byte;
        Sint16 iCoef1 = fmt->fmt.adpcm.aCoef[headers[i].bPredictor].iCoef1;
        Sint16 iCoef2 = fmt->fmt.adpcm.aCoef[headers[i].bPredictor].iCoef2;
        Sint32 lPredSamp = ((headers[i].iSamp1 * iCoef1) +
                            (headers[i].iSamp2 * iCoef2)) / 
                             FIXED_POINT_COEF_BASE;

        if (fmt->fmt.adpcm.nibble_state == 0)
        {
            BAIL_IF_MACRO(!read_uint8(rw, &nib), NULL, 0);
            fmt->fmt.adpcm.nibble_state = 1;
            do_adpcm_nibble(nib >> 4, &headers[i], lPredSamp);
        } /* if */
        else
        {
开发者ID:BPaden,项目名称:garglk,代码行数:29,代码来源:wav.c

示例8: read_adpcm_block_headers

static __inline__ int read_adpcm_block_headers(Sound_Sample *sample)
{
    Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
    SDL_RWops *rw = internal->rw;
    wav_t *w = (wav_t *) internal->decoder_private;
    fmt_t *fmt = w->fmt;
    ADPCMBLOCKHEADER *headers = fmt->fmt.adpcm.blockheaders;
    int i;
    int max = fmt->wChannels;

    if (w->bytesLeft < fmt->wBlockAlign)
    {
        sample->flags |= SOUND_SAMPLEFLAG_EOF;
        return(0);
    } /* if */

    w->bytesLeft -= fmt->wBlockAlign;

    for (i = 0; i < max; i++)
        BAIL_IF_MACRO(!read_uint8(rw, &headers[i].bPredictor), NULL, 0);

    for (i = 0; i < max; i++)
        BAIL_IF_MACRO(!read_le16(rw, &headers[i].iDelta), NULL, 0);

    for (i = 0; i < max; i++)
        BAIL_IF_MACRO(!read_le16(rw, &headers[i].iSamp1), NULL, 0);

    for (i = 0; i < max; i++)
        BAIL_IF_MACRO(!read_le16(rw, &headers[i].iSamp2), NULL, 0);

    fmt->fmt.adpcm.samples_left_in_block = fmt->fmt.adpcm.wSamplesPerBlock;
    fmt->fmt.adpcm.nibble_state = 0;
    return(1);
} /* read_adpcm_block_headers */
开发者ID:BPaden,项目名称:garglk,代码行数:34,代码来源:wav.c

示例9: read_var_int

    /**
     * Reads a variable length integer.
     */
    std::uint64_t read_var_int()
    {
        std::uint64_t ret = 0;

        std::uint8_t size = read_uint8();

        if (size < 253)
        {
            ret = size;
        }
        else if (size == 253)
        {
            ret = read_uint16();
        }
        else if (size == 254)
        {
            ret = read_uint32();
        }
        else if (size == 255)
        {
            ret = read_uint64();
        }
        else
        {
            assert(0);
        }

        return ret;
    }
开发者ID:VNLtools,项目名称:coinpp,代码行数:32,代码来源:data_buffer.hpp

示例10: send_rtp

static int send_rtp(const uint8_t *pkt, size_t len, void *arg){
	struct sync_state* pss = (struct sync_state*)arg;
    
	pthread_mutex_lock(&pss->mutex);
	pss->event = true;
	pss->pt = read_uint8(&pkt[1]);
    uint16_t seq = read_uint16(&pkt[2]);
    uint32_t timestamp = read_uint32(&pkt[4]);
    pss->ssrc = read_uint32(&pkt[8]);
    pss->seq_diff = seq - pss->prev_seq;
    if(pss->seq_diff < 0) {
        pss->seq_diff += 0xffff;
    }
    pss->prev_seq = seq;
    pss->timestamp_diff = timestamp - pss->prev_timestamp;
    if(pss->timestamp_diff < 0) {
        pss->timestamp_diff += 0xfffffff;
    }
    pss->prev_timestamp = timestamp;
    memcpy(pss->packet_buf, pkt, len);
    pss->nbytes = len;
    
	pthread_cond_signal(&pss->cond);
	pthread_mutex_unlock(&pss->mutex);

    return 0;
}
开发者ID:LampmanYao,项目名称:wire-audio-video-signaling,代码行数:27,代码来源:test_voe.cpp

示例11: consume_uint8

static uint8_t SPICE_GNUC_UNUSED consume_uint8(uint8_t **ptr)
{
    uint8_t val;
    val = read_uint8(*ptr);
    *ptr += 1;
    return val;
}
开发者ID:zhoupeng,项目名称:spice4xen,代码行数:7,代码来源:generated_demarshallers.c

示例12: printf

CMp4_stsc_box CMp4_stsc_box::mp4_read_stsc_box(FILE *f, int size)  //level 8
{
	CMp4_stsc_box box_sc;
	box_sc.size=size;
	box_sc.type= 's'|'t'<<8|'s'<<16|'c'<<24;
    printf("\t\t\t\t\t+%s\n", "stsc");
	box_sc.version    = read_uint8(f);
    fread(&box_sc.flags, sizeof(box_sc.flags), 1, f);
    box_sc.map_amount = read_uint32_lit(f);//sample-to-chunk 的数目
   
    printf("map-amount: %u\n", box_sc.map_amount);
    
    box_sc.scmap= new mp4_list_t[box_sc.map_amount];
    printf("first chunk:\tsamples-per-chunk:\tsample-description-ID\n");
	/*这个表类似于行程编码,第一个first chunk 减去第二个first chunk 就是一共有多少个trunk
	包含相同的sample 数目,这样通过不断的叠加,就可以得到一共有多少个chunk,每个chunk 包含多
	少个sample,以及每个chunk 对应的description。*/
	unsigned int cur_pos=_ftelli64(f);
	for(int i = 0; i < box_sc.map_amount; ++i){
		_fseeki64(f,cur_pos,SEEK_SET);
        box_sc.scmap[i].first_chunk_num = read_uint32_lit(f);
        box_sc.scmap[i].sample_amount_in_cur_table = read_uint32_lit(f);
        box_sc.scmap[i].sample_description_id = read_uint32_lit(f);
		cur_pos+=12;
    }
	for (int i=0;i<10;i++)
	{
         printf("%13d", box_sc.scmap[i].first_chunk_num);
         printf("\t%13d", box_sc.scmap[i].sample_amount_in_cur_table);
         printf("\t%13d\n", box_sc.scmap[i].sample_description_id);
	}
	std::cout<<"stsc:chunk_num="<<box_sc.scmap[box_sc.map_amount-1].first_chunk_num<<std::endl;
    return box_sc;
}
开发者ID:DreamZoom,项目名称:EasyPusher,代码行数:34,代码来源:Mp4_stsc_box.cpp

示例13: streamProcessor

void streamProcessor()
{
	while(1)
	{
#ifndef SW
#ifdef PIPELINE
		__loop_pipelining_on__(32,2,1);
#endif
#endif
		float x = read_float32("x_pipe");
		float y = read_float32("y_pipe");

		uint8_t op_code = read_uint8("op_pipe");

		float result = 0;
		if(op_code == 0)
			result = x*y;
		else if(op_code == 1)
			result = x+y;
		else if(op_code == 2)
			result = (x*x) - (y*y);
		else if(op_code == 3)
			result = (x + y) * (x + y);
		else
			result = 0;

		write_float32("z_pipe",result);
	}
}
开发者ID:madhavPdesai,项目名称:ahir,代码行数:29,代码来源:prog.c

示例14: read_v6_address

		address read_v6_address(InIt&& in)
		{
			address_v6::bytes_type bytes;
			for (auto& b : bytes)
				b = read_uint8(in);
			return address_v6(bytes);
		}
开发者ID:Chocobo1,项目名称:libtorrent,代码行数:7,代码来源:socket_io.hpp

示例15: read_uint8

/*final box
 */
CMp4_mdhd_box CMp4_mdhd_box::mp4_read_mdhd_box(FILE *f, int size)
{
   // printf("\t\t\t+mdhd\n");
    CMp4_mdhd_box box;
	std::cout<<"\t\t\t\t\tmdhd"<<std::endl;
	int k = 0;                                  \
	unsigned char p[5];                         \
	int inner_size = 0;
        
    box.size              = size;
    box.type              = 'm' | 'd'<<8 | 'h'<<16 | 'd'<<24;
    box.version           = read_uint8(f);
    fread(&box.flags, sizeof(box.flags), 1, f);
    box.creation_time     = read_uint32_lit(f);
    box.modification_time = read_uint32_lit(f);
    box.timescale         = read_uint32_lit(f);
    box.duration          = read_uint32_lit(f);
    box.language          = read_uint16_big(f);
    box.pre_defined       = read_uint16_big(f);


	printf("\t\t\t\t\tflags: 0x%x\n", box.flags[2]
            | box.flags[1] | box.flags[0]);
     printf("\t\t\t\t\tcreation time: %u\n", box.creation_time);
     printf("\t\t\t\t\tmodifaction time: %u\n",
            box.modification_time);
    printf("\t\t\t\ttimescale: %u\n", box.timescale);
    printf("\t\t\t\tduration: %u\n", box.duration);
    printf("\t\t\t\tlanguage: %u\n", box.language);
     printf("\t\t\t\tpre-defined: %u\n", box.pre_defined);
    
    printf("\n");

    return box;
}
开发者ID:DreamZoom,项目名称:EasyPusher,代码行数:37,代码来源:Mp4_mdhd_box.cpp


注:本文中的read_uint8函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。