[FFmpeg-devel] [PATCH 4/4] targa: cosmetics - add some whitespace

Bobby Bingham uhmmmm at gmail.com
Mon Oct 8 07:41:21 CEST 2012


Signed-off-by: Bobby Bingham <uhmmmm at gmail.com>
---
 libavcodec/targa.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/libavcodec/targa.c b/libavcodec/targa.c
index dd30a41..0dc4203 100644
--- a/libavcodec/targa.c
+++ b/libavcodec/targa.c
@@ -150,7 +150,7 @@ static int decode_frame(AVCodecContext *avctx,
     // skip identifier if any
     bytestream2_skip(&s->gb, idlen);
 
-    switch(bpp){
+    switch(bpp) {
     case 8:
         avctx->pix_fmt = ((compr & (~TGA_RLE)) == TGA_BW) ? PIX_FMT_GRAY8 : PIX_FMT_PAL8;
         break;
@@ -180,10 +180,11 @@ static int decode_frame(AVCodecContext *avctx,
         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
         return -1;
     }
+
     if(flags & TGA_TOPTOBOTTOM) {
         dst = p->data[0];
         stride = p->linesize[0];
-    }else{ //image is upside-down
+    } else { //image is upside-down
         dst = p->data[0] + p->linesize[0] * (h - 1);
         stride = -p->linesize[0];
     }
@@ -191,7 +192,7 @@ static int decode_frame(AVCodecContext *avctx,
     interleave = flags & TGA_INTERLEAVE2 ? 2 :
                  flags & TGA_INTERLEAVE4 ? 4 : 1;
 
-    if(colors){
+    if(colors) {
         int pal_size, pal_sample_size;
         if((colors + first_clr) > 256){
             av_log(avctx, AV_LOG_ERROR, "Incorrect palette: %i colors with offset %i\n", colors, first_clr);
@@ -206,9 +207,9 @@ static int decode_frame(AVCodecContext *avctx,
             return -1;
         }
         pal_size = colors * pal_sample_size;
-        if(avctx->pix_fmt != PIX_FMT_PAL8)//should not occur but skip palette anyway
+        if(avctx->pix_fmt != PIX_FMT_PAL8) //should not occur but skip palette anyway
             bytestream2_skip(&s->gb, pal_size);
-        else{
+        else {
             int t;
             uint32_t *pal = ((uint32_t *)p->data[1]) + first_clr;
 
@@ -239,10 +240,11 @@ static int decode_frame(AVCodecContext *avctx,
             p->palette_has_changed = 1;
         }
     }
+
     if ((compr & (~TGA_RLE)) == TGA_NODATA) {
         memset(p->data[0], 0, p->linesize[0] * h);
     } else {
-        if(compr & TGA_RLE){
+        if(compr & TGA_RLE) {
             int res = targa_decode_rle(avctx, s, dst, w, h, stride, bpp, interleave);
             if (res < 0)
                 return res;
@@ -263,12 +265,13 @@ static int decode_frame(AVCodecContext *avctx,
             } while (line);
         }
     }
+
     if(flags & TGA_RIGHTTOLEFT) { // right-to-left, needs horizontal flip
         int x;
-        for(y = 0; y < h; y++){
+        for(y = 0; y < h; y++) {
             void *line = &p->data[0][y * p->linesize[0]];
-            for(x = 0; x < w >> 1; x++){
-                switch(bpp){
+            for(x = 0; x < w >> 1; x++) {
+                switch(bpp) {
                 case 32:
                     FFSWAP(uint32_t, ((uint32_t *)line)[x], ((uint32_t *)line)[w - x - 1]);
                     break;
@@ -293,7 +296,7 @@ static int decode_frame(AVCodecContext *avctx,
     return avpkt->size;
 }
 
-static av_cold int targa_init(AVCodecContext *avctx){
+static av_cold int targa_init(AVCodecContext *avctx) {
     TargaContext *s = avctx->priv_data;
 
     avcodec_get_frame_defaults(&s->picture);
@@ -302,7 +305,7 @@ static av_cold int targa_init(AVCodecContext *avctx){
     return 0;
 }
 
-static av_cold int targa_end(AVCodecContext *avctx){
+static av_cold int targa_end(AVCodecContext *avctx) {
     TargaContext *s = avctx->priv_data;
 
     if(s->picture.data[0])
-- 
1.7.12



More information about the ffmpeg-devel mailing list