---
 libavcodec/dirac.c        | 28 ++++++++++++++--------------
 libavcodec/dirac_parser.c | 34 +++++++++++++++-------------------
 2 files changed, 29 insertions(+), 33 deletions(-)

diff --git a/libavcodec/dirac.c b/libavcodec/dirac.c
index ed0ea9f..0fe7d7f 100644
--- a/libavcodec/dirac.c
+++ b/libavcodec/dirac.c
@@ -61,20 +61,20 @@ static const dirac_source_params 
dirac_source_parameters_defaults[] = {
 
 /* [DIRAC_STD] Table 10.4 - Available preset pixel aspect ratio values */
 static const AVRational dirac_preset_aspect_ratios[] = {
-    {1, 1},
-    {10, 11},
-    {12, 11},
-    {40, 33},
-    {16, 11},
-    {4, 3},
+    {  1, 1  },
+    { 10, 11 },
+    { 12, 11 },
+    { 40, 33 },
+    { 16, 11 },
+    {  4, 3  },
 };
 
 /* [DIRAC_STD] Values 9,10 of 10.3.5 Frame Rate.
  * Table 10.3 Available preset frame rate values
  */
 static const AVRational dirac_frame_rate[] = {
-    {15000, 1001},
-    {25, 2},
+    { 15000, 1001 },
+    { 25, 2 },
 };
 
 /* [DIRAC_STD] This should be equivalent to Table 10.5 Available signal
@@ -83,10 +83,10 @@ static const struct {
     uint8_t             bitdepth;
     enum AVColorRange   color_range;
 } pixel_range_presets[] = {
-    {8,  AVCOL_RANGE_JPEG},
-    {8,  AVCOL_RANGE_MPEG},
-    {10, AVCOL_RANGE_MPEG},
-    {12, AVCOL_RANGE_MPEG},
+    {  8, AVCOL_RANGE_JPEG },
+    {  8, AVCOL_RANGE_MPEG },
+    { 10, AVCOL_RANGE_MPEG },
+    { 12, AVCOL_RANGE_MPEG },
 };
 
 static const enum AVColorPrimaries dirac_primaries[] = {
@@ -118,7 +118,7 @@ static const enum AVPixelFormat dirac_pix_fmt[2][3] = {
 static int parse_source_parameters(AVCodecContext *avctx, GetBitContext *gb,
                                    dirac_source_params *source)
 {
-    AVRational frame_rate = {0,0};
+    AVRational frame_rate = { 0, 0 };
     unsigned luma_depth = 8, luma_offset = 16;
     int idx;
 
@@ -270,7 +270,7 @@ static int parse_source_parameters(AVCodecContext *avctx, 
GetBitContext *gb,
                 avctx->color_trc = AVCOL_TRC_BT709;
         }
     } else {
-        idx = source->color_spec_index;
+        idx                    = source->color_spec_index;
         avctx->color_primaries = dirac_color_presets[idx].color_primaries;
         avctx->colorspace      = dirac_color_presets[idx].colorspace;
         avctx->color_trc       = dirac_color_presets[idx].color_trc;
diff --git a/libavcodec/dirac_parser.c b/libavcodec/dirac_parser.c
index 46f5430..90564b3 100644
--- a/libavcodec/dirac_parser.c
+++ b/libavcodec/dirac_parser.c
@@ -79,7 +79,7 @@ static int find_frame_end(DiracParseContext *pc,
                     pc->state = -1;
                     return i + pc->header_bytes_needed;
                 } else {
-                    pc->header_bytes_needed = 9-(buf_size-i);
+                    pc->header_bytes_needed = 9 - (buf_size - i);
                     break;
                 }
             } else
@@ -90,8 +90,7 @@ static int find_frame_end(DiracParseContext *pc,
     return -1;
 }
 
-typedef struct DiracParseUnit
-{
+typedef struct DiracParseUnit {
     int next_pu_offset;
     int prev_pu_offset;
     uint8_t pu_type;
@@ -102,12 +101,12 @@ static int unpack_parse_unit(DiracParseUnit *pu, 
DiracParseContext *pc,
 {
     uint8_t *start = pc->buffer + offset;
     uint8_t *end   = pc->buffer + pc->index;
-    if (start < pc->buffer || (start+13 > end))
+    if (start < pc->buffer || (start + 13 > end))
         return 0;
     pu->pu_type = start[4];
 
-    pu->next_pu_offset = AV_RB32(start+5);
-    pu->prev_pu_offset = AV_RB32(start+9);
+    pu->next_pu_offset = AV_RB32(start + 5);
+    pu->prev_pu_offset = AV_RB32(start + 9);
 
     if (pu->pu_type == 0x10 && pu->next_pu_offset == 0)
         pu->next_pu_offset = 13;
@@ -162,8 +161,8 @@ static int dirac_combine_frame(AVCodecParserContext *s, 
AVCodecContext *avctx,
         if (!unpack_parse_unit(&pu1, pc, pc->index - 13)                     ||
             !unpack_parse_unit(&pu, pc, pc->index - 13 - pu1.prev_pu_offset) ||
             pu.next_pu_offset != pu1.prev_pu_offset) {
-            pc->index -= 9;
-            *buf_size = next-9;
+            pc->index              -= 9;
+            *buf_size               = next-9;
             pc->header_bytes_needed = 9;
             return -1;
         }
@@ -179,7 +178,7 @@ static int dirac_combine_frame(AVCodecParserContext *s, 
AVCodecContext *avctx,
 
         if ((pu.pu_type&0x08) != 0x08) {
             pc->header_bytes_needed = 9;
-            *buf_size = next;
+            *buf_size               = next;
             return -1;
         }
 
@@ -217,27 +216,24 @@ static int dirac_parse(AVCodecParserContext *s, 
AVCodecContext *avctx,
     DiracParseContext *pc = s->priv_data;
     int next;
 
-    *poutbuf = NULL;
+    *poutbuf      = NULL;
     *poutbuf_size = 0;
 
     if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) {
-        next = buf_size;
-        *poutbuf = buf;
+        next          = buf_size;
+        *poutbuf      = buf;
         *poutbuf_size = buf_size;
         /* Assume that data has been packetized into an encapsulation unit. */
     } else {
         next = find_frame_end(pc, buf, buf_size);
-        if (!pc->is_synced && next == -1) {
-            /* No frame start found yet. So throw away the entire buffer. */
-            return buf_size;
-        }
+        if (!pc->is_synced && next == -1)
+            return buf_size; /* No frame start found yet. So throw away the 
entire buffer. */
 
-        if (dirac_combine_frame(s, avctx, next, &buf, &buf_size) < 0) {
+        if (dirac_combine_frame(s, avctx, next, &buf, &buf_size) < 0)
             return buf_size;
-        }
     }
 
-    *poutbuf = buf;
+    *poutbuf      = buf;
     *poutbuf_size = buf_size;
     return next;
 }
-- 
1.8.5.5

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to