mirror of
https://github.com/dnet/pySSTV.git
synced 2025-12-06 07:12:00 +01:00
use yield from instead of explicit version
This commit is contained in:
parent
30294ee096
commit
2f7a11abc1
|
|
@ -16,14 +16,12 @@ class ColorSSTV(GrayscaleSSTV):
|
||||||
msec_pixel = self.SCAN / self.WIDTH
|
msec_pixel = self.SCAN / self.WIDTH
|
||||||
image = self.pixels
|
image = self.pixels
|
||||||
for index in self.COLOR_SEQ:
|
for index in self.COLOR_SEQ:
|
||||||
for item in self.before_channel(index):
|
yield from self.before_channel(index)
|
||||||
yield item
|
|
||||||
for col in range(self.WIDTH):
|
for col in range(self.WIDTH):
|
||||||
pixel = image[col, line]
|
pixel = image[col, line]
|
||||||
freq_pixel = byte_to_freq(pixel[index])
|
freq_pixel = byte_to_freq(pixel[index])
|
||||||
yield freq_pixel, msec_pixel
|
yield freq_pixel, msec_pixel
|
||||||
for item in self.after_channel(index):
|
yield from self.after_channel(index)
|
||||||
yield item
|
|
||||||
|
|
||||||
def before_channel(self, index):
|
def before_channel(self, index):
|
||||||
return []
|
return []
|
||||||
|
|
@ -65,8 +63,7 @@ class ScottieS1(MartinM1):
|
||||||
|
|
||||||
def before_channel(self, index):
|
def before_channel(self, index):
|
||||||
if index == RED:
|
if index == RED:
|
||||||
for item in MartinM1.horizontal_sync(self):
|
yield from MartinM1.horizontal_sync(self)
|
||||||
yield item
|
|
||||||
yield FREQ_BLACK, self.INTER_CH_GAP
|
yield FREQ_BLACK, self.INTER_CH_GAP
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -159,8 +156,7 @@ class PD90(ColorSSTV):
|
||||||
def gen_image_tuples(self):
|
def gen_image_tuples(self):
|
||||||
yuv = self.image.convert('YCbCr').load()
|
yuv = self.image.convert('YCbCr').load()
|
||||||
for line in range(0, self.HEIGHT, 2):
|
for line in range(0, self.HEIGHT, 2):
|
||||||
for item in self.horizontal_sync():
|
yield from self.horizontal_sync()
|
||||||
yield item
|
|
||||||
yield FREQ_BLACK, self.PORCH
|
yield FREQ_BLACK, self.PORCH
|
||||||
pixels0 = [yuv[col, line] for col in range(self.WIDTH)]
|
pixels0 = [yuv[col, line] for col in range(self.WIDTH)]
|
||||||
pixels1 = [yuv[col, line + 1] for col in range(self.WIDTH)]
|
pixels1 = [yuv[col, line + 1] for col in range(self.WIDTH)]
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,8 @@ class GrayscaleSSTV(SSTV):
|
||||||
|
|
||||||
def gen_image_tuples(self):
|
def gen_image_tuples(self):
|
||||||
for line in range(self.HEIGHT):
|
for line in range(self.HEIGHT):
|
||||||
for item in self.horizontal_sync():
|
yield from self.horizontal_sync()
|
||||||
yield item
|
yield from self.encode_line(line)
|
||||||
for item in self.encode_line(line):
|
|
||||||
yield item
|
|
||||||
|
|
||||||
def encode_line(self, line):
|
def encode_line(self, line):
|
||||||
msec_pixel = self.SCAN / self.WIDTH
|
msec_pixel = self.SCAN / self.WIDTH
|
||||||
|
|
|
||||||
|
|
@ -113,8 +113,7 @@ class SSTV(object):
|
||||||
parity_freq = FREQ_VIS_BIT1 if num_ones % 2 == 1 else FREQ_VIS_BIT0
|
parity_freq = FREQ_VIS_BIT1 if num_ones % 2 == 1 else FREQ_VIS_BIT0
|
||||||
yield parity_freq, MSEC_VIS_BIT
|
yield parity_freq, MSEC_VIS_BIT
|
||||||
yield FREQ_SYNC, MSEC_VIS_BIT # stop bit
|
yield FREQ_SYNC, MSEC_VIS_BIT # stop bit
|
||||||
for freq_tuple in self.gen_image_tuples():
|
yield from self.gen_image_tuples()
|
||||||
yield freq_tuple
|
|
||||||
for fskid_byte in map(ord, self.fskid_payload):
|
for fskid_byte in map(ord, self.fskid_payload):
|
||||||
for _ in range(6):
|
for _ in range(6):
|
||||||
bit = fskid_byte & 1
|
bit = fskid_byte & 1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue