Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(750)

Side by Side Diff: third_party/libva/test/basic/test_common.c

Issue 10375035: Add libva to chromium third_party. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2007 Intel Corporation. All Rights Reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sub license, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
14 * of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19 * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
20 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25 #include <va/va.h>
26 #ifdef ANDROID
27 #include <va/va_android.h>
28 #else
29 #include <va/va_x11.h>
30 #endif
31 #include "assert.h"
32 #include <stdarg.h>
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <string.h>
36 #include <stdint.h>
37 #include <dlfcn.h>
38
39 #define ASSERT assert
40
41 void status(const char *msg, ...);
42 #ifdef ANDROID
43 #include "test_android.c"
44 #else
45 #include "test_x11.c"
46 #endif
47
48 Display *dpy;
49 VADisplay va_dpy;
50 VAStatus va_status;
51 int major_version, minor_version;
52 int print_status = 0;
53 int num_profiles;
54 VAProfile *profiles = NULL;
55
56 void pre();
57 void test();
58 void post();
59
60 void status(const char *msg, ...)
61 {
62 if (!print_status) return;
63 va_list args;
64 printf("--- ");
65 va_start(args, msg);
66 vfprintf(stdout, msg, args);
67 va_end(args);
68 }
69
70
71 int main(int argc, const char* argv[])
72 {
73 const char *name = strrchr(argv[0], '/');
74 if (name)
75 name++;
76 else
77 name = argv[0];
78 printf("*** %s: %s\n", name, TEST_DESCRIPTION);
79 pre();
80 print_status = 1;
81 test();
82 print_status = 0;
83 post();
84 printf("*** %s: Finished\n", name);
85 return 0;
86 }
87
88 #define PROFILE(profile) case VAProfile##profile: return("VAProfil e" #profile);
89
90 const char *profile2string(VAProfile profile)
91 {
92 switch(profile)
93 {
94 PROFILE(MPEG2Simple)
95 PROFILE(MPEG2Main)
96 PROFILE(MPEG4Simple)
97 PROFILE(MPEG4AdvancedSimple)
98 PROFILE(MPEG4Main)
99 PROFILE(H263Baseline)
100 PROFILE(H264Baseline)
101 PROFILE(H264Main)
102 PROFILE(H264High)
103 PROFILE(H264ConstrainedBaseline)
104 PROFILE(VC1Simple)
105 PROFILE(VC1Main)
106 PROFILE(VC1Advanced)
107 PROFILE(JPEGBaseline)
108 }
109 ASSERT(0);
110 return "Unknown";
111 }
112
113 #define ENTRYPOINT(profile) case VAEntrypoint##profile: return("VAEntryp oint" #profile);
114
115 const char *entrypoint2string(VAEntrypoint entrypoint)
116 {
117 switch(entrypoint)
118 {
119 ENTRYPOINT(VLD)
120 ENTRYPOINT(IZZ)
121 ENTRYPOINT(IDCT)
122 ENTRYPOINT(MoComp)
123 ENTRYPOINT(Deblocking)
124 ENTRYPOINT(EncSlice)
125 ENTRYPOINT(EncPicture)
126 }
127 ASSERT(0);
128 return "Unknown";
129 }
130
131
132 void test_profiles()
133 {
134 int max_profiles;
135 int i;
136 max_profiles = vaMaxNumProfiles(va_dpy);
137 status("vaMaxNumProfiles = %d\n", max_profiles);
138 ASSERT(max_profiles > 0);
139 profiles = malloc(max_profiles * sizeof(VAProfile));
140 ASSERT(profiles);
141
142 va_status = vaQueryConfigProfiles(va_dpy, profiles, &num_profiles);
143 ASSERT( VA_STATUS_SUCCESS == va_status );
144
145 status("vaQueryConfigProfiles reports %d profiles\n", num_profiles);
146 ASSERT(num_profiles <= max_profiles);
147 ASSERT(num_profiles > 0);
148
149 if (print_status)
150 {
151 for(i = 0; i < num_profiles; i++)
152 {
153 status(" profile %d [%s]\n", profiles[i], profile2string(profiles[i ]));
154 }
155 }
156 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698