From a1f15814be0eb9921a6b5bb102354df7eeb936b2 Mon Sep 17 00:00:00 2001 From: John Koleszar Date: Tue, 27 Nov 2012 11:16:15 -0800 Subject: Clamp decoded feature data Not all segment feature data elements are full-range powers of two, so there are values that can be encoded that are invalid. Add a new function to clamp values to the maximum allowed. Change-Id: Ie47cb80ef2d54292e6b8db9f699c57214a915bc4 --- vp9/encoder/vp9_bitstream.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'vp9/encoder/vp9_bitstream.c') diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c index ae8a7c616..73c116766 100644 --- a/vp9/encoder/vp9_bitstream.c +++ b/vp9/encoder/vp9_bitstream.c @@ -1911,19 +1911,19 @@ void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest, // Encode the relevant feature data if (Data < 0) { Data = - Data; - vp9_write_literal(&header_bc, Data, - vp9_seg_feature_data_bits(j)); + vp9_encode_unsigned_max(&header_bc, Data, + vp9_seg_feature_data_max(j)); vp9_write_bit(&header_bc, 1); } else { - vp9_write_literal(&header_bc, Data, - vp9_seg_feature_data_bits(j)); + vp9_encode_unsigned_max(&header_bc, Data, + vp9_seg_feature_data_max(j)); vp9_write_bit(&header_bc, 0); } } // Unsigned data element so no sign bit needed else - vp9_write_literal(&header_bc, Data, - vp9_seg_feature_data_bits(j)); + vp9_encode_unsigned_max(&header_bc, Data, + vp9_seg_feature_data_max(j)); } else vp9_write_bit(&header_bc, 0); } -- cgit v1.2.3