Commit bd9d3bba authored by Vincent PINON's avatar Vincent PINON

Cppcheck fixs

Conflicts:
	src/kthumb.cpp
	src/mainwindow.cpp
	src/mltdevicecapture.cpp
	src/renderer.cpp
parent 56acd924
......@@ -223,7 +223,7 @@ void AbstractClipItem::resizeEnd(int posx, bool /*emitChange*/)
//kDebug() << "///////// COLLISION DETECTED!!!!!!!!!";
//kDebug() << "///////// CURRENT: " << startPos().frames(25) << "x" << endPos().frames(25) << ", RECT: " << rect() << "-" << pos();
//kDebug() << "///////// COLLISION: " << ((AbstractClipItem *)item)->startPos().frames(25) << "x" << ((AbstractClipItem *)item)->endPos().frames(25) << ", RECT: " << ((AbstractClipItem *)item)->rect() << "-" << item->pos();
GenTime diff = ((AbstractClipItem *)item)->startPos() - startPos();
GenTime diff = static_cast<AbstractClipItem*>(item)->startPos() - startPos();
if (fixItem == false || diff < m_info.cropDuration) {
fixItem = true;
m_info.cropDuration = diff;
......
......@@ -78,7 +78,7 @@ void AbstractGroupItem::setItemLocked(bool locked)
setFlag(QGraphicsItem::ItemIsSelectable, !locked);
foreach (QGraphicsItem *child, childItems())
((AbstractClipItem *)child)->setItemLocked(locked);
static_cast<AbstractClipItem*>(child)->setItemLocked(locked);
}
bool AbstractGroupItem::isItemLocked() const
......@@ -318,19 +318,11 @@ QVariant AbstractGroupItem::itemChange(GraphicsItemChange change, const QVariant
return pos();
}
AbstractClipItem *item = static_cast <AbstractClipItem *>(collision);
if (forwardMove) {
// Moving forward, determine best pos
// Determine best pos
QPainterPath clipPath;
clipPath.addRect(item->sceneBoundingRect());
QPainterPath res = shape.intersected(clipPath);
offset = qMax(offset, (int)(res.boundingRect().width() + 0.5));
} else {
// Moving backward, determine best pos
QPainterPath clipPath;
clipPath.addRect(item->sceneBoundingRect());
QPainterPath res = shape.intersected(clipPath);
offset = qMax(offset, (int)(res.boundingRect().width() + 0.5));
}
}
}
if (offset > 0) {
......@@ -383,19 +375,11 @@ QVariant AbstractGroupItem::itemChange(GraphicsItemChange change, const QVariant
return pos();
}
AbstractClipItem *item = static_cast <AbstractClipItem *>(collision);
if (forwardMove) {
// Moving forward, determine best pos
// Determine best pos
QPainterPath clipPath;
clipPath.addRect(item->sceneBoundingRect());
QPainterPath res = shape.intersected(clipPath);
offset = qMax(offset, (int)(res.boundingRect().width() + 0.5));
} else {
// Moving backward, determine best pos
QPainterPath clipPath;
clipPath.addRect(item->sceneBoundingRect());
QPainterPath res = shape.intersected(clipPath);
offset = qMax(offset, (int)(res.boundingRect().width() + 0.5));
}
}
}
if (offset > 0) {
......@@ -426,13 +410,13 @@ void AbstractGroupItem::dropEvent(QGraphicsSceneDragDropEvent * event)
doc.setContent(effects, true);
QDomElement e = doc.documentElement();
e.setAttribute("kdenlive_ix", 0);
CustomTrackView *view = (CustomTrackView *) scene()->views()[0];
CustomTrackView *view = static_cast<CustomTrackView*>(scene()->views()[0]);
QPointF dropPos = event->scenePos();
QList<QGraphicsItem *> selection = scene()->items(dropPos);
AbstractClipItem *dropChild = NULL;
for (int i = 0; i < selection.count(); ++i) {
if (selection.at(i)->type() == AVWidget) {
dropChild = (AbstractClipItem *) selection.at(i);
dropChild = static_cast<AbstractClipItem*>(selection.at(i));
break;
}
}
......
......@@ -240,7 +240,7 @@ void ClipStabilize::slotUpdateParams()
QString name=w->objectName();
if (!name.isEmpty() && m_ui_params.contains(name)){
if (m_ui_params[name]["type"]=="int" || m_ui_params[name]["type"]=="double"){
DoubleParameterWidget *dbl=(DoubleParameterWidget*)w;
DoubleParameterWidget *dbl=static_cast<DoubleParameterWidget*>(w);
m_ui_params[name]["value"]=QString::number((double)(dbl->getValue()));
}else if (m_ui_params[name]["type"]=="bool"){
QCheckBox *ch=(QCheckBox*)w;
......
......@@ -52,7 +52,7 @@ QImage RGBParadeGenerator::calculateRGBParade(const QSize &paradeSize, const QIm
QRgb *col;
QPainter davinci(&parade);
double dx, dy;
double dx;
const uint ww = paradeSize.width();
const uint wh = paradeSize.height();
......@@ -148,7 +148,7 @@ QImage RGBParadeGenerator::calculateRGBParade(const QSize &paradeSize, const QIm
if (drawAxis) {
QRgb opx;
for (uint i = 0; i <= 10; ++i) {
dy = (float)i/10 * (partH-1);
double dy = (float)i/10 * (partH-1);
for (uint x = 0; x < ww-distRight; x++) {
opx = parade.pixel(x, dy);
parade.setPixel(x,dy, qRgba(CHOP255(150+qRed(opx)), 255,
......
......@@ -36,8 +36,8 @@ CustomTrackScene::~CustomTrackScene()
double CustomTrackScene::getSnapPointForPos(double pos, bool doSnap)
{
double maximumOffset;
if (doSnap) {
double maximumOffset;
if (m_scale.x() > 3) maximumOffset = 10 / m_scale.x();
else maximumOffset = 6 / m_scale.x();
for (int i = 0; i < m_snapPoints.size(); ++i) {
......
......@@ -300,7 +300,7 @@ void CustomTrackView::updateSceneFrameWidth()
ClipItem *item;
for (int i = 0; i < itemList.count(); ++i) {
if (itemList.at(i)->type() == AVWidget) {
item = (ClipItem*) itemList.at(i);
item = static_cast<ClipItem*>(itemList.at(i));
item->resetFrameWidth(frameWidth);
item->resetThumbs(true);
}
......@@ -320,13 +320,13 @@ bool CustomTrackView::checkTrackHeight()
KdenliveSettings::setSnaptopoints(false);
for (int i = 0; i < itemList.count(); ++i) {
if (itemList.at(i)->type() == AVWidget) {
item = (ClipItem*) itemList.at(i);
item = static_cast<ClipItem*>(itemList.at(i));
item->setRect(0, 0, item->rect().width(), m_tracksHeight - 1);
item->setPos((qreal) item->startPos().frames(m_document->fps()), (qreal) item->track() * m_tracksHeight + 1);
item->resetFrameWidth(frameWidth);
item->resetThumbs(true);
} else if (itemList.at(i)->type() == TransitionWidget) {
transitionitem = (Transition*) itemList.at(i);
transitionitem = static_cast<Transition*>(itemList.at(i));
transitionitem->setRect(0, 0, transitionitem->rect().width(), m_tracksHeight / 3 * 2 - 1);
transitionitem->setPos((qreal) transitionitem->startPos().frames(m_document->fps()), (qreal) transitionitem->track() * m_tracksHeight + m_tracksHeight / 3 * 2);
}
......@@ -490,9 +490,9 @@ void CustomTrackView::mouseMoveEvent(QMouseEvent * event)
QString offset = m_document->timecode().getDisplayTimecode(m_dragItem->cropDuration() - m_dragItemInfo.cropDuration, KdenliveSettings::frametimecode());
emit displayMessage(i18n("Duration:") + ' ' + duration + ' ' + i18n("Offset:") + ' ' + offset, InformationMessage);
} else if (m_operationMode == FadeIn && move) {
((ClipItem*) m_dragItem)->setFadeIn((int)(mappedXPos - m_dragItem->startPos().frames(m_document->fps())));
((ClipItem*) m_dragItem)->setFadeIn(static_cast<int>(mappedXPos - m_dragItem->startPos().frames(m_document->fps())));
} else if (m_operationMode == FadeOut && move) {
((ClipItem*) m_dragItem)->setFadeOut((int)(m_dragItem->endPos().frames(m_document->fps()) - mappedXPos));
((ClipItem*) m_dragItem)->setFadeOut(static_cast<int>(m_dragItem->endPos().frames(m_document->fps()) - mappedXPos));
} else if (m_operationMode == KeyFrame && move) {
GenTime keyFramePos = GenTime(mappedXPos, m_document->fps()) - m_dragItem->startPos() + m_dragItem->cropStart();
double pos = mapToScene(event->pos()).toPoint().y();
......@@ -647,7 +647,7 @@ void CustomTrackView::mouseMoveEvent(QMouseEvent * event)
// razor tool over a clip, display current frame in monitor
if (false && !m_blockRefresh && item->type() == AVWidget) {
//TODO: solve crash when showing frame when moving razor over clip
emit showClipFrame(((ClipItem *) item)->baseClip(), QPoint(), false, mappedXPos - (clip->startPos() - clip->cropStart()).frames(m_document->fps()));
emit showClipFrame(static_cast<ClipItem*>(item)->baseClip(), QPoint(), false, mappedXPos - (clip->startPos() - clip->cropStart()).frames(m_document->fps()));
}
event->accept();
return;
......@@ -808,7 +808,7 @@ void CustomTrackView::mousePressEvent(QMouseEvent * event)
for (int i = 0; i < collisionList.count(); ++i) {
if (collisionList.at(i)->type() == GUIDEITEM) {
// a guide item was pressed
m_dragGuide = (Guide *) collisionList.at(i);
m_dragGuide = static_cast<Guide*>(collisionList.at(i));
if (event->button() == Qt::LeftButton) { // move it
m_dragGuide->setFlag(QGraphicsItem::ItemIsMovable, true);
m_operationMode = MoveGuide;
......@@ -1023,7 +1023,7 @@ void CustomTrackView::mousePressEvent(QMouseEvent * event)
} else {
m_document->renderer()->pause();
if (m_dragItem->parentItem() && m_dragItem->parentItem() != m_selectionGroup) {
razorGroup((AbstractGroupItem *)m_dragItem->parentItem(), cutPos);
razorGroup(static_cast<AbstractGroupItem*>(m_dragItem->parentItem()), cutPos);
} else {
ClipItem *clip = static_cast <ClipItem *>(m_dragItem);
RazorClipCommand* command = new RazorClipCommand(this, clip->info(), clip->effectList(), cutPos);
......@@ -1207,7 +1207,7 @@ void CustomTrackView::mousePressEvent(QMouseEvent * event)
} else transitionAccepted = false;
}
}
if (transitionAccepted) slotAddTransition((ClipItem *) m_dragItem, info, transitiontrack);
if (transitionAccepted) slotAddTransition(static_cast<ClipItem*>(m_dragItem), info, transitiontrack);
else emit displayMessage(i18n("Cannot add transition"), ErrorMessage);
} else if (m_operationMode == TransitionEnd && event->modifiers() != Qt::ControlModifier) {
ItemInfo info;
......@@ -1242,7 +1242,7 @@ void CustomTrackView::mousePressEvent(QMouseEvent * event)
} else transitionAccepted = false;
}
}
if (transitionAccepted) slotAddTransition((ClipItem *) m_dragItem, info, transitiontrack, transition);
if (transitionAccepted) slotAddTransition(static_cast<ClipItem*>(m_dragItem), info, transitiontrack, transition);
else emit displayMessage(i18n("Cannot add transition"), ErrorMessage);
} else if ((m_operationMode == ResizeStart || m_operationMode == ResizeEnd) && m_selectionGroup) {
......@@ -1474,7 +1474,7 @@ void CustomTrackView::mouseDoubleClickEvent(QMouseEvent *event)
} else {
QList<QGraphicsItem *> collisionList = items(event->pos());
if (collisionList.count() == 1 && collisionList.at(0)->type() == GUIDEITEM) {
Guide *editGuide = (Guide *) collisionList.at(0);
Guide *editGuide = static_cast<Guide*>(collisionList.at(0));
if (editGuide) slotEditGuide(editGuide->info());
}
}
......@@ -2572,7 +2572,7 @@ void CustomTrackView::slotAddTransitionToSelectedClips(QDomElement transition)
QList<QGraphicsItem *> itemList = scene()->selectedItems();
if (itemList.count() == 1) {
if (itemList.at(0)->type() == AVWidget) {
ClipItem *item = (ClipItem *) itemList.at(0);
ClipItem *item = static_cast<ClipItem*>(itemList.at(0));
ItemInfo info;
info.track = item->track();
ClipItem *transitionClip = NULL;
......@@ -2630,7 +2630,7 @@ void CustomTrackView::slotAddTransitionToSelectedClips(QDomElement transition)
}
} else for (int i = 0; i < itemList.count(); ++i) {
if (itemList.at(i)->type() == AVWidget) {
ClipItem *item = (ClipItem *) itemList.at(i);
ClipItem *item = static_cast<ClipItem*>(itemList.at(i));
ItemInfo info;
info.startPos = item->startPos();
info.endPos = info.startPos + GenTime(65, m_document->fps());
......@@ -2877,7 +2877,7 @@ void CustomTrackView::dropEvent(QDropEvent * event)
groupSelectedItems(items);
} else if (items.count() == 1) {
m_dragItem = static_cast <AbstractClipItem *>(items.at(0));
emit clipItemSelected((ClipItem*) m_dragItem, false);
emit clipItemSelected(static_cast<ClipItem*>(m_dragItem), false);
}
m_document->renderer()->refreshIfActive();
event->setDropAction(Qt::MoveAction);
......@@ -3251,7 +3251,7 @@ void CustomTrackView::lockTrack(int ix, bool lock, bool requestUpdate)
QList<QGraphicsItem *> selection = m_scene->items(0, ix * m_tracksHeight + m_tracksHeight / 2, sceneRect().width(), m_tracksHeight / 2 - 2);
for (int i = 0; i < selection.count(); ++i) {
if (selection.at(i)->type() == GroupWidget && (AbstractGroupItem *)selection.at(i) != m_selectionGroup) {
if (selection.at(i)->type() == GroupWidget && static_cast<AbstractGroupItem*>(selection.at(i)) != m_selectionGroup) {
if (selection.at(i)->parentItem() && m_selectionGroup) {
selection.removeAll((QGraphicsItem*)m_selectionGroup);
resetSelectionGroup();
......@@ -3283,7 +3283,7 @@ void CustomTrackView::lockTrack(int ix, bool lock, bool requestUpdate)
hasClipOnTrack = true;
}
if (changeGroupLock && hasClipOnTrack)
((AbstractGroupItem*)selection.at(i))->setItemLocked(lock);
static_cast<AbstractGroupItem*>(selection.at(i))->setItemLocked(lock);
} else if((selection.at(i)->type() == AVWidget || selection.at(i)->type() == TransitionWidget)) {
if (selection.at(i)->parentItem()) {
if (selection.at(i)->parentItem() == m_selectionGroup) {
......@@ -4903,7 +4903,7 @@ void CustomTrackView::moveGroup(QList<ItemInfo> startClip, QList<ItemInfo> start
//grp->moveBy(offset.frames(m_document->fps()), trackOffset *(qreal) m_tracksHeight);
/*m_document->clipManager()->removeGroup(grp);
m_scene->destroyItemGroup(grp);*/
AbstractGroupItem *group = (AbstractGroupItem*) children.at(i);
AbstractGroupItem *group = static_cast<AbstractGroupItem*>(children.at(i));
if (!groupList.contains(group)) groupList.append(group);
children.removeAll(children.at(i));
--i;
......@@ -6025,7 +6025,7 @@ QList<ItemInfo> CustomTrackView::findId(const QString &clipId)
QList<QGraphicsItem *> itemList = items();
for (int i = 0; i < itemList.count(); ++i) {
if (itemList.at(i)->type() == AVWidget) {
ClipItem *item = (ClipItem *)itemList.at(i);
ClipItem *item = static_cast<ClipItem*>(itemList.at(i));
if (item->clipProducer() == clipId)
matchingInfo << item->info();
}
......@@ -7172,7 +7172,7 @@ QStringList CustomTrackView::selectedClips() const
QList<QGraphicsItem *> selection = m_scene->selectedItems();
for (int i = 0; i < selection.count(); ++i) {
if (selection.at(i)->type() == AVWidget) {
ClipItem *item = (ClipItem *)selection.at(i);
ClipItem *item = static_cast<ClipItem*>(selection.at(i));
clipIds << item->clipProducer();
}
}
......@@ -7185,7 +7185,7 @@ QList<ClipItem *> CustomTrackView::selectedClipItems() const
QList<QGraphicsItem *> selection = m_scene->selectedItems();
for (int i = 0; i < selection.count(); ++i) {
if (selection.at(i)->type() == AVWidget) {
clips.append((ClipItem *)selection.at(i));
clips.append(static_cast<ClipItem*>(selection.at(i)));
}
}
return clips;
......@@ -7374,9 +7374,9 @@ void CustomTrackView::setTipAnimation(AbstractClipItem *clip, OperationType mode
((QGraphicsEllipseItem*) m_visualTip)->setBrush(m_tipColor);
((QGraphicsEllipseItem*) m_visualTip)->setPen(m_tipPen);
if (mode == FadeIn)
m_visualTip->setPos(rect.x() + ((ClipItem *) clip)->fadeIn(), rect.y());
m_visualTip->setPos(rect.x() + static_cast<ClipItem*>(clip)->fadeIn(), rect.y());
else
m_visualTip->setPos(rect.right() - ((ClipItem *) clip)->fadeOut(), rect.y());
m_visualTip->setPos(rect.right() - static_cast<ClipItem*>(clip)->fadeOut(), rect.y());
m_animation->setScaleAt(.5, 2, 2);
break;
......@@ -7723,7 +7723,7 @@ void CustomTrackView::slotImportClipKeyframes(GraphicsRectItem type)
QList<QGraphicsItem *> children = m_selectionGroup->childItems();
for (int i = 0; i < children.count(); ++i) {
if (children.at(i)->type() == AVWidget) {
item = (ClipItem*) children.at(i);
item = static_cast<ClipItem*>(children.at(i));
break;
}
}
......
......@@ -620,10 +620,10 @@ void ParameterContainer::slotCollectAllParameters()
DoubleParameterWidget *doubleparam = (DoubleParameterWidget*)m_valueItems.value(paramName);
setValue = locale.toString(doubleparam->getValue());
} else if (type == "list") {
KComboBox *box = ((Listval*)m_valueItems.value(paramName))->list;
KComboBox *box = static_cast<Listval*>(m_valueItems.value(paramName))->list;
setValue = box->itemData(box->currentIndex()).toString();
} else if (type == "bool") {
QCheckBox *box = ((Boolval*)m_valueItems.value(paramName))->checkBox;
QCheckBox *box = static_cast<Boolval*>(m_valueItems.value(paramName))->checkBox;
setValue = box->checkState() == Qt::Checked ? "1" : "0" ;
} else if (type == "color") {
ChooseColorWidget *choosecolor = ((ChooseColorWidget*)m_valueItems.value(paramName));
......@@ -700,7 +700,7 @@ void ParameterContainer::slotCollectAllParameters()
setValue = widget->getSpline();
#endif
} else if (type == "wipe") {
Wipeval *wp = (Wipeval*)m_valueItems.value(paramName);
Wipeval *wp = static_cast<Wipeval*>(m_valueItems.value(paramName));
wipeInfo info;
if (wp->start_left->isChecked())
info.start = LEFT;
......@@ -742,11 +742,11 @@ void ParameterContainer::slotCollectAllParameters()
else if (pa.hasAttribute("intimeline"))
pa.setAttribute("intimeline", "0");
} else if (type == "url") {
KUrlRequester *req = ((Urlval*)m_valueItems.value(paramName))->urlwidget;
KUrlRequester *req = static_cast<Urlval*>(m_valueItems.value(paramName))->urlwidget;
setValue = req->url().path();
} else if (type == "keywords"){
QLineEdit *line = ((Keywordval*)m_valueItems.value(paramName))->lineeditwidget;
QComboBox *combo = ((Keywordval*)m_valueItems.value(paramName))->comboboxwidget;
QLineEdit *line = static_cast<Keywordval*>(m_valueItems.value(paramName))->lineeditwidget;
QComboBox *combo = static_cast<Keywordval*>(m_valueItems.value(paramName))->comboboxwidget;
if(combo->currentIndex())
{
QString comboval = combo->itemData(combo->currentIndex()).toString();
......@@ -755,7 +755,7 @@ void ParameterContainer::slotCollectAllParameters()
}
setValue = line->text();
} else if (type == "fontfamily") {
QFontComboBox* fontfamily = ((Fontval*)m_valueItems.value(paramName))->fontfamilywidget;
QFontComboBox* fontfamily = static_cast<Fontval*>(m_valueItems.value(paramName))->fontfamilywidget;
setValue = fontfamily->currentFont().family();
}
if (!setValue.isNull())
......
......@@ -207,10 +207,10 @@ void JogShuttle::customEvent(QEvent* e)
QEvent::Type type = e->type();
if (type == MediaCtrlEvent::Key) {
MediaCtrlEvent* mev = (MediaCtrlEvent*)e;
MediaCtrlEvent* mev = static_cast<MediaCtrlEvent*>(e);
emit button(mev->value());
} else if (type == MediaCtrlEvent::Jog) {
MediaCtrlEvent* mev = (MediaCtrlEvent*)e;
MediaCtrlEvent* mev = static_cast<MediaCtrlEvent*>(e);
int value = mev->value();
if (value < 0) {
......@@ -219,7 +219,7 @@ void JogShuttle::customEvent(QEvent* e)
emit jogForward();
}
} else if (type == MediaCtrlEvent::Shuttle) {
MediaCtrlEvent* mev = (MediaCtrlEvent*)e;
MediaCtrlEvent* mev = static_cast<MediaCtrlEvent*>(e);
emit shuttlePos(mev->value());
}
}
......
......@@ -276,8 +276,8 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap<QString, QString>& map
m_configSdl.kcfg_external_display->setEnabled(false);
}
double dvgrabVersion = 0;
if (!KdenliveSettings::dvgrab_path().isEmpty()) {
double dvgrabVersion = 0;
QProcess *versionCheck = new QProcess;
versionCheck->setProcessChannelMode(QProcess::MergedChannels);
versionCheck->start("dvgrab", QStringList() << "--version");
......
......@@ -226,7 +226,6 @@ QImage KThumb::getFrame(Mlt::Frame *frame, int frameWidth, int displayWidth, int
//const uchar* imagedata = frame->get_image(format, ow, oh);
//QImage image(imagedata, ow, oh, QImage::Format_ARGB32_Premultiplied);
if (!image.isNull()) {
if (ow > (2 * displayWidth)) {
// there was a scaling problem, do it manually
......
......@@ -165,7 +165,7 @@ int AudioEnvelope::startPos() const
return m_startpos;
}
void AudioEnvelope::normalizeEnvelope(bool clampTo0)
void AudioEnvelope::normalizeEnvelope(bool /*clampTo0*/)
{
if (m_envelope == NULL && !m_future.isRunning()) {
m_future = QtConcurrent::run(this, &AudioEnvelope::loadEnvelope);
......
......@@ -18,7 +18,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
/*
Some definitions that allow real or complex filtering
*/
#ifdef REAL_FASTFIR
/*REAL_FASTFIR*/
#define MIN_FFT_LEN 2048
#include "kiss_fftr.h"
typedef kiss_fft_scalar kffsamp_t;
......@@ -26,14 +26,6 @@ typedef kiss_fftr_cfg kfcfg_t;
#define FFT_ALLOC kiss_fftr_alloc
#define FFTFWD kiss_fftr
#define FFTINV kiss_fftri
#else
#define MIN_FFT_LEN 1024
typedef kiss_fft_cpx kffsamp_t;
typedef kiss_fft_cfg kfcfg_t;
#define FFT_ALLOC kiss_fft_alloc
#define FFTFWD kiss_fft
#define FFTINV kiss_fft
#endif
typedef struct kiss_fastfir_state *kiss_fastfir_cfg;
......@@ -78,7 +70,7 @@ kiss_fastfir_cfg kiss_fastfir_alloc(
if (pnfft)
nfft=*pnfft;
if (nfft<=0) {
if (nfft==0) {
/* determine fft size as next power of two at least 2x
the impulse response length*/
i=n_imp_resp-1;
......@@ -86,19 +78,13 @@ kiss_fastfir_cfg kiss_fastfir_alloc(
do{
nfft<<=1;
}while (i>>=1);
#ifdef MIN_FFT_LEN
if ( nfft < MIN_FFT_LEN )
nfft=MIN_FFT_LEN;
#endif
}
if (pnfft)
*pnfft = nfft;
#ifdef REAL_FASTFIR
n_freq_bins = nfft/2 + 1;
#else
n_freq_bins = nfft;
#endif
/*fftcfg*/
FFT_ALLOC (nfft, 0, NULL, &len_fftcfg);
memneeded += len_fftcfg;
......@@ -244,7 +230,7 @@ size_t kiss_fastfir(
}
}
#ifdef FAST_FILT_UTIL
/*FAST_FILT_UTIL*/
#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>
......@@ -285,12 +271,12 @@ void direct_file_filter(
do {
nread = fread (buf, sizeof (kffsamp_t), nbuf, fin);
if (nread <= 0)
if (nread == 0)
break;
for (k = 0; k < nread; ++k) {
tmph = imp_resp+nlag;
#ifdef REAL_FASTFIR
/*REAL_FASTFIR*/
# ifdef USE_SIMD
outval = _mm_set1_ps(0);
#else
......@@ -301,26 +287,6 @@ void direct_file_filter(
for (tap = 0; tap < oldestlag; ++tap)
outval += circbuf[tap] * *tmph--;
outval += buf[k] * *tmph;
#else
# ifdef USE_SIMD
outval.r = outval.i = _mm_set1_ps(0);
#else
outval.r = outval.i = 0;
#endif
for (tap = oldestlag; tap < nlag; ++tap){
C_MUL(tmp,circbuf[tap],*tmph);
--tmph;
C_ADDTO(outval,tmp);
}
for (tap = 0; tap < oldestlag; ++tap) {
C_MUL(tmp,circbuf[tap],*tmph);
--tmph;
C_ADDTO(outval,tmp);
}
C_MUL(tmp,buf[k],*tmph);
C_ADDTO(outval,tmp);
#endif
circbuf[oldestlag++] = buf[k];
buf[k] = outval;
......@@ -463,6 +429,7 @@ int main(int argc,char**argv)
if (fout!=stdout) fclose(fout);
if (fin!=stdin) fclose(fin);
free(h);
return 0;
}
#endif
......@@ -137,7 +137,7 @@ void transform_signal(void)
CHECKNULL( fbuf=(kiss_fft_cpx*)malloc(sizeof(kiss_fft_cpx)*nfreqs ) );
CHECKNULL( mag2buf=(float*)malloc(sizeof(float)*nfreqs ) );
memset(mag2buf,0,sizeof(mag2buf)*nfreqs);
memset(mag2buf,0,sizeof(float)*nfreqs);
while (1) {
if (stereo) {
......@@ -168,9 +168,11 @@ void transform_signal(void)
mag2buf[i] += fbuf[i].r * fbuf[i].r + fbuf[i].i * fbuf[i].i;
if (++avgctr == navg) {
float *new_vals;
avgctr=0;
++nrows;
vals = (float*)realloc(vals,sizeof(float)*nrows*nfreqs);
new_vals = (float*)realloc(vals,sizeof(float)*nrows*nfreqs);
if(new_vals == NULL) return; else vals=new_vals;
float eps = 1;
for (i=0;i<nfreqs;++i)
vals[(nrows - 1) * nfreqs + i] = 10 * log10 ( mag2buf[i] / navg + eps );
......@@ -188,7 +190,7 @@ void transform_signal(void)
static
void make_png(void)
{
png_bytepp row_pointers=NULL;
png_bytepp row_pointers=NULL, new_row_pointers;
rgb_t * row_data=NULL;
int i;
int nfreqs = nfft/2+1;
......@@ -208,6 +210,8 @@ void make_png(void)
cpx2pixels(row_data, vals, nfreqs*nrows );
row_pointers = realloc(row_pointers, nrows*sizeof(png_bytep));
if(new_row_pointers == NULL) return; else row_pointers=new_row_pointers;
for (i=0;i<nrows;++i) {
row_pointers[i] = (png_bytep)(row_data + i*nfreqs);
}
......
......@@ -201,12 +201,10 @@ int media_ctrl_get_keys_count(struct media_ctrl *ctrl)
void translate_contour_hid_event(struct media_ctrl *ctrl, struct input_event *ev, struct media_ctrl_event *me)
{
int lv, cv;
me->type = 0;
if (ev->type == EV_REL) {
int cv;
/* First check the outer dial */
if (ev->code == REL_WHEEL) {
......@@ -227,6 +225,7 @@ void translate_contour_hid_event(struct media_ctrl *ctrl, struct input_event *ev
me->name = _shuttle_name;
} else if (ev->code == REL_DIAL) {
int lv;
if ( ctrl->lastval == -1 ) ctrl->lastval = ev->value;
lv = ctrl->lastval;
......
......@@ -147,6 +147,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
m_projectList(NULL),
m_effectList(NULL),
m_effectStack(NULL),
m_clipMonitor(NULL),
m_projectMonitor(NULL),
m_recMonitor(NULL),
......@@ -444,11 +445,11 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
/*ScriptingPart* sp = new ScriptingPart(this, QStringList());
guiFactory()->addClient(sp);*/
QMenu *trackMenu = (QMenu*)(factory()->container("track_menu", this));
QMenu *trackMenu = static_cast<QMenu*>(factory()->container("track_menu", this));
if (trackMenu) trackMenu->addActions(m_tracksActionCollection->actions());
QMenu *saveLayout = (QMenu*)(factory()->container("layout_save_as", this));
QMenu *saveLayout = static_cast<QMenu*>(factory()->container("layout_save_as", this));
if (saveLayout)
connect(saveLayout, SIGNAL(triggered(QAction*)), this, SLOT(slotSaveLayout(QAction*)));
......@@ -554,7 +555,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
m_timelineContextClipMenu->addAction(actionCollection()->action("paste_effects"));
m_timelineContextClipMenu->addSeparator();
QMenu *markersMenu = (QMenu*)(factory()->container("marker_menu", this));
QMenu *markersMenu = static_cast<QMenu*>(factory()->container("marker_menu", this));
m_timelineContextClipMenu->addMenu(markersMenu);
m_timelineContextClipMenu->addSeparator();
m_timelineContextClipMenu->addMenu(m_transitionsMenu);
......@@ -1807,7 +1808,7 @@ void MainWindow::setStatusBarStyleSheet(const QPalette &p)