207 COLOR_POS_Q, |
210 COLOR_POS_Q, |
208 COLOR_SUPER_BLACK, |
211 COLOR_SUPER_BLACK, |
209 COLOR_DARK_GREY |
212 COLOR_DARK_GREY |
210 }; |
213 }; |
211 |
214 |
212 static const struct vts_color_struct vts_colors[] = { |
215 static const struct vts_color_struct_rgb vts_colors_rgb[] = { |
213 /* 100% white */ |
216 {255, 255, 255}, |
214 {255, 128, 128, 255, 255, 255, 255}, |
217 {255, 255, 0}, |
215 /* yellow */ |
218 {0, 255, 255}, |
216 {226, 0, 155, 255, 255, 0, 255}, |
219 {0, 255, 0}, |
217 /* cyan */ |
220 {255, 0, 255}, |
218 {179, 170, 0, 0, 255, 255, 255}, |
221 {255, 0, 0}, |
219 /* green */ |
222 {0, 0, 255}, |
220 {150, 46, 21, 0, 255, 0, 255}, |
223 {0, 0, 0}, |
221 /* magenta */ |
224 {0, 0, 128}, /* -I ? */ |
222 {105, 212, 235, 255, 0, 255, 255}, |
225 {0, 128, 255}, /* +Q ? */ |
223 /* red */ |
226 {0, 0, 0}, |
224 {76, 85, 255, 255, 0, 0, 255}, |
227 {19, 19, 19}, |
225 /* blue */ |
|
226 {29, 255, 107, 0, 0, 255, 255}, |
|
227 /* black */ |
|
228 {16, 128, 128, 0, 0, 0, 255}, |
|
229 /* -I */ |
|
230 {16, 198, 21, 0, 0, 128, 255}, |
|
231 /* +Q */ |
|
232 {16, 235, 198, 0, 128, 255, 255}, |
|
233 /* superblack */ |
|
234 {0, 128, 128, 0, 0, 0, 255}, |
|
235 /* 5% grey */ |
|
236 {32, 128, 128, 32, 32, 32, 255}, |
|
237 }; |
228 }; |
238 |
229 |
239 |
230 static const struct vts_color_struct_rgb vts_colors_rgb_75[] = { |
240 #if 0 |
231 {191, 191, 191}, |
241 |
232 {191, 191, 0}, |
242 /* wht yel cya grn mag red blu blk -I Q, superblack, dark grey */ |
233 {0, 191, 191}, |
243 static int y_colors[] = { 255, 226, 179, 150, 105, 76, 29, 16, 16, 16, 0, 32 }; |
234 {0, 191, 0}, |
244 static int u_colors[] = |
235 {191, 0, 191}, |
245 { 128, 0, 170, 46, 212, 85, 255, 128, 198, 235, 128, 128 }; |
236 {191, 0, 0}, |
246 static int v_colors[] = |
237 {0, 0, 191}, |
247 { 128, 155, 0, 21, 235, 255, 107, 128, 21, 198, 128, 128 }; |
238 {0, 0, 0}, |
248 |
239 {0, 0, 128}, /* -I ? */ |
249 /* wht yel cya grn mag red blu blk -I Q superblack, dark grey */ |
240 {0, 128, 255}, /* +Q ? */ |
250 static int r_colors[] = { 255, 255, 0, 0, 255, 255, 0, 0, 0, 0, 0, 32 }; |
241 {0, 0, 0}, |
251 static int g_colors[] = { 255, 255, 255, 255, 0, 0, 0, 0, 0, 128, 0, 32 }; |
242 {19, 19, 19}, |
252 static int b_colors[] = { 255, 0, 255, 0, 255, 0, 255, 0, 128, 255, 0, 32 }; |
243 }; |
253 #endif |
244 |
254 |
245 static const struct vts_color_struct_yuv vts_colors_bt709_ycbcr_100[] = { |
|
246 {235, 128, 128}, |
|
247 {219, 16, 138}, |
|
248 {188, 154, 16}, |
|
249 {173, 42, 26}, |
|
250 {78, 214, 230}, |
|
251 {63, 102, 240}, |
|
252 {32, 240, 118}, |
|
253 {16, 128, 128}, |
|
254 {16, 198, 21}, /* -I ? */ |
|
255 {16, 235, 198}, /* +Q ? */ |
|
256 {0, 128, 128}, |
|
257 {32, 128, 128}, |
|
258 }; |
|
259 |
|
260 static const struct vts_color_struct_yuv vts_colors_bt709_ycbcr_75[] = { |
|
261 {180, 128, 128}, |
|
262 {168, 44, 136}, |
|
263 {145, 147, 44}, |
|
264 {133, 63, 52}, |
|
265 {63, 193, 204}, |
|
266 {51, 109, 212}, |
|
267 {28, 212, 120}, |
|
268 {16, 128, 128}, |
|
269 {16, 198, 21}, /* -I ? */ |
|
270 {16, 235, 198}, /* +Q ? */ |
|
271 {0, 128, 128}, |
|
272 {32, 128, 128}, |
|
273 }; |
|
274 |
|
275 static const struct vts_color_struct_yuv vts_colors_bt601_ycbcr_100[] = { |
|
276 {235, 128, 128}, |
|
277 {210, 16, 146}, |
|
278 {170, 166, 16}, |
|
279 {145, 54, 34}, |
|
280 {106, 202, 222}, |
|
281 {81, 90, 240}, |
|
282 {41, 240, 110}, |
|
283 {16, 128, 128}, |
|
284 {16, 198, 21}, /* -I ? */ |
|
285 {16, 235, 198}, /* +Q ? */ |
|
286 {-0, 128, 128}, |
|
287 {32, 128, 128}, |
|
288 }; |
|
289 |
|
290 static const struct vts_color_struct_yuv vts_colors_bt601_ycbcr_75[] = { |
|
291 {180, 128, 128}, |
|
292 {162, 44, 142}, |
|
293 {131, 156, 44}, |
|
294 {112, 72, 58}, |
|
295 {84, 184, 198}, |
|
296 {65, 100, 212}, |
|
297 {35, 212, 114}, |
|
298 {16, 128, 128}, |
|
299 {16, 198, 21}, /* -I ? */ |
|
300 {16, 235, 198}, /* +Q ? */ |
|
301 {-0, 128, 128}, |
|
302 {32, 128, 128}, |
|
303 }; |
|
304 |
|
305 static const struct vts_color_struct_gray vts_colors_gray_100[] = { |
|
306 {235 << 8}, |
|
307 {210 << 8}, |
|
308 {170 << 8}, |
|
309 {145 << 8}, |
|
310 {106 << 8}, |
|
311 {81 << 8}, |
|
312 {41 << 8}, |
|
313 {16 << 8}, |
|
314 {16 << 8}, |
|
315 {16 << 8}, |
|
316 {-0 << 8}, |
|
317 {32 << 8}, |
|
318 }; |
|
319 |
|
320 static const struct vts_color_struct_gray vts_colors_gray_75[] = { |
|
321 {180 << 8}, |
|
322 {162 << 8}, |
|
323 {131 << 8}, |
|
324 {112 << 8}, |
|
325 {84 << 8}, |
|
326 {65 << 8}, |
|
327 {35 << 8}, |
|
328 {16 << 8}, |
|
329 {16 << 8}, |
|
330 {16 << 8}, |
|
331 {-0 << 8}, |
|
332 {32 << 8}, |
|
333 }; |
255 |
334 |
256 static void paint_setup_I420 (paintinfo * p, unsigned char *dest); |
335 static void paint_setup_I420 (paintinfo * p, unsigned char *dest); |
257 static void paint_setup_YV12 (paintinfo * p, unsigned char *dest); |
336 static void paint_setup_YV12 (paintinfo * p, unsigned char *dest); |
258 static void paint_setup_YUY2 (paintinfo * p, unsigned char *dest); |
337 static void paint_setup_YUY2 (paintinfo * p, unsigned char *dest); |
259 static void paint_setup_UYVY (paintinfo * p, unsigned char *dest); |
338 static void paint_setup_UYVY (paintinfo * p, unsigned char *dest); |
260 static void paint_setup_YVYU (paintinfo * p, unsigned char *dest); |
339 static void paint_setup_YVYU (paintinfo * p, unsigned char *dest); |
261 static void paint_setup_IYU2 (paintinfo * p, unsigned char *dest); |
340 static void paint_setup_IYU2 (paintinfo * p, unsigned char *dest); |
262 static void paint_setup_Y41B (paintinfo * p, unsigned char *dest); |
341 static void paint_setup_Y41B (paintinfo * p, unsigned char *dest); |
263 static void paint_setup_Y42B (paintinfo * p, unsigned char *dest); |
342 static void paint_setup_Y42B (paintinfo * p, unsigned char *dest); |
|
343 static void paint_setup_Y444 (paintinfo * p, unsigned char *dest); |
264 static void paint_setup_Y800 (paintinfo * p, unsigned char *dest); |
344 static void paint_setup_Y800 (paintinfo * p, unsigned char *dest); |
265 static void paint_setup_AYUV (paintinfo * p, unsigned char *dest); |
345 static void paint_setup_AYUV (paintinfo * p, unsigned char *dest); |
|
346 static void paint_setup_v308 (paintinfo * p, unsigned char *dest); |
|
347 static void paint_setup_NV12 (paintinfo * p, unsigned char *dest); |
|
348 static void paint_setup_NV21 (paintinfo * p, unsigned char *dest); |
|
349 static void paint_setup_v410 (paintinfo * p, unsigned char *dest); |
|
350 static void paint_setup_v216 (paintinfo * p, unsigned char *dest); |
|
351 static void paint_setup_v210 (paintinfo * p, unsigned char *dest); |
266 |
352 |
267 #if 0 |
353 #if 0 |
268 static void paint_setup_IMC1 (paintinfo * p, unsigned char *dest); |
354 static void paint_setup_IMC1 (paintinfo * p, unsigned char *dest); |
269 static void paint_setup_IMC2 (paintinfo * p, unsigned char *dest); |
355 static void paint_setup_IMC2 (paintinfo * p, unsigned char *dest); |
270 static void paint_setup_IMC3 (paintinfo * p, unsigned char *dest); |
356 static void paint_setup_IMC3 (paintinfo * p, unsigned char *dest); |
286 static void paint_setup_xRGB1555 (paintinfo * p, unsigned char *dest); |
372 static void paint_setup_xRGB1555 (paintinfo * p, unsigned char *dest); |
287 |
373 |
288 static void paint_setup_bayer (paintinfo * p, unsigned char *dest); |
374 static void paint_setup_bayer (paintinfo * p, unsigned char *dest); |
289 |
375 |
290 static void paint_hline_I420 (paintinfo * p, int x, int y, int w); |
376 static void paint_hline_I420 (paintinfo * p, int x, int y, int w); |
|
377 static void paint_hline_NV12_NV21 (paintinfo * p, int x, int y, int w); |
291 static void paint_hline_YUY2 (paintinfo * p, int x, int y, int w); |
378 static void paint_hline_YUY2 (paintinfo * p, int x, int y, int w); |
292 static void paint_hline_IYU2 (paintinfo * p, int x, int y, int w); |
379 static void paint_hline_IYU2 (paintinfo * p, int x, int y, int w); |
293 static void paint_hline_Y41B (paintinfo * p, int x, int y, int w); |
380 static void paint_hline_Y41B (paintinfo * p, int x, int y, int w); |
294 static void paint_hline_Y42B (paintinfo * p, int x, int y, int w); |
381 static void paint_hline_Y42B (paintinfo * p, int x, int y, int w); |
|
382 static void paint_hline_Y444 (paintinfo * p, int x, int y, int w); |
295 static void paint_hline_Y800 (paintinfo * p, int x, int y, int w); |
383 static void paint_hline_Y800 (paintinfo * p, int x, int y, int w); |
|
384 static void paint_hline_v308 (paintinfo * p, int x, int y, int w); |
296 static void paint_hline_AYUV (paintinfo * p, int x, int y, int w); |
385 static void paint_hline_AYUV (paintinfo * p, int x, int y, int w); |
|
386 static void paint_hline_v410 (paintinfo * p, int x, int y, int w); |
|
387 static void paint_hline_v216 (paintinfo * p, int x, int y, int w); |
|
388 static void paint_hline_v210 (paintinfo * p, int x, int y, int w); |
297 |
389 |
298 #if 0 |
390 #if 0 |
299 static void paint_hline_IMC1 (paintinfo * p, int x, int y, int w); |
391 static void paint_hline_IMC1 (paintinfo * p, int x, int y, int w); |
300 #endif |
392 #endif |
301 static void paint_hline_YUV9 (paintinfo * p, int x, int y, int w); |
393 static void paint_hline_YUV9 (paintinfo * p, int x, int y, int w); |
304 static void paint_hline_RGB565 (paintinfo * p, int x, int y, int w); |
396 static void paint_hline_RGB565 (paintinfo * p, int x, int y, int w); |
305 static void paint_hline_xRGB1555 (paintinfo * p, int x, int y, int w); |
397 static void paint_hline_xRGB1555 (paintinfo * p, int x, int y, int w); |
306 |
398 |
307 static void paint_hline_bayer (paintinfo * p, int x, int y, int w); |
399 static void paint_hline_bayer (paintinfo * p, int x, int y, int w); |
308 |
400 |
|
401 static void paint_setup_GRAY8 (paintinfo * p, unsigned char *dest); |
|
402 static void paint_setup_GRAY16 (paintinfo * p, unsigned char *dest); |
|
403 static void paint_hline_GRAY8 (paintinfo * p, int x, int y, int w); |
|
404 static void paint_hline_GRAY16 (paintinfo * p, int x, int y, int w); |
|
405 |
309 struct fourcc_list_struct fourcc_list[] = { |
406 struct fourcc_list_struct fourcc_list[] = { |
310 /* packed */ |
407 /* packed */ |
311 {VTS_YUV, "YUY2", "YUY2", 16, paint_setup_YUY2, paint_hline_YUY2}, |
408 {VTS_YUV, "YUY2", "YUY2", 16, paint_setup_YUY2, paint_hline_YUY2}, |
312 {VTS_YUV, "UYVY", "UYVY", 16, paint_setup_UYVY, paint_hline_YUY2}, |
409 {VTS_YUV, "UYVY", "UYVY", 16, paint_setup_UYVY, paint_hline_YUY2}, |
313 {VTS_YUV, "Y422", "Y422", 16, paint_setup_UYVY, paint_hline_YUY2}, |
410 {VTS_YUV, "Y422", "Y422", 16, paint_setup_UYVY, paint_hline_YUY2}, |
314 {VTS_YUV, "UYNV", "UYNV", 16, paint_setup_UYVY, paint_hline_YUY2}, /* FIXME: UYNV? */ |
411 {VTS_YUV, "UYNV", "UYNV", 16, paint_setup_UYVY, paint_hline_YUY2}, /* FIXME: UYNV? */ |
315 {VTS_YUV, "YVYU", "YVYU", 16, paint_setup_YVYU, paint_hline_YUY2}, |
412 {VTS_YUV, "YVYU", "YVYU", 16, paint_setup_YVYU, paint_hline_YUY2}, |
|
413 {VTS_YUV, "v308", "v308", 24, paint_setup_v308, paint_hline_v308}, |
316 {VTS_YUV, "AYUV", "AYUV", 32, paint_setup_AYUV, paint_hline_AYUV}, |
414 {VTS_YUV, "AYUV", "AYUV", 32, paint_setup_AYUV, paint_hline_AYUV}, |
|
415 {VTS_YUV, "v410", "v410", 32, paint_setup_v410, paint_hline_v410}, |
|
416 {VTS_YUV, "v210", "v210", 21, paint_setup_v210, paint_hline_v210}, |
|
417 {VTS_YUV, "v216", "v216", 32, paint_setup_v216, paint_hline_v216}, |
317 |
418 |
318 /* interlaced */ |
419 /* interlaced */ |
319 /*{ VTS_YUV, "IUYV", "IUY2", 16, paint_setup_YVYU, paint_hline_YUY2 }, */ |
420 /*{ VTS_YUV, "IUYV", "IUY2", 16, paint_setup_YVYU, paint_hline_YUY2 }, */ |
320 |
421 |
321 /* inverted */ |
422 /* inverted */ |
654 } else if (i == 1) { |
802 } else if (i == 1) { |
655 k = COLOR_BLACK; |
803 k = COLOR_BLACK; |
656 } else |
804 } else |
657 k = COLOR_DARK_GREY; |
805 k = COLOR_DARK_GREY; |
658 |
806 |
659 p->color = vts_colors + k; |
807 p->yuv_color = p->yuv_colors + k; |
|
808 p->rgb_color = p->rgb_colors + k; |
|
809 p->gray_color = p->gray_colors + k; |
660 for (j = y2; j < h; j++) { |
810 for (j = y2; j < h; j++) { |
661 p->paint_hline (p, x1, j, (x2 - x1)); |
811 p->paint_hline (p, x1, j, (x2 - x1)); |
662 } |
812 } |
663 } |
813 } |
664 |
814 |
665 { |
815 { |
666 int x1 = w * 3 / 4; |
816 int x1 = w * 3 / 4; |
667 struct vts_color_struct color; |
817 struct vts_color_struct_rgb rgb_color; |
668 |
818 struct vts_color_struct_yuv yuv_color; |
669 color = vts_colors[COLOR_BLACK]; |
819 struct vts_color_struct_gray gray_color; |
670 p->color = &color; |
820 |
|
821 rgb_color = p->rgb_colors[COLOR_BLACK]; |
|
822 yuv_color = p->yuv_colors[COLOR_BLACK]; |
|
823 gray_color = p->gray_colors[COLOR_BLACK]; |
|
824 p->rgb_color = &rgb_color; |
|
825 p->yuv_color = &yuv_color; |
|
826 p->gray_color = &gray_color; |
671 |
827 |
672 for (i = x1; i < w; i++) { |
828 for (i = x1; i < w; i++) { |
673 for (j = y2; j < h; j++) { |
829 for (j = y2; j < h; j++) { |
674 /* FIXME not strictly correct */ |
830 /* FIXME not strictly correct */ |
675 color.Y = random_char (); |
831 int y = random_char (); |
676 color.R = color.Y; |
832 yuv_color.Y = y; |
677 color.G = color.Y; |
833 rgb_color.R = y; |
678 color.B = color.Y; |
834 rgb_color.G = y; |
|
835 rgb_color.B = y; |
|
836 gray_color.G = (y << 8) | random_char (); |
679 p->paint_hline (p, i, j, 1); |
837 p->paint_hline (p, i, j, 1); |
680 } |
838 } |
681 } |
839 } |
682 |
840 |
683 } |
841 } |
684 } |
842 } |
685 |
843 |
686 void |
844 void |
687 gst_video_test_src_snow (GstVideoTestSrc * v, unsigned char *dest, int w, int h) |
845 gst_video_test_src_smpte75 (GstVideoTestSrc * v, unsigned char *dest, int w, |
|
846 int h) |
688 { |
847 { |
689 int i; |
848 int i; |
690 int j; |
849 int j; |
691 paintinfo pi = { NULL, }; |
850 paintinfo pi = { NULL, }; |
692 paintinfo *p = π |
851 paintinfo *p = π |
693 struct fourcc_list_struct *fourcc; |
852 struct fourcc_list_struct *fourcc; |
694 struct vts_color_struct color; |
853 |
695 |
854 p->rgb_colors = vts_colors_rgb_75; |
|
855 if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) { |
|
856 p->yuv_colors = vts_colors_bt601_ycbcr_75; |
|
857 } else { |
|
858 p->yuv_colors = vts_colors_bt709_ycbcr_75; |
|
859 } |
|
860 p->gray_colors = vts_colors_gray_75; |
696 p->width = w; |
861 p->width = w; |
697 p->height = h; |
862 p->height = h; |
698 fourcc = v->fourcc; |
863 fourcc = v->fourcc; |
699 if (fourcc == NULL) |
864 if (fourcc == NULL) |
700 return; |
865 return; |
701 |
866 |
702 fourcc->paint_setup (p, dest); |
867 fourcc->paint_setup (p, dest); |
703 p->paint_hline = fourcc->paint_hline; |
868 p->paint_hline = fourcc->paint_hline; |
704 |
869 |
705 color = vts_colors[COLOR_BLACK]; |
870 /* color bars */ |
706 p->color = &color; |
871 for (i = 0; i < 7; i++) { |
707 |
872 int x1 = i * w / 7; |
708 for (i = 0; i < w; i++) { |
873 int x2 = (i + 1) * w / 7; |
|
874 |
|
875 p->yuv_color = p->yuv_colors + i; |
|
876 p->rgb_color = p->rgb_colors + i; |
|
877 p->gray_color = p->gray_colors + i; |
709 for (j = 0; j < h; j++) { |
878 for (j = 0; j < h; j++) { |
710 /* FIXME not strictly correct */ |
879 p->paint_hline (p, x1, j, (x2 - x1)); |
711 color.Y = random_char (); |
880 } |
712 color.R = color.Y; |
881 } |
713 color.G = color.Y; |
882 } |
714 color.B = color.Y; |
883 |
715 p->paint_hline (p, i, j, 1); |
884 void |
716 } |
885 gst_video_test_src_snow (GstVideoTestSrc * v, unsigned char *dest, int w, int h) |
717 } |
|
718 } |
|
719 |
|
720 static void |
|
721 gst_video_test_src_unicolor (GstVideoTestSrc * v, unsigned char *dest, int w, |
|
722 int h, const struct vts_color_struct *color) |
|
723 { |
886 { |
724 int i; |
887 int i; |
|
888 int j; |
725 paintinfo pi = { NULL, }; |
889 paintinfo pi = { NULL, }; |
726 paintinfo *p = π |
890 paintinfo *p = π |
727 struct fourcc_list_struct *fourcc; |
891 struct fourcc_list_struct *fourcc; |
728 |
892 struct vts_color_struct_rgb rgb_color; |
|
893 struct vts_color_struct_yuv yuv_color; |
|
894 struct vts_color_struct_gray gray_color; |
|
895 |
|
896 p->rgb_colors = vts_colors_rgb; |
|
897 if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) { |
|
898 p->yuv_colors = vts_colors_bt601_ycbcr_100; |
|
899 } else { |
|
900 p->yuv_colors = vts_colors_bt709_ycbcr_100; |
|
901 } |
|
902 p->gray_colors = vts_colors_gray_100; |
729 p->width = w; |
903 p->width = w; |
730 p->height = h; |
904 p->height = h; |
731 fourcc = v->fourcc; |
905 fourcc = v->fourcc; |
732 if (fourcc == NULL) |
906 if (fourcc == NULL) |
733 return; |
907 return; |
734 |
908 |
735 fourcc->paint_setup (p, dest); |
909 fourcc->paint_setup (p, dest); |
736 p->paint_hline = fourcc->paint_hline; |
910 p->paint_hline = fourcc->paint_hline; |
737 |
911 |
738 p->color = color; |
912 rgb_color = p->rgb_colors[COLOR_BLACK]; |
739 |
913 yuv_color = p->yuv_colors[COLOR_BLACK]; |
740 for (i = 0; i < h; i++) { |
914 gray_color = p->gray_colors[COLOR_BLACK]; |
741 p->paint_hline (p, 0, i, w); |
915 p->rgb_color = &rgb_color; |
742 } |
916 p->yuv_color = &yuv_color; |
743 } |
917 p->gray_color = &gray_color; |
744 |
918 |
745 void |
919 for (i = 0; i < w; i++) { |
746 gst_video_test_src_black (GstVideoTestSrc * v, guchar * dest, int w, int h) |
920 for (j = 0; j < h; j++) { |
747 { |
921 /* FIXME not strictly correct */ |
748 gst_video_test_src_unicolor (v, dest, w, h, vts_colors + COLOR_BLACK); |
922 int y = random_char (); |
749 } |
923 yuv_color.Y = y; |
750 |
924 rgb_color.R = y; |
751 void |
925 rgb_color.G = y; |
752 gst_video_test_src_white (GstVideoTestSrc * v, guchar * dest, int w, int h) |
926 rgb_color.B = y; |
753 { |
927 gray_color.G = (y << 8) | random_char (); |
754 gst_video_test_src_unicolor (v, dest, w, h, vts_colors + COLOR_WHITE); |
928 p->paint_hline (p, i, j, 1); |
755 } |
929 } |
756 |
930 } |
757 void |
931 } |
758 gst_video_test_src_red (GstVideoTestSrc * v, guchar * dest, int w, int h) |
932 |
759 { |
933 static void |
760 gst_video_test_src_unicolor (v, dest, w, h, vts_colors + COLOR_RED); |
934 gst_video_test_src_unicolor (GstVideoTestSrc * v, unsigned char *dest, int w, |
761 } |
935 int h, int color_index) |
762 |
936 { |
763 void |
937 int i; |
764 gst_video_test_src_green (GstVideoTestSrc * v, guchar * dest, int w, int h) |
|
765 { |
|
766 gst_video_test_src_unicolor (v, dest, w, h, vts_colors + COLOR_GREEN); |
|
767 } |
|
768 |
|
769 void |
|
770 gst_video_test_src_blue (GstVideoTestSrc * v, guchar * dest, int w, int h) |
|
771 { |
|
772 gst_video_test_src_unicolor (v, dest, w, h, vts_colors + COLOR_BLUE); |
|
773 } |
|
774 |
|
775 void |
|
776 gst_video_test_src_checkers1 (GstVideoTestSrc * v, guchar * dest, int w, int h) |
|
777 { |
|
778 int x, y; |
|
779 paintinfo pi = { NULL, }; |
938 paintinfo pi = { NULL, }; |
780 paintinfo *p = π |
939 paintinfo *p = π |
781 struct fourcc_list_struct *fourcc; |
940 struct fourcc_list_struct *fourcc; |
782 |
941 |
|
942 p->rgb_colors = vts_colors_rgb; |
|
943 if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) { |
|
944 p->yuv_colors = vts_colors_bt601_ycbcr_100; |
|
945 } else { |
|
946 p->yuv_colors = vts_colors_bt709_ycbcr_100; |
|
947 } |
|
948 p->gray_colors = vts_colors_gray_100; |
783 p->width = w; |
949 p->width = w; |
784 p->height = h; |
950 p->height = h; |
785 fourcc = v->fourcc; |
951 fourcc = v->fourcc; |
786 if (fourcc == NULL) |
952 if (fourcc == NULL) |
787 return; |
953 return; |
788 |
954 |
789 fourcc->paint_setup (p, dest); |
955 fourcc->paint_setup (p, dest); |
790 p->paint_hline = fourcc->paint_hline; |
956 p->paint_hline = fourcc->paint_hline; |
791 |
957 |
792 for (y = 0; y < h; y++) { |
958 p->rgb_color = p->rgb_colors + color_index; |
793 p->color = vts_colors + COLOR_GREEN; |
959 p->yuv_color = p->yuv_colors + color_index; |
794 p->paint_hline (p, 0, y, w); |
960 p->gray_color = p->gray_colors + color_index; |
795 for (x = (y % 2); x < w; x += 2) { |
961 |
796 p->color = vts_colors + COLOR_RED; |
962 for (i = 0; i < h; i++) { |
797 p->paint_hline (p, x, y, 1); |
963 p->paint_hline (p, 0, i, w); |
798 } |
|
799 } |
964 } |
800 } |
965 } |
801 |
966 |
802 void |
967 void |
803 gst_video_test_src_checkers2 (GstVideoTestSrc * v, guchar * dest, int w, int h) |
968 gst_video_test_src_black (GstVideoTestSrc * v, guchar * dest, int w, int h) |
|
969 { |
|
970 gst_video_test_src_unicolor (v, dest, w, h, COLOR_BLACK); |
|
971 } |
|
972 |
|
973 void |
|
974 gst_video_test_src_white (GstVideoTestSrc * v, guchar * dest, int w, int h) |
|
975 { |
|
976 gst_video_test_src_unicolor (v, dest, w, h, COLOR_WHITE); |
|
977 } |
|
978 |
|
979 void |
|
980 gst_video_test_src_red (GstVideoTestSrc * v, guchar * dest, int w, int h) |
|
981 { |
|
982 gst_video_test_src_unicolor (v, dest, w, h, COLOR_RED); |
|
983 } |
|
984 |
|
985 void |
|
986 gst_video_test_src_green (GstVideoTestSrc * v, guchar * dest, int w, int h) |
|
987 { |
|
988 gst_video_test_src_unicolor (v, dest, w, h, COLOR_GREEN); |
|
989 } |
|
990 |
|
991 void |
|
992 gst_video_test_src_blue (GstVideoTestSrc * v, guchar * dest, int w, int h) |
|
993 { |
|
994 gst_video_test_src_unicolor (v, dest, w, h, COLOR_BLUE); |
|
995 } |
|
996 |
|
997 void |
|
998 gst_video_test_src_checkers1 (GstVideoTestSrc * v, guchar * dest, int w, int h) |
804 { |
999 { |
805 int x, y; |
1000 int x, y; |
806 paintinfo pi = { NULL, }; |
1001 paintinfo pi = { NULL, }; |
807 paintinfo *p = π |
1002 paintinfo *p = π |
808 struct fourcc_list_struct *fourcc; |
1003 struct fourcc_list_struct *fourcc; |
809 |
1004 |
|
1005 p->rgb_colors = vts_colors_rgb; |
|
1006 if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) { |
|
1007 p->yuv_colors = vts_colors_bt601_ycbcr_100; |
|
1008 } else { |
|
1009 p->yuv_colors = vts_colors_bt709_ycbcr_100; |
|
1010 } |
|
1011 p->gray_colors = vts_colors_gray_100; |
810 p->width = w; |
1012 p->width = w; |
811 p->height = h; |
1013 p->height = h; |
812 fourcc = v->fourcc; |
1014 fourcc = v->fourcc; |
813 if (fourcc == NULL) |
1015 if (fourcc == NULL) |
814 return; |
1016 return; |
815 |
1017 |
816 fourcc->paint_setup (p, dest); |
1018 fourcc->paint_setup (p, dest); |
817 p->paint_hline = fourcc->paint_hline; |
1019 p->paint_hline = fourcc->paint_hline; |
818 |
1020 |
819 p->color = vts_colors + COLOR_GREEN; |
|
820 for (y = 0; y < h; y++) { |
1021 for (y = 0; y < h; y++) { |
|
1022 p->rgb_color = p->rgb_colors + COLOR_GREEN; |
|
1023 p->yuv_color = p->yuv_colors + COLOR_GREEN; |
|
1024 p->gray_color = p->gray_colors + COLOR_GREEN; |
821 p->paint_hline (p, 0, y, w); |
1025 p->paint_hline (p, 0, y, w); |
822 } |
1026 for (x = (y % 2); x < w; x += 2) { |
823 |
1027 p->rgb_color = p->rgb_colors + COLOR_RED; |
824 for (y = 0; y < h; y += 2) { |
1028 p->yuv_color = p->yuv_colors + COLOR_RED; |
825 for (x = ((y % 4) == 0) ? 0 : 2; x < w; x += 4) { |
1029 p->gray_color = p->gray_colors + COLOR_RED; |
826 guint len = (x < (w - 1)) ? 2 : (w - x); |
1030 p->paint_hline (p, x, y, 1); |
827 |
|
828 p->color = vts_colors + COLOR_RED; |
|
829 p->paint_hline (p, x, y + 0, len); |
|
830 if (G_LIKELY ((y + 1) < h)) { |
|
831 p->paint_hline (p, x, y + 1, len); |
|
832 } |
|
833 } |
1031 } |
834 } |
1032 } |
835 } |
1033 } |
836 |
1034 |
837 void |
1035 void |
838 gst_video_test_src_checkers4 (GstVideoTestSrc * v, guchar * dest, int w, int h) |
1036 gst_video_test_src_checkers2 (GstVideoTestSrc * v, guchar * dest, int w, int h) |
839 { |
1037 { |
840 int x, y; |
1038 int x, y; |
841 paintinfo pi = { NULL, }; |
1039 paintinfo pi = { NULL, }; |
842 paintinfo *p = π |
1040 paintinfo *p = π |
843 struct fourcc_list_struct *fourcc; |
1041 struct fourcc_list_struct *fourcc; |
844 |
1042 |
|
1043 p->rgb_colors = vts_colors_rgb; |
|
1044 if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) { |
|
1045 p->yuv_colors = vts_colors_bt601_ycbcr_100; |
|
1046 } else { |
|
1047 p->yuv_colors = vts_colors_bt709_ycbcr_100; |
|
1048 } |
|
1049 p->gray_colors = vts_colors_gray_100; |
845 p->width = w; |
1050 p->width = w; |
846 p->height = h; |
1051 p->height = h; |
847 fourcc = v->fourcc; |
1052 fourcc = v->fourcc; |
848 if (fourcc == NULL) |
1053 if (fourcc == NULL) |
849 return; |
1054 return; |
850 |
1055 |
851 fourcc->paint_setup (p, dest); |
1056 fourcc->paint_setup (p, dest); |
852 p->paint_hline = fourcc->paint_hline; |
1057 p->paint_hline = fourcc->paint_hline; |
853 |
1058 |
854 p->color = vts_colors + COLOR_GREEN; |
1059 p->rgb_color = p->rgb_colors + COLOR_GREEN; |
|
1060 p->yuv_color = p->yuv_colors + COLOR_GREEN; |
|
1061 p->gray_color = p->gray_colors + COLOR_GREEN; |
|
1062 for (y = 0; y < h; y++) { |
|
1063 p->paint_hline (p, 0, y, w); |
|
1064 } |
|
1065 |
|
1066 for (y = 0; y < h; y += 2) { |
|
1067 for (x = ((y % 4) == 0) ? 0 : 2; x < w; x += 4) { |
|
1068 guint len = (x < (w - 1)) ? 2 : (w - x); |
|
1069 |
|
1070 p->rgb_color = p->rgb_colors + COLOR_RED; |
|
1071 p->yuv_color = p->yuv_colors + COLOR_RED; |
|
1072 p->gray_color = p->gray_colors + COLOR_RED; |
|
1073 p->paint_hline (p, x, y + 0, len); |
|
1074 if (G_LIKELY ((y + 1) < h)) { |
|
1075 p->paint_hline (p, x, y + 1, len); |
|
1076 } |
|
1077 } |
|
1078 } |
|
1079 } |
|
1080 |
|
1081 void |
|
1082 gst_video_test_src_checkers4 (GstVideoTestSrc * v, guchar * dest, int w, int h) |
|
1083 { |
|
1084 int x, y; |
|
1085 paintinfo pi = { NULL, }; |
|
1086 paintinfo *p = π |
|
1087 struct fourcc_list_struct *fourcc; |
|
1088 |
|
1089 p->rgb_colors = vts_colors_rgb; |
|
1090 if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) { |
|
1091 p->yuv_colors = vts_colors_bt601_ycbcr_100; |
|
1092 } else { |
|
1093 p->yuv_colors = vts_colors_bt709_ycbcr_100; |
|
1094 } |
|
1095 p->gray_colors = vts_colors_gray_100; |
|
1096 p->width = w; |
|
1097 p->height = h; |
|
1098 fourcc = v->fourcc; |
|
1099 if (fourcc == NULL) |
|
1100 return; |
|
1101 |
|
1102 fourcc->paint_setup (p, dest); |
|
1103 p->paint_hline = fourcc->paint_hline; |
|
1104 |
|
1105 p->rgb_color = p->rgb_colors + COLOR_GREEN; |
|
1106 p->yuv_color = p->yuv_colors + COLOR_GREEN; |
|
1107 p->gray_color = p->gray_colors + COLOR_GREEN; |
855 for (y = 0; y < h; y++) { |
1108 for (y = 0; y < h; y++) { |
856 p->paint_hline (p, 0, y, w); |
1109 p->paint_hline (p, 0, y, w); |
857 } |
1110 } |
858 |
1111 |
859 for (y = 0; y < h; y += 4) { |
1112 for (y = 0; y < h; y += 4) { |
860 for (x = ((y % 8) == 0) ? 0 : 4; x < w; x += 8) { |
1113 for (x = ((y % 8) == 0) ? 0 : 4; x < w; x += 8) { |
861 guint len = (x < (w - 3)) ? 4 : (w - x); |
1114 guint len = (x < (w - 3)) ? 4 : (w - x); |
862 |
1115 |
863 p->color = vts_colors + COLOR_RED; |
1116 p->rgb_color = p->rgb_colors + COLOR_RED; |
|
1117 p->yuv_color = p->yuv_colors + COLOR_RED; |
|
1118 p->gray_color = p->gray_colors + COLOR_RED; |
864 p->paint_hline (p, x, y + 0, len); |
1119 p->paint_hline (p, x, y + 0, len); |
865 if (G_LIKELY ((y + 1) < h)) { |
1120 if (G_LIKELY ((y + 1) < h)) { |
866 p->paint_hline (p, x, y + 1, len); |
1121 p->paint_hline (p, x, y + 1, len); |
867 if (G_LIKELY ((y + 2) < h)) { |
1122 if (G_LIKELY ((y + 2) < h)) { |
868 p->paint_hline (p, x, y + 2, len); |
1123 p->paint_hline (p, x, y + 2, len); |
881 int x, y; |
1136 int x, y; |
882 paintinfo pi = { NULL, }; |
1137 paintinfo pi = { NULL, }; |
883 paintinfo *p = π |
1138 paintinfo *p = π |
884 struct fourcc_list_struct *fourcc; |
1139 struct fourcc_list_struct *fourcc; |
885 |
1140 |
|
1141 p->rgb_colors = vts_colors_rgb; |
|
1142 if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) { |
|
1143 p->yuv_colors = vts_colors_bt601_ycbcr_100; |
|
1144 } else { |
|
1145 p->yuv_colors = vts_colors_bt709_ycbcr_100; |
|
1146 } |
|
1147 p->gray_colors = vts_colors_gray_100; |
886 p->width = w; |
1148 p->width = w; |
887 p->height = h; |
1149 p->height = h; |
888 fourcc = v->fourcc; |
1150 fourcc = v->fourcc; |
889 if (fourcc == NULL) |
1151 if (fourcc == NULL) |
890 return; |
1152 return; |
891 |
1153 |
892 fourcc->paint_setup (p, dest); |
1154 fourcc->paint_setup (p, dest); |
893 p->paint_hline = fourcc->paint_hline; |
1155 p->paint_hline = fourcc->paint_hline; |
894 |
1156 |
895 p->color = vts_colors + COLOR_GREEN; |
1157 p->rgb_color = p->rgb_colors + COLOR_GREEN; |
|
1158 p->yuv_color = p->yuv_colors + COLOR_GREEN; |
|
1159 p->gray_color = p->gray_colors + COLOR_GREEN; |
896 for (y = 0; y < h; y++) { |
1160 for (y = 0; y < h; y++) { |
897 p->paint_hline (p, 0, y, w); |
1161 for (x = 0; x < w; x += 8) { |
898 } |
1162 int len = MIN (8, w - x); |
899 |
1163 |
900 for (y = 0; y < h; y += 8) { |
1164 if ((x ^ y) & (1 << 4)) { |
901 for (x = ((GST_ROUND_UP_8 (y) % 16) == 0) ? 0 : 8; x < w; x += 16) { |
1165 p->rgb_color = p->rgb_colors + COLOR_GREEN; |
902 guint len = (x < (w - 7)) ? 8 : (w - x); |
1166 p->yuv_color = p->yuv_colors + COLOR_GREEN; |
903 |
1167 p->gray_color = p->gray_colors + COLOR_GREEN; |
904 p->color = vts_colors + COLOR_RED; |
1168 } else { |
905 p->paint_hline (p, x, y + 0, len); |
1169 p->rgb_color = p->rgb_colors + COLOR_RED; |
906 if (G_LIKELY ((y + 1) < h)) { |
1170 p->yuv_color = p->yuv_colors + COLOR_RED; |
907 p->paint_hline (p, x, y + 1, len); |
1171 p->gray_color = p->gray_colors + COLOR_RED; |
908 if (G_LIKELY ((y + 2) < h)) { |
|
909 p->paint_hline (p, x, y + 2, len); |
|
910 if (G_LIKELY ((y + 3) < h)) { |
|
911 p->paint_hline (p, x, y + 3, len); |
|
912 if (G_LIKELY ((y + 4) < h)) { |
|
913 p->paint_hline (p, x, y + 4, len); |
|
914 if (G_LIKELY ((y + 5) < h)) { |
|
915 p->paint_hline (p, x, y + 5, len); |
|
916 if (G_LIKELY ((y + 6) < h)) { |
|
917 p->paint_hline (p, x, y + 6, len); |
|
918 if (G_LIKELY ((y + 7) < h)) { |
|
919 p->paint_hline (p, x, y + 7, len); |
|
920 } |
|
921 } |
|
922 } |
|
923 } |
|
924 } |
|
925 } |
|
926 } |
1172 } |
927 } |
1173 p->paint_hline (p, x, y, len); |
928 } |
1174 } |
929 } |
1175 } |
930 |
1176 } |
931 #undef SCALE_AMPLITUDE |
1177 |
932 void |
1178 void |
933 gst_video_test_src_circular (GstVideoTestSrc * v, unsigned char *dest, |
1179 gst_video_test_src_zoneplate (GstVideoTestSrc * v, unsigned char *dest, |
934 int w, int h) |
1180 int w, int h) |
935 { |
1181 { |
936 int i; |
1182 int i; |
937 int j; |
1183 int j; |
938 paintinfo pi = { NULL, }; |
1184 paintinfo pi = { NULL, }; |
939 paintinfo *p = π |
1185 paintinfo *p = π |
940 struct fourcc_list_struct *fourcc; |
1186 struct fourcc_list_struct *fourcc; |
941 struct vts_color_struct color; |
1187 struct vts_color_struct_rgb rgb_color; |
|
1188 struct vts_color_struct_yuv yuv_color; |
|
1189 struct vts_color_struct_gray gray_color; |
942 static uint8_t sine_array[256]; |
1190 static uint8_t sine_array[256]; |
943 static int sine_array_inited = FALSE; |
1191 static int sine_array_inited = FALSE; |
944 double freq[8]; |
1192 |
945 |
1193 static int t = 0; /* time - increment phase vs time by 1 for each generated frame */ |
946 #ifdef SCALE_AMPLITUDE |
1194 /* this may not fit with the correct gstreamer notion of time, so maybe FIXME? */ |
947 double ampl[8]; |
1195 |
948 #endif |
1196 int xreset = -(w / 2) - v->xoffset; /* starting values for x^2 and y^2, centering the ellipse */ |
949 int d; |
1197 int yreset = -(h / 2) - v->yoffset; |
|
1198 |
|
1199 int x, y; |
|
1200 int accum_kx; |
|
1201 int accum_kxt; |
|
1202 int accum_ky; |
|
1203 int accum_kyt; |
|
1204 int accum_kxy; |
|
1205 int kt; |
|
1206 int kt2; |
|
1207 int ky2; |
|
1208 int delta_kxt = v->kxt * t; |
|
1209 int delta_kxy; |
|
1210 int scale_kxy = 0xffff / (w / 2); |
|
1211 int scale_kx2 = 0xffff / w; |
950 |
1212 |
951 if (!sine_array_inited) { |
1213 if (!sine_array_inited) { |
|
1214 int black = 16; |
|
1215 int white = 235; |
|
1216 int range = white - black; |
952 for (i = 0; i < 256; i++) { |
1217 for (i = 0; i < 256; i++) { |
953 sine_array[i] = |
1218 sine_array[i] = |
954 floor (255 * (0.5 + 0.5 * sin (i * 2 * M_PI / 256)) + 0.5); |
1219 floor (range * (0.5 + 0.5 * sin (i * 2 * M_PI / 256)) + 0.5 + black); |
955 } |
1220 } |
956 sine_array_inited = TRUE; |
1221 sine_array_inited = TRUE; |
957 } |
1222 } |
958 |
1223 |
|
1224 p->rgb_colors = vts_colors_rgb; |
|
1225 if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) { |
|
1226 p->yuv_colors = vts_colors_bt601_ycbcr_100; |
|
1227 } else { |
|
1228 p->yuv_colors = vts_colors_bt709_ycbcr_100; |
|
1229 } |
|
1230 p->gray_colors = vts_colors_gray_100; |
959 p->width = w; |
1231 p->width = w; |
960 p->height = h; |
1232 p->height = h; |
961 fourcc = v->fourcc; |
1233 fourcc = v->fourcc; |
962 if (fourcc == NULL) |
1234 if (fourcc == NULL) |
963 return; |
1235 return; |
964 |
1236 |
965 fourcc->paint_setup (p, dest); |
1237 fourcc->paint_setup (p, dest); |
966 p->paint_hline = fourcc->paint_hline; |
1238 p->paint_hline = fourcc->paint_hline; |
967 |
1239 |
968 color = vts_colors[COLOR_BLACK]; |
1240 rgb_color = p->rgb_colors[COLOR_BLACK]; |
969 p->color = &color; |
1241 yuv_color = p->yuv_colors[COLOR_BLACK]; |
|
1242 gray_color = p->gray_colors[COLOR_BLACK]; |
|
1243 p->rgb_color = &rgb_color; |
|
1244 p->yuv_color = &yuv_color; |
|
1245 p->gray_color = &gray_color; |
|
1246 |
|
1247 /* Zoneplate equation: |
|
1248 * |
|
1249 * phase = k0 + kx*x + ky*y + kt*t |
|
1250 * + kxt*x*t + kyt*y*t + kxy*x*y |
|
1251 * + kx2*x*x + ky2*y*y + Kt2*t*t |
|
1252 */ |
|
1253 |
|
1254 #if 0 |
|
1255 for (j = 0, y = yreset; j < h; j++, y++) { |
|
1256 for (i = 0, x = xreset; i < w; i++, x++) { |
|
1257 |
|
1258 //zero order |
|
1259 int phase = v->k0; |
|
1260 |
|
1261 //first order |
|
1262 phase = phase + (v->kx * i) + (v->ky * j) + (v->kt * t); |
|
1263 |
|
1264 //cross term |
|
1265 //phase = phase + (v->kxt * i * t) + (v->kyt * j * t); |
|
1266 //phase = phase + (v->kxy * x * y) / (w/2); |
|
1267 |
|
1268 /*second order */ |
|
1269 /*normalise x/y terms to rate of change of phase at the picture edge */ |
|
1270 phase = |
|
1271 phase + ((v->kx2 * x * x) / w) + ((v->ky2 * y * y) / h) + |
|
1272 ((v->kt2 * t * t) >> 1); |
|
1273 |
|
1274 color.Y = sine_array[phase & 0xff]; |
|
1275 |
|
1276 color.R = color.Y; |
|
1277 color.G = color.Y; |
|
1278 color.B = color.Y; |
|
1279 p->paint_hline (p, i, j, 1); |
|
1280 } |
|
1281 } |
|
1282 #endif |
|
1283 |
|
1284 /* optimised version, with original code shown in comments */ |
|
1285 accum_ky = 0; |
|
1286 accum_kyt = 0; |
|
1287 kt = v->kt * t; |
|
1288 kt2 = v->kt2 * t * t; |
|
1289 for (j = 0, y = yreset; j < h; j++, y++) { |
|
1290 accum_kx = 0; |
|
1291 accum_kxt = 0; |
|
1292 accum_ky += v->ky; |
|
1293 accum_kyt += v->kyt * t; |
|
1294 delta_kxy = v->kxy * y * scale_kxy; |
|
1295 accum_kxy = delta_kxy * xreset; |
|
1296 ky2 = (v->ky2 * y * y) / h; |
|
1297 for (i = 0, x = xreset; i < w; i++, x++) { |
|
1298 |
|
1299 //zero order |
|
1300 int phase = v->k0; |
|
1301 |
|
1302 //first order |
|
1303 accum_kx += v->kx; |
|
1304 //phase = phase + (v->kx * i) + (v->ky * j) + (v->kt * t); |
|
1305 phase = phase + accum_kx + accum_ky + kt; |
|
1306 |
|
1307 //cross term |
|
1308 accum_kxt += delta_kxt; |
|
1309 accum_kxy += delta_kxy; |
|
1310 //phase = phase + (v->kxt * i * t) + (v->kyt * j * t); |
|
1311 phase = phase + accum_kxt + accum_kyt; |
|
1312 |
|
1313 //phase = phase + (v->kxy * x * y) / (w/2); |
|
1314 //phase = phase + accum_kxy / (w/2) ; |
|
1315 phase = phase + (accum_kxy >> 16); |
|
1316 |
|
1317 /*second order */ |
|
1318 /*normalise x/y terms to rate of change of phase at the picture edge */ |
|
1319 //phase = phase + ((v->kx2 * x * x)/w) + ((v->ky2 * y * y)/h) + ((v->kt2 * t * t)>>1); |
|
1320 phase = phase + ((v->kx2 * x * x * scale_kx2) >> 16) + ky2 + (kt2 >> 1); |
|
1321 |
|
1322 yuv_color.Y = sine_array[phase & 0xff]; |
|
1323 |
|
1324 rgb_color.R = yuv_color.Y; |
|
1325 rgb_color.G = yuv_color.Y; |
|
1326 rgb_color.B = yuv_color.Y; |
|
1327 |
|
1328 gray_color.G = yuv_color.Y << 8; |
|
1329 p->paint_hline (p, i, j, 1); |
|
1330 } |
|
1331 } |
|
1332 |
|
1333 t++; |
|
1334 } |
|
1335 |
|
1336 #undef SCALE_AMPLITUDE |
|
1337 void |
|
1338 gst_video_test_src_circular (GstVideoTestSrc * v, unsigned char *dest, |
|
1339 int w, int h) |
|
1340 { |
|
1341 int i; |
|
1342 int j; |
|
1343 paintinfo pi = { NULL, }; |
|
1344 paintinfo *p = π |
|
1345 struct fourcc_list_struct *fourcc; |
|
1346 struct vts_color_struct_rgb rgb_color; |
|
1347 struct vts_color_struct_yuv yuv_color; |
|
1348 struct vts_color_struct_gray gray_color; |
|
1349 static uint8_t sine_array[256]; |
|
1350 static int sine_array_inited = FALSE; |
|
1351 double freq[8]; |
|
1352 |
|
1353 #ifdef SCALE_AMPLITUDE |
|
1354 double ampl[8]; |
|
1355 #endif |
|
1356 int d; |
|
1357 |
|
1358 if (!sine_array_inited) { |
|
1359 for (i = 0; i < 256; i++) { |
|
1360 sine_array[i] = |
|
1361 floor (255 * (0.5 + 0.5 * sin (i * 2 * M_PI / 256)) + 0.5); |
|
1362 } |
|
1363 sine_array_inited = TRUE; |
|
1364 } |
|
1365 |
|
1366 p->rgb_colors = vts_colors_rgb; |
|
1367 if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) { |
|
1368 p->yuv_colors = vts_colors_bt601_ycbcr_100; |
|
1369 } else { |
|
1370 p->yuv_colors = vts_colors_bt709_ycbcr_100; |
|
1371 } |
|
1372 p->gray_colors = vts_colors_gray_100; |
|
1373 p->width = w; |
|
1374 p->height = h; |
|
1375 fourcc = v->fourcc; |
|
1376 if (fourcc == NULL) |
|
1377 return; |
|
1378 |
|
1379 fourcc->paint_setup (p, dest); |
|
1380 p->paint_hline = fourcc->paint_hline; |
|
1381 |
|
1382 rgb_color = p->rgb_colors[COLOR_BLACK]; |
|
1383 yuv_color = p->yuv_colors[COLOR_BLACK]; |
|
1384 gray_color = p->gray_colors[COLOR_BLACK]; |
|
1385 p->rgb_color = &rgb_color; |
|
1386 p->yuv_color = &yuv_color; |
|
1387 p->gray_color = &gray_color; |
970 |
1388 |
971 for (i = 1; i < 8; i++) { |
1389 for (i = 1; i < 8; i++) { |
972 freq[i] = 200 * pow (2.0, -(i - 1) / 4.0); |
1390 freq[i] = 200 * pow (2.0, -(i - 1) / 4.0); |
973 #ifdef SCALE_AMPLITUDE |
1391 #ifdef SCALE_AMPLITUDE |
974 { |
1392 { |
1090 p->ystride = GST_ROUND_UP_2 (p->width) * 2; |
1593 p->ystride = GST_ROUND_UP_2 (p->width) * 2; |
1091 p->endptr = dest + p->ystride * p->height; |
1594 p->endptr = dest + p->ystride * p->height; |
1092 } |
1595 } |
1093 |
1596 |
1094 static void |
1597 static void |
|
1598 paint_hline_v308 (paintinfo * p, int x, int y, int w) |
|
1599 { |
|
1600 int offset; |
|
1601 |
|
1602 offset = (y * p->ystride) + (x * 3); |
|
1603 oil_splat_u8 (p->yp + offset, 3, &p->yuv_color->Y, w); |
|
1604 oil_splat_u8 (p->up + offset, 3, &p->yuv_color->U, w); |
|
1605 oil_splat_u8 (p->vp + offset, 3, &p->yuv_color->V, w); |
|
1606 } |
|
1607 |
|
1608 static void |
1095 paint_hline_AYUV (paintinfo * p, int x, int y, int w) |
1609 paint_hline_AYUV (paintinfo * p, int x, int y, int w) |
1096 { |
1610 { |
1097 int offset; |
1611 int offset; |
|
1612 guint8 alpha = 255; |
1098 |
1613 |
1099 offset = (y * p->ystride) + (x * 4); |
1614 offset = (y * p->ystride) + (x * 4); |
1100 oil_splat_u8 (p->yp + offset, 4, &p->color->Y, w); |
1615 oil_splat_u8 (p->yp + offset, 4, &p->yuv_color->Y, w); |
1101 oil_splat_u8 (p->up + offset, 4, &p->color->U, w); |
1616 oil_splat_u8 (p->up + offset, 4, &p->yuv_color->U, w); |
1102 oil_splat_u8 (p->vp + offset, 4, &p->color->V, w); |
1617 oil_splat_u8 (p->vp + offset, 4, &p->yuv_color->V, w); |
1103 oil_splat_u8 (p->ap + offset, 4, &p->color->A, w); |
1618 oil_splat_u8 (p->ap + offset, 4, &alpha, w); |
|
1619 } |
|
1620 |
|
1621 #define TO_16(x) (((x)<<8) | (x)) |
|
1622 #define TO_10(x) (((x)<<2) | ((x)>>6)) |
|
1623 |
|
1624 static void |
|
1625 paint_hline_v216 (paintinfo * p, int x, int y, int w) |
|
1626 { |
|
1627 int x1 = x / 2; |
|
1628 int x2 = (x + w) / 2; |
|
1629 uint16_t Y, U, V; |
|
1630 int i; |
|
1631 int offset; |
|
1632 |
|
1633 offset = y * p->ystride; |
|
1634 Y = TO_16 (p->yuv_color->Y); |
|
1635 U = TO_16 (p->yuv_color->U); |
|
1636 V = TO_16 (p->yuv_color->V); |
|
1637 for (i = x; i < x + w; i++) { |
|
1638 GST_WRITE_UINT16_LE (p->yp + offset + i * 4, Y); |
|
1639 } |
|
1640 for (i = x1; i < x2; i++) { |
|
1641 GST_WRITE_UINT16_LE (p->up + offset + i * 8, U); |
|
1642 GST_WRITE_UINT16_LE (p->vp + offset + i * 8, V); |
|
1643 } |
|
1644 } |
|
1645 |
|
1646 static void |
|
1647 paint_hline_v410 (paintinfo * p, int x, int y, int w) |
|
1648 { |
|
1649 uint32_t a; |
|
1650 uint8_t *data; |
|
1651 int i; |
|
1652 |
|
1653 a = (TO_10 (p->yuv_color->U) << 22) | |
|
1654 (TO_10 (p->yuv_color->Y) << 12) | (TO_10 (p->yuv_color->V) << 2); |
|
1655 |
|
1656 data = p->yp + y * p->ystride + x * 4; |
|
1657 for (i = 0; i < w; i++) { |
|
1658 GST_WRITE_UINT32_LE (data, a); |
|
1659 } |
|
1660 } |
|
1661 |
|
1662 static void |
|
1663 paint_hline_v210 (paintinfo * p, int x, int y, int w) |
|
1664 { |
|
1665 uint32_t a0, a1, a2, a3; |
|
1666 uint8_t *data; |
|
1667 int i; |
|
1668 |
|
1669 /* FIXME this is kinda gross. it only handles x values in |
|
1670 multiples of 6 */ |
|
1671 |
|
1672 a0 = TO_10 (p->yuv_color->U) | (TO_10 (p->yuv_color->Y) << 10) |
|
1673 | (TO_10 (p->yuv_color->V) << 20); |
|
1674 a1 = TO_10 (p->yuv_color->Y) | (TO_10 (p->yuv_color->U) << 10) |
|
1675 | (TO_10 (p->yuv_color->Y) << 20); |
|
1676 a2 = TO_10 (p->yuv_color->V) | (TO_10 (p->yuv_color->Y) << 10) |
|
1677 | (TO_10 (p->yuv_color->U) << 20); |
|
1678 a3 = TO_10 (p->yuv_color->Y) | (TO_10 (p->yuv_color->V) << 10) |
|
1679 | (TO_10 (p->yuv_color->Y) << 20); |
|
1680 |
|
1681 data = p->yp + y * p->ystride; |
|
1682 for (i = x / 6; i < (x + w) / 6; i++) { |
|
1683 GST_WRITE_UINT32_LE (data + i * 16 + 0, a0); |
|
1684 GST_WRITE_UINT32_LE (data + i * 16 + 4, a1); |
|
1685 GST_WRITE_UINT32_LE (data + i * 16 + 8, a2); |
|
1686 GST_WRITE_UINT32_LE (data + i * 16 + 12, a3); |
|
1687 } |
1104 } |
1688 } |
1105 |
1689 |
1106 static void |
1690 static void |
1107 paint_hline_YUY2 (paintinfo * p, int x, int y, int w) |
1691 paint_hline_YUY2 (paintinfo * p, int x, int y, int w) |
1108 { |
1692 { |
1109 int x1 = x / 2; |
1693 int x1 = x / 2; |
1110 int x2 = (x + w) / 2; |
1694 int x2 = (x + w) / 2; |
1111 int offset; |
1695 int offset; |
1112 |
1696 |
1113 offset = y * p->ystride; |
1697 offset = y * p->ystride; |
1114 oil_splat_u8 (p->yp + offset + x * 2, 2, &p->color->Y, w); |
1698 oil_splat_u8 (p->yp + offset + x * 2, 2, &p->yuv_color->Y, w); |
1115 oil_splat_u8 (p->up + offset + x1 * 4, 4, &p->color->U, x2 - x1); |
1699 oil_splat_u8 (p->up + offset + x1 * 4, 4, &p->yuv_color->U, x2 - x1); |
1116 oil_splat_u8 (p->vp + offset + x1 * 4, 4, &p->color->V, x2 - x1); |
1700 oil_splat_u8 (p->vp + offset + x1 * 4, 4, &p->yuv_color->V, x2 - x1); |
1117 } |
1701 } |
1118 |
1702 |
1119 static void |
1703 static void |
1120 paint_setup_IYU2 (paintinfo * p, unsigned char *dest) |
1704 paint_setup_IYU2 (paintinfo * p, unsigned char *dest) |
1121 { |
1705 { |