2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 # Script for converting celt_pitch_xcorr_arm.s -> celt_pitch_xcorr_arm.S
7 # using the arm2gnu.pl script.
14 './convert_rtcd_assembler.py arm2gnu_script input_file output_file')
19 print >> sys
.stderr
, ('Error: You must pass the following arguments:\n'
20 ' * arm2gnu_script_path\n'
26 arm2gnu_script
= os
.path
.abspath(argv
[0])
27 if not os
.path
.exists(arm2gnu_script
):
28 print >> sys
.stderr
, ('Error: Cannot find arm2gnu.pl script at: %s.' %
32 input_file
= os
.path
.abspath(argv
[1])
33 if not os
.path
.exists(input_file
):
34 print >> sys
.stderr
, 'Error: Cannot find input file at: %s.' % input_file
39 # Ensure the output file's directory path exists.
40 output_dir
= os
.path
.dirname(output_file
)
41 if not os
.path
.exists(output_dir
):
42 os
.makedirs(output_dir
)
44 cmd
= ('perl %s %s | '
45 'sed "s/OPUS_ARM_MAY_HAVE_[A-Z]*/1/g" | '
47 '> %s') % (arm2gnu_script
, input_file
, output_file
)
51 if __name__
== '__main__':
52 sys
.exit(main(sys
.argv
[1:]))