Browse code

rtpenc_jpeg: handle case of picture dimensions not dividing by 8

This fixes the calculation of the number of needed blocks to make
sure that ALL pixels are represented by the result.

Reviewed-by: Thomas Volkert <silvo@gmx.net>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7f64a7503b19b39f1251e4380987034c569bebf5)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Andrey Utkin authored on 2015/04/11 06:54:10
Showing 1 changed files
... ...
@@ -40,8 +40,8 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t *buf, int size)
40 40
     s->timestamp = s->cur_timestamp;
41 41
 
42 42
     /* convert video pixel dimensions from pixels to blocks */
43
-    w = s1->streams[0]->codec->width  >> 3;
44
-    h = s1->streams[0]->codec->height >> 3;
43
+    w = FF_CEIL_RSHIFT(s1->streams[0]->codec->width, 3);
44
+    h = FF_CEIL_RSHIFT(s1->streams[0]->codec->height, 3);
45 45
 
46 46
     /* get the pixel format type or fail */
47 47
     if (s1->streams[0]->codec->pix_fmt == AV_PIX_FMT_YUVJ422P ||