[libav-devel] [PATCH 1/2] flashsv: K&R cosmetics formatting

Luca Barbato lu_zero at gentoo.org
Tue Oct 29 20:42:15 CET 2013


---
 libavcodec/flashsv.c | 37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)

diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c
index e9749fe..789e6ec 100644
--- a/libavcodec/flashsv.c
+++ b/libavcodec/flashsv.c
@@ -76,7 +76,7 @@ static int decode_hybrid(const uint8_t *sptr, uint8_t *dptr, int dx, int dy,
     int x, y;
     const uint8_t *orig_src = sptr;
 
-    for (y = dx+h; y > dx; y--) {
+    for (y = dx + h; y > dx; y--) {
         uint8_t *dst = dptr + (y * stride) + dy * 3;
         for (x = 0; x < w; x++) {
             if (*sptr & 0x80) {
@@ -194,8 +194,8 @@ static int flashsv_decode_block(AVCodecContext *avctx, AVPacket *avpkt,
     }
 
     if (s->is_keyframe) {
-        s->blocks[blk_idx].pos      = s->keyframedata + (get_bits_count(gb) / 8);
-        s->blocks[blk_idx].size     = block_size;
+        s->blocks[blk_idx].pos  = s->keyframedata + (get_bits_count(gb) / 8);
+        s->blocks[blk_idx].size = block_size;
     }
     if (!s->color_depth) {
         /* Flash Screen Video stores the image upside down, so copy
@@ -237,8 +237,8 @@ static int calc_deflate_block_size(int tmpblock_size)
 static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
                                 int *got_frame, AVPacket *avpkt)
 {
-    int buf_size       = avpkt->size;
-    FlashSVContext *s  = avctx->priv_data;
+    int buf_size      = avpkt->size;
+    FlashSVContext *s = avctx->priv_data;
     int h_blocks, v_blocks, h_part, v_part, i, j, ret;
     GetBitContext gb;
 
@@ -281,18 +281,22 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
 
         s->tmpblock = av_realloc(s->tmpblock, tmpblock_size);
         if (!s->tmpblock) {
-            av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
+            av_log(avctx, AV_LOG_ERROR,
+                   "Cannot allocate decompression buffer.\n");
             return AVERROR(ENOMEM);
         }
         if (s->ver == 2) {
             s->deflate_block_size = calc_deflate_block_size(tmpblock_size);
             if (s->deflate_block_size <= 0) {
-                av_log(avctx, AV_LOG_ERROR, "Can't determine deflate buffer size.\n");
+                av_log(avctx, AV_LOG_ERROR,
+                       "Cannot determine deflate buffer size.\n");
                 return -1;
             }
-            s->deflate_block = av_realloc(s->deflate_block, s->deflate_block_size);
+            s->deflate_block = av_realloc(s->deflate_block,
+                                          s->deflate_block_size);
             if (!s->deflate_block) {
-                av_log(avctx, AV_LOG_ERROR, "Can't allocate deflate buffer.\n");
+                av_log(avctx, AV_LOG_ERROR,
+                       "Cannot allocate deflate buffer.\n");
                 return AVERROR(ENOMEM);
             }
         }
@@ -320,8 +324,8 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
         s->keyframedata = av_realloc(s->keyframedata, avpkt->size);
         memcpy(s->keyframedata, avpkt->data, avpkt->size);
         s->blocks = av_realloc(s->blocks,
-                               (v_blocks + !!v_part) * (h_blocks + !!h_part)
-                               * sizeof(s->blocks[0]));
+                               (v_blocks + !!v_part) * (h_blocks + !!h_part) *
+                               sizeof(s->blocks[0]));
     }
 
     av_dlog(avctx, "image: %dx%d block: %dx%d num: %dx%d part: %dx%d\n",
@@ -368,14 +372,15 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
 
                 if (s->color_depth != 0 && s->color_depth != 2) {
                     av_log(avctx, AV_LOG_ERROR,
-                           "%dx%d invalid color depth %d\n", i, j, s->color_depth);
+                           "%dx%d invalid color depth %d\n",
+                           i, j, s->color_depth);
                     return AVERROR_INVALIDDATA;
                 }
 
                 if (has_diff) {
                     if (!s->keyframe) {
                         av_log(avctx, AV_LOG_ERROR,
-                               "inter frame without keyframe\n");
+                               "Inter frame without keyframe\n");
                         return AVERROR_INVALIDDATA;
                     }
                     s->diff_start  = get_bits(&gb, 8);
@@ -392,7 +397,8 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
                 if (s->zlibprime_curr) {
                     int col = get_bits(&gb, 8);
                     int row = get_bits(&gb, 8);
-                    av_log(avctx, AV_LOG_DEBUG, "%dx%d zlibprime_curr %dx%d\n", i, j, col, row);
+                    av_log(avctx, AV_LOG_DEBUG, "%dx%d zlibprime_curr %dx%d\n",
+                           i, j, col, row);
                     size -= 2;
                     avpriv_request_sample(avctx, "zlibprime_curr");
                     return AVERROR_PATCHWELCOME;
@@ -434,7 +440,8 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
                 return AVERROR(ENOMEM);
             }
         }
-        memcpy(s->keyframe, s->frame.data[0], s->frame.linesize[0] * avctx->height);
+        memcpy(s->keyframe, s->frame.data[0],
+               s->frame.linesize[0] * avctx->height);
     }
 
     if ((ret = av_frame_ref(data, &s->frame)) < 0)
-- 
1.8.3.2



More information about the libav-devel mailing list