--- gst/ffmpegcolorspace/gstffmpegcodecmap.c
+++ gst/ffmpegcolorspace/gstffmpegcodecmap.c
@@ -586,7 +586,7 @@
 gst_ffmpegcsp_avpicture_fill (AVPicture * picture,
     uint8_t * ptr, enum PixelFormat pix_fmt, int width, int height)
 {
-  int size, w2, h2, size2;
+  int size, size2;
   int stride, stride2;
   PixFmtInfo *pinfo;
 
@@ -601,13 +601,10 @@
     case PIX_FMT_YUVJ420P:
     case PIX_FMT_YUVJ422P:
     case PIX_FMT_YUVJ444P:
-      stride = ROUND_UP_4 (width);
-      h2 = ROUND_UP_X (height, pinfo->y_chroma_shift);
-      size = stride * h2;
-      w2 = DIV_ROUND_UP_X (width, pinfo->x_chroma_shift);
-      stride2 = ROUND_UP_4 (w2);
-      h2 = DIV_ROUND_UP_X (height, pinfo->y_chroma_shift);
-      size2 = stride2 * h2;
+      stride = width;
+      size = stride * height;
+      stride2 = width / 2;
+      size2 = stride2 * height / 2;
       picture->data[0] = ptr;
       picture->data[1] = picture->data[0] + size;
       picture->data[2] = picture->data[1] + size2;
