Browse code

avfilter/vf_vectorscope: always flip output vertically

Signed-off-by: Paul B Mahol <onemda@gmail.com>

Paul B Mahol authored on 2016/03/21 05:03:43
Showing 7 changed files
... ...
@@ -911,7 +911,7 @@ static void draw_htext(AVFrame *out, int x, int y, float o1, float o2, const cha
911 911
             int v = color[plane];
912 912
 
913 913
             uint8_t *p = out->data[plane] + y * out->linesize[plane] + (x + i * 8);
914
-            for (char_y = 0; char_y < font_height; char_y++) {
914
+            for (char_y = font_height - 1; char_y >= 0; char_y--) {
915 915
                 for (mask = 0x80; mask; mask >>= 1) {
916 916
                     if (font[txt[i] * font_height + char_y] & mask)
917 917
                         p[0] = p[0] * o2 + v * o1;
... ...
@@ -937,7 +937,7 @@ static void draw_htext16(AVFrame *out, int x, int y, float o1, float o2, const c
937 937
             int v = color[plane];
938 938
 
939 939
             uint16_t *p = (uint16_t *)(out->data[plane] + y * out->linesize[plane]) + (x + i * 8);
940
-            for (char_y = 0; char_y < font_height; char_y++) {
940
+            for (char_y = font_height - 1; char_y >= 0; char_y--) {
941 941
                 for (mask = 0x80; mask; mask >>= 1) {
942 942
                     if (font[txt[i] * font_height + char_y] & mask)
943 943
                         p[0] = p[0] * o2 + v * o1;
... ...
@@ -1207,6 +1207,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
1207 1207
     VectorscopeContext *s = ctx->priv;
1208 1208
     AVFilterLink *outlink = ctx->outputs[0];
1209 1209
     AVFrame *out;
1210
+    int plane;
1210 1211
 
1211 1212
     if (s->colorspace) {
1212 1213
         s->cs = (s->depth - 8) * 2 + s->colorspace - 1;
... ...
@@ -1232,6 +1233,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
1232 1232
     s->vectorscope(s, in, out, s->pd);
1233 1233
     s->graticulef(s, out, s->x, s->y, s->pd, s->cs);
1234 1234
 
1235
+    for (plane = 0; plane < 4; plane++) {
1236
+        if (out->data[plane]) {
1237
+            out->data[plane]    += (s->size - 1) * out->linesize[plane];
1238
+            out->linesize[plane] = -out->linesize[plane];
1239
+        }
1240
+    }
1241
+
1235 1242
     av_frame_free(&in);
1236 1243
     return ff_filter_frame(outlink, out);
1237 1244
 }
... ...
@@ -1,4 +1,4 @@
1 1
 #tb 0: 1/25
2
-0,          0,          0,        1,   196608, 0x1890aa30
3
-0,          1,          1,        1,   196608, 0xa490acf9
4
-0,          2,          2,        1,   196608, 0x404a775d
2
+0,          0,          0,        1,   196608, 0xf6e3aa30
3
+0,          1,          1,        1,   196608, 0x5584acf9
4
+0,          2,          2,        1,   196608, 0xa862775d
... ...
@@ -1,4 +1,4 @@
1 1
 #tb 0: 1/25
2
-0,          0,          0,        1,   196608, 0x9bfcfae5
3
-0,          1,          1,        1,   196608, 0x1ac6fcbf
4
-0,          2,          2,        1,   196608, 0x31cb1088
2
+0,          0,          0,        1,   196608, 0x5e62fae5
3
+0,          1,          1,        1,   196608, 0x4c27fcbf
4
+0,          2,          2,        1,   196608, 0xb7531088
... ...
@@ -1,4 +1,4 @@
1 1
 #tb 0: 1/25
2
-0,          0,          0,        1,   196608, 0x6e698770
3
-0,          1,          1,        1,   196608, 0x374d74a7
4
-0,          2,          2,        1,   196608, 0x3d817143
2
+0,          0,          0,        1,   196608, 0x83df8770
3
+0,          1,          1,        1,   196608, 0xa6a674a7
4
+0,          2,          2,        1,   196608, 0x11757143
... ...
@@ -1,4 +1,4 @@
1 1
 #tb 0: 1/25
2
-0,          0,          0,        1,   196608, 0x4d2e53c4
3
-0,          1,          1,        1,   196608, 0x795e1dcc
4
-0,          2,          2,        1,   196608, 0xe4268800
2
+0,          0,          0,        1,   196608, 0x326953c4
3
+0,          1,          1,        1,   196608, 0x870e1dcc
4
+0,          2,          2,        1,   196608, 0x87cb8800
... ...
@@ -1,4 +1,4 @@
1 1
 #tb 0: 1/25
2
-0,          0,          0,        1,   196608, 0x8e4171e2
3
-0,          1,          1,        1,   196608, 0xf3d371e2
4
-0,          2,          2,        1,   196608, 0xb9cb71e2
2
+0,          0,          0,        1,   196608, 0x79ba71e2
3
+0,          1,          1,        1,   196608, 0x909271e2
4
+0,          2,          2,        1,   196608, 0x143971e2
... ...
@@ -1,4 +1,4 @@
1 1
 #tb 0: 1/25
2
-0,          0,          0,        1,   196608, 0xa0939af1
3
-0,          1,          1,        1,   196608, 0x43699af1
4
-0,          2,          2,        1,   196608, 0x69a19af1
2
+0,          0,          0,        1,   196608, 0xa2899af1
3
+0,          1,          1,        1,   196608, 0x26409af1
4
+0,          2,          2,        1,   196608, 0xf5209af1