static void GLAPIENTRY VertexAttrib2NsvARB(GLuint index, const GLshort *v) { CALL_VertexAttrib2fARB(GET_DISPATCH(), (index, SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]))); }
static void GLAPIENTRY VertexAttrib4NsvNV(GLuint index, const GLshort *v) { GL_CALL(VertexAttrib4fNV)(index, SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), SHORT_TO_FLOAT(v[2]), SHORT_TO_FLOAT(v[3])); }
static void GLAPIENTRY VertexAttrib4Nsv(GLuint index, const GLshort *v) { _glapi_Dispatch->VertexAttrib4fNV(index, SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]), SHORT_TO_FLOAT(v[2]), SHORT_TO_FLOAT(v[3])); }
/** For ADD/MULT */ static void accum_mad(GLcontext *ctx, GLfloat scale, GLfloat bias, GLint xpos, GLint ypos, GLint width, GLint height, struct st_renderbuffer *acc_strb) { size_t stride = acc_strb->stride; GLubyte *data = acc_strb->data; switch (acc_strb->format) { case PIPE_FORMAT_R16G16B16A16_SNORM: { int i, j; for (i = 0; i < height; i++) { GLshort *acc = (GLshort *) (data + (ypos + i) * stride + xpos * 8); for (j = 0; j < width * 4; j++) { float val = SHORT_TO_FLOAT(*acc) * scale + bias; *acc++ = FLOAT_TO_SHORT(val); } } } break; default: _mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()"); } }
void aubio_source_apple_audio_do_multi(aubio_source_apple_audio_t *s, fmat_t * read_to, uint_t * read) { UInt32 c, v, loadedPackets = s->block_size; OSStatus err = ExtAudioFileRead(s->audioFile, &loadedPackets, &s->bufferList); if (err) { AUBIO_ERROR("source_apple_audio: error in ExtAudioFileRead, %d\n", (int)err); goto beach;} short *data = (short*)s->bufferList.mBuffers[0].mData; smpl_t **buf = read_to->data; for (v = 0; v < loadedPackets; v++) { for (c = 0; c < s->channels; c++) { buf[c][v] = SHORT_TO_FLOAT(data[ v * s->channels + c]); } } // short read, fill with zeros if (loadedPackets < s->block_size) { for (v = loadedPackets; v < s->block_size; v++) { for (c = 0; c < s->channels; c++) { buf[c][v] = 0.; } } } *read = (uint_t)loadedPackets; return; beach: *read = 0; return; }
static void accum_return(GLcontext *ctx, GLfloat value, GLint xpos, GLint ypos, GLint width, GLint height, struct st_renderbuffer *acc_strb, struct st_renderbuffer *color_strb) { struct pipe_context *pipe = ctx->st->pipe; struct pipe_screen *screen = pipe->screen; const GLubyte *colormask = ctx->Color.ColorMask; enum pipe_transfer_usage usage; struct pipe_transfer *color_trans; size_t stride = acc_strb->stride; const GLubyte *data = acc_strb->data; GLfloat *buf; if (ST_DEBUG & DEBUG_FALLBACK) debug_printf("%s: fallback processing\n", __FUNCTION__); buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); if (!colormask[0] || !colormask[1] || !colormask[2] || !colormask[3]) usage = PIPE_TRANSFER_READ_WRITE; else usage = PIPE_TRANSFER_WRITE; color_trans = st_cond_flush_get_tex_transfer(st_context(ctx), color_strb->texture, 0, 0, 0, usage, xpos, ypos, width, height); if (usage & PIPE_TRANSFER_READ) pipe_get_tile_rgba(color_trans, 0, 0, width, height, buf); switch (acc_strb->format) { case PIPE_FORMAT_R16G16B16A16_SNORM: { GLfloat *color = buf; int i, j, ch; for (i = 0; i < height; i++) { const GLshort *acc = (const GLshort *) (data + (ypos + i) * stride + xpos * 8); for (j = 0; j < width; j++) { for (ch = 0; ch < 4; ch++) { if (colormask[ch]) { GLfloat val = SHORT_TO_FLOAT(*acc * value); *color = CLAMP(val, 0.0f, 1.0f); } else { /* No change */ } ++acc; ++color; } } } } break; default: _mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()"); } pipe_put_tile_rgba(color_trans, 0, 0, width, height, buf); _mesa_free(buf); screen->tex_transfer_destroy(color_trans); }