当前位置: 首页>>代码示例>>C++>>正文


C++ decoder函数代码示例

本文整理汇总了C++中decoder函数的典型用法代码示例。如果您正苦于以下问题:C++ decoder函数的具体用法?C++ decoder怎么用?C++ decoder使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了decoder函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TEST

TEST(ImageDecoderTest, requiredPreviousFrameIndexDisposeOverwriteBgcolor)
{
    std::unique_ptr<TestImageDecoder> decoder(wrapUnique(new TestImageDecoder()));
    decoder->initFrames(3);
    Vector<ImageFrame, 1>& frameBuffers = decoder->frameBufferCache();

    // Fully covering DisposeOverwriteBgcolor previous frame resets the starting state.
    frameBuffers[1].setDisposalMethod(ImageFrame::DisposeOverwriteBgcolor);
    decoder->resetRequiredPreviousFrames();
    EXPECT_EQ(kNotFound, frameBuffers[2].requiredPreviousFrameIndex());

    // Partially covering DisposeOverwriteBgcolor previous frame is required by this frame.
    frameBuffers[1].setOriginalFrameRect(IntRect(50, 50, 50, 50));
    decoder->resetRequiredPreviousFrames();
    EXPECT_EQ(1u, frameBuffers[2].requiredPreviousFrameIndex());
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:16,代码来源:ImageDecoderTest.cpp

示例2: decoder

    void Selector::UpdateViewRay()
    {
        //  TODO: Maybe should be placed in frustum, or somehere else, because it depends greatly
        //  on the projection matrix

        Math::PerspectiveDecoder decoder(m_projection_matrix);
        float x = decoder.GetWidthToHeightAspectRatio()*( -1 + 2.0f * m_cursor.X() / m_screen_size.X());
        float y = (-1 + 2.0f * m_cursor.Y() / m_screen_size.Y());

        auto m = m_view_matrix.Inversed();
        Math::vec3 origin = m * Math::vec3(0,0,0);
        auto vv = m * Math::vec4(x, y, -1.0f / tan(decoder.GetFovY() / 2.0f), 1);
        Math::vec3 destination(vv[0] / vv[3], vv[1] / vv[3], vv[2] / vv[3]);
        m_world_screen_point = destination;
        m_view_ray.SetOriginDestination(origin, origin + (destination - origin).Normalized() * m_selection_depth);
    }
开发者ID:Mikalai,项目名称:punk_project_a,代码行数:16,代码来源:selector.cpp

示例3: decoder

    std::shared_ptr<Video::MovieAudioDecoder> MovieAudioFactory::createDecoder(Video::VideoState* videoState)
    {
        std::shared_ptr<MWSound::MovieAudioDecoder> decoder(new MWSound::MovieAudioDecoder(videoState));
        decoder->setupFormat();

        MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
        MWBase::SoundStream *sound = sndMgr->playTrack(decoder->mDecoderBridge, MWSound::Type::Movie);
        if (!sound)
        {
            decoder.reset();
            return decoder;
        }

        decoder->mAudioTrack = sound;
        return decoder;
    }
开发者ID:OpenMW,项目名称:openmw,代码行数:16,代码来源:movieaudiofactory.cpp

示例4: int

bool FFMpegStream::readFrame(AVFrame *frame)
{
	typedef int (*decoder_t)(AVCodecContext*,AVFrame*,int*,const AVPacket*);
	decoder_t decoder = type == TYPE_VIDEO ? &avcodec_decode_video2 : &avcodec_decode_audio4;

	int got_frame = 0;
	while (!got_frame)
	{
		if (!readPacket())
			return false;
		if (decoder(codecContext, frame, &got_frame, &packet) < 0)
			return false;
	}

	return true;
}
开发者ID:MikuAuahDark,项目名称:livesim4,代码行数:16,代码来源:FFMpegStream.cpp

示例5: decoder

MediaDataDecoder*
WMFDecoderModule::CreateAACDecoder(uint32_t aChannelCount,
                                   uint32_t aSampleRate,
                                   uint16_t aBitsPerSample,
                                   const uint8_t* aUserData,
                                   uint32_t aUserDataLength)
{
  nsAutoPtr<WMFAudioDecoder> decoder(new WMFAudioDecoder());
  nsresult rv = decoder->Init(aChannelCount,
                              aSampleRate,
                              aBitsPerSample,
                              aUserData,
                              aUserDataLength);
  NS_ENSURE_SUCCESS(rv, nullptr);
  return decoder.forget();
}
开发者ID:Gozala,项目名称:gecko-dev,代码行数:16,代码来源:WMFDecoderModule.cpp

示例6: compareMonoSysex

bool compareMonoSysex(uint8_t *buf, uint8_t *buf2) {
	uint8_t buftmp[8192];
	uint8_t buftmp2[8192];
	uint16_t len = 0x1978;
	MNMSysexDecoder decoder(DATA_ENCODER_INIT(buf + 10, len - 10));
	decoder.get(buftmp + 1, len - 10);
	MNMSysexDecoder decoder2(DATA_ENCODER_INIT(buf2 + 10,  - 10));
	decoder2.get(buftmp2 + 1, len - 10);
	for (uint16_t i = 1; i < len - 10; i++) {
		if (buftmp[i] != buftmp2[i]) {
			printf("mono sysex different at 0x%x, %x != %x\n", i, buftmp[i], buftmp2[i]);
			return false;
		}
	}
	return true;
}
开发者ID:jmamma,项目名称:mididuino,代码行数:16,代码来源:mnmPatternTest.cpp

示例7: decompressAdaptive

void decompressAdaptive(std::istream& in, std::ostream& out) {
	AdaptiveDataModel dataModel(NUM_SYMBOLS);
	ArithmeticDecoder decoder(std::make_shared<BitStreamReader>(&in));
	for (;;) {
		auto symbol = decoder.decode(&dataModel);

		if (symbol >= NUM_SYMBOLS)
			throw std::runtime_error("Read bad symbol value. Symbols are expected to be 1 byte long.");

		// on ending symbol exit loop
		if (symbol == NUM_SYMBOLS - 1)
			break;

		out << static_cast<char>(symbol);
	}
}
开发者ID:WingOfRay,项目名称:lzw,代码行数:16,代码来源:main.cpp

示例8: metautils_unpack_bodyv

GError *
metautils_unpack_bodyv (GByteArray **bodyv, GSList **result,
		body_decoder_f decoder)
{
	GError *err = NULL;
	GSList *items = NULL;
	for (GByteArray **p=bodyv; *p && !err ;++p) {
		GSList *l = NULL;
		if (!decoder (&l, (*p)->data, (*p)->len, NULL))
			err = NEWERROR (CODE_PROXY_ERROR, "Bad payload from service");
		else
			items = metautils_gslist_precat (items, l);
	}
	*result = items;
	return err;
}
开发者ID:InGenious-Justice,项目名称:oio-sds,代码行数:16,代码来源:comm_message.c

示例9: readFixedLengthStringFromBuffer

QString readFixedLengthStringFromBuffer(const void *buffer,
    size_t bufferSize,
    size_t pos,
    uint length,
    QTextCodec *codec)
{
    if(codec == NULL)
    {
        throw std::runtime_error("Codec is NULL");
    }
    QScopedArrayPointer<quint8> stringIn(
        new quint8[static_cast<size_t>(length)]);
    if((pos + static_cast<size_t>(length)) <= bufferSize)
    {
        size_t last = pos + static_cast<size_t>(length);
        size_t strPtr = static_cast<size_t>(0);
        for(size_t ptr = pos; ptr < last; ptr++)
        {
            stringIn[strPtr] = (reinterpret_cast<const quint8 *>(buffer))[ptr];
            strPtr++;
        }
    }
    else
    {
        size_t last = bufferSize;
        size_t strPtr = static_cast<size_t>(0);
        for(size_t ptr = pos; ptr < last; ptr++)
        {
            stringIn[strPtr] = (reinterpret_cast<const quint8 *>(buffer))[ptr];
            strPtr++;
        }
        for(size_t ptr = strPtr; ptr < static_cast<size_t>(length); ptr++)
        {
            stringIn[ptr] = 0;
        }
    }
    uint stringLength = qstrnlen(
        reinterpret_cast<char *> (stringIn.data()), length);
    QScopedPointer<QTextDecoder> decoder(codec->makeDecoder());
    if (decoder.isNull())
    {
        throw std::runtime_error("Unable to create text decoder");
    }
    return decoder->toUnicode(
        reinterpret_cast<const char *> (stringIn.data()),
        static_cast<int> (stringLength));
}
开发者ID:rel-eng,项目名称:QWinHelp,代码行数:47,代码来源:IOUtils.cpp

示例10: decoder

CHeaderData* CSoundCardRepeaterTXRXThread::processFECHeader()
{
	bool buffer[FEC_SECTION_LENGTH_BITS];
	m_bitBuffer.getData(buffer, FEC_SECTION_LENGTH_BITS);

	CRadioHeaderDecoder decoder(buffer, FEC_SECTION_LENGTH_BITS);

	CHeaderData* header = decoder.getHeaderData();
	if (header == NULL)
		return NULL;

	m_headerBER = decoder.getBER();

	wxLogMessage(wxT("Radio header decoded - My: %s/%s  Your: %s  Rpt1: %s  Rpt2: %s  Flags: %02X %02X %02X  BER: %u%%"), header->getMyCall1().c_str(), header->getMyCall2().c_str(), header->getYourCall().c_str(), header->getRptCall1().c_str(), header->getRptCall2().c_str(), header->getFlag1(), header->getFlag2(), header->getFlag3(), m_headerBER);

	return header;
}
开发者ID:BackupTheBerlios,项目名称:opendv-svn,代码行数:17,代码来源:SoundCardRepeaterTXRXThread.cpp

示例11: LoadSound

unsigned int LoadSound(const char * filename, ALCcontext * context)
{
    alcMakeContextCurrent(context);

    OggDecoder decoder(filename);
    decoder.GetInfo();
    decoder.FillBuffer();

    unsigned int buffer;
    alGenBuffers(1, &buffer);
    alBufferData(buffer, decoder.GetChannels() > 1 ?
                     AL_FORMAT_STEREO16 : AL_FORMAT_MONO16,
                 decoder.GetData(), decoder.GetBufferSize(), decoder.GetSampleRate());
    decoder.ClearBuffer();

    return buffer;
}
开发者ID:Gooeybots,项目名称:Hackman,代码行数:17,代码来源:loadsound.cpp

示例12: evaluate_fitness

void evaluate_fitness(Population * population, mySlimTree* SlimTree, TCity * queryObject, stDistance range)
{
	double x, y;
	long i;
	for( i = 0; i < POPULATION_SIZE; ++i)
	{
		decoder(&population->individuals[i]);
		
		if(MAXIMIZATION)
		{
			population->individuals[i].fitness = objective_function(population->individuals[i].phenotype, SlimTree, queryObject, range);
		} else
		{
			population->individuals[i].fitness = (-1 * objective_function(population->individuals[i].phenotype, SlimTree, queryObject, range));
		}
	}
}
开发者ID:dannluciano,项目名称:Tcc,代码行数:17,代码来源:genetic_algorithm.cpp

示例13: TEST

TEST(invalidDecoder, CodecLibrary)
{
    HBitmapDecoder decoder(new WindowsBitmapDecoder);

    bool isInvalidDecoder = false;

    try
    {
        decoder->createIterator();
    }
    catch (const InvalidDecoder&)
    {
        isInvalidDecoder = true;
    }

    CHECK(isInvalidDecoder);
}
开发者ID:mcmellawatt,项目名称:VectorGraphicsFramework,代码行数:17,代码来源:CodecLibraryTest.cpp

示例14: CreateDecoderWrapper

static already_AddRefed<MediaDataDecoderProxy>
CreateDecoderWrapper(MediaDataDecoderCallback* aCallback, CDMProxy* aProxy, FlushableTaskQueue* aTaskQueue)
{
  nsCOMPtr<mozIGeckoMediaPluginService> gmpService = do_GetService("@mozilla.org/gecko-media-plugin-service;1");
  if (!gmpService) {
    return nullptr;
  }

  nsCOMPtr<nsIThread> thread;
  nsresult rv = gmpService->GetThread(getter_AddRefs(thread));
  if (NS_FAILED(rv)) {
    return nullptr;
  }

  RefPtr<MediaDataDecoderProxy> decoder(new EMEMediaDataDecoderProxy(thread, aCallback, aProxy, aTaskQueue));
  return decoder.forget();
}
开发者ID:Manishearth,项目名称:gecko-dev,代码行数:17,代码来源:EMEDecoderModule.cpp

示例15: main

int main(void)
{
  int i, sic, eic;
  U16BIT I;

  reset_encoder();
  reset_decoder();

  sic = __time / 2;
  for (i = 0; i < sizeof(Input) / sizeof(U16BIT); i++)
    decoder(encoder(Input[i]));
  eic = __time / 2;
  printf("\nInstruction cycles for transcoding a sample: %d\n",
	 (eic - sic) / (sizeof(Input) / sizeof(U16BIT)));

  return (0);
}
开发者ID:b14ckkn19ht,项目名称:Shang,代码行数:17,代码来源:board_test.c


注:本文中的decoder函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。