View Full Version : XviD DS Filter overlay support
Koepi
20th February 2002, 14:38
Ahoy,
since I'm simply too stupid to correctly code directshow I ask for some assistance here.
While testing around I found that the XviD DS decoder already supports overlay through activemovie objects (verify this vie your NVIDIA's drivers overlay mixer ;) ).
So no need to insert an overlay mixer (was my first try now, didn't work out since it is already an overlay ;) ).
So if it _is_ an overlay, how do I control the settinbgs like brightness/contrast etc.?
Well, just some info about my (non existent) progress.
Regards,
Koepi
kastro68
20th February 2002, 15:03
Yo,
did you try reverse engineering the divx4 DSF yet?
Koepi
20th February 2002, 15:48
I finally found what to do:
include <mpconf.h>
the getoverlaysurfacecolorcontrol + set....
Now I've to figure out how to correctly do that stuff :)
Regards,
Koepi
Nic
20th February 2002, 16:01
Well done Koepi :) I suppose you can then set:
typedef struct _DDCOLORCONTROL
{
DWORD dwSize;
DWORD dwFlags;
LONG lBrightness;
LONG lContrast;
LONG lHue;
LONG lSaturation;
LONG lSharpness;
LONG lGamma;
LONG lColorEnable;
DWORD dwReserved1;
} DDCOLORCONTROL;
To whatever you want??
Tell me how it goes... :)
Cheers,
-Nic
Koepi
20th February 2002, 16:17
Hehe, you found the necessary structure that I want to modify (well, I just wnated to do first checks with a fixed
ColorControl->lBrightness=60;
...but I'm incapable to get the surface or whatever to what this has to be applied - this is soooo odd.
(Maybe we have to get rid of that AMOVIESETUP_BLAH stuff and directly code IBasicBlahBlah stuff...).
Hell. I'm loosing my motivation, now that I'm really close to what we need.
Nic, you seem to be way more comfortable with that matter, now that we have that structure, can't you implement it (correctly - I would mess up again, I'm sure :( )?
Regards,
Koepi
Nic
20th February 2002, 16:31
Ive implemented brightness control in Core....How have I done it, the same way a four year old child would do... Doh! But it works....
(i.e. how would a four year old child do it? Convert the YUV->RGB->Fiddle around->YUV :) (Im a professional programmer & that was the best I could come up with!? :)
(Im so bad at YUV, Ive got my head around YUY2 before, but thats about it)
However, now I know how to fiddle around with the decoded frames im currently looking up ffmpeg... :) Try & get some basic postprocessing info....Im really new at this, so although I know working in RGB is just _wrong_...Ill probably be able to whip something up useful over the week with brightness + a little block removal/postprocessing as a fix until someone with better experience steps in & takes over.
Ill look at grabbing the overlay surface, although im not sure if that is the right solution (Overlays are sometimes troublesome, using the pallete would be interesting, the old DXMedia sample called "Contrast" gives a good enough example to work from (but its only in RGB))
Cheers,
-Nic
Koepi
20th February 2002, 16:38
Using the palette was one of my ideas as well. But if we have an interface to control the colour with, why not use it?
I simply can't apply that to anything. Maybe I have to create an instance of an overlay mixer, use that filter on it's input pin, but then I'm in a one-way road again....
*SIGH* it's really unbelievable that noone has experience with that matter.
Btw., I'm not keen on post processing, that can wait. To use the XviD filter I first need colour control... ;) (guess why I'm trying to work that out ;) )
Well, I'm getting in a bad mood now and simply should stop investigating further as I find some things here and there but can't apply them because I don't know where.
Regards,
Koepi
Nic
20th February 2002, 16:41
Getting in a bad mood? why? frustrating MS SDK docs tend to do that to me. There are people with experience, I dont want to do it using Overlay support though, so thats why im not looking into it (i.e. its better to have such things in core isn't it? for linux compatability, etc? or am i wrong?
Ive done brightness control, ill finish it off over the weekend (or tomorrow ;) )
Cheers,
-Nic
Koepi
20th February 2002, 16:50
I don't thik this belongs into the core. You modify the raw data there, that's a bad idea (just IMHO).
All the other codecs seem to use the overlay and modify the settings there - that's the cleanest way to do that.
Since you have overlays on linux as well, you can modify those values (maybe even in a way more elegant way than with directX sdk).
Btw., why not finishing that now? ;)
Regards,
Koepi
Nic
20th February 2002, 17:01
Mmmmm...Maybe your right, that makes sense. :)
Ill look into the overlay stuff & why hasn't anyone added the postprocessing from divx4a50 into xvid?
-Nic
Koepi
20th February 2002, 17:09
There is already post processing?
There should be colour controls as well then I guess?
Wtf...?
Regards,
Koepi
Nic
20th February 2002, 17:14
Would you believe it? There isn't any color control that I can find in DivX4a50, but the postprocessing is all there (deblocking/deringing/etc) But there must be a reason it hasn't been included? If its just been no one has had the time ill do it at the weekend (it looks very easy to "duct tape" in (to quote -h :) ))
-Nic
Nic
20th February 2002, 17:29
The only way I can workout how to use the overlay, is for the decoder to get a pointer to the Video Renderer & control it from there. I think???? Im going to go get some help (wheres Ingo, Tobias, BlackSun, etc. when ya need them? :) )
-Nic
Koepi
20th February 2002, 17:36
Something like that seems to be necessary - I still fiddle around with it but can't find aything useful :(
Regards,
Koepi
Koepi
20th February 2002, 17:43
I'm off now for 1-2 hours. Cooking dinner.
Maybe until then you figured something out ;)
Regards,
Koepi
Nic
20th February 2002, 17:57
Well im off home (had enough of work LoL) for today, can never get on my comp at home (my sis is always on it grrrr)
See ya tommorrow,
Cheers,
-Nic
ps
Ive worked out how to do the brightness in DShow rather than Core, but its still a crappy way....... :(
Koepi
20th February 2002, 18:03
Damn - and now you can't write how to do that...
If youcan't get to your compi then I could have tried it.
But anyways...
Cooking - now! ;)
Regards,
Koepi
Koepi
20th February 2002, 20:48
Ok, back from dinner... and still no clue what to do about the colour controls.
I could implement something (slow?) like conversion to RGB, applying transforms like in the contrast example (brightness would be a simple shift of the palette instead of resizing it)...
But that sounds like a bad idea to me.
Anyone with some better ideas/results?
Nic? :)
Regards,
Koepi
Nic
20th February 2002, 20:50
LoL :)
It wasn't using the overlay. Anywayz im about to go out & drink some Foster's even if it is the "leper beer" :)
Cheers,
-Nic
ps
Did a test over the last two days between xvid, divx, div3....xvid did pretty much come out on top (although they were all pretty much equal with this movie (Ronin))
Koepi
20th February 2002, 20:56
Enjoy your beer, have one for me, too :)
Nope, it wouldn't be the overlay.
But I can modify the raw data before that so that it's brighter/darker... should even work in YUV color space when I think about it, but I'd need o do further investigation.
I simply don't feel like it anymore now. A whole day wasted on this subject without results is annoying enough. specially when you know someone has the solution but you can't get the knowledge ;) (let's beat up DivX Networks.. ;) ...just kidding.)
Foo
20th February 2002, 22:59
I just wanted to take a second to thank you guys (Nic, Koepi, -h) for all the frustrating hours you've spent implementing the stuff we bug you about :D .
Once everything is mostly done and we have a really nice cross-platform GPL'd mpeg4 codec, all those hours and beers will be worth it:p .
cheers,
foo
-h
20th February 2002, 23:35
I seem to remember that the a50 dshow code was either broken or missing.. guess that's really messed things up.
Heh "good luck guys" :)
-h
BlackSun
21st February 2002, 08:15
This may help you:
http://sourceforge.net/projects/avifile/ (the author is the main coder of the DivX 4, Sparky)
Nic
21st February 2002, 09:52
I'd already checked out avifile............ :) Thanx for the input BlackSun :)
.......The post processing I was looking at was from the videocoding.de decore cvs
Cheers,
-Nic
-h
21st February 2002, 10:12
The post processing I was looking at was from the videocoding.de decore cvs
Did you look at the decore tree, or the divx4windows tree? the overlay stuff would be in divx4windows...
-h
Nic
21st February 2002, 10:21
Cheers for the hint -h grabbing it now....
....Implemented brightness in YUV, just adjusted the luminance by a set factor, but isn't color logarithmic? So I should change that.
Now got to look through overlay stuff (im sure MS purposely make my life hard :)
Cheers,
-Nic
ps
Even with the fosters induced headache I have right now, cant find anything in that tree, the divx4a50 source can be downloaded from Doom9, but that doesn't contain brightness control......Grrr :)
Koepi
21st February 2002, 13:01
Did you code the brightness in the core again or only in the CXviD...::transform of the DS filter?
Regards,
Koepi
P.S.: after having the whole day yesterday with frustration I'm now "porting" my stats file reader to MFC /C++. Guess what - always lot's of trouble :-/ but it works mostly again, now have to introduce some user interaction (maybe I can make it a stats modifier - wouldn't be much of use though... maybe as an extra tab on XviD vfw, for "visually" modifying the stats?) Oppsi, this is a long story again ;)
Koepi
21st February 2002, 13:04
AviFile was never helpful when it comes to coding to me.
I tried to add normal file support to the ASX parser but that didn't work out, whatever I did.
The code is a little - well - messy.
But I'll make a fresh CVS checkout. Or Nic, has your implementation already derived from that?
Regards,
Koepi
Nic
21st February 2002, 13:18
Nope, I did it in Core again, to do it in DShow I have to import the image.h & work from there, it isn't difficult, but at present im everso busy at work.
Im going to take it home with me tonight & do it there....Ill get it done. Im also going to look at the post processing (if you checkout decore, you'll see the postprocessing code....it looks pretty good.
-Nic
Koepi
21st February 2002, 14:11
Ah, nice to hear Nic.
...if we can't control the overlay directly, I guess the color transform has to be written for both colorspaces, RGB and YUV (this just pops into my mind) as the output pin can be RGB as well, right? (for example, if some VGA drivers don't support overlay...)
This seems to get very tricky.
Maybe we shouldn't care about that (yet) as XviD is a "new" codec and needs "new" hardware t run smoothly on ;) (at least my modifications like intraframe quant lock etc tend to produce files which need more processing power to playback well).
How does the avifile code solve the brightness/contrast control?
Regards,
Koepi
Nic
21st February 2002, 14:18
Ahh, your complicating things...The codec converts internally to YUV & then converts to whatever you want on the output. If you grab it internally (in core) then its easy because you only dealing with one format.
If I were to do it in DShow, at present id request a convert to YUV then in the DShow convert to the required output colorspace. This is of course slower, but less messy than doing it in Core or writing a brightness function for all the color spaces (i.e. RGB24, RGB32, YV12, RGB555, etc)
-Nic
Koepi
21st February 2002, 14:35
Ok, that sounds very reasonable.
So after all, it isn't too bad to have those controls in the core. You can port it between the platforms easily ;)
I'm curious, that should modify the API, right? How did you solve this?
I'm really looking forward to get my hands on your code (or at least at your xvidax ;) ) to finally watch my encoded results with XviD DS filter without problems :)
Regards,
Koepi
rui
21st February 2002, 14:46
Originally posted by Koepi
I'm really looking forward to get my hands on your code (or at least at your xvidax ;) ) to finally watch my encoded results with XviD DS filter without problems :)
Regards,
Koepi
And that will be a very happy day :)
But you guys should watch out. One of this days Microsoft is going to read this forums, and probably will try to hire you :D
Nic
21st February 2002, 14:46
The weird thing is that the DShow filter isn't automonous! If I make changes to core, these have no effect on the decoding of the DShow filter (??), the DShow filter loads the decoding core from vfw.dll....so its not just a case of distributing the xvid.ax (!)
I dont modify the API apart from to add another function which sets the brightness variable. Ill get a version going over the weekend, (tonight ive got paperwork to fill in & tommorrow is Friday night so ill be drinking lots of leper's beer :D
-Nic
Koepi
21st February 2002, 15:13
This is strange...
How about this:
- in DShow, request the YUV image from the core (API extension necessary)
- apply the color correction in DShow
- send corrected YUV image back to core, which does whatever it's supposed to do.
Better? Worse?
Regards,
Koepi
Nic
21st February 2002, 15:22
Yes, very similar to that (no need to send back to core), ill try not to do anything in Core. :)
-Nic
ChristianHJW
21st February 2002, 16:12
Just posting to say i'm follwing this tread ... i dont have a clue about what is discussed ;) , but the 'missing' DSF is the only reason for me to not switch to XviD completely ... call me old-fashioned if you like, but i really fear messing with different codecs registering for the same FourCC on my PC.
Once there is a working DSF for XviD, including postprocessing and all the other goodies, than i guess its really time to drop DivX4 completely ... until DivX 5 is ready to be tested against it ....
Teegedeck
21st February 2002, 16:16
Isn't it a bigger step to use a new A/V-format? :)
I mean, all you have to do is change fourccs to play a movie with a different DSF. Installing XviD's DSF doesn't do harm.
ChristianHJW
21st February 2002, 16:26
Originally posted by Teegedeck Isn't it a bigger step to use a new A/V-format? :)
lol .... yeah mate, i guess you're right ;)
I mean, all you have to do is change fourccs to play a movie with a different DSF. Installing XviD's DSF doesn't do harm.
Its not at all the XviD DSF that i fear .... i just remember this very OS i screwed when installing one of the 1st versions of XviD ... had to do format C: this time, because even after unregistering XviD and reregistering DivX4 non of my movies would play ... :( .
I really dont know what the problems were these days, i guess the fact that XviD was using same FourCC as DivX4 then f..ed something completely. So i decided that whenever there is a version of XviD using own FourCC for en/decoding i will start using it .... i probably misunderstood something totally, but until recently i didnt have any real reason to switch. This is changing now as i hear so many very positive comments from experienced users ( like Neo Neko recently : http://www.powerdivx.com/phpbb2/viewtopic.php?t=223 ), i somehow have the feeling i am missing something ... probably even get left behind :eek: ???
Acaila
21st February 2002, 16:38
This is changing now as i hear so many very positive comments from experienced users ( like Neo Neko recently : http://www.powerdivx.com/phpbb2/viewtopic.php?t=223 ), i somehow have the feeling i am missing something ... probably even get left behind ???
Stop waiting and hop on!
So what if you have to format every day, you don't want to miss this :D
Nic
21st February 2002, 16:55
Done It!!! :D :D :D
Implemented brightness only in the DShow filter :) YaY!
Erm...now back to work...Ill fiddle later tonight :)
Cheers,
-Nic
ps
However, there is a change to image.h (to allow certain functions to be external) - but nothing else
Koepi
21st February 2002, 18:03
You're a star Nic :)
I'm glad that it is possible to solve more elegantly!!!
Still can't wait to see the results :)
Best regards,
Koepi
Teegedeck
21st February 2002, 18:52
@Koepi:
I warned you! I warned you not to tell everyone how good XviD is! And now you're even carrying it as a name tag! I warned you once and now you'll just have to live with the consequences, new mod. :)
Koepi
21st February 2002, 19:15
Wtf? :)
Well, thanks for the title ;)
But you'll have to live without my help from tomorrow to sunday, I hope you can forgive me ;)
Warm regards,
Koepi
EDIT:
P.S.: if I'd write a "Doom9's options explained", will I become a supermod then? ;)
Nic
21st February 2002, 23:53
Brightness!
www.freewebz.com/xvid/Xvid_ax.zip
Install that & have fabby brightness control.
Cheers,
-Nic
Ripe73
22nd February 2002, 00:00
Thanks for the light!!!:D
ARDA
22nd February 2002, 00:15
Great,Nic and thanks.
Just a small bug, I can't move the progress bar to advance the picture.
It does nothing.I've tested wmplayer,zoom,powerdivx
Keep on and thanks,again
Arda
Nic
22nd February 2002, 00:18
You cant seek through the film??? I don't know how what ive done could effect that....What happens when you try?
-Nic
ARDA
22nd February 2002, 00:28
I have the last frame frozen and the time counter in zoomplayer for instance indicates it is still playing,I have registered your ax and the one I've got today sooner from your binary package. No problem
with xvid.ax 44kb 21/02/2002 11:43.Sorry my english
Nic
22nd February 2002, 00:40
Whoops! :) Theres a weird thing that happens to the frame size calculation when you jump frames.....But its now fixed.
Please re-download from the site & try again for me :)
Well done on spotting that :)
-Nic
ARDA
22nd February 2002, 00:47
Everything is working ok now.Great job
Arda
Koepi
22nd February 2002, 02:04
Damn, somehow my win\sys32\xvid_ax is blocked, can't overwrite and test it :-/
But tomorrow morning *caugh* after the encoding run i should be able to test...
Thanks nic for the great work once more :)
Do you submit that to CVS? (pretty please!)
Regards,
Koepi
Doom9
22nd February 2002, 02:33
@koepi: first of all I hope you're not offended by the new mod status.. I got forced into this ;)
I've also had this problem recently.. vobsub and ogg filters would get locked and I had to boot into the recovery console to get rid of the files.. dunno why this happesn. I recall overwriting DivX4 dlls and filters without any problems.. so if you find a working solution please let me know.
Nic
22nd February 2002, 09:43
LoL... :)
Ill have to consult with someone whether to put it into CVS (who should I talk to? Suxen_drole?), I have to use image.c commands & im not sure if they'll like that being included in the DShow (Or though I cant see any way of getting the frame otherwise) (but means adding two lines in image.h)
(-h maybe I should put it past you first?)
Not bad though is it :)
Cheers,
-Nic
ps
Can I also say, adding PostProcessing from DivX4a50 will be everso easy :) (easier than adding the brightness!)
rui
22nd February 2002, 10:44
Any hopes for a post processing anytime soon?
It would be very usefull for 1 cd encondings, and since the divx4 guys don't seem very interested in fixing the MPEG decoder bug...
P.S. I just read your last post, Nic. That is great news :)
Nic
22nd February 2002, 10:48
How about Monday? :)
Well maybe thats optimistic, but seeing that even though the xvid code is written from scratch, the API is everso similar to DivX4a50 & therefore I can just attach the code.
If I were DivXNetworks....Im not sure if i'd want to fix the bug right now....its one of the main things holding XVID back from being even more popular.
-Nic
rui
22nd February 2002, 11:43
Originally posted by Nic
How about Monday? :)
Well maybe thats optimistic, but seeing that even though the xvid code is written from scratch, the API is everso similar to DivX4a50 & therefore I can just attach the code.
GREAT!! :) I will be here to test it ;)
Originally posted by Nic
If I were DivXNetworks....Im not sure if i'd want to fix the bug right now....its one of the main things holding XVID back from being even more popular.
-Nic
Wise words... It makes one think...
-h
22nd February 2002, 12:56
Ill have to consult with someone whether to put it into CVS (who should I talk to? Suxen_drole?), I have to use image.c commands & im not sure if they'll like that being included in the DShow (Or though I cant see any way of getting the frame otherwise) (but means adding two lines in image.h)
Hey hey. How big a mod is it?
gruel is looking at a number of mods: merging image.c / image.h with common.c / common.h, replacing the XVID_ENC_PARAM / DEC_PARAM with a more modular flags design, etc. Whatever the mod is (I haven't downloaded it yet!), it'll probably need updating by next week :)
-h
Nic
22nd February 2002, 13:07
Its a tiny mod really.....
Well ill wait till next week then.
I dont agree with what Gruel is doing though, image functions have a very definite puropose & should be kept seperate from the common files.
(however, both encoder & decoder need the colorspace conversion, but that doesn't mean he should merge the files)
(changing the encoder & decoder struct types doesn't make much sense either to me....surely a flags system just overcomplicates things )
-Nic
b0b0b0b
22nd February 2002, 17:48
Have you guys looked at "dscaler" to see how they handle drawing to overlay surfaces? They are also extremely configurable.
Nic
22nd February 2002, 17:51
Good thinking....PM'ing Tom now.
-Nic
BlackSun
23rd February 2002, 08:01
AviFile was never helpful when it comes to coding to me.
I tried to add normal file support to the ASX parser but that didn't work out, whatever I did.
The code is a little - well - messy.
Lol, and you don't understand why he VBRControl.cpp from the DivX4 codec is strange ?
@Nic: great that you found something, because AViFile was the only interesting thing I've found...
But you guys should watch out. One of this days Microsoft is going to read this forums, and probably will try to hire you :D
It's like going to hell :p
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.