Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vp8_decode: Ensure the Partition0BitOffset in VP8_BSD_OBJECT #535

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ typedef struct _CODEC_VP8_PIC_PARAMS
uint8_t ucP0EntropyValue;
uint32_t uiP0EntropyRange;
uint32_t uiFirstMbByteOffset;
uint32_t uiP0FirstmbbitoffsetFromFrameHeader;
uint32_t uiPartitionSize[CODEC_VP8_MAX_PARTITION_NUMBER];

uint32_t uiStatusReportFeedbackNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2828,6 +2828,7 @@ class MhwVdboxMfxInterfaceGeneric : public MhwVdboxMfxInterface

uint8_t numPartitions = (1 << vp8PicParams->CodedCoeffTokenPartition);

cmd.DW1.Partition0FirstmbbitoffsetFromFrameHeader = vp8PicParams->uiP0FirstmbbitoffsetFromFrameHeader;
cmd.DW1.CodedNumOfCoeffTokenPartitions = vp8PicParams->CodedCoeffTokenPartition;
cmd.DW1.Partition0CpbacEntropyRange = vp8PicParams->uiP0EntropyRange;
cmd.DW1.Partition0CpbacEntropyCount = vp8PicParams->ucP0EntropyCount;
Expand Down
3 changes: 2 additions & 1 deletion media_driver/linux/common/codec/ddi/media_ddi_decode_vp8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ VAStatus DdiDecodeVP8::ParseSliceParams(
//macroblock_offset is in unit of bit.it should be always the next byte, the byte is divided to two parts
//used bits and remaining bits, if used bits == 8, uiFirstMbByteOffset should add 1, so use 8 to do the ceil operator
picParams->uiFirstMbByteOffset = slcParam->slice_data_offset + ((slcParam->macroblock_offset + 8) >> 3);

//offset to the first bit of MB from the first byte of partition data
picParams->uiP0FirstmbbitoffsetFromFrameHeader = slcParam->macroblock_offset & 0x7;
MOS_SecureMemcpy(picParams->uiPartitionSize, sizeof(picParams->uiPartitionSize), slcParam->partition_size, sizeof(picParams->uiPartitionSize));
//partition 0 size in command buffer includes the one byte in bool decoder if remaining bits of bool decoder is zero.
picParams->uiPartitionSize[0] -= (slcParam->macroblock_offset & 0x7) ? 0 : 1;
Expand Down