Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | 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:
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 
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
#include 
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("VAProfile" #profile);
89
 
90
const char *profile2string(VAProfile profile)
91
{
92
    switch(profile)
93
    {
94
        PROFILE(None)
95
        PROFILE(MPEG2Simple)
96
        PROFILE(MPEG2Main)
97
        PROFILE(MPEG4Simple)
98
        PROFILE(MPEG4AdvancedSimple)
99
        PROFILE(MPEG4Main)
100
        PROFILE(H263Baseline)
101
        PROFILE(H264Baseline)
102
        PROFILE(H264Main)
103
        PROFILE(H264High)
104
        PROFILE(H264ConstrainedBaseline)
105
        PROFILE(H264MultiviewHigh)
106
        PROFILE(H264StereoHigh)
107
        PROFILE(VC1Simple)
108
        PROFILE(VC1Main)
109
        PROFILE(VC1Advanced)
110
        PROFILE(JPEGBaseline)
111
        PROFILE(VP8Version0_3)
112
    }
113
    ASSERT(0);
114
    return "Unknown";
115
}
116
 
117
#define ENTRYPOINT(profile)	case VAEntrypoint##profile:	return("VAEntrypoint" #profile);
118
 
119
const char *entrypoint2string(VAEntrypoint entrypoint)
120
{
121
    switch(entrypoint)
122
    {
123
        ENTRYPOINT(VLD)
124
        ENTRYPOINT(IZZ)
125
        ENTRYPOINT(IDCT)
126
        ENTRYPOINT(MoComp)
127
        ENTRYPOINT(Deblocking)
128
        ENTRYPOINT(EncSlice)
129
        ENTRYPOINT(EncPicture)
130
        ENTRYPOINT(VideoProc)
131
    }
132
    ASSERT(0);
133
    return "Unknown";
134
}
135
 
136
 
137
void test_profiles()
138
{
139
    int max_profiles;
140
    int i;
141
    max_profiles = vaMaxNumProfiles(va_dpy);
142
    status("vaMaxNumProfiles = %d\n", max_profiles);
143
    ASSERT(max_profiles > 0);
144
    profiles = malloc(max_profiles * sizeof(VAProfile));
145
    ASSERT(profiles);
146
 
147
    va_status = vaQueryConfigProfiles(va_dpy, profiles, &num_profiles);
148
    ASSERT( VA_STATUS_SUCCESS == va_status );
149
 
150
    status("vaQueryConfigProfiles reports %d profiles\n", num_profiles);
151
    ASSERT(num_profiles <= max_profiles);
152
    ASSERT(num_profiles > 0);
153
 
154
    if (print_status)
155
    {
156
        for(i = 0; i < num_profiles; i++)
157
        {
158
            status("  profile %d [%s]\n", profiles[i], profile2string(profiles[i]));
159
        }
160
    }
161
}