[FFmpeg-devel] [PATCH 5/7] utvideoenc: drop step

Michael Niedermayer michaelni at gmx.at
Wed Aug 22 16:26:47 CEST 2012


Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavcodec/utvideoenc.c |   30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/libavcodec/utvideoenc.c b/libavcodec/utvideoenc.c
index ca89c71..ee3ed83 100644
--- a/libavcodec/utvideoenc.c
+++ b/libavcodec/utvideoenc.c
@@ -225,13 +225,13 @@ static void mangle_rgb_planes(uint8_t *dst[4], uint8_t *src, int step, int strid
 }
 
 /* Write data to a plane, no prediction applied */
-static void write_plane(uint8_t *src, uint8_t *dst, int step, int stride,
+static void write_plane(uint8_t *src, uint8_t *dst, int stride,
                         int width, int height)
 {
     int i, j;
 
     for (j = 0; j < height; j++) {
-        for (i = 0; i < width * step; i += step)
+        for (i = 0; i < width; i ++)
             *dst++ = src[i];
 
         src += stride;
@@ -239,7 +239,7 @@ static void write_plane(uint8_t *src, uint8_t *dst, int step, int stride,
 }
 
 /* Write data to a plane with left prediction */
-static void left_predict(uint8_t *src, uint8_t *dst, int step, int stride,
+static void left_predict(uint8_t *src, uint8_t *dst, int stride,
                          int width, int height)
 {
     int i, j;
@@ -247,7 +247,7 @@ static void left_predict(uint8_t *src, uint8_t *dst, int step, int stride,
 
     prev = 0x80; /* Set the initial value */
     for (j = 0; j < height; j++) {
-        for (i = 0; i < width * step; i += step) {
+        for (i = 0; i < width; i ++) {
             *dst++ = src[i] - prev;
             prev   = src[i];
         }
@@ -256,7 +256,7 @@ static void left_predict(uint8_t *src, uint8_t *dst, int step, int stride,
 }
 
 /* Write data to a plane with median prediction */
-static void median_predict(uint8_t *src, uint8_t *dst, int step, int stride,
+static void median_predict(uint8_t *src, uint8_t *dst, int stride,
                            int width, int height)
 {
     int i, j;
@@ -265,7 +265,7 @@ static void median_predict(uint8_t *src, uint8_t *dst, int step, int stride,
 
     /* First line uses left neighbour prediction */
     prev = 0x80; /* Set the initial value */
-    for (i = 0; i < width * step; i += step) {
+    for (i = 0; i < width; i ++) {
         *dst++ = src[i] - prev;
         prev   = src[i];
     }
@@ -282,7 +282,7 @@ static void median_predict(uint8_t *src, uint8_t *dst, int step, int stride,
     C      = src[-stride];
     *dst++ = src[0] - C;
     A      = src[0];
-    for (i = step; i < width * step; i += step) {
+    for (i = 1; i < width; i ++) {
         B       = src[i - stride];
         *dst++  = src[i] - mid_pred(A, B, (A + B - C) & 0xFF);
         C       = B;
@@ -293,7 +293,7 @@ static void median_predict(uint8_t *src, uint8_t *dst, int step, int stride,
 
     /* Rest of the coded part uses median prediction */
     for (j = 2; j < height; j++) {
-        for (i = 0; i < width * step; i += step) {
+        for (i = 0; i < width; i ++) {
             B       = src[i - stride];
             *dst++  = src[i] - mid_pred(A, B, (A + B - C) & 0xFF);
             C       = B;
@@ -372,7 +372,7 @@ static int write_huff_codes(uint8_t *src, uint8_t *dst, int dst_size,
 }
 
 static int encode_plane(AVCodecContext *avctx, uint8_t *src,
-                        uint8_t *dst, int step, int stride,
+                        uint8_t *dst, int stride,
                         int width, int height, PutByteContext *pb)
 {
     UtvideoContext *c        = avctx->priv_data;
@@ -392,7 +392,7 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
             sstart = send;
             send   = height * (i + 1) / c->slices;
             write_plane(src + sstart * stride, dst + sstart * width,
-                        step, stride, width, send - sstart);
+                        stride, width, send - sstart);
         }
         break;
     case PRED_LEFT:
@@ -400,7 +400,7 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
             sstart = send;
             send   = height * (i + 1) / c->slices;
             left_predict(src + sstart * stride, dst + sstart * width,
-                         step, stride, width, send - sstart);
+                         stride, width, send - sstart);
         }
         break;
     case PRED_MEDIAN:
@@ -408,7 +408,7 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
             sstart = send;
             send   = height * (i + 1) / c->slices;
             median_predict(src + sstart * stride, dst + sstart * width,
-                           step, stride, width, send - sstart);
+                           stride, width, send - sstart);
         }
         break;
     default:
@@ -552,7 +552,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     case PIX_FMT_RGBA:
         for (i = 0; i < c->planes; i++) {
             ret = encode_plane(avctx, c->slice_buffer[i] + width,
-                               c->slice_buffer[i], 1, width,
+                               c->slice_buffer[i], width,
                                width, height, &pb);
 
             if (ret) {
@@ -563,7 +563,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
         break;
     case PIX_FMT_YUV422P:
         for (i = 0; i < c->planes; i++) {
-            ret = encode_plane(avctx, pic->data[i], c->slice_buffer[0], 1,
+            ret = encode_plane(avctx, pic->data[i], c->slice_buffer[0],
                                pic->linesize[i], width >> !!i, height, &pb);
 
             if (ret) {
@@ -574,7 +574,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
         break;
     case PIX_FMT_YUV420P:
         for (i = 0; i < c->planes; i++) {
-            ret = encode_plane(avctx, pic->data[i], c->slice_buffer[0], 1,
+            ret = encode_plane(avctx, pic->data[i], c->slice_buffer[0],
                                pic->linesize[i], width >> !!i, height >> !!i,
                                &pb);
 
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list