[FFmpeg-cvslog] swr-test:indent

Michael Niedermayer git at videolan.org
Fri Apr 27 00:09:06 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Apr 26 23:43:45 2012 +0200| [a0dd81dd95207b54fab5ad7d411dd9c0e18408af] | committer: Michael Niedermayer

swr-test:indent

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a0dd81dd95207b54fab5ad7d411dd9c0e18408af
---

 libswresample/swresample_test.c |  224 +++++++++++++++++++-------------------
 1 files changed, 112 insertions(+), 112 deletions(-)

diff --git a/libswresample/swresample_test.c b/libswresample/swresample_test.c
index ba77d79..1e1b80c 100644
--- a/libswresample/swresample_test.c
+++ b/libswresample/swresample_test.c
@@ -271,121 +271,121 @@ int main(int argc, char **argv){
         out_sample_rate = rates  [vector % FF_ARRAY_ELEMS(rates  )]; vector /= FF_ARRAY_ELEMS(rates);
         av_assert0(!vector);
 
-                    int in_ch_count;
-                    in_ch_count= av_get_channel_layout_nb_channels(in_ch_layout);
-                        int out_count, mid_count, out_ch_count;
-                        out_ch_count= av_get_channel_layout_nb_channels(out_ch_layout);
-                        av_get_channel_layout_string( in_layout_string, sizeof( in_layout_string),  in_ch_count,  in_ch_layout);
-                        av_get_channel_layout_string(out_layout_string, sizeof(out_layout_string), out_ch_count, out_ch_layout);
-                        fprintf(stderr, "TEST: %s->%s, rate:%5d->%5d, fmt:%s->%s\n",
-                               in_layout_string, out_layout_string,
-                               in_sample_rate, out_sample_rate,
-                               av_get_sample_fmt_name(in_sample_fmt), av_get_sample_fmt_name(out_sample_fmt));
-                        forw_ctx  = swr_alloc_set_opts(forw_ctx, out_ch_layout, out_sample_fmt,  out_sample_rate,
-                                                                  in_ch_layout,  in_sample_fmt,  in_sample_rate,
-                                                       0, 0);
-                        backw_ctx = swr_alloc_set_opts(backw_ctx, in_ch_layout,  in_sample_fmt,             in_sample_rate,
-                                                                 out_ch_layout, out_sample_fmt, out_sample_rate,
-                                                       0, 0);
-                        if(swr_init( forw_ctx) < 0)
-                            fprintf(stderr, "swr_init(->) failed\n");
-                        if(swr_init(backw_ctx) < 0)
-                            fprintf(stderr, "swr_init(<-) failed\n");
-                        if(!forw_ctx)
-                            fprintf(stderr, "Failed to init forw_cts\n");
-                        if(!backw_ctx)
-                            fprintf(stderr, "Failed to init backw_ctx\n");
-                               //FIXME test planar
-                        setup_array(ain , array_in ,  in_sample_fmt,   SAMPLES);
-                        setup_array(amid, array_mid, out_sample_fmt, 3*SAMPLES);
-                        setup_array(aout, array_out,  in_sample_fmt           ,   SAMPLES);
+        int in_ch_count;
+        in_ch_count= av_get_channel_layout_nb_channels(in_ch_layout);
+        int out_count, mid_count, out_ch_count;
+        out_ch_count= av_get_channel_layout_nb_channels(out_ch_layout);
+        av_get_channel_layout_string( in_layout_string, sizeof( in_layout_string),  in_ch_count,  in_ch_layout);
+        av_get_channel_layout_string(out_layout_string, sizeof(out_layout_string), out_ch_count, out_ch_layout);
+        fprintf(stderr, "TEST: %s->%s, rate:%5d->%5d, fmt:%s->%s\n",
+                in_layout_string, out_layout_string,
+                in_sample_rate, out_sample_rate,
+                av_get_sample_fmt_name(in_sample_fmt), av_get_sample_fmt_name(out_sample_fmt));
+        forw_ctx  = swr_alloc_set_opts(forw_ctx, out_ch_layout, out_sample_fmt,  out_sample_rate,
+                                                    in_ch_layout,  in_sample_fmt,  in_sample_rate,
+                                        0, 0);
+        backw_ctx = swr_alloc_set_opts(backw_ctx, in_ch_layout,  in_sample_fmt,             in_sample_rate,
+                                                    out_ch_layout, out_sample_fmt, out_sample_rate,
+                                        0, 0);
+        if(swr_init( forw_ctx) < 0)
+            fprintf(stderr, "swr_init(->) failed\n");
+        if(swr_init(backw_ctx) < 0)
+            fprintf(stderr, "swr_init(<-) failed\n");
+        if(!forw_ctx)
+            fprintf(stderr, "Failed to init forw_cts\n");
+        if(!backw_ctx)
+            fprintf(stderr, "Failed to init backw_ctx\n");
+                //FIXME test planar
+        setup_array(ain , array_in ,  in_sample_fmt,   SAMPLES);
+        setup_array(amid, array_mid, out_sample_fmt, 3*SAMPLES);
+        setup_array(aout, array_out,  in_sample_fmt           ,   SAMPLES);
 #if 0
-                        for(ch=0; ch<in_ch_count; ch++){
-                            for(i=0; i<SAMPLES; i++)
-                                set(ain, ch, i, in_ch_count, in_sample_fmt, sin(i*i*3/SAMPLES));
-                        }
+        for(ch=0; ch<in_ch_count; ch++){
+            for(i=0; i<SAMPLES; i++)
+                set(ain, ch, i, in_ch_count, in_sample_fmt, sin(i*i*3/SAMPLES));
+        }
 #else
-                        audiogen(ain, in_sample_fmt, in_ch_count, SAMPLES/6+1, SAMPLES);
+        audiogen(ain, in_sample_fmt, in_ch_count, SAMPLES/6+1, SAMPLES);
 #endif
-                        mode++;
-                        mode%=3;
-                        if(mode==0 /*|| out_sample_rate == in_sample_rate*/) {
-                            mid_count= swr_convert(forw_ctx, amid, 3*SAMPLES, ain, SAMPLES);
-                        } else if(mode==1){
-                            mid_count= swr_convert(forw_ctx, amid,         0, ain, SAMPLES);
-                            mid_count+=swr_convert(forw_ctx, amid, 3*SAMPLES, ain,       0);
-                        } else {
-                            int tmp_count;
-                            mid_count= swr_convert(forw_ctx, amid,         0, ain,       1);
-                            av_assert0(mid_count==0);
-                            shift(ain,  1, in_ch_count, in_sample_fmt);
-                            mid_count+=swr_convert(forw_ctx, amid, 3*SAMPLES, ain,       0);
-                            shift(amid,  mid_count, out_ch_count, out_sample_fmt); tmp_count = mid_count;
-                            mid_count+=swr_convert(forw_ctx, amid,         2, ain,       2);
-                            shift(amid,  mid_count-tmp_count, out_ch_count, out_sample_fmt); tmp_count = mid_count;
-                            shift(ain,  2, in_ch_count, in_sample_fmt);
-                            mid_count+=swr_convert(forw_ctx, amid,         1, ain, SAMPLES-3);
-                            shift(amid,  mid_count-tmp_count, out_ch_count, out_sample_fmt); tmp_count = mid_count;
-                            shift(ain, -3, in_ch_count, in_sample_fmt);
-                            mid_count+=swr_convert(forw_ctx, amid, 3*SAMPLES, ain,       0);
-                            shift(amid,  -tmp_count, out_ch_count, out_sample_fmt);
-                        }
-                        out_count= swr_convert(backw_ctx,aout, SAMPLES, amid, mid_count);
-
-                        for(ch=0; ch<in_ch_count; ch++){
-                            double sse, x, maxdiff=0;
-                            double sum_a= 0;
-                            double sum_b= 0;
-                            double sum_aa= 0;
-                            double sum_bb= 0;
-                            double sum_ab= 0;
-                            for(i=0; i<out_count; i++){
-                                double a= get(ain , ch, i, in_ch_count, in_sample_fmt);
-                                double b= get(aout, ch, i, in_ch_count, in_sample_fmt);
-                                sum_a += a;
-                                sum_b += b;
-                                sum_aa+= a*a;
-                                sum_bb+= b*b;
-                                sum_ab+= a*b;
-                                maxdiff= FFMAX(maxdiff, FFABS(a-b));
-                            }
-                            sse= sum_aa + sum_bb - 2*sum_ab;
-
-                            fprintf(stderr, "[e:%f c:%f max:%f] len:%5d\n", sqrt(sse/out_count), sum_ab/(sqrt(sum_aa*sum_bb)), maxdiff, out_count);
-                        }
-
-                        flush_i++;
-                        flush_i%=21;
-                        flush_count = swr_convert(backw_ctx,aout, flush_i, 0, 0);
-                        shift(aout,  flush_i, in_ch_count, in_sample_fmt);
-                        flush_count+= swr_convert(backw_ctx,aout, SAMPLES-flush_i, 0, 0);
-                        shift(aout, -flush_i, in_ch_count, in_sample_fmt);
-                        if(flush_count){
-                            for(ch=0; ch<in_ch_count; ch++){
-                                double sse, x, maxdiff=0;
-                                double sum_a= 0;
-                                double sum_b= 0;
-                                double sum_aa= 0;
-                                double sum_bb= 0;
-                                double sum_ab= 0;
-                                for(i=0; i<flush_count; i++){
-                                    double a= get(ain , ch, i+out_count, in_ch_count, in_sample_fmt);
-                                    double b= get(aout, ch, i, in_ch_count, in_sample_fmt);
-                                    sum_a += a;
-                                    sum_b += b;
-                                    sum_aa+= a*a;
-                                    sum_bb+= b*b;
-                                    sum_ab+= a*b;
-                                    maxdiff= FFMAX(maxdiff, FFABS(a-b));
-                                }
-                                sse= sum_aa + sum_bb - 2*sum_ab;
-
-                                fprintf(stderr, "[e:%f c:%f max:%f] len:%5d F:%3d\n", sqrt(sse/flush_count), sum_ab/(sqrt(sum_aa*sum_bb)), maxdiff, flush_count, flush_i);
-                            }
-                        }
-
-
-                        fprintf(stderr, "\n");
+        mode++;
+        mode%=3;
+        if(mode==0 /*|| out_sample_rate == in_sample_rate*/) {
+            mid_count= swr_convert(forw_ctx, amid, 3*SAMPLES, ain, SAMPLES);
+        } else if(mode==1){
+            mid_count= swr_convert(forw_ctx, amid,         0, ain, SAMPLES);
+            mid_count+=swr_convert(forw_ctx, amid, 3*SAMPLES, ain,       0);
+        } else {
+            int tmp_count;
+            mid_count= swr_convert(forw_ctx, amid,         0, ain,       1);
+            av_assert0(mid_count==0);
+            shift(ain,  1, in_ch_count, in_sample_fmt);
+            mid_count+=swr_convert(forw_ctx, amid, 3*SAMPLES, ain,       0);
+            shift(amid,  mid_count, out_ch_count, out_sample_fmt); tmp_count = mid_count;
+            mid_count+=swr_convert(forw_ctx, amid,         2, ain,       2);
+            shift(amid,  mid_count-tmp_count, out_ch_count, out_sample_fmt); tmp_count = mid_count;
+            shift(ain,  2, in_ch_count, in_sample_fmt);
+            mid_count+=swr_convert(forw_ctx, amid,         1, ain, SAMPLES-3);
+            shift(amid,  mid_count-tmp_count, out_ch_count, out_sample_fmt); tmp_count = mid_count;
+            shift(ain, -3, in_ch_count, in_sample_fmt);
+            mid_count+=swr_convert(forw_ctx, amid, 3*SAMPLES, ain,       0);
+            shift(amid,  -tmp_count, out_ch_count, out_sample_fmt);
+        }
+        out_count= swr_convert(backw_ctx,aout, SAMPLES, amid, mid_count);
+
+        for(ch=0; ch<in_ch_count; ch++){
+            double sse, x, maxdiff=0;
+            double sum_a= 0;
+            double sum_b= 0;
+            double sum_aa= 0;
+            double sum_bb= 0;
+            double sum_ab= 0;
+            for(i=0; i<out_count; i++){
+                double a= get(ain , ch, i, in_ch_count, in_sample_fmt);
+                double b= get(aout, ch, i, in_ch_count, in_sample_fmt);
+                sum_a += a;
+                sum_b += b;
+                sum_aa+= a*a;
+                sum_bb+= b*b;
+                sum_ab+= a*b;
+                maxdiff= FFMAX(maxdiff, FFABS(a-b));
+            }
+            sse= sum_aa + sum_bb - 2*sum_ab;
+
+            fprintf(stderr, "[e:%f c:%f max:%f] len:%5d\n", sqrt(sse/out_count), sum_ab/(sqrt(sum_aa*sum_bb)), maxdiff, out_count);
+        }
+
+        flush_i++;
+        flush_i%=21;
+        flush_count = swr_convert(backw_ctx,aout, flush_i, 0, 0);
+        shift(aout,  flush_i, in_ch_count, in_sample_fmt);
+        flush_count+= swr_convert(backw_ctx,aout, SAMPLES-flush_i, 0, 0);
+        shift(aout, -flush_i, in_ch_count, in_sample_fmt);
+        if(flush_count){
+            for(ch=0; ch<in_ch_count; ch++){
+                double sse, x, maxdiff=0;
+                double sum_a= 0;
+                double sum_b= 0;
+                double sum_aa= 0;
+                double sum_bb= 0;
+                double sum_ab= 0;
+                for(i=0; i<flush_count; i++){
+                    double a= get(ain , ch, i+out_count, in_ch_count, in_sample_fmt);
+                    double b= get(aout, ch, i, in_ch_count, in_sample_fmt);
+                    sum_a += a;
+                    sum_b += b;
+                    sum_aa+= a*a;
+                    sum_bb+= b*b;
+                    sum_ab+= a*b;
+                    maxdiff= FFMAX(maxdiff, FFABS(a-b));
+                }
+                sse= sum_aa + sum_bb - 2*sum_ab;
+
+                fprintf(stderr, "[e:%f c:%f max:%f] len:%5d F:%3d\n", sqrt(sse/flush_count), sum_ab/(sqrt(sum_aa*sum_bb)), maxdiff, flush_count, flush_i);
+            }
+        }
+
+
+        fprintf(stderr, "\n");
     }
 
     return 0;



More information about the ffmpeg-cvslog mailing list