static void vlVdpVideoSurfaceSize(vlVdpSurface *p_surf, int component, unsigned *width, unsigned *height) { *width = p_surf->templat.width; *height = p_surf->templat.height; vl_video_buffer_adjust_size(width, height, component, p_surf->templat.chroma_format, p_surf->templat.interlaced); }
static void vlVaGetBox(struct pipe_video_buffer *buf, unsigned idx, struct pipe_box *box, const VARectangle *region) { unsigned plane = buf->interlaced ? idx / 2: idx; unsigned x, y, width, height; x = abs(region->x); y = abs(region->y); width = region->width; height = region->height; vl_video_buffer_adjust_size(&x, &y, plane, buf->chroma_format, buf->interlaced); vl_video_buffer_adjust_size(&width, &height, plane, buf->chroma_format, buf->interlaced); box->x = region->x < 0 ? -x : x; box->y = region->y < 0 ? -y : y; box->width = width; box->height = height; }
static void vid_dec_FillOutput(vid_dec_PrivateType *priv, struct pipe_video_buffer *buf, OMX_BUFFERHEADERTYPE* output) { omx_base_PortType *port = priv->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX]; OMX_VIDEO_PORTDEFINITIONTYPE *def = &port->sPortParam.format.video; struct pipe_sampler_view **views; unsigned i, j; unsigned width, height; views = buf->get_sampler_view_planes(buf); for (i = 0; i < 2 /* NV12 */; i++) { if (!views[i]) continue; width = def->nFrameWidth; height = def->nFrameHeight; vl_video_buffer_adjust_size(&width, &height, i, buf->chroma_format, buf->interlaced); for (j = 0; j < views[i]->texture->array_size; ++j) { struct pipe_box box = {0, 0, j, width, height, 1}; struct pipe_transfer *transfer; uint8_t *map, *dst; map = priv->pipe->transfer_map(priv->pipe, views[i]->texture, 0, PIPE_TRANSFER_READ, &box, &transfer); if (!map) return; dst = ((uint8_t*)output->pBuffer + output->nOffset) + j * def->nStride + i * def->nFrameWidth * def->nFrameHeight; util_copy_rect(dst, views[i]->texture->format, def->nStride * views[i]->texture->array_size, 0, 0, box.width, box.height, map, transfer->stride, 0, 0); pipe_transfer_unmap(priv->pipe, transfer); } } }