Пример #1
0
TEST_P(DecoderOutputTest, CompareOutput) {
  FileParam p = GetParam();
  DecodeFile(p.fileName, this);

  unsigned char digest[SHA_DIGEST_LENGTH];
  SHA1Result(&ctx_, digest);
  if (!HasFatalFailure()) {
    CompareHash(digest, p.hashStr);
  }
}
Пример #2
0
TEST_P(DecodeEncodeTest, CompareOutput) {
  DecodeEncodeFileParam p = GetParam();

  ASSERT_TRUE(Open(p.fileName));
  EncodeStream(this, p.width, p.height, p.frameRate, this);
  unsigned char digest[SHA_DIGEST_LENGTH];
  SHA1_Final(digest, &ctx_);
  if (!HasFatalFailure()) {
    ASSERT_TRUE(CompareHash(digest, p.hashStr));
  }
}
Пример #3
0
TEST_P (DecodeEncodeTest, CompareOutput) {
  DecodeEncodeFileParam p = GetParam();

  ASSERT_TRUE (Open (p.fileName));
  EncodeStream (this, CAMERA_VIDEO_REAL_TIME, p.width, p.height, p.frameRate, SM_SINGLE_SLICE, false, 1, this);
  unsigned char digest[SHA_DIGEST_LENGTH];
  SHA1Result (&ctx_, digest);
  if (!HasFatalFailure()) {
    CompareHash (digest, p.hashStr);
  }
}
Пример #4
0
TEST_P (EncoderOutputTest, CompareOutput) {
  EncodeFileParam p = GetParam();
  EncodeFile (p.fileName, p.usageType , p.width, p.height, p.frameRate, p.slices, p.denoise, p.layers, this);

  //will remove this after screen content algorithms are ready,
  //because the bitstream output will vary when the different algorithms are added.
  unsigned char digest[SHA_DIGEST_LENGTH];
  SHA1Result (&ctx_, digest);
  if (!HasFatalFailure()) {
    CompareHash (digest, p.hashStr);
  }
}
Пример #5
0
TEST_P (DecoderOutputTest, CompareOutput) {
  FileParam p = GetParam();
#if defined(ANDROID_NDK)
  std::string filename = std::string ("/sdcard/") + p.fileName;
  DecodeFile (filename.c_str(), this);
#else
  DecodeFile (p.fileName, this);
#endif

  unsigned char digest[SHA_DIGEST_LENGTH];
  SHA1Result (&ctx_, digest);
  if (!HasFatalFailure()) {
    CompareHash (digest, p.hashStr);
  }
}
Пример #6
0
TEST_P (EncoderOutputTest, CompareOutput) {
  EncodeFileParam p = GetParam();
#if defined(ANDROID_NDK)
  std::string filename = std::string ("/sdcard/") + p.fileName;
  EncodeFile (filename.c_str(), p.usageType , p.width, p.height, p.frameRate, p.slices, p.denoise, p.layers, p.isLossless, p.enableLtr, this);
#else
  EncodeFile (p.fileName, p.usageType , p.width, p.height, p.frameRate, p.slices, p.denoise, p.layers, p.isLossless, p.enableLtr, this);
#endif
  //will remove this after screen content algorithms are ready,
  //because the bitstream output will vary when the different algorithms are added.
  unsigned char digest[SHA_DIGEST_LENGTH];
  SHA1Result (&ctx_, digest);
  if (!HasFatalFailure()) {
    CompareHash (digest, p.hashStr);
  }
}
Пример #7
0
TEST_P (DecodeEncodeTest, CompareOutput) {
    DecodeEncodeFileParam p = GetParam();
    SEncParamExt  EnxParamExt;
    DecEncFileParamToParamExt (&p, &EnxParamExt);

#if defined(ANDROID_NDK)
    std::string filename = std::string ("/sdcard/") + p.fileName;
    ASSERT_TRUE (Open (filename.c_str()));
#else
    ASSERT_TRUE (Open (p.fileName));
#endif
    EncodeStream (this, &EnxParamExt, this);
    unsigned char digest[SHA_DIGEST_LENGTH];
    SHA1Result (&ctx_, digest);
    if (!HasFatalFailure()) {
        CompareHash (digest, p.hashStr);
    }
}
Пример #8
0
TEST_P (EncoderOutputTest, CompareOutput) {
  EncodeFileParam p = GetParam();
  SEncParamExt EnxParamExt;

  EncFileParamToParamExt (&p, &EnxParamExt);

#if defined(ANDROID_NDK)
  std::string filename = std::string ("/sdcard/") + p.pkcFileName;
  EncodeFile (p.pkcFileName, &EnxParamExt, this);
#else
  EncodeFile (p.pkcFileName, &EnxParamExt, this);
#endif
  //will remove this after screen content algorithms are ready,
  //because the bitstream output will vary when the different algorithms are added.
  unsigned char digest[SHA_DIGEST_LENGTH];
  SHA1Result (&ctx_, digest);
  if (!HasFatalFailure()) {
    CompareHash (digest, p.pkcHashStr);
  }
}
Пример #9
0
static void CompareFileToHash(ISVCEncoder* encoder,
    const char* fileName, const char* hashStr,
    int width, int height, float frameRate) {
  std::ifstream file(fileName, std::ios::in | std::ios::binary);
  ASSERT_TRUE(file.is_open());

  int rv = InitWithParam(encoder, width, height, frameRate);
  ASSERT_TRUE(rv == cmResultSuccess);

  // I420: 1(Y) + 1/4(U) + 1/4(V)
  int frameSize = width * height * 3 / 2;

  BufferedData buf;
  buf.SetLength(frameSize);
  ASSERT_TRUE(buf.Length() == frameSize);
  char* data = reinterpret_cast<char*>(buf.data());

  SFrameBSInfo info;
  memset(&info, 0, sizeof(SFrameBSInfo));

  unsigned char digest[SHA_DIGEST_LENGTH];
  SHA_CTX ctx;
  SHA1_Init(&ctx);

  while (file.read(data, frameSize), file.gcount() == frameSize) {
    rv = encoder->EncodeFrame(buf.data(), &info);
    if (rv == videoFrameTypeInvalid) {
      SHA1_Final(digest, &ctx);
      FAIL() << "unable to encode frame";
    }
    if (rv != videoFrameTypeSkip) {
      UpdateHashFromFrame(info, &ctx);
    }
  }

  SHA1_Final(digest, &ctx);
  ASSERT_TRUE(CompareHash(digest, hashStr));
}