2 # -*- encoding: iso-8859-1 -*-
3 # OpenGL ES 2.0 memory performance estimator
4 # Copyright (C) 2009 Nokia
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with this program; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 # \author Sami Kyöstilä <sami.kyostila@nokia.com>
24 if not len(sys.argv) == 5:
25 print "Usage: %s SOURCE DEST BYTES-PER-PIXEL STRIDE" % sys.argv[0]
28 fsrc = open(sys.argv[1], "rb")
29 fdst = open(sys.argv[2], "wb")
30 bpp = int(sys.argv[3])
31 stride = int(sys.argv[4])
35 line = fsrc.read(stride)
39 print "%dx%dx => %dx%d" % (stride / bpp, len(lines), len(lines), stride / bpp)
41 for x in range(0, stride, bpp):
43 fdst.write(line[x:x+bpp])