Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Tomas Härdin" <git@haerdin.se>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH 2/2] lavc/speedhqdec: Reindent
Date: Mon, 13 May 2024 17:43:28 +0200
Message-ID: <d653e62a7886594af4c84be97daa9bf5d27e7804.camel@haerdin.se> (raw)
In-Reply-To: <ce5bb50c2351c52662798f30d5aa601b4d7e002a.camel@haerdin.se>

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: 0002-lavc-speedhqdec-Reindent.patch --]
[-- Type: text/x-patch, Size: 10289 bytes --]

From 17aceef1c1a1bb25d651610cd52bc94dbdf20e0d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <git@haerdin.se>
Date: Mon, 13 May 2024 17:01:28 +0200
Subject: [PATCH 2/2] lavc/speedhqdec: Reindent

---
 libavcodec/speedhqdec.c | 152 ++++++++++++++++++++--------------------
 1 file changed, 76 insertions(+), 76 deletions(-)

diff --git a/libavcodec/speedhqdec.c b/libavcodec/speedhqdec.c
index 77a159f7e5..06ae0a7a85 100644
--- a/libavcodec/speedhqdec.c
+++ b/libavcodec/speedhqdec.c
@@ -297,98 +297,98 @@ static int decode_speedhq_field(const SHQContext *s, const uint8_t *buf, int buf
             return AVERROR_INVALIDDATA;
     }
 
-        slice_begin = slice_offsets[slice_number];
-        slice_end = slice_offsets[slice_number + 1];
+    slice_begin = slice_offsets[slice_number];
+    slice_end = slice_offsets[slice_number + 1];
 
-        if ((ret = init_get_bits8(&gb, buf + slice_begin + 3, slice_end - slice_begin - 3)) < 0)
-            return ret;
+    if ((ret = init_get_bits8(&gb, buf + slice_begin + 3, slice_end - slice_begin - 3)) < 0)
+        return ret;
 
