Useful for the state trackers as well.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
templ->bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
templ->usage = usage;
- if (plane > 0) {
- if (tmpl->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420) {
- templ->width0 /= 2;
- templ->height0 /= 2;
- } else if (tmpl->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_422) {
- templ->width0 /= 2;
- }
- }
+ vl_video_buffer_adjust_size(&templ->width0, &templ->height0, plane,
+ tmpl->chroma_format, false);
}
static void
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
*/