It is currently Tue Jul 23, 2019 2:23 am

All times are UTC - 7 hours



Forum rules





Post new topic Reply to topic  [ 199 posts ]  Go to page Previous  1 ... 10, 11, 12, 13, 14  Next
Author Message
PostPosted: Thu Oct 01, 2015 4:15 pm 
Offline
Formerly Espozo
User avatar

Joined: Mon Sep 15, 2014 4:35 pm
Posts: 3501
Location: Richmond, Virginia
You know, what's stopping you from using the full resolution then? It may look even odder around the edges, but I imagine it would still look pretty decent.

Also, I forgot, are there any tricks with the palettes being used?


Top
 Profile  
 
PostPosted: Thu Oct 01, 2015 4:59 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11376
Location: Rio de Janeiro - Brazil
Espozo wrote:
You know, what's stopping you from using the full resolution then? It may look even odder around the edges, but I imagine it would still look pretty decent.

I was wondering about that myself. The reason I didn't try it is because my script was very poorly coded, and it uses a lot of RAM. It will need 4 times more RAM if I try the full resolution video, and I don't have that much free memory. To try this I'd have to rewrite the script, which I'm not sure I want to.

Quote:
Also, I forgot, are there any tricks with the palettes being used?

Not at all. We could easily have 2 sets of 256 patterns though, and select the best one for each 16x16-pixel area, and display the selected set by using the appropriate palette in each area.

That concept could be expanded to 2 more sets in the other pattern table, and use raster effects to select which pattern table is best for each scanline. That would overcomplicate the encoder though, and add the need for raster effects.


Top
 Profile  
 
PostPosted: Thu Oct 01, 2015 5:20 pm 
Offline
Formerly Espozo
User avatar

Joined: Mon Sep 15, 2014 4:35 pm
Posts: 3501
Location: Richmond, Virginia
tokumaru wrote:
16x16-pixel area

Oh, yeah... I'm not exactly an expert when it comes to NES hardware. (I probably even have a better understanding of the Genesis.)


Top
 Profile  
 
PostPosted: Thu Oct 01, 2015 5:57 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11376
Location: Rio de Janeiro - Brazil
NEs tiles are 2bpp, but we only need 1bpp. This means you can store 2 1bpp patterns in each tile, and you can display one plane or the other by using special palettes:

This palette will show plane 0:

0 = black
1 = white
2 = black
3 = white

And this will show plane 1:

0 = black
1 = black
2 = white
3 = white

Mega Man 2 does this to animate the background in some stages, like Metal Man's.

The NES allows palettes to be applied to 16x16-pixel areas (unless you use the MMC5, of course) so that's the minimum area you can use to select one tile set (plane 0) or the other (plane 1).

BTW, I just figured out the logic to encode a full resolution version like this, so maybe I'll give it a try.


Top
 Profile  
 
PostPosted: Thu Oct 01, 2015 10:39 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11376
Location: Rio de Janeiro - Brazil
Well, I finished rewriting the script to handle 256x176-pixel images. Unfortunately, the results aren't so hot this time. Here are the first 2000 frames (I didn't do the whole thing because the new script is crazy slow):

Attachment:
apple-nes-256x176.gif
apple-nes-256x176.gif [ 1.38 MiB | Viewed 6991 times ]


I'm using 2 sets of 256 patterns that can be selected for each 16x16 pixel area: the first set contains the most frequent 256 patterns, and the second contains the 64 most frequent patterns (repeated from the other set) followed by the 192 patterns that come after the first 256. I decided to repeat a certain amount of popular patterns hoping to increase the chances of the second set being selected (and it does get used, like, 1/4 of the time).

I honestly don't think this is an improvement over the 128x88-pixel version. What good is it to have more resolution if the fine details are all mangled? And this is just the first 2000 frames... I imagine it could get a little worse if all frames were processed, since that would mean more images being represented by the same amount of blocks. Things didn't change much when I went from 1000 frames to 2000 though, so who knows...

Still, this was an interesting exercise, and I think it's fun to see the program trying to recreate the original images from such a limited amount of blocks.

OK, now I'm done with this Bad Apple business. No more distractions for me! :roll:


Top
 Profile  
 
PostPosted: Fri Oct 02, 2015 4:18 am 
Offline

Joined: Mon Jul 01, 2013 11:25 am
Posts: 249
Indeed this time it looks a bit too blocky and i also prefer the lower resolution. There is a 4 MB version on Megadrive which use a lossy compression and look a bit blocky as well (not that much but still too much imo). I would really like to fit the MD version in 4MB instead of 8MB (and so having it working on almost all flash carts) but i don't know if that is possible.


Top
 Profile  
 
PostPosted: Fri Oct 02, 2015 8:23 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11376
Location: Rio de Janeiro - Brazil
I realized that since there are still 2 free palettes, that these could be used to display more variations of the patterns that are already loaded. Unfortunately, it's not possible to simply swap black and white, since color 0 must always be black... but there are still a total of 8 possible palette configurations:

black, black, black, black (useless)
black, white, black, black (plane 0 - plane 1)
black, black, white, black (plane 1 - plane 0)
black, white, white, black (plane 0 XOR plane 1)
black, black, black, white (intersection between plane 0 and plane 1)
black, white, black, white (plane 0 only, already in use)
black, black, white, white (plane 1 only, already in use)
black, white, white, white (plane 0 OR plane 1)

