Exemple #1
0
BCGFilter::BCGFilter(QObject* const parent)
    : DImgThreadedFilter(parent, "BCGFilter"),
      d(new Private)
{
    reset();
    initFilter();
}
FreeRotationFilter::FreeRotationFilter(DImg* orgImage, QObject* parent, const FreeRotationContainer& settings)
    : DImgThreadedFilter(orgImage, parent, "FreeRotation"),
      d(new FreeRotationFilterPriv)
{
    d->settings = settings;
    initFilter();
}
Exemple #3
0
HSLFilter::HSLFilter(QObject* parent)
    : DImgThreadedFilter(parent),
      d(new HSLFilterPriv)
{
    reset();
    initFilter();
}
Exemple #4
0
SharpenFilter::SharpenFilter(DImg* const orgImage, QObject* const parent, double radius, double sigma)
    : DImgThreadedFilter(orgImage, parent, QLatin1String("Sharpen"))
{
    m_radius = radius;
    m_sigma  = sigma;
    initFilter();
}
Exemple #5
0
BorderFilter::BorderFilter(DImg* image, QObject* const parent, const BorderContainer& settings)
    : DImgThreadedFilter(image, parent, QLatin1String("Border")),
      d(new Private)
{
    d->settings = settings;
    initFilter();
}
Exemple #6
0
WBFilter::WBFilter(DImg* orgImage, QObject* parent, const WBContainer& settings)
    : DImgThreadedFilter(orgImage, parent, "WBFilter"),
      d(new WBFilterPriv)
{
    m_settings = settings;
    initFilter();
}
Exemple #7
0
FilmGrainFilter::FilmGrainFilter(DImg* const orgImage, QObject* const parent, const FilmGrainContainer& settings)
    : DImgThreadedFilter(orgImage, parent, QLatin1String("FilmGrain")),
      d(new Private)
{
    d->settings = settings;
    initFilter();
}
Exemple #8
0
bool Filter::filter(upx_byte *buf_, unsigned buf_len_)
{
    initFilter(this, buf_, buf_len_);

    const FilterImp::FilterEntry * const fe = FilterImp::getFilter(id);
    if (fe == NULL)
        throwInternalError("filter-1");
    if (fe->id == 0)
        return true;
    if (buf_len < fe->min_buf_len)
        return false;
    if (fe->max_buf_len && buf_len > fe->max_buf_len)
        return false;
    if (!fe->do_filter)
        throwInternalError("filter-2");

    // save checksum
    this->adler = 0;
    if (clevel != 1)
        this->adler = upx_adler32(this->buf, this->buf_len);

    //printf("filter: %02x %p %d\n", this->id, this->buf, this->buf_len);
    //OutputFile::dump("filter.dat", buf, buf_len);
    int r = (*fe->do_filter)(this);
    //printf("filter: %02x %d\n", fe->id, r);
    if (r > 0)
        throwFilterException();
    if (r == 0)
        return true;
    return false;
}
Exemple #9
0
void Filter::unfilter(upx_byte *buf_, unsigned buf_len_, bool verify_checksum)
{
    initFilter(this, buf_, buf_len_);

    const FilterImp::FilterEntry * const fe = FilterImp::getFilter(id);
    if (fe == NULL)
        throwInternalError("unfilter-1");
    if (fe->id == 0)
        return;
    if (buf_len < fe->min_buf_len)
        return;
    if (fe->max_buf_len && buf_len > fe->max_buf_len)
        return;
    if (!fe->do_unfilter)
        throwInternalError("unfilter-2");

    //printf("unfilter: %02x %p %d\n", this->id, this->buf, this->buf_len);
    int r = (*fe->do_unfilter)(this);
    //printf("unfilter: %02x %d\n", fe->id, r);
    if (r != 0)
        throwInternalError("unfilter-3");
    //OutputFile::dump("unfilter.dat", buf, buf_len);

    // verify checksum
    if (verify_checksum && clevel != 1)
    {
        if (this->adler != upx_adler32(this->buf, this->buf_len))
            throwInternalError("unfilter-4");
    }
}
Exemple #10
0
BWSepiaFilter::BWSepiaFilter(DImg* const orgImage, QObject* const parent, const BWSepiaContainer& settings)
    : DImgThreadedFilter(orgImage, parent, QLatin1String("BWSepiaFilter")),
      d(new Private)
{
    d->settings = settings;
    initFilter();
}
// figure processing latency by doing 'dry runs' of filterBuffer()
bigtime_t StepMotionBlurFilter::calcProcessingLatency() {
	PRINT(("StepMotionBlurFilter::calcProcessingLatency()\n"));
	
	if(m_output.destination == media_destination::null) {
		PRINT(("\tNot connected.\n"));
		return 0LL;
	}
	
	// allocate a temporary buffer group
	BBufferGroup* pTestGroup = new BBufferGroup(m_output.format.u.raw_video.display.line_width * m_output.format.u.raw_video.display.line_count *4, 1);
	
	// fetch a buffer
	BBuffer* pBuffer = pTestGroup->RequestBuffer(m_output.format.u.raw_video.display.line_width * m_output.format.u.raw_video.display.line_count * 4);
	ASSERT(pBuffer);
	
	pBuffer->Header()->type = B_MEDIA_RAW_VIDEO;
	pBuffer->Header()->size_used = m_output.format.u.raw_video.display.line_width * m_output.format.u.raw_video.display.line_count * 4;
	
	// run the test
	bigtime_t preTest = system_time();
	filterBuffer(pBuffer);
	bigtime_t elapsed = system_time()-preTest;
	
	// clean up
	pBuffer->Recycle();
	delete pTestGroup;

	// reset filter state
	initFilter();

	return elapsed;
}
Exemple #12
0
bool Filter::scan(const upx_byte *buf_, unsigned buf_len_)
{
    // Note: must use const_cast here. This is fine as the scan
    //   implementations (fe->do_scan) actually don't change the buffer.
    upx_byte *b = const_cast<upx_byte *>(buf_);
    initFilter(this, b, buf_len_);

    const FilterImp::FilterEntry * const fe = FilterImp::getFilter(id);
    if (fe == NULL)
        throwInternalError("scan-1");
    if (fe->id == 0)
        return true;
    if (buf_len < fe->min_buf_len)
        return false;
    if (fe->max_buf_len && buf_len > fe->max_buf_len)
        return false;
    if (!fe->do_scan)
        throwInternalError("scan-2");

    //printf("filter: %02x %p %d\n", this->id, this->buf, this->buf_len);
    int r = (*fe->do_scan)(this);
    //printf("filter: %02x %d\n", fe->id, r);
    if (r > 0)
        throwFilterException();
    if (r == 0)
        return true;
    return false;
}
Exemple #13
0
// figure processing latency by doing 'dry runs' of filterBuffer()
bigtime_t FlangerNode::calcProcessingLatency() {
	PRINT(("FlangerNode::calcProcessingLatency()\n"));

	if(m_output.destination == media_destination::null) {
		PRINT(("\tNot connected.\n"));
		return 0LL;
	}

	// allocate a temporary buffer group
	BBufferGroup* pTestGroup = new BBufferGroup(
		m_output.format.u.raw_audio.buffer_size, 1);

	// fetch a buffer
	BBuffer* pBuffer = pTestGroup->RequestBuffer(
		m_output.format.u.raw_audio.buffer_size);
	ASSERT(pBuffer);

	pBuffer->Header()->type = B_MEDIA_RAW_AUDIO;
	pBuffer->Header()->size_used = m_output.format.u.raw_audio.buffer_size;

	// run the test
	bigtime_t preTest = system_time();
	filterBuffer(pBuffer);
	bigtime_t elapsed = system_time()-preTest;

	// clean up
	pBuffer->Recycle();
	delete pTestGroup;

	// reset filter state
	initFilter();

	return elapsed;
}
Exemple #14
0
AntiVignettingFilter::AntiVignettingFilter(DImg* const orgImage, QObject* const parent,
                                           const AntiVignettingContainer& settings)
    : DImgThreadedFilter(orgImage, parent, QLatin1String("AntiVignettingFilter")),
      m_settings(settings)
{
    initFilter();
}
Exemple #15
0
BCGFilter::BCGFilter(DImg* const orgImage, QObject* const parent, const BCGContainer& settings)
    : DImgThreadedFilter(orgImage, parent, "BCGFilter"),
      d(new Private)
{
    d->settings = settings;
    reset();
    initFilter();
}
Exemple #16
0
SharpenFilter::SharpenFilter(QObject* const parent)
    : DImgThreadedFilter(parent)
{
    m_radius = 0.0;
    m_sigma  = 1.0;

    initFilter();
}
Exemple #17
0
TextureFilter::TextureFilter(DImg* orgImage, QObject* parent, int blendGain, const QString& texturePath)
    : DImgThreadedFilter(orgImage, parent, "Texture")
{
    m_blendGain   = blendGain;
    m_texturePath = texturePath;

    initFilter();
}
Exemple #18
0
LevelsFilter::LevelsFilter(const LevelsContainer& settings, DImgThreadedFilter* const master,
                           const DImg& orgImage, DImg& destImage, int progressBegin, int progressEnd)
    : DImgThreadedFilter(master, orgImage, destImage, progressBegin, progressEnd, QLatin1String("LevelsFilter"))
{
    m_settings = settings;
    initFilter();
    destImage = m_destImage;
}
Exemple #19
0
NRFilter::NRFilter(DImg* const orgImage, QObject* const parent, const NRContainer& settings)
    : DImgThreadedFilter(orgImage, parent, "NRFilter"),
      d(new Private)
{
    d->settings = settings;

    initFilter();
}
RawProcessingFilter::RawProcessingFilter(DImg* orgImage, QObject* parent,
                                         const DRawDecoding& settings, const QString& name)
    : DImgThreadedFilter(orgImage, parent, name),
      m_observer(0)
{
    setSettings(settings);
    initFilter();
}
Exemple #21
0
TonalityFilter::TonalityFilter(DImg* const orgImage,
                               QObject* const parent,
                               const TonalityContainer& settings)
    : DImgThreadedFilter(orgImage, parent, QLatin1String("TonalityFilter")),
    m_settings(settings)
{
    initFilter();
}
Exemple #22
0
//***************************************************************************
Kwave::PitchShiftFilter::PitchShiftFilter()
    :Kwave::SampleSource(0), m_buffer(blockSize()),
     m_speed(1.0), m_frequency(0.5), m_dbuffer(),
     m_lfopos(0), m_b1pos(0), m_b2pos(0), m_b1inc(0), m_b2inc(0),
     m_b1reset(false), m_b2reset(false), m_dbpos(0)
{
    initFilter();
}
Exemple #23
0
//***************************************************************************
void Kwave::PitchShiftFilter::setFrequency(const QVariant freq)
{
    float new_freq = QVariant(freq).toFloat();
    if (qFuzzyCompare(new_freq, m_frequency)) return; // nothing to do

    m_frequency = new_freq;
    initFilter();
}
Exemple #24
0
//***************************************************************************
void Kwave::PitchShiftFilter::setSpeed(const QVariant speed)
{
    float new_speed = QVariant(speed).toFloat();
    if (qFuzzyCompare(new_speed, m_speed)) return; // nothing to do

    m_speed = new_speed;
    initFilter();
}
QgsRuleBasedRendererV2::Rule::Rule( QgsSymbolV2* symbol, int scaleMinDenom, int scaleMaxDenom, QString filterExp, QString label, QString description , bool elseRule )
    : mParent( NULL ), mSymbol( symbol )
    , mScaleMinDenom( scaleMinDenom ), mScaleMaxDenom( scaleMaxDenom )
    , mFilterExp( filterExp ), mLabel( label ), mDescription( description )
    , mElseRule( elseRule ), mFilter( NULL )
{
  initFilter();
}
Exemple #26
0
void Tables::initFiltCoeff(float samplerate) {
	for (int j = 0; j < FILTERGRAN; j++) {
		for (int res = 0; res < 31; res++) {
			float tres = resonanceFactor[res];
			initFilter((float)samplerate, (((float)(j+1.0)/FILTERGRAN)) * ((float)samplerate/2), filtCoeff[j][res], tres);
		}
	}
}
Exemple #27
0
HSLFilter::HSLFilter(DImg* orgImage, QObject* parent, const HSLContainer& settings)
    : DImgThreadedFilter(orgImage, parent, "HSLFilter"),
      d(new HSLFilterPriv)
{
    d->settings = settings;
    reset();
    initFilter();
}
Exemple #28
0
InvertFilter::InvertFilter(DImgThreadedFilter* const parentFilter,
                           const DImg& orgImage, DImg& destImage,
                           int progressBegin, int progressEnd)
    : DImgThreadedFilter(parentFilter, orgImage, destImage, progressBegin, progressEnd,
                         parentFilter->filterName() + QLatin1String(": InvertFilter"))
{
    initFilter();
    destImage = m_destImage;
}
Exemple #29
0
//***************************************************************************
void Kwave::NotchFilter::setBandwidth(const QVariant bw)
{
    double new_bw = QVariant(bw).toDouble();
    if (qFuzzyCompare(new_bw, m_f_bw)) return; // nothing to do

    m_f_bw = new_bw;
    initFilter();
    setfilter_peaknotch2(m_f_cutoff, m_f_bw);
}
Exemple #30
0
CharcoalFilter::CharcoalFilter(DImg* const orgImage, QObject* const parent, double pencil, double smooth)
    : DImgThreadedFilter(orgImage, parent, QLatin1String("Charcoal")),
      d(new Private)
{
    d->pencil = pencil;
    d->smooth = smooth;

    initFilter();
}