[CinCV TNG] [PATCH] Make result of division as floating without loosing precision

Nicola Ferralis feranick at hotmail.com
Sun Apr 12 22:37:44 CEST 2015


Patch dropped as considered irrelevant.

Nicola

> Date: Fri, 20 Mar 2015 20:23:17 +0100
> From: j6t at kdbg.org
> To: cinelerra at lists.cinelerra-cv.org
> Subject: Re: [CinCV TNG] [PATCH] Make result of division as floating without loosing precision
> 
> Am 18.03.2015 um 05:35 schrieb Nicola Ferralis:
> > Subject: [PATCH] Make result of division as floating without loosing precision
> >
> > A few divisions are carried out among integers, but the result
> > is converted into double. Any reminder is ignored.
> > This patch fixes this By making sure at least one  member of the
> > divisions is double, so that precision is preserved.
> > ---
> >   cinelerra/audioalsa.C  |  2 +-
> >   cinelerra/cwindowgui.C | 16 ++++++++--------
> >   2 files changed, 9 insertions(+), 9 deletions(-)
> >
> > diff --git a/cinelerra/audioalsa.C b/cinelerra/audioalsa.C
> > index f356917..f4c0a76 100644
> > --- a/cinelerra/audioalsa.C
> > +++ b/cinelerra/audioalsa.C
> > @@ -255,7 +255,7 @@ int AudioALSA::set_params(snd_pcm_t *dsp,
> >   	}
> >   	else
> >   	{
> > -		buffer_time = (int)((int64_t)samples * 1000000 * 2 / samplerate + 0.5);
> > +		buffer_time = (int)((int64_t)samples * 1000000 * 2.0 / samplerate + 0.5);
> >   		period_time = samples * samplerate / 1000000;
> >   	}
> 
> The value is used in call to snd_pcm_hw_params_set_buffer_time_near. I 
> have no idea whether a change in behavior hurts.
> 
> > diff --git a/cinelerra/cwindowgui.C b/cinelerra/cwindowgui.C
> > index 5581ed9..42c6506 100644
> > --- a/cinelerra/cwindowgui.C
> > +++ b/cinelerra/cwindowgui.C
> > @@ -2067,14 +2067,14 @@ void CWindowCanvas::draw_safe_regions()
> >   	float action_x1, action_x2, action_y1, action_y2;
> >   	float title_x1, title_x2, title_y1, title_y2;
> >
> > -	action_x1 = mwindow->edl->session->output_w / 2 - mwindow->edl->session->output_w / 2 * 0.9;
> > -	action_x2 = mwindow->edl->session->output_w / 2 + mwindow->edl->session->output_w / 2 * 0.9;
> > -	action_y1 = mwindow->edl->session->output_h / 2 - mwindow->edl->session->output_h / 2 * 0.9;
> > -	action_y2 = mwindow->edl->session->output_h / 2 + mwindow->edl->session->output_h / 2 * 0.9;
> > -	title_x1 = mwindow->edl->session->output_w / 2 - mwindow->edl->session->output_w / 2 * 0.8;
> > -	title_x2 = mwindow->edl->session->output_w / 2 + mwindow->edl->session->output_w / 2 * 0.8;
> > -	title_y1 = mwindow->edl->session->output_h / 2 - mwindow->edl->session->output_h / 2 * 0.8;
> > -	title_y2 = mwindow->edl->session->output_h / 2 + mwindow->edl->session->output_h / 2 * 0.8;
> > +	action_x1 = mwindow->edl->session->output_w / 2.0 - mwindow->edl->session->output_w / 2.0 * 0.9;
> > +	action_x2 = mwindow->edl->session->output_w / 2.0 + mwindow->edl->session->output_w / 2.0 * 0.9;
> > +	action_y1 = mwindow->edl->session->output_h / 2.0 - mwindow->edl->session->output_h / 2.0 * 0.9;
> > +	action_y2 = mwindow->edl->session->output_h / 2.0 + mwindow->edl->session->output_h / 2.0 * 0.9;
> > +	title_x1 = mwindow->edl->session->output_w / 2.0 - mwindow->edl->session->output_w / 2.0 * 0.8;
> > +	title_x2 = mwindow->edl->session->output_w / 2.0 + mwindow->edl->session->output_w / 2.0 * 0.8;
> > +	title_y1 = mwindow->edl->session->output_h / 2.0 - mwindow->edl->session->output_h / 2.0 * 0.8;
> > +	title_y2 = mwindow->edl->session->output_h / 2.0 + mwindow->edl->session->output_h / 2.0 * 0.8;
> 
> This part is OK, I think. It draws the safe area. A pixel more or fewer 
> certainly does not matter.
> 
> -- Hannes
> 
> _______________________________________________
> Cinelerra mailing list
> Cinelerra at lists.cinelerra-cv.org
> http://lists.cinelerra-cv.org/cgi-bin/mailman/listinfo/cinelerra
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cinelerra-cv.org/pipermail/cinelerra/attachments/20150412/d7cfcc75/attachment.html>


More information about the Cinelerra mailing list