179e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka// Copyright 2013 Google Inc. All Rights Reserved. 279e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka// 379e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka// Licensed under the Apache License, Version 2.0 (the "License"); 479e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka// you may not use this file except in compliance with the License. 579e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka// You may obtain a copy of the License at 679e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka// 779e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka// http://www.apache.org/licenses/LICENSE-2.0 879e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka// 979e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka// Unless required by applicable law or agreed to in writing, software 1079e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka// distributed under the License is distributed on an "AS IS" BASIS, 1179e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1279e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka// See the License for the specific language governing permissions and 1379e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka// limitations under the License. 1479e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka// 1579e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka// This class models a sequence of literals and a backward reference copy. 1679e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka 1779e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka#ifndef BROTLI_ENC_COMMAND_H_ 1879e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka#define BROTLI_ENC_COMMAND_H_ 1979e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka 2079e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka#include <stdint.h> 2179e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka 2279e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadkanamespace brotli { 2379e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka 2479e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka// Command holds a sequence of literals and a backward reference copy. 2579e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadkaclass Command { 2679e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka public: 27278b89484fa947fad7fbf8753aadff0c9ce18a8cZoltan Szabadka // distance_code_ is initialized to 17 because it refers to the distance 28278b89484fa947fad7fbf8753aadff0c9ce18a8cZoltan Szabadka // code of a backward distance of 1, this way the last insert-only command 29278b89484fa947fad7fbf8753aadff0c9ce18a8cZoltan Szabadka // won't use the last-distance short code, and accordingly distance_prefix_ is 30278b89484fa947fad7fbf8753aadff0c9ce18a8cZoltan Szabadka // set to 16 31437bbad37074e472b66d427814275de84ca77f19Roderick Sheeter Command() : insert_length_(0), copy_length_(0), copy_length_code_(0), 32278b89484fa947fad7fbf8753aadff0c9ce18a8cZoltan Szabadka copy_distance_(0), distance_code_(17), 33278b89484fa947fad7fbf8753aadff0c9ce18a8cZoltan Szabadka distance_prefix_(16), command_prefix_(0), 3479e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka distance_extra_bits_(0), distance_extra_bits_value_(0) {} 3579e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka 3679e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka uint32_t insert_length_; 3779e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka uint32_t copy_length_; 38437bbad37074e472b66d427814275de84ca77f19Roderick Sheeter uint32_t copy_length_code_; 3979e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka uint32_t copy_distance_; 4079e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka // Values <= 16 are short codes, values > 16 are distances shifted by 16. 4179e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka uint32_t distance_code_; 4279e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka uint16_t distance_prefix_; 4379e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka uint16_t command_prefix_; 4479e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka int distance_extra_bits_; 4579e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka uint32_t distance_extra_bits_value_; 4679e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka}; 4779e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka 4879e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka} // namespace brotli 4979e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka 5079e99afe468407e9ff9f0820df7190cb069eabebZoltan Szabadka#endif // BROTLI_ENC_COMMAND_H_ 51