本文整理汇总了C++中READ_UINT16函数的典型用法代码示例。如果您正苦于以下问题:C++ READ_UINT16函数的具体用法?C++ READ_UINT16怎么用?C++ READ_UINT16使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了READ_UINT16函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: parse_sprite_trajectory
static gboolean
parse_sprite_trajectory (GstBitReader * br,
GstMpeg4SpriteTrajectory * sprite_traj, guint no_of_sprite_warping_points)
{
guint i, length;
for (i = 0; i < no_of_sprite_warping_points; i++) {
if (!decode_vlc (br, &length, mpeg4_dmv_size_vlc_table,
G_N_ELEMENTS (mpeg4_dmv_size_vlc_table)))
goto failed;
if (length)
READ_UINT16 (br, sprite_traj->vop_ref_points[i], length);
CHECK_MARKER (br);
if (!decode_vlc (br, &length, mpeg4_dmv_size_vlc_table,
G_N_ELEMENTS (mpeg4_dmv_size_vlc_table)))
goto failed;
if (length)
READ_UINT16 (br, sprite_traj->sprite_ref_points[i], length);
CHECK_MARKER (br);
}
return TRUE;
failed:
GST_WARNING ("Could not parse the sprite trajectory");
return FALSE;
}
开发者ID:GrokImageCompression,项目名称:gst-plugins-bad,代码行数:31,代码来源:gstmpeg4parser.c
示例2: ENTER
void OSystem_Android::disableCursorPalette(bool disable) {
ENTER("%d", disable);
// when disabling the cursor palette, and we're running a clut8 game,
// it expects the game palette to be used for the cursor
if (disable && _game_texture->hasPalette()) {
const byte *src = _game_texture->palette_const();
byte *dst = _mouse_texture_palette->palette();
const Graphics::PixelFormat &pf_src =
_game_texture->getPalettePixelFormat();
const Graphics::PixelFormat &pf_dst =
_mouse_texture_palette->getPalettePixelFormat();
uint8 r, g, b;
for (uint i = 0; i < 256; ++i, src += 2, dst += 2) {
pf_src.colorToRGB(READ_UINT16(src), r, g, b);
WRITE_UINT16(dst, pf_dst.RGBToColor(r, g, b));
}
byte *p = _mouse_texture_palette->palette() + _mouse_keycolor * 2;
WRITE_UINT16(p, READ_UINT16(p) & ~1);
}
_use_mouse_palette = !disable;
}
开发者ID:shailendji,项目名称:nefertiti,代码行数:27,代码来源:gfx.cpp
示例3: mpeg_util_parse_sequence_hdr
gboolean
mpeg_util_parse_sequence_hdr (MPEGSeqHdr * hdr, GstBuffer * buffer)
{
GstBitReader reader = GST_BIT_READER_INIT_FROM_BUFFER (buffer);
guint8 dar_idx, par_idx;
guint8 load_intra_flag, load_non_intra_flag;
/* skip sync word */
if (!gst_bit_reader_skip (&reader, 8 * 4))
return FALSE;
/* resolution */
READ_UINT16 (&reader, hdr->width, 12);
READ_UINT16 (&reader, hdr->height, 12);
/* aspect ratio */
READ_UINT8 (&reader, dar_idx, 4);
set_par_from_dar (hdr, dar_idx);
/* framerate */
READ_UINT8 (&reader, par_idx, 4);
set_fps_from_code (hdr, par_idx);
/* bitrate */
READ_UINT32 (&reader, hdr->bitrate, 18);
if (!gst_bit_reader_skip (&reader, 1))
return FALSE;
/* VBV buffer size */
READ_UINT16 (&reader, hdr->vbv_buffer, 10);
/* constrained parameters flag */
READ_UINT8 (&reader, hdr->constrained_parameters_flag, 1);
/* intra quantizer matrix */
READ_UINT8 (&reader, load_intra_flag, 1);
if (load_intra_flag) {
gint i;
for (i = 0; i < 64; i++)
READ_UINT8 (&reader, hdr->intra_quantizer_matrix[mpeg_zigzag_8x8[i]], 8);
} else
memcpy (hdr->intra_quantizer_matrix, default_intra_quantizer_matrix, 64);
/* non intra quantizer matrix */
READ_UINT8 (&reader, load_non_intra_flag, 1);
if (load_non_intra_flag) {
gint i;
for (i = 0; i < 64; i++)
READ_UINT8 (&reader, hdr->non_intra_quantizer_matrix[mpeg_zigzag_8x8[i]],
8);
} else
memset (hdr->non_intra_quantizer_matrix, 16, 64);
return TRUE;
error:
GST_WARNING ("error parsing \"Sequence Header\"");
return FALSE;
}
开发者ID:ChinnaSuhas,项目名称:ossbuild,代码行数:60,代码来源:mpegutil.c
示例4: WRITE_UINT16
void Transport::nfcGetRecordInfo(size_t recordNumber, uint16_t* pType, uint16_t* info, size_t infoCount)
{
uint8_t out[2];
uint8_t in[2+2*infoCount];
WRITE_UINT16(&out[0], recordNumber);
command(Transport::NFC_GET_RECORD_INFO, out, sizeof(out), in, sizeof(in));
READ_UINT16(&in[0], *pType);
for(int i = 0; i < infoCount; i++)
{
READ_UINT16(&in[2+2*i], info[i]);
}
}
开发者ID:AppNearMe,项目名称:micronfcboard-arduino-peripheral,代码行数:12,代码来源:transport.cpp
示例5: READ_UINT16
void Surface::scaleTransparentCopy(const Common::Rect &srcRect, const Common::Rect &dstRect) const {
// I'm doing simple linear scaling here
// dstRect(x, y) = srcRect(x * srcW / dstW, y * srcH / dstH);
Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getCurSurface();
int srcW = srcRect.width();
int srcH = srcRect.height();
int dstW = dstRect.width();
int dstH = dstRect.height();
for (int y = 0; y < dstH; y++) {
for (int x = 0; x < dstW; x++) {
if (g_system->getScreenFormat().bytesPerPixel == 2) {
uint16 color = READ_UINT16((byte *)_surface->getBasePtr(
x * srcW / dstW + srcRect.left,
y * srcH / dstH + srcRect.top));
if (!isTransparent(color))
WRITE_UINT16((byte *)screen->getBasePtr(x + dstRect.left, y + dstRect.top), color);
} else if (g_system->getScreenFormat().bytesPerPixel == 4) {
uint32 color = READ_UINT32((byte *)_surface->getBasePtr(
x * srcW / dstW + srcRect.left,
y * srcH / dstH + srcRect.top));
if (!isTransparent(color))
WRITE_UINT32((byte *)screen->getBasePtr(x + dstRect.left, y + dstRect.top), color);
}
}
}
}
开发者ID:AlbanBedel,项目名称:scummvm,代码行数:29,代码来源:surface.cpp
示例6: hwTimer32ClearEvent
void hwTimer32ClearEvent(soc_timer32_num_t timer_num)
{
unsigned int module = timer32_module(timer_num);
unsigned int timer = timer32_in_module(timer_num);
#ifdef B4860_FAMILY
uint16_t reg;
#endif
#ifdef HW_TIMER_ERROR_CHECKING
if (timer_num >= NUM_OF_HW_TIMERS_32b)
{
#ifdef HW_TIMER_ERROR_ASSERT
OS_ASSERT;
#endif /* HW_TIMER_ERROR_ASSERT */
return;
}
#endif /* HW_TIMER_ERROR_CHECKING */
#ifdef B4860_FAMILY
CLEAR_UINT16(soc_timer32_module[module].tmr[timer].tmr_sctl, TMR32_SCTL_TCF);
DBAR_SCFG();
READ_UINT16(reg, soc_timer32_module[module].tmr[timer].tmr_sctl);
#else
CLEAR_UINT32(soc_timer32_module[module].tmr[timer].tmr_sctl, TMR32_SCTL_TCF);
#endif //B4860_FAMILY
}
开发者ID:lanxinyu003,项目名称:DD_ARCH_BSC9131,代码行数:26,代码来源:hw_timers32.c
示例7: READ_UINT16
void CloudIcon::makeAlphaIcon(const Graphics::Surface &icon, float alpha) {
_alphaIcon.copyFrom(icon);
byte *pixels = (byte *)_alphaIcon.getPixels();
for (int y = 0; y < _alphaIcon.h; y++) {
byte *row = pixels + y * _alphaIcon.pitch;
for (int x = 0; x < _alphaIcon.w; x++) {
uint32 srcColor;
if (_alphaIcon.format.bytesPerPixel == 2)
srcColor = READ_UINT16(row);
else if (_alphaIcon.format.bytesPerPixel == 3)
srcColor = READ_UINT24(row);
else
srcColor = READ_UINT32(row);
// Update color's alpha
byte r, g, b, a;
_alphaIcon.format.colorToARGB(srcColor, a, r, g, b);
a = (byte)(a * alpha);
uint32 color = _alphaIcon.format.ARGBToColor(a, r, g, b);
if (_alphaIcon.format.bytesPerPixel == 2)
*((uint16 *)row) = color;
else
*((uint32 *)row) = color;
row += _alphaIcon.format.bytesPerPixel;
}
}
}
开发者ID:86400,项目名称:scummvm,代码行数:30,代码来源:cloudicon.cpp
示例8: parse_uint16
/* Used by client_x11.c, for parsing xauth */
int
parse_uint16(struct simple_buffer *buffer, uint32_t *result)
{
if (LEFT < 2)
return 0;
*result = READ_UINT16(HERE);
ADVANCE(2);
return 1;
}
开发者ID:jeremyfrench,项目名称:lsh,代码行数:11,代码来源:parse.c
示例9: READ_LE_UINT16
void FlicDecoder::FlicVideoTrack::decodeDeltaFLC(uint8 *data) {
uint16 linesInChunk = READ_LE_UINT16(data); data += 2;
uint16 currentLine = 0;
uint16 packetCount = 0;
while (linesInChunk--) {
uint16 opcode;
// First process all the opcodes.
do {
opcode = READ_LE_UINT16(data); data += 2;
switch ((opcode >> 14) & 3) {
case OP_PACKETCOUNT:
packetCount = opcode;
break;
case OP_UNDEFINED:
break;
case OP_LASTPIXEL:
*((byte *)_surface->getBasePtr(getWidth() - 1, currentLine)) = (opcode & 0xFF);
_dirtyRects.push_back(Common::Rect(getWidth() - 1, currentLine, getWidth(), currentLine + 1));
break;
case OP_LINESKIPCOUNT:
currentLine += -(int16)opcode;
break;
}
} while (((opcode >> 14) & 3) != OP_PACKETCOUNT);
uint16 column = 0;
// Now interpret the RLE data
while (packetCount--) {
column += *data++;
int rleCount = (int8)*data++;
if (rleCount > 0) {
memcpy((byte *)_surface->getBasePtr(column, currentLine), data, rleCount * 2);
data += rleCount * 2;
_dirtyRects.push_back(Common::Rect(column, currentLine, column + rleCount * 2, currentLine + 1));
} else if (rleCount < 0) {
rleCount = -rleCount;
uint16 dataWord = READ_UINT16(data); data += 2;
for (int i = 0; i < rleCount; ++i) {
WRITE_UINT16((byte *)_surface->getBasePtr(column + i * 2, currentLine), dataWord);
}
_dirtyRects.push_back(Common::Rect(column, currentLine, column + rleCount * 2, currentLine + 1));
} else { // End of cutscene ?
return;
}
column += rleCount * 2;
}
currentLine++;
}
}
开发者ID:BenCastricum,项目名称:scummvm,代码行数:54,代码来源:flic_decoder.cpp
示例10: WRITE_UINT16
void OSystem_Android::setCursorPaletteInternal(const byte *colors,
uint start, uint num) {
const Graphics::PixelFormat &pf =
_mouse_texture_palette->getPalettePixelFormat();
byte *p = _mouse_texture_palette->palette() + start * 2;
for (uint i = 0; i < num; ++i, colors += 3, p += 2)
WRITE_UINT16(p, pf.RGBToColor(colors[0], colors[1], colors[2]));
p = _mouse_texture_palette->palette() + _mouse_keycolor * 2;
WRITE_UINT16(p, READ_UINT16(p) & ~1);
}
开发者ID:Akz-,项目名称:residual,代码行数:12,代码来源:gfx.cpp
示例11: command
void Transport::nfcDecodePrefix(uint8_t prefix, char* data, size_t* pDataLength)
{
uint8_t out[] = { prefix };
uint8_t in[2 + 36]; //max prefix length is 36
command(Transport::NFC_DECODE_PREFIX, out, sizeof(out), in, sizeof(in));
size_t length;
READ_UINT16(&in[0], length);
if(length < *pDataLength)
{
*pDataLength = length;
}
memcpy(data, &in[2], *pDataLength);
}
开发者ID:AppNearMe,项目名称:micronfcboard-arduino-peripheral,代码行数:13,代码来源:transport.cpp
示例12: TinyGLBlit
void TinyGLBlit(byte *dst, byte *src, int x, int y, int width, int height, bool trans) {
int srcPitch = width * 2;
int dstPitch = 640 * 2;
int srcX, srcY;
int l, r;
if (x > 639 || y > 479)
return;
if (x < 0) {
srcX = -x;
x = 0;
} else {
srcX = 0;
}
if (y < 0) {
srcY = -y;
y = 0;
} else {
srcY = 0;
}
if (x + width > 640)
width -= (x + width) - 640;
if (y + height > 480)
height -= (y + height) - 480;
dst += (x + (y * 640)) * 2;
src += (srcX + (srcY * width)) * 2;
int copyWidth = width * 2;
if (!trans) {
for (l = 0; l < height; l++) {
memcpy(dst, src, copyWidth);
dst += dstPitch;
src += srcPitch;
}
} else {
for (l = 0; l < height; l++) {
for (r = 0; r < copyWidth; r += 2) {
uint16 pixel = READ_UINT16(src + r);
if (pixel != 0xf81f)
WRITE_UINT16(dst + r, pixel);
}
dst += dstPitch;
src += srcPitch;
}
}
}
开发者ID:gmacon,项目名称:residual,代码行数:51,代码来源:gfx_tinygl.cpp
示例13: pixelFormat16
void SaveLoadManager::convertThumb16To8(Graphics::Surface *thumb16, Graphics::Surface *thumb8) {
thumb8->create(thumb16->w, thumb16->h, Graphics::PixelFormat::createFormatCLUT8());
Graphics::PixelFormat pixelFormat16(2, 5, 6, 5, 0, 11, 5, 0, 0);
byte paletteR[PALETTE_SIZE];
byte paletteG[PALETTE_SIZE];
byte paletteB[PALETTE_SIZE];
for (int palIndex = 0; palIndex < PALETTE_SIZE; ++palIndex) {
uint16 p = READ_UINT16(&_vm->_graphicsMan->_palettePixels[palIndex * 2]);
pixelFormat16.colorToRGB(p, paletteR[palIndex], paletteG[palIndex], paletteB[palIndex]);
}
const uint16 *srcP = (const uint16 *)thumb16->getPixels();
byte *destP = (byte *)thumb8->getPixels();
for (int yp = 0; yp < thumb16->h; ++yp) {
const uint16 *lineSrcP = srcP;
byte *lineDestP = destP;
for (int xp = 0; xp < thumb16->w; ++xp) {
byte r, g, b;
pixelFormat16.colorToRGB(*lineSrcP++, r, g, b);
// Do like in the original and show thumbnail as a grayscale picture
int lum = (r * 21 + g * 72 + b * 7) / 100;
r = g = b = lum;
// Scan the palette for the closest match
int difference = 99999, foundIndex = 0;
for (int palIndex = 0; palIndex < PALETTE_SIZE; ++palIndex) {
byte rCurrent = paletteR[palIndex];
byte gCurrent = paletteG[palIndex];
byte bCurrent = paletteB[palIndex];
int diff = ABS((int)r - (int)rCurrent) + ABS((int)g - (int)gCurrent) + ABS((int)b - (int)bCurrent);
if (diff < difference) {
difference = diff;
foundIndex = palIndex;
}
}
*lineDestP++ = foundIndex;
}
// Move to the start of the next line
srcP += thumb16->w;
destP += thumb16->w;
}
}
开发者ID:BenCastricum,项目名称:scummvm,代码行数:49,代码来源:saveload.cpp
示例14: ENTER
void OSystem_Android::grabPalette(byte *colors, uint start, uint num) {
ENTER("%p, %u, %u", colors, start, num);
#ifdef USE_RGB_COLOR
assert(_game_texture->hasPalette());
#endif
GLTHREADCHECK;
const Graphics::PixelFormat &pf = _game_texture->getPalettePixelFormat();
const byte *p = _game_texture->palette_const() + start * 2;
for (uint i = 0; i < num; ++i, colors += 3, p += 2)
pf.colorToRGB(READ_UINT16(p), colors[0], colors[1], colors[2]);
}
开发者ID:Akz-,项目名称:residual,代码行数:15,代码来源:gfx.cpp
示例15: mpeg_util_parse_sequence_extension
gboolean
mpeg_util_parse_sequence_extension (MPEGSeqExtHdr * hdr, GstBuffer * buffer)
{
GstBitReader reader = GST_BIT_READER_INIT_FROM_BUFFER (buffer);;
/* skip sync word */
if (!gst_bit_reader_skip (&reader, 8 * 4))
return FALSE;
/* skip extension code */
if (!gst_bit_reader_skip (&reader, 4))
return FALSE;
/* skip profile and level escape bit */
if (!gst_bit_reader_skip (&reader, 1))
return FALSE;
READ_UINT8 (&reader, hdr->profile, 3);
READ_UINT8 (&reader, hdr->level, 4);
/* progressive */
READ_UINT8 (&reader, hdr->progressive, 1);
/* chroma format */
READ_UINT8 (&reader, hdr->chroma_format, 2);
/* resolution extension */
READ_UINT8 (&reader, hdr->horiz_size_ext, 2);
READ_UINT8 (&reader, hdr->vert_size_ext, 2);
READ_UINT16 (&reader, hdr->bitrate_ext, 12);
/* skip to framerate extension */
if (!gst_bit_reader_skip (&reader, 9))
return FALSE;
/* framerate extension */
READ_UINT8 (&reader, hdr->fps_n_ext, 2);
READ_UINT8 (&reader, hdr->fps_d_ext, 2);
return TRUE;
error:
GST_WARNING ("error parsing \"Sequence Extension\"");
return FALSE;
}
开发者ID:ChinnaSuhas,项目名称:ossbuild,代码行数:46,代码来源:mpegutil.c
示例16: sexp_iterator_get_uint32
int
sexp_iterator_get_uint32(struct sexp_iterator *iterator,
uint32_t *x)
{
if (iterator->type == SEXP_ATOM
&& !iterator->display
&& iterator->atom_length
&& iterator->atom[0] < 0x80)
{
size_t length = iterator->atom_length;
const uint8_t *p = iterator->atom;
/* Skip leading zeros. */
while(length && !*p)
{
length--;
p++;
}
switch(length)
{
case 0:
*x = 0;
break;
case 1:
*x = p[0];
break;
case 2:
*x = READ_UINT16(p);
break;
case 3:
*x = READ_UINT24(p);
break;
case 4:
*x = READ_UINT32(p);
break;
default:
return 0;
}
return sexp_iterator_next(iterator);
}
return 0;
}
开发者ID:GrangerHub,项目名称:tremulous-launcher,代码行数:43,代码来源:sexp.c
示例17: drawCharIntern
void drawCharIntern(byte *ptr, uint pitch, const bitmap_t *src, int h, int minX, int maxX, const PixelType color) {
const bitmap_t maxXMask = ~((1 << (16-maxX)) - 1);
while (h-- > 0) {
bitmap_t buffer = READ_UINT16(src);
src++;
buffer &= maxXMask;
buffer <<= minX;
PixelType *tmp = (PixelType *)ptr;
while (buffer != 0) {
if ((buffer & 0x8000) != 0)
*tmp = color;
tmp++;
buffer <<= 1;
}
ptr += pitch;
}
}
开发者ID:St0rmcrow,项目名称:scummvm,代码行数:19,代码来源:font.cpp
示例18: while
bool SaveConverter::swapDataEndian(byte *data, const byte *sizes, uint32 count) {
if (!data || !sizes || (count == 0))
return false;
while (count-- > 0) {
if (*sizes == 3) // 32bit value (3 additional bytes)
WRITE_UINT32(data, SWAP_BYTES_32(READ_UINT32(data)));
else if (*sizes == 1) // 16bit value (1 additional byte)
WRITE_UINT16(data, SWAP_BYTES_16(READ_UINT16(data)));
else if (*sizes != 0) // else, it has to be an 8bit value
return false;
count -= *sizes;
data += *sizes + 1;
sizes += *sizes + 1;
}
return true;
}
开发者ID:peres,项目名称:scummvm,代码行数:19,代码来源:saveconverter.cpp
示例19: grabScreen565
/**
* Copies the current screen contents to a new surface, using RGB565 format.
* WARNING: surf->free() must be called by the user to avoid leaking.
*
* @param surf the surface to store the data in it
*/
static bool grabScreen565(Graphics::Surface *surf) {
Graphics::Surface *screen = g_system->lockScreen();
if (!screen)
return false;
assert(screen->format.bytesPerPixel == 1 || screen->format.bytesPerPixel == 2);
assert(screen->getPixels() != 0);
Graphics::PixelFormat screenFormat = g_system->getScreenFormat();
surf->create(screen->w, screen->h, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
byte *palette = 0;
if (screenFormat.bytesPerPixel == 1) {
palette = new byte[256 * 3];
assert(palette);
g_system->getPaletteManager()->grabPalette(palette, 0, 256);
}
for (uint y = 0; y < screen->h; ++y) {
for (uint x = 0; x < screen->w; ++x) {
byte r = 0, g = 0, b = 0;
if (screenFormat.bytesPerPixel == 1) {
uint8 pixel = *(uint8 *)screen->getBasePtr(x, y);
r = palette[pixel * 3 + 0];
g = palette[pixel * 3 + 1];
b = palette[pixel * 3 + 2];
} else if (screenFormat.bytesPerPixel == 2) {
uint16 col = READ_UINT16(screen->getBasePtr(x, y));
screenFormat.colorToRGB(col, r, g, b);
}
*((uint16 *)surf->getBasePtr(x, y)) = Graphics::RGBToColor<Graphics::ColorMasks<565> >(r, g, b);
}
}
delete[] palette;
g_system->unlockScreen();
return true;
}
开发者ID:MaddTheSane,项目名称:scummvm,代码行数:48,代码来源:thumbnail_intern.cpp
示例20: dw_getPixel
Uint32 dw_getPixel(SDL_Surface *s, Uint16 x, Uint16 y) {
assert(s);
assert(x < s->w && y < s->h);
Uint32 bpp = s->format->BytesPerPixel;
Uint8 *p = (Uint8 *)s->pixels + (y * s->pitch) + (x * bpp);
Uint32 pix;
switch (bpp) {
case 1: // b/w
return *p;
case 2: // 16 bit per pixel
return READ_UINT16(p);
case 3:
pix = p[0] << 24 | p[1] << 16 | p[0] << 0;
return READ_UINT32(&pix);
case 4:
return READ_UINT32(p);
default: // !?!?
return 0;
}
}
开发者ID:hkzlab,项目名称:YaGOL,代码行数:22,代码来源:drawing_base.c
注:本文中的READ_UINT16函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论