comparison bmp.c @ 7908:dc825905f93f libavcodec

Calculate line size correctly for bit depths < 8
author kostya
date Tue, 23 Sep 2008 08:32:18 +0000
parents 44da2504ce69
children 9fd3f57e4c16
comparison
equal deleted inserted replaced
7907:8eb69709a934 7908:dc825905f93f
173 173
174 buf = buf0 + hsize; 174 buf = buf0 + hsize;
175 dsize = buf_size - hsize; 175 dsize = buf_size - hsize;
176 176
177 /* Line size in file multiple of 4 */ 177 /* Line size in file multiple of 4 */
178 n = (avctx->width * (depth / 8) + 3) & ~3; 178 n = ((avctx->width * depth) / 8 + 3) & ~3;
179 179
180 if(n * avctx->height > dsize){ 180 if(n * avctx->height > dsize){
181 av_log(avctx, AV_LOG_ERROR, "not enough data (%d < %d)\n", 181 av_log(avctx, AV_LOG_ERROR, "not enough data (%d < %d)\n",
182 dsize, n * avctx->height); 182 dsize, n * avctx->height);
183 return -1; 183 return -1;