Example #1
0
short
IsolatedScalarUDF::generateShape(CollHeap * c, char * buf,
                           NAString * shapeStr)
{
  Space *space = (Space *)c;
  char mybuf[100];

  sprintf (mybuf, "isolated_scalar_udf");
  outputBuffer (space, buf, mybuf, shapeStr);

  if (getRoutineDesc() &&
      getRoutineDesc()->getNARoutine() &&
      getRoutineDesc()->getNARoutine()->getRoutineName())
  {
    NAString fmtdStr;
    ToQuotedString(fmtdStr, getRoutineDesc()->getNARoutine()->
                             getRoutineName()->getQualifiedNameObj().
                             getQualifiedNameAsAnsiString().data());
    snprintf (mybuf, 100, "(scalar_udf %s", fmtdStr.data());
    outputBuffer (space, buf, mybuf, shapeStr);
    if (getRoutineDesc()->isUUDFRoutine() &&
        getRoutineDesc()->getActionNARoutine() &&
        getRoutineDesc()->getActionNARoutine()->getActionName())
    {
      ToQuotedString(fmtdStr, getRoutineDesc()->getActionNARoutine()->
                               getActionName()->data());
      snprintf (mybuf, 100, ", udf_action %s", fmtdStr.data());
      outputBuffer (space, buf, mybuf, shapeStr);
    }
    strcpy(mybuf, ")");
    outputBuffer (space, buf, mybuf, shapeStr);
  }
  return 0;
}
Example #2
0
short PhysSample::generateShape(CollHeap * c, char * buf, NAString * shapeStr)
{
  Space * space = (Space *)c;
  char mybuf[100];

  sprintf(mybuf, "sample(");
  outputBuffer(space, buf, mybuf, shapeStr);

  child(0)->generateShape(space, buf, shapeStr);

  sprintf(mybuf, ")");
  outputBuffer(space, buf, mybuf, shapeStr);

  return 0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifEclipseDataTableFormatter::tableCompleted()
{
    outputBuffer();

    // Output an "empty" line after a finished table
    m_out << m_tableRowPrependText << m_tableRowAppendText << "\n";
}
  //---------------------------------------------------------------
  void 
  FilterYUV411toYUV::process()
  {
    unsigned char const * src_img = inputBuffer();
    unsigned char * tgt_img = outputBuffer();
    int srcImgSize = getImageSize(inputFormat_);

    for (int i = 0; i < srcImgSize; i += 6) {
      register int u  = src_img[i];
      register int y0 = src_img[i+1];
      register int y1 = src_img[i+2];
      register int v  = src_img[i+3];
      register int y2 = src_img[i+4];
      register int y3 = src_img[i+5];
      
      *(tgt_img++) = y0;
      *(tgt_img++) = u;
      *(tgt_img++) = v;
      
      *(tgt_img++) = y1;
      *(tgt_img++) = u;
      *(tgt_img++) = v;
      
      *(tgt_img++) = y2;
      *(tgt_img++) = u;
      *(tgt_img++) = v;
	
      *(tgt_img++) = y3;
      *(tgt_img++) = u;
      *(tgt_img++) = v;
    }
  }
  //--------------------------------------------------------------------
  void
  DevicePlayer::process()
  {
    ACE_Time_Value now = ACE_OS::gettimeofday();


    if (playerClient->Read()) {
      throw Miro::EDevIO("Could not read from Player camera");
    }

    assert(inputFormat_.width==playerCamera->width);
    assert(inputFormat_.height==playerCamera->height);

    unsigned char * outBuffer = outputBuffer();
    unsigned char * inBuffer = playerCamera->image;
    
    //do work
    unsigned long int i;
    for (i=0; i<playerCamera->imageSize; i++) {
      *outBuffer=*inBuffer++;
      
      outBuffer++;
    }

    bufferManager_->bufferTimeStamp(outputBufferIndex_, 
				      ACE_OS::gettimeofday());

     }
Example #6
0
void GPU::merge(uint32_t *input, size *positions, size n) const
{
    cl::make_kernel<cl::Buffer&,cl::Buffer&,cl::Buffer&> merge(this->kmerge);
    cl::make_kernel<cl::Buffer&,size,size> updatePositions(this->kupdatePositions);
    cl::CommandQueue queue(context,dev);
    size len=positions[n];
    cl::Buffer inputBuffer(context, CL_MEM_READ_WRITE, sizeof(uint32_t)*len);
    queue.enqueueWriteBuffer(inputBuffer, false, 0, sizeof(uint32_t)*len, input);
    cl::Buffer outputBuffer(context, CL_MEM_READ_WRITE, sizeof(uint32_t)*len);
    cl::Buffer positionsBuffer(context, CL_MEM_READ_WRITE, sizeof(size)*(n+1));
    queue.enqueueWriteBuffer(positionsBuffer, false, 0, (n+1)*sizeof(size), positions);
    if(n%2)
        queue.enqueueCopyBuffer(inputBuffer, outputBuffer, sizeof(uint32_t)*positions[n-1],sizeof(uint32_t)*positions[n-1], (positions[n]-positions[n-1])*sizeof(uint32_t));    //kopiowanie ostatniego fragmentu, który przez pewien czas może nie być mergowany (jak długo jest nieparzysta liczba list)
    while(n>1)
    {
//        std::clog<<n<<": ";
//        std::copy(positions,positions+n+1,std::ostream_iterator<size>(std::clog," "));
//        std::clog<<std::endl;
        merge(cl::EnqueueArgs(queue,n/2),inputBuffer,outputBuffer,positionsBuffer);
        size o=n;
        n-=n/2;
        updatePositions(cl::EnqueueArgs(queue,1),positionsBuffer,o,n);
        std::swap(inputBuffer,outputBuffer);
    }
    queue.enqueueReadBuffer(inputBuffer, false, 0, sizeof(uint32_t)*len, input);
    queue.finish();
}
Example #7
0
void FinalWidget::mouseMoveEvent(QMouseEvent *event)
{
    if (!(event->buttons() & Qt::LeftButton))
        return;
    if ((event->pos() - dragStartPosition).manhattanLength()
         < QApplication::startDragDistance())
        return;
    if (!hasImage)
        return;

    QDrag *drag = new QDrag(this);
    QMimeData *mimeData = new QMimeData;

//! [0]
    QByteArray output;
    QBuffer outputBuffer(&output);
    outputBuffer.open(QIODevice::WriteOnly);
    imageLabel->pixmap()->toImage().save(&outputBuffer, "PNG");
    mimeData->setData("image/png", output);
//! [0]
/*
//! [1]
    mimeData->setImageData(QVariant(*imageLabel->pixmap()));
//! [1]
*/
    drag->setMimeData(mimeData);
    drag->setPixmap(imageLabel->pixmap()->scaled(64, 64, Qt::KeepAspectRatio));
//! [2]
    drag->setHotSpot(QPoint(drag->pixmap().width()/2,
                            drag->pixmap().height()));
//! [2]

    drag->start();
}
OutputStream createOutputCompressedFileStream(const std::string &fileName)
{
	OutputStream outputStream;
	boost::shared_ptr<OutputCompressedFileStreamBuffer> outputBuffer(new OutputCompressedFileStreamBuffer(fileName));

	outputStream.setBuffer(outputBuffer);
	return outputStream;
}
// verifies that the specified mb sequences decode to the specified wc sequence
void MBConvTestCase::TestDecoder(
    const wchar_t* wideBuffer,  // the same character sequence as multiBuffer, encoded as wchar_t
    size_t         wideChars,   // the number of wide characters at wideBuffer
    const char*    multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
    size_t         multiBytes,  // the byte length of the multibyte character sequence that can be decoded by "converter"
    wxMBConv*      converter,   // the wxMBConv object that can decode multiBuffer into a wide character sequence
    int            sizeofNull   // number of bytes occupied by terminating null in this encoding
    )
{
    const unsigned UNINITIALIZED = 0xcd;

    // copy the input bytes into a null terminated buffer
    wxCharBuffer inputCopy( multiBytes+sizeofNull );
    memcpy( inputCopy.data(), multiBuffer, multiBytes );
    memset( &inputCopy.data()[multiBytes], 0, sizeofNull );

    // calculate the output size
    size_t outputWritten = converter->MB2WC
        ( 
        0, 
        (const char*)inputCopy.data(), 
        0
        );
    // make sure the correct output length was calculated
    CPPUNIT_ASSERT( outputWritten == wideChars );

    // convert the string
    size_t guardChars = 8; // to make sure we're not overrunning the output buffer
    size_t nullCharacters = 1;
    size_t outputBufferChars = outputWritten + nullCharacters + guardChars;
    wxWCharBuffer outputBuffer(outputBufferChars);
    memset( outputBuffer.data(), UNINITIALIZED, outputBufferChars*sizeof(wchar_t) );

    outputWritten = converter->MB2WC
        ( 
        outputBuffer.data(), 
        (const char*)inputCopy.data(), 
        outputBufferChars
        );
    // make sure the correct number of characters were outputs
    CPPUNIT_ASSERT( outputWritten == wideChars );

    // make sure the characters generated are correct
    CPPUNIT_ASSERT( 0 == memcmp( outputBuffer, wideBuffer, wideChars*sizeof(wchar_t) ) );

    // the output buffer should be null terminated
    CPPUNIT_ASSERT(  outputBuffer[outputWritten] == 0 );

    // make sure the rest of the output buffer is untouched
    for ( size_t i = (wideChars+1)*sizeof(wchar_t); i < (outputBufferChars*sizeof(wchar_t)); i++ )
    {
        CPPUNIT_ASSERT( ((unsigned char*)outputBuffer.data())[i] == UNINITIALIZED );
    }

#if wxUSE_UNICODE && wxUSE_STREAMS
    TestStreamDecoder( wideBuffer, wideChars, multiBuffer, multiBytes, converter );
#endif
}
Example #10
0
void FilterApiTest::testFaceInterpretationFilter()
{
    // Input data to feed to the filter
    TimedXyzData inputData[] = {
        TimedXyzData(      0,   0,   0,-981),
        TimedXyzData(1000000,   0,   0, 981),
        TimedXyzData(2000000,   0,   0,-981),
        TimedXyzData(2100000,   0,   0, 981),
        TimedXyzData(2200000,   0,   0,-981)
    };

    // Expected output data
    PoseData expectedResult[] = {
        PoseData(      0, PoseData::FaceUp),
        PoseData(1000000, PoseData::FaceDown),
        PoseData(2000000, PoseData::FaceUp),
    };

    int numInputs = (sizeof(inputData) / sizeof(TimedXyzData));
    int numOutputs = (sizeof(expectedResult) / sizeof(PoseData));

    FilterBase* faceInterpreterFilter = OrientationInterpreter::factoryMethod();

    Bin filterBin;
    DummyAdaptor<TimedXyzData> dummyAdaptor;

    RingBuffer<PoseData> outputBuffer(10);

    filterBin.add(&dummyAdaptor, "adapter");
    filterBin.add(faceInterpreterFilter, "filter");
    filterBin.add(&outputBuffer, "buffer");
    filterBin.join("adapter", "source", "filter", "accsink");
    filterBin.join("filter", "face", "buffer", "sink");

    DummyDataEmitter<PoseData> dbusEmitter;
    Bin marshallingBin;
    marshallingBin.add(&dbusEmitter, "testdataemitter");
    outputBuffer.join(&dbusEmitter);

    // Setup data
    dummyAdaptor.setTestData(numInputs, inputData);
    dbusEmitter.setExpectedData(numOutputs, expectedResult);

    marshallingBin.start();
    filterBin.start();

    for (int j=1; j < numInputs; j++){
        dummyAdaptor.pushNewData();
    }

    filterBin.stop();
    marshallingBin.stop();

    QVERIFY2(numOutputs == dbusEmitter.numSamplesReceived(), "Too many/few outputs from filter.");

    delete faceInterpreterFilter;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifEclipseDataTableFormatter::tableCompleted(const QString& appendText, bool appendNewline)
{
    outputBuffer();

    // Output an "empty" line after a finished table
    if (!appendText.isEmpty() || appendNewline)
    {
        m_out << m_tableRowPrependText << appendText << (appendNewline ? "\n" : "");
    }
}
Example #12
0
short MergeUnion::generateShape(CollHeap * c, char * buf, NAString * shapeStr)
{
  Space * space = (Space *)c;
  char mybuf[100];

  sprintf(mybuf, "union(");
  outputBuffer(space, buf, mybuf, shapeStr);

  child(0)->generateShape(space, buf, shapeStr);

  sprintf(mybuf, ",");
  outputBuffer(space, buf, mybuf, shapeStr);

  child(1)->generateShape(space, buf, shapeStr);

  sprintf(mybuf, ")");
  outputBuffer(space, buf, mybuf, shapeStr);

  return 0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifEclipseDataTableFormatter& RifEclipseDataTableFormatter::header(const std::vector<RifEclipseOutputTableColumn> header)
{
    outputBuffer();
    m_columns = header;

    for (size_t colNumber = 0u; colNumber < m_columns.size(); ++colNumber)
    {
        m_columns[colNumber].width = measure(m_columns[colNumber].title);
    }
    return *this;
}
 void
 FilterFlip::process()
 {
   unsigned char const * src = inputBuffer();
   unsigned char * dst = outputBuffer() + rowSize_ * (inputFormat_.height - 1);
   for (unsigned int i = inputFormat_.height; i != 0; --i) {
     memcpy(dst, src, rowSize_);
     src += rowSize_;
     dst -= rowSize_;
   }
 }
Example #15
0
short CallSP::generateShape(CollHeap * c, char * buf, NAString * shapeStr)
{
  Space *space = (Space *)c;
  char mybuf[100];

  sprintf (mybuf, "callsp");
  outputBuffer (space, buf, mybuf, shapeStr);

  return 0;

}
  void
  FilterHalfImage::process()
  {
    unsigned char const * src = inputBuffer() + offset_;
    unsigned char * dst = outputBuffer();

    for (unsigned int i = 0; i < inputFormat_.height; i += 2) {
      memcpy(dst, src, rowSize_);
      src += rowSize2_;
      dst += rowSize_;
    }
  }
Example #17
0
int main(void)
{
	cl::Program addProgram(
        cl::STRING_CLASS(
		"int add(int a, int b) { return a + b; }")
		, false);
	cl::Program vectorWrapper(
        cl::STRING_CLASS(
		"int add(int a, int b); kernel void vectorAdd(global const int *inputA, global const int *inputB, global int *output){output[get_global_id(0)] = add(inputA[get_global_id(0)], inputB[get_global_id(0)]);}")
		, false);
	std::vector<cl::Program> programs;
	addProgram.compile();
	vectorWrapper.compile();		
	
    cl::STRING_CLASS s = addProgram.getInfo<CL_PROGRAM_SOURCE>();
    
	programs.push_back(addProgram);
	programs.push_back(vectorWrapper);
	cl::Program vectorAddProgram = cl::linkProgram(programs);

    auto vectorAddKernel = 
        cl::make_kernel<
            cl::Buffer&,
            cl::Buffer&,
            cl::Buffer&
            >( vectorAddProgram, "vectorAdd" );


    std::vector<int> inputA(numElements, 1);
    std::vector<int> inputB(numElements, 2);
    std::vector<int> output(numElements, 0xdeadbeef);
    cl::Buffer inputABuffer(begin(inputA), end(inputA), true);
    cl::Buffer inputBBuffer(begin(inputB), end(inputB), true);
    cl::Buffer outputBuffer(begin(output), end(output), false);

    vectorAddKernel(
        cl::EnqueueArgs(
            cl::NDRange(numElements),
            cl::NDRange(numElements)),
        inputABuffer,
        inputBBuffer,
        outputBuffer);

    cl::copy(outputBuffer, begin(output), end(output));

    std::cout << "Output:\n";
    for( int i = 1; i < numElements; ++i ) {
        std::cout << "\t" << output[i] << "\n";
    }
    std::cout << "\n\n";

}
 void
 FilterSwap4::process()
 {
   unsigned int const * first = 
     reinterpret_cast<unsigned int const *>(inputBuffer());
   unsigned int const * last =
     reinterpret_cast<unsigned int const *>(inputBuffer() + imageSize_);
   unsigned int * dest = 
     reinterpret_cast<unsigned int *>(outputBuffer());
   while (first < last) {
     *(dest++) = __bswap_32(*(first++));
   }
 }
Example #19
0
SharedArrayPtr<char> Tracer::traceFormatChars(
    const Buffer& data,
    bool binary)
{
    static char start[]="\n### Begin of binary data\n";
    static char end[]="\n### End of binary data\n";
    static char msg[] ="\n### Parts of data omitted. Only first 768 bytes and "\
        "last 256 bytes shown. For complete information, use traceLevel 5.\n\n";

    SharedArrayPtr<char> outputBuffer(
        new char[(10*data.size()+sizeof(start)+sizeof(end)+sizeof(msg))]);

    char* target = outputBuffer.get();
    size_t size = data.size();

    if (0 == size)
    {
        target[0] = 0;
        return outputBuffer;
    }
    if (binary)
    {
        memcpy(target,&(start[0]),sizeof(start)-1);
        target+=sizeof(start)-1;
        // If there are more then 1024 bytes of binary data and the trace level
        // is not at highest level(5), we only trace part of the data and not
        // everything
        if ((_traceLevelMask & Tracer::LEVEL5) || (size <= 1024))
        {
            target=_formatHexDump(target, data.getData(), size);

        }
        else
        {
            target=_formatHexDump(target, data.getData(), 768);

            memcpy(target, &(msg[0]), sizeof(msg)-1);
            target+=sizeof(msg)-1;

            target=_formatHexDump(target, &(data.getData()[size-256]), 256);
        }
        memcpy(target,&(end[0]),sizeof(end));
    }
    else
    {
        memcpy(target, data.getData(), size);
        target[size] = 0;
    }
    return outputBuffer;
}
  void
  FilterReverse::process()
  {
    unsigned char const * src = inputBuffer();
    unsigned char * dst = outputBuffer() + rowSize_ * (inputFormat_.height - 1);
    int numberOfPixel = inputFormat_.height * inputFormat_.width;

    for (unsigned int i = numberOfPixel; i != 0; --i) 
    {
      memcpy(dst, src, bytesPerPixel);
      src += bytesPerPixel;
      dst -= bytesPerPixel;
    }
  }
 void
 FilterSwap3::process()
 {
   unsigned char const * first = inputBuffer();
   unsigned char const * last = inputBuffer() + imageSize_;
   unsigned char * dest = outputBuffer();
   char r, g, b;
   while (first < last) {
     b = *first++;
     g = *first++;
     r = *first++;
     *dest++ = r;
     *dest++ = g;
     *dest++ = b;
   }
 }
QString
MySqlEmbeddedCollection::escape( QString text ) const
{
    if( !m_db )
    {
        error() << "Tried to perform escape() on uninitialized MySQLe";
        return QString();
    }

    const QByteArray utfText = text.toUtf8();
    const int length = utfText.length() * 2 + 1;
    QVarLengthArray<char, 1024> outputBuffer( length );

    mysql_real_escape_string( m_db, outputBuffer.data(), utfText.constData(), utfText.length() );

    return QString::fromUtf8( outputBuffer.constData() );
}
int main (void)
{
	std::cout << "Initializing...";
	
	boost::circular_buffer<Frame> outputBuffer(5);
	boost::circular_buffer<Frame> inputBuffer(5);
	
	PhysicalLayer physicalLayer(paFloat32, 2, 1000, 8000, paFloat32, 2, 500, 8000);
	physicalLayer.startDataStream();

	std::cout << "\nReady for playback...\n\n";

	std::system("PAUSE");
		
	outputBuffer.push_back(Frame(255,255,255));
	outputBuffer.push_back(Frame(0,0,0));
	outputBuffer.push_back(Frame(1,2,3));
	outputBuffer.push_back(Frame(4,5,6));
	outputBuffer.push_back(Frame(7,8,9));

	physicalLayer.send(&outputBuffer);

	std::system("PAUSE");

	std::cout << "\n\n----------------------------------------------------------------------------\n";
	std::cout << "Recorded frames:\n";

	physicalLayer.receive(&inputBuffer);
		
	for (int i = 0; i < inputBuffer.size(); i++)
	{
		Frame funFrame = inputBuffer[i];
		funFrame.coutHeader();
	}

	std::cout << "\n\n----------------------------------------------------------------------------\n";
	
	std::system("PAUSE");

	std::cout << "\nStopping data streams...\n\n";

	physicalLayer.stopDataStream();
	
	return 0;
}
/**
 * Image conversion.
 */
void
FilterGray::process()
{
  // Pointer to the input image.
  unsigned char const * src = inputBuffer();
  // Pointer to the output image.
  unsigned char * dest = outputBuffer();
  // Past the end pointer of the output image for termination condition.
  unsigned char * last = dest + outputSize_;

  while (dest < last) {
    *(dest++) = 
      (unsigned char) ( ( *(src++) * params_->weightRed +
			  *(src++) * params_->weightGreen +
			  *(src++) * params_->weightBlue) 
			/ sum_) ;
  }
}
Example #25
0
short GenericUpdate::generateShape(CollHeap * c, char * buf, NAString * shapeStr)
{
  Space * space = (Space *)c;
  char mybuf[100];

  switch (getOperatorType())
    {
    default:
      {
	sprintf (mybuf, "anything");
      }
    break;
    }

  outputBuffer(space, buf, mybuf, shapeStr);

  return 0;
}
            CryptoBuffer AES_KeyWrap_Cipher_CommonCrypto::FinalizeDecryption()
            {
                CheckInitDecryptor();
                size_t outputBufferLength = m_workingKeyBuffer.GetLength() - GetBlockSizeBytes();
                CryptoBuffer outputBuffer(outputBufferLength);

                CCCryptorStatus status = CCSymmetricKeyUnwrap(kCCWRAPAES, CCrfc3394_iv, CCrfc3394_ivLen, m_key.GetUnderlyingData(), m_key.GetLength(),
                                                            m_workingKeyBuffer.GetUnderlyingData(), m_workingKeyBuffer.GetLength(), outputBuffer.GetUnderlyingData(), &outputBufferLength);

                if(status != kCCSuccess)
                {
                    m_failure = true;
                    AWS_LOGSTREAM_ERROR(AES_KEY_WRAP_LOG_TAG, "Key unwrap failed with status code " << status);
                    return CryptoBuffer();
                }

                return outputBuffer;
            }
Example #27
0
		ByteArray Decompress(const ByteArrayView view)
		{
			const uint64 originalSize = ZSTD_getDecompressedSize(view.data(), view.size());

			if (originalSize == 0)
			{
				return ByteArray();
			}

			Array<Byte> outputBuffer(static_cast<size_t>(originalSize));

			const size_t decompressedSize = ZSTD_decompress(outputBuffer.data(), outputBuffer.size(), view.data(), view.size());

			if (originalSize != decompressedSize)
			{
				return ByteArray();
			}

			return ByteArray(std::move(outputBuffer));
		}
Example #28
0
QString
MySqlStorage::escape( const QString &text ) const
{
    if( !m_db )
    {
        error() << "Tried to perform escape() on uninitialized MySQL";
        return QString();
    }

    const QByteArray utfText = text.toUtf8();
    const int length = utfText.length() * 2 + 1;
    QVarLengthArray<char, 1000> outputBuffer( length );

    {
        QMutexLocker locker( &m_mutex );
        mysql_real_escape_string( m_db, outputBuffer.data(), utfText.constData(), utfText.length() );
    }

    return QString::fromUtf8( outputBuffer.constData() );
}
  //---------------------------------------------------------------
  void 
  FilterYUV422toRGB::process()
  {
    unsigned char const * src_img = inputBuffer();
    unsigned char * tgt_img = outputBuffer();
    unsigned int srcImgSize = getImageSize(inputFormat_);

    for (unsigned int i = 0; i < srcImgSize; i += 4) {
      register int u  = src_img[i];
      register int y0 = src_img[i+1];
      register int v  = src_img[i+2];
      register int y1 = src_img[i+3];

      *(tgt_img++) = t_r[(y0<<8)|v];
      *(tgt_img++) = t_g2[(y0<<8)|t_g1[(u<<8)|v]];
      *(tgt_img++) = t_b[(y0<<8)|u];
      
      *(tgt_img++) = t_r[(y1<<8)|v];
      *(tgt_img++) = t_g2[(y1<<8)|t_g1[(u<<8)|v]];
      *(tgt_img++) = t_b[(y1<<8)|u];
    }
  }
  //---------------------------------------------------------------
  void
  FilterOmni2Pan::process()
  {
    unsigned char const * srcImg = inputBuffer();
    unsigned char * tgtImg = outputBuffer();
    int * srcOffset = srcOffset_;

    if (outputFormat_.palette == Miro::RGB_24) {
      unsigned char * tgtImgEnd = tgtImg + IMAGE_WIDTH * IMAGE_HEIGHT * 3;
      for (; tgtImg != tgtImgEnd; ++srcOffset) {
	*tgtImg++ = *(srcImg + *srcOffset);
	*tgtImg++ = *(srcImg + *srcOffset + 1);
	*tgtImg++ = *(srcImg + *srcOffset + 2);
      }
    }
    else {
      unsigned char * tgtImgEnd = tgtImg + IMAGE_WIDTH * IMAGE_HEIGHT;
      for (; tgtImg != tgtImgEnd; ++srcOffset) {
	*tgtImg++ = *(srcImg + *srcOffset);
      }
    }
  }