UINT8* encodeMcu( UINT32 imageFormat, UINT8 *outputBuffer ) { levelShift(Y1); dct(Y1); quantization(Y1, ILqt); outputBuffer = huffman(1, outputBuffer); #if 0 if (imageFormat != GRAY) { levelShift(CB); dct(CB); quantization(CB, ICqt); outputBuffer = huffman(2, outputBuffer); levelShift(CR); dct(CR); quantization(CR, ICqt); outputBuffer = huffman(3, outputBuffer); } #endif //0 return outputBuffer; }
/** * @brief Set the position of the point that is being dragged. * Calling this function will also automatically set m_dragging to true, * which applyDragValue() have to be called to m_dragging. * @param the time(x position) of the point being dragged * @param the value(y position) of the point being dragged * @param true to snip x position * @return */ MidiTime AutomationPattern::setDragValue( const MidiTime & time, const float value, const bool quantPos, const bool controlKey ) { if( m_dragging == false ) { MidiTime newTime = quantPos ? Note::quantized( time, quantization() ) : time; this->removeValue( newTime ); m_oldTimeMap = m_timeMap; m_dragging = true; } //Restore to the state before it the point were being dragged m_timeMap = m_oldTimeMap; for( timeMap::const_iterator it = m_timeMap.begin(); it != m_timeMap.end(); ++it ) { generateTangents( it, 3 ); } return this->putValue( time, value, quantPos, controlKey ); }
void AutomationPattern::removeValue( const MidiTime & _time, const bool _quant_pos ) { cleanObjects(); MidiTime newTime = _quant_pos ? Note::quantized( _time, quantization() ) : _time; m_timeMap.remove( newTime ); m_tangents.remove( newTime ); timeMap::const_iterator it = m_timeMap.lowerBound( newTime ); if( it != m_timeMap.begin() ) { --it; } generateTangents(it, 3); if( getTrack() && getTrack()->type() == Track::HiddenAutomationTrack ) { changeLength( length() ); } emit dataChanged(); }
MidiTime AutomationPattern::putValue( const MidiTime & _time, const float _value, const bool _quant_pos ) { cleanObjects(); MidiTime newTime = _quant_pos ? Note::quantized( _time, quantization() ) : _time; m_timeMap[newTime] = _value; timeMap::const_iterator it = m_timeMap.find( newTime ); if( it != m_timeMap.begin() ) { --it; } generateTangents(it, 3); // we need to maximize our length in case we're part of a hidden // automation track as the user can't resize this pattern if( getTrack() && getTrack()->type() == Track::HiddenAutomationTrack ) { changeLength( length() ); } emit dataChanged(); return newTime; }
MidiTime AutomationPattern::putValue( const MidiTime & time, const float value, const bool quantPos, const bool ignoreSurroundingPoints ) { cleanObjects(); MidiTime newTime = quantPos ? Note::quantized( time, quantization() ) : time; m_timeMap[ newTime ] = value; timeMap::const_iterator it = m_timeMap.find( newTime ); // Remove control points that are covered by the new points // quantization value. Control Key to override if( ! ignoreSurroundingPoints ) { for( int i = newTime + 1; i < newTime + quantization(); ++i ) { AutomationPattern::removeValue( i ); } } if( it != m_timeMap.begin() ) { --it; } generateTangents( it, 3 ); // we need to maximize our length in case we're part of a hidden // automation track as the user can't resize this pattern if( getTrack() && getTrack()->type() == Track::HiddenAutomationTrack ) { updateLength(); } emit dataChanged(); return newTime; }
int main() { freopen("Lena.raw", "rb", stdin); int r, c; for (r = 0; r < N; r++) for (c = 0; c < N; c++) scanf("%c", &pic[r][c]); init(); DCT(); quantization(); IDCT(); MSE(); return 0; }
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Run filter on the image, transforming I1 to I2. // Overrides ImageFilter::applyFilter(). // Return 1 for success, 0 for failure. // bool Quantization::applyFilter(ImagePtr I1, ImagePtr I2) { // error checking if (I1.isNull()) return 0; // get value int levels = m_slider->value(); // apply filter quantization(I1, levels, I2); return 1; }
//----------------------------------------------------------------------------- void module(unsigned char *imagedata, int image_height, int image_width) { int i; unsigned char (*cin)[size]=new unsigned char [size][size]; double (*fin)[Nray]=new double [Nview][Nray]; //double count=0,count2=0,count3=0,count4=0,count5=0; //double sum=0,min=1.e10; for(i=0; i<1024; i++) { timage[i]=(COMPLEX *) calloc(1024,sizeof(COMPLEX)); } for(i=0; i<512; i++) { inimage[i]=(COMPLEX *) calloc(512,sizeof(COMPLEX)); image[i]=(COMPLEX *) calloc(512,sizeof(COMPLEX)); } // 2000.10.11 - [email protected] for(i=0; i<size; i++) for(int j=0; j<size; j++) cin[i][j] = imagedata[i*image_width+j]; radon(cin,fin,Nray,Nview); //dc=(dc)*(dc); // 2001.01.31 - [email protected] feature(fin,vec,dvec); // feature extraction for(i=0; i<1024; i++) free(timage[i]); for(i=0; i<512; i++) { free(inimage[i]); free(image[i]); } delete [] fin; delete [] cin; ////////////////////////////////////////////// // quantization of features min max extract.// ////////////////////////////////////////////// quantization(); }