diff options
author | Christian König <[email protected]> | 2015-12-15 11:51:44 +0100 |
---|---|---|
committer | Christian König <[email protected]> | 2016-01-12 13:28:16 +0100 |
commit | 52ca9a9b8bf9c3991a82d7039d7a35955ad774b8 (patch) | |
tree | 259d72c07ff073f72606bec2bcc7234b39611793 /src/gallium/auxiliary/vl/vl_video_buffer.h | |
parent | 8479782361ab58eeacee7f81b18d9597553859ce (diff) |
vl/buffers: extract vl_video_buffer_adjust_size helper
Useful for the state trackers as well.
Signed-off-by: Christian König <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/vl/vl_video_buffer.h')
-rw-r--r-- | src/gallium/auxiliary/vl/vl_video_buffer.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.h b/src/gallium/auxiliary/vl/vl_video_buffer.h index 488c3cc4eac..8a1c0773fc9 100644 --- a/src/gallium/auxiliary/vl/vl_video_buffer.h +++ b/src/gallium/auxiliary/vl/vl_video_buffer.h @@ -48,6 +48,24 @@ struct vl_video_buffer struct pipe_surface *surfaces[VL_MAX_SURFACES]; }; +static inline void +vl_video_buffer_adjust_size(unsigned *width, unsigned *height, unsigned plane, + enum pipe_video_chroma_format chroma_format, + bool interlaced) +{ + if (interlaced) { + *height /= 2; + } + if (plane > 0) { + if (chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420) { + *width /= 2; + *height /= 2; + } else if (chroma_format == PIPE_VIDEO_CHROMA_FORMAT_422) { + *width /= 2; + } + } +} + /** * get subformats for each plane */ |