mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-12-27 07:10:05 +00:00
vp9/vic: Resolve pessimizing moves
Removes the usage of moves that don't result in behavior different from a copy, or otherwise would prevent copy elision from occurring.
This commit is contained in:
parent
88089c8754
commit
cf9767c608
@ -355,7 +355,7 @@ void VP9::WriteMvProbabilityUpdate(VpxRangeEncoder& writer, u8 new_prob, u8 old_
|
|||||||
Vp9PictureInfo VP9::GetVp9PictureInfo(const NvdecCommon::NvdecRegisters& state) {
|
Vp9PictureInfo VP9::GetVp9PictureInfo(const NvdecCommon::NvdecRegisters& state) {
|
||||||
PictureInfo picture_info{};
|
PictureInfo picture_info{};
|
||||||
gpu.MemoryManager().ReadBlock(state.picture_info_offset, &picture_info, sizeof(PictureInfo));
|
gpu.MemoryManager().ReadBlock(state.picture_info_offset, &picture_info, sizeof(PictureInfo));
|
||||||
Vp9PictureInfo vp9_info = std::move(picture_info.Convert());
|
Vp9PictureInfo vp9_info = picture_info.Convert();
|
||||||
|
|
||||||
InsertEntropy(state.vp9_entropy_probs_offset, vp9_info.entropy);
|
InsertEntropy(state.vp9_entropy_probs_offset, vp9_info.entropy);
|
||||||
|
|
||||||
@ -377,7 +377,7 @@ Vp9FrameContainer VP9::GetCurrentFrame(const NvdecCommon::NvdecRegisters& state)
|
|||||||
Vp9FrameContainer frame{};
|
Vp9FrameContainer frame{};
|
||||||
{
|
{
|
||||||
gpu.SyncGuestHost();
|
gpu.SyncGuestHost();
|
||||||
frame.info = std::move(GetVp9PictureInfo(state));
|
frame.info = GetVp9PictureInfo(state);
|
||||||
frame.bit_stream.resize(frame.info.bitstream_size);
|
frame.bit_stream.resize(frame.info.bitstream_size);
|
||||||
gpu.MemoryManager().ReadBlock(state.frame_bitstream_offset, frame.bit_stream.data(),
|
gpu.MemoryManager().ReadBlock(state.frame_bitstream_offset, frame.bit_stream.data(),
|
||||||
frame.info.bitstream_size);
|
frame.info.bitstream_size);
|
||||||
@ -385,29 +385,29 @@ Vp9FrameContainer VP9::GetCurrentFrame(const NvdecCommon::NvdecRegisters& state)
|
|||||||
// Buffer two frames, saving the last show frame info
|
// Buffer two frames, saving the last show frame info
|
||||||
if (!next_next_frame.bit_stream.empty()) {
|
if (!next_next_frame.bit_stream.empty()) {
|
||||||
Vp9FrameContainer temp{
|
Vp9FrameContainer temp{
|
||||||
.info = std::move(frame.info),
|
.info = frame.info,
|
||||||
.bit_stream = std::move(frame.bit_stream),
|
.bit_stream = std::move(frame.bit_stream),
|
||||||
};
|
};
|
||||||
next_next_frame.info.show_frame = frame.info.last_frame_shown;
|
next_next_frame.info.show_frame = frame.info.last_frame_shown;
|
||||||
frame.info = std::move(next_next_frame.info);
|
frame.info = next_next_frame.info;
|
||||||
frame.bit_stream = std::move(next_next_frame.bit_stream);
|
frame.bit_stream = std::move(next_next_frame.bit_stream);
|
||||||
next_next_frame = std::move(temp);
|
next_next_frame = std::move(temp);
|
||||||
|
|
||||||
if (!next_frame.bit_stream.empty()) {
|
if (!next_frame.bit_stream.empty()) {
|
||||||
Vp9FrameContainer temp2{
|
Vp9FrameContainer temp2{
|
||||||
.info = std::move(frame.info),
|
.info = frame.info,
|
||||||
.bit_stream = std::move(frame.bit_stream),
|
.bit_stream = std::move(frame.bit_stream),
|
||||||
};
|
};
|
||||||
next_frame.info.show_frame = frame.info.last_frame_shown;
|
next_frame.info.show_frame = frame.info.last_frame_shown;
|
||||||
frame.info = std::move(next_frame.info);
|
frame.info = next_frame.info;
|
||||||
frame.bit_stream = std::move(next_frame.bit_stream);
|
frame.bit_stream = std::move(next_frame.bit_stream);
|
||||||
next_frame = std::move(temp2);
|
next_frame = std::move(temp2);
|
||||||
} else {
|
} else {
|
||||||
next_frame.info = std::move(frame.info);
|
next_frame.info = frame.info;
|
||||||
next_frame.bit_stream = std::move(frame.bit_stream);
|
next_frame.bit_stream = std::move(frame.bit_stream);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
next_next_frame.info = std::move(frame.info);
|
next_next_frame.info = frame.info;
|
||||||
next_next_frame.bit_stream = std::move(frame.bit_stream);
|
next_next_frame.bit_stream = std::move(frame.bit_stream);
|
||||||
}
|
}
|
||||||
return frame;
|
return frame;
|
||||||
@ -806,8 +806,8 @@ VpxBitStreamWriter VP9::ComposeUncompressedHeader() {
|
|||||||
const std::vector<u8>& VP9::ComposeFrameHeader(const NvdecCommon::NvdecRegisters& state) {
|
const std::vector<u8>& VP9::ComposeFrameHeader(const NvdecCommon::NvdecRegisters& state) {
|
||||||
std::vector<u8> bitstream;
|
std::vector<u8> bitstream;
|
||||||
{
|
{
|
||||||
Vp9FrameContainer curr_frame = std::move(GetCurrentFrame(state));
|
Vp9FrameContainer curr_frame = GetCurrentFrame(state);
|
||||||
current_frame_info = std::move(curr_frame.info);
|
current_frame_info = curr_frame.info;
|
||||||
bitstream = std::move(curr_frame.bit_stream);
|
bitstream = std::move(curr_frame.bit_stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ void Vic::Execute() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const VicConfig config{gpu.MemoryManager().Read<u64>(config_struct_address + 0x20)};
|
const VicConfig config{gpu.MemoryManager().Read<u64>(config_struct_address + 0x20)};
|
||||||
const AVFramePtr frame_ptr = std::move(nvdec_processor->GetFrame());
|
const AVFramePtr frame_ptr = nvdec_processor->GetFrame();
|
||||||
const auto* frame = frame_ptr.get();
|
const auto* frame = frame_ptr.get();
|
||||||
if (!frame || frame->width == 0 || frame->height == 0) {
|
if (!frame || frame->width == 0 || frame->height == 0) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user