Status MJPEGVideoDecoderBaseMFX::FillVideoParam(mfxVideoParam *par, bool /*full*/)
{
    memset(par, 0, sizeof(mfxVideoParam));

    par->mfx.CodecId = MFX_CODEC_JPEG;

    par->mfx.FrameInfo.FourCC = MFX_FOURCC_NV12;

    mfxSize size = m_frameDims;
    AdjustFrameSize(size);

    par->mfx.FrameInfo.Width = mfxU16(size.width);
    par->mfx.FrameInfo.Height = mfxU16(size.height);

    par->mfx.FrameInfo.CropX = 0;
    par->mfx.FrameInfo.CropY = 0;
    par->mfx.FrameInfo.CropH = (mfxU16) (m_frameDims.height);
    par->mfx.FrameInfo.CropW = (mfxU16) (m_frameDims.width);

    par->mfx.FrameInfo.CropW = UMC::align_value<mfxU16>(par->mfx.FrameInfo.CropW, 2);
    par->mfx.FrameInfo.CropH = UMC::align_value<mfxU16>(par->mfx.FrameInfo.CropH, 2);

    par->mfx.FrameInfo.PicStruct = (mfxU8)(m_interleaved ? MFX_PICSTRUCT_FIELD_TFF : MFX_PICSTRUCT_PROGRESSIVE);
    par->mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420;

    par->mfx.FrameInfo.AspectRatioW = 0;
    par->mfx.FrameInfo.AspectRatioH = 0;

    par->mfx.FrameInfo.FrameRateExtD = 1;
    par->mfx.FrameInfo.FrameRateExtN = 30;

    par->mfx.CodecProfile = 1;
    par->mfx.CodecLevel = 1;

    par->mfx.JPEGChromaFormat = GetMFXChromaFormat(GetChromaType());
    par->mfx.JPEGColorFormat = GetMFXColorFormat(GetColorType());
    par->mfx.Rotation  = MFX_ROTATION_0;
    par->mfx.InterleavedDec = (mfxU16)(m_interleavedScan ? MFX_SCANTYPE_INTERLEAVED : MFX_SCANTYPE_NONINTERLEAVED);

    par->mfx.NumThread = 0;

    return UMC_OK;
}
Example #2
0
void graphics::brush::BrushSet::SetColorSet(const graphics::color::ColorSet &colorSet)
{
    Clear();

    for (size_t i = 0; i < colorSet.GetNumberOfColors(); ++i) {
        auto color = colorSet.GetColor(i);
        switch (color->GetColorType()) {
        case graphics::color::IColor::COLOR_TYPE_SOLID_COLOR: {
            auto solidColor =
                std::dynamic_pointer_cast<graphics::color::SolidColor>(color);
            auto solidBrush =
                std::make_shared<graphics::brush::SolidColorBrush>();
            solidBrush->SetColor(solidColor->GetCurrentColor());
            if (solidColor->GetLabel().length() > 0) {
                solidBrush->SetLabel(solidColor->GetLabel());
                m_labelToBrashMap.insert(
                    std::make_pair<std::wstring, std::shared_ptr<graphics::brush::IBrush>>(
                        solidColor->GetLabel(),
                        solidBrush));
            }
            m_brushes.push_back(solidBrush);
        }
        break;
        case graphics::color::IColor::COLOR_TYPE_LINEAR_GRADIENT_COLOR: {
            auto linearGradientColor =
                std::dynamic_pointer_cast<graphics::color::LinearGradientColor>(color);
            auto linearBrush =
                std::make_shared<graphics::brush::LinearGradientBrush>();
            linearBrush->SetGradientDirection(linearGradientColor->GetGradientDirection());
            linearBrush->SetGradientStops(linearGradientColor->GetCurrentColor());
            if (linearGradientColor->GetLabel().length() > 0) {
                linearBrush->SetLabel(linearGradientColor->GetLabel());
                m_labelToBrashMap.insert(
                    std::make_pair<std::wstring, std::shared_ptr<graphics::brush::IBrush>>(
                        linearGradientColor->GetLabel(),
                        linearBrush));
            }
            m_brushes.push_back(linearBrush);
        }
        break;
        case graphics::color::IColor::COLOR_TYPE_RADIAL_GRADIENT_COLOR: {
            auto radialGradientColor =
                std::dynamic_pointer_cast<graphics::color::RadialGradientColor>(color);
            auto radialBrush =
                std::make_shared<graphics::brush::RadialGradientBrush>();
            radialBrush->SetGradientOriginOffsetRate(
                radialGradientColor->GetGradientOffsetX(),
                radialGradientColor->GetGradientOffsetY());
            radialBrush->SetGradientStops(radialGradientColor->GetCurrentColor());
            if (radialGradientColor->GetLabel().length() > 0) {
                radialBrush->SetLabel(radialGradientColor->GetLabel());
                m_labelToBrashMap.insert(
                    std::make_pair<std::wstring, std::shared_ptr<graphics::brush::IBrush>>(
                        radialGradientColor->GetLabel(),
                        radialBrush));
            }
            m_brushes.push_back(radialBrush);
        }
        break;
        }
    }
}