Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 3/3] avfilter/vf_signalstats: Reindent after the previous commit
Date: Sat, 18 May 2024 17:25:44 +0200
Message-ID: <AS8P250MB0744D13145B0A34374A87CFB8FEF2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <AS8P250MB074478DAE48B5D615AEC218C8FEF2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>

Also use loop scope for iterators while just at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavfilter/vf_signalstats.c | 143 +++++++++++++++++------------------
 1 file changed, 71 insertions(+), 72 deletions(-)

diff --git a/libavfilter/vf_signalstats.c b/libavfilter/vf_signalstats.c
index 1bdc6a42ba..50c9df4298 100644
--- a/libavfilter/vf_signalstats.c
+++ b/libavfilter/vf_signalstats.c
@@ -544,7 +544,6 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
     SignalstatsContext *s = ctx->priv;
     AVFilterLink *outlink = ctx->outputs[0];
     AVFrame *out = in;
-    int i, j;
     int  w = 0,  cw = 0, // in
         pw = 0, cpw = 0; // prev
     int fil;
@@ -609,83 +608,83 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
     memset(s->histsat, 0, s->maxsize * sizeof(*s->histsat));
 
     if (hbd) {
-    const uint16_t *p_sat = (uint16_t *)sat->data[0];
-    const uint16_t *p_hue = (uint16_t *)hue->data[0];
-    const int lsz_sat = sat->linesize[0] / 2;
-    const int lsz_hue = hue->linesize[0] / 2;
-    // Calculate luma histogram and difference with previous frame or field.
-    for (j = 0; j < link->h; j++) {
-        for (i = 0; i < link->w; i++) {
-            const int yuv = AV_RN16(in->data[0] + w + i * 2);
-
-            masky |= yuv;
-            histy[yuv]++;
-            dify += abs(yuv - (int)AV_RN16(prev->data[0] + pw + i * 2));
+        const uint16_t *p_sat = (uint16_t *)sat->data[0];
+        const uint16_t *p_hue = (uint16_t *)hue->data[0];
+        const int lsz_sat = sat->linesize[0] / 2;
+        const int lsz_hue = hue->linesize[0] / 2;
+        // Calculate luma histogram and difference with previous frame or field.
+        for (int j = 0; j < link->h; j++) {
+            for (int i = 0; i < link->w; i++) {
+                const int yuv = AV_RN16(in->data[0] + w + i * 2);
+
+                masky |= yuv;
+                histy[yuv]++;
+                dify += abs(yuv - (int)AV_RN16(prev->data[0] + pw + i * 2));
+            }
+            w  += in->linesize[0];
+            pw += prev->linesize[0];
         }
-        w  += in->linesize[0];
-        pw += prev->linesize[0];
-    }
 
-    // Calculate chroma histogram and difference with previous frame or field.
-    for (j = 0; j < s->chromah; j++) {
-        for (i = 0; i < s->chromaw; i++) {
-            const int yuvu = AV_RN16(in->data[1] + cw + i * 2);
-            const int yuvv = AV_RN16(in->data[2] + cw + i * 2);
-
-            masku |= yuvu;
-            maskv |= yuvv;
-            histu[yuvu]++;
-            difu += abs(yuvu - (int)AV_RN16(prev->data[1] + cpw + i * 2));
-            histv[yuvv]++;
-            difv += abs(yuvv - (int)AV_RN16(prev->data[2] + cpw + i * 2));
-
-            histsat[p_sat[i]]++;
-            histhue[((int16_t*)p_hue)[i]]++;
+        // Calculate chroma histogram and difference with previous frame or field.
+        for (int j = 0; j < s->chromah; j++) {
+            for (int i = 0; i < s->chromaw; i++) {
+                const int yuvu = AV_RN16(in->data[1] + cw + i * 2);
+                const int yuvv = AV_RN16(in->data[2] + cw + i * 2);
+
+                masku |= yuvu;
+                maskv |= yuvv;
+                histu[yuvu]++;
+                difu += abs(yuvu - (int)AV_RN16(prev->data[1] + cpw + i * 2));
+                histv[yuvv]++;
+                difv += abs(yuvv - (int)AV_RN16(prev->data[2] + cpw + i * 2));
+
+                histsat[p_sat[i]]++;
+                histhue[((int16_t*)p_hue)[i]]++;
+            }
+            cw  += in->linesize[1];
+            cpw += prev->linesize[1];
+            p_sat += lsz_sat;
+            p_hue += lsz_hue;
         }
-        cw  += in->linesize[1];
-        cpw += prev->linesize[1];
-        p_sat += lsz_sat;
-        p_hue += lsz_hue;
-    }
     } else {
-    const uint8_t *p_sat = sat->data[0];
-    const uint8_t *p_hue = hue->data[0];
-    const int lsz_sat = sat->linesize[0];
-    const int lsz_hue = hue->linesize[0];
-    // Calculate luma histogram and difference with previous frame or field.
-    for (j = 0; j < link->h; j++) {
-        for (i = 0; i < link->w; i++) {
-            const int yuv = in->data[0][w + i];
-
-            masky |= yuv;
-            histy[yuv]++;
-            dify += abs(yuv - prev->data[0][pw + i]);
+        const uint8_t *p_sat = sat->data[0];
+        const uint8_t *p_hue = hue->data[0];
+        const int lsz_sat = sat->linesize[0];
+        const int lsz_hue = hue->linesize[0];
+        // Calculate luma histogram and difference with previous frame or field.
+        for (int j = 0; j < link->h; j++) {
+            for (int i = 0; i < link->w; i++) {
+                const int yuv = in->data[0][w + i];
+
+                masky |= yuv;
+                histy[yuv]++;
+                dify += abs(yuv - prev->data[0][pw + i]);
+            }
+            w  += in->linesize[0];
+            pw += prev->linesize[0];
         }
-        w  += in->linesize[0];
-        pw += prev->linesize[0];
-    }
 
-    // Calculate chroma histogram and difference with previous frame or field.
-    for (j = 0; j < s->chromah; j++) {
-        for (i = 0; i < s->chromaw; i++) {
-            const int yuvu = in->data[1][cw+i];
-            const int yuvv = in->data[2][cw+i];
-
-            masku |= yuvu;
-            maskv |= yuvv;
-            histu[yuvu]++;
-            difu += abs(yuvu - prev->data[1][cpw+i]);
-            histv[yuvv]++;
-            difv += abs(yuvv - prev->data[2][cpw+i]);
-
-            histsat[p_sat[i]]++;
-            histhue[((int16_t*)p_hue)[i]]++;
+        // Calculate chroma histogram and difference with previous frame or field.
+        for (int j = 0; j < s->chromah; j++) {
+            for (int i = 0; i < s->chromaw; i++) {
+                const int yuvu = in->data[1][cw+i];
+                const int yuvv = in->data[2][cw+i];
+
+                masku |= yuvu;
+                maskv |= yuvv;
+                histu[yuvu]++;
+                difu += abs(yuvu - prev->data[1][cpw+i]);
+                histv[yuvv]++;
+                difv += abs(yuvv - prev->data[2][cpw+i]);
+
+                histsat[p_sat[i]]++;
+                histhue[((int16_t*)p_hue)[i]]++;
+            }
+            cw  += in->linesize[1];
+            cpw += prev->linesize[1];
+            p_sat += lsz_sat;
+            p_hue += lsz_hue;
         }
-        cw  += in->linesize[1];
-        cpw += prev->linesize[1];
-        p_sat += lsz_sat;
-        p_hue += lsz_hue;
-    }
     }
 
     for (fil = 0; fil < FILT_NUMB; fil ++) {
@@ -697,7 +696,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
             memset(s->jobs_rets, 0, s->nb_jobs * sizeof(*s->jobs_rets));
             ff_filter_execute(ctx, hbd ? filters_def[fil].process16 : filters_def[fil].process8,
                               &td, s->jobs_rets, s->nb_jobs);
-            for (i = 0; i < s->nb_jobs; i++)
+            for (int i = 0; i < s->nb_jobs; i++)
                 filtot[fil] += s->jobs_rets[i];
         }
     }
-- 
2.40.1

_______________________________________________
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".

  parent reply	other threads:[~2024-05-18 15:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-18 15:24 [FFmpeg-devel] [PATCH 1/3] avfilter/vf_signalstats: Use av_dict_set_int() where appropriate Andreas Rheinhardt
2024-05-18 15:25 ` [FFmpeg-devel] [PATCH 2/3] avfilter/vf_signalstats: Deduplicate <= 8 and > 8 bit code Andreas Rheinhardt
2024-05-18 15:25 ` Andreas Rheinhardt [this message]
2024-05-20  9:41 ` [FFmpeg-devel] [PATCH 1/3] avfilter/vf_signalstats: Use av_dict_set_int() where appropriate Andreas Rheinhardt

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=AS8P250MB0744D13145B0A34374A87CFB8FEF2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --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