summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/g3dvl/tests/test_b_rendering.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers/g3dvl/tests/test_b_rendering.c')
-rw-r--r--src/gallium/state_trackers/g3dvl/tests/test_b_rendering.c226
1 files changed, 226 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/g3dvl/tests/test_b_rendering.c b/src/gallium/state_trackers/g3dvl/tests/test_b_rendering.c
new file mode 100644
index 0000000000..b78cc851ae
--- /dev/null
+++ b/src/gallium/state_trackers/g3dvl/tests/test_b_rendering.c
@@ -0,0 +1,226 @@
+#include <stdio.h>
+#include <X11/Xlib.h>
+#include <vl_context.h>
+#include <vl_surface.h>
+#include <xsp_winsys.h>
+
+static const unsigned short ycbcr16x16_420[8*8*6] =
+{
+ 0x00A5,0x00A5,0x00A5,0x0072,0x00A5,0x0072,0x0072,0x0072,
+ 0x0072,0x00A5,0x0072,0x0072,0x00A5,0x0072,0x0072,0x0072,
+ 0x0072,0x00A5,0x0072,0x0072,0x00A5,0x00A5,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x00A5,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x0072,0x00A5,0x00A5,
+ 0x0072,0x0072,0x0072,0x0072,0x0072,0x00A5,0x00A5,0x00A5,
+ 0x0072,0x0072,0x0072,0x0072,0x00A5,0x00A5,0x00A5,0x00A5,
+
+ 0x004F,0x004F,0x004F,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,
+ 0x00B2,0x00B2,0x004F,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,
+ 0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,
+ 0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,
+ 0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,
+ 0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,
+ 0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x004F,
+ 0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x00B2,0x004F,0x004F,
+
+ 0x003E,0x003E,0x003E,0x0060,0x0060,0x0060,0x0060,0x0060,
+ 0x0060,0x0060,0x003E,0x0060,0x0060,0x0060,0x0060,0x0060,
+ 0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,
+ 0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,
+ 0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,
+ 0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,
+ 0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x003E,
+ 0x0060,0x0060,0x0060,0x0060,0x0060,0x0060,0x003E,0x003E
+};
+
+static const signed short ycbcr16x16_420_2[8*8*6] =
+{
+ -0x00A5,-0x00A5,-0x00A5,-0x0072,-0x00A5,-0x0072,-0x0072,-0x0072,
+ -0x0072,-0x00A5,-0x0072,-0x0072,-0x00A5,-0x0072,-0x0072,-0x0072,
+ -0x0072,-0x00A5,-0x0072,-0x0072,-0x00A5,-0x00A5,-0x0072,-0x0072,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x00A5,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x00A5,-0x00A5,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x0072,-0x00A5,-0x00A5,-0x00A5,
+ -0x0072,-0x0072,-0x0072,-0x0072,-0x00A5,-0x00A5,-0x00A5,-0x00A5,
+
+ -0x004F,-0x004F,-0x004F,-0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x00B2,
+ -0x00B2,-0x00B2,-0x004F,-0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x00B2,
+ -0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x00B2,
+ -0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x00B2,
+ -0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x00B2,
+ -0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x00B2,
+ -0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x004F,
+ -0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x00B2,-0x004F,-0x004F,
+
+ -0x003E,-0x003E,-0x003E,-0x0060,-0x0060,-0x0060,-0x0060,-0x0060,
+ -0x0060,-0x0060,-0x003E,-0x0060,-0x0060,-0x0060,-0x0060,-0x0060,
+ -0x0060,-0x0060,-0x0060,-0x0060,-0x0060,-0x0060,-0x0060,-0x0060,
+ -0x0060,-0x0060,-0x0060,-0x0060,-0x0060,-0x0060,-0x0060,-0x0060,
+ -0x0060,-0x0060,-0x0060,-0x0060,-0x0060,-0x0060,-0x0060,-0x0060,
+ -0x0060,-0x0060,-0x0060,-0x0060,-0x0060,-0x0060,-0x0060,-0x0060,
+ -0x0060,-0x0060,-0x0060,-0x0060,-0x0060,-0x0060,-0x0060,-0x003E,
+ -0x0060,-0x0060,-0x0060,-0x0060,-0x0060,-0x0060,-0x003E,-0x003E
+};
+
+int main(int argc, char **argv)
+{
+ const unsigned int video_width = 32, video_height = 32;
+ const unsigned int window_width = video_width * 2, window_height = video_height * 2;
+ int quit = 0;
+ Display *display;
+ Window root, window;
+ Pixmap framebuffer;
+ XEvent event;
+ struct pipe_context *pipe;
+ struct VL_CONTEXT *ctx;
+ struct VL_SURFACE *sfc, *past_sfc, *future_sfc;
+ struct VL_MOTION_VECTOR motion_vector[2] =
+ {
+ {
+ {0, 0}, {0, 0}
+ },
+ {
+ {0, 0}, {0, 0}
+ }
+ };
+
+ display = XOpenDisplay(NULL);
+ root = XDefaultRootWindow(display);
+ window = XCreateSimpleWindow(display, root, 0, 0, window_width, window_height, 0, 0, 0);
+ framebuffer = XCreatePixmap(display, root, window_width, window_height, 24);
+
+ XSelectInput(display, window, ExposureMask | KeyPressMask);
+ XMapWindow(display, window);
+ XSync(display, 0);
+
+ pipe = create_pipe_context(display);
+ vlCreateContext(display, pipe, video_width, video_height, VL_FORMAT_YCBCR_420, &ctx);
+ vlCreateSurface(ctx, &sfc);
+ vlCreateSurface(ctx, &past_sfc);
+ vlCreateSurface(ctx, &future_sfc);
+
+ vlRenderIMacroBlock(VL_FRAME_PICTURE, VL_FIELD_FIRST, 0, 0, 0x3F, VL_DCT_FRAME_CODED, (short*)ycbcr16x16_420, past_sfc);
+ vlRenderIMacroBlock(VL_FRAME_PICTURE, VL_FIELD_FIRST, 1, 0, 0x3F, VL_DCT_FRAME_CODED, (short*)ycbcr16x16_420, past_sfc);
+ vlRenderIMacroBlock(VL_FRAME_PICTURE, VL_FIELD_FIRST, 0, 1, 0x3F, VL_DCT_FRAME_CODED, (short*)ycbcr16x16_420, past_sfc);
+ vlRenderIMacroBlock(VL_FRAME_PICTURE, VL_FIELD_FIRST, 1, 1, 0x3F, VL_DCT_FRAME_CODED, (short*)ycbcr16x16_420, past_sfc);
+ vlRenderIMacroBlock(VL_FRAME_PICTURE, VL_FIELD_FIRST, 0, 0, 0x3F, VL_DCT_FRAME_CODED, (short*)ycbcr16x16_420, future_sfc);
+ vlRenderIMacroBlock(VL_FRAME_PICTURE, VL_FIELD_FIRST, 1, 0, 0x3F, VL_DCT_FRAME_CODED, (short*)ycbcr16x16_420, future_sfc);
+ vlRenderIMacroBlock(VL_FRAME_PICTURE, VL_FIELD_FIRST, 0, 1, 0x3F, VL_DCT_FRAME_CODED, (short*)ycbcr16x16_420, future_sfc);
+ vlRenderIMacroBlock(VL_FRAME_PICTURE, VL_FIELD_FIRST, 1, 1, 0x3F, VL_DCT_FRAME_CODED, (short*)ycbcr16x16_420, future_sfc);
+ vlRenderBMacroBlock
+ (
+ VL_FRAME_PICTURE,
+ VL_FIELD_FIRST,
+ 0,
+ 0,
+ VL_FRAME_MC,
+ motion_vector,
+ 0x3F,
+ VL_DCT_FRAME_CODED,
+ (short*)ycbcr16x16_420_2,
+ past_sfc,
+ future_sfc,
+ sfc
+ );
+ vlPutSurface(sfc, framebuffer, 0, 0, video_width, video_height, 0, 0, window_width, window_height, VL_FRAME_PICTURE);
+
+ puts("Press any key to continue...");
+
+ while (!quit)
+ {
+ XNextEvent(display, &event);
+ switch (event.type)
+ {
+ case Expose:
+ {
+ XCopyArea
+ (
+ display,
+ framebuffer,
+ window,
+ XDefaultGC(display, XDefaultScreen(display)),
+ 0,
+ 0,
+ window_width,
+ window_height,
+ 0,
+ 0
+ );
+ break;
+ }
+ case KeyPress:
+ {
+ quit = 1;
+ break;
+ }
+ }
+ }
+
+ vlDestroySurface(sfc);
+ vlDestroySurface(past_sfc);
+ vlDestroySurface(future_sfc);
+ vlDestroyContext(ctx);
+
+ XFreePixmap(display, framebuffer);
+ XDestroyWindow(display, window);
+ XCloseDisplay(display);
+
+ return 0;
+}
+