-        for (y = slice_number * 16 * line_stride; y < frame->height; y += line_stride * 64) {
-            uint8_t *dest_y, *dest_cb, *dest_cr, *dest_a;
-            int last_dc[4] = { 1024, 1024, 1024, 1024 };
-            uint8_t last_alpha[16];
+    for (y = slice_number * 16 * line_stride; y < frame->height; y += line_stride * 64) {
+        uint8_t *dest_y, *dest_cb, *dest_cr, *dest_a;
+        int last_dc[4] = { 1024, 1024, 1024, 1024 };
+        uint8_t last_alpha[16];
 
-            memset(last_alpha, 255, sizeof(last_alpha));
+        memset(last_alpha, 255, sizeof(last_alpha));
 
-            dest_y = frame->data[0] + frame->linesize[0] * (y + field_number);
-            if (s->subsampling == SHQ_SUBSAMPLING_420) {
-                dest_cb = frame->data[1] + frame->linesize[1] * (y/2 + field_number);
-                dest_cr = frame->data[2] + frame->linesize[2] * (y/2 + field_number);
-            } else {
-                dest_cb = frame->data[1] + frame->linesize[1] * (y + field_number);
-                dest_cr = frame->data[2] + frame->linesize[2] * (y + field_number);
-            }
-            if (s->alpha_type != SHQ_NO_ALPHA) {
-                dest_a = frame->data[3] + frame->linesize[3] * (y + field_number);
-            }
+        dest_y = frame->data[0] + frame->linesize[0] * (y + field_number);
+        if (s->subsampling == SHQ_SUBSAMPLING_420) {
+            dest_cb = frame->data[1] + frame->linesize[1] * (y/2 + field_number);
+            dest_cr = frame->data[2] + frame->linesize[2] * (y/2 + field_number);
+        } else {
+            dest_cb = frame->data[1] + frame->linesize[1] * (y + field_number);
+            dest_cr = frame->data[2] + frame->linesize[2] * (y + field_number);
+        }
+        if (s->alpha_type != SHQ_NO_ALPHA) {
+            dest_a = frame->data[3] + frame->linesize[3] * (y + field_number);
+        }
 
-            for (x = 0; x < frame->width - 8 * (s->subsampling != SHQ_SUBSAMPLING_444); x += 16) {
-                /* Decode the four luma blocks. */
-                if ((ret = decode_dct_block(s, &gb, last_dc, 0, dest_y, linesize_y)) < 0)
-                    return ret;
-                if ((ret = decode_dct_block(s, &gb, last_dc, 0, dest_y + 8, linesize_y)) < 0)
-                    return ret;
-                if ((ret = decode_dct_block(s, &gb, last_dc, 0, dest_y + 8 * linesize_y, linesize_y)) < 0)
-                    return ret;
-                if ((ret = decode_dct_block(s, &gb, last_dc, 0, dest_y + 8 * linesize_y + 8, linesize_y)) < 0)
-                    return ret;
+        for (x = 0; x < frame->width - 8 * (s->subsampling != SHQ_SUBSAMPLING_444); x += 16) {
+            /* Decode the four luma blocks. */
+            if ((ret = decode_dct_block(s, &gb, last_dc, 0, dest_y, linesize_y)) < 0)
+                return ret;
+            if ((ret = decode_dct_block(s, &gb, last_dc, 0, dest_y + 8, linesize_y)) < 0)
+                return ret;
+            if ((ret = decode_dct_block(s, &gb, last_dc, 0, dest_y + 8 * linesize_y, linesize_y)) < 0)
+                return ret;
+            if ((ret = decode_dct_block(s, &gb, last_dc, 0, dest_y + 8 * linesize_y + 8, linesize_y)) < 0)
+                return ret;
+
+            /*
+                * Decode the first chroma block. For 4:2:0, this is the only one;
+                * for 4:2:2, it's the top block; for 4:4:4, it's the top-left block.
+                */
+            if ((ret = decode_dct_block(s, &gb, last_dc, 1, dest_cb, linesize_cb)) < 0)
+                return ret;
+            if ((ret = decode_dct_block(s, &gb, last_dc, 2, dest_cr, linesize_cr)) < 0)
+                return ret;
 
-                /*
-                 * Decode the first chroma block. For 4:2:0, this is the only one;
-                 * for 4:2:2, it's the top block; for 4:4:4, it's the top-left block.
-                 */
-                if ((ret = decode_dct_block(s, &gb, last_dc, 1, dest_cb, linesize_cb)) < 0)
+            if (s->subsampling != SHQ_SUBSAMPLING_420) {
+                /* For 4:2:2, this is the bottom block; for 4:4:4, it's the bottom-left block. */
+                if ((ret = decode_dct_block(s, &gb, last_dc, 1, dest_cb + 8 * linesize_cb, linesize_cb)) < 0)
                     return ret;
-                if ((ret = decode_dct_block(s, &gb, last_dc, 2, dest_cr, linesize_cr)) < 0)
+                if ((ret = decode_dct_block(s, &gb, last_dc, 2, dest_cr + 8 * linesize_cr, linesize_cr)) < 0)
                     return ret;
 
-                if (s->subsampling != SHQ_SUBSAMPLING_420) {
-                    /* For 4:2:2, this is the bottom block; for 4:4:4, it's the bottom-left block. */
-                    if ((ret = decode_dct_block(s, &gb, last_dc, 1, dest_cb + 8 * linesize_cb, linesize_cb)) < 0)
-                        return ret;
-                    if ((ret = decode_dct_block(s, &gb, last_dc, 2, dest_cr + 8 * linesize_cr, linesize_cr)) < 0)
-                        return ret;
-
-                    if (s->subsampling == SHQ_SUBSAMPLING_444) {
-                        /* Top-right and bottom-right blocks. */
-                        if ((ret = decode_dct_block(s, &gb, last_dc, 1, dest_cb + 8, linesize_cb)) < 0)
-                            return ret;
-                        if ((ret = decode_dct_block(s, &gb, last_dc, 2, dest_cr + 8, linesize_cr)) < 0)
-                            return ret;
-                        if ((ret = decode_dct_block(s, &gb, last_dc, 1, dest_cb + 8 * linesize_cb + 8, linesize_cb)) < 0)
-                            return ret;
-                        if ((ret = decode_dct_block(s, &gb, last_dc, 2, dest_cr + 8 * linesize_cr + 8, linesize_cr)) < 0)
-                            return ret;
-
-                        dest_cb += 8;
-                        dest_cr += 8;
-                    }
-                }
-                dest_y += 16;
-                dest_cb += 8;
-                dest_cr += 8;
-
-                if (s->alpha_type == SHQ_RLE_ALPHA) {
-                    /* Alpha coded using 16x8 RLE blocks. */
-                    if ((ret = decode_alpha_block(s, &gb, last_alpha, dest_a, linesize_a)) < 0)
-                        return ret;
-                    if ((ret = decode_alpha_block(s, &gb, last_alpha, dest_a + 8 * linesize_a, linesize_a)) < 0)
-                        return ret;
-                    dest_a += 16;
-                } else if (s->alpha_type == SHQ_DCT_ALPHA) {
-                    /* Alpha encoded exactly like luma. */
-                    if ((ret = decode_dct_block(s, &gb, last_dc, 3, dest_a, linesize_a)) < 0)
+                if (s->subsampling == SHQ_SUBSAMPLING_444) {
+                    /* Top-right and bottom-right blocks. */
+                    if ((ret = decode_dct_block(s, &gb, last_dc, 1, dest_cb + 8, linesize_cb)) < 0)
                         return ret;
-                    if ((ret = decode_dct_block(s, &gb, last_dc, 3, dest_a + 8, linesize_a)) < 0)
+                    if ((ret = decode_dct_block(s, &gb, last_dc, 2, dest_cr + 8, linesize_cr)) < 0)
                         return ret;
-                    if ((ret = decode_dct_block(s, &gb, last_dc, 3, dest_a + 8 * linesize_a, linesize_a)) < 0)
+                    if ((ret = decode_dct_block(s, &gb, last_dc, 1, dest_cb + 8 * linesize_cb + 8, linesize_cb)) < 0)
                         return ret;
-                    if ((ret = decode_dct_block(s, &gb, last_dc, 3, dest_a + 8 * linesize_a + 8, linesize_a)) < 0)
+                    if ((ret = decode_dct_block(s, &gb, last_dc, 2, dest_cr + 8 * linesize_cr + 8, linesize_cr)) < 0)
                         return ret;
-                    dest_a += 16;
+
+                    dest_cb += 8;
+                    dest_cr += 8;
                 }
             }
+            dest_y += 16;
+            dest_cb += 8;
+            dest_cr += 8;
+
+            if (s->alpha_type == SHQ_RLE_ALPHA) {
+                /* Alpha coded using 16x8 RLE blocks. */
+                if ((ret = decode_alpha_block(s, &gb, last_alpha, dest_a, linesize_a)) < 0)
+                    return ret;
+                if ((ret = decode_alpha_block(s, &gb, last_alpha, dest_a + 8 * linesize_a, linesize_a)) < 0)
+                    return ret;
+                dest_a += 16;
+            } else if (s->alpha_type == SHQ_DCT_ALPHA) {
+                /* Alpha encoded exactly like luma. */
+                if ((ret = decode_dct_block(s, &gb, last_dc, 3, dest_a, linesize_a)) < 0)
+                    return ret;
+                if ((ret = decode_dct_block(s, &gb, last_dc, 3, dest_a + 8, linesize_a)) < 0)
+                    return ret;
+                if ((ret = decode_dct_block(s, &gb, last_dc, 3, dest_a + 8 * linesize_a, linesize_a)) < 0)
+                    return ret;
+                if ((ret = decode_dct_block(s, &gb, last_dc, 3, dest_a + 8 * linesize_a + 8, linesize_a)) < 0)
+                    return ret;
+                dest_a += 16;
+            }
         }
+    }
 
     if (s->subsampling != SHQ_SUBSAMPLING_444 && (frame->width & 15) && slice_number == 3)
         return decode_speedhq_border(s, &gb, frame, field_number, line_stride);
-- 
2.39.2


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2024-05-13 15:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-13 15:42 [FFmpeg-devel] [PATCH 1/2] lavc/speedhqdec: Add AV_CODEC_CAP_SLICE_THREADS Tomas Härdin
2024-05-13 15:43 ` Tomas Härdin [this message]
2024-05-14  8:20 ` Tomas Härdin
2024-05-30 14:23 ` Tomas Härdin
2024-06-03 12:54   ` Tomas Härdin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d653e62a7886594af4c84be97daa9bf5d27e7804.camel@haerdin.se \
    --to=git@haerdin.se \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git