    001/*
    002 * Licensed to the Apache Software Foundation (ASF) under one
    003 * or more contributor license agreements.  See the NOTICE file
    004 * distributed with this work for additional information
    005 * regarding copyright ownership.  The ASF licenses this file
    006 * to you under the Apache License, Version 2.0 (the
    007 * "License"); you may not use this file except in compliance
    008 * with the License.  You may obtain a copy of the License at
    009 *
    010 *   https://www.apache.org/licenses/LICENSE-2.0
    011 *
    012 * Unless required by applicable law or agreed to in writing,
    013 * software distributed under the License is distributed on an
    014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    015 * KIND, either express or implied.  See the License for the
    016 * specific language governing permissions and limitations
    017 * under the License.
    018 */
    019package org.apache.commons.compress.harmony.pack200;
    020
    021/**
    022 * Sets of codecs that share characteristics. Mainly used for different effort compression heuristics in BandSet.
    023 */
    024public class CanonicalCodecFamilies {
    025
    026    // Families of codecs for bands of positive integers that do not correlate
    027    // well (i.e. would not benefit from delta encoding)
    028
    029    /**
    030     * Non-delta unsigned codecs 1.
    031     */
    032    public static BHSDCodec[] nonDeltaUnsignedCodecs1 = {
    033            // (1,256) is a special case and is considered separately so shouldn't be included here
    034//        CodecEncoding.getCanonicalCodec(1), // (1,256)
    035            CodecEncoding.getCanonicalCodec(5), // (2,256)
    036            CodecEncoding.getCanonicalCodec(9), // (3,256)
    037            CodecEncoding.getCanonicalCodec(13) // (4,256)
    038    };
    039
    040    /**
    041     * Non-delta unsigned codecs 2.
    042     */
    043    public static BHSDCodec[] nonDeltaUnsignedCodecs2 = { CodecEncoding.getCanonicalCodec(17), // (5,4)
    044            CodecEncoding.getCanonicalCodec(20), // (5,16)
    045            CodecEncoding.getCanonicalCodec(23), // (5,32)
    046            CodecEncoding.getCanonicalCodec(26), // (5,64)
    047            CodecEncoding.getCanonicalCodec(29) // (5,128)
    048    };
    049
    050    /**
    051     * Non-delta unsigned codecs 3.
    052     */
    053    public static BHSDCodec[] nonDeltaUnsignedCodecs3 = { CodecEncoding.getCanonicalCodec(47), // (2,192)
    054            CodecEncoding.getCanonicalCodec(48), // (2,224)
    055            CodecEncoding.getCanonicalCodec(49), // (2,240)
    056            CodecEncoding.getCanonicalCodec(50), // (2,248)
    057            CodecEncoding.getCanonicalCodec(51) // (2,252)
    058    };
    059
    060    /**
    061     * Non-delta unsigned codecs 4.
    062     */
    063    public static BHSDCodec[] nonDeltaUnsignedCodecs4 = { CodecEncoding.getCanonicalCodec(70), // (3,192)
    064            CodecEncoding.getCanonicalCodec(71), // (3,224)
    065            CodecEncoding.getCanonicalCodec(72), // (3,240)
    066            CodecEncoding.getCanonicalCodec(73), // (3,248)
    067            CodecEncoding.getCanonicalCodec(74) // (3,252)
    068    };
    069
    070    /**
    071     * Non-delta unsigned codecs 5.
    072     */
    073    public static BHSDCodec[] nonDeltaUnsignedCodecs5 = { CodecEncoding.getCanonicalCodec(93), // (4,192)
    074            CodecEncoding.getCanonicalCodec(94), // (4,224)
    075            CodecEncoding.getCanonicalCodec(95), // (4,240)
    076            CodecEncoding.getCanonicalCodec(96), // (4,248)
    077            CodecEncoding.getCanonicalCodec(97) // (4,252)
    078    };
    079
    080    // Families of codecs for bands of positive integers that do correlate well
    081    // and would benefit from delta encoding
    082
    083    /**
    084     * Delta unsigned codecs 1.
    085     */
    086    public static BHSDCodec[] deltaUnsignedCodecs1 = { CodecEncoding.getCanonicalCodec(3), // (1,256,0,1)
    087            CodecEncoding.getCanonicalCodec(7), // (2,256,0,1)
    088            CodecEncoding.getCanonicalCodec(11), // (3,256,0,1)
    089            CodecEncoding.getCanonicalCodec(15) // (4,256,0,1)
    090    };
    091
    092    /**
    093     * Delta unsigned codecs 2.
    094     */
    095    public static BHSDCodec[] deltaUnsignedCodecs2 = { CodecEncoding.getCanonicalCodec(32), // (5,4,0,1)
    096            CodecEncoding.getCanonicalCodec(35), // (5,16,0,1)
    097            CodecEncoding.getCanonicalCodec(38), // (5,32,0,1)
    098            CodecEncoding.getCanonicalCodec(41), // (5,64,0,1)
    099            CodecEncoding.getCanonicalCodec(44) // (5,128,0,1)
    100    };
    101
    102    /**
    103     * Delta unsigned codecs 3.
    104     */
    105    public static BHSDCodec[] deltaUnsignedCodecs3 = { CodecEncoding.getCanonicalCodec(52), // (2,8,0,1)
    106            CodecEncoding.getCanonicalCodec(54), // (2,16,0,1)
    107            CodecEncoding.getCanonicalCodec(56), // (2,32,0,1)
    108            CodecEncoding.getCanonicalCodec(58), // (2,64,0,1)
    109            CodecEncoding.getCanonicalCodec(60), // (2,128,0,1)
    110            CodecEncoding.getCanonicalCodec(62), // (2,192,0,1)
    111            CodecEncoding.getCanonicalCodec(64), // (2,224,0,1)
    112            CodecEncoding.getCanonicalCodec(66), // (2,240,0,1)
    113            CodecEncoding.getCanonicalCodec(68) // (2,248,0,1)
    114    };
    115
    116    /**
    117     * Delta unsigned codecs 4.
    118     */
    119    public static BHSDCodec[] deltaUnsignedCodecs4 = { CodecEncoding.getCanonicalCodec(75), // (3,8,0,1)
    120            CodecEncoding.getCanonicalCodec(77), // (3,16,0,1)
    121            CodecEncoding.getCanonicalCodec(79), // (3,32,0,1)
    122            CodecEncoding.getCanonicalCodec(81), // (3,64,0,1)
    123            CodecEncoding.getCanonicalCodec(83), // (3,128,0,1)
    124            CodecEncoding.getCanonicalCodec(85), // (3,192,0,1)
    125            CodecEncoding.getCanonicalCodec(87), // (3,224,0,1)
    126            CodecEncoding.getCanonicalCodec(89), // (3,240,0,1)
    127            CodecEncoding.getCanonicalCodec(91) // (3,248,0,1)
    128    };
    129
    130    /**
    131     * Delta unsigned codecs 5.
    132     */
    133    public static BHSDCodec[] deltaUnsignedCodecs5 = { CodecEncoding.getCanonicalCodec(98), // (4,8,0,1)
    134            CodecEncoding.getCanonicalCodec(100), // (4,16,0,1)
    135            CodecEncoding.getCanonicalCodec(102), // (4,32,0,1)
    136            CodecEncoding.getCanonicalCodec(104), // (4,64,0,1)
    137            CodecEncoding.getCanonicalCodec(106), // (4,128,0,1)
    138            CodecEncoding.getCanonicalCodec(108), // (4,192,0,1)
    139            CodecEncoding.getCanonicalCodec(110), // (4,224,0,1)
    140            CodecEncoding.getCanonicalCodec(112), // (4,240,0,1)
    141            CodecEncoding.getCanonicalCodec(114) // (4,248,0,1)
    142    };
    143
    144    // Families of codecs for bands containing positive and negative integers
    145    // that do correlate well (i.e. delta encoding is used)
    146
    147    /**
    148     * Delta signed codecs 1.
    149     */
    150    public static BHSDCodec[] deltaSignedCodecs1 = { CodecEncoding.getCanonicalCodec(4), // (1,256,1,1)
    151            CodecEncoding.getCanonicalCodec(8), // (2,256,1,1)
    152            CodecEncoding.getCanonicalCodec(12), // (3,256,1,1)
    153            CodecEncoding.getCanonicalCodec(16) // (4,256,1,1)
    154    };
    155
    156    /**
    157     * Delta signed codecs 2.
    158     */
    159    public static BHSDCodec[] deltaSignedCodecs2 = { CodecEncoding.getCanonicalCodec(33), // (5,4,1,1)
    160            CodecEncoding.getCanonicalCodec(36), // (5,16,1,1)
    161            CodecEncoding.getCanonicalCodec(39), // (5,32,1,1)
    162            CodecEncoding.getCanonicalCodec(42), // (5,64,1,1)
    163            CodecEncoding.getCanonicalCodec(45) // (5,128,1,1)
    164    };
    165
    166    /**
    167     * Delta signed codecs 3.
    168     */
    169    public static BHSDCodec[] deltaSignedCodecs3 = { CodecEncoding.getCanonicalCodec(53), // (2,8,1,1)
    170            CodecEncoding.getCanonicalCodec(55), // (2,16,1,1)
    171            CodecEncoding.getCanonicalCodec(57), // (2,32,1,1)
    172            CodecEncoding.getCanonicalCodec(59), // (2,64,1,1)
    173            CodecEncoding.getCanonicalCodec(61), // (2,128,1,1)
    174            CodecEncoding.getCanonicalCodec(63), // (2,192,1,1)
    175            CodecEncoding.getCanonicalCodec(65), // (2,224,1,1)
    176            CodecEncoding.getCanonicalCodec(67), // (2,240,1,1)
    177            CodecEncoding.getCanonicalCodec(69) // (2,248,1,1)
    178    };
    179
    180    /**
    181     * Delta signed codecs 4.
    182     */
    183    public static BHSDCodec[] deltaSignedCodecs4 = { CodecEncoding.getCanonicalCodec(76), // (3,8,1,1)
    184            CodecEncoding.getCanonicalCodec(78), // (3,16,1,1)
    185            CodecEncoding.getCanonicalCodec(80), // (3,32,1,1)
    186            CodecEncoding.getCanonicalCodec(82), // (3,64,1,1)
    187            CodecEncoding.getCanonicalCodec(84), // (3,128,1,1)
    188            CodecEncoding.getCanonicalCodec(86), // (3,192,1,1)
    189            CodecEncoding.getCanonicalCodec(88), // (3,224,1,1)
    190            CodecEncoding.getCanonicalCodec(90), // (3,240,1,1)
    191            CodecEncoding.getCanonicalCodec(92) // (3,248,1,1)
    192    };
    193
    194    /**
    195     * Delta signed codecs 5.
    196     */
    197    public static BHSDCodec[] deltaSignedCodecs5 = { CodecEncoding.getCanonicalCodec(99), // (4,8,1,1)
    198            CodecEncoding.getCanonicalCodec(101), // (4,16,1,1)
    199            CodecEncoding.getCanonicalCodec(103), // (4,32,1,1)
    200            CodecEncoding.getCanonicalCodec(105), // (4,64,1,1)
    201            CodecEncoding.getCanonicalCodec(107), // (4,128,1,1)
    202            CodecEncoding.getCanonicalCodec(109), // (4,192,1,1)
    203            CodecEncoding.getCanonicalCodec(111), // (4,224,1,1)
    204            CodecEncoding.getCanonicalCodec(113), // (4,240,1,1)
    205            CodecEncoding.getCanonicalCodec(115) // (4,248,1,1)
    206    };
    207
    208    /**
    209     * Delta double signed codecs 1.
    210     */
    211    public static BHSDCodec[] deltaDoubleSignedCodecs1 = { CodecEncoding.getCanonicalCodec(34), // (5,4,2,1)
    212            CodecEncoding.getCanonicalCodec(37), // (5,16,2,1)
    213            CodecEncoding.getCanonicalCodec(40), // (5,32,2,1)
    214            CodecEncoding.getCanonicalCodec(43), // (5,64,2,1)
    215            CodecEncoding.getCanonicalCodec(46) // (5,128,2,1)
    216    };
    217
    218    // Families of codecs for bands containing positive and negative values that
    219    // do not correlate well (i.e. delta encoding is not used)
    220
    221    /**
    222     * Non-delta signed codecs 1.
    223     */
    224    public static BHSDCodec[] nonDeltaSignedCodecs1 = { CodecEncoding.getCanonicalCodec(2), // (1,256,1)
    225            CodecEncoding.getCanonicalCodec(6), // (2,256,1)
    226            CodecEncoding.getCanonicalCodec(10), // (3,256,1)
    227            CodecEncoding.getCanonicalCodec(14) // (4,256,1)
    228    };
    229
    230    /**
    231     * Non-delta signed codecs 2.
    232     */
    233    public static BHSDCodec[] nonDeltaSignedCodecs2 = { CodecEncoding.getCanonicalCodec(18), // (5,4,1)
    234            CodecEncoding.getCanonicalCodec(21), // (5,16,1)
    235            CodecEncoding.getCanonicalCodec(24), // (5,32,1)
    236            CodecEncoding.getCanonicalCodec(27), // (5,64,1)
    237            CodecEncoding.getCanonicalCodec(30) // (5,128,1)
    238    };
    239
    240    /**
    241     * Non-delta double signed codecs 1.
    242     */
    243    public static BHSDCodec[] nonDeltaDoubleSignedCodecs1 = { CodecEncoding.getCanonicalCodec(19), // (5,4,2)
    244            CodecEncoding.getCanonicalCodec(22), // (5,16,2)
    245            CodecEncoding.getCanonicalCodec(25), // (5,32,2)
    246            CodecEncoding.getCanonicalCodec(28), // (5,64,2)
    247            CodecEncoding.getCanonicalCodec(31) // (5,128,2)
    248    };
    249
    250
    251    /**
    252     * Constructs a new instance.
    253     *
    254     * @deprecated Will be private in the next major release.
    255     */
    256    @Deprecated
    257    public CanonicalCodecFamilies() {
    258        // empty
    259    }
    260}