svn merge -r39765:39781 https://svn.blender.org/svnroot/bf-blender/trunk/blender
[blender.git] / source / blender / editors / space_sequencer / sequencer_scopes.c
1 /*
2  * $Id$
3  *
4  * ***** BEGIN GPL LICENSE BLOCK *****
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  *
20  * Author: Peter Schlaile < peter [at] schlaile [dot] de >
21  *
22  * ***** END GPL LICENSE BLOCK *****
23  *
24  */
25
26 /** \file blender/editors/space_sequencer/sequencer_scopes.c
27  *  \ingroup spseq
28  */
29
30
31 #include <math.h>
32 #include <string.h>
33
34 #include "BLI_utildefines.h"
35
36
37
38 #include "IMB_imbuf_types.h"
39 #include "IMB_imbuf.h"
40
41 #include "sequencer_intern.h"
42
43 static void rgb_to_yuv(float rgb[3], float yuv[3]) 
44 {
45                 yuv[0]= 0.299f*rgb[0] + 0.587f*rgb[1] + 0.114f*rgb[2];
46                 yuv[1]= 0.492f*(rgb[2] - yuv[0]);
47                 yuv[2]= 0.877f*(rgb[0] - yuv[0]);
48
49                 /* Normalize */
50                 yuv[1]*= 255.0f/(122*2.0f);
51                 yuv[1]+= 0.5f;
52
53                 yuv[2]*= 255.0f/(157*2.0f);
54                 yuv[2]+= 0.5f;
55 }
56
57 static void scope_put_pixel(unsigned char* table, unsigned char * pos)
58 {
59         char newval = table[*pos];
60         pos[0] = pos[1] = pos[2] = newval;
61         pos[3] = 255;
62 }
63
64 static void scope_put_pixel_single(unsigned char* table, unsigned char * pos,
65                                    int col)
66 {
67         char newval = table[pos[col]];
68         pos[col] = newval;
69         pos[3] = 255;
70 }
71
72 static void wform_put_line(int w,
73                            unsigned char * last_pos, unsigned char * new_pos)
74 {
75         if (last_pos > new_pos) {
76                 unsigned char* temp = new_pos;
77                 new_pos = last_pos;
78                 last_pos = temp;
79         }
80
81         while (last_pos < new_pos) {
82                 if (last_pos[0] == 0) {
83                         last_pos[0] = last_pos[1] = last_pos[2] = 32;
84                         last_pos[3] = 255;
85                 }
86                 last_pos += 4*w;
87         }
88 }
89
90 static void wform_put_line_single(
91         int w, unsigned char * last_pos, unsigned char * new_pos, int col)
92 {
93         if (last_pos > new_pos) {
94                 unsigned char* temp = new_pos;
95                 new_pos = last_pos;
96                 last_pos = temp;
97         }
98
99         while (last_pos < new_pos) {
100                 if (last_pos[col] == 0) {
101                         last_pos[col] = 32;
102                         last_pos[3] = 255;
103                 }
104                 last_pos += 4*w;
105         }
106 }
107
108 static void wform_put_border(unsigned char * tgt, int w, int h)
109 {
110         int x, y;
111
112         for (x = 0; x < w; x++) {
113                 unsigned char * p = tgt + 4 * x;
114                 p[1] = p[3] = 255.0;
115                 p[4 * w + 1] = p[4 * w + 3] = 255.0;
116                 p = tgt + 4 * (w * (h - 1) + x);
117                 p[1] = p[3] = 255.0;
118                 p[-4 * w + 1] = p[-4 * w + 3] = 255.0;
119         }
120
121         for (y = 0; y < h; y++) {
122                 unsigned char * p = tgt + 4 * w * y;
123                 p[1] = p[3] = 255.0;
124                 p[4 + 1] = p[4 + 3] = 255.0;
125                 p = tgt + 4 * (w * y + w - 1);
126                 p[1] = p[3] = 255.0;
127                 p[-4 + 1] = p[-4 + 3] = 255.0;
128         }
129 }
130
131 static void wform_put_gridrow(unsigned char * tgt, float perc, int w, int h)
132 {
133         int i;
134
135         tgt += (int) (perc/100.0f * h) * w * 4;
136
137         for (i = 0; i < w*2; i++) {
138                 tgt[0] = 255;
139
140                 tgt += 4;
141         }
142 }
143
144 static void wform_put_grid(unsigned char * tgt, int w, int h)
145 {
146         wform_put_gridrow(tgt, 90.0, w, h);
147         wform_put_gridrow(tgt, 70.0, w, h);
148         wform_put_gridrow(tgt, 10.0, w, h);
149 }
150
151 static struct ImBuf *make_waveform_view_from_ibuf_byte(struct ImBuf * ibuf)
152 {
153         struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect);
154         int x,y;
155         unsigned char* src = (unsigned char*) ibuf->rect;
156         unsigned char* tgt = (unsigned char*) rval->rect;
157         int w = ibuf->x + 3;
158         int h = 515;
159         float waveform_gamma = 0.2;
160         unsigned char wtable[256];
161
162         wform_put_grid(tgt, w, h);
163
164         for (x = 0; x < 256; x++) {
165                 wtable[x] = (unsigned char) (pow(((float) x + 1)/256, 
166                                                  waveform_gamma)*255);
167         }
168
169         for (y = 0; y < ibuf->y; y++) {
170                 unsigned char * last_p = NULL;
171
172                 for (x = 0; x < ibuf->x; x++) {
173                         unsigned char * rgb = src + 4 * (ibuf->x * y + x);
174                         float v = 1.0 * 
175                                 (  0.299*rgb[0] 
176                                  + 0.587*rgb[1] 
177                                  + 0.114*rgb[2]) / 255.0;
178                         unsigned char * p = tgt;
179                         p += 4 * (w * ((int) (v * (h - 3)) + 1) + x + 1);
180
181                         scope_put_pixel(wtable, p);
182                         p += 4 * w;
183                         scope_put_pixel(wtable, p);
184
185                         if (last_p != NULL) {
186                                 wform_put_line(w, last_p, p);
187                         }
188                         last_p = p;
189                 }
190         }
191
192         wform_put_border(tgt, w, h);
193         
194         return rval;
195 }
196
197 static struct ImBuf *make_waveform_view_from_ibuf_float(struct ImBuf * ibuf)
198 {
199         struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect);
200         int x,y;
201         float* src = ibuf->rect_float;
202         unsigned char* tgt = (unsigned char*) rval->rect;
203         int w = ibuf->x + 3;
204         int h = 515;
205         float waveform_gamma = 0.2;
206         unsigned char wtable[256];
207
208         wform_put_grid(tgt, w, h);
209
210         for (x = 0; x < 256; x++) {
211                 wtable[x] = (unsigned char) (pow(((float) x + 1)/256, 
212                                                  waveform_gamma)*255);
213         }
214
215         for (y = 0; y < ibuf->y; y++) {
216                 unsigned char * last_p = NULL;
217
218                 for (x = 0; x < ibuf->x; x++) {
219                         float * rgb = src + 4 * (ibuf->x * y + x);
220                         float v = 1.0f *
221                                 (  0.299f*rgb[0]
222                                  + 0.587f*rgb[1]
223                                  + 0.114f*rgb[2]);
224                         unsigned char * p = tgt;
225
226                         CLAMP(v, 0.0f, 1.0f);
227
228                         p += 4 * (w * ((int) (v * (h - 3)) + 1) + x + 1);
229
230                         scope_put_pixel(wtable, p);
231                         p += 4 * w;
232                         scope_put_pixel(wtable, p);
233
234                         if (last_p != NULL) {
235                                 wform_put_line(w, last_p, p);
236                         }
237                         last_p = p;
238                 }
239         }
240
241         wform_put_border(tgt, w, h);
242         
243         return rval;
244 }
245
246 struct ImBuf *make_waveform_view_from_ibuf(struct ImBuf * ibuf)
247 {
248         if (ibuf->rect_float) {
249                 return make_waveform_view_from_ibuf_float(ibuf);
250         } else {
251                 return make_waveform_view_from_ibuf_byte(ibuf);
252         }
253 }
254
255
256 static struct ImBuf *make_sep_waveform_view_from_ibuf_byte(struct ImBuf * ibuf)
257 {
258         struct ImBuf * rval = IMB_allocImBuf(
259                 ibuf->x + 3, 515, 32, IB_rect);
260         int x,y;
261         unsigned char* src = (unsigned char*) ibuf->rect;
262         unsigned char* tgt = (unsigned char*) rval->rect;
263         int w = ibuf->x + 3;
264         int sw = ibuf->x/3;
265         int h = 515;
266         float waveform_gamma = 0.2;
267         unsigned char wtable[256];
268
269         wform_put_grid(tgt, w, h);
270
271         for (x = 0; x < 256; x++) {
272                 wtable[x] = (unsigned char) (pow(((float) x + 1)/256, 
273                                                  waveform_gamma)*255);
274         }
275
276         for (y = 0; y < ibuf->y; y++) {
277                 unsigned char *last_p[3] = {NULL, NULL, NULL};
278
279                 for (x = 0; x < ibuf->x; x++) {
280                         int c;
281                         unsigned char * rgb = src + 4 * (ibuf->x * y + x);
282                         for (c = 0; c < 3; c++) {
283                                 unsigned char * p = tgt;
284                                 p += 4 * (w * ((rgb[c] * (h - 3))/255 + 1) 
285                                           + c * sw + x/3 + 1);
286
287                                 scope_put_pixel_single(wtable, p, c);
288                                 p += 4 * w;
289                                 scope_put_pixel_single(wtable, p, c);
290
291                                 if (last_p[c] != NULL) {
292                                         wform_put_line_single(
293                                                 w, last_p[c], p, c);
294                                 }
295                                 last_p[c] = p;
296                         }
297                 }
298         }
299
300         wform_put_border(tgt, w, h);
301         
302         return rval;
303 }
304
305 static struct ImBuf *make_sep_waveform_view_from_ibuf_float(
306         struct ImBuf * ibuf)
307 {
308         struct ImBuf * rval = IMB_allocImBuf(
309                 ibuf->x + 3, 515, 32, IB_rect);
310         int x,y;
311         float* src = ibuf->rect_float;
312         unsigned char* tgt = (unsigned char*) rval->rect;
313         int w = ibuf->x + 3;
314         int sw = ibuf->x/3;
315         int h = 515;
316         float waveform_gamma = 0.2;
317         unsigned char wtable[256];
318
319         wform_put_grid(tgt, w, h);
320
321         for (x = 0; x < 256; x++) {
322                 wtable[x] = (unsigned char) (pow(((float) x + 1)/256, 
323                                                  waveform_gamma)*255);
324         }
325
326         for (y = 0; y < ibuf->y; y++) {
327                 unsigned char *last_p[3] = {NULL, NULL, NULL};
328
329                 for (x = 0; x < ibuf->x; x++) {
330                         int c;
331                         float * rgb = src + 4 * (ibuf->x * y + x);
332                         for (c = 0; c < 3; c++) {
333                                 unsigned char * p = tgt;
334                                 float v = rgb[c];
335
336                                 CLAMP(v, 0.0f, 1.0f);
337
338                                 p += 4 * (w * ((int) (v * (h - 3)) + 1)
339                                           + c * sw + x/3 + 1);
340
341                                 scope_put_pixel_single(wtable, p, c);
342                                 p += 4 * w;
343                                 scope_put_pixel_single(wtable, p, c);
344
345                                 if (last_p[c] != NULL) {
346                                         wform_put_line_single(
347                                                 w, last_p[c], p, c);
348                                 }
349                                 last_p[c] = p;
350                         }
351                 }
352         }
353
354         wform_put_border(tgt, w, h);
355         
356         return rval;
357 }
358
359 struct ImBuf *make_sep_waveform_view_from_ibuf(struct ImBuf * ibuf)
360 {
361         if (ibuf->rect_float) {
362                 return make_sep_waveform_view_from_ibuf_float(ibuf);
363         } else {
364                 return make_sep_waveform_view_from_ibuf_byte(ibuf);
365         }
366 }
367
368 static void draw_zebra_byte(struct ImBuf * src,struct ImBuf * ibuf, float perc)
369 {
370         unsigned int limit = 255.0f * perc / 100.0f;
371         unsigned char * p = (unsigned char*) src->rect;
372         unsigned char * o = (unsigned char*) ibuf->rect;
373         int x;
374         int y;
375
376         for (y = 0; y < ibuf->y; y++) {
377                 for (x = 0; x < ibuf->x; x++) {
378                         unsigned char r = *p++;
379                         unsigned char g = *p++;
380                         unsigned char b = *p++;
381                         unsigned char a = *p++;
382
383                         if (r >= limit || g >= limit || b >= limit) {
384                                 if (((x + y) & 0x08) != 0) {
385                                         r = 255 - r;
386                                         g = 255 - g;
387                                         b = 255 - b;
388                                 }
389                         }
390                         *o++ = r;
391                         *o++ = g;
392                         *o++ = b;
393                         *o++ = a;
394                 }
395         }
396 }
397
398
399 static void draw_zebra_float(struct ImBuf * src,struct ImBuf * ibuf,float perc)
400 {
401         float limit = perc / 100.0f;
402         float * p = src->rect_float;
403         unsigned char * o = (unsigned char*) ibuf->rect;
404         int x;
405         int y;
406
407         for (y = 0; y < ibuf->y; y++) {
408                 for (x = 0; x < ibuf->x; x++) {
409                         float r = *p++;
410                         float g = *p++;
411                         float b = *p++;
412                         float a = *p++;
413
414                         if (r >= limit || g >= limit || b >= limit) {
415                                 if (((x + y) & 0x08) != 0) {
416                                         r = -r;
417                                         g = -g;
418                                         b = -b;
419                                 }
420                         }
421
422                         *o++ = FTOCHAR(r);
423                         *o++ = FTOCHAR(g);
424                         *o++ = FTOCHAR(b);
425                         *o++ = FTOCHAR(a);
426                 }
427         }
428 }
429
430 struct ImBuf * make_zebra_view_from_ibuf(struct ImBuf * src, float perc)
431 {
432         struct ImBuf * ibuf = IMB_allocImBuf(src->x, src->y, 32, IB_rect);
433
434         if (src->rect_float) {
435                 draw_zebra_float(src, ibuf, perc);
436         } else {
437                 draw_zebra_byte(src, ibuf, perc);
438         }
439         return ibuf;
440 }
441
442 static void draw_histogram_marker(struct ImBuf * ibuf, int x)
443 {
444         unsigned char * p = (unsigned char*) ibuf->rect;
445         int barh = ibuf->y * 0.1;
446         int i;
447
448         p += 4 * (x + ibuf->x * (ibuf->y - barh + 1));
449
450         for (i = 0; i < barh-1; i++) {
451                 p[0] = p[1] = p[2] = 255;
452                 p += ibuf->x * 4;
453         }
454 }
455
456 static void draw_histogram_bar(struct ImBuf * ibuf, int x,float val, int col)
457 {
458         unsigned char * p = (unsigned char*) ibuf->rect;
459         int barh = ibuf->y * val * 0.9f;
460         int i;
461
462         p += 4 * (x + ibuf->x);
463
464         for (i = 0; i < barh; i++) {
465                 p[col] = 255;
466                 p += ibuf->x * 4;
467         }
468 }
469
470 static struct ImBuf *make_histogram_view_from_ibuf_byte(
471         struct ImBuf * ibuf)
472 {
473         struct ImBuf * rval = IMB_allocImBuf(515, 128, 32, IB_rect);
474         int c,x,y;
475         unsigned int n;
476         unsigned char* src = (unsigned char*) ibuf->rect;
477
478         unsigned int bins[3][256];
479
480         memset(bins, 0, 3 * 256* sizeof(unsigned int));
481
482         for (y = 0; y < ibuf->y; y++) {
483                 for (x = 0; x < ibuf->x; x++) {
484                         bins[0][*src++]++;
485                         bins[1][*src++]++;
486                         bins[2][*src++]++;
487                         src++;
488                 }
489         }
490
491         n = 0;
492         for (c = 0; c < 3; c++) {
493                 for (x = 0; x < 256; x++) {
494                         if (bins[c][x] > n) {
495                                 n = bins[c][x];
496                         }
497                 }
498         }
499
500         for (c = 0; c < 3; c++) {
501                 for (x = 0; x < 256; x++) {
502                         draw_histogram_bar(rval, x*2+1, 
503                                            ((float) bins[c][x])/n, c);
504                         draw_histogram_bar(rval, x*2+2, 
505                                            ((float) bins[c][x])/n, c);
506                 }
507         }
508
509         wform_put_border((unsigned char*) rval->rect, rval->x, rval->y);
510         
511         return rval;
512 }
513
514 static int get_bin_float(float f)
515 {
516         if (f < -0.25f) {
517                 f = -0.25f;
518         } else if (f > 1.25f) {
519                 f = 1.25f;
520         }
521
522         return (int) (((f + 0.25f) / 1.5f) * 512);
523 }
524
525 static struct ImBuf *make_histogram_view_from_ibuf_float(
526         struct ImBuf * ibuf)
527 {
528         struct ImBuf * rval = IMB_allocImBuf(515, 128, 32, IB_rect);
529         int n,c,x,y;
530         float* src = ibuf->rect_float;
531
532         unsigned int bins[3][512];
533
534         memset(bins, 0, 3 * 256* sizeof(unsigned int));
535
536         for (y = 0; y < ibuf->y; y++) {
537                 for (x = 0; x < ibuf->x; x++) {
538                         bins[0][get_bin_float(*src++)]++;
539                         bins[1][get_bin_float(*src++)]++;
540                         bins[2][get_bin_float(*src++)]++;
541                         src++;
542                 }
543         }
544
545         draw_histogram_marker(rval, get_bin_float(0.0));
546         draw_histogram_marker(rval, get_bin_float(1.0));
547
548         n = 0;
549         for (c = 0; c < 3; c++) {
550                 for (x = 0; x < 512; x++) {
551                         if (bins[c][x] > n) {
552                                 n = bins[c][x];
553                         }
554                 }
555         }
556         for (c = 0; c < 3; c++) {
557                 for (x = 0; x < 512; x++) {
558                         draw_histogram_bar(rval, x+1, (float) bins[c][x]/n, c);
559                 }
560         }
561
562         wform_put_border((unsigned char*) rval->rect, rval->x, rval->y);
563         
564         return rval;
565 }
566
567 struct ImBuf *make_histogram_view_from_ibuf(struct ImBuf * ibuf)
568 {
569         if (ibuf->rect_float) {
570                 return make_histogram_view_from_ibuf_float(ibuf);
571         } else {
572                 return make_histogram_view_from_ibuf_byte(ibuf);
573         }
574 }
575
576 static void vectorscope_put_cross(unsigned char r, unsigned char g, 
577                                   unsigned char b, 
578                                   char * tgt, int w, int h, int size)
579 {
580         float rgb[3], yuv[3];
581         char * p;
582         int x = 0;
583         int y = 0;
584
585         rgb[0]= (float)r/255.0f;
586         rgb[1]= (float)g/255.0f;
587         rgb[2]= (float)b/255.0f;
588         rgb_to_yuv(rgb, yuv);
589                         
590         p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1)) 
591                            + (int) ((yuv[1] * (w - 3) + 1)));
592
593         if (r == 0 && g == 0 && b == 0) {
594                 r = 255;
595         }
596
597         for (y = -size; y <= size; y++) {
598                 for (x = -size; x <= size; x++) {
599                         char * q = p + 4 * (y * w + x);
600                         q[0] = r; q[1] = g; q[2] = b; q[3] = 255;
601                 }
602         }
603 }
604
605 static struct ImBuf *make_vectorscope_view_from_ibuf_byte(struct ImBuf * ibuf)
606 {
607         struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect);
608         int x,y;
609         char* src = (char*) ibuf->rect;
610         char* tgt = (char*) rval->rect;
611         float rgb[3], yuv[3];
612         int w = 515;
613         int h = 515;
614         float scope_gamma = 0.2;
615         unsigned char wtable[256];
616
617         for (x = 0; x < 256; x++) {
618                 wtable[x] = (unsigned char) (pow(((float) x + 1)/256, 
619                                                  scope_gamma)*255);
620         }
621
622         for (x = 0; x <= 255; x++) {
623                 vectorscope_put_cross(255   ,     0,255 - x, tgt, w, h, 1);
624                 vectorscope_put_cross(255   ,     x,      0, tgt, w, h, 1);
625                 vectorscope_put_cross(255- x,   255,      0, tgt, w, h, 1);
626                 vectorscope_put_cross(0,        255,      x, tgt, w, h, 1);
627                 vectorscope_put_cross(0,    255 - x,    255, tgt, w, h, 1);
628                 vectorscope_put_cross(x,          0,    255, tgt, w, h, 1);
629         }
630
631         for (y = 0; y < ibuf->y; y++) {
632                 for (x = 0; x < ibuf->x; x++) {
633                         char * src1 = src + 4 * (ibuf->x * y + x);
634                         char * p;
635                         
636                         rgb[0]= (float)src1[0]/255.0f;
637                         rgb[1]= (float)src1[1]/255.0f;
638                         rgb[2]= (float)src1[2]/255.0f;
639                         rgb_to_yuv(rgb, yuv);
640                         
641                         p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1)) 
642                                            + (int) ((yuv[1] * (w - 3) + 1)));
643                         scope_put_pixel(wtable, (unsigned char*)p);
644                 }
645         }
646
647         vectorscope_put_cross(0, 0, 0, tgt, w, h, 3);
648
649         return rval;
650 }
651
652 static struct ImBuf *make_vectorscope_view_from_ibuf_float(struct ImBuf * ibuf)
653 {
654         struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect);
655         int x,y;
656         float* src = ibuf->rect_float;
657         char* tgt = (char*) rval->rect;
658         float rgb[3], yuv[3];
659         int w = 515;
660         int h = 515;
661         float scope_gamma = 0.2;
662         unsigned char wtable[256];
663
664         for (x = 0; x < 256; x++) {
665                 wtable[x] = (unsigned char) (pow(((float) x + 1)/256, 
666                                                  scope_gamma)*255);
667         }
668
669         for (x = 0; x <= 255; x++) {
670                 vectorscope_put_cross(255   ,     0,255 - x, tgt, w, h, 1);
671                 vectorscope_put_cross(255   ,     x,      0, tgt, w, h, 1);
672                 vectorscope_put_cross(255- x,   255,      0, tgt, w, h, 1);
673                 vectorscope_put_cross(0,        255,      x, tgt, w, h, 1);
674                 vectorscope_put_cross(0,    255 - x,    255, tgt, w, h, 1);
675                 vectorscope_put_cross(x,          0,    255, tgt, w, h, 1);
676         }
677
678         for (y = 0; y < ibuf->y; y++) {
679                 for (x = 0; x < ibuf->x; x++) {
680                         float * src1 = src + 4 * (ibuf->x * y + x);
681                         char * p;
682                         
683                         memcpy(rgb, src1, 3 * sizeof(float));
684
685                         CLAMP(rgb[0], 0.0f, 1.0f);
686                         CLAMP(rgb[1], 0.0f, 1.0f);
687                         CLAMP(rgb[2], 0.0f, 1.0f);
688
689                         rgb_to_yuv(rgb, yuv);
690                         
691                         p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1)) 
692                                            + (int) ((yuv[1] * (w - 3) + 1)));
693                         scope_put_pixel(wtable, (unsigned char*)p);
694                 }
695         }
696
697         vectorscope_put_cross(0, 0, 0, tgt, w, h, 3);
698
699         return rval;
700 }
701
702 struct ImBuf *make_vectorscope_view_from_ibuf(struct ImBuf * ibuf)
703 {
704         if (ibuf->rect_float) {
705                 return make_vectorscope_view_from_ibuf_float(ibuf);
706         } else {
707                 return make_vectorscope_view_from_ibuf_byte(ibuf);
708         }
709 }