help="number of blocks in the X direction.", default=11) parser.add_argument("--blocks_in_y", help="number of blocks in the Y direction.", default=9) parser.add_argument("--fields", help="number of fields in to expand.", default=2) parser.add_argument("--file", help="name of the file with the motion fields.", default="") args = parser.parse_known_args()[0] blocks_in_x = int(args.blocks_in_x) log.info("blocks_in_x={}".format(blocks_in_x)) blocks_in_y = int(args.blocks_in_y) log.info("blocks_in_x={}".format(blocks_in_x)) bytes_per_field = blocks_in_x * blocks_in_y * BYTES_PER_COMPONENT fields = int(args.fields) log.info("fields={}".format(fields)) file = args.file log.info("file={}".format(file)) # }}} extension = ".rawl"
parser.pixels_in_x() parser.pixels_in_y() parser.layers() parser.SRLs() parser.slope() args = parser.parse_known_args()[0] file = args.file layers = int(args.layers) number_of_pictures = int(args.pictures) pixels_in_x = int(args.pixels_in_x) pixels_in_y = int(args.pixels_in_y) SRLs = int(args.SRLs) slope = int(args.slope) log.info("file={}".format(file)) log.info("layers={}".format(layers)) log.info("pictures={}".format(number_of_pictures)) log.info("pixels_in_x={}".format(pixels_in_x)) log.info("pixels_in_y={}".format(pixels_in_y)) log.info("SRLs={}".format(SRLs)) log.info("slope={}".format(slope)) # }}} BYTES_PER_COMPONENT = 1 # 2 IMG_EXT = os.environ["MCTF_IMG_EXT"] Clevels = SRLs - 1 if Clevels < 0:
parser = arguments_parser( description="Creates a \"empty\" (unsigned char = 128) texture image file." ) parser.add_argument("--file", help="File that contains the texture.", default="empty.pgm") parser.pixels_in_x() parser.pixels_in_y() args = parser.parse_known_args()[0] file = args.file pixels_in_x = int(args.pixels_in_x) log.info("pixels_in_x={}".format(pixels_in_x)) pixels_in_y = int(args.pixels_in_y) log.info("pixels_in_y={}".format(pixels_in_y)) f = open(file, "wb") if file[4:] != ".yuv": # For .yuv argument f.write(b"P5\n") f.write(bytes(str.encode("{} {}\n".format(pixels_in_x, pixels_in_y)))) f.write(b"255\n") for a in range(pixels_in_x * pixels_in_y): f.write(struct.pack('B', 128)) f.close()
+ " --block_overlaping=" + str(block_overlaping) + " --block_size=" + str(block_size) + " --border_size=" + str(border_size) + " --pictures=" + str(pictures) + " --pixels_in_x=" + str(pixels_in_x) + " --pixels_in_y=" + str(pixels_in_y) + " --search_range=" + str(search_range) + " --subpixel_accuracy=" + str(subpixel_accuracy) + " --temporal_subband=" + str(temporal_subband) + " --update_factor=" + str(update_factor)) pictures = (pictures + 1) // 2 search_range = search_range * search_factor if search_range > MAX_SEARCH_RANGE: log.info("Maximum search range ({}) reached!".format(MAX_SEARCH_RANGE)) search_range = MAX_SEARCH_RANGE if block_size > min_block_size: block_size //= 2 shell.run("mctf zoomin_imotion" + " --block_size=" + str(block_size) + " --imotion_fn=" + "M_" + str(temporal_subband-1) + " --motion_fn=" + "M_" + str(temporal_subband) + " --pictures=" + str(pictures) + " --pixels_in_x=" + str(pixels_in_x) + " --pixels_in_y=" + str(pixels_in_y)) #block_size = block_size // 2 #if ( block_size < min_block_size ): # block_size = min_block_size
parser.pixels_in_x() parser.pixels_in_y() parser.SRLs() parser.TRLs() parser.slope() args = parser.parse_known_args()[0] GOPs = int(args.GOPs) layers = int(args.layers) pixels_in_x = int(args.pixels_in_x) pixels_in_y = int(args.pixels_in_y) SRLs = int(args.SRLs) TRLs = int(args.TRLs) slope = int(args.slope) log.info("GOPs={}".format(GOPs)) log.info("layers={}".format(layers)) log.info("pixels_in_x={}".format(pixels_in_x)) log.info("pixels_in_y={}".format(pixels_in_y)) log.info("SRLs={}".format(SRLs)) log.info("TRLs={}".format(TRLs)) log.info("(minimum) slope={}".format(slope)) # }}} # {{{ Some defs MCTF_TEXTURE_CODEC = os.environ["MCTF_TEXTURE_CODEC"] HIGH = "H" LOW = "L"
#parser.motion_quantization() #parser.motion_quantization_step() parser.pixels_in_x() parser.pixels_in_y() parser.search_range() parser.slope() parser.subpixel_accuracy() parser.layers() parser.SRLs() parser.TRLs() parser.update_factor() args = parser.parse_known_args()[0] always_B = int(args.always_B) log.info("always_B={}".format(always_B)) block_overlaping = int(args.block_overlaping) log.info("block_overlaping={}".format(block_overlaping)) block_size = int(args.block_size) log.info("block_size={}".format(block_size)) border_size = int(args.border_size) log.info("border_size={}".format(border_size)) GOPs = int(args.GOPs) log.info("GOPs={}".format(GOPs)) min_block_size = int(args.min_block_size) log.info("min_block_size={}".format(min_block_size))
MCTF_TEXTURE_CODEC = os.environ["MCTF_TEXTURE_CODEC"] LOW = "L" HIGH = "H" # {{{ Arguments parsing parser = arguments_parser(description="Expands the texture.") parser.GOPs() parser.pixels_in_x() parser.pixels_in_y() parser.SRLs() parser.TRLs() args = parser.parse_known_args()[0] GOPs = int(args.GOPs) log.info("GOPs={}".format(GOPs)) pixels_in_x = str(args.pixels_in_x) log.info("pixels_in_x={}".format(pixels_in_x)) pixels_in_y = str(args.pixels_in_y) log.info("pixels_in_y={}".format(pixels_in_y)) SRLs = int(args.SRLs) log.info("SRLs={}".format(SRLs)) TRLs = int(args.TRLs) log.info("TRLs={}".format(TRLs)) # }}}
GOPs = int(args.GOPs) keep_layers = int(args.keep_layers) TRLs = int(args.TRLs) layers = int(args.layers) destination = args.destination slope = int(args.slope) FPS = float(args.FPS) x_dim = int(args.pixels_in_x) y_dim = int(args.pixels_in_y) block_size = int(args.block_size) min_block_size = int(args.min_block_size) search_range = int(args.search_range) video = args.video log.info("GOPs={}".format(GOPs)) log.info("keep_layers={}".format(keep_layers)) log.info("TRLs={}".format(TRLs)) log.info("layers={}".format(layers)) log.info("destination={}".format(destination)) log.info("slope={}".format(slope)) log.info("FPS={}".format(FPS)) log.info("pixels_in_x={}".format(x_dim)) log.info("pixels_in_y={}".format(y_dim)) log.info("block_size={}".format(block_size)) log.info("min_block_size={}".format(min_block_size)) log.info("search_range={}".format(search_range)) log.info("video={}".format(video)) # }}} destination_zero = "zero_texture"
parser.TRLs() parser.layers() parser.add_argument("--destination", help="destination directory (must exist)", default="/transcode_quality") parser.slope() args = parser.parse_known_args()[0] GOPs = int(args.GOPs) keep_layers = int(args.keep_layers) TRLs = int(args.TRLs) layers = int(args.layers) destination = args.destination slope = int(args.slope) log.info("GOPs={}".format(GOPs)) log.info("keep_layers={}".format(keep_layers)) log.info("TRLs={}".format(TRLs)) log.info("layers={}".format(layers)) log.info("destination={}".format(destination)) log.info("slope={}".format(slope)) # }}} def transcode_picture(filename, layers): # {{{ log.debug("transcode_picture: {} {}".format(filename, layers)) if layers > 0: shell.run("trace kdu_transcode" + " -i " + filename +
parser.add_argument("--subband", help="Subband prefix (for example, \"L_3\")", default="") parser.add_argument("--layers", help="Number of quality layers to output", default=8) parser.add_argument("--pictures", help="Number of pictures to transcode", default=1) args = parser.parse_known_args()[0] subband = args.subband layers = int(args.layers) pictures = int(args.pictures) log.info("subband={}".format(subband)) log.info("layers={}".format(layers)) log.info("pictures={}".format(pictures)) IMG_EXT = os.environ["MCTF_IMG_EXT"] # }}} def transcode_picture(filename, layers): # {{{ print(filename, layers) shell.run("trace kdu_transcode" + " -i " + filename + " -jpx_layers sYCC,0,1,2" + " -o " + "transcode_quality/" + filename + " Clayers=" + str(layers))
# {{{ Arguments parsing parser = arguments_parser(description="Decodes a subband of texture.") parser.add_argument("--file", help="File that contains the LFB or HFB data.", default="") parser.add_argument("--pictures", help="Number of pictures to expand.", default=1) parser.pixels_in_x() parser.pixels_in_y() args = parser.parse_known_args()[0] file = args.file log.info("file={}".format(file)) pictures = int(args.pictures) log.info("pictures={}".format(pictures)) pixels_in_x = int(args.pixels_in_x) log.info("pixels_in_x={}".format(pixels_in_x)) pixels_in_y = int(args.pixels_in_y) log.info("pixels_in_y={}".format(pixels_in_y)) # }}} IMG_EXT = os.environ["MCTF_IMG_EXT"] p = 0
shell.setLogger(log) # }}} # {{{ Arguments parsing parser = arguments_parser(description="Expands the motion data.") parser.GOPs() parser.TRLs() parser.block_size() parser.pixels_in_x() parser.pixels_in_y() args = parser.parse_known_args()[0] block_size = int(args.block_size) log.info("block_size={}".format(block_size)) GOPs = int(args.GOPs) log.info("GOPs={}".format(GOPs)) pixels_in_x = int(args.pixels_in_x) log.info("pixels_in_x={}".format(pixels_in_x)) pixels_in_y = int(args.pixels_in_y) log.info("pixels_in_y={}".format(pixels_in_y)) TRLs = int(args.TRLs) log.info("TRLs={}".format(TRLs)) # }}} #MOTION_DECODER_NAME = "gzip"