kopia lustrzana https://github.com/dnet/pySSTV
use yield from instead of explicit version
rodzic
30294ee096
commit
2f7a11abc1
|
@ -16,14 +16,12 @@ class ColorSSTV(GrayscaleSSTV):
|
|||
msec_pixel = self.SCAN / self.WIDTH
|
||||
image = self.pixels
|
||||
for index in self.COLOR_SEQ:
|
||||
for item in self.before_channel(index):
|
||||
yield item
|
||||
yield from self.before_channel(index)
|
||||
for col in range(self.WIDTH):
|
||||
pixel = image[col, line]
|
||||
freq_pixel = byte_to_freq(pixel[index])
|
||||
yield freq_pixel, msec_pixel
|
||||
for item in self.after_channel(index):
|
||||
yield item
|
||||
yield from self.after_channel(index)
|
||||
|
||||
def before_channel(self, index):
|
||||
return []
|
||||
|
@ -65,8 +63,7 @@ class ScottieS1(MartinM1):
|
|||
|
||||
def before_channel(self, index):
|
||||
if index == RED:
|
||||
for item in MartinM1.horizontal_sync(self):
|
||||
yield item
|
||||
yield from MartinM1.horizontal_sync(self)
|
||||
yield FREQ_BLACK, self.INTER_CH_GAP
|
||||
|
||||
|
||||
|
@ -159,8 +156,7 @@ class PD90(ColorSSTV):
|
|||
def gen_image_tuples(self):
|
||||
yuv = self.image.convert('YCbCr').load()
|
||||
for line in range(0, self.HEIGHT, 2):
|
||||
for item in self.horizontal_sync():
|
||||
yield item
|
||||
yield from self.horizontal_sync()
|
||||
yield FREQ_BLACK, self.PORCH
|
||||
pixels0 = [yuv[col, line] 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):
|
||||
for line in range(self.HEIGHT):
|
||||
for item in self.horizontal_sync():
|
||||
yield item
|
||||
for item in self.encode_line(line):
|
||||
yield item
|
||||
yield from self.horizontal_sync()
|
||||
yield from self.encode_line(line)
|
||||
|
||||
def encode_line(self, line):
|
||||
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
|
||||
yield parity_freq, MSEC_VIS_BIT
|
||||
yield FREQ_SYNC, MSEC_VIS_BIT # stop bit
|
||||
for freq_tuple in self.gen_image_tuples():
|
||||
yield freq_tuple
|
||||
yield from self.gen_image_tuples()
|
||||
for fskid_byte in map(ord, self.fskid_payload):
|
||||
for _ in range(6):
|
||||
bit = fskid_byte & 1
|
||||
|
|
Ładowanie…
Reference in New Issue