From 7bf647e6ba3328d580a64f311f3deba014f844d2 Mon Sep 17 00:00:00 2001
From: unknown <chrisberov@gmail.com>
Date: Wed, 30 Nov 2011 19:46:31 +0200
Subject: [PATCH] yuv4mpeg: cosmetics

---
 libavcodec/4xm.c       |   27 ++++++++++++++-------------
 libavformat/yuv4mpeg.c |   28 ++++++++++++++--------------
 2 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c
index 21bde52..95ca845 100644
--- a/libavcodec/4xm.c
+++ b/libavcodec/4xm.c
@@ -38,38 +38,38 @@
 
 #define CFRAME_BUFFER_COUNT 100
 
-static const uint8_t block_type_tab[2][4][8][2]={
+static const uint8_t block_type_tab[2][4][8][2] = {
  {
   {   //{8,4,2}x{8,4,2}
-    { 0,1}, { 2,2}, { 6,3}, {14,4}, {30,5}, {31,5}, { 0,0}
+    {0, 1}, {2, 2}, {6, 3}, {14, 4}, {30, 5}, {31, 5}, {0, 0}
   },{ //{8,4}x1
-    { 0,1}, { 0,0}, { 2,2}, { 6,3}, {14,4}, {15,4}, { 0,0}
+    {0, 1}, {0, 0}, {2, 2}, {6, 3}, {14, 4}, {15, 4}, {0, 0}
   },{ //1x{8,4}
-    { 0,1}, { 2,2}, { 0,0}, { 6,3}, {14,4}, {15,4}, { 0,0}
+    {0, 1}, {2, 2}, {0, 0}, {6, 3}, {14, 4}, {15, 4}, {0, 0}
   },{ //1x2, 2x1
-    { 0,1}, { 0,0}, { 0,0}, { 2,2}, { 6,3}, {14,4}, {15,4}
+    {0, 1}, {0, 0}, {0, 0}, {2, 2}, {6, 3}, {14, 4}, {15, 4}
   }
  },{
   {  //{8,4,2}x{8,4,2}
-    { 1,2}, { 4,3}, { 5,3}, {0,2}, {6,3}, {7,3}, {0,0}
+    {1, 2}, {4, 3}, {5, 3}, {0, 2}, {6, 3}, {7, 3}, {0, 0}
   },{//{8,4}x1
-    { 1,2}, { 0,0}, { 2,2}, {0,2}, {6,3}, {7,3}, {0,0}
+    {1, 2}, {0, 0}, {2, 2}, {0, 2}, {6, 3}, {7, 3}, {0, 0}
   },{//1x{8,4}
-    { 1,2}, { 2,2}, { 0,0}, {0,2}, {6,3}, {7,3}, {0,0}
+    {1, 2}, {2, 2}, {0, 0}, {0, 2}, {6, 3}, {7, 3}, {0, 0}
   },{//1x2, 2x1
-    { 1,2}, { 0,0}, { 0,0}, {0,2}, {2,2}, {6,3}, {7,3}
+    {1, 2}, {0, 0}, {0, 0}, {0, 2}, {2, 2}, {6, 3}, {7, 3}
   }
  }
 };
 
-static const uint8_t size2index[4][4]={
+static const uint8_t size2index[4][4] = {
   {-1, 3, 1, 1},
   { 3, 0, 0, 0},
   { 2, 0, 0, 0},
   { 2, 0, 0, 0},
 };
 
-static const int8_t mv[256][2]={
+static const int8_t mv[256][2] = {
 {  0,  0},{  0, -1},{ -1,  0},{  1,  0},{  0,  1},{ -1, -1},{  1, -1},{ -1,  1},
 {  1,  1},{  0, -2},{ -2,  0},{  2,  0},{  0,  2},{ -1, -2},{  1, -2},{ -2, -1},
 {  2, -1},{ -2,  1},{  2,  1},{ -1,  2},{  1,  2},{ -2, -2},{  2, -2},{ -2,  2},
@@ -104,8 +104,9 @@ static const int8_t mv[256][2]={
 {-29, 18},{-16,-31},{-28,-22},{ 21,-30},{-25, 28},{ 26,-29},{ 25,-32},{-32,-32}
 };
 
-// this is simply the scaled down elementwise product of the standard jpeg quantizer table and the AAN premul table
-static const uint8_t dequant_table[64]={
+// this is simply the scaled down elementwise product of the standard jpeg
+// quantizer table and the AAN premul table
+static const uint8_t dequant_table[64] = {
  16, 15, 13, 19, 24, 31, 28, 17,
  17, 23, 25, 31, 36, 63, 45, 21,
  18, 24, 27, 37, 52, 59, 49, 20,
diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c
index 708c901..0d0bb5e 100644
--- a/libavformat/yuv4mpeg.c
+++ b/libavformat/yuv4mpeg.c
@@ -63,12 +63,9 @@ static int yuv4_generate_header(AVFormatContext *s, char* buf)
         colorspace = " C411 XYSCSS=411";
         break;
     case PIX_FMT_YUV420P:
-        colorspace = 
-            (st->codec->chroma_sample_location == AVCHROMA_LOC_TOPLEFT)?
-                      " C420paldv XYSCSS=420PALDV":
-                     (st->codec->chroma_sample_location == AVCHROMA_LOC_LEFT)?
-                      " C420mpeg2 XYSCSS=420MPEG2":
-                      " C420jpeg XYSCSS=420JPEG";
+        colorspace = (st->codec->chroma_sample_location == AVCHROMA_LOC_TOPLEFT)?" C420paldv XYSCSS=420PALDV":
+                (st->codec->chroma_sample_location == AVCHROMA_LOC_LEFT)?" C420mpeg2 XYSCSS=420MPEG2":
+                " C420jpeg XYSCSS=420JPEG";
         break;
     case PIX_FMT_YUV422P:
         colorspace = " C422 XYSCSS=422";
@@ -203,8 +200,8 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap)
     char *tokstart, *tokend, *header_end;
     int i;
     AVIOContext *pb = s->pb;
-    int width = -1, height = -1, raten = 0,
-        rated = 0, aspectn = 0, aspectd = 0;
+    int width = -1, height  = -1, raten   = 0,
+        rated =  0, aspectn =  0, aspectd = 0;
     enum PixelFormat pix_fmt = PIX_FMT_NONE, alt_pix_fmt = PIX_FMT_NONE;
     enum AVChromaLocation chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED;
     AVStream *st;
@@ -264,7 +261,8 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap)
                        "pixel format.\n");
                 return -1;
             }
-            while (tokstart < header_end && *tokstart != 0x20) tokstart++;
+            while (tokstart < header_end && *tokstart != 0x20)
+            tokstart++;
             break;
         case 'I': // Interlace type
             switch (*tokstart++){
@@ -292,11 +290,13 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap)
             break;
         case 'F': // Frame rate
             sscanf(tokstart, "%d:%d", &raten, &rated); // 0:0 if unknown
-            while (tokstart < header_end && *tokstart != 0x20) tokstart++;
+            while (tokstart < header_end && *tokstart != 0x20)
+            tokstart++;
             break;
         case 'A': // Pixel aspect
             sscanf(tokstart, "%d:%d", &aspectn, &aspectd); // 0:0 if unknown
-            while (tokstart < header_end && *tokstart != 0x20) tokstart++;
+            while (tokstart < header_end && *tokstart != 0x20)
+            tokstart++;
             break;
         case 'X': // Vendor extensions
             if (strncmp("YSCSS=", tokstart, 6) == 0) {
@@ -315,7 +315,8 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap)
                 else if (strncmp("444", tokstart, 3) == 0)
                     alt_pix_fmt = PIX_FMT_YUV444P;
             }
-            while(tokstart < header_end && *tokstart != 0x20) tokstart++;
+            while (tokstart < header_end && *tokstart != 0x20)
+            tokstart++;
             break;
         }
     }
@@ -389,8 +390,7 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt)
 
     if (st->codec->coded_frame) {
         st->codec->coded_frame->interlaced_frame = s1->interlaced_frame;
-        st->codec->coded_frame->
-        top_field_first = s1->top_field_first;
+        st->codec->coded_frame->top_field_first = s1->top_field_first;
     }
 
     pkt->stream_index = 0;
-- 
1.7.7.1.msysgit.0

