all repos — mgba @ d6f041d5e79659245731e51b30732421be116890

mGBA Game Boy Advance Emulator

CInema: Clean up size issues
Vicki Pfau vi@endrift.com
Wed, 24 Jun 2020 04:31:35 -0700
commit

d6f041d5e79659245731e51b30732421be116890

parent

4f671290989321fc98ec15e0ec307eaafc07d031

M src/platform/python/cinema/movie.pysrc/platform/python/cinema/movie.py

@@ -8,15 +8,17 @@

class Tracer(object): def __init__(self, core): self.core = core - self.framebuffer = Image(*core.desired_video_dimensions()) - self.core.set_video_buffer(self.framebuffer) self._video_fifo = [] def yield_frames(self, skip=0, limit=None): + self.framebuffer = Image(*self.core.desired_video_dimensions()) + self.core.set_video_buffer(self.framebuffer) self.core.reset() skip = (skip or 0) + 1 while skip > 0: frame = self.core.frame_counter + self.framebuffer = Image(*self.core.desired_video_dimensions()) + self.core.set_video_buffer(self.framebuffer) self.core.run_frame() skip -= 1 while frame <= self.core.frame_counter and limit != 0:
M src/platform/python/cinema/test.pysrc/platform/python/cinema/test.py

@@ -3,7 +3,6 @@ import os.path

import mgba.core import mgba.image import cinema.movie -import itertools import glob import re from copy import deepcopy

@@ -73,7 +72,7 @@ super(VideoTest, self).setup()

self.tracer = cinema.movie.Tracer(self.core) def generate_frames(self): - for i, frame in zip(itertools.count(), self.tracer.video(**self.output_settings())): + for i, frame in enumerate(self.tracer.video(**self.output_settings())): try: baseline = VideoFrame.load(os.path.join(self.path, self.BASELINE % i)) yield baseline, frame, VideoFrame.diff(baseline, frame)

@@ -85,7 +84,7 @@ self.baseline, self.frames, self.diffs = zip(*self.generate_frames())

assert not any(any(diffs[0].image.convert("L").point(bool).getdata()) for diffs in self.diffs) def generate_baseline(self): - for i, frame in zip(itertools.count(), self.tracer.video(**self.output_settings())): + for i, frame in enumerate(self.tracer.video(**self.output_settings())): frame.save(os.path.join(self.path, self.BASELINE % i))