diff options
author | ameerj <aj662@drexel.edu> | 2020-11-25 23:10:44 +0100 |
---|---|---|
committer | ameerj <aj662@drexel.edu> | 2020-11-25 23:10:44 +0100 |
commit | eab041866b7c766aa38258aecef8a00c03612459 (patch) | |
tree | 7ca30459bcdfb9a277c3afac9d37f7198c01f535 /src/video_core/command_classes/codecs/vp9_types.h | |
parent | Merge pull request #4946 from ameerj/alpha-test (diff) | |
download | yuzu-eab041866b7c766aa38258aecef8a00c03612459.tar yuzu-eab041866b7c766aa38258aecef8a00c03612459.tar.gz yuzu-eab041866b7c766aa38258aecef8a00c03612459.tar.bz2 yuzu-eab041866b7c766aa38258aecef8a00c03612459.tar.lz yuzu-eab041866b7c766aa38258aecef8a00c03612459.tar.xz yuzu-eab041866b7c766aa38258aecef8a00c03612459.tar.zst yuzu-eab041866b7c766aa38258aecef8a00c03612459.zip |
Diffstat (limited to 'src/video_core/command_classes/codecs/vp9_types.h')
-rw-r--r-- | src/video_core/command_classes/codecs/vp9_types.h | 154 |
1 files changed, 45 insertions, 109 deletions
diff --git a/src/video_core/command_classes/codecs/vp9_types.h b/src/video_core/command_classes/codecs/vp9_types.h index 4f0b05d22..5ca944f2a 100644 --- a/src/video_core/command_classes/codecs/vp9_types.h +++ b/src/video_core/command_classes/codecs/vp9_types.h @@ -31,62 +31,6 @@ enum FrameFlags : u32 { IntraOnly = 1 << 5, }; -enum class MvJointType { - MvJointZero = 0, /* Zero vector */ - MvJointHnzvz = 1, /* Vert zero, hor nonzero */ - MvJointHzvnz = 2, /* Hor zero, vert nonzero */ - MvJointHnzvnz = 3, /* Both components nonzero */ -}; -enum class MvClassType { - MvClass0 = 0, /* (0, 2] integer pel */ - MvClass1 = 1, /* (2, 4] integer pel */ - MvClass2 = 2, /* (4, 8] integer pel */ - MvClass3 = 3, /* (8, 16] integer pel */ - MvClass4 = 4, /* (16, 32] integer pel */ - MvClass5 = 5, /* (32, 64] integer pel */ - MvClass6 = 6, /* (64, 128] integer pel */ - MvClass7 = 7, /* (128, 256] integer pel */ - MvClass8 = 8, /* (256, 512] integer pel */ - MvClass9 = 9, /* (512, 1024] integer pel */ - MvClass10 = 10, /* (1024,2048] integer pel */ -}; - -enum class BlockSize { - Block4x4 = 0, - Block4x8 = 1, - Block8x4 = 2, - Block8x8 = 3, - Block8x16 = 4, - Block16x8 = 5, - Block16x16 = 6, - Block16x32 = 7, - Block32x16 = 8, - Block32x32 = 9, - Block32x64 = 10, - Block64x32 = 11, - Block64x64 = 12, - BlockSizes = 13, - BlockInvalid = BlockSizes -}; - -enum class PredictionMode { - DcPred = 0, // Average of above and left pixels - VPred = 1, // Vertical - HPred = 2, // Horizontal - D45Pred = 3, // Directional 45 deg = round(arctan(1 / 1) * 180 / pi) - D135Pred = 4, // Directional 135 deg = 180 - 45 - D117Pred = 5, // Directional 117 deg = 180 - 63 - D153Pred = 6, // Directional 153 deg = 180 - 27 - D207Pred = 7, // Directional 207 deg = 180 + 27 - D63Pred = 8, // Directional 63 deg = round(arctan(2 / 1) * 180 / pi) - TmPred = 9, // True-motion - NearestMv = 10, - NearMv = 11, - ZeroMv = 12, - NewMv = 13, - MbModeCount = 14 -}; - enum class TxSize { Tx4x4 = 0, // 4x4 transform Tx8x8 = 1, // 8x8 transform @@ -104,13 +48,6 @@ enum class TxMode { TxModes = 5 }; -enum class reference_mode { - SingleReference = 0, - CompoundReference = 1, - ReferenceModeSelect = 2, - ReferenceModes = 3 -}; - struct Segmentation { u8 enabled{}; u8 update_map{}; @@ -131,7 +68,7 @@ static_assert(sizeof(LoopFilter) == 0x7, "LoopFilter is an invalid size"); struct Vp9EntropyProbs { std::array<u8, 36> y_mode_prob{}; std::array<u8, 64> partition_prob{}; - std::array<u8, 2304> coef_probs{}; + std::array<u8, 1728> coef_probs{}; std::array<u8, 8> switchable_interp_prob{}; std::array<u8, 28> inter_mode_prob{}; std::array<u8, 4> intra_inter_prob{}; @@ -152,7 +89,7 @@ struct Vp9EntropyProbs { std::array<u8, 2> class_0_hp{}; std::array<u8, 2> high_precision{}; }; -static_assert(sizeof(Vp9EntropyProbs) == 0x9F4, "Vp9EntropyProbs is an invalid size"); +static_assert(sizeof(Vp9EntropyProbs) == 0x7B4, "Vp9EntropyProbs is an invalid size"); struct Vp9PictureInfo { bool is_key_frame{}; @@ -278,44 +215,41 @@ static_assert(sizeof(PictureInfo) == 0x100, "PictureInfo is an invalid size"); struct EntropyProbs { INSERT_PADDING_BYTES(1024); - std::array<std::array<u8, 4>, 7> inter_mode_prob{}; + std::array<u8, 28> inter_mode_prob{}; std::array<u8, 4> intra_inter_prob{}; INSERT_PADDING_BYTES(80); - std::array<std::array<u8, 1>, 2> tx_8x8_prob{}; - std::array<std::array<u8, 2>, 2> tx_16x16_prob{}; - std::array<std::array<u8, 3>, 2> tx_32x32_prob{}; + std::array<u8, 2> tx_8x8_prob{}; + std::array<u8, 4> tx_16x16_prob{}; + std::array<u8, 6> tx_32x32_prob{}; std::array<u8, 4> y_mode_prob_e8{}; std::array<std::array<u8, 8>, 4> y_mode_prob_e0e7{}; INSERT_PADDING_BYTES(64); - std::array<std::array<u8, 4>, 16> partition_prob{}; + std::array<u8, 64> partition_prob{}; INSERT_PADDING_BYTES(10); - std::array<std::array<u8, 2>, 4> switchable_interp_prob{}; + std::array<u8, 8> switchable_interp_prob{}; std::array<u8, 5> comp_inter_prob{}; - std::array<u8, 4> skip_probs{}; + std::array<u8, 3> skip_probs{}; + INSERT_PADDING_BYTES(1); std::array<u8, 3> joints{}; std::array<u8, 2> sign{}; - std::array<std::array<u8, 1>, 2> class_0{}; - std::array<std::array<u8, 3>, 2> fr{}; + std::array<u8, 2> class_0{}; + std::array<u8, 6> fr{}; std::array<u8, 2> class_0_hp{}; std::array<u8, 2> high_precision{}; - std::array<std::array<u8, 10>, 2> classes{}; - std::array<std::array<std::array<u8, 3>, 2>, 2> class_0_fr{}; - std::array<std::array<u8, 10>, 2> pred_bits{}; - std::array<std::array<u8, 2>, 5> single_ref_prob{}; + std::array<u8, 20> classes{}; + std::array<u8, 12> class_0_fr{}; + std::array<u8, 20> pred_bits{}; + std::array<u8, 10> single_ref_prob{}; std::array<u8, 5> comp_ref_prob{}; INSERT_PADDING_BYTES(17); - std::array<std::array<std::array<std::array<std::array<std::array<u8, 4>, 6>, 6>, 2>, 2>, 4> - coef_probs{}; + std::array<u8, 2304> coef_probs{}; void Convert(Vp9EntropyProbs& fc) { - std::memcpy(fc.inter_mode_prob.data(), inter_mode_prob.data(), fc.inter_mode_prob.size()); - - std::memcpy(fc.intra_inter_prob.data(), intra_inter_prob.data(), - fc.intra_inter_prob.size()); - - std::memcpy(fc.tx_8x8_prob.data(), tx_8x8_prob.data(), fc.tx_8x8_prob.size()); - std::memcpy(fc.tx_16x16_prob.data(), tx_16x16_prob.data(), fc.tx_16x16_prob.size()); - std::memcpy(fc.tx_32x32_prob.data(), tx_32x32_prob.data(), fc.tx_32x32_prob.size()); + fc.inter_mode_prob = std::move(inter_mode_prob); + fc.intra_inter_prob = std::move(intra_inter_prob); + fc.tx_8x8_prob = std::move(tx_8x8_prob); + fc.tx_16x16_prob = std::move(tx_16x16_prob); + fc.tx_32x32_prob = std::move(tx_32x32_prob); for (s32 i = 0; i < 4; i++) { for (s32 j = 0; j < 9; j++) { @@ -323,27 +257,29 @@ struct EntropyProbs { } } - std::memcpy(fc.partition_prob.data(), partition_prob.data(), fc.partition_prob.size()); - - std::memcpy(fc.switchable_interp_prob.data(), switchable_interp_prob.data(), - fc.switchable_interp_prob.size()); - std::memcpy(fc.comp_inter_prob.data(), comp_inter_prob.data(), fc.comp_inter_prob.size()); - std::memcpy(fc.skip_probs.data(), skip_probs.data(), fc.skip_probs.size()); - - std::memcpy(fc.joints.data(), joints.data(), fc.joints.size()); - - std::memcpy(fc.sign.data(), sign.data(), fc.sign.size()); - std::memcpy(fc.class_0.data(), class_0.data(), fc.class_0.size()); - std::memcpy(fc.fr.data(), fr.data(), fc.fr.size()); - std::memcpy(fc.class_0_hp.data(), class_0_hp.data(), fc.class_0_hp.size()); - std::memcpy(fc.high_precision.data(), high_precision.data(), fc.high_precision.size()); - std::memcpy(fc.classes.data(), classes.data(), fc.classes.size()); - std::memcpy(fc.class_0_fr.data(), class_0_fr.data(), fc.class_0_fr.size()); - std::memcpy(fc.prob_bits.data(), pred_bits.data(), fc.prob_bits.size()); - std::memcpy(fc.single_ref_prob.data(), single_ref_prob.data(), fc.single_ref_prob.size()); - std::memcpy(fc.comp_ref_prob.data(), comp_ref_prob.data(), fc.comp_ref_prob.size()); - - std::memcpy(fc.coef_probs.data(), coef_probs.data(), fc.coef_probs.size()); + fc.partition_prob = std::move(partition_prob); + fc.switchable_interp_prob = std::move(switchable_interp_prob); + fc.comp_inter_prob = std::move(comp_inter_prob); + fc.skip_probs = std::move(skip_probs); + fc.joints = std::move(joints); + fc.sign = std::move(sign); + fc.class_0 = std::move(class_0); + fc.fr = std::move(fr); + fc.class_0_hp = std::move(class_0_hp); + fc.high_precision = std::move(high_precision); + fc.classes = std::move(classes); + fc.class_0_fr = std::move(class_0_fr); + fc.prob_bits = std::move(pred_bits); + fc.single_ref_prob = std::move(single_ref_prob); + fc.comp_ref_prob = std::move(comp_ref_prob); + + // Skip the 4th element as it goes unused + for (std::size_t i = 0; i < coef_probs.size(); i += 4) { + const std::size_t j = i - i / 4; + fc.coef_probs[j] = coef_probs[i]; + fc.coef_probs[j + 1] = coef_probs[i + 1]; + fc.coef_probs[j + 2] = coef_probs[i + 2]; + } } }; static_assert(sizeof(EntropyProbs) == 0xEA0, "EntropyProbs is an invalid size"); |