shithub: openh264

Download patch

ref: dfd3d89a20056214bd3746b400f81c394a836676
parent: d63fc1004ef6cf2a5998d222b9b2495c4187ed2c
author: sijchen <[email protected]>
date: Mon Mar 10 12:57:19 EDT 2014

specific slice mode in encoder test

--- a/test/BaseEncoderTest.cpp
+++ b/test/BaseEncoderTest.cpp
@@ -6,8 +6,8 @@
 #include "BaseEncoderTest.h"
 
 static int InitWithParam(ISVCEncoder* encoder, int width,
-    int height, float frameRate, bool slices) {
-  if (!slices) {
+    int height, float frameRate, SliceModeEnum sliceMode) {
+  if (SM_SINGLE_SLICE == sliceMode) {
     SEncParamBase param;
     memset (&param, 0, sizeof(SEncParamBase));
 
@@ -33,7 +33,7 @@
     param.sSpatialLayers[0].fFrameRate = frameRate;
     param.sSpatialLayers[0].iSpatialBitrate = param.iTargetBitrate;
 
-    param.sSpatialLayers[0].sSliceCfg.uiSliceMode = SM_ROWMB_SLICE;
+    param.sSpatialLayers[0].sSliceCfg.uiSliceMode = sliceMode;
 
     return encoder->InitializeExt(&param);
   }
@@ -55,7 +55,7 @@
 }
 
 void BaseEncoderTest::EncodeStream(InputStream* in, int width, int height,
-    float frameRate, bool slices, Callback* cbk) {
+    float frameRate, SliceModeEnum slices, Callback* cbk) {
   int rv = InitWithParam(encoder_, width, height, frameRate, slices);
   ASSERT_TRUE(rv == cmResultSuccess);
 
@@ -89,7 +89,7 @@
 }
 
 void BaseEncoderTest::EncodeFile(const char* fileName, int width, int height,
-    float frameRate, bool slices, Callback* cbk) {
+    float frameRate, SliceModeEnum slices, Callback* cbk) {
   FileInputStream fileStream;
   ASSERT_TRUE(fileStream.Open(fileName));
   EncodeStream(&fileStream, width, height, frameRate, slices, cbk);
--- a/test/BaseEncoderTest.h
+++ b/test/BaseEncoderTest.h
@@ -14,8 +14,8 @@
   BaseEncoderTest();
   void SetUp();
   void TearDown();
-  void EncodeFile(const char* fileName, int width, int height, float frameRate, bool slices, Callback* cbk);
-  void EncodeStream(InputStream* in, int width, int height, float frameRate, bool slices, Callback* cbk);
+  void EncodeFile(const char* fileName, int width, int height, float frameRate, SliceModeEnum slices, Callback* cbk);
+  void EncodeStream(InputStream* in, int width, int height, float frameRate, SliceModeEnum slices, Callback* cbk);
 
  private:
   ISVCEncoder* encoder_;
--- a/test/decode_encode_test.cpp
+++ b/test/decode_encode_test.cpp
@@ -95,7 +95,7 @@
   DecodeEncodeFileParam p = GetParam();
 
   ASSERT_TRUE(Open(p.fileName));
-  EncodeStream(this, p.width, p.height, p.frameRate, false, this);
+  EncodeStream(this, p.width, p.height, p.frameRate, SM_SINGLE_SLICE, this);
   unsigned char digest[SHA_DIGEST_LENGTH];
   SHA1Result(&ctx_, digest);
   if (!HasFatalFailure()) {
--- a/test/encoder_test.cpp
+++ b/test/encoder_test.cpp
@@ -31,7 +31,7 @@
   int width;
   int height;
   float frameRate;
-  bool slices;
+  SliceModeEnum slices;
 };
 
 class EncoderOutputTest : public ::testing::WithParamInterface<EncodeFileParam>,
@@ -66,19 +66,19 @@
 static const EncodeFileParam kFileParamArray[] = {
   {
       "res/CiscoVT2people_320x192_12fps.yuv",
-      "06441376891cbc237a36e59b62131cd94ff9cb19", 320, 192, 12.0f, false
+      "06441376891cbc237a36e59b62131cd94ff9cb19", 320, 192, 12.0f, SM_SINGLE_SLICE
   },
   {
       "res/CiscoVT2people_160x96_6fps.yuv",
-      "4f3759fc44125b27a179ebff158dbba9e431bd0b", 160, 96, 6.0f, false
+      "4f3759fc44125b27a179ebff158dbba9e431bd0b", 160, 96, 6.0f, SM_SINGLE_SLICE
   },
   {
       "res/Static_152_100.yuv",
-      "af5c6a41b567ce1b2cb6fd427f4379473d3b829f", 152, 100, 6.0f, false
+      "af5c6a41b567ce1b2cb6fd427f4379473d3b829f", 152, 100, 6.0f, SM_SINGLE_SLICE
   },
   {
       "res/CiscoVT2people_320x192_12fps.yuv",
-      "be0079b022b18fdce04570db24e4327ca26a0ecb", 320, 192, 12.0f, true
+      "be0079b022b18fdce04570db24e4327ca26a0ecb", 320, 192, 12.0f, SM_ROWMB_SLICE // One slice per MB row
   },
 };