def test_lossless(cl): input = NamedVideoStream(cl, 'test1') frame = cl.io.Input([input]) range_frame = cl.streams.Range(frame, ranges=[{'start': 0, 'end': 30}]) blurred_frame = cl.ops.Blur(frame=range_frame, kernel_size=3, sigma=0.1) output = NamedVideoStream(cl, 'test_blur') output_op = cl.io.Output(blurred_frame.lossless(), [output]) cl.run(output_op, PerfParams.estimate(), cache_mode=CacheMode.Overwrite, show_progress=False) next(output.load())
def run_sampler_job(sampler, sampler_args, expected_rows): frame = cl.io.Input([NamedVideoStream(cl, 'test1')]) sample_frame = sampler(input=frame, **sampler_args) output = NamedVideoStream(cl, 'test_sample') output_op = cl.io.Output(sample_frame, [output]) cl.run(output_op, PerfParams.estimate(), cache_mode=CacheMode.Overwrite, show_progress=False) num_rows = len(list(output.load())) assert num_rows == expected_rows
def test_stream_args(cl): frame = cl.io.Input([NamedVideoStream(cl, 'test1')]) resized_frame = cl.ops.Resize(frame=frame, width=[640], height=[480]) range_frame = cl.streams.Range(resized_frame, [(0, 10)]) output_stream = NamedVideoStream(cl, 'test_stream_args') output_op = cl.io.Output(range_frame, [output_stream]) cl.run(output_op, PerfParams.estimate(), cache_mode=CacheMode.Overwrite, show_progress=False) list(output_stream.load())
def test_py_variadic(cl): input = NamedVideoStream(cl, 'test1') frame = cl.io.Input([input]) range_frame = cl.streams.Range(frame, ranges=[{'start': 0, 'end': 30}]) out_frame = cl.ops.TestPyVariadic(range_frame, range_frame, range_frame) output = NamedVideoStream(cl, 'test_variadic') output_op = cl.io.Output(out_frame.lossless(), [output]) cl.run(output_op, PerfParams.estimate(), cache_mode=CacheMode.Overwrite, show_progress=False) next(output.load())