Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

Commit

Permalink
Release v2021.5.0
Browse files Browse the repository at this point in the history
New in This Release
-------------------

* Updated API version dependency to 2.4
* Improved warnings for incompatible parameters
* Numerous minor bugs fixed

Issues and Limitations
----------------------
* Decode input bitstream buffer size must be large enough to hold
  several frames. Buffer sizes that are too small may cause issues. The
  necessary minimum size is stream dependent but enough for 10 frames is
  a conservative estimate.
* AVC/H.264 encode is disabled due to licensing restrictions. To enable
  it, refer to the instructions to [Optionally enable H.264
  encode](https://github.com/oneapi-src/oneVPL-cpu#optionally-enable-h264-encode).
* A subset of parameters and functions from the specification are
  implemented. For more information on mandatory and optional APIs and
  features, see the [oneVPL
  specification](https://spec.oneapi.com/versions/latest/elements/oneVPL/source/VPL_summary.html#mandatory-optional-apis-and-features).
* For the Windows* release, Visual C++* Redistributable for Visual
  Studio* 2015 or higher is required. Without this, an error reporting a
  missing MSVCP140.dll will be generated.
* MFX_BITSTREAM_EOS from the input bitstream dataFlag is ignored by
  MFXVideoDECODE_DecodeFrameAsync().
  • Loading branch information
mav-intel committed Aug 4, 2021
1 parent 19f2e5a commit a259736
Show file tree
Hide file tree
Showing 32 changed files with 1,015 additions and 430 deletions.
4 changes: 2 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DerivePointerAlignment: true
DerivePointerAlignment: false
DisableFormat: false
FixNamespaceComments: true
ForEachMacros:
Expand Down Expand Up @@ -88,7 +88,7 @@ PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
PointerAlignment: Right
RawStringFormats:
- Language: Cpp
Delimiters:
Expand Down
6 changes: 3 additions & 3 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Add `gpl` to the build commands to enable H.264 encode capability.
For Linux:
```
script/bootstrap gpl
source script/bootstrap gpl
script/build gpl
script/install
```
Expand All @@ -110,9 +110,9 @@ script\install
The bootstrap and build scripts accept additional options. See the -h flag for more details.
To build in debug mode:
To build in debug mode in Linux:
```
script/bootstrap --config Debug
source script/bootstrap --config Debug
script/build --config Debug
script/install
```
Expand Down
20 changes: 20 additions & 0 deletions cmake/CompileOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,30 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
endif(UNIX)
endif()

if(ENABLE_WARNING_AS_ERROR)
message(STATUS "Warnings as errors enabled")
set(MFX_DEPRECATED_OFF 1)
endif()

if(DEFINED ENV{MFX_DEPRECATED_OFF})
set(MFX_DEPRECATED_OFF 1)
endif()

if(MFX_DEPRECATED_OFF)
message(STATUS "Deprecation warnings disabled")
add_definitions(-DMFX_DEPRECATED_OFF)
endif()

if(MSVC)
add_link_options("/DYNAMICBASE")
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
add_link_options("/HIGHENTROPYVA")
endif()
add_link_options("/LARGEADDRESSAWARE")
add_link_options("/NXCOMPAT")
if(ENABLE_WARNING_AS_ERROR)
add_compile_options("/WX")
endif()
add_compile_options("/GS")
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D \"SAFESEH:NO\"")
Expand All @@ -36,4 +53,7 @@ else()
add_compile_options("-fstack-protector-strong")
set(CMAKE_CXX_FLAGS "-z relro -z now -z noexecstack")
add_compile_options("-Wall")
if(ENABLE_WARNING_AS_ERROR)
add_compile_options("-Werror")
endif()
endif()
2 changes: 1 addition & 1 deletion cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ if(POLICY CMP0074)
cmake_policy(SET CMP0074 OLD)
endif()

find_package(VPL 2.2 REQUIRED COMPONENTS api)
find_package(VPL 2.4 REQUIRED COMPONENTS api)
message(STATUS "Found VPL (version ${VPL_VERSION})")
target_link_libraries(${TARGET} PUBLIC VPL::api)

Expand Down
4 changes: 4 additions & 0 deletions cpu/src/cpu_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ uint32_t AVPixelFormat2MFXFourCC(int format) {
return MFX_FOURCC_RGB4;
case AV_PIX_FMT_YUV420P:
return MFX_FOURCC_I420;
default:
return 0;
}
return 0;
}
Expand Down Expand Up @@ -63,6 +65,8 @@ mfxU32 AVCodecID_to_MFXCodecId(AVCodecID CodecId) {
return MFX_CODEC_JPEG;
case AV_CODEC_ID_AV1:
return MFX_CODEC_AV1;
default:
return 0;
}
return 0;
}
Expand Down
20 changes: 10 additions & 10 deletions cpu/src/cpu_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ extern "C" {
#include <iostream>
class TraceObject {
public:
explicit TraceObject(const char* name) : m_name(name) {
explicit TraceObject(const char *name) : m_name(name) {
std::cout << "### entering " << name << std::endl;
}
~TraceObject() {
std::cout << "### leaving " << m_name << std::endl;
}

protected:
const char* m_name;
const char *m_name;
};

#define VPL_TRACE(_NAME) TraceObject trace_object(_NAME)
Expand Down Expand Up @@ -106,15 +106,15 @@ uint32_t AVPixelFormat2MFXFourCC(int format);
AVCodecID MFXCodecId_to_AVCodecID(mfxU32 CodecId);
mfxU32 AVCodecID_to_MFXCodecId(AVCodecID CodecId);

std::shared_ptr<AVFrame> GetAVFrameFromMfxSurface(mfxFrameSurface1* surface,
mfxFrameAllocator* allocator);
std::shared_ptr<AVFrame> GetAVFrameFromMfxSurface(mfxFrameSurface1 *surface,
mfxFrameAllocator *allocator);

// copy image data from AVFrame to mfxFrameSurface1
mfxStatus AVFrame2mfxFrameSurface(mfxFrameSurface1* surface,
AVFrame* frame,
mfxFrameAllocator* allocator);
mfxStatus AVFrame2mfxFrameSurface(mfxFrameSurface1 *surface,
AVFrame *frame,
mfxFrameAllocator *allocator);

mfxStatus CheckFrameInfoCommon(mfxFrameInfo* info, mfxU32 codecId);
mfxStatus CheckFrameInfoCodecs(mfxFrameInfo* info, mfxU32 codecId);
mfxStatus CheckVideoParamCommon(mfxVideoParam* in);
mfxStatus CheckFrameInfoCommon(mfxFrameInfo *info, mfxU32 codecId);
mfxStatus CheckFrameInfoCodecs(mfxFrameInfo *info, mfxU32 codecId);
mfxStatus CheckVideoParamCommon(mfxVideoParam *in);
#endif // CPU_SRC_CPU_COMMON_H_
16 changes: 8 additions & 8 deletions cpu/src/cpu_decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
#include "src/cpu_workstream.h"

CpuDecode::CpuDecode(CpuWorkstream *session)
: m_session(session),
m_avDecCodec(nullptr),
: m_avDecCodec(nullptr),
m_avDecContext(nullptr),
m_avDecParser(nullptr),
m_avDecPacket(nullptr),
m_avDecFrameOut(nullptr),
m_swsContext(nullptr),
m_param(),
m_decSurfaces(),
m_frameOrder(0),
m_bFrameBuffered(false),
m_bStreamInfo(false),
m_bFrameBuffered(false) {}
m_session(session),
m_frameOrder(0) {}

mfxStatus CpuDecode::ValidateDecodeParams(mfxVideoParam *par, bool canCorrect) {
bool fixedIncompatible = false;
Expand Down Expand Up @@ -166,10 +166,10 @@ mfxStatus CpuDecode::InitDecode(mfxVideoParam *par, mfxBitstream *bs) {
AVCodecID cid = MFXCodecId_to_AVCodecID(par->mfx.CodecId);
RET_IF_FALSE(cid, MFX_ERR_INVALID_VIDEO_PARAM);

mfxStatus valSts = MFX_ERR_NONE;
if (!bs) {
mfxStatus sts = ValidateDecodeParams(par, false);
if (sts != MFX_ERR_NONE)
return sts;
valSts = ValidateDecodeParams(par, false);
RET_ERROR(valSts);
}

m_avDecCodec = avcodec_find_decoder(cid);
Expand Down Expand Up @@ -231,7 +231,7 @@ mfxStatus CpuDecode::InitDecode(mfxVideoParam *par, mfxBitstream *bs) {
GetVideoParam(par);
}

return MFX_ERR_NONE;
return valSts;
}

CpuDecode::~CpuDecode() {
Expand Down
44 changes: 22 additions & 22 deletions cpu/src/cpu_decode.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,44 +15,44 @@ class CpuWorkstream;

class CpuDecode {
public:
explicit CpuDecode(CpuWorkstream* session);
explicit CpuDecode(CpuWorkstream *session);
~CpuDecode();

static mfxStatus DecodeQuery(mfxVideoParam* in, mfxVideoParam* out);
static mfxStatus DecodeQueryIOSurf(mfxVideoParam* par, mfxFrameAllocRequest* request);
static mfxStatus DecodeQuery(mfxVideoParam *in, mfxVideoParam *out);
static mfxStatus DecodeQueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest *request);

mfxStatus InitDecode(mfxVideoParam* par, mfxBitstream* bs);
mfxStatus DecodeFrame(mfxBitstream* bs,
mfxFrameSurface1* surface_work,
mfxFrameSurface1** surface_out);
mfxStatus GetVideoParam(mfxVideoParam* par);
mfxStatus GetDecodeSurface(mfxFrameSurface1** surface);
mfxStatus InitDecode(mfxVideoParam *par, mfxBitstream *bs);
mfxStatus DecodeFrame(mfxBitstream *bs,
mfxFrameSurface1 *surface_work,
mfxFrameSurface1 **surface_out);
mfxStatus GetVideoParam(mfxVideoParam *par);
mfxStatus GetDecodeSurface(mfxFrameSurface1 **surface);

mfxStatus CheckVideoParamDecoders(mfxVideoParam* in);
mfxStatus IsSameVideoParam(mfxVideoParam* newPar, mfxVideoParam* oldPar);
mfxStatus CheckVideoParamDecoders(mfxVideoParam *in);
mfxStatus IsSameVideoParam(mfxVideoParam *newPar, mfxVideoParam *oldPar);

private:
static mfxStatus ValidateDecodeParams(mfxVideoParam* par, bool canCorrect);
AVFrame* ConvertJPEGOutputColorSpace(AVFrame* avframe, AVPixelFormat target_pixfmt);
const AVCodec* m_avDecCodec;
AVCodecContext* m_avDecContext;
AVCodecParserContext* m_avDecParser;
AVPacket* m_avDecPacket;
AVFrame* m_avDecFrameOut;
struct SwsContext* m_swsContext;
static mfxStatus ValidateDecodeParams(mfxVideoParam *par, bool canCorrect);
AVFrame *ConvertJPEGOutputColorSpace(AVFrame *avframe, AVPixelFormat target_pixfmt);
const AVCodec *m_avDecCodec;
AVCodecContext *m_avDecContext;
AVCodecParserContext *m_avDecParser;
AVPacket *m_avDecPacket;
AVFrame *m_avDecFrameOut;
struct SwsContext *m_swsContext;

mfxVideoParam m_param;
std::unique_ptr<CpuFramePool> m_decSurfaces;
bool m_bFrameBuffered;
bool m_bStreamInfo;

CpuWorkstream* m_session;
CpuWorkstream *m_session;

mfxU32 m_frameOrder;

/* copy not allowed */
CpuDecode(const CpuDecode&);
CpuDecode& operator=(const CpuDecode&);
CpuDecode(const CpuDecode &);
CpuDecode &operator=(const CpuDecode &);
};

#endif // CPU_SRC_CPU_DECODE_H_
Loading

0 comments on commit a259736

Please sign in to comment.