[FFmpeg-devel] [PATCH 2/5] avcodec/dvbsubenc: reindent after previous commit

Clément Bœsch u at pkh.me
Tue Aug 18 23:55:32 EEST 2020


---
 libavcodec/dvbsubenc.c | 78 +++++++++++++++++++++---------------------
 1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/libavcodec/dvbsubenc.c b/libavcodec/dvbsubenc.c
index ce6de4a774..f6cf1d869f 100644
--- a/libavcodec/dvbsubenc.c
+++ b/libavcodec/dvbsubenc.c
@@ -375,48 +375,48 @@ static int dvbsub_encode(AVCodecContext *avctx, uint8_t *outbuf, int buf_size,
             buf_size -= 6 + h->rects[clut_id]->nb_colors * 6;
         }
 
-    if (buf_size < h->num_rects * 22)
-        return AVERROR_BUFFER_TOO_SMALL;
-    for (region_id = 0; region_id < h->num_rects; region_id++) {
+        if (buf_size < h->num_rects * 22)
+            return AVERROR_BUFFER_TOO_SMALL;
+        for (region_id = 0; region_id < h->num_rects; region_id++) {
 
-        /* region composition segment */
-
-        if (h->rects[region_id]->nb_colors <= 4) {
-            /* 2 bpp, some decoders do not support it correctly */
-            bpp_index = 0;
-        } else if (h->rects[region_id]->nb_colors <= 16) {
-            /* 4 bpp, standard encoding */
-            bpp_index = 1;
-        } else if (h->rects[region_id]->nb_colors <= 256) {
-            /* 8 bpp, standard encoding */
-            bpp_index = 2;
-        } else {
-            return AVERROR(EINVAL);
-        }
+            /* region composition segment */
 
-        *q++ = 0x0f; /* sync_byte */
-        *q++ = 0x11; /* segment_type */
-        bytestream_put_be16(&q, page_id);
-        pseg_len = q;
-        q += 2; /* segment length */
-        *q++ = region_id;
-        *q++ = (s->object_version << 4) | (0 << 3) | 0x07; /* version , no fill */
-        bytestream_put_be16(&q, h->rects[region_id]->w); /* region width */
-        bytestream_put_be16(&q, h->rects[region_id]->h); /* region height */
-        *q++ = ((1 + bpp_index) << 5) | ((1 + bpp_index) << 2) | 0x03;
-        *q++ = region_id; /* clut_id == region_id */
-        *q++ = 0; /* 8 bit fill colors */
-        *q++ = 0x03; /* 4 bit and 2 bit fill colors */
-
-        bytestream_put_be16(&q, region_id); /* object_id == region_id */
-        *q++ = (0 << 6) | (0 << 4);
-        *q++ = 0;
-        *q++ = 0xf0;
-        *q++ = 0;
+            if (h->rects[region_id]->nb_colors <= 4) {
+                /* 2 bpp, some decoders do not support it correctly */
+                bpp_index = 0;
+            } else if (h->rects[region_id]->nb_colors <= 16) {
+                /* 4 bpp, standard encoding */
+                bpp_index = 1;
+            } else if (h->rects[region_id]->nb_colors <= 256) {
+                /* 8 bpp, standard encoding */
+                bpp_index = 2;
+            } else {
+                return AVERROR(EINVAL);
+            }
 
-        bytestream_put_be16(&pseg_len, q - pseg_len - 2);
-    }
-    buf_size -= h->num_rects * 22;
+            *q++ = 0x0f; /* sync_byte */
+            *q++ = 0x11; /* segment_type */
+            bytestream_put_be16(&q, page_id);
+            pseg_len = q;
+            q += 2; /* segment length */
+            *q++ = region_id;
+            *q++ = (s->object_version << 4) | (0 << 3) | 0x07; /* version , no fill */
+            bytestream_put_be16(&q, h->rects[region_id]->w); /* region width */
+            bytestream_put_be16(&q, h->rects[region_id]->h); /* region height */
+            *q++ = ((1 + bpp_index) << 5) | ((1 + bpp_index) << 2) | 0x03;
+            *q++ = region_id; /* clut_id == region_id */
+            *q++ = 0; /* 8 bit fill colors */
+            *q++ = 0x03; /* 4 bit and 2 bit fill colors */
+
+            bytestream_put_be16(&q, region_id); /* object_id == region_id */
+            *q++ = (0 << 6) | (0 << 4);
+            *q++ = 0;
+            *q++ = 0xf0;
+            *q++ = 0;
+
+            bytestream_put_be16(&pseg_len, q - pseg_len - 2);
+        }
+        buf_size -= h->num_rects * 22;
 
         for (object_id = 0; object_id < h->num_rects; object_id++) {
             int (*dvb_encode_rle)(uint8_t **pq, int buf_size,
-- 
2.28.0



More information about the ffmpeg-devel mailing list