[XviD-devel] Return PSNR in new API?

suxen_drol xvid-devel@xvid.org
Sun, 26 Jan 2003 11:56:53 +1100


On Sun, 26 Jan 2003 00:27:39 +0100 (CET) Christoph Lampert <chl@math.uni-bonn.de> wrote:

> On Fri, 24 Jan 2003, Edouard Gomez wrote:
> 
> > En réponse à Christoph Lampert <chl@math.uni-bonn.de>:
> > > MSE/PSNR code is already there, just #ifdef'ed .
> > > 
> > > Any objections to turning #ifdef's into FLAGS ? 
> > 
> > Personally, i would be very very happy with this type of stats, because PSNR
> > calculation outside XviD is a bit difficult with bframes.
> 
> It seems to be difficult within XVID, too. Internal PSNR doesn't work for
> Bframes (or I do something wrong...).
> 
> gruel 

it doesnt work with bframes because we perform psnr calcs inside the
scheduler (the encoder_encoder and encoder_encode_bframes).

possible solutions:

a) call image_copy and image_psnr inside FrameCodeI/P/B, or

b) place an intermediate function between the scheduler and
FrameCodeI/P/B. ie.

FrameCode(FrameCodeXFunc * FrameCodeX ..., FRAMEINFO * frame)
{
#ifdef _DEBUG_PSNR
	image_copy(&pEnc->sOriginal, &pEnc->frame,
		   pEnc->mbParam.edged_width, pEnc->mbParam.height);
#endif

	FrameCodeX( ... );		/* or we could use a vop_type switch */
	
#ifdef _DEBUG_PSNR
	frame->psnr = image_psnr(&pEnc->sOriginal, &frame->image,
			   pEnc->mbParam.edged_width, pEnc->mbParam.width,
			   pEnc->mbParam.height);
#emdif
}


option b) is better imho. 

also: i have some code ready which moves the BitstreamInit &
BitstreamLength stuff into a similar generic-FrameCode function, and
store the frame length into FRAMEINFO->length.

the idea being that we call the "new/coming-soon" RateControlUpdate()
function purely with the FRAMEINFO struct.


-- pete; life is like a box of ammo