hardware/intel/libva
修订版 | 888a75cac869dc197bd55381dd80cde2942b3b52 (tree) |
---|---|
时间 | 2016-05-09 17:48:52 |
作者 | Xiang, Haihao <haihao.xiang@inte...> |
Commiter | Xiang, Haihao |
test/encode/avcenc: Add support for low power mode
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Reviewed-By: Sean V Kelley <sean.v.kelley@intel.com>
@@ -92,6 +92,8 @@ static int frame_bit_rate = -1; | ||
92 | 92 | static int frame_rate = 30; |
93 | 93 | static int ip_period = 1; |
94 | 94 | |
95 | +static VAEntrypoint select_entrypoint = VAEntrypointEncSlice; | |
96 | + | |
95 | 97 | #define MAX_SLICES 32 |
96 | 98 | |
97 | 99 |
@@ -103,6 +105,7 @@ static const struct option longopts[] = { | ||
103 | 105 | {"qp", required_argument, 0, 1}, |
104 | 106 | {"fb", required_argument, 0, 2}, |
105 | 107 | {"mode", required_argument, 0, 3}, |
108 | + {"low-power", no_argument, 0, 4}, | |
106 | 109 | { NULL, 0, NULL, 0} |
107 | 110 | }; |
108 | 111 |
@@ -194,7 +197,7 @@ static void create_encode_pipe() | ||
194 | 197 | &num_entrypoints); |
195 | 198 | |
196 | 199 | for (slice_entrypoint = 0; slice_entrypoint < num_entrypoints; slice_entrypoint++) { |
197 | - if (entrypoints[slice_entrypoint] == VAEntrypointEncSlice) | |
200 | + if (entrypoints[slice_entrypoint] == select_entrypoint) | |
198 | 201 | break; |
199 | 202 | } |
200 | 203 |
@@ -206,7 +209,7 @@ static void create_encode_pipe() | ||
206 | 209 | /* find out the format for the render target, and rate control mode */ |
207 | 210 | attrib[0].type = VAConfigAttribRTFormat; |
208 | 211 | attrib[1].type = VAConfigAttribRateControl; |
209 | - vaGetConfigAttributes(va_dpy, avcenc_context.profile, VAEntrypointEncSlice, | |
212 | + vaGetConfigAttributes(va_dpy, avcenc_context.profile, select_entrypoint, | |
210 | 213 | &attrib[0], 2); |
211 | 214 | |
212 | 215 | if ((attrib[0].value & VA_RT_FORMAT_YUV420) == 0) { |
@@ -223,7 +226,7 @@ static void create_encode_pipe() | ||
223 | 226 | attrib[0].value = VA_RT_FORMAT_YUV420; /* set to desired RT format */ |
224 | 227 | attrib[1].value = avcenc_context.rate_control_method; /* set to desired RC mode */ |
225 | 228 | |
226 | - va_status = vaCreateConfig(va_dpy, avcenc_context.profile, VAEntrypointEncSlice, | |
229 | + va_status = vaCreateConfig(va_dpy, avcenc_context.profile, select_entrypoint, | |
227 | 230 | &attrib[0], 2,&avcenc_context.config_id); |
228 | 231 | CHECK_VASTATUS(va_status, "vaCreateConfig"); |
229 | 232 |
@@ -1688,7 +1691,7 @@ encode_picture(FILE *yuv_fp, FILE *avc_fp, | ||
1688 | 1691 | |
1689 | 1692 | static void show_help() |
1690 | 1693 | { |
1691 | - printf("Usage: avnenc <width> <height> <input_yuvfile> <output_avcfile> [--qp=qpvalue|--fb=framebitrate] [--mode=0(I frames only)/1(I and P frames)/2(I, P and B frames)\n"); | |
1694 | + printf("Usage: avnenc <width> <height> <input_yuvfile> <output_avcfile> [--qp=qpvalue|--fb=framebitrate] [--mode=0(I frames only)/1(I and P frames)/2(I, P and B frames)] [--low-power]\n"); | |
1692 | 1695 | } |
1693 | 1696 | |
1694 | 1697 | static void avcenc_context_seq_param_init(VAEncSequenceParameterBufferH264 *seq_param, |
@@ -1919,6 +1922,10 @@ int main(int argc, char *argv[]) | ||
1919 | 1922 | |
1920 | 1923 | break; |
1921 | 1924 | |
1925 | + case 4: // low-power mode | |
1926 | + select_entrypoint = VAEntrypointEncSliceLP; | |
1927 | + break; | |
1928 | + | |
1922 | 1929 | default: |
1923 | 1930 | show_help(); |
1924 | 1931 | return -1; |