/* * Copyright (c) 2014 The WebM project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/
class InvalidFileTest : public ::libvpx_test::DecoderTest, public ::libvpx_test::CodecTestWithParam<DecodeParam> { protected:
InvalidFileTest() : DecoderTest(GET_PARAM(0)), res_file_(nullptr) {}
~InvalidFileTest() override { if (res_file_ != nullptr) fclose(res_file_);
}
// Read integer result. constint res = fscanf(res_file_, "%d", &expected_res_dec);
EXPECT_NE(res, EOF) << "Read result data failed";
// Check results match. const DecodeParam input = GET_PARAM(1); if (input.threads > 1) { // The serial decode check is too strict for tile-threaded decoding as // there is no guarantee on the decode order nor which specific error // will take precedence. Currently a tile-level error is not forwarded so // the frame will simply be marked corrupt.
EXPECT_TRUE(res_dec == expected_res_dec ||
res_dec == VPX_CODEC_CORRUPT_FRAME)
<< "Results don't match: frame number = " << video.frame_number()
<< ". (" << decoder->DecodeError()
<< "). Expected: " << expected_res_dec << " or "
<< VPX_CODEC_CORRUPT_FRAME;
} else {
EXPECT_EQ(expected_res_dec, res_dec)
<< "Results don't match: frame number = " << video.frame_number()
<< ". (" << decoder->DecodeError() << ")";
}
// Open compressed video file.
std::unique_ptr<libvpx_test::CompressedVideoSource> video; if (filename.substr(filename.length() - 3, 3) == "ivf") {
video.reset(new libvpx_test::IVFVideoSource(filename));
} elseif (filename.substr(filename.length() - 4, 4) == "webm") { #if CONFIG_WEBM_IO
video.reset(new libvpx_test::WebMVideoSource(filename)); #else
fprintf(stderr, "WebM IO is disabled, skipping test vector %s\n",
filename.c_str()); return; #endif
}
ASSERT_NE(video.get(), nullptr);
video->Init();
// Construct result file name. The file holds a list of expected integer // results, one for each decoded frame. Any result that doesn't match // the files list will cause a test failure. const std::string res_filename = filename + ".res";
OpenResFile(res_filename);
// Decode frame, and check the md5 matching.
ASSERT_NO_FATAL_FAILURE(RunLoop(video.get(), cfg));
}
// This class will include test vectors that are expected to fail // peek. However they are still expected to have no fatal failures. class InvalidFileInvalidPeekTest : public InvalidFileTest { protected:
InvalidFileInvalidPeekTest() : InvalidFileTest() {} void HandlePeekResult(libvpx_test::Decoder *const/*decoder*/,
libvpx_test::CompressedVideoSource * /*video*/, const vpx_codec_err_t /*res_peek*/) override {}
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.