gcvideo - Open source GameCube component cable solution

Discussion in 'Modding and Hacking - Consoles and Electronics' started by darcagn, Aug 31, 2014.

  1. OzOnE

    OzOnE Site Supporter 2013

    Joined:
    Nov 10, 2011
    Messages:
    538
    Likes Received:
    173
    oic, cool. Thanks for the info. ;)

    I must give it a try again later on a PAL cube. I have one or two of them already in bits (don't we all? lol)

    Yep, I guess a proper DAC is the way to go for analog. It's all about quality really.

    I'm doing a design for a Game Gear RGB / Composite DAC as well (partly based off Tim Worthington's work).
    The composite output is generated on the CPLD as well, which will make it easy to do LCD retrofits.
    Obviously with the GG only having 12-bit video, I'll be using resistor DACs for that.

    I'm basically allowing the black borders through from the GC, but the HDMI chip is still configured for 720x480 (or 720x576 etc.)

    There is a fair gap either side of the image before the sync pulses, so it seems to fit fine without any scaling, and the aspect ratio looks good too...

    [​IMG]

    I'm not actually using HDMI_DE on the Tx chip side, I'm just setting DE Generation via I2C based on each video mode (480i, 480p, 576i).
    So, the TV / monitor simply "sees" a 720-pixel wide image, and all is good. The HDMI Tx also has the 4:3 flag enabled, so the capture card isn't squishing the image.

    Only problem is that my Samsung 46" LCD doesn't support interlaced via HDMI (unless it's 1080i), so I have to blindly switch to prog scan on the Cube.
    I have a few options for scan doubling, but no SDRAM / DDR on this current board for doing more advanced scaling.

    That's another advantage for Component really, since most TVs will work fine with interlaced via Component.

    I really need to get this PCB design finalized soon, as I'm looking to send off for a big batch of PCBs for various projects.
    This will be my largest bulk order of PCB designs to date (one or two big panels), and one of the projects will be of huge interest to N64 fans. ;)

    OzOnE.

    btw, with the basic chroma LERP stuff, the difference in quality is quite small..

    This is with LERP OFF...

    [​IMG]


    And this is with it ON...

    [​IMG]

    Obviously it doesn't help at all that the AverMedia software only seems to do frame grabs in JPEG, but you can just about notice the difference between the two modes.

    With the LERP enabled, you can see that the chroma seems to get slightly shifted to the left on Mario's hat, so doesn't bleed into the black outline on the right as much.
    (the colour bleed on the right edge of the platform / fence is due to the crappy JPEG compression, so please ignore that.)

    It could just be that the Cr sample needs to be delayed by an extra clock cycle in non-LERP mode maybe?
    Either way, the difference seems negligible, but is worth keeping as an option since it uses very little logic to implement.

    As you know, the other small issue with a basic LERP is that it can produce slightly softer vertical edges where the main image meets the black bars (due to the large step in chroma values).
    Although, I haven't yet added the delays for the sync / blanking in LERP mode yet, as you can see from the previous SigTap screenshot. :p

    Another way to interpolate the chroma samples is with FIR filtering, but that could take a fair amount of logic and push the cost of the FPGA / CPLD / board up.

    What I can say is that even without extra processing, the 480p image looks fantastic in person via the HDMI capture card. :)

    OzOnE
     
    Last edited by a moderator: Nov 2, 2016
  2. Unseen

    Unseen Spirited Member

    Joined:
    Sep 1, 2014
    Messages:
    126
    Likes Received:
    17
    Ah, I see. I overdid it a bit in my design, the FPGA actively measures the start and end of the horizontal and vertical blanking and then calculates border sizes that center the active GC image within the standard resolution. It's slightly messy and the size of that module on the FPGA is a bit large, so my plan is to run a few cube games to check if I can just use fixed per-resolution values and hardcode that - this will probably be very similar to the scheme you currently use.

    Do you enable pixel-doubling on your HDMI transmitter in 480i mode? Without it, the HDMI clock is below the specified minimum of 25MHz. Some displays accept such signals, others do not.

    I see that the ADV7513 has an auto mode for pixel repetition, but the programming guide seems to suggest that the selection only checks that the audio signal can fit into the data stream, so if you use that it may be possible that the chip tries to send a 13.5MHz pixel clock. If you have a scope available, checking that directly on the HDMI connector should be easy enough.

    I have a simple line-doubler module for converting 240p/288p to 480p/576p in my design that didn't make it into the released analog version(*) because it would've required an FPGA with more BRAM. It's not that hard to implement, just two dual-ported RAMs of sufficient size to store an entire line, filled in one process from the incoming data and read two times at twice the speed in a second process. My very simple scheme doesn't result in a usable 480p signal from a 480i input though, I guess I just need to sit down with pen and paper and work out the timing for that by hand.

    (*) 240p via component is claimed to be incompatible with some TVs and it's used by Nintendos NES emulator on the GC

    Oh, finally an addon for playing Genesis games on the N64? ;)
     
  3. OzOnE

    OzOnE Site Supporter 2013

    Joined:
    Nov 10, 2011
    Messages:
    538
    Likes Received:
    173
    Yep, it has auto pixel-doubling enabled, and I've tried manually enabling it and tried different pix clock multiples just to make sure, but it's definitely the TV.
    My older Philips 42" plasma accepts 480i via HDMI just fine, so it's just the newer TVs being a bit cheap, and making 480i / 576i via digital obsolete it seems.

    The pixel doubling is working OK, but I just need to changed the DE Generation parameters for each mode, since it doesn't like the timings if I simply use the blanking_n signal for Data Enable.
    I just use the "inter_n" and "pal_n" flag bits to create a vid_mode value. (The flags should be valid in either interlaced or prog scan anyway, since it always grabs the Y value first when VPHASE changes.)

    0 = 480i
    1 = 480p
    2 = 576i
    3 = 576p

    I think 576p is technically possible. I'm currently hunting for a blank DVD-R as well, so I can test this out...

    http://junkerhq.net/xrgb/index.php/240p_test_suite

    I'm thinking that the Cr samples just need a teensy bit more delay with LERP disabled, and it will then look almost indistinguishable from 480P + LERP.

    Yep, the timings are a bit hard on the brain at times.
    The dual-port RAM method is used quite often by things like the Minimig and fpga64 scandoublers, so not too hard to do.
    As you say, the simpler way does result in loosing half the 480i / 576i resolution tough.


    I can't say too much about the N64 thing, but let's just say that any RGB / Component / HDMI add-on will be pretty much moot if it works out.
    It's not just a video board for the N64 either. It's far more than that. ;)

    OzOnE.
    P.S. (think iQue ლ(ಠ益ಠლ) ;)
     
  4. Unseen

    Unseen Spirited Member

    Joined:
    Sep 1, 2014
    Messages:
    126
    Likes Received:
    17
    Too bad, I was hoping that there wouldn't be any TVs that leave out 480i support. My new(ish) Samsung TC27C370 has no problems with a 480i signal from my Cube, but Samsung advertises it as a PC monitor with TV capabilities, so maybe they made sure to make the firmware more tolerant for rarely-used/non-standard input formats.

    It is, Swiss can use it for its menus and force games to run in it.

    I'm surprised you haven't used the test suite - it's really useful, although it doesn't support 576p. Some of its test patterns like the color bars and the color bleed check are a good way to reveal problems with color sample alignment.

    How do you implement the color interpolation? My current interpretation of the Cube's signal is that both color samples are aligned with the first luma sample in a two-pixel pair, so to reconstruct the colors for the second luma sample a simple average of the color values to the left and right are sufficient and that shouldn't result in a color shift.
     
  5. OzOnE

    OzOnE Site Supporter 2013

    Joined:
    Nov 10, 2011
    Messages:
    538
    Likes Received:
    173
    I did try the test suite when I first got a Xeno GC chip, but I lost the disk ages ago, and now I'm all out of blank DVD-Rs. lol

    I'm doing the interpolation pretty much as in your code (I had a quick peek on Github).
    You can really cut down on the amount of code though, by doing the assign directly (I do like Verilog :) )...

    // Lerp for cb...
    wire [8:0] cb_res = {1'b0, prev_cb} + {1'b0, current_cb};
    wire [7:0] cb_lerp = cb_res[8:1];


    // Lerp for cr...
    wire [8:0] cr_res = {1'b0, prev_cr} + {1'b0, current_cr};
    wire [7:0] cr_lerp = cr_res[8:1];

    I also implemented prog scan detection almost the same as you did - I used a counter to see how many clock ticks between VPHASE changes.
    I'm wondering if this gives a different result to simply using the "gc_inter_n" flag though?

    I'm guessing the 240p / 288p modes still bring gc_inter_n High, even though they aren't strictly 30KHz modes?

    Looks like most of the other flags from the GC can be trusted though, even when it switches between interlaced and prog, because of the way it always grabs the flags after VPHASE toggles?

    Anywho, I've actually removed the LERP stuff now, as it made very little difference that I could see.
    I even compared the two images by doing a difference layer in Paint Shop Pro, and not much changed.

    Yes, the LERP definitely did interp the adjacent pixels, but I'm not sure it made a noticeable improvement to warrant keeping it.

    But, I still had a slight colour shift (to the right) on the Cr chroma, so had to delay Cb and Y by one clock (not delay Cr, as I previously stated).

    It looks much better now, and on rapidly changing backgrounds, the LERP tended to blur things very slightly anyway (only a tiny bit, but still).
    I do like the fact that LERP magically (almost) generates the missing samples though, and is nice to see the Y / Cb / Cr data all aligned. :p

    Seems strange why a modern-ish console wouldn't output full 444 video?
    Even if the textures and polys start life as 422, you'd think it would look marginally better on the output?
    Then again, it's all a question of bandwidth, and even 27MHz / 54MHz is pushing things a bit.

    The test suite will definitely come in handy though - I can then see exactly what the pixel delays are.
    It's quite possible the capture card has it's on delays too, since I believe it samples in YUV by default.
    EDIT: Actually, scrap that last bit. The YUV colourspace isn't quite the same as the sampling system of course. ;)

    I'm probably being a bit too OCD with this tbh. hehe
    It looks fantastic already (as you've seen yourself), so these are just final tweaks really.

    I do need to try getting the simple scandoubler working though, just so it will display an image on any modern TV.

    OzOnE.
     
    Last edited: Mar 6, 2015
  6. Unseen

    Unseen Spirited Member

    Joined:
    Sep 1, 2014
    Messages:
    126
    Likes Received:
    17
    Your way is basically the same, the stricter typing in VHDL adds some verbosity in my version but it should synth down to the same hardware. I still wonder if I should add 1 to the sum though to use rounding instead of truncation though.

    Even though it's more verbose I prever VHDL though - just the fact that I can define records to combine multiple signals makes life so much easier when you're dealing with a CPU bus that has half a dozen signals going in each direction, with multiple peripherals and a bus mux that connects everything together.

    Indeed, the 240p/288p modes signal "Noninterlaced" on this bit which I would argue is the correct thing to do. It certainly simplifies things if you have a linedoubler that should only activate in these two modes.

    Yes, I haven't seen any problems with that yet. If you don't need the 15/30kHz detection you could even drop the counter entirely, read the incoming data on each falling 54MHz clock edge and just use the first and last data byte in a CSel phase. For the 15kHz modes that would read both the luma and chroma value twice, but implicitly drop the two reads in the middle of the CSel phase, so the outputs still receive exactly the data that is needed.

    Compared to the color space conversion I have in my code it's trivially small though, so I just left it in. It should at least be good as a marketing feature for the people who look for the ultimate video quality. ;)

    It saves 33% RAM in the final frame buffer. Also, 4:2:2 YCbCr is commonly used in professional video standards and as someone already mentioned in this thread, the format of the Cube is quite similar to an existing professional video signal standard, which may have been an influence on the design team.

    I thought it was interesting how much detail is actually in the Logo on the Twilight Princess title screen that is completely lost via composite.
     
  7. OzOnE

    OzOnE Site Supporter 2013

    Joined:
    Nov 10, 2011
    Messages:
    538
    Likes Received:
    173
    All good points. :)

    I guess it doesn't add much to leave the LERP in there as an option, and very few registers / nets to implement it.
    The prototype HDMI board has a Cyclone III EP3C10 on there atm. It's overkill for most stuff of course, but great for debugging using SignalTap etc.

    I don't think I'll be going for a full OSD, as it's way too much hassle.
    I'll probably just put some micro DIP switches on the final board for LERP and scandoubler enable.

    I did wonder about the rounding stuff too, and then there's the FIR method, which looks quite overcomplex for what I imagine would be a small benefit...

    http://pastebin.com/QzbhrnGJ

    A good idea to keep the counter then it seems. It will make it much easier to detect the specific output mode. ;)

    Yep, 4:2:2 is used in a ton of stuff, and I'm finding out just how rubbish our eyes are at colour resolution. lol
    I know MPEG-2 used on DVD commonly only used 4:2:0 video as well. Just a shame they screwed up the interlaced chroma decimation on so many players.

    I really have to make a push for finishing the PCB design for the HDMI board now.
    I've been trying to learn Altium Designer, but it's tough going after using Eagle for about ten years.

    What is your preferred PCB house atm?
    I've used Gold Phoenix in China for the last few projects. They are very efficient, but even their full panel prices are getting a bit high.

    I think it will be fine to just break out the 24-bit vid bus to the HDMI Tx though.
    That will let me use a analog DAC as an add-on option.

    The PCB is small enough to even leave the HDMI stuff un-populated for consoles that don't really warrant it (rather than making yet another board).

    Might have to try the N64 next. :)
    This is a test I did last year by hooking up the HDMI directly to the LVDS pins of a cheap Cyc II EP2C8 board (including my trademarked "dodgy shaky-cam" method)...

    https://www.youtube.com/watch?v=NCbkDgCIKRQ

    Even though most N64 games are only rendered at 320x240, it still made a worthwhile difference.
    Might not be long until they completely scrap all analog inputs on modern TVs too.

    OzOnE.
     
  8. Unseen

    Unseen Spirited Member

    Joined:
    Sep 1, 2014
    Messages:
    126
    Likes Received:
    17
    Oh wow, a mere 12 multipliers to implement a probably very minor improvement. I don't think I'll go for that. =)

    I tend to get my prototypes from OSHPark because the boards I design are usually very small. The one time I had a large(ish) PCB (arm2iec, about 10x10cm) that I also needed in larger quantities, I ordered them from iteadstudio.

    Nice! I though the N64 used a very non-standard pixel clock, but it looks like it's not that far off at all if you can easily turn it into 720x480 HDMI.
     
  9. SnoopKatt

    SnoopKatt Rapidly Rising Member

    Joined:
    Jul 27, 2012
    Messages:
    76
    Likes Received:
    1
    If you guys are still looking for interest in the project, I definitely am interested in an HDMI and/or component solution.
     
  10. dieWiiLinse

    dieWiiLinse Newly Registered

    Joined:
    Nov 13, 2014
    Messages:
    2
    Likes Received:
    0
    Hello,
    I recently bought a Gamecube Component Cable.

    I read in the "List of Nintendo GameCube games with 480p and 16:9 support" Wikipedia article that some PAL Games will support 480p resolution if a NTSC signal is detected. F-Zero GX was one of these, so I bought a Freeloader, sticked my Component Cable into my (PAL) Cube's DIGITAL AV OUT Port, sticked the Audio signal from the Composite Cable into the ANALOG AV OUT, put in my Freeloader Disc (V1.06b) and pressed the power button. After the Freeloader screen had appeared I switched the disc (F-Zero GX -PAL) and it was starting to boot in "Region-Auto-Select" mode when a green frozen screen appeared. I rebooted the console manually (turning the power off and on) and went through the same procedure but this time with different "Freeloader Boot Settings". I hold down the Z button, selected a NTSC Region (USA) and it booted up.......in 480i. I was also pushing down the B button (although I asked myself if the message box asking you whether you want to play in Progressive Mode or not would even appear in a PAL Game) and waiting for the title screen of the Game (where it says "Press Start") but nothing changed. It was still 480i. I rebooted the console and hold down the Z button in the Freeloader Menu and chose JAPAN for the Region. It did the same. Booting up in 480i.
    I was a bit confused.

    Because I tried the same thing on my softmodded Wii console before . With component cables, a backup of my F-Zero GX game (PAL) and the homebrew app "GC Backup Launcher" (V0.2) by pressing the Y button in the app's menu for NTSC mode. The first time it booted up in 480i mode. I gave it another try by pressing the B button down this time - the same. I tried it again pressing down the B button right away after pressing the Y button for NTSC and suddenly it booted up in 480p. And since then it's always booting up in 480p (doesn't matter if I am pressing B or not, I don't know, maybe it was just a sofware failure the first times).

    Back to the Cube:
    I tried the same again, choosing the "Region-Auto-Select" mode and this time it booted up correctly without any frozen screen in 480i. Thats also curious...PAL Game..."Region Auto-Detect"...480i (well I think the "Codejunkie Guys" just want to deliver us the best gaming experience:))?? But it was only 480i again . So I bought a Gameboy Player with a NTSC Boot Disc and tried to boot it in "Region Auto-Select" mode (of course). The first thing that appeared was the box asking for Progressive Scan. I selected "Yes" and the resolution changed to 480p successfully.
    Then I rebooted the Cube trying again with F-Zero GX through Freeloader in "Region Auto-Select" mode. It booted up in $(=P.:).

    AFTER A YELL OF HAPPINESS I tried it again and again, it always booted up in 480p. Even after I boot up F-Zero GX without Freeloader in 576i/480i, every time I use the Freeloader it's 480p.

    It's interesting, isn't it?
     
  11. bobrocks95

    bobrocks95 Member

    Joined:
    Mar 9, 2014
    Messages:
    16
    Likes Received:
    0
    It's nice to hear that you got 480p working on your PAL cube, but it adds absolutely nothing to the actual topic of this thread.
     
  12. OzOnE

    OzOnE Site Supporter 2013

    Joined:
    Nov 10, 2011
    Messages:
    538
    Likes Received:
    173
    Actually, it was quite an interesting read, and the info is kind of relevant as it helps define which combinations work on which GCs / mod chips etc.

    I wasn't sure at first if the PAL cube could do 480p because I recall Megalomaniac on gc-forever saying that the PAL cubes were missing a clock signal or io pin on the Dig port?

    Give the guy a break, it's his first post. lol

    OzOnE.
     
  13. GillBert

    GillBert Spirited Member

    Joined:
    Jul 27, 2012
    Messages:
    101
    Likes Received:
    39
    I'm wondering if I'll be able to flash the FPGA using this DIY programmer. Could someone please confirm if it is possible? If not, is there another DIY alternative?

    Thanks in advance!
     
  14. Unseen

    Unseen Spirited Member

    Joined:
    Sep 1, 2014
    Messages:
    126
    Likes Received:
    17
    The DVI version is now in the repository. I still feel as if I forgot something important in the README there, but I'll just wait for the hate mail to see what it is. ;)
     
  15. LeHaM

    LeHaM Site Soldier

    Joined:
    May 5, 2013
    Messages:
    2,636
    Likes Received:
    295
    Any pictures or videos of this device in action?
     
  16. WolfOD64

    WolfOD64 Newly Registered

    Joined:
    Dec 5, 2014
    Messages:
    2
    Likes Received:
    0
    As an avid Cuber, I am astronomically intrigued with this project. Keep up the good work, and let the rest of us know when the mod is available for purchase! :)
     
  17. Unseen

    Unseen Spirited Member

    Joined:
    Sep 1, 2014
    Messages:
    126
    Likes Received:
    17
    The "software" is on Github and the hardware (for the DVI version) is just an existing, commercially-available, low-cost FPGA board. What are you waiting for?

    If you want the analog version that was initially discussed here instead: You can build it yourself or wait until someone decides to make it available for purchase - it won't be me though, local laws make distribution of electronic devices extremely expensive for individuals or small-sized companies and the people who would be willing to assemble an SMD kit would probably be able to source the components themselves.
     
    Last edited: Dec 5, 2014
  18. LeHaM

    LeHaM Site Soldier

    Joined:
    May 5, 2013
    Messages:
    2,636
    Likes Received:
    295
    got some links to the fpga ?
     
  19. Unseen

    Unseen Spirited Member

    Joined:
    Sep 1, 2014
    Messages:
    126
    Likes Received:
    17
    The board? Pluto IIx HDMI
     
  20. WolfOD64

    WolfOD64 Newly Registered

    Joined:
    Dec 5, 2014
    Messages:
    2
    Likes Received:
    0
    I'm waiting around for someone to make the analog version commercially available. I'm not capable of modding my console at all...I'm really not tech-savvy enough.

    That's why I'm waiting.
     

Share This Page