• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ decoder函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: decoder

bool GraphicsContext3D::getImageData(Image* image,
                                     GC3Denum format,
                                     GC3Denum type,
                                     bool premultiplyAlpha,
                                     bool ignoreGammaAndColorProfile,
                                     Vector<uint8_t>& outputVector)
{
    if (!image)
        return false;
    OwnPtr<NativeImageSkia> pixels;
    NativeImageSkia* skiaImage = 0;
    AlphaOp neededAlphaOp = AlphaDoNothing;
    bool hasAlpha = image->isBitmapImage() ? static_cast<BitmapImage*>(image)->frameHasAlphaAtIndex(0) : true;
    if ((ignoreGammaAndColorProfile || (hasAlpha && !premultiplyAlpha)) && image->data()) {
        ImageSource decoder(ImageSource::AlphaNotPremultiplied,
                            ignoreGammaAndColorProfile ? ImageSource::GammaAndColorProfileIgnored : ImageSource::GammaAndColorProfileApplied);
        // Attempt to get raw unpremultiplied image data 
        decoder.setData(image->data(), true);
        if (!decoder.frameCount() || !decoder.frameIsCompleteAtIndex(0))
            return false;
        hasAlpha = decoder.frameHasAlphaAtIndex(0);
        pixels = adoptPtr(decoder.createFrameAtIndex(0));
        if (!pixels.get() || !pixels->isDataComplete() || !pixels->width() || !pixels->height())
            return false;
        SkBitmap::Config skiaConfig = pixels->config();
        if (skiaConfig != SkBitmap::kARGB_8888_Config)
            return false;
        skiaImage = pixels.get();
        if (hasAlpha && premultiplyAlpha)
            neededAlphaOp = AlphaDoPremultiply;
    } else {
        skiaImage = image->nativeImageForCurrentFrame();
        if (!premultiplyAlpha && hasAlpha)
            neededAlphaOp = AlphaDoUnmultiply;
    }
    if (!skiaImage)
        return false;
    SkBitmap& skiaImageRef = *skiaImage;
    SkAutoLockPixels lock(skiaImageRef);
    ASSERT(skiaImage->rowBytes() == skiaImage->width() * 4);
    outputVector.resize(skiaImage->rowBytes() * skiaImage->height());
    return packPixels(reinterpret_cast<const uint8_t*>(skiaImage->getPixels()),
                      SourceFormatBGRA8, skiaImage->width(), skiaImage->height(), 0,
                      format, type, neededAlphaOp, outputVector.data());
}
开发者ID:dankurka,项目名称:webkit_titanium,代码行数:45,代码来源:GraphicsContext3DSkia.cpp


示例17: decode

    virtual int decode( gpointer data, gsize size, TPImage * image )
    {
        if ( ! enabled() )
        {
            tplog( "  EXTERNAL IMAGE DECODER IS DISABLED" );

            return TP_IMAGE_UNSUPPORTED_FORMAT;
        }

        tplog( "  INVOKING EXTERNAL DECODER WITH BUFFER OF %d BYTES", size );

        int result = decoder( data, size, image, decoder_data );

        tplog( "    EXTERNAL DECODER RETURNED %d", result );

        if ( result == TP_IMAGE_DECODE_OK )
        {
            tplog( "      pixels      : %p", image->pixels );
            tplog( "      width       : %u", image->width );
            tplog( "      height      : %u", image->height );
            tplog( "      pitch       : %u", image->pitch );
            tplog( "      depth       : %u", image->depth );
            tplog( "      bgr         : %u", image->bgr );
            tplog( "      pm_alpha    : %u", image->pm_alpha );
            tplog( "      free_image  : %p", image->free_image );

            g_assert( image->pixels != NULL );
            g_assert( image->pitch >= image->width * image->depth );
            g_assert( image->depth == 3 || image->depth == 4 );
            g_assert( image->bgr == 0 );

            Image::premultiply_alpha( image );
        }
        else
        {
            g_assert( image->pixels == NULL );

            // We change to unsupported format so that no matter what
            // the external decoder does, we try the internal decoders.

            result = TP_IMAGE_UNSUPPORTED_FORMAT;
        }

        return result;
    }
开发者ID:cebu4u,项目名称:Trickplay,代码行数:45,代码来源:images.cpp


示例18: decoder

