78
78
#define PROFILE_IDC_MAIN10 2
79
79
80
80
#define BITSTREAM_ALLOCATE_STEPPING 4096
81
- #define LCU_SIZE 32
81
+ static int LCU_SIZE = 32 ;
82
82
83
83
#define SURFACE_NUM 16 /* 16 surfaces for source YUV */
84
84
#define SURFACE_NUM 16 /* 16 surfaces for reference */
@@ -374,7 +374,9 @@ static struct SliceHeader ssh;
374
374
static VADisplay va_dpy ;
375
375
static VAProfile hevc_profile = ~0 ;
376
376
static int real_hevc_profile = 0 ;
377
+ static VAEntrypoint entryPoint = VAEntrypointEncSlice ;
377
378
static int p2b = 1 ;
379
+ static int lowpower = 0 ;
378
380
static VAConfigAttrib attrib [VAConfigAttribTypeMax ];
379
381
static VAConfigAttrib config_attrib [VAConfigAttribTypeMax ];
380
382
static int config_attrib_num = 0 , enc_packed_header_idx ;
@@ -1746,7 +1748,7 @@ static int print_help(void)
1746
1748
printf (" --intra_period <number>\n" );
1747
1749
printf (" --idr_period <number>\n" );
1748
1750
printf (" --ip_period <number>\n" );
1749
- printf (" --bitrate <bitrate>\n" );
1751
+ printf (" --bitrate <bitrate> Kbits per second \n" );
1750
1752
printf (" --initialqp <number>\n" );
1751
1753
printf (" --minqp <number>\n" );
1752
1754
printf (" --rcmode <NONE|CBR|VBR|VCM|CQP|VBR_CONTRAINED>\n" );
@@ -1757,6 +1759,7 @@ static int print_help(void)
1757
1759
printf (" --enablePSNR calculate PSNR of recyuv vs. srcyuv\n" );
1758
1760
printf (" --profile 1: main 2 : main10\n" );
1759
1761
printf (" --p2b 1: enable 0 : disalbe(defalut)\n" );
1762
+ printf (" --lowpower 1: enable 0 : disalbe(defalut)\n" );
1760
1763
return 0 ;
1761
1764
}
1762
1765
@@ -1782,6 +1785,7 @@ static int process_cmdline(int argc, char *argv[])
1782
1785
{"framecount" , required_argument , NULL , 16 },
1783
1786
{"profile" , required_argument , NULL , 17 },
1784
1787
{"p2b" , required_argument , NULL , 18 },
1788
+ {"lowpower" , required_argument , NULL , 19 },
1785
1789
{NULL , no_argument , NULL , 0 }
1786
1790
};
1787
1791
int long_index ;
@@ -1808,7 +1812,7 @@ static int process_cmdline(int argc, char *argv[])
1808
1812
print_help ();
1809
1813
exit (0 );
1810
1814
case 1 :
1811
- frame_bitrate = atoi (optarg );
1815
+ frame_bitrate = atoi (optarg )* 1000 ;
1812
1816
break ;
1813
1817
case 2 :
1814
1818
minimal_qp = atoi (optarg );
@@ -1870,6 +1874,9 @@ static int process_cmdline(int argc, char *argv[])
1870
1874
case 18 :
1871
1875
p2b = atoi (optarg );
1872
1876
break ;
1877
+ case 19 :
1878
+ lowpower = atoi (optarg );
1879
+ break ;
1873
1880
1874
1881
case ':' :
1875
1882
case '?' :
@@ -1987,7 +1994,8 @@ static int init_va(void)
1987
1994
hevc_profile = profile_list [i ];
1988
1995
vaQueryConfigEntrypoints (va_dpy , hevc_profile , entrypoints , & num_entrypoints );
1989
1996
for (slice_entrypoint = 0 ; slice_entrypoint < num_entrypoints ; slice_entrypoint ++ ) {
1990
- if (entrypoints [slice_entrypoint ] == VAEntrypointEncSlice ) {
1997
+ if (entrypoints [slice_entrypoint ] == VAEntrypointEncSlice ||
1998
+ entrypoints [slice_entrypoint ] == VAEntrypointEncSliceLP ) {
1991
1999
support_encode = 1 ;
1992
2000
break ;
1993
2001
}
@@ -2023,7 +2031,7 @@ static int init_va(void)
2023
2031
for (i = 0 ; i < VAConfigAttribTypeMax ; i ++ )
2024
2032
attrib [i ].type = i ;
2025
2033
2026
- va_status = vaGetConfigAttributes (va_dpy , hevc_profile , VAEntrypointEncSlice ,
2034
+ va_status = vaGetConfigAttributes (va_dpy , hevc_profile , entryPoint ,
2027
2035
& attrib [0 ], VAConfigAttribTypeMax );
2028
2036
CHECK_VASTATUS (va_status , "vaGetConfigAttributes" );
2029
2037
/* check the interested configattrib */
@@ -2165,7 +2173,12 @@ static int setup_encode()
2165
2173
VASurfaceID * tmp_surfaceid ;
2166
2174
int codedbuf_size , i ;
2167
2175
2168
- va_status = vaCreateConfig (va_dpy , hevc_profile , VAEntrypointEncSlice ,
2176
+ if (lowpower )
2177
+ {
2178
+ entryPoint = VAEntrypointEncSliceLP ;
2179
+ LCU_SIZE = 64 ;
2180
+ }
2181
+ va_status = vaCreateConfig (va_dpy , hevc_profile , entryPoint ,
2169
2182
& config_attrib [0 ], config_attrib_num , & config_id );
2170
2183
CHECK_VASTATUS (va_status , "vaCreateConfig" );
2171
2184
@@ -2325,7 +2338,7 @@ static int render_sequence(struct SeqParamSet *sps)
2325
2338
seq_param .intra_idr_period = intra_idr_period ;
2326
2339
seq_param .ip_period = ip_period ;
2327
2340
2328
- seq_param .bits_per_second = 400000 ;
2341
+ seq_param .bits_per_second = frame_bitrate ;
2329
2342
seq_param .pic_width_in_luma_samples = sps -> pic_width_in_luma_samples ;
2330
2343
seq_param .pic_height_in_luma_samples = sps -> pic_height_in_luma_samples ;
2331
2344
@@ -3171,6 +3184,7 @@ static int print_input()
3171
3184
printf ("INPUT: Initial QP : %d\n" , initial_qp );
3172
3185
printf ("INPUT: Min QP : %d\n" , minimal_qp );
3173
3186
printf ("INPUT: P As B : %d\n" , p2b );
3187
+ printf ("INPUT: lowpower : %d\n" , lowpower );
3174
3188
printf ("INPUT: Source YUV : %s" , srcyuv_fp ? "FILE" : "AUTO generated" );
3175
3189
if (srcyuv_fp )
3176
3190
printf (":%s (fourcc %s)\n" , srcyuv_fn , fourcc_to_string (srcyuv_fourcc ));
0 commit comments