@@ -229,29 +229,29 @@ static void mangle_rgb_planes(uint8_t *dst[4], uint8_t *src, int step,
229229}
230230
231231/* Write data to a plane, no prediction applied */
232- static void write_plane (uint8_t * src , uint8_t * dst , int step , int stride ,
232+ static void write_plane (uint8_t * src , uint8_t * dst , int stride ,
233233 int width , int height )
234234{
235235 int i , j ;
236236
237237 for (j = 0 ; j < height ; j ++ ) {
238- for (i = 0 ; i < width * step ; i += step )
238+ for (i = 0 ; i < width ; i ++ )
239239 * dst ++ = src [i ];
240240
241241 src += stride ;
242242 }
243243}
244244
245245/* Write data to a plane with left prediction */
246- static void left_predict (uint8_t * src , uint8_t * dst , int step , int stride ,
246+ static void left_predict (uint8_t * src , uint8_t * dst , int stride ,
247247 int width , int height )
248248{
249249 int i , j ;
250250 uint8_t prev ;
251251
252252 prev = 0x80 ; /* Set the initial value */
253253 for (j = 0 ; j < height ; j ++ ) {
254- for (i = 0 ; i < width * step ; i += step ) {
254+ for (i = 0 ; i < width ; i ++ ) {
255255 * dst ++ = src [i ] - prev ;
256256 prev = src [i ];
257257 }
@@ -260,7 +260,7 @@ static void left_predict(uint8_t *src, uint8_t *dst, int step, int stride,
260260}
261261
262262/* Write data to a plane with median prediction */
263- static void median_predict (uint8_t * src , uint8_t * dst , int step , int stride ,
263+ static void median_predict (uint8_t * src , uint8_t * dst , int stride ,
264264 int width , int height )
265265{
266266 int i , j ;
@@ -269,7 +269,7 @@ static void median_predict(uint8_t *src, uint8_t *dst, int step, int stride,
269269
270270 /* First line uses left neighbour prediction */
271271 prev = 0x80 ; /* Set the initial value */
272- for (i = 0 ; i < width * step ; i += step ) {
272+ for (i = 0 ; i < width ; i ++ ) {
273273 * dst ++ = src [i ] - prev ;
274274 prev = src [i ];
275275 }
@@ -286,7 +286,7 @@ static void median_predict(uint8_t *src, uint8_t *dst, int step, int stride,
286286 C = src [- stride ];
287287 * dst ++ = src [0 ] - C ;
288288 A = src [0 ];
289- for (i = step ; i < width * step ; i += step ) {
289+ for (i = 1 ; i < width ; i ++ ) {
290290 B = src [i - stride ];
291291 * dst ++ = src [i ] - mid_pred (A , B , (A + B - C ) & 0xFF );
292292 C = B ;
@@ -297,7 +297,7 @@ static void median_predict(uint8_t *src, uint8_t *dst, int step, int stride,
297297
298298 /* Rest of the coded part uses median prediction */
299299 for (j = 2 ; j < height ; j ++ ) {
300- for (i = 0 ; i < width * step ; i += step ) {
300+ for (i = 0 ; i < width ; i ++ ) {
301301 B = src [i - stride ];
302302 * dst ++ = src [i ] - mid_pred (A , B , (A + B - C ) & 0xFF );
303303 C = B ;
@@ -376,7 +376,7 @@ static int write_huff_codes(uint8_t *src, uint8_t *dst, int dst_size,
376376}
377377
378378static int encode_plane (AVCodecContext * avctx , uint8_t * src ,
379- uint8_t * dst , int step , int stride ,
379+ uint8_t * dst , int stride ,
380380 int width , int height , PutByteContext * pb )
381381{
382382 UtvideoContext * c = avctx -> priv_data ;
@@ -396,23 +396,23 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
396396 sstart = send ;
397397 send = height * (i + 1 ) / c -> slices ;
398398 write_plane (src + sstart * stride , dst + sstart * width ,
399- step , stride , width , send - sstart );
399+ stride , width , send - sstart );
400400 }
401401 break ;
402402 case PRED_LEFT :
403403 for (i = 0 ; i < c -> slices ; i ++ ) {
404404 sstart = send ;
405405 send = height * (i + 1 ) / c -> slices ;
406406 left_predict (src + sstart * stride , dst + sstart * width ,
407- step , stride , width , send - sstart );
407+ stride , width , send - sstart );
408408 }
409409 break ;
410410 case PRED_MEDIAN :
411411 for (i = 0 ; i < c -> slices ; i ++ ) {
412412 sstart = send ;
413413 send = height * (i + 1 ) / c -> slices ;
414414 median_predict (src + sstart * stride , dst + sstart * width ,
415- step , stride , width , send - sstart );
415+ stride , width , send - sstart );
416416 }
417417 break ;
418418 default :
@@ -556,7 +556,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
556556 case PIX_FMT_RGBA :
557557 for (i = 0 ; i < c -> planes ; i ++ ) {
558558 ret = encode_plane (avctx , c -> slice_buffer [i ] + width ,
559- c -> slice_buffer [i ], 1 , width ,
559+ c -> slice_buffer [i ], width ,
560560 width , height , & pb );
561561
562562 if (ret ) {
@@ -567,7 +567,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
567567 break ;
568568 case PIX_FMT_YUV422P :
569569 for (i = 0 ; i < c -> planes ; i ++ ) {
570- ret = encode_plane (avctx , pic -> data [i ], c -> slice_buffer [0 ], 1 ,
570+ ret = encode_plane (avctx , pic -> data [i ], c -> slice_buffer [0 ],
571571 pic -> linesize [i ], width >> !!i , height , & pb );
572572
573573 if (ret ) {
@@ -578,7 +578,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
578578 break ;
579579 case PIX_FMT_YUV420P :
580580 for (i = 0 ; i < c -> planes ; i ++ ) {
581- ret = encode_plane (avctx , pic -> data [i ], c -> slice_buffer [0 ], 1 ,
581+ ret = encode_plane (avctx , pic -> data [i ], c -> slice_buffer [0 ],
582582 pic -> linesize [i ], width >> !!i , height >> !!i ,
583583 & pb );
584584
0 commit comments