[XviD-devel] [WISH] Statistics and frame type returning

suxen_drol xvid-devel@xvid.org
Tue, 14 Jan 2003 22:35:41 +1100


On Tue, 14 Jan 2003 11:29:59 +0100 (CET) Christoph Lampert <chl@math.uni-bonn.de> wrote:

> On Tue, 14 Jan 2003, suxen_drol wrote:
> > bframe reporting is difficult. we need to break the current api to do it
> > properly. the new api is ready, but if i commit it the existing 2-pass
> > becomes unuable... ive had no time to work on my new 2pass algo. besides
> > it needs more testing.
> 
> Did you include "aspect ratio" information into new API? 
> If not, please do...

yes.

the api is very much like the current one
for inputing video, the frame.type' now replaces frame->intra; 
we have XVID_TYPE_{I,P,B}VOP and XVID_TYPE_AUTO #defines.

frame.out_flags indicates application/container stuff, such as "this is
a keyframe".

the stats structure is filled by the encoder. where stats.type is set to
the XVID_TYPE_{I,P,B,S}VOP, or XVID_TYPE_NONE(for bframes, whilst the
encoder is buffering up bframes).


typedef struct {
	int version;

/* --- VOL related stuff -----------------------------------------*/
	int vol_flags;			/* [in]	vol flags */
	unsigned char *
		quant_intra_matrix;	/* [in:opt] custom intra qmatrix */
	unsigned char *
		quant_inter_matrix;	/* [in:opt] custom inter qmatrix */

	int par;			/* [in:opt] picture aspect ratio (refer to XVID_PAR_xxx above) */
	int par_width;			/* [in:opt] aspect ratio width */
	int par_height;			/* [in:opt] aspect ratio height */
/* ^^^-------------------------------------------------------------*/

	int vop_flags;			/* [in] (general)vop-based flags */
	int motion;			/* [in] ME options */

	xvid_image_t input;		/* [in] input image (read from)
*/
	
	int type;			/* [in:opt] coding type */
	int quant;			/* [in] frame quantizer; if <=0, automatatic (ratecontrol) */
	int bquant;			/* [in:opt] bframe quantizer; if <=0, automatic*/

	void *bitstream;		/* [in:opt] bitstream ptr (written to)*/
	int length;			/* [in:opt] bitstream length (bytes) */

	int out_flags;			/* [out] bitstream output flags */
}
xvid_enc_frame_t;



typedef struct {
	int version;

	/* encoding parameters */
	int type;			/* [out] coding type */
	int quant;			/* [out] frame quantizer */
	int vol_flags;			/* [out] vol flags (see above) */
	int vop_flags;			/* [out] vop flags (see above) */

	/* bitrate/ratecontrol related */
	int length;			/* [out] frame length */
	int hlength;			/* [out] header length (bytes)*/
	int kblks, mblks, ublks;	/* [out] */
}
xvid_enc_stats_t;


-- pete; life is like a box of ammo