yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

Address PR feedback

remove some redundant moves, make deleter match naming guidelines.

Co-Authored-By: LC <712067+lioncash@users.noreply.github.com>
This commit is contained in:
ameerj 2020-11-26 00:18:26 -05:00
parent eab041866b
commit c9e3abe206
4 changed files with 33 additions and 32 deletions

View File

@ -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 {

View File

@ -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;

View File

@ -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);

View File

@ -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) {