Rev 5362 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5362 | serge | 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: |
||
5366 | serge | 11 | * |
5362 | serge | 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. |
||
5366 | serge | 15 | * |
5362 | serge | 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 |
||
26 | #ifdef ANDROID |
||
27 | #include |
||
28 | #else |
||
29 | #include |
||
30 | #endif |
||
31 | #include "assert.h" |
||
32 | #include |
||
33 | #include |
||
34 | #include |
||
35 | #include |
||
36 | #include |
||
37 | |||
38 | #define ASSERT assert |
||
39 | |||
40 | void status(const char *msg, ...); |
||
41 | #ifdef ANDROID |
||
42 | #include "test_android.c" |
||
43 | #else |
||
44 | #include "test_x11.c" |
||
45 | #endif |
||
46 | |||
47 | VADisplay va_dpy; |
||
48 | VAStatus va_status; |
||
49 | int major_version, minor_version; |
||
5366 | serge | 50 | int print_status = 1; |
5362 | serge | 51 | int num_profiles; |
52 | VAProfile *profiles = NULL; |
||
53 | |||
54 | void pre(); |
||
55 | void test(); |
||
56 | void post(); |
||
57 | |||
58 | void status(const char *msg, ...) |
||
59 | { |
||
60 | if (!print_status) return; |
||
61 | va_list args; |
||
62 | printf("--- "); |
||
63 | va_start(args, msg); |
||
64 | vfprintf(stdout, msg, args); |
||
65 | va_end(args); |
||
66 | } |
||
67 | |||
68 | |||
69 | int main(int argc, const char* argv[]) |
||
70 | { |
||
71 | const char *name = strrchr(argv[0], '/'); |
||
72 | if (name) |
||
73 | name++; |
||
74 | else |
||
75 | name = argv[0]; |
||
76 | printf("*** %s: %s\n", name, TEST_DESCRIPTION); |
||
77 | pre(); |
||
78 | print_status = 1; |
||
79 | test(); |
||
80 | print_status = 0; |
||
81 | post(); |
||
82 | printf("*** %s: Finished\n", name); |
||
83 | return 0; |
||
84 | } |
||
85 | |||
86 | #define PROFILE(profile) case VAProfile##profile: return("VAProfile" #profile); |
||
87 | |||
88 | const char *profile2string(VAProfile profile) |
||
89 | { |
||
90 | switch(profile) |
||
91 | { |
||
92 | PROFILE(None) |
||
93 | PROFILE(MPEG2Simple) |
||
94 | PROFILE(MPEG2Main) |
||
95 | PROFILE(MPEG4Simple) |
||
96 | PROFILE(MPEG4AdvancedSimple) |
||
97 | PROFILE(MPEG4Main) |
||
98 | PROFILE(H263Baseline) |
||
99 | PROFILE(H264Baseline) |
||
100 | PROFILE(H264Main) |
||
101 | PROFILE(H264High) |
||
102 | PROFILE(H264ConstrainedBaseline) |
||
103 | PROFILE(H264MultiviewHigh) |
||
104 | PROFILE(H264StereoHigh) |
||
105 | PROFILE(VC1Simple) |
||
106 | PROFILE(VC1Main) |
||
107 | PROFILE(VC1Advanced) |
||
108 | PROFILE(JPEGBaseline) |
||
109 | PROFILE(VP8Version0_3) |
||
110 | } |
||
111 | ASSERT(0); |
||
112 | return "Unknown"; |
||
113 | } |
||
114 | |||
115 | #define ENTRYPOINT(profile) case VAEntrypoint##profile: return("VAEntrypoint" #profile); |
||
116 | |||
117 | const char *entrypoint2string(VAEntrypoint entrypoint) |
||
118 | { |
||
119 | switch(entrypoint) |
||
120 | { |
||
121 | ENTRYPOINT(VLD) |
||
122 | ENTRYPOINT(IZZ) |
||
123 | ENTRYPOINT(IDCT) |
||
124 | ENTRYPOINT(MoComp) |
||
125 | ENTRYPOINT(Deblocking) |
||
126 | ENTRYPOINT(EncSlice) |
||
127 | ENTRYPOINT(EncPicture) |
||
128 | ENTRYPOINT(VideoProc) |
||
129 | } |
||
130 | ASSERT(0); |
||
131 | return "Unknown"; |
||
132 | } |
||
133 | |||
134 | |||
135 | void test_profiles() |
||
136 | { |
||
137 | int max_profiles; |
||
138 | int i; |
||
139 | max_profiles = vaMaxNumProfiles(va_dpy); |
||
140 | status("vaMaxNumProfiles = %d\n", max_profiles); |
||
141 | ASSERT(max_profiles > 0); |
||
142 | profiles = malloc(max_profiles * sizeof(VAProfile)); |
||
143 | ASSERT(profiles); |
||
5366 | serge | 144 | |
5362 | serge | 145 | va_status = vaQueryConfigProfiles(va_dpy, profiles, &num_profiles); |
146 | ASSERT( VA_STATUS_SUCCESS == va_status ); |
||
5366 | serge | 147 | |
5362 | serge | 148 | status("vaQueryConfigProfiles reports %d profiles\n", num_profiles); |
149 | ASSERT(num_profiles <= max_profiles); |
||
150 | ASSERT(num_profiles > 0); |
||
5366 | serge | 151 | |
5362 | serge | 152 | if (print_status) |
153 | { |
||
154 | for(i = 0; i < num_profiles; i++) |
||
155 | { |
||
156 | status(" profile %d [%s]\n", profiles[i], profile2string(profiles[i])); |
||
157 | } |
||
158 | } |
||
159 | }>=> |