Exemplo n.º 1
0
for GOP_number in range(1, GOPs):

    length_GOP = 0
    sys.stdout.write("%3s" % '%04d' % (GOP_number))

    # {{{ L

    length = 0
    filename = "L_" + str(TRLs - 1) + "/" + "%04d" % GOP_number + "." + IMG_EXT
    try:
        with io.open(filename, "rb") as file:
            file.seek(0, 2)
            length += file.tell()
    except:
        if __debug__:
            log.warning("{} is missing".format(filename))
        else:
            pass

    kbps = float(length) * 8.0 / GOP_time / 1000.0
    sys.stdout.write(" %5d" % int(round(kbps)))
    length_GOP += length

    # }}}

    # {{{ Rest of subbands

    pics_in_subband = 1
    for subband in range(TRLs - 1, 0, -1):

        #import ipdb; ipdb.set_trace()
Exemplo n.º 2
0
extension = ".rawl"

field = 0
while field < fields:

    fn = file + "/" + str('%04d' % field)
    shell.run("trace rm -f " + fn + extension)

    for c in range(COMPONENTS):

        command = "trace kdu_expand" \
                  + " -i " + fn + ".j2c" \
                  + " -o tmp_" + str(c) + extension \
                  + " -skip_components " + str(c)

        if not __debug__:
            command += " > /dev/null 2> /dev/null"

        try:
            shell.run(command)
        except:
            log.warning("{} is missing".format(fn + extension))
            continue

        shell.run("trace cat tmp_" + str(c) + extension + " >> " + fn +
                  extension)
        shell.run("trace rm tmp_" + str(c) + extension)

    field += 1
IMG_EXT = os.environ["MCTF_IMG_EXT"]

p = 0
while p < pictures:

    fn = file + "/" + str('%04d' % p)

    command = "trace kdu_expand" \
              + " -i " + fn + '.' + IMG_EXT \
              + " -o " \
              + "tmp_0.pgm," \
              + "tmp_1.pgm," \
              + "tmp_2.pgm"

    if not __debug__:
        command += " > /dev/null 2> /dev/null"

    try:
        shell.run(command)
        shell.run("trace convert -endian LSB tmp_0.pgm " + fn + "_0.pgm")
        shell.run("trace rm tmp_0.pgm")
        shell.run("trace convert -endian LSB tmp_1.pgm " + fn + "_1.pgm")
        shell.run("trace rm tmp_1.pgm")
        shell.run("trace convert -endian LSB tmp_2.pgm " + fn + "_2.pgm")
        shell.run("trace rm tmp_2.pgm")
    except:
        log.warning("{} is missing".format(fn + '.' + IMG_EXT))

    p += 1