xref: /aosp_15_r20/external/libaom/examples/twopass_encoder.c (revision 77c1e3ccc04c968bd2bc212e87364f250e820521)
1*77c1e3ccSAndroid Build Coastguard Worker /*
2*77c1e3ccSAndroid Build Coastguard Worker  * Copyright (c) 2016, Alliance for Open Media. All rights reserved.
3*77c1e3ccSAndroid Build Coastguard Worker  *
4*77c1e3ccSAndroid Build Coastguard Worker  * This source code is subject to the terms of the BSD 2 Clause License and
5*77c1e3ccSAndroid Build Coastguard Worker  * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6*77c1e3ccSAndroid Build Coastguard Worker  * was not distributed with this source code in the LICENSE file, you can
7*77c1e3ccSAndroid Build Coastguard Worker  * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8*77c1e3ccSAndroid Build Coastguard Worker  * Media Patent License 1.0 was not distributed with this source code in the
9*77c1e3ccSAndroid Build Coastguard Worker  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10*77c1e3ccSAndroid Build Coastguard Worker  */
11*77c1e3ccSAndroid Build Coastguard Worker 
12*77c1e3ccSAndroid Build Coastguard Worker // Two Pass Encoder
13*77c1e3ccSAndroid Build Coastguard Worker // ================
14*77c1e3ccSAndroid Build Coastguard Worker //
15*77c1e3ccSAndroid Build Coastguard Worker // This is an example of a two pass encoder loop. It takes an input file in
16*77c1e3ccSAndroid Build Coastguard Worker // YV12 format, passes it through the encoder twice, and writes the compressed
17*77c1e3ccSAndroid Build Coastguard Worker // frames to disk in IVF format. It builds upon the simple_encoder example.
18*77c1e3ccSAndroid Build Coastguard Worker //
19*77c1e3ccSAndroid Build Coastguard Worker // Twopass Variables
20*77c1e3ccSAndroid Build Coastguard Worker // -----------------
21*77c1e3ccSAndroid Build Coastguard Worker // Twopass mode needs to track the current pass number and the buffer of
22*77c1e3ccSAndroid Build Coastguard Worker // statistics packets.
23*77c1e3ccSAndroid Build Coastguard Worker //
24*77c1e3ccSAndroid Build Coastguard Worker // Updating The Configuration
25*77c1e3ccSAndroid Build Coastguard Worker // ---------------------------------
26*77c1e3ccSAndroid Build Coastguard Worker // In two pass mode, the configuration has to be updated on each pass. The
27*77c1e3ccSAndroid Build Coastguard Worker // statistics buffer is passed on the last pass.
28*77c1e3ccSAndroid Build Coastguard Worker //
29*77c1e3ccSAndroid Build Coastguard Worker // Encoding A Frame
30*77c1e3ccSAndroid Build Coastguard Worker // ----------------
31*77c1e3ccSAndroid Build Coastguard Worker // Encoding a frame in two pass mode is identical to the simple encoder
32*77c1e3ccSAndroid Build Coastguard Worker // example.
33*77c1e3ccSAndroid Build Coastguard Worker //
34*77c1e3ccSAndroid Build Coastguard Worker // Processing Statistics Packets
35*77c1e3ccSAndroid Build Coastguard Worker // -----------------------------
36*77c1e3ccSAndroid Build Coastguard Worker // Each packet of type `AOM_CODEC_CX_FRAME_PKT` contains the encoded data
37*77c1e3ccSAndroid Build Coastguard Worker // for this frame. We write a IVF frame header, followed by the raw data.
38*77c1e3ccSAndroid Build Coastguard Worker //
39*77c1e3ccSAndroid Build Coastguard Worker //
40*77c1e3ccSAndroid Build Coastguard Worker // Pass Progress Reporting
41*77c1e3ccSAndroid Build Coastguard Worker // -----------------------------
42*77c1e3ccSAndroid Build Coastguard Worker // It's sometimes helpful to see when each pass completes.
43*77c1e3ccSAndroid Build Coastguard Worker //
44*77c1e3ccSAndroid Build Coastguard Worker //
45*77c1e3ccSAndroid Build Coastguard Worker // Clean-up
46*77c1e3ccSAndroid Build Coastguard Worker // -----------------------------
47*77c1e3ccSAndroid Build Coastguard Worker // Destruction of the encoder instance must be done on each pass. The
48*77c1e3ccSAndroid Build Coastguard Worker // raw image should be destroyed at the end as usual.
49*77c1e3ccSAndroid Build Coastguard Worker 
50*77c1e3ccSAndroid Build Coastguard Worker #include <stdio.h>
51*77c1e3ccSAndroid Build Coastguard Worker #include <stdlib.h>
52*77c1e3ccSAndroid Build Coastguard Worker #include <string.h>
53*77c1e3ccSAndroid Build Coastguard Worker 
54*77c1e3ccSAndroid Build Coastguard Worker #include "aom/aom_encoder.h"
55*77c1e3ccSAndroid Build Coastguard Worker #include "aom/aomcx.h"
56*77c1e3ccSAndroid Build Coastguard Worker #include "common/tools_common.h"
57*77c1e3ccSAndroid Build Coastguard Worker #include "common/video_writer.h"
58*77c1e3ccSAndroid Build Coastguard Worker 
59*77c1e3ccSAndroid Build Coastguard Worker static const char *exec_name;
60*77c1e3ccSAndroid Build Coastguard Worker 
usage_exit(void)61*77c1e3ccSAndroid Build Coastguard Worker void usage_exit(void) {
62*77c1e3ccSAndroid Build Coastguard Worker   fprintf(stderr,
63*77c1e3ccSAndroid Build Coastguard Worker           "Usage: %s <codec> <width> <height> <infile> <outfile> "
64*77c1e3ccSAndroid Build Coastguard Worker           "<limit(optional)>\n",
65*77c1e3ccSAndroid Build Coastguard Worker           exec_name);
66*77c1e3ccSAndroid Build Coastguard Worker   exit(EXIT_FAILURE);
67*77c1e3ccSAndroid Build Coastguard Worker }
68*77c1e3ccSAndroid Build Coastguard Worker 
get_frame_stats(aom_codec_ctx_t * ctx,const aom_image_t * img,aom_codec_pts_t pts,unsigned int duration,aom_enc_frame_flags_t flags,aom_fixed_buf_t * stats)69*77c1e3ccSAndroid Build Coastguard Worker static int get_frame_stats(aom_codec_ctx_t *ctx, const aom_image_t *img,
70*77c1e3ccSAndroid Build Coastguard Worker                            aom_codec_pts_t pts, unsigned int duration,
71*77c1e3ccSAndroid Build Coastguard Worker                            aom_enc_frame_flags_t flags,
72*77c1e3ccSAndroid Build Coastguard Worker                            aom_fixed_buf_t *stats) {
73*77c1e3ccSAndroid Build Coastguard Worker   int got_pkts = 0;
74*77c1e3ccSAndroid Build Coastguard Worker   aom_codec_iter_t iter = NULL;
75*77c1e3ccSAndroid Build Coastguard Worker   const aom_codec_cx_pkt_t *pkt = NULL;
76*77c1e3ccSAndroid Build Coastguard Worker   const aom_codec_err_t res = aom_codec_encode(ctx, img, pts, duration, flags);
77*77c1e3ccSAndroid Build Coastguard Worker   if (res != AOM_CODEC_OK) die_codec(ctx, "Failed to get frame stats.");
78*77c1e3ccSAndroid Build Coastguard Worker 
79*77c1e3ccSAndroid Build Coastguard Worker   while ((pkt = aom_codec_get_cx_data(ctx, &iter)) != NULL) {
80*77c1e3ccSAndroid Build Coastguard Worker     got_pkts = 1;
81*77c1e3ccSAndroid Build Coastguard Worker 
82*77c1e3ccSAndroid Build Coastguard Worker     if (pkt->kind == AOM_CODEC_STATS_PKT) {
83*77c1e3ccSAndroid Build Coastguard Worker       const uint8_t *const pkt_buf = pkt->data.twopass_stats.buf;
84*77c1e3ccSAndroid Build Coastguard Worker       const size_t pkt_size = pkt->data.twopass_stats.sz;
85*77c1e3ccSAndroid Build Coastguard Worker       stats->buf = realloc(stats->buf, stats->sz + pkt_size);
86*77c1e3ccSAndroid Build Coastguard Worker       if (!stats->buf) die("Failed to allocate frame stats buffer.");
87*77c1e3ccSAndroid Build Coastguard Worker       memcpy((uint8_t *)stats->buf + stats->sz, pkt_buf, pkt_size);
88*77c1e3ccSAndroid Build Coastguard Worker       stats->sz += pkt_size;
89*77c1e3ccSAndroid Build Coastguard Worker     }
90*77c1e3ccSAndroid Build Coastguard Worker   }
91*77c1e3ccSAndroid Build Coastguard Worker 
92*77c1e3ccSAndroid Build Coastguard Worker   return got_pkts;
93*77c1e3ccSAndroid Build Coastguard Worker }
94*77c1e3ccSAndroid Build Coastguard Worker 
encode_frame(aom_codec_ctx_t * ctx,const aom_image_t * img,aom_codec_pts_t pts,unsigned int duration,aom_enc_frame_flags_t flags,AvxVideoWriter * writer)95*77c1e3ccSAndroid Build Coastguard Worker static int encode_frame(aom_codec_ctx_t *ctx, const aom_image_t *img,
96*77c1e3ccSAndroid Build Coastguard Worker                         aom_codec_pts_t pts, unsigned int duration,
97*77c1e3ccSAndroid Build Coastguard Worker                         aom_enc_frame_flags_t flags, AvxVideoWriter *writer) {
98*77c1e3ccSAndroid Build Coastguard Worker   int got_pkts = 0;
99*77c1e3ccSAndroid Build Coastguard Worker   aom_codec_iter_t iter = NULL;
100*77c1e3ccSAndroid Build Coastguard Worker   const aom_codec_cx_pkt_t *pkt = NULL;
101*77c1e3ccSAndroid Build Coastguard Worker   const aom_codec_err_t res = aom_codec_encode(ctx, img, pts, duration, flags);
102*77c1e3ccSAndroid Build Coastguard Worker   if (res != AOM_CODEC_OK) die_codec(ctx, "Failed to encode frame.");
103*77c1e3ccSAndroid Build Coastguard Worker 
104*77c1e3ccSAndroid Build Coastguard Worker   while ((pkt = aom_codec_get_cx_data(ctx, &iter)) != NULL) {
105*77c1e3ccSAndroid Build Coastguard Worker     got_pkts = 1;
106*77c1e3ccSAndroid Build Coastguard Worker     if (pkt->kind == AOM_CODEC_CX_FRAME_PKT) {
107*77c1e3ccSAndroid Build Coastguard Worker       const int keyframe = (pkt->data.frame.flags & AOM_FRAME_IS_KEY) != 0;
108*77c1e3ccSAndroid Build Coastguard Worker 
109*77c1e3ccSAndroid Build Coastguard Worker       if (!aom_video_writer_write_frame(writer, pkt->data.frame.buf,
110*77c1e3ccSAndroid Build Coastguard Worker                                         pkt->data.frame.sz,
111*77c1e3ccSAndroid Build Coastguard Worker                                         pkt->data.frame.pts))
112*77c1e3ccSAndroid Build Coastguard Worker         die_codec(ctx, "Failed to write compressed frame.");
113*77c1e3ccSAndroid Build Coastguard Worker       printf(keyframe ? "K" : ".");
114*77c1e3ccSAndroid Build Coastguard Worker       fflush(stdout);
115*77c1e3ccSAndroid Build Coastguard Worker     }
116*77c1e3ccSAndroid Build Coastguard Worker   }
117*77c1e3ccSAndroid Build Coastguard Worker 
118*77c1e3ccSAndroid Build Coastguard Worker   return got_pkts;
119*77c1e3ccSAndroid Build Coastguard Worker }
120*77c1e3ccSAndroid Build Coastguard Worker 
pass0(aom_image_t * raw,FILE * infile,aom_codec_iface_t * encoder,const aom_codec_enc_cfg_t * cfg,int limit)121*77c1e3ccSAndroid Build Coastguard Worker static aom_fixed_buf_t pass0(aom_image_t *raw, FILE *infile,
122*77c1e3ccSAndroid Build Coastguard Worker                              aom_codec_iface_t *encoder,
123*77c1e3ccSAndroid Build Coastguard Worker                              const aom_codec_enc_cfg_t *cfg, int limit) {
124*77c1e3ccSAndroid Build Coastguard Worker   aom_codec_ctx_t codec;
125*77c1e3ccSAndroid Build Coastguard Worker   int frame_count = 0;
126*77c1e3ccSAndroid Build Coastguard Worker   aom_fixed_buf_t stats = { NULL, 0 };
127*77c1e3ccSAndroid Build Coastguard Worker 
128*77c1e3ccSAndroid Build Coastguard Worker   if (aom_codec_enc_init(&codec, encoder, cfg, 0))
129*77c1e3ccSAndroid Build Coastguard Worker     die("Failed to initialize encoder");
130*77c1e3ccSAndroid Build Coastguard Worker 
131*77c1e3ccSAndroid Build Coastguard Worker   // Calculate frame statistics.
132*77c1e3ccSAndroid Build Coastguard Worker   while (aom_img_read(raw, infile) && frame_count < limit) {
133*77c1e3ccSAndroid Build Coastguard Worker     ++frame_count;
134*77c1e3ccSAndroid Build Coastguard Worker     get_frame_stats(&codec, raw, frame_count, 1, 0, &stats);
135*77c1e3ccSAndroid Build Coastguard Worker   }
136*77c1e3ccSAndroid Build Coastguard Worker 
137*77c1e3ccSAndroid Build Coastguard Worker   // Flush encoder.
138*77c1e3ccSAndroid Build Coastguard Worker   while (get_frame_stats(&codec, NULL, frame_count, 1, 0, &stats)) {
139*77c1e3ccSAndroid Build Coastguard Worker   }
140*77c1e3ccSAndroid Build Coastguard Worker 
141*77c1e3ccSAndroid Build Coastguard Worker   printf("Pass 0 complete. Processed %d frames.\n", frame_count);
142*77c1e3ccSAndroid Build Coastguard Worker   if (aom_codec_destroy(&codec)) die_codec(&codec, "Failed to destroy codec.");
143*77c1e3ccSAndroid Build Coastguard Worker 
144*77c1e3ccSAndroid Build Coastguard Worker   return stats;
145*77c1e3ccSAndroid Build Coastguard Worker }
146*77c1e3ccSAndroid Build Coastguard Worker 
pass1(aom_image_t * raw,FILE * infile,const char * outfile_name,aom_codec_iface_t * encoder,const aom_codec_enc_cfg_t * cfg,int limit)147*77c1e3ccSAndroid Build Coastguard Worker static void pass1(aom_image_t *raw, FILE *infile, const char *outfile_name,
148*77c1e3ccSAndroid Build Coastguard Worker                   aom_codec_iface_t *encoder, const aom_codec_enc_cfg_t *cfg,
149*77c1e3ccSAndroid Build Coastguard Worker                   int limit) {
150*77c1e3ccSAndroid Build Coastguard Worker   AvxVideoInfo info = { get_fourcc_by_aom_encoder(encoder),
151*77c1e3ccSAndroid Build Coastguard Worker                         cfg->g_w,
152*77c1e3ccSAndroid Build Coastguard Worker                         cfg->g_h,
153*77c1e3ccSAndroid Build Coastguard Worker                         { cfg->g_timebase.num, cfg->g_timebase.den },
154*77c1e3ccSAndroid Build Coastguard Worker                         0 };
155*77c1e3ccSAndroid Build Coastguard Worker   AvxVideoWriter *writer = NULL;
156*77c1e3ccSAndroid Build Coastguard Worker   aom_codec_ctx_t codec;
157*77c1e3ccSAndroid Build Coastguard Worker   int frame_count = 0;
158*77c1e3ccSAndroid Build Coastguard Worker 
159*77c1e3ccSAndroid Build Coastguard Worker   writer = aom_video_writer_open(outfile_name, kContainerIVF, &info);
160*77c1e3ccSAndroid Build Coastguard Worker   if (!writer) die("Failed to open %s for writing", outfile_name);
161*77c1e3ccSAndroid Build Coastguard Worker 
162*77c1e3ccSAndroid Build Coastguard Worker   if (aom_codec_enc_init(&codec, encoder, cfg, 0))
163*77c1e3ccSAndroid Build Coastguard Worker     die("Failed to initialize encoder");
164*77c1e3ccSAndroid Build Coastguard Worker 
165*77c1e3ccSAndroid Build Coastguard Worker   if (aom_codec_control(&codec, AOME_SET_CPUUSED, 2))
166*77c1e3ccSAndroid Build Coastguard Worker     die_codec(&codec, "Failed to set cpu-used");
167*77c1e3ccSAndroid Build Coastguard Worker 
168*77c1e3ccSAndroid Build Coastguard Worker   // Encode frames.
169*77c1e3ccSAndroid Build Coastguard Worker   while (aom_img_read(raw, infile) && frame_count < limit) {
170*77c1e3ccSAndroid Build Coastguard Worker     ++frame_count;
171*77c1e3ccSAndroid Build Coastguard Worker     encode_frame(&codec, raw, frame_count, 1, 0, writer);
172*77c1e3ccSAndroid Build Coastguard Worker   }
173*77c1e3ccSAndroid Build Coastguard Worker 
174*77c1e3ccSAndroid Build Coastguard Worker   // Flush encoder.
175*77c1e3ccSAndroid Build Coastguard Worker   while (encode_frame(&codec, NULL, -1, 1, 0, writer)) {
176*77c1e3ccSAndroid Build Coastguard Worker   }
177*77c1e3ccSAndroid Build Coastguard Worker 
178*77c1e3ccSAndroid Build Coastguard Worker   printf("\n");
179*77c1e3ccSAndroid Build Coastguard Worker 
180*77c1e3ccSAndroid Build Coastguard Worker   if (aom_codec_destroy(&codec)) die_codec(&codec, "Failed to destroy codec.");
181*77c1e3ccSAndroid Build Coastguard Worker 
182*77c1e3ccSAndroid Build Coastguard Worker   aom_video_writer_close(writer);
183*77c1e3ccSAndroid Build Coastguard Worker 
184*77c1e3ccSAndroid Build Coastguard Worker   printf("Pass 1 complete. Processed %d frames.\n", frame_count);
185*77c1e3ccSAndroid Build Coastguard Worker }
186*77c1e3ccSAndroid Build Coastguard Worker 
main(int argc,char ** argv)187*77c1e3ccSAndroid Build Coastguard Worker int main(int argc, char **argv) {
188*77c1e3ccSAndroid Build Coastguard Worker   FILE *infile = NULL;
189*77c1e3ccSAndroid Build Coastguard Worker   int w, h;
190*77c1e3ccSAndroid Build Coastguard Worker   aom_codec_ctx_t codec;
191*77c1e3ccSAndroid Build Coastguard Worker   aom_codec_enc_cfg_t cfg;
192*77c1e3ccSAndroid Build Coastguard Worker   aom_image_t raw;
193*77c1e3ccSAndroid Build Coastguard Worker   aom_codec_err_t res;
194*77c1e3ccSAndroid Build Coastguard Worker   aom_fixed_buf_t stats;
195*77c1e3ccSAndroid Build Coastguard Worker 
196*77c1e3ccSAndroid Build Coastguard Worker   const int fps = 30;       // TODO(dkovalev) add command line argument
197*77c1e3ccSAndroid Build Coastguard Worker   const int bitrate = 200;  // kbit/s TODO(dkovalev) add command line argument
198*77c1e3ccSAndroid Build Coastguard Worker   const char *const codec_arg = argv[1];
199*77c1e3ccSAndroid Build Coastguard Worker   const char *const width_arg = argv[2];
200*77c1e3ccSAndroid Build Coastguard Worker   const char *const height_arg = argv[3];
201*77c1e3ccSAndroid Build Coastguard Worker   const char *const infile_arg = argv[4];
202*77c1e3ccSAndroid Build Coastguard Worker   const char *const outfile_arg = argv[5];
203*77c1e3ccSAndroid Build Coastguard Worker   int limit = 0;
204*77c1e3ccSAndroid Build Coastguard Worker   exec_name = argv[0];
205*77c1e3ccSAndroid Build Coastguard Worker 
206*77c1e3ccSAndroid Build Coastguard Worker   if (argc < 6) die("Invalid number of arguments");
207*77c1e3ccSAndroid Build Coastguard Worker 
208*77c1e3ccSAndroid Build Coastguard Worker   if (argc > 6) limit = (int)strtol(argv[6], NULL, 0);
209*77c1e3ccSAndroid Build Coastguard Worker 
210*77c1e3ccSAndroid Build Coastguard Worker   if (limit == 0) limit = 100;
211*77c1e3ccSAndroid Build Coastguard Worker 
212*77c1e3ccSAndroid Build Coastguard Worker   aom_codec_iface_t *encoder = get_aom_encoder_by_short_name(codec_arg);
213*77c1e3ccSAndroid Build Coastguard Worker   if (!encoder) die("Unsupported codec.");
214*77c1e3ccSAndroid Build Coastguard Worker 
215*77c1e3ccSAndroid Build Coastguard Worker   w = (int)strtol(width_arg, NULL, 0);
216*77c1e3ccSAndroid Build Coastguard Worker   h = (int)strtol(height_arg, NULL, 0);
217*77c1e3ccSAndroid Build Coastguard Worker 
218*77c1e3ccSAndroid Build Coastguard Worker   if (w <= 0 || h <= 0 || (w % 2) != 0 || (h % 2) != 0)
219*77c1e3ccSAndroid Build Coastguard Worker     die("Invalid frame size: %dx%d", w, h);
220*77c1e3ccSAndroid Build Coastguard Worker 
221*77c1e3ccSAndroid Build Coastguard Worker   if (!aom_img_alloc(&raw, AOM_IMG_FMT_I420, w, h, 1))
222*77c1e3ccSAndroid Build Coastguard Worker     die("Failed to allocate image (%dx%d)", w, h);
223*77c1e3ccSAndroid Build Coastguard Worker 
224*77c1e3ccSAndroid Build Coastguard Worker   printf("Using %s\n", aom_codec_iface_name(encoder));
225*77c1e3ccSAndroid Build Coastguard Worker 
226*77c1e3ccSAndroid Build Coastguard Worker   // Configuration
227*77c1e3ccSAndroid Build Coastguard Worker   res = aom_codec_enc_config_default(encoder, &cfg, 0);
228*77c1e3ccSAndroid Build Coastguard Worker   if (res) die_codec(&codec, "Failed to get default codec config.");
229*77c1e3ccSAndroid Build Coastguard Worker 
230*77c1e3ccSAndroid Build Coastguard Worker   cfg.g_w = w;
231*77c1e3ccSAndroid Build Coastguard Worker   cfg.g_h = h;
232*77c1e3ccSAndroid Build Coastguard Worker   cfg.g_timebase.num = 1;
233*77c1e3ccSAndroid Build Coastguard Worker   cfg.g_timebase.den = fps;
234*77c1e3ccSAndroid Build Coastguard Worker   cfg.rc_target_bitrate = bitrate;
235*77c1e3ccSAndroid Build Coastguard Worker 
236*77c1e3ccSAndroid Build Coastguard Worker   if (!(infile = fopen(infile_arg, "rb")))
237*77c1e3ccSAndroid Build Coastguard Worker     die("Failed to open %s for reading", infile_arg);
238*77c1e3ccSAndroid Build Coastguard Worker 
239*77c1e3ccSAndroid Build Coastguard Worker   // Pass 0
240*77c1e3ccSAndroid Build Coastguard Worker   cfg.g_pass = AOM_RC_FIRST_PASS;
241*77c1e3ccSAndroid Build Coastguard Worker   stats = pass0(&raw, infile, encoder, &cfg, limit);
242*77c1e3ccSAndroid Build Coastguard Worker 
243*77c1e3ccSAndroid Build Coastguard Worker   // Pass 1
244*77c1e3ccSAndroid Build Coastguard Worker   rewind(infile);
245*77c1e3ccSAndroid Build Coastguard Worker   cfg.g_pass = AOM_RC_LAST_PASS;
246*77c1e3ccSAndroid Build Coastguard Worker   cfg.rc_twopass_stats_in = stats;
247*77c1e3ccSAndroid Build Coastguard Worker   pass1(&raw, infile, outfile_arg, encoder, &cfg, limit);
248*77c1e3ccSAndroid Build Coastguard Worker   free(stats.buf);
249*77c1e3ccSAndroid Build Coastguard Worker 
250*77c1e3ccSAndroid Build Coastguard Worker   aom_img_free(&raw);
251*77c1e3ccSAndroid Build Coastguard Worker   fclose(infile);
252*77c1e3ccSAndroid Build Coastguard Worker 
253*77c1e3ccSAndroid Build Coastguard Worker   return EXIT_SUCCESS;
254*77c1e3ccSAndroid Build Coastguard Worker }
255