1
/***************************************************************************
2
copyright : (C) 2001 by mean
3
email : fixounet@free.fr
4
***************************************************************************/
6
/***************************************************************************
8
* This program is free software; you can redistribute it and/or modify *
9
* it under the terms of the GNU General Public License as published by *
10
* the Free Software Foundation; either version 2 of the License, or *
11
* (at your option) any later version. *
13
***************************************************************************/
20
#define Ui_Dialog Ui_resizeDialog
21
#include "ui_resizing.h"
25
#include "avidemutils.h"
27
#include "ADM_osSupport/ADM_misc.h"
28
static double aspectRatio[2][3]={
29
{1.,0.888888,1.19}, // NTSC 1:1 4:3 16:9
30
{1.,1.066667,1.43} // PAL 1:1 4:3 16:9
32
#define aprintf printf
33
typedef struct resParam
35
uint32_t width,height;
36
uint32_t originalWidth,originalHeight;
42
class resizeWindow : public QDialog
48
resizeWindow(resParam *param);
61
resizeWindow::resizeWindow(resParam *param) : QDialog()
65
ui.spinBoxWidth->setValue(_param->width);
66
ui.spinBoxHeight->setValue(_param->height);
67
ui.horizontalSlider->setValue(100);
69
connect( ui.horizontalSlider,SIGNAL(valueChanged(int)),this,SLOT(update(int)));
72
void resizeWindow::gather(void)
74
_param->width=ui.spinBoxWidth->value();
75
_param->height=ui.spinBoxHeight->value();
76
_param->algo=ui.comboBoxAlgo->currentIndex();
79
void resizeWindow::update(int foo)
90
percent = ui.horizontalSlider->value();;
91
sar=ui.comboBoxSource->currentIndex();
92
dar=ui.comboBoxDestination->currentIndex();
93
if(percent<10.0) percent=10.;
95
aprintf("drag called : %f \n",percent);
96
x=_param->originalWidth;
97
y=_param->originalHeight;
102
{ // source is 4/3 or 16/9
103
sr_mul=aspectRatio[_param->pal][sar];
109
{ // dst is 4/3 or 16/9
111
dst_mul=1/aspectRatio[_param->pal][dar];
113
aprintf("source mul %02.2f , dst mul : %02.2f\n",sr_mul,dst_mul);
117
// normalize it to recover 100% width
118
y=y/(x/_param->originalWidth);
119
x=_param->originalWidth;
121
aprintf("AR:x,y : %03f %03f \n",x,y);
128
aprintf("AR x,y : %03f %03f \n",x,y);
129
xx=(uint32_t)floor(x+0.5);
130
yy=(uint32_t)floor(y+0.5);
136
if(ui.checkBoxRoundup->checkState())
139
xx=(xx +7) & 0xfffff0;
140
yy=(yy +7) & 0xfffff0;
147
aprintf("x: %d -> %d : err %f\n",ox,xx,erx);
148
aprintf("y: %d -> %d : err %f\n",oy,yy,ery);
152
ui.spinBoxWidth->setValue(xx);
153
ui.spinBoxHeight->setValue(yy);
159
\brief Handle resize dialo
161
uint8_t DIA_resize(uint32_t *width,uint32_t *height,uint32_t *alg,uint32_t originalw, uint32_t originalh,uint32_t fps1000)
164
resParam param={*width,*height,originalw,originalh,fps1000,*alg,0};
166
if(fps1000>24600 && fps1000<25400)
173
resizeWindow resizewindow(¶m) ;
175
if(resizewindow.exec()==QDialog::Accepted)
177
resizewindow.gather();
179
*height=param.height;
185
//********************************************