PDA

View Full Version : XviD stats file update?


Belgabor
18th January 2003, 18:28
Hi ppl,

Since I implemented stats file manipulation into VDubMod (latest bug fix release), i need to know if there have been any updates on the stats file structure (improbable) and/or the info stored in there (likely with b-frames) lately. The information I used was this (http://forum.doom9.org/showthread.php?threadid=31762&highlight=stats+file).

tia
Belgabor

DaveEL
18th January 2003, 19:34
The struct is the same the only thing is a few extra frame types

#define NNSTATS_KEYFRAME (1<<31)
#define NNSTATS_BFRAME (1<<30)
#define NNSTATS_SKIPFRAME (1<<29)
#define NNSTATS_PADFRAME (1<<28)
#define NNSTATS_DELAYFRAME (1<<27)

typedef struct
{
/* frame length (bytes) */

DWORD bytes;

/* ignored & zero'd by gk
xvid specific: dk_v = frame header bytes
*/

int dk_v, dk_u, dk_y;
int dd_v, dd_u, dd_y;
int mk_u, mk_y;
int md_u, md_y;

/* q used for this frame
set bit 31 for keyframe */

int quant;

/* key, motion, not-coded macroblocks */

int kblk, mblk, ublk;

/* lum_noise is actually a double (as 8 bytes)
for some reason msvc6.0 stores doubles as 12 bytes!?
lum_noise is not used so it doesnt matter */

float lum_noise[2];
} NNSTATS;


DaveEL

Belgabor
19th January 2003, 00:47
Thx for the info :)

Now if someone could please tell me what skip-, pad- and delay frames are and whether they are mutually exclusive with the other types...

DaveEL
19th January 2003, 03:05
frame can only be of one type

Right i the rest of the info is what i think not what i know for sure.

Delay frames are those which are ONLY so the vfw codecs can get extra data to do bframes

Pad frames i think are empty frames used for packed bitstream

still havnt worked our what skip frames are for.

DaveEL
(sorry im drunk while posting ill try to remember to edit this post to correct errors tommorow).

EDIT: Ouch hangover whisky bad :) info seems to be correct but like i said its guess work based on what ive read (thats why b-frames dont work with avs2avi resuming support yet) For the purpose of stats file scaling frame types shouldnt matter much as long as you preserve the type

NiTroGen
19th January 2003, 13:23
And don't forget that for a keyframe we check bit 31 of NNSTATS.quant, but for the other frame types we check the appropriate bits of NNSTATS.dd_v.

Here are some examples of a frame type check:
If ("quant bit 31" = 1) Then Keyframe
If ("quant bit 31" = 0) And ("dd_v bit 30" = 0) Then P-Frame
If ("quant bit 31" = 0) And ("dd_v bit 30" = 1) Then B-Frame
If ("dd_v bit 29" = 1) Then SkipFrame
...etc...

PS. With Koepi's build of 15/01, I've noticed a HUGE bug(???) in reporting Skip/Delay/Pad frames. I've posted it here (http://forum.doom9.org/showthread.php?s=&postid=243496#post243496), I had neither replies nor the attachment approved yet.:(

DaveEL
19th January 2003, 14:55
@NiTroGen

Can you tell me if what i think about the frame types is correct?

DaveEL

NiTroGen
19th January 2003, 21:07
Well, I'm just an XviD user and I don't really know anything about MPEG compression. As many times I've asked for info, nobody had replied (see here (http://www.xvid.org/modules.php?op=modload&name=phpBB2&file=viewtopic&t=864)). I guess, just like you, than Delay and Pad are something like you described and about Skip frames, I think they are used when the frame is identical to the previews one, so it's skipped. ;) I hope I'm right, but we really need an answer from an XviD developer.

DaveEL
19th January 2003, 22:48
Nice to know im not the only one who cant get a straight answer out of the developers :). Looks like im just gonna have to guess.

BTW can stats viewer be run using only the command line? as im working on some SMP optimisations for avs2avi which will require external stats scaling.

(the link to the xvid cvs web is out of date on your site)

DaveEL

NiTroGen
20th January 2003, 15:40
Originally posted by DaveEL
Can stats viewer be run using only the command line? as im working on some SMP optimisations for avs2avi which will require external stats scaling.
Sorry, it can't. As a matter of fact, I've decided to remove the external stats file creation routine, because linear downscaling has already been implemented into the codec. I'm thinking of placing instead some buttons that will change the registry settings of XviD to automatically select 2-pass linear downscaling.
If you want to use linear scaling with avs2avi, you don't need to have an external stats file.

(I'll change the link of CVS asap. Thanks for noticing it.)

Belgabor
20th January 2003, 21:13
Thanks again for the info, but now I start to wonder, these 'exotic' frame types, do they make sense in the stats file?!? That rather seems to be somthing for a frame header in the video stream...

DaveEL
21st January 2003, 00:49
Originally posted by Belgabor
Thanks again for the info, but now I start to wonder, these 'exotic' frame types, do they make sense in the stats file?!? That rather seems to be somthing for a frame header in the video stream...

Im not sure pad and delay frames should be in the stats file but they are (i believe both are to work around putting b-frames in avi containers/vfw codecs). The others are prefectly valid video frames so should be in the stats files. One thing is i guess the size of skip/pad/delay frames shouldn't be changed by any stats file manipulation as they will always be the same size as they contain no video data.

DaveEL

NiTroGen
21st January 2003, 16:08
BTW, what exactly is this dk_v (= frame header bytes) ?

DaveEL
21st January 2003, 18:00
I believe all the d?_/m?_ stuff is leftovers from nandub and are not used. xvid has however started to recycle them with new meanings so when it says frame header bytes it really does mean the number of bytes in the header even if the name of the variable makes no sense and should really be changed IMO).


btw was just reading the xvid devel mailing list and it looks like some of the stats stuff is about to change (at least in the dev-api-3 builds the core changed and broke the vfw stuff recently) ill try to keep up to date and post anything i think useful here.

DaveEL