Example #1
0
File: vp8.cs Project: soywiz/nwebp
		// Paragraph 9.3
		static int ParseSegmentHeader(VP8BitReader* br,
									  VP8SegmentHeader* hdr, VP8Proba* proba) {
		  assert(br);
		  assert(hdr);
		  hdr.use_segment_ = VP8Get(br);
		  if (hdr.use_segment_) {
			hdr.update_map_ = VP8Get(br);
			if (VP8Get(br)) {   // update data
			  int s;
			  hdr.absolute_delta_ = VP8Get(br);
			  for (s = 0; s < NUM_MB_SEGMENTS; ++s) {
				hdr.quantizer_[s] = VP8Get(br) ? VP8GetSignedValue(br, 7) : 0;
			  }
			  for (s = 0; s < NUM_MB_SEGMENTS; ++s) {
				hdr.filter_strength_[s] = VP8Get(br) ? VP8GetSignedValue(br, 6) : 0;
			  }
			}
			if (hdr.update_map_) {
			  int s;
			  for (s = 0; s < MB_FEATURE_TREE_PROBS; ++s) {
				proba.segments_[s] = VP8Get(br) ? VP8GetValue(br, 8) : 255u;
			  }
			}
		  } else {
			hdr.update_map_ = 0;
		  }
		  return !br.eof_;
		}
Example #2
0
File: vp8.cs Project: soywiz/nwebp
		//------------------------------------------------------------------------------
		// Header parsing

		static void ResetSegmentHeader(VP8SegmentHeader* hdr) {
		  assert(hdr);
		  hdr.use_segment_ = 0;
		  hdr.update_map_ = 0;
		  hdr.absolute_delta_ = 1;
		  memset(hdr.quantizer_, 0, sizeof(hdr.quantizer_));
		  memset(hdr.filter_strength_, 0, sizeof(hdr.filter_strength_));
		}