Merge changes I3c72a2d8,I9905f3a8 into nextgenv2
* changes: Add pluggable bitwriters. Add pluggable bitreaders.
This commit is contained in:
		@@ -16,6 +16,7 @@
 | 
				
			|||||||
#include <assert.h>
 | 
					#include <assert.h>
 | 
				
			||||||
#include "./vpx_config.h"
 | 
					#include "./vpx_config.h"
 | 
				
			||||||
#include "vpx/vpx_integer.h"
 | 
					#include "vpx/vpx_integer.h"
 | 
				
			||||||
 | 
					#include "vpx_dsp/prob.h"
 | 
				
			||||||
#include "vpx_ports/mem_ops.h"
 | 
					#include "vpx_ports/mem_ops.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define ANS_DIVIDE_BY_MULTIPLY 1
 | 
					#define ANS_DIVIDE_BY_MULTIPLY 1
 | 
				
			||||||
@@ -242,6 +243,18 @@ static INLINE int uabs_read_literal(struct AnsDecoder *ans, int bits) {
 | 
				
			|||||||
  return literal;
 | 
					  return literal;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// TODO(aconverse): Replace trees with tokensets.
 | 
				
			||||||
 | 
					static INLINE int uabs_read_tree(struct AnsDecoder *ans,
 | 
				
			||||||
 | 
					                                 const vpx_tree_index *tree,
 | 
				
			||||||
 | 
					                                 const AnsP8 *probs) {
 | 
				
			||||||
 | 
					  vpx_tree_index i = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  while ((i = tree[i + uabs_read(ans, probs[i >> 1])]) > 0)
 | 
				
			||||||
 | 
					    continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return -i;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct rans_sym {
 | 
					struct rans_sym {
 | 
				
			||||||
  AnsP8 prob;
 | 
					  AnsP8 prob;
 | 
				
			||||||
  AnsP8 cum_prob;  // not-inclusive
 | 
					  AnsP8 cum_prob;  // not-inclusive
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										38
									
								
								vp10/decoder/bitreader.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								vp10/decoder/bitreader.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 *  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.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* The purpose of this header is to provide compile time pluggable bit reader
 | 
				
			||||||
 | 
					 * implementations with a common interface. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef VPX10_DECODER_BITREADER_H_
 | 
				
			||||||
 | 
					#define VPX10_DECODER_BITREADER_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "./vpx_config.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if CONFIG_ANS
 | 
				
			||||||
 | 
					#include "vp10/common/ans.h"
 | 
				
			||||||
 | 
					#include "vpx/vp8dx.h"  // for vp10_decrypt_cb
 | 
				
			||||||
 | 
					#define vp10_reader struct AnsDecoder
 | 
				
			||||||
 | 
					#define vp10_reader_has_error ans_reader_has_error
 | 
				
			||||||
 | 
					#define vp10_read uabs_read
 | 
				
			||||||
 | 
					#define vp10_read_bit uabs_read_bit
 | 
				
			||||||
 | 
					#define vp10_read_literal uabs_read_literal
 | 
				
			||||||
 | 
					#define vp10_read_tree uabs_read_tree
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					#include "vpx_dsp/bitreader.h"
 | 
				
			||||||
 | 
					#define vp10_reader vpx_reader
 | 
				
			||||||
 | 
					#define vp10_reader_has_error vpx_reader_has_error
 | 
				
			||||||
 | 
					#define vp10_read vpx_read
 | 
				
			||||||
 | 
					#define vp10_read_bit vpx_read_bit
 | 
				
			||||||
 | 
					#define vp10_read_literal vpx_read_literal
 | 
				
			||||||
 | 
					#define vp10_read_tree vpx_read_tree
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif  // VPX10_DECODER_BITREADER_H_
 | 
				
			||||||
							
								
								
									
										35
									
								
								vp10/encoder/bitwriter.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								vp10/encoder/bitwriter.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 *  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.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* The purpose of this header is to provide compile time pluggable bit writer
 | 
				
			||||||
 | 
					 * implementations with a common interface. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef VPX10_ENCODER_BITWRITER_H_
 | 
				
			||||||
 | 
					#define VPX10_ENCODER_BITWRITER_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "./vpx_config.h"
 | 
				
			||||||
 | 
					#include "vpx_dsp/prob.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if CONFIG_ANS
 | 
				
			||||||
 | 
					typedef struct BufAnsCoder BufAnsCoder;
 | 
				
			||||||
 | 
					#include "vp10/encoder/buf_ans.h"
 | 
				
			||||||
 | 
					#define vp10_writer BufAnsCoder
 | 
				
			||||||
 | 
					#define vp10_write buf_uabs_write
 | 
				
			||||||
 | 
					#define vp10_write_bit buf_uabs_write_bit
 | 
				
			||||||
 | 
					#define vp10_write_literal buf_uabs_write_literal
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					#include "vpx_dsp/bitwriter.h"
 | 
				
			||||||
 | 
					#define vp10_writer vpx_writer
 | 
				
			||||||
 | 
					#define vp10_write vpx_write
 | 
				
			||||||
 | 
					#define vp10_write_bit vpx_write_bit
 | 
				
			||||||
 | 
					#define vp10_write_literal vpx_write_literal
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif  // VPX10_ENCODER_BITWRITER_H_
 | 
				
			||||||
@@ -18,6 +18,7 @@ VP10_CX_SRCS_REMOVE-no  += $(VP10_COMMON_SRCS_REMOVE-no)
 | 
				
			|||||||
VP10_CX_SRCS-yes += vp10_cx_iface.c
 | 
					VP10_CX_SRCS-yes += vp10_cx_iface.c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VP10_CX_SRCS-yes += encoder/bitstream.c
 | 
					VP10_CX_SRCS-yes += encoder/bitstream.c
 | 
				
			||||||
 | 
					VP10_CX_SRCS-yes += encoder/bitwriter.h
 | 
				
			||||||
VP10_CX_SRCS-yes += encoder/context_tree.c
 | 
					VP10_CX_SRCS-yes += encoder/context_tree.c
 | 
				
			||||||
VP10_CX_SRCS-yes += encoder/context_tree.h
 | 
					VP10_CX_SRCS-yes += encoder/context_tree.h
 | 
				
			||||||
VP10_CX_SRCS-yes += encoder/cost.h
 | 
					VP10_CX_SRCS-yes += encoder/cost.h
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,5 +29,6 @@ VP10_DX_SRCS-yes += decoder/decoder.c
 | 
				
			|||||||
VP10_DX_SRCS-yes += decoder/decoder.h
 | 
					VP10_DX_SRCS-yes += decoder/decoder.h
 | 
				
			||||||
VP10_DX_SRCS-yes += decoder/dsubexp.c
 | 
					VP10_DX_SRCS-yes += decoder/dsubexp.c
 | 
				
			||||||
VP10_DX_SRCS-yes += decoder/dsubexp.h
 | 
					VP10_DX_SRCS-yes += decoder/dsubexp.h
 | 
				
			||||||
 | 
					VP10_DX_SRCS-yes += decoder/bitreader.h
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VP10_DX_SRCS-yes := $(filter-out $(VP10_DX_SRCS_REMOVE-yes),$(VP10_DX_SRCS-yes))
 | 
					VP10_DX_SRCS-yes := $(filter-out $(VP10_DX_SRCS_REMOVE-yes),$(VP10_DX_SRCS-yes))
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user