bool GraphicsContext3D::getImageData(Image* image, unsigned int format, unsigned int type, bool premultiplyAlpha, bool ignoreGammaAndColorProfile, Vector<uint8_t>& outputVector)
{
    if (!image)
        return false;
    // We need this to stay in scope because the native image is just a shallow copy of the data.
    ImageSource decoder(premultiplyAlpha ? ImageSource::AlphaPremultiplied : ImageSource::AlphaNotPremultiplied,
                        ignoreGammaAndColorProfile ? ImageSource::GammaAndColorProfileIgnored : ImageSource::GammaAndColorProfileApplied);
    AlphaOp alphaOp = AlphaDoNothing;
    RefPtr<cairo_surface_t> imageSurface;
    if (image->data()) {
        decoder.setData(image->data(), true);
        if (!decoder.frameCount() || !decoder.frameIsCompleteAtIndex(0))
            return false;
        imageSurface = decoder.createFrameAtIndex(0);
    } else {
        imageSurface = image->nativeImageForCurrentFrame();
        if (!premultiplyAlpha)
            alphaOp = AlphaDoUnmultiply;
    }

    if (!imageSurface)
        return false;

    int width = cairo_image_surface_get_width(imageSurface.get());
    int height = cairo_image_surface_get_height(imageSurface.get());
    if (!width || !height)
        return false;

    if (cairo_image_surface_get_format(imageSurface.get()) != CAIRO_FORMAT_ARGB32)
        return false;

    unsigned int srcUnpackAlignment = 1;
    size_t bytesPerRow = cairo_image_surface_get_stride(imageSurface.get());
    size_t bitsPerPixel = 32;
    unsigned int padding = bytesPerRow - bitsPerPixel / 8 * width;
    if (padding) {
        srcUnpackAlignment = padding + 1;
        while (bytesPerRow % srcUnpackAlignment)
            ++srcUnpackAlignment;
    }

    outputVector.resize(width * height * 4);
    return packPixels(cairo_image_surface_get_data(imageSurface.get()), SourceFormatBGRA8,
                      width, height, srcUnpackAlignment, format, type, alphaOp, outputVector.data());
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:45,代码来源:GraphicsContext3DCairo.cpp


示例19: NS_ENSURE_TRUE

TemporaryRef<MFTDecoder>
WMFAudioMFTManager::Init()
{
  NS_ENSURE_TRUE(mStreamType != Unknown, nullptr);

  RefPtr<MFTDecoder> decoder(new MFTDecoder());

  HRESULT hr = decoder->Create(GetMFTGUID());
  NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);

  // Setup input/output media types
  RefPtr<IMFMediaType> type;

  hr = wmf::MFCreateMediaType(byRef(type));
  NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);

  hr = type->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio);
  NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);

  hr = type->SetGUID(MF_MT_SUBTYPE, GetMediaSubtypeGUID());
  NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);

  hr = type->SetUINT32(MF_MT_AUDIO_SAMPLES_PER_SECOND, mAudioRate);
  NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);

  hr = type->SetUINT32(MF_MT_AUDIO_NUM_CHANNELS, mAudioChannels);
  NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);

  if (mStreamType == AAC) {
    hr = type->SetUINT32(MF_MT_AAC_PAYLOAD_TYPE, 0x0); // Raw AAC packet
    NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);

    hr = type->SetBlob(MF_MT_USER_DATA,
                       mUserData.Elements(),
                       mUserData.Length());
    NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
  }

  hr = decoder->SetMediaTypes(type, MFAudioFormat_PCM);
  NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);

  mDecoder = decoder;

  return decoder.forget();
}
开发者ID:msliu,项目名称:gecko-dev,代码行数:45,代码来源:WMFAudioMFTManager.cpp


示例20: qDebug

void AnalyzeFileTask::run()
{
    qDebug() << "Analyzing file" << m_path;

    AnalyzeResult *result = new AnalyzeResult();
    result->fileName = m_path;

    TagReader tags(m_path);
    if (!tags.read()) {
        result->error = true;
        result->errorMessage = "Couldn't read metadata";
		emit finished(result);
        return;
    }

    result->mbid = tags.mbid();
    result->length = tags.length();
    result->bitrate = tags.bitrate();
    if (result->length < 10) {
        result->error = true;
        result->errorMessage = "Too short audio stream, should be at least 10 seconds";
		emit finished(result);
        return;
    }

    Decoder decoder(qPrintable(m_path));
    if (!decoder.Open()) {
        result->error = true;
        result->errorMessage = QString("Couldn't open the file: ") + QString::fromStdString(decoder.LastError());
		emit finished(result);
        return;
    }

    FingerprintCalculator fpcalculator;
    if (!fpcalculator.start(decoder.SampleRate(), decoder.Channels())) {
        result->error = true;
        result->errorMessage = "Error while fingerpriting the file";
		emit finished(result);
        return;
	}
    decoder.Decode(&fpcalculator, AUDIO_LENGTH);
    result->fingerprint = fpcalculator.finish();

	emit finished(result);
}
开发者ID:nemesit,项目名称:acoustid-fingerprinter,代码行数:45,代码来源:analyzefiletask.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ decoder_NewPicture函数代码示例发布时间:2022-05-30
下一篇:
C++ decode_uint32函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap