Skip to content

Commit a6c6e59

Browse files
Pengfei Quxhaihao
authored andcommitted
add the frame number as the cmd line input parameter
when --frames with <=0, it will be ignored. Fixes #37 Signed-off-by: Pengfei Qu <[email protected]> (cherry picked from commit 2fc915d)
1 parent fbb45cd commit a6c6e59

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

encode/avcenc.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ static const struct option longopts[] = {
111111
{"mode", required_argument, 0, 3},
112112
{"low-power", no_argument, 0, 4},
113113
{"roi-test", no_argument, 0, 5},
114+
{"frames", required_argument, 0, 6},
114115
{ NULL, 0, NULL, 0}
115116
};
116117

@@ -1845,7 +1846,7 @@ encode_picture(FILE *yuv_fp, FILE *avc_fp,
18451846

18461847
static void show_help()
18471848
{
1848-
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] [--roi-test]\n");
1849+
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] [--roi-test] [--frames=0(ignore when < 0)/N(number)] \n");
18491850
}
18501851

18511852
static void avcenc_context_seq_param_init(VAEncSequenceParameterBufferH264 *seq_param,
@@ -2017,6 +2018,7 @@ int main(int argc, char *argv[])
20172018
int mode_value;
20182019
struct timeval tpstart,tpend;
20192020
float timeuse;
2021+
int frame_num_value = 0;
20202022

20212023
va_init_display_args(&argc, argv);
20222024

@@ -2087,6 +2089,9 @@ int main(int argc, char *argv[])
20872089
roi_test_enable = 1;
20882090
break;
20892091

2092+
case 6: // Frames number
2093+
frame_num_value = atoi(optarg);
2094+
break;
20902095
default:
20912096
show_help();
20922097
return -1;
@@ -2124,7 +2129,10 @@ int main(int argc, char *argv[])
21242129
alloc_encode_resource(yuv_fp);
21252130

21262131
enc_frame_number = 0;
2127-
for ( f = 0; f < frame_number; f++) { //picture level loop
2132+
if(frame_num_value <= 0)
2133+
frame_num_value = frame_number;
2134+
2135+
for ( f = 0; f < frame_num_value; f++) { //picture level loop
21282136
unsigned long long next_frame_display;
21292137
int next_frame_type;
21302138

0 commit comments

Comments
 (0)