From 21dfa9d19a3398298a6647a60f20e6e6444f7322 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Sat, 4 Dec 2010 14:16:19 -0600 Subject: [PATCH] clean up padded buffer size calculations --- src/gstducatih264dec.c | 2 +- src/gstducatimpeg4dec.c | 2 +- src/gstducativc1dec.c | 4 ++-- src/gstducativp6dec.c | 2 +- src/gstducativp7dec.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gstducatih264dec.c b/src/gstducatih264dec.c index af7ddc2..88ebb57 100644 --- a/src/gstducatih264dec.c +++ b/src/gstducatih264dec.c @@ -67,7 +67,7 @@ gst_ducati_h264dec_update_buffer_size (GstDucatiVidDec * self) gint h = self->height; /* calculate output buffer parameters: */ - self->padded_width = (w + (2 * PADX) + 127) & 0xFFFFFF80; + self->padded_width = ALIGN2 (w + (2 * PADX), 7); self->padded_height = h + 4 * PADY; self->min_buffers = MIN (16, 32768 / ((w / 16) * (h / 16))) + 3; } diff --git a/src/gstducatimpeg4dec.c b/src/gstducatimpeg4dec.c index 4c79044..7c16547 100644 --- a/src/gstducatimpeg4dec.c +++ b/src/gstducatimpeg4dec.c @@ -79,7 +79,7 @@ gst_ducati_mpeg4dec_update_buffer_size (GstDucatiVidDec * self) gint h = self->height; /* calculate output buffer parameters: */ - self->padded_width = (w + PADX + 0x7f) & ~0x7f; + self->padded_width = ALIGN2 (w + PADX, 7); self->padded_height = h + PADY; self->min_buffers = 8; } diff --git a/src/gstducativc1dec.c b/src/gstducativc1dec.c index ace7baf..5d56015 100644 --- a/src/gstducativc1dec.c +++ b/src/gstducativc1dec.c @@ -100,8 +100,8 @@ gst_ducati_vc1dec_update_buffer_size (GstDucatiVidDec * self) gint h = self->height; /* calculate output buffer parameters: */ - self->padded_width = (w + (2 * PADX) + 0x7f) & ~0x7f; - self->padded_height = (((h / 2 + 0xf) & ~0xf) * 2) + 2 * PADY; + self->padded_width = ALIGN2 (w + (2 * PADX), 7); + self->padded_height = (ALIGN2 (h / 2, 4) * 2) + 2 * PADY; self->min_buffers = 8; } diff --git a/src/gstducativp6dec.c b/src/gstducativp6dec.c index b497efb..ec9be8f 100644 --- a/src/gstducativp6dec.c +++ b/src/gstducativp6dec.c @@ -65,7 +65,7 @@ gst_ducati_vp6dec_update_buffer_size (GstDucatiVidDec * self) gint h = self->height; /* calculate output buffer parameters: */ - self->padded_width = (w + (2 * PADX) + 0x7f) & ~0x7f; + self->padded_width = ALIGN2 (w + (2 * PADX), 7); self->padded_height = h + 2 * PADY; self->min_buffers = 8; } diff --git a/src/gstducativp7dec.c b/src/gstducativp7dec.c index b3b30ed..fdad19a 100644 --- a/src/gstducativp7dec.c +++ b/src/gstducativp7dec.c @@ -65,7 +65,7 @@ gst_ducati_vp7dec_update_buffer_size (GstDucatiVidDec * self) gint h = self->height; /* calculate output buffer parameters: */ - self->padded_width = (w + (2 * PADX) + 0x7f) & ~0x7f; + self->padded_width = ALIGN2 (w + (2 * PADX), 7); self->padded_height = h + 2 * PADY; self->min_buffers = 8; } -- 2.39.2