changeset 35148:89660feadcce

Add necessary checks to the vd_hmblck input. The code assumes the input image contains whole macroblocks (16x16). Since same thing applies to the downsampled chroma channels, the final requirement is the image to be multiple of 32. Also, add explicit pixel format check at init.
author iive
date Thu, 11 Oct 2012 22:06:42 +0000
parents 4d8d26a9d66a
children fbe4b3716aa0
files libmpcodecs/vd_hmblck.c
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_hmblck.c	Thu Oct 11 21:50:18 2012 +0000
+++ b/libmpcodecs/vd_hmblck.c	Thu Oct 11 22:06:42 2012 +0000
@@ -82,6 +82,14 @@
  * init driver
  */
 static int init(sh_video_t *sh){
+
+    if(sh->format != IMGFMT_HM12) return 0;
+
+    if((sh->disp_w&31) != 0 || (sh->disp_h&31) != 0) {
+        mp_msg(MSGT_DECVIDEO, MSGL_ERR,
+               "hmblck: Image size must be multiple of 32.\n");
+        return 0;
+    }
     return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,sh->format);
 }
 /*************************************************************************