Commit Graph

24 Commits

Author SHA1 Message Date
kris
782156967b Add --video_mode HGR|DHGR option to support both video modes uniformly. 2019-04-25 17:38:04 +01:00
kris
a188216f90 Add a video Mode enum. 2019-04-25 16:28:25 +01:00
kris
de8747ff37 Emit the video header and add an assertion to help make sure we don't
break the stream framing.
2019-04-25 16:28:06 +01:00
kris
2a76e3d48f Add a HEADER opcode that emits the 7-byte video header, used to
select the playback mode (HGR/DHGR).
2019-04-25 16:26:38 +01:00
kris
33ac880d29 Improve comment about stream padding 2019-03-28 23:47:38 +00:00
kris
10fa4bc72d Proof of concept DHGR encoding/playback
- Every time we process an ACK opcode, toggle page 1/page 2 soft
  switches to steer subsequent writes between MAIN and AUX memory
- while I'm here, squeeze out some unnecessary operations from the
  buffer management

On the player side, this is implemented by maintaining two screen
memory maps, and alternating between opcode streams for each of them.
This is using entirely the wrong colour model for errors, but
surprisingly it already works pretty well in practise (and the frame
rate is acceptable on test videos)

DHGR/HGR could be made runtime selectable by adding a header byte that
determines whether to set the DHGR soft switches before initiating
the decode loop.

While I'm in here, fix op_terminate to clear keyboard strobe before
waiting.
2019-03-27 21:37:06 +00:00
kris
21a4ac0186 Fix video termination logic 2019-03-24 00:14:41 +00:00
kris
dd422d1156 Fix tests 2019-03-23 22:05:36 +00:00
kris
13fb9c3125 Clean up module and abort import if we are unable to find the address
of an opcode.
2019-03-23 22:01:49 +00:00
kris
531a6ae345 Allow player to exit cleanly
- can't emit Terminate opcode in the middle of the bytestream
- pad the TCP stream to next 2k boundary when emitting terminate opcode,
  since the player will block until receiving this much data.
2019-03-23 21:46:35 +00:00
kris
8174d853f9 Downsize image using LANCZOS resampler. 2019-03-22 00:06:29 +00:00
kris
f37d07914d Print input frame rate, and default to every_n_video_frames=2 which
gives better quality without compromising frame rate too much.
2019-03-21 23:25:51 +00:00
kris
eebbccf711 Add some docstrings
Clean up naming in edit_distance

In video encoder, when we emit additional offsets as part of an opcode,
reinsert back into the priority heapq if the new edit distance is
nonzero, in case we get the chance to fix it up later in the frame.

Also make sure to zero out the diff_weights and content_deltas
so we don't consider the offset again as a side-effect of some other
opcode.

Instead of prioritizing side-effect offsets by their previous update
priority, prioritize by those with the lowest (error - edit) delta i.e.
not introducing too much error relative to their edit distance.
2019-03-21 22:56:45 +00:00
kris
fe10f98128 Support skipping frames from the input video to increase output
image quality at the expense of frame rate.
2019-03-21 22:43:02 +00:00
kris
8bdad22162 Stop ticking cycles as part of emitting the opcodes, we are counting
them externally in audio.py now.

Add some docstrings
2019-03-21 22:42:09 +00:00
kris
ce078f493f Start to flesh out function docstrings, add some more type annotations. 2019-03-21 22:41:05 +00:00
kris
da2e2476e7 Rename tests and clean up a bit. Still don't pass. 2019-03-21 17:21:43 +00:00
kris
5a5c761183 Remove _END from opcode.
Don't set cls in outer module scope
2019-03-21 17:15:44 +00:00
kris
84e14efc57 Fix 2019-03-21 16:51:33 +00:00
kris
5411793ea4 factor out State and CycleCounter to a new machine module and rename 2019-03-21 16:48:02 +00:00
kris
cf493e782c Add module docstrings 2019-03-21 16:42:47 +00:00
kris
5d4148daaf No need to store opcode _END any more 2019-03-21 16:35:42 +00:00
kris
fb47e48e4a Fix imports and point to player debug symbols 2019-03-21 16:24:40 +00:00
kris
bbfcacd674 Move transcoder to new location 2019-03-21 16:10:16 +00:00