Move template specializations into .cc from .h
Change-Id: I6d8775c1fa228fde25016a401e3c22a8e3da42f9
This commit is contained in:
		
							
								
								
									
										58
									
								
								test/randomise.cc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								test/randomise.cc
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,58 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 *  Copyright (c) 2016 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.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "test/randomise.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace libvpx_test {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Add further specialisations as necessary
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					template<>
 | 
				
			||||||
 | 
					bool Randomise::uniform<bool>() {
 | 
				
			||||||
 | 
					  return rnd_.Rand8() & 1 ? true : false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					template<>
 | 
				
			||||||
 | 
					uint8_t Randomise::uniform<uint8_t>() {
 | 
				
			||||||
 | 
					  return rnd_.Rand8();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					template<>
 | 
				
			||||||
 | 
					uint16_t Randomise::uniform<uint16_t>() {
 | 
				
			||||||
 | 
					  return rnd_.Rand16();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					template<>
 | 
				
			||||||
 | 
					uint32_t Randomise::uniform<uint32_t>() {
 | 
				
			||||||
 | 
					  const uint32_t l = uniform<uint16_t>();
 | 
				
			||||||
 | 
					  const uint32_t h = uniform<uint16_t>();
 | 
				
			||||||
 | 
					  return h << 16 | l;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					template<>
 | 
				
			||||||
 | 
					uint64_t Randomise::uniform<uint64_t>() {
 | 
				
			||||||
 | 
					  const uint64_t l = uniform<uint32_t>();
 | 
				
			||||||
 | 
					  const uint64_t h = uniform<uint32_t>();
 | 
				
			||||||
 | 
					  return h << 32 | l;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					template<>
 | 
				
			||||||
 | 
					int8_t Randomise::uniform<int8_t>() { return uniform<uint8_t>(); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					template<>
 | 
				
			||||||
 | 
					int16_t Randomise::uniform<int16_t>() { return uniform<uint16_t>(); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					template<>
 | 
				
			||||||
 | 
					int32_t Randomise::uniform<int32_t>() { return uniform<uint32_t>(); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					template<>
 | 
				
			||||||
 | 
					int64_t Randomise::uniform<int64_t>() { return uniform<uint64_t>(); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}  // namespace libvpx_test
 | 
				
			||||||
@@ -162,45 +162,31 @@ class Randomise {
 | 
				
			|||||||
// Add further specialisations as necessary
 | 
					// Add further specialisations as necessary
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template<>
 | 
					template<>
 | 
				
			||||||
bool Randomise::uniform<bool>() {
 | 
					bool Randomise::uniform<bool>();
 | 
				
			||||||
  return rnd_.Rand8() & 1 ? true : false;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
template<>
 | 
					template<>
 | 
				
			||||||
uint8_t Randomise::uniform<uint8_t>() {
 | 
					uint8_t Randomise::uniform<uint8_t>();
 | 
				
			||||||
  return rnd_.Rand8();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
template<>
 | 
					template<>
 | 
				
			||||||
uint16_t Randomise::uniform<uint16_t>() {
 | 
					uint16_t Randomise::uniform<uint16_t>();
 | 
				
			||||||
  return rnd_.Rand16();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
template<>
 | 
					template<>
 | 
				
			||||||
uint32_t Randomise::uniform<uint32_t>() {
 | 
					uint32_t Randomise::uniform<uint32_t>();
 | 
				
			||||||
  const uint32_t l = uniform<uint16_t>();
 | 
					 | 
				
			||||||
  const uint32_t h = uniform<uint16_t>();
 | 
					 | 
				
			||||||
  return h << 16 | l;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
template<>
 | 
					template<>
 | 
				
			||||||
uint64_t Randomise::uniform<uint64_t>() {
 | 
					uint64_t Randomise::uniform<uint64_t>();
 | 
				
			||||||
  const uint64_t l = uniform<uint32_t>();
 | 
					 | 
				
			||||||
  const uint64_t h = uniform<uint32_t>();
 | 
					 | 
				
			||||||
  return h << 32 | l;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
template<>
 | 
					template<>
 | 
				
			||||||
int8_t Randomise::uniform<int8_t>() { return uniform<uint8_t>(); }
 | 
					int8_t Randomise::uniform<int8_t>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template<>
 | 
					template<>
 | 
				
			||||||
int16_t Randomise::uniform<int16_t>() { return uniform<uint16_t>(); }
 | 
					int16_t Randomise::uniform<int16_t>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template<>
 | 
					template<>
 | 
				
			||||||
int32_t Randomise::uniform<int32_t>() { return uniform<uint32_t>(); }
 | 
					int32_t Randomise::uniform<int32_t>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template<>
 | 
					template<>
 | 
				
			||||||
int64_t Randomise::uniform<int64_t>() { return uniform<uint64_t>(); }
 | 
					int64_t Randomise::uniform<int64_t>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}  // namespace libvpx_test
 | 
					}  // namespace libvpx_test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -49,6 +49,8 @@ LIBVPX_TEST_SRCS-yes                   += decode_test_driver.cc
 | 
				
			|||||||
LIBVPX_TEST_SRCS-yes                   += decode_test_driver.h
 | 
					LIBVPX_TEST_SRCS-yes                   += decode_test_driver.h
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS)    += encode_test_driver.cc
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS)    += encode_test_driver.cc
 | 
				
			||||||
LIBVPX_TEST_SRCS-yes                   += encode_test_driver.h
 | 
					LIBVPX_TEST_SRCS-yes                   += encode_test_driver.h
 | 
				
			||||||
 | 
					LIBVPX_TEST_SRCS-yes                   += randomise.h
 | 
				
			||||||
 | 
					LIBVPX_TEST_SRCS-yes                   += randomise.cc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## IVF writing.
 | 
					## IVF writing.
 | 
				
			||||||
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS)    += ../ivfenc.c ../ivfenc.h
 | 
					LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS)    += ../ivfenc.c ../ivfenc.h
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user