Maybe two of these operations will result in patterns that are similar to the ones that are actually used in the video, and each 16x16-pixel area will have more options of patterns to choose from. For this to be really useful though, a more complicated analysis of the patterns should be made so that they are arranged in the optimal order in each plane to generate the most useful combinations, but that's way too hardcore for me. It would even make much more sense to have the repeated patterns in different positions, so they don't generate useless combinations. Right now I just have them arranged by frequency (most common patterns come first).


Top
 Profile  
 
PostPosted: Sat Oct 03, 2015 10:17 am 
Offline
User avatar

Joined: Sat Jul 12, 2014 3:04 pm
Posts: 965
Did you consider the effect of allowing minor scrolling? It'd let you move the attribute and pattern grids. Of course, that would mean 256x the checking per-frame to encode...though you wouldn't need to do that for pure-black or pure-white areas, just those near edges. If you don't want to check extra pattern options, you could just see if one of the other attribute alignments (+8,0), (0,+8), (+8,+8) would give you better options overall...or in any given frame.

Might let you get a better fit into 256-tiles-alloted.

[And separately, 8x8-tile attributes are relatively cheap, mapper-wise...if you don't mind going beyond traditional.]


Top
 Profile  
 
PostPosted: Sat Oct 03, 2015 12:13 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11376
Location: Rio de Janeiro - Brazil
Interesting ideas. Testing all of these rotations would indeed be slow as hell with the script I have now (except for the different 8x8 alignments).

I'm definitely not trying any of this now though... Like I said, I can't afford any more distractions.


Top
 Profile  
 
PostPosted: Sat Oct 03, 2015 2:10 pm 
Offline
User avatar

Joined: Sat Jul 12, 2014 3:04 pm
Posts: 965
Checking for just-pans (or near-pans) that would convert better to scrolling, like the sword, or Marisa bobbing in flight [scroll-split?], might also get you some pattern space- but one can pretty easily guide where a program should check for that.

Had you considered using the "just plane 1"/"just plane 2" trick (or an upgraded method for SNES, having more bitdepth) to get multiple frames for one update in your tight spots(Flandre), where you'd just have to switch the palette entry?


Top
 Profile  
 
PostPosted: Sat Oct 03, 2015 2:23 pm 
Offline
Formerly Espozo
User avatar

Joined: Mon Sep 15, 2014 4:35 pm
Posts: 3501
Location: Richmond, Virginia
Wait a minute, if we're doing split screen scrolling and stuff, why not just make the tilemap 256 x 512 and have it to where you're essentially using 8x4 tiles? Even lines would use the top half of the tiles, and odd lines would use the bottom half.


Top
 Profile  
 
PostPosted: Sun Oct 04, 2015 9:40 am 
Offline
User avatar

Joined: Sun May 27, 2012 8:43 pm
Posts: 1348
Espozo wrote:
Wait a minute, if we're doing split screen scrolling and stuff, why not just make the tilemap 256 x 512 and have it to where you're essentially using 8x4 tiles? Even lines would use the top half of the tiles, and odd lines would use the bottom half.


Moving the tilemap up 4 pixels on every 4th scanline would be an interesting solution.


Top
 Profile  
 
PostPosted: Mon Oct 05, 2015 8:49 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11376
Location: Rio de Janeiro - Brazil
Just thought of another improvement to the NES version: before encoding, separate the frames into 2 groups, based on similarity. Then, encode each group separately, resulting in 2 pattern tables worth of monochrome patterns, so each frame gets to choose the pattern table that will best represent it. That will double the amount of patterns for the entire video, although I'm sure there will be quite a few duplicates.


Top
 Profile  
 
PostPosted: Fri May 24, 2019 2:54 pm 
Offline

Joined: Thu Apr 18, 2019 9:13 am
Posts: 151
tepples wrote:
This gives 262-176=86 lines of blanking, and at 14 bytes per line with a straightforward unrolled copy, you can fill 86*14 = 1204 bytes, which is just shy of the 32*44 = 1408 bytes of nametable data for 128x88. But decompression of that much data on a 1.8 MHz 6502 at 30 fps might be a pain.


How about using 8K WRAM to hold 1410 instruction pairs of the form "LDA #xx / STA $20xx", storing five groups of 51 bytes of data for the LDA in each page of ROM, interleaved (so an unrolled sequence of 51 consecutive "ldy #0 [or 5, 10, 15...] / lda (src),y / sta (dest),y" will copy 51 bytes), and then use a separately-stored sequence of bytes to indicate which sta instructions need to store to $2006 instead of $2007. For the scenario where all 1410 stores are needed, the time during vblank would be 8260 cycles and the time to prepare all the stores would be 18330 cycles. In the cases where stores are going to be patched to hit $2006 instead of $2007, some time would be required to do that patching before running the code in WRAM and then undo it afterward, but since fewer loads would need to be prepped, the time spent patching would still be a net "win".

If replacing every sequence of three or more bytes that match a previous frame with the two byte address of the next sequence of bytes requiring updates would be adequate to meet compression requirements, I don't think there would be any problem running the uncompressor in real time if audio doesn't gobble too much CPU.


Top
 Profile  
 
PostPosted: Sat May 25, 2019 6:00 am 
Offline

Joined: Thu Apr 18, 2019 9:13 am
Posts: 151
tokumaru wrote:
Well, I couldn't resist and I reduced the pattern count down to 256. Each pattern past 256 got mapped to one of the 256 most frequent ones (the one with least different pixels). I must say that the result is surprisingly good:


Have you tried porting that to the NES? I'd say it looks pretty good.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 199 posts ]  Go to page Previous  1 ... 10, 11, 12, 13, 14  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group