summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorameerj <aj662@drexel.edu>2020-11-26 06:18:26 +0100
committerameerj <aj662@drexel.edu>2020-11-26 06:18:26 +0100
commitc9e3abe2060760d71c83a1574559b6e479e637d2 (patch)
tree2c29ff2c4ba95f7219b0654b5c1c32b23288cd54 /src
parentQueue decoded frames, cleanup decoders (diff)
downloadyuzu-c9e3abe2060760d71c83a1574559b6e479e637d2.tar
yuzu-c9e3abe2060760d71c83a1574559b6e479e637d2.tar.gz
yuzu-c9e3abe2060760d71c83a1574559b6e479e637d2.tar.bz2
yuzu-c9e3abe2060760d71c83a1574559b6e479e637d2.tar.lz
yuzu-c9e3abe2060760d71c83a1574559b6e479e637d2.tar.xz
yuzu-c9e3abe2060760d71c83a1574559b6e479e637d2.tar.zst
yuzu-c9e3abe2060760d71c83a1574559b6e479e637d2.zip
Diffstat (limited to 'src')
-rw-r--r--src/video_core/command_classes/codecs/codec.cpp15
-rw-r--r--src/video_core/command_classes/codecs/codec.h4
-rw-r--r--src/video_core/command_classes/codecs/vp9.cpp2
-rw-r--r--src/video_core/command_classes/codecs/vp9_types.h44
4 files changed, 33 insertions, 32 deletions
diff --git a/src/video_core/command_classes/codecs/codec.cpp b/src/video_core/command_classes/codecs/codec.cpp
index 1a19341c8..412e1e41c 100644
--- a/src/video_core/command_classes/codecs/codec.cpp
+++ b/src/video_core/command_classes/codecs/codec.cpp
@@ -18,7 +18,7 @@ extern "C" {
namespace Tegra {
-void av_frame_deleter(AVFrame* ptr) {
+void AVFrameDeleter(AVFrame* ptr) {
av_frame_unref(ptr);
av_free(ptr);
}
@@ -101,7 +101,7 @@ void Codec::Decode() {
if (!vp9_hidden_frame) {
// Only receive/store visible frames
- AVFramePtr frame = AVFramePtr{av_frame_alloc(), av_frame_deleter};
+ AVFramePtr frame = AVFramePtr{av_frame_alloc(), AVFrameDeleter};
avcodec_receive_frame(av_codec_ctx, frame.get());
av_frames.push(std::move(frame));
}
@@ -110,12 +110,13 @@ void Codec::Decode() {
AVFramePtr Codec::GetCurrentFrame() {
// Sometimes VIC will request more frames than have been decoded.
// in this case, return a nullptr and don't overwrite previous frame data
- if (av_frames.size() > 0) {
- AVFramePtr frame = std::move(av_frames.front());
- av_frames.pop();
- return frame;
+ if (av_frames.empty()) {
+ return AVFramePtr{nullptr, AVFrameDeleter};
}
- return AVFramePtr{nullptr, av_frame_deleter};
+
+ AVFramePtr frame = std::move(av_frames.front());
+ av_frames.pop();
+ return frame;
}
NvdecCommon::VideoCodec Codec::GetCurrentCodec() const {
diff --git a/src/video_core/command_classes/codecs/codec.h b/src/video_core/command_classes/codecs/codec.h
index c26b59fde..0c6dde405 100644
--- a/src/video_core/command_classes/codecs/codec.h
+++ b/src/video_core/command_classes/codecs/codec.h
@@ -23,8 +23,8 @@ namespace Tegra {
class GPU;
struct VicRegisters;
-void av_frame_deleter(AVFrame* ptr);
-using AVFramePtr = std::unique_ptr<AVFrame, decltype(&av_frame_deleter)>;
+void AVFrameDeleter(AVFrame* ptr);
+using AVFramePtr = std::unique_ptr<AVFrame, decltype(&AVFrameDeleter)>;
namespace Decoder {
class H264;
diff --git a/src/video_core/command_classes/codecs/vp9.cpp b/src/video_core/command_classes/codecs/vp9.cpp
index 31e00c27d..b1d675cdb 100644
--- a/src/video_core/command_classes/codecs/vp9.cpp
+++ b/src/video_core/command_classes/codecs/vp9.cpp
@@ -306,7 +306,7 @@ void VP9::WriteCoefProbabilityUpdate(VpxRangeEncoder& writer, s32 tx_mode,
const std::array<u8, 1728>& old_prob) {
constexpr u32 block_bytes = 2 * 2 * 6 * 6 * 3;
- const auto needs_update = [&](u32 base_index) -> bool {
+ const auto needs_update = [&](u32 base_index) {
return !std::equal(new_prob.begin() + base_index,
new_prob.begin() + base_index + block_bytes,
old_prob.begin() + base_index);
diff --git a/src/video_core/command_classes/codecs/vp9_types.h b/src/video_core/command_classes/codecs/vp9_types.h
index 5ca944f2a..139501a1c 100644
--- a/src/video_core/command_classes/codecs/vp9_types.h
+++ b/src/video_core/command_classes/codecs/vp9_types.h
@@ -245,33 +245,33 @@ struct EntropyProbs {
std::array<u8, 2304> coef_probs{};
void Convert(Vp9EntropyProbs& fc) {
- 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);
+ fc.inter_mode_prob = inter_mode_prob;
+ fc.intra_inter_prob = intra_inter_prob;
+ fc.tx_8x8_prob = tx_8x8_prob;
+ fc.tx_16x16_prob = tx_16x16_prob;
+ fc.tx_32x32_prob = tx_32x32_prob;
- for (s32 i = 0; i < 4; i++) {
- for (s32 j = 0; j < 9; j++) {
+ for (std::size_t i = 0; i < 4; i++) {
+ for (std::size_t j = 0; j < 9; j++) {
fc.y_mode_prob[j + 9 * i] = j < 8 ? y_mode_prob_e0e7[i][j] : y_mode_prob_e8[i];
}
}
- 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);
+ fc.partition_prob = partition_prob;
+ fc.switchable_interp_prob = switchable_interp_prob;
+ fc.comp_inter_prob = comp_inter_prob;
+ fc.skip_probs = skip_probs;
+ fc.joints = joints;
+ fc.sign = sign;
+ fc.class_0 = class_0;
+ fc.fr = fr;
+ fc.class_0_hp = class_0_hp;
+ fc.high_precision = high_precision;
+ fc.classes = classes;
+ fc.class_0_fr = class_0_fr;
+ fc.prob_bits = pred_bits;
+ fc.single_ref_prob = single_ref_prob;
+ fc.comp_ref_prob = comp_ref_prob;
// Skip the 4th element as it goes unused
for (std::size_t i = 0; i < coef_probs.size(); i += 4) {