English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 17 February 2014, 17:50   #1
obiwanken
Registered User
 
Join Date: Jan 2013
Location: Slovakia
Posts: 27
Interlace problem.

Hi, Im playnig with interlace screen.

My code Works perfect in WinUAE:

Click image for larger version

Name:	Interlace1.jpg
Views:	521
Size:	62.9 KB
ID:	39074

But on my real A1200,A600 looks like this:

Click image for larger version

Name:	Interlace2.jpg
Views:	575
Size:	63.5 KB
ID:	39075


Even/Odd lines switching is in VBI.

Code:

Click image for larger version

Name:	Code1.jpg
Views:	472
Size:	130.0 KB
ID:	39076

When I change code :

BNE SETBITPLANESODD
to
BEQ SETBITPLANESODD

then works perfect on real A1200,A600 ofcourse. But not in WinUAE.

Is this any Even/odd lines sync problem ?
Or problem is me ?
obiwanken is offline  
Old 17 February 2014, 18:07   #2
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,349
Does the WinUAE display look any different if you use the double, fields or double, fields+ interlaced line modes? (With the latter you'll want to have the WinUAE output vsynced to your monitor to avoid flashing/flickering.)
mark_k is online now  
Old 17 February 2014, 18:10   #3
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,554
I think you are modifying copper list while copper is reading it, if CPU is fast enough, plane pointers are updated before copper reads them (and moves to bitplane pointers), if CPU is slow enough, copper wins and effectively odd and even fields get swapped.

This is not that rare bug, many A500 demos have similar bug and only work because CPU is slow enough.
Toni Wilen is online now  
Old 17 February 2014, 18:31   #4
obiwanken
Registered User
 
Join Date: Jan 2013
Location: Slovakia
Posts: 27
to mark_k: I tried, but no effect. Thanks

to Toni:
Clever, when I use Cycle-exact option in Chipset menu , then WinUAE and real Amiga works with no difference.

Many thanks.
obiwanken is offline  
Old 18 February 2014, 00:04   #5
pandy71
Registered User
 
Join Date: Jun 2010
Location: PL?
Posts: 2,872
probably wrong field order - change order and it should work better, remember that NTSC and PAL have different field order (but windows is US so it can ignore PAL field order) not sure also on Amiga behavior - it is US machine it can force NTSC field order even for PAL (so incorrectly from PAL point of view)

http://documentation.apple.com/en/mo...4%26tasks=true

btw it is safer to set one large bitplane than two separate fields (ie process only each second VBLANK i.e. trig on pictures not on fields)
pandy71 is offline  
Old 18 February 2014, 07:59   #6
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,554
Easiest fix is to add copper WAIT before bitplane pointer moves which waits for line 10-20 or so, leaving more than enough time for CPU to update everything needed in copper list.

Amiga surely has exact same PAL and NTSC field order or all PAL games would have bad interlace on NTSC and vice versa.
Toni Wilen is online now  
Old 18 February 2014, 08:17   #7
mr.vince
Cheesy crust
 
mr.vince's Avatar
 
Join Date: Nov 2008
Location: Hawk's Creek
Age: 48
Posts: 1,383
Interlace problem.

Quote:
Originally Posted by pandy71 View Post
probably wrong field order - change order and it should work better, remember that NTSC and PAL have different field order (but windows is US so it can ignore PAL field order) not sure also on Amiga behavior - it is US machine it can force NTSC field order even for PAL (so incorrectly from PAL point of view)

This is absolutely wrong. Both standards start with the odd field.

Where is this supposed to come from?

EDIT: ok, will read Apple doc. But still wrong...
mr.vince is offline  
Old 18 February 2014, 15:45   #8
pandy71
Registered User
 
Join Date: Jun 2010
Location: PL?
Posts: 2,872
Quote:
Originally Posted by Toni Wilen View Post
Amiga surely has exact same PAL and NTSC field order or all PAL games would have bad interlace on NTSC and vice versa.
So Amiga probably will use NTSC field order... for progressive data field order is not important, it is only important for animations.

Quote:
Originally Posted by mr.vince View Post
This is absolutely wrong. Both standards start with the odd field.

Where is this supposed to come from?

EDIT: ok, will read Apple doc. But still wrong...

nothing is wrong, NTSC have inverted field dominance, in this case i think fields are swapped (incorrect field order is not a problem for progressive video, swapped fields give distortion for progressive video).
Wrong field dominance i see quite frequently in Europe nowadays as lot of people without knowledge use various video processing tools (like FinalCut), usually those tools working in native(default) NTSC field order, after processing such video is sent to encoder but most of the encoders is fixed on PAL dominance and distortions is badly visible as strobe motion - also video materials from USA need to be fixed.

https://support.apple.com/kb/TA26010?viewlocale=en_US
http://documentation.apple.com/en/fi...6%26tasks=true
http://www.mir.com/DMG/interl.html
http://lurkertech.com/lg/fields/

WinUAE AFAIK not support interlace in a native way and interlace is simulated on progressive screen (AFAIK Windows support display on interlace but not provide control over field order).


But once again - this kind of distortion for static picture means swapped fields, i've made simple Avisynth script with original and swap fields corrected (swap swapped) and seems that it works. issue can be or display or capture device - this why i recommend to test interlace always on CRT.

Bellow Avisynth script and picture:

Code:
StackHorizontal (ImageSource("Interlace2.jpg"), ImageSource("Interlace2.jpg").SwapFields())

Last edited by pandy71; 18 February 2014 at 16:16.
pandy71 is offline  
Old 18 February 2014, 17:29   #9
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,349
I don't think the original PAL or NTSC analogue video standards specify a field order; there's not really any concept of that in interlaced video as broadcast. Likewise there is no "field order" for Amiga output video. If you want to output an interlaced animation where the image is only updated every two fields (i.e. ~25/30 fps frame rate), you choose the field order yourself. That is, does each frame consist of an odd field then even field, or does it consist of an even field then odd field. Either way, that wouldn't be ideal since motion would be jittery. (For what it's worth, WinUAE's "double, frames" method works like that. Meaning, if you chose the "opposite" field order for your program to that used by the "double, frames" method, the WinUAE display will look pretty bad. The recently-introduced "double, fields" is better, matching what a real Amiga with de-interlacer shows.)

Where defining a field order (and/or field dominance) does become relevant is editing video, or converting from interlaced video which is actually a representation of a progressive source. For example, a PAL DVD sourced from film. Each original film frame would be stored as two successive fields. To reconstruct the original progressive frame you need to know whether a frame is odd then even fields, or even then odd fields.
mark_k is online now  
Old 18 February 2014, 20:36   #10
mc6809e
Registered User
 
Join Date: Jan 2012
Location: USA
Posts: 373
Setting LACE in BPLCON0 auto-toggles LOF in VPOSR, so there are two questions:

What is the initial state of LOF? Do you set/reset it by writing to VPOSW?

When you read LOF in your handler, does the read happen before or after the toggle of LOF -- i.e. is there a race condition? I'm not sure LOF is toggled immediately at the beginning of vblank. When does the toggle actually happen? If your int handler takes too long, you might read LOF after the toggle and get the LOF for the next frame. Or, you might read it quickly and get the LOF for the current frame. Which happens? Maybe you can find out by quickly polling both VHPOSR and VPOSR.

Last edited by mc6809e; 18 February 2014 at 20:42. Reason: clearify
mc6809e is offline  
Old 18 February 2014, 20:43   #11
pandy71
Registered User
 
Join Date: Jun 2010
Location: PL?
Posts: 2,872
Quote:
Originally Posted by mark_k View Post
Where defining a field order (and/or field dominance) does become relevant is editing video, or converting from interlaced video which is actually a representation of a progressive source. For example, a PAL DVD sourced from film. Each original film frame would be stored as two successive fields. To reconstruct the original progressive frame you need to know whether a frame is odd then even fields, or even then odd fields.
But Amiga can generate or progressive or interlace content and this is why field dominance is important - for example scrolling of text - can be performed or by progressive way (25/30fps) or interlace (50/60fps) way - all animation using interlace will be twice smoother- motion will be more smooth.

To display static picture, filed order can be ignored, for animated content there are two possibilities.
pandy71 is offline  
Old 18 February 2014, 21:29   #12
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,554
LOF toggles at the end of last line. (But I am 100% sure my explanation in 3rd post explains OPs problem 100% and LOF or whatever is not the problem at all)

Quote:
Originally Posted by pandy71 View Post
But Amiga can generate or progressive or interlace content and this is why field dominance is important - for example scrolling of text - can be performed or by progressive way (25/30fps) or interlace (50/60fps) way - all animation using interlace will be twice smoother- motion will be more smooth.

To display static picture, filed order can be ignored, for animated content there are two possibilities.
Sorry but I'll have to ask: What? Really? (When did progressive become 25/30? It has always been 50/60, 1 field is 1 frame. Also static interlace image with wrong field order will look horrible)
Toni Wilen is online now  
Old 19 February 2014, 09:55   #13
pandy71
Registered User
 
Join Date: Jun 2010
Location: PL?
Posts: 2,872
Quote:
Originally Posted by Toni Wilen View Post
Sorry but I'll have to ask: What? Really? (When did progressive become 25/30? It has always been 50/60, 1 field is 1 frame. Also static interlace image with wrong field order will look horrible)
You can have progressive video on interlaced display (situation where both fields have no temporal difference is progressive) - refresh rate is reduced by half.
In fact progressive (static video) with incorrect field dominance looks exactly the same as video with correct field dominance (field dominance == field order), swapped fields is horrible in both cases (i.e. for static and dynamic video). I can create 2 movies if You interested - one correct field order and second with incorrect field order (but no swapped fields) - they will look exactly the same on CRT, LCD or any other display, sometimes video equipment (mostly encoders) are equipped with feature to fix this problem (incorrect field dominance).

Btw
It is quite clear that TV video is designed to be interlace - i.e. two fields but with half vertical resolution (in fact less than half due Kell factor https://en.wikipedia.org/wiki/Kell_factor ), full vertical resolution (with respect to Kell factor) is achieved only with reduced refresh rate i.e. field rate /2 - this is why video can be interlace or progressive (temporal) on interlace display.

Last edited by pandy71; 19 February 2014 at 10:02.
pandy71 is offline  
Old 19 February 2014, 11:15   #14
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,554
But I still don't see what this has to do with Amiga and its analog progressive/interlace output. There is no field order to detect or anything like that. It just works

Display device just follows sync signals, field ordering is "automatic". (sync starts at mid scan line vs sync starts at the end of scanline)

Amiga creates the field order and it is fully programmable, it does not need to be (and rarely) is what PAL or NTSC spec says, for example both field order and plane order may suddenly change, result is still correct image but if you try to capture it, you probably get a glitch(es).

Yes, PAL/NTSC is designed to be interlaced, "progressive" is just a hack and not in spec. (for example most LCDs try to deinterlace it resulting in ugly half-vertical resolution 25hz with every other field dropped)
Toni Wilen is online now  
Old 19 February 2014, 13:46   #15
pandy71
Registered User
 
Join Date: Jun 2010
Location: PL?
Posts: 2,872
Of course you can distinguish between fields in display thus source need to provide correct information - serration/equalizing pulses combination is responsible for that - look at Agnus specification - how different are sync signals for "odd" and "even" fields" - based on this display (capture) device can distinguish between fields, field order is extremely important for interlace content - TFF (Top Field First) or BFF (Bottom Field First) - without this you will have very nasty stutter.

For Amiga it can be all fields are Odd OR all fields are Even (usual case for modes without ILACE bit active) but for ILACE active Odd/Even or Even/Odd sequence should be kept constantly especially when content displayed (produced) by Amiga is interlaced type (like smooth animations - like software to video titling supporting interlace fully in a smart way).

And most LCD's perform deinterlacing by BOB method (ie interpolate missing lines in field to form frame, usually kernel to shift lines vertically +-0.5 line is used - this is why progressive video modes from Amiga shaking vertically on many modern LCD's/PDP's)
pandy71 is offline  
Old 19 February 2014, 13:59   #16
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,554
I think we are talking from different view points. I only care what Amiga hardware does, it is not Amiga's or programmer's problem to care if display device (or whatever gets the input) understands it correctly. It just does it and if it does not, it is broken

You seem to look from input (display) device's point of view.

Also even emulation does not need to care about sync pulses because Agnus will latch LOF (unless I missed something when I tested it) state at the end of field and it will use this latched value to generate next field (including correct equalizer pulses etc..) , nothing happens even if you modify LOF immediately, at least not until following field starts.
Toni Wilen is online now  
Old 19 February 2014, 14:54   #17
pandy71
Registered User
 
Join Date: Jun 2010
Location: PL?
Posts: 2,872
Quote:
Originally Posted by Toni Wilen View Post
I think we are talking from different view points. I only care what Amiga hardware does, it is not Amiga's or programmer's problem to care if display device (or whatever gets the input) understands it correctly. It just does it and if it does not, it is broken

You seem to look from input (display) device's point of view.
Yes, i agree as WinUAE is emulator - You see data in memory, interpreting them based on state in few register and produce based on this bitmap exposed to Windows.
Minimig trying to recreate hardware based on WinUAE however need to follow different way.

Quote:
Originally Posted by Toni Wilen View Post
Also even emulation does not need to care about sync pulses because Agnus will latch LOF (unless I missed something when I tested it) state at the end of field and it will use this latched value to generate next field (including correct equalizer pulses etc..) , nothing happens even if you modify LOF immediately, at least not until following field starts.
As mentioned previously this is main difference between software emulator and real hardware implementation.
For sure real sync signals need to behave in correct way to provide correct video (especially that one of unique features in Amiga video hardware was full TV video standard compatibility - AFAIR Agnus/Denise was designed to fully follow RS170A USA video signal standard).
pandy71 is offline  
Old 19 February 2014, 18:18   #18
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,349
The most logical behaviour for a hardware/software Amiga emulator which needs to output a progressive video signal is (in my opinion) to work the same as an Amiga de-interlacer card (flickerFixer, A2320 etc.).

So for interlaced modes, in the case of an odd field, all odd lines of the output frame are the lines of that field. The even lines of the output frame are the lines from the previous (even) field. Similarly when the Amiga outputs an even field. WinUAE's "double, fields" method does that. If the field type is the same as the last one, assume output is non-interlaced and double the field lines in the output frame. [Some de-interlacers including the Microway flickerFixer didn't have logic to do that, so you get deinterlacing artifacts even when the Amiga output is non-interlaced.]

That avoids the extra-latency problem and artifacts of combining each pair of fields into two identical output frames. In certain cases, that combining can give "better-looking" results than a real Amiga. But in others it doesn't, and without a way to manually switch the fields→frame pairing (does one output frame = odd field + even field, or even + odd?) might not give consistent results even when running the same program on different occasions.
mark_k is online now  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Digi-View 4.0 and WinUAE in lo-res interlace problem? ImmortalA1000 support.WinUAE 4 13 January 2012 18:41
interlace a3k lost_loven support.Hardware 11 27 November 2011 16:16
Interlace question. Thorham Coders. General 5 24 November 2007 11:00
de-interlace algorythm VermillioN request.UAE Wishlist 4 15 August 2004 05:50

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 17:59.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.11108 seconds with 14 queries