Log in

View Full Version : mv hints format


DaveEL
26th November 2002, 19:22
Could anyone here point me to some documentation/code about the format for the mv hint files. Im working on being able to pause (shutdown computer) and resume 2 pass xvid encodes (Here) (http://forum.doom9.org/showthread.php?s=&postid=215856#post215856) so they can really be done in the background. ive got the stats working in the first pass and the second pass should be quite easy, but i have no idea about the format of the mv hints files which i will need to edit as well.

DaveEL

Koepi
26th November 2002, 19:58
MVhints are broken ATM anyways and it'll last a few days/weeks until this is fixed, so concentrate on more important things first ;)

As far as I can tell MVhints are a little cryptic; they're huffman-compressed pure motion vectors for each MB. (motion_est.c/motion_comp.c should contain most of the MVhints code)

-h or sysKin may step in here and explain the format in detail, but for now I think it's impossible to pause/resume MVhints files due to the MB-level... you'd need to find the position of the last valid frame and continue there (cutting off wrong, already stored MVs) - but since the same is valid for stats and the bitstream itself I think you are doing big efforts to guarantee correctness of all files :)

Thanks a million for your (appreciated!) work Dave,

best regards
Koepi

-h
26th November 2002, 20:49
They're unfortunately not huffman packed, which would save quite a bit of space, they're just bitpacked to only consume as many bits per mv as the current frame's fcode requires.

I've been meaning to fix hinted MVs (along with who knows what else) but have not had any real time to speak of.

Unfortunately, pausing and resuming XviD encoding would be a monumental and daunting task - there are an awful lot of variables in xvidcore you have to back up and worry about. Though you could get away with restarting the encode with a fresh instance of the core, starting with an I-frame and such. Then you'd only have to worry about the state of vfw. Actually that seems pretty simple now that I think about it.

-h

DaveEL
29th November 2002, 16:08
Originally posted by Koepi
MVhints are broken ATM anyways and it'll last a few days/weeks until this is fixed, so concentrate on more important things first ;)


Done everything else now i need the file format! :)
I need enough information to be able to read each frame from one file and save in another file that all i dont need to know what the data means at all.

DaveEL
Also would it be possible to move a couple of extra members of the xvid vfw config struct into the "protected" non moving part so they are always at a fixed address. Things i would like moved would be
a) 2nd stats file
b) mv hints related (on/off and the file name).

DaveEL

[Toff]
29th November 2002, 23:19
I have played a bit with xvid vfw module some times ago to see if it's possible to add command accessible by the VFW interface.
So basicaly here is what I have been able to do in my application :

// -------------------------------------
typedef int (*XvidCommandPtr)(char* command, void* codec);
XvidCommandPtr XvidCommand;
// -------------------------------------

void* XvidCommandPointer = 0;
void* CodecPointer = 0;
ICSendMessage(CompVars.hic, ICM_USER+1, (DWORD)&XvidCommandPointer, (DWORD)&CodecPointer);
XvidCommand = (XvidCommandPtr) XvidCommandPointer;

// Use our getter/setter to get/set any xvid settings
XvidCommand("rc_bitrate=60000", CodecPointer);
int check_bitrate = XvidCommand("rc_bitrate", CodecPointer);
char* hintfile = (char*)XvidCommand("hintfile", CodecPointer);

// Call custom function in xvid
XvidCommand("ShowConfigDialog()",CodecPointer);
XvidCommand("SetPassStartFrame(100)",CodecPointer);
// -------------------------------------

I don't know if it can be of any interest but here are the modified xvid files. (at least this way you can get/set every parameter of the codec even if the CONFIG struct is moving)
http://christophe.paris.free.fr/temp/xvid_vfw_command.zip

Maybe Koepi, if you have time, you can look at it.