code
stringlengths
1
2.01M
repo_name
stringlengths
3
62
path
stringlengths
1
267
language
stringclasses
231 values
license
stringclasses
13 values
size
int64
1
2.01M
/* * AAC data * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org ) * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com ) * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * AAC data * @author Oded Shimon ( ods15 ods15 dyndns org ) * @author Maxim Gavrilov ( maxim.gavrilov gmail com ) */ #include "libavutil/mem.h" #include "aac.h" #include "aac_tablegen.h" #include <stdint.h> DECLARE_ALIGNED(16, float, ff_aac_kbd_long_1024)[1024]; DECLARE_ALIGNED(16, float, ff_aac_kbd_short_128)[128]; const uint8_t ff_aac_num_swb_1024[] = { 41, 41, 47, 49, 49, 51, 47, 47, 43, 43, 43, 40, 40 }; const uint8_t ff_aac_num_swb_128[] = { 12, 12, 12, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15 }; const uint8_t ff_aac_pred_sfb_max[] = { 33, 33, 38, 40, 40, 40, 41, 41, 37, 37, 37, 34, 34 }; const uint32_t ff_aac_scalefactor_code[121] = { 0x3ffe8, 0x3ffe6, 0x3ffe7, 0x3ffe5, 0x7fff5, 0x7fff1, 0x7ffed, 0x7fff6, 0x7ffee, 0x7ffef, 0x7fff0, 0x7fffc, 0x7fffd, 0x7ffff, 0x7fffe, 0x7fff7, 0x7fff8, 0x7fffb, 0x7fff9, 0x3ffe4, 0x7fffa, 0x3ffe3, 0x1ffef, 0x1fff0, 0x0fff5, 0x1ffee, 0x0fff2, 0x0fff3, 0x0fff4, 0x0fff1, 0x07ff6, 0x07ff7, 0x03ff9, 0x03ff5, 0x03ff7, 0x03ff3, 0x03ff6, 0x03ff2, 0x01ff7, 0x01ff5, 0x00ff9, 0x00ff7, 0x00ff6, 0x007f9, 0x00ff4, 0x007f8, 0x003f9, 0x003f7, 0x003f5, 0x001f8, 0x001f7, 0x000fa, 0x000f8, 0x000f6, 0x00079, 0x0003a, 0x00038, 0x0001a, 0x0000b, 0x00004, 0x00000, 0x0000a, 0x0000c, 0x0001b, 0x00039, 0x0003b, 0x00078, 0x0007a, 0x000f7, 0x000f9, 0x001f6, 0x001f9, 0x003f4, 0x003f6, 0x003f8, 0x007f5, 0x007f4, 0x007f6, 0x007f7, 0x00ff5, 0x00ff8, 0x01ff4, 0x01ff6, 0x01ff8, 0x03ff8, 0x03ff4, 0x0fff0, 0x07ff4, 0x0fff6, 0x07ff5, 0x3ffe2, 0x7ffd9, 0x7ffda, 0x7ffdb, 0x7ffdc, 0x7ffdd, 0x7ffde, 0x7ffd8, 0x7ffd2, 0x7ffd3, 0x7ffd4, 0x7ffd5, 0x7ffd6, 0x7fff2, 0x7ffdf, 0x7ffe7, 0x7ffe8, 0x7ffe9, 0x7ffea, 0x7ffeb, 0x7ffe6, 0x7ffe0, 0x7ffe1, 0x7ffe2, 0x7ffe3, 0x7ffe4, 0x7ffe5, 0x7ffd7, 0x7ffec, 0x7fff4, 0x7fff3, }; const uint8_t ff_aac_scalefactor_bits[121] = { 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 18, 19, 18, 17, 17, 16, 17, 16, 16, 16, 16, 15, 15, 14, 14, 14, 14, 14, 14, 13, 13, 12, 12, 12, 11, 12, 11, 10, 10, 10, 9, 9, 8, 8, 8, 7, 6, 6, 5, 4, 3, 1, 4, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 16, 15, 16, 15, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, }; static const uint16_t codes1[81] = { 0x7f8, 0x1f1, 0x7fd, 0x3f5, 0x068, 0x3f0, 0x7f7, 0x1ec, 0x7f5, 0x3f1, 0x072, 0x3f4, 0x074, 0x011, 0x076, 0x1eb, 0x06c, 0x3f6, 0x7fc, 0x1e1, 0x7f1, 0x1f0, 0x061, 0x1f6, 0x7f2, 0x1ea, 0x7fb, 0x1f2, 0x069, 0x1ed, 0x077, 0x017, 0x06f, 0x1e6, 0x064, 0x1e5, 0x067, 0x015, 0x062, 0x012, 0x000, 0x014, 0x065, 0x016, 0x06d, 0x1e9, 0x063, 0x1e4, 0x06b, 0x013, 0x071, 0x1e3, 0x070, 0x1f3, 0x7fe, 0x1e7, 0x7f3, 0x1ef, 0x060, 0x1ee, 0x7f0, 0x1e2, 0x7fa, 0x3f3, 0x06a, 0x1e8, 0x075, 0x010, 0x073, 0x1f4, 0x06e, 0x3f7, 0x7f6, 0x1e0, 0x7f9, 0x3f2, 0x066, 0x1f5, 0x7ff, 0x1f7, 0x7f4, }; static const uint8_t bits1[81] = { 11, 9, 11, 10, 7, 10, 11, 9, 11, 10, 7, 10, 7, 5, 7, 9, 7, 10, 11, 9, 11, 9, 7, 9, 11, 9, 11, 9, 7, 9, 7, 5, 7, 9, 7, 9, 7, 5, 7, 5, 1, 5, 7, 5, 7, 9, 7, 9, 7, 5, 7, 9, 7, 9, 11, 9, 11, 9, 7, 9, 11, 9, 11, 10, 7, 9, 7, 5, 7, 9, 7, 10, 11, 9, 11, 10, 7, 9, 11, 9, 11, }; static const uint16_t codes2[81] = { 0x1f3, 0x06f, 0x1fd, 0x0eb, 0x023, 0x0ea, 0x1f7, 0x0e8, 0x1fa, 0x0f2, 0x02d, 0x070, 0x020, 0x006, 0x02b, 0x06e, 0x028, 0x0e9, 0x1f9, 0x066, 0x0f8, 0x0e7, 0x01b, 0x0f1, 0x1f4, 0x06b, 0x1f5, 0x0ec, 0x02a, 0x06c, 0x02c, 0x00a, 0x027, 0x067, 0x01a, 0x0f5, 0x024, 0x008, 0x01f, 0x009, 0x000, 0x007, 0x01d, 0x00b, 0x030, 0x0ef, 0x01c, 0x064, 0x01e, 0x00c, 0x029, 0x0f3, 0x02f, 0x0f0, 0x1fc, 0x071, 0x1f2, 0x0f4, 0x021, 0x0e6, 0x0f7, 0x068, 0x1f8, 0x0ee, 0x022, 0x065, 0x031, 0x002, 0x026, 0x0ed, 0x025, 0x06a, 0x1fb, 0x072, 0x1fe, 0x069, 0x02e, 0x0f6, 0x1ff, 0x06d, 0x1f6, }; static const uint8_t bits2[81] = { 9, 7, 9, 8, 6, 8, 9, 8, 9, 8, 6, 7, 6, 5, 6, 7, 6, 8, 9, 7, 8, 8, 6, 8, 9, 7, 9, 8, 6, 7, 6, 5, 6, 7, 6, 8, 6, 5, 6, 5, 3, 5, 6, 5, 6, 8, 6, 7, 6, 5, 6, 8, 6, 8, 9, 7, 9, 8, 6, 8, 8, 7, 9, 8, 6, 7, 6, 4, 6, 8, 6, 7, 9, 7, 9, 7, 6, 8, 9, 7, 9, }; static const uint16_t codes3[81] = { 0x0000, 0x0009, 0x00ef, 0x000b, 0x0019, 0x00f0, 0x01eb, 0x01e6, 0x03f2, 0x000a, 0x0035, 0x01ef, 0x0034, 0x0037, 0x01e9, 0x01ed, 0x01e7, 0x03f3, 0x01ee, 0x03ed, 0x1ffa, 0x01ec, 0x01f2, 0x07f9, 0x07f8, 0x03f8, 0x0ff8, 0x0008, 0x0038, 0x03f6, 0x0036, 0x0075, 0x03f1, 0x03eb, 0x03ec, 0x0ff4, 0x0018, 0x0076, 0x07f4, 0x0039, 0x0074, 0x03ef, 0x01f3, 0x01f4, 0x07f6, 0x01e8, 0x03ea, 0x1ffc, 0x00f2, 0x01f1, 0x0ffb, 0x03f5, 0x07f3, 0x0ffc, 0x00ee, 0x03f7, 0x7ffe, 0x01f0, 0x07f5, 0x7ffd, 0x1ffb, 0x3ffa, 0xffff, 0x00f1, 0x03f0, 0x3ffc, 0x01ea, 0x03ee, 0x3ffb, 0x0ff6, 0x0ffa, 0x7ffc, 0x07f2, 0x0ff5, 0xfffe, 0x03f4, 0x07f7, 0x7ffb, 0x0ff7, 0x0ff9, 0x7ffa, }; static const uint8_t bits3[81] = { 1, 4, 8, 4, 5, 8, 9, 9, 10, 4, 6, 9, 6, 6, 9, 9, 9, 10, 9, 10, 13, 9, 9, 11, 11, 10, 12, 4, 6, 10, 6, 7, 10, 10, 10, 12, 5, 7, 11, 6, 7, 10, 9, 9, 11, 9, 10, 13, 8, 9, 12, 10, 11, 12, 8, 10, 15, 9, 11, 15, 13, 14, 16, 8, 10, 14, 9, 10, 14, 12, 12, 15, 11, 12, 16, 10, 11, 15, 12, 12, 15, }; static const uint16_t codes4[81] = { 0x007, 0x016, 0x0f6, 0x018, 0x008, 0x0ef, 0x1ef, 0x0f3, 0x7f8, 0x019, 0x017, 0x0ed, 0x015, 0x001, 0x0e2, 0x0f0, 0x070, 0x3f0, 0x1ee, 0x0f1, 0x7fa, 0x0ee, 0x0e4, 0x3f2, 0x7f6, 0x3ef, 0x7fd, 0x005, 0x014, 0x0f2, 0x009, 0x004, 0x0e5, 0x0f4, 0x0e8, 0x3f4, 0x006, 0x002, 0x0e7, 0x003, 0x000, 0x06b, 0x0e3, 0x069, 0x1f3, 0x0eb, 0x0e6, 0x3f6, 0x06e, 0x06a, 0x1f4, 0x3ec, 0x1f0, 0x3f9, 0x0f5, 0x0ec, 0x7fb, 0x0ea, 0x06f, 0x3f7, 0x7f9, 0x3f3, 0xfff, 0x0e9, 0x06d, 0x3f8, 0x06c, 0x068, 0x1f5, 0x3ee, 0x1f2, 0x7f4, 0x7f7, 0x3f1, 0xffe, 0x3ed, 0x1f1, 0x7f5, 0x7fe, 0x3f5, 0x7fc, }; static const uint8_t bits4[81] = { 4, 5, 8, 5, 4, 8, 9, 8, 11, 5, 5, 8, 5, 4, 8, 8, 7, 10, 9, 8, 11, 8, 8, 10, 11, 10, 11, 4, 5, 8, 4, 4, 8, 8, 8, 10, 4, 4, 8, 4, 4, 7, 8, 7, 9, 8, 8, 10, 7, 7, 9, 10, 9, 10, 8, 8, 11, 8, 7, 10, 11, 10, 12, 8, 7, 10, 7, 7, 9, 10, 9, 11, 11, 10, 12, 10, 9, 11, 11, 10, 11, }; static const uint16_t codes5[81] = { 0x1fff, 0x0ff7, 0x07f4, 0x07e8, 0x03f1, 0x07ee, 0x07f9, 0x0ff8, 0x1ffd, 0x0ffd, 0x07f1, 0x03e8, 0x01e8, 0x00f0, 0x01ec, 0x03ee, 0x07f2, 0x0ffa, 0x0ff4, 0x03ef, 0x01f2, 0x00e8, 0x0070, 0x00ec, 0x01f0, 0x03ea, 0x07f3, 0x07eb, 0x01eb, 0x00ea, 0x001a, 0x0008, 0x0019, 0x00ee, 0x01ef, 0x07ed, 0x03f0, 0x00f2, 0x0073, 0x000b, 0x0000, 0x000a, 0x0071, 0x00f3, 0x07e9, 0x07ef, 0x01ee, 0x00ef, 0x0018, 0x0009, 0x001b, 0x00eb, 0x01e9, 0x07ec, 0x07f6, 0x03eb, 0x01f3, 0x00ed, 0x0072, 0x00e9, 0x01f1, 0x03ed, 0x07f7, 0x0ff6, 0x07f0, 0x03e9, 0x01ed, 0x00f1, 0x01ea, 0x03ec, 0x07f8, 0x0ff9, 0x1ffc, 0x0ffc, 0x0ff5, 0x07ea, 0x03f3, 0x03f2, 0x07f5, 0x0ffb, 0x1ffe, }; static const uint8_t bits5[81] = { 13, 12, 11, 11, 10, 11, 11, 12, 13, 12, 11, 10, 9, 8, 9, 10, 11, 12, 12, 10, 9, 8, 7, 8, 9, 10, 11, 11, 9, 8, 5, 4, 5, 8, 9, 11, 10, 8, 7, 4, 1, 4, 7, 8, 11, 11, 9, 8, 5, 4, 5, 8, 9, 11, 11, 10, 9, 8, 7, 8, 9, 10, 11, 12, 11, 10, 9, 8, 9, 10, 11, 12, 13, 12, 12, 11, 10, 10, 11, 12, 13, }; static const uint16_t codes6[81] = { 0x7fe, 0x3fd, 0x1f1, 0x1eb, 0x1f4, 0x1ea, 0x1f0, 0x3fc, 0x7fd, 0x3f6, 0x1e5, 0x0ea, 0x06c, 0x071, 0x068, 0x0f0, 0x1e6, 0x3f7, 0x1f3, 0x0ef, 0x032, 0x027, 0x028, 0x026, 0x031, 0x0eb, 0x1f7, 0x1e8, 0x06f, 0x02e, 0x008, 0x004, 0x006, 0x029, 0x06b, 0x1ee, 0x1ef, 0x072, 0x02d, 0x002, 0x000, 0x003, 0x02f, 0x073, 0x1fa, 0x1e7, 0x06e, 0x02b, 0x007, 0x001, 0x005, 0x02c, 0x06d, 0x1ec, 0x1f9, 0x0ee, 0x030, 0x024, 0x02a, 0x025, 0x033, 0x0ec, 0x1f2, 0x3f8, 0x1e4, 0x0ed, 0x06a, 0x070, 0x069, 0x074, 0x0f1, 0x3fa, 0x7ff, 0x3f9, 0x1f6, 0x1ed, 0x1f8, 0x1e9, 0x1f5, 0x3fb, 0x7fc, }; static const uint8_t bits6[81] = { 11, 10, 9, 9, 9, 9, 9, 10, 11, 10, 9, 8, 7, 7, 7, 8, 9, 10, 9, 8, 6, 6, 6, 6, 6, 8, 9, 9, 7, 6, 4, 4, 4, 6, 7, 9, 9, 7, 6, 4, 4, 4, 6, 7, 9, 9, 7, 6, 4, 4, 4, 6, 7, 9, 9, 8, 6, 6, 6, 6, 6, 8, 9, 10, 9, 8, 7, 7, 7, 7, 8, 10, 11, 10, 9, 9, 9, 9, 9, 10, 11, }; static const uint16_t codes7[64] = { 0x000, 0x005, 0x037, 0x074, 0x0f2, 0x1eb, 0x3ed, 0x7f7, 0x004, 0x00c, 0x035, 0x071, 0x0ec, 0x0ee, 0x1ee, 0x1f5, 0x036, 0x034, 0x072, 0x0ea, 0x0f1, 0x1e9, 0x1f3, 0x3f5, 0x073, 0x070, 0x0eb, 0x0f0, 0x1f1, 0x1f0, 0x3ec, 0x3fa, 0x0f3, 0x0ed, 0x1e8, 0x1ef, 0x3ef, 0x3f1, 0x3f9, 0x7fb, 0x1ed, 0x0ef, 0x1ea, 0x1f2, 0x3f3, 0x3f8, 0x7f9, 0x7fc, 0x3ee, 0x1ec, 0x1f4, 0x3f4, 0x3f7, 0x7f8, 0xffd, 0xffe, 0x7f6, 0x3f0, 0x3f2, 0x3f6, 0x7fa, 0x7fd, 0xffc, 0xfff, }; static const uint8_t bits7[64] = { 1, 3, 6, 7, 8, 9, 10, 11, 3, 4, 6, 7, 8, 8, 9, 9, 6, 6, 7, 8, 8, 9, 9, 10, 7, 7, 8, 8, 9, 9, 10, 10, 8, 8, 9, 9, 10, 10, 10, 11, 9, 8, 9, 9, 10, 10, 11, 11, 10, 9, 9, 10, 10, 11, 12, 12, 11, 10, 10, 10, 11, 11, 12, 12, }; static const uint16_t codes8[64] = { 0x00e, 0x005, 0x010, 0x030, 0x06f, 0x0f1, 0x1fa, 0x3fe, 0x003, 0x000, 0x004, 0x012, 0x02c, 0x06a, 0x075, 0x0f8, 0x00f, 0x002, 0x006, 0x014, 0x02e, 0x069, 0x072, 0x0f5, 0x02f, 0x011, 0x013, 0x02a, 0x032, 0x06c, 0x0ec, 0x0fa, 0x071, 0x02b, 0x02d, 0x031, 0x06d, 0x070, 0x0f2, 0x1f9, 0x0ef, 0x068, 0x033, 0x06b, 0x06e, 0x0ee, 0x0f9, 0x3fc, 0x1f8, 0x074, 0x073, 0x0ed, 0x0f0, 0x0f6, 0x1f6, 0x1fd, 0x3fd, 0x0f3, 0x0f4, 0x0f7, 0x1f7, 0x1fb, 0x1fc, 0x3ff, }; static const uint8_t bits8[64] = { 5, 4, 5, 6, 7, 8, 9, 10, 4, 3, 4, 5, 6, 7, 7, 8, 5, 4, 4, 5, 6, 7, 7, 8, 6, 5, 5, 6, 6, 7, 8, 8, 7, 6, 6, 6, 7, 7, 8, 9, 8, 7, 6, 7, 7, 8, 8, 10, 9, 7, 7, 8, 8, 8, 9, 9, 10, 8, 8, 8, 9, 9, 9, 10, }; static const uint16_t codes9[169] = { 0x0000, 0x0005, 0x0037, 0x00e7, 0x01de, 0x03ce, 0x03d9, 0x07c8, 0x07cd, 0x0fc8, 0x0fdd, 0x1fe4, 0x1fec, 0x0004, 0x000c, 0x0035, 0x0072, 0x00ea, 0x00ed, 0x01e2, 0x03d1, 0x03d3, 0x03e0, 0x07d8, 0x0fcf, 0x0fd5, 0x0036, 0x0034, 0x0071, 0x00e8, 0x00ec, 0x01e1, 0x03cf, 0x03dd, 0x03db, 0x07d0, 0x0fc7, 0x0fd4, 0x0fe4, 0x00e6, 0x0070, 0x00e9, 0x01dd, 0x01e3, 0x03d2, 0x03dc, 0x07cc, 0x07ca, 0x07de, 0x0fd8, 0x0fea, 0x1fdb, 0x01df, 0x00eb, 0x01dc, 0x01e6, 0x03d5, 0x03de, 0x07cb, 0x07dd, 0x07dc, 0x0fcd, 0x0fe2, 0x0fe7, 0x1fe1, 0x03d0, 0x01e0, 0x01e4, 0x03d6, 0x07c5, 0x07d1, 0x07db, 0x0fd2, 0x07e0, 0x0fd9, 0x0feb, 0x1fe3, 0x1fe9, 0x07c4, 0x01e5, 0x03d7, 0x07c6, 0x07cf, 0x07da, 0x0fcb, 0x0fda, 0x0fe3, 0x0fe9, 0x1fe6, 0x1ff3, 0x1ff7, 0x07d3, 0x03d8, 0x03e1, 0x07d4, 0x07d9, 0x0fd3, 0x0fde, 0x1fdd, 0x1fd9, 0x1fe2, 0x1fea, 0x1ff1, 0x1ff6, 0x07d2, 0x03d4, 0x03da, 0x07c7, 0x07d7, 0x07e2, 0x0fce, 0x0fdb, 0x1fd8, 0x1fee, 0x3ff0, 0x1ff4, 0x3ff2, 0x07e1, 0x03df, 0x07c9, 0x07d6, 0x0fca, 0x0fd0, 0x0fe5, 0x0fe6, 0x1feb, 0x1fef, 0x3ff3, 0x3ff4, 0x3ff5, 0x0fe0, 0x07ce, 0x07d5, 0x0fc6, 0x0fd1, 0x0fe1, 0x1fe0, 0x1fe8, 0x1ff0, 0x3ff1, 0x3ff8, 0x3ff6, 0x7ffc, 0x0fe8, 0x07df, 0x0fc9, 0x0fd7, 0x0fdc, 0x1fdc, 0x1fdf, 0x1fed, 0x1ff5, 0x3ff9, 0x3ffb, 0x7ffd, 0x7ffe, 0x1fe7, 0x0fcc, 0x0fd6, 0x0fdf, 0x1fde, 0x1fda, 0x1fe5, 0x1ff2, 0x3ffa, 0x3ff7, 0x3ffc, 0x3ffd, 0x7fff, }; static const uint8_t bits9[169] = { 1, 3, 6, 8, 9, 10, 10, 11, 11, 12, 12, 13, 13, 3, 4, 6, 7, 8, 8, 9, 10, 10, 10, 11, 12, 12, 6, 6, 7, 8, 8, 9, 10, 10, 10, 11, 12, 12, 12, 8, 7, 8, 9, 9, 10, 10, 11, 11, 11, 12, 12, 13, 9, 8, 9, 9, 10, 10, 11, 11, 11, 12, 12, 12, 13, 10, 9, 9, 10, 11, 11, 11, 12, 11, 12, 12, 13, 13, 11, 9, 10, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 11, 10, 10, 11, 11, 12, 12, 13, 13, 13, 13, 13, 13, 11, 10, 10, 11, 11, 11, 12, 12, 13, 13, 14, 13, 14, 11, 10, 11, 11, 12, 12, 12, 12, 13, 13, 14, 14, 14, 12, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 12, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 15, 15, 13, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, }; static const uint16_t codes10[169] = { 0x022, 0x008, 0x01d, 0x026, 0x05f, 0x0d3, 0x1cf, 0x3d0, 0x3d7, 0x3ed, 0x7f0, 0x7f6, 0xffd, 0x007, 0x000, 0x001, 0x009, 0x020, 0x054, 0x060, 0x0d5, 0x0dc, 0x1d4, 0x3cd, 0x3de, 0x7e7, 0x01c, 0x002, 0x006, 0x00c, 0x01e, 0x028, 0x05b, 0x0cd, 0x0d9, 0x1ce, 0x1dc, 0x3d9, 0x3f1, 0x025, 0x00b, 0x00a, 0x00d, 0x024, 0x057, 0x061, 0x0cc, 0x0dd, 0x1cc, 0x1de, 0x3d3, 0x3e7, 0x05d, 0x021, 0x01f, 0x023, 0x027, 0x059, 0x064, 0x0d8, 0x0df, 0x1d2, 0x1e2, 0x3dd, 0x3ee, 0x0d1, 0x055, 0x029, 0x056, 0x058, 0x062, 0x0ce, 0x0e0, 0x0e2, 0x1da, 0x3d4, 0x3e3, 0x7eb, 0x1c9, 0x05e, 0x05a, 0x05c, 0x063, 0x0ca, 0x0da, 0x1c7, 0x1ca, 0x1e0, 0x3db, 0x3e8, 0x7ec, 0x1e3, 0x0d2, 0x0cb, 0x0d0, 0x0d7, 0x0db, 0x1c6, 0x1d5, 0x1d8, 0x3ca, 0x3da, 0x7ea, 0x7f1, 0x1e1, 0x0d4, 0x0cf, 0x0d6, 0x0de, 0x0e1, 0x1d0, 0x1d6, 0x3d1, 0x3d5, 0x3f2, 0x7ee, 0x7fb, 0x3e9, 0x1cd, 0x1c8, 0x1cb, 0x1d1, 0x1d7, 0x1df, 0x3cf, 0x3e0, 0x3ef, 0x7e6, 0x7f8, 0xffa, 0x3eb, 0x1dd, 0x1d3, 0x1d9, 0x1db, 0x3d2, 0x3cc, 0x3dc, 0x3ea, 0x7ed, 0x7f3, 0x7f9, 0xff9, 0x7f2, 0x3ce, 0x1e4, 0x3cb, 0x3d8, 0x3d6, 0x3e2, 0x3e5, 0x7e8, 0x7f4, 0x7f5, 0x7f7, 0xffb, 0x7fa, 0x3ec, 0x3df, 0x3e1, 0x3e4, 0x3e6, 0x3f0, 0x7e9, 0x7ef, 0xff8, 0xffe, 0xffc, 0xfff, }; static const uint8_t bits10[169] = { 6, 5, 6, 6, 7, 8, 9, 10, 10, 10, 11, 11, 12, 5, 4, 4, 5, 6, 7, 7, 8, 8, 9, 10, 10, 11, 6, 4, 5, 5, 6, 6, 7, 8, 8, 9, 9, 10, 10, 6, 5, 5, 5, 6, 7, 7, 8, 8, 9, 9, 10, 10, 7, 6, 6, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 8, 7, 6, 7, 7, 7, 8, 8, 8, 9, 10, 10, 11, 9, 7, 7, 7, 7, 8, 8, 9, 9, 9, 10, 10, 11, 9, 8, 8, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11, 9, 8, 8, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 10, 9, 9, 9, 9, 9, 9, 10, 10, 10, 11, 11, 12, 10, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 11, 10, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 12, 11, 10, 10, 10, 10, 10, 10, 11, 11, 12, 12, 12, 12, }; static const uint16_t codes11[289] = { 0x000, 0x006, 0x019, 0x03d, 0x09c, 0x0c6, 0x1a7, 0x390, 0x3c2, 0x3df, 0x7e6, 0x7f3, 0xffb, 0x7ec, 0xffa, 0xffe, 0x38e, 0x005, 0x001, 0x008, 0x014, 0x037, 0x042, 0x092, 0x0af, 0x191, 0x1a5, 0x1b5, 0x39e, 0x3c0, 0x3a2, 0x3cd, 0x7d6, 0x0ae, 0x017, 0x007, 0x009, 0x018, 0x039, 0x040, 0x08e, 0x0a3, 0x0b8, 0x199, 0x1ac, 0x1c1, 0x3b1, 0x396, 0x3be, 0x3ca, 0x09d, 0x03c, 0x015, 0x016, 0x01a, 0x03b, 0x044, 0x091, 0x0a5, 0x0be, 0x196, 0x1ae, 0x1b9, 0x3a1, 0x391, 0x3a5, 0x3d5, 0x094, 0x09a, 0x036, 0x038, 0x03a, 0x041, 0x08c, 0x09b, 0x0b0, 0x0c3, 0x19e, 0x1ab, 0x1bc, 0x39f, 0x38f, 0x3a9, 0x3cf, 0x093, 0x0bf, 0x03e, 0x03f, 0x043, 0x045, 0x09e, 0x0a7, 0x0b9, 0x194, 0x1a2, 0x1ba, 0x1c3, 0x3a6, 0x3a7, 0x3bb, 0x3d4, 0x09f, 0x1a0, 0x08f, 0x08d, 0x090, 0x098, 0x0a6, 0x0b6, 0x0c4, 0x19f, 0x1af, 0x1bf, 0x399, 0x3bf, 0x3b4, 0x3c9, 0x3e7, 0x0a8, 0x1b6, 0x0ab, 0x0a4, 0x0aa, 0x0b2, 0x0c2, 0x0c5, 0x198, 0x1a4, 0x1b8, 0x38c, 0x3a4, 0x3c4, 0x3c6, 0x3dd, 0x3e8, 0x0ad, 0x3af, 0x192, 0x0bd, 0x0bc, 0x18e, 0x197, 0x19a, 0x1a3, 0x1b1, 0x38d, 0x398, 0x3b7, 0x3d3, 0x3d1, 0x3db, 0x7dd, 0x0b4, 0x3de, 0x1a9, 0x19b, 0x19c, 0x1a1, 0x1aa, 0x1ad, 0x1b3, 0x38b, 0x3b2, 0x3b8, 0x3ce, 0x3e1, 0x3e0, 0x7d2, 0x7e5, 0x0b7, 0x7e3, 0x1bb, 0x1a8, 0x1a6, 0x1b0, 0x1b2, 0x1b7, 0x39b, 0x39a, 0x3ba, 0x3b5, 0x3d6, 0x7d7, 0x3e4, 0x7d8, 0x7ea, 0x0ba, 0x7e8, 0x3a0, 0x1bd, 0x1b4, 0x38a, 0x1c4, 0x392, 0x3aa, 0x3b0, 0x3bc, 0x3d7, 0x7d4, 0x7dc, 0x7db, 0x7d5, 0x7f0, 0x0c1, 0x7fb, 0x3c8, 0x3a3, 0x395, 0x39d, 0x3ac, 0x3ae, 0x3c5, 0x3d8, 0x3e2, 0x3e6, 0x7e4, 0x7e7, 0x7e0, 0x7e9, 0x7f7, 0x190, 0x7f2, 0x393, 0x1be, 0x1c0, 0x394, 0x397, 0x3ad, 0x3c3, 0x3c1, 0x3d2, 0x7da, 0x7d9, 0x7df, 0x7eb, 0x7f4, 0x7fa, 0x195, 0x7f8, 0x3bd, 0x39c, 0x3ab, 0x3a8, 0x3b3, 0x3b9, 0x3d0, 0x3e3, 0x3e5, 0x7e2, 0x7de, 0x7ed, 0x7f1, 0x7f9, 0x7fc, 0x193, 0xffd, 0x3dc, 0x3b6, 0x3c7, 0x3cc, 0x3cb, 0x3d9, 0x3da, 0x7d3, 0x7e1, 0x7ee, 0x7ef, 0x7f5, 0x7f6, 0xffc, 0xfff, 0x19d, 0x1c2, 0x0b5, 0x0a1, 0x096, 0x097, 0x095, 0x099, 0x0a0, 0x0a2, 0x0ac, 0x0a9, 0x0b1, 0x0b3, 0x0bb, 0x0c0, 0x18f, 0x004, }; static const uint8_t bits11[289] = { 4, 5, 6, 7, 8, 8, 9, 10, 10, 10, 11, 11, 12, 11, 12, 12, 10, 5, 4, 5, 6, 7, 7, 8, 8, 9, 9, 9, 10, 10, 10, 10, 11, 8, 6, 5, 5, 6, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10, 8, 7, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10, 8, 8, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10, 8, 8, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 8, 9, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10, 10, 8, 9, 8, 8, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10, 10, 10, 8, 10, 9, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 8, 10, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 8, 11, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 10, 11, 11, 8, 11, 10, 9, 9, 10, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 8, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 9, 11, 10, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 9, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 9, 12, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 5, }; const uint16_t * const ff_aac_spectral_codes[11] = { codes1, codes2, codes3, codes4, codes5, codes6, codes7, codes8, codes9, codes10, codes11, }; const uint8_t * const ff_aac_spectral_bits[11] = { bits1, bits2, bits3, bits4, bits5, bits6, bits7, bits8, bits9, bits10, bits11, }; const uint16_t ff_aac_spectral_sizes[11] = { 81, 81, 81, 81, 81, 81, 64, 64, 169, 169, 289, }; /* NOTE: * 64.0f is a special value indicating the existence of an escape code in the * bitstream. */ static const DECLARE_ALIGNED(16, float, codebook_vector0)[324] = { -1.0000000, -1.0000000, -1.0000000, -1.0000000, -1.0000000, -1.0000000, -1.0000000, 0.0000000, -1.0000000, -1.0000000, -1.0000000, 1.0000000, -1.0000000, -1.0000000, 0.0000000, -1.0000000, -1.0000000, -1.0000000, 0.0000000, 0.0000000, -1.0000000, -1.0000000, 0.0000000, 1.0000000, -1.0000000, -1.0000000, 1.0000000, -1.0000000, -1.0000000, -1.0000000, 1.0000000, 0.0000000, -1.0000000, -1.0000000, 1.0000000, 1.0000000, -1.0000000, 0.0000000, -1.0000000, -1.0000000, -1.0000000, 0.0000000, -1.0000000, 0.0000000, -1.0000000, 0.0000000, -1.0000000, 1.0000000, -1.0000000, 0.0000000, 0.0000000, -1.0000000, -1.0000000, 0.0000000, 0.0000000, 0.0000000, -1.0000000, 0.0000000, 0.0000000, 1.0000000, -1.0000000, 0.0000000, 1.0000000, -1.0000000, -1.0000000, 0.0000000, 1.0000000, 0.0000000, -1.0000000, 0.0000000, 1.0000000, 1.0000000, -1.0000000, 1.0000000, -1.0000000, -1.0000000, -1.0000000, 1.0000000, -1.0000000, 0.0000000, -1.0000000, 1.0000000, -1.0000000, 1.0000000, -1.0000000, 1.0000000, 0.0000000, -1.0000000, -1.0000000, 1.0000000, 0.0000000, 0.0000000, -1.0000000, 1.0000000, 0.0000000, 1.0000000, -1.0000000, 1.0000000, 1.0000000, -1.0000000, -1.0000000, 1.0000000, 1.0000000, 0.0000000, -1.0000000, 1.0000000, 1.0000000, 1.0000000, 0.0000000, -1.0000000, -1.0000000, -1.0000000, 0.0000000, -1.0000000, -1.0000000, 0.0000000, 0.0000000, -1.0000000, -1.0000000, 1.0000000, 0.0000000, -1.0000000, 0.0000000, -1.0000000, 0.0000000, -1.0000000, 0.0000000, 0.0000000, 0.0000000, -1.0000000, 0.0000000, 1.0000000, 0.0000000, -1.0000000, 1.0000000, -1.0000000, 0.0000000, -1.0000000, 1.0000000, 0.0000000, 0.0000000, -1.0000000, 1.0000000, 1.0000000, 0.0000000, 0.0000000, -1.0000000, -1.0000000, 0.0000000, 0.0000000, -1.0000000, 0.0000000, 0.0000000, 0.0000000, -1.0000000, 1.0000000, 0.0000000, 0.0000000, 0.0000000, -1.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 1.0000000, 0.0000000, 0.0000000, 1.0000000, -1.0000000, 0.0000000, 0.0000000, 1.0000000, 0.0000000, 0.0000000, 0.0000000, 1.0000000, 1.0000000, 0.0000000, 1.0000000, -1.0000000, -1.0000000, 0.0000000, 1.0000000, -1.0000000, 0.0000000, 0.0000000, 1.0000000, -1.0000000, 1.0000000, 0.0000000, 1.0000000, 0.0000000, -1.0000000, 0.0000000, 1.0000000, 0.0000000, 0.0000000, 0.0000000, 1.0000000, 0.0000000, 1.0000000, 0.0000000, 1.0000000, 1.0000000, -1.0000000, 0.0000000, 1.0000000, 1.0000000, 0.0000000, 0.0000000, 1.0000000, 1.0000000, 1.0000000, 1.0000000, -1.0000000, -1.0000000, -1.0000000, 1.0000000, -1.0000000, -1.0000000, 0.0000000, 1.0000000, -1.0000000, -1.0000000, 1.0000000, 1.0000000, -1.0000000, 0.0000000, -1.0000000, 1.0000000, -1.0000000, 0.0000000, 0.0000000, 1.0000000, -1.0000000, 0.0000000, 1.0000000, 1.0000000, -1.0000000, 1.0000000, -1.0000000, 1.0000000, -1.0000000, 1.0000000, 0.0000000, 1.0000000, -1.0000000, 1.0000000, 1.0000000, 1.0000000, 0.0000000, -1.0000000, -1.0000000, 1.0000000, 0.0000000, -1.0000000, 0.0000000, 1.0000000, 0.0000000, -1.0000000, 1.0000000, 1.0000000, 0.0000000, 0.0000000, -1.0000000, 1.0000000, 0.0000000, 0.0000000, 0.0000000, 1.0000000, 0.0000000, 0.0000000, 1.0000000, 1.0000000, 0.0000000, 1.0000000, -1.0000000, 1.0000000, 0.0000000, 1.0000000, 0.0000000, 1.0000000, 0.0000000, 1.0000000, 1.0000000, 1.0000000, 1.0000000, -1.0000000, -1.0000000, 1.0000000, 1.0000000, -1.0000000, 0.0000000, 1.0000000, 1.0000000, -1.0000000, 1.0000000, 1.0000000, 1.0000000, 0.0000000, -1.0000000, 1.0000000, 1.0000000, 0.0000000, 0.0000000, 1.0000000, 1.0000000, 0.0000000, 1.0000000, 1.0000000, 1.0000000, 1.0000000, -1.0000000, 1.0000000, 1.0000000, 1.0000000, 0.0000000, 1.0000000, 1.0000000, 1.0000000, 1.0000000, }; static const DECLARE_ALIGNED(16, float, codebook_vector2)[324] = { 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 1.0000000, 0.0000000, 0.0000000, 0.0000000, 2.5198421, 0.0000000, 0.0000000, 1.0000000, 0.0000000, 0.0000000, 0.0000000, 1.0000000, 1.0000000, 0.0000000, 0.0000000, 1.0000000, 2.5198421, 0.0000000, 0.0000000, 2.5198421, 0.0000000, 0.0000000, 0.0000000, 2.5198421, 1.0000000, 0.0000000, 0.0000000, 2.5198421, 2.5198421, 0.0000000, 1.0000000, 0.0000000, 0.0000000, 0.0000000, 1.0000000, 0.0000000, 1.0000000, 0.0000000, 1.0000000, 0.0000000, 2.5198421, 0.0000000, 1.0000000, 1.0000000, 0.0000000, 0.0000000, 1.0000000, 1.0000000, 1.0000000, 0.0000000, 1.0000000, 1.0000000, 2.5198421, 0.0000000, 1.0000000, 2.5198421, 0.0000000, 0.0000000, 1.0000000, 2.5198421, 1.0000000, 0.0000000, 1.0000000, 2.5198421, 2.5198421, 0.0000000, 2.5198421, 0.0000000, 0.0000000, 0.0000000, 2.5198421, 0.0000000, 1.0000000, 0.0000000, 2.5198421, 0.0000000, 2.5198421, 0.0000000, 2.5198421, 1.0000000, 0.0000000, 0.0000000, 2.5198421, 1.0000000, 1.0000000, 0.0000000, 2.5198421, 1.0000000, 2.5198421, 0.0000000, 2.5198421, 2.5198421, 0.0000000, 0.0000000, 2.5198421, 2.5198421, 1.0000000, 0.0000000, 2.5198421, 2.5198421, 2.5198421, 1.0000000, 0.0000000, 0.0000000, 0.0000000, 1.0000000, 0.0000000, 0.0000000, 1.0000000, 1.0000000, 0.0000000, 0.0000000, 2.5198421, 1.0000000, 0.0000000, 1.0000000, 0.0000000, 1.0000000, 0.0000000, 1.0000000, 1.0000000, 1.0000000, 0.0000000, 1.0000000, 2.5198421, 1.0000000, 0.0000000, 2.5198421, 0.0000000, 1.0000000, 0.0000000, 2.5198421, 1.0000000, 1.0000000, 0.0000000, 2.5198421, 2.5198421, 1.0000000, 1.0000000, 0.0000000, 0.0000000, 1.0000000, 1.0000000, 0.0000000, 1.0000000, 1.0000000, 1.0000000, 0.0000000, 2.5198421, 1.0000000, 1.0000000, 1.0000000, 0.0000000, 1.0000000, 1.0000000, 1.0000000, 1.0000000, 1.0000000, 1.0000000, 1.0000000, 2.5198421, 1.0000000, 1.0000000, 2.5198421, 0.0000000, 1.0000000, 1.0000000, 2.5198421, 1.0000000, 1.0000000, 1.0000000, 2.5198421, 2.5198421, 1.0000000, 2.5198421, 0.0000000, 0.0000000, 1.0000000, 2.5198421, 0.0000000, 1.0000000, 1.0000000, 2.5198421, 0.0000000, 2.5198421, 1.0000000, 2.5198421, 1.0000000, 0.0000000, 1.0000000, 2.5198421, 1.0000000, 1.0000000, 1.0000000, 2.5198421, 1.0000000, 2.5198421, 1.0000000, 2.5198421, 2.5198421, 0.0000000, 1.0000000, 2.5198421, 2.5198421, 1.0000000, 1.0000000, 2.5198421, 2.5198421, 2.5198421, 2.5198421, 0.0000000, 0.0000000, 0.0000000, 2.5198421, 0.0000000, 0.0000000, 1.0000000, 2.5198421, 0.0000000, 0.0000000, 2.5198421, 2.5198421, 0.0000000, 1.0000000, 0.0000000, 2.5198421, 0.0000000, 1.0000000, 1.0000000, 2.5198421, 0.0000000, 1.0000000, 2.5198421, 2.5198421, 0.0000000, 2.5198421, 0.0000000, 2.5198421, 0.0000000, 2.5198421, 1.0000000, 2.5198421, 0.0000000, 2.5198421, 2.5198421, 2.5198421, 1.0000000, 0.0000000, 0.0000000, 2.5198421, 1.0000000, 0.0000000, 1.0000000, 2.5198421, 1.0000000, 0.0000000, 2.5198421, 2.5198421, 1.0000000, 1.0000000, 0.0000000, 2.5198421, 1.0000000, 1.0000000, 1.0000000, 2.5198421, 1.0000000, 1.0000000, 2.5198421, 2.5198421, 1.0000000, 2.5198421, 0.0000000, 2.5198421, 1.0000000, 2.5198421, 1.0000000, 2.5198421, 1.0000000, 2.5198421, 2.5198421, 2.5198421, 2.5198421, 0.0000000, 0.0000000, 2.5198421, 2.5198421, 0.0000000, 1.0000000, 2.5198421, 2.5198421, 0.0000000, 2.5198421, 2.5198421, 2.5198421, 1.0000000, 0.0000000, 2.5198421, 2.5198421, 1.0000000, 1.0000000, 2.5198421, 2.5198421, 1.0000000, 2.5198421, 2.5198421, 2.5198421, 2.5198421, 0.0000000, 2.5198421, 2.5198421, 2.5198421, 1.0000000, 2.5198421, 2.5198421, 2.5198421, 2.5198421, }; static const DECLARE_ALIGNED(16, float, codebook_vector4)[162] = { -6.3496042, -6.3496042, -6.3496042, -4.3267487, -6.3496042, -2.5198421, -6.3496042, -1.0000000, -6.3496042, 0.0000000, -6.3496042, 1.0000000, -6.3496042, 2.5198421, -6.3496042, 4.3267487, -6.3496042, 6.3496042, -4.3267487, -6.3496042, -4.3267487, -4.3267487, -4.3267487, -2.5198421, -4.3267487, -1.0000000, -4.3267487, 0.0000000, -4.3267487, 1.0000000, -4.3267487, 2.5198421, -4.3267487, 4.3267487, -4.3267487, 6.3496042, -2.5198421, -6.3496042, -2.5198421, -4.3267487, -2.5198421, -2.5198421, -2.5198421, -1.0000000, -2.5198421, 0.0000000, -2.5198421, 1.0000000, -2.5198421, 2.5198421, -2.5198421, 4.3267487, -2.5198421, 6.3496042, -1.0000000, -6.3496042, -1.0000000, -4.3267487, -1.0000000, -2.5198421, -1.0000000, -1.0000000, -1.0000000, 0.0000000, -1.0000000, 1.0000000, -1.0000000, 2.5198421, -1.0000000, 4.3267487, -1.0000000, 6.3496042, 0.0000000, -6.3496042, 0.0000000, -4.3267487, 0.0000000, -2.5198421, 0.0000000, -1.0000000, 0.0000000, 0.0000000, 0.0000000, 1.0000000, 0.0000000, 2.5198421, 0.0000000, 4.3267487, 0.0000000, 6.3496042, 1.0000000, -6.3496042, 1.0000000, -4.3267487, 1.0000000, -2.5198421, 1.0000000, -1.0000000, 1.0000000, 0.0000000, 1.0000000, 1.0000000, 1.0000000, 2.5198421, 1.0000000, 4.3267487, 1.0000000, 6.3496042, 2.5198421, -6.3496042, 2.5198421, -4.3267487, 2.5198421, -2.5198421, 2.5198421, -1.0000000, 2.5198421, 0.0000000, 2.5198421, 1.0000000, 2.5198421, 2.5198421, 2.5198421, 4.3267487, 2.5198421, 6.3496042, 4.3267487, -6.3496042, 4.3267487, -4.3267487, 4.3267487, -2.5198421, 4.3267487, -1.0000000, 4.3267487, 0.0000000, 4.3267487, 1.0000000, 4.3267487, 2.5198421, 4.3267487, 4.3267487, 4.3267487, 6.3496042, 6.3496042, -6.3496042, 6.3496042, -4.3267487, 6.3496042, -2.5198421, 6.3496042, -1.0000000, 6.3496042, 0.0000000, 6.3496042, 1.0000000, 6.3496042, 2.5198421, 6.3496042, 4.3267487, 6.3496042, 6.3496042, }; static const DECLARE_ALIGNED(16, float, codebook_vector6)[128] = { 0.0000000, 0.0000000, 0.0000000, 1.0000000, 0.0000000, 2.5198421, 0.0000000, 4.3267487, 0.0000000, 6.3496042, 0.0000000, 8.5498797, 0.0000000, 10.9027236, 0.0000000, 13.3905183, 1.0000000, 0.0000000, 1.0000000, 1.0000000, 1.0000000, 2.5198421, 1.0000000, 4.3267487, 1.0000000, 6.3496042, 1.0000000, 8.5498797, 1.0000000, 10.9027236, 1.0000000, 13.3905183, 2.5198421, 0.0000000, 2.5198421, 1.0000000, 2.5198421, 2.5198421, 2.5198421, 4.3267487, 2.5198421, 6.3496042, 2.5198421, 8.5498797, 2.5198421, 10.9027236, 2.5198421, 13.3905183, 4.3267487, 0.0000000, 4.3267487, 1.0000000, 4.3267487, 2.5198421, 4.3267487, 4.3267487, 4.3267487, 6.3496042, 4.3267487, 8.5498797, 4.3267487, 10.9027236, 4.3267487, 13.3905183, 6.3496042, 0.0000000, 6.3496042, 1.0000000, 6.3496042, 2.5198421, 6.3496042, 4.3267487, 6.3496042, 6.3496042, 6.3496042, 8.5498797, 6.3496042, 10.9027236, 6.3496042, 13.3905183, 8.5498797, 0.0000000, 8.5498797, 1.0000000, 8.5498797, 2.5198421, 8.5498797, 4.3267487, 8.5498797, 6.3496042, 8.5498797, 8.5498797, 8.5498797, 10.9027236, 8.5498797, 13.3905183, 10.9027236, 0.0000000, 10.9027236, 1.0000000, 10.9027236, 2.5198421, 10.9027236, 4.3267487, 10.9027236, 6.3496042, 10.9027236, 8.5498797, 10.9027236, 10.9027236, 10.9027236, 13.3905183, 13.3905183, 0.0000000, 13.3905183, 1.0000000, 13.3905183, 2.5198421, 13.3905183, 4.3267487, 13.3905183, 6.3496042, 13.3905183, 8.5498797, 13.3905183, 10.9027236, 13.3905183, 13.3905183, }; static const DECLARE_ALIGNED(16, float, codebook_vector8)[338] = { 0.0000000, 0.0000000, 0.0000000, 1.0000000, 0.0000000, 2.5198421, 0.0000000, 4.3267487, 0.0000000, 6.3496042, 0.0000000, 8.5498797, 0.0000000, 10.9027236, 0.0000000, 13.3905183, 0.0000000, 16.0000000, 0.0000000, 18.7207544, 0.0000000, 21.5443469, 0.0000000, 24.4637810, 0.0000000, 27.4731418, 1.0000000, 0.0000000, 1.0000000, 1.0000000, 1.0000000, 2.5198421, 1.0000000, 4.3267487, 1.0000000, 6.3496042, 1.0000000, 8.5498797, 1.0000000, 10.9027236, 1.0000000, 13.3905183, 1.0000000, 16.0000000, 1.0000000, 18.7207544, 1.0000000, 21.5443469, 1.0000000, 24.4637810, 1.0000000, 27.4731418, 2.5198421, 0.0000000, 2.5198421, 1.0000000, 2.5198421, 2.5198421, 2.5198421, 4.3267487, 2.5198421, 6.3496042, 2.5198421, 8.5498797, 2.5198421, 10.9027236, 2.5198421, 13.3905183, 2.5198421, 16.0000000, 2.5198421, 18.7207544, 2.5198421, 21.5443469, 2.5198421, 24.4637810, 2.5198421, 27.4731418, 4.3267487, 0.0000000, 4.3267487, 1.0000000, 4.3267487, 2.5198421, 4.3267487, 4.3267487, 4.3267487, 6.3496042, 4.3267487, 8.5498797, 4.3267487, 10.9027236, 4.3267487, 13.3905183, 4.3267487, 16.0000000, 4.3267487, 18.7207544, 4.3267487, 21.5443469, 4.3267487, 24.4637810, 4.3267487, 27.4731418, 6.3496042, 0.0000000, 6.3496042, 1.0000000, 6.3496042, 2.5198421, 6.3496042, 4.3267487, 6.3496042, 6.3496042, 6.3496042, 8.5498797, 6.3496042, 10.9027236, 6.3496042, 13.3905183, 6.3496042, 16.0000000, 6.3496042, 18.7207544, 6.3496042, 21.5443469, 6.3496042, 24.4637810, 6.3496042, 27.4731418, 8.5498797, 0.0000000, 8.5498797, 1.0000000, 8.5498797, 2.5198421, 8.5498797, 4.3267487, 8.5498797, 6.3496042, 8.5498797, 8.5498797, 8.5498797, 10.9027236, 8.5498797, 13.3905183, 8.5498797, 16.0000000, 8.5498797, 18.7207544, 8.5498797, 21.5443469, 8.5498797, 24.4637810, 8.5498797, 27.4731418, 10.9027236, 0.0000000, 10.9027236, 1.0000000, 10.9027236, 2.5198421, 10.9027236, 4.3267487, 10.9027236, 6.3496042, 10.9027236, 8.5498797, 10.9027236, 10.9027236, 10.9027236, 13.3905183, 10.9027236, 16.0000000, 10.9027236, 18.7207544, 10.9027236, 21.5443469, 10.9027236, 24.4637810, 10.9027236, 27.4731418, 13.3905183, 0.0000000, 13.3905183, 1.0000000, 13.3905183, 2.5198421, 13.3905183, 4.3267487, 13.3905183, 6.3496042, 13.3905183, 8.5498797, 13.3905183, 10.9027236, 13.3905183, 13.3905183, 13.3905183, 16.0000000, 13.3905183, 18.7207544, 13.3905183, 21.5443469, 13.3905183, 24.4637810, 13.3905183, 27.4731418, 16.0000000, 0.0000000, 16.0000000, 1.0000000, 16.0000000, 2.5198421, 16.0000000, 4.3267487, 16.0000000, 6.3496042, 16.0000000, 8.5498797, 16.0000000, 10.9027236, 16.0000000, 13.3905183, 16.0000000, 16.0000000, 16.0000000, 18.7207544, 16.0000000, 21.5443469, 16.0000000, 24.4637810, 16.0000000, 27.4731418, 18.7207544, 0.0000000, 18.7207544, 1.0000000, 18.7207544, 2.5198421, 18.7207544, 4.3267487, 18.7207544, 6.3496042, 18.7207544, 8.5498797, 18.7207544, 10.9027236, 18.7207544, 13.3905183, 18.7207544, 16.0000000, 18.7207544, 18.7207544, 18.7207544, 21.5443469, 18.7207544, 24.4637810, 18.7207544, 27.4731418, 21.5443469, 0.0000000, 21.5443469, 1.0000000, 21.5443469, 2.5198421, 21.5443469, 4.3267487, 21.5443469, 6.3496042, 21.5443469, 8.5498797, 21.5443469, 10.9027236, 21.5443469, 13.3905183, 21.5443469, 16.0000000, 21.5443469, 18.7207544, 21.5443469, 21.5443469, 21.5443469, 24.4637810, 21.5443469, 27.4731418, 24.4637810, 0.0000000, 24.4637810, 1.0000000, 24.4637810, 2.5198421, 24.4637810, 4.3267487, 24.4637810, 6.3496042, 24.4637810, 8.5498797, 24.4637810, 10.9027236, 24.4637810, 13.3905183, 24.4637810, 16.0000000, 24.4637810, 18.7207544, 24.4637810, 21.5443469, 24.4637810, 24.4637810, 24.4637810, 27.4731418, 27.4731418, 0.0000000, 27.4731418, 1.0000000, 27.4731418, 2.5198421, 27.4731418, 4.3267487, 27.4731418, 6.3496042, 27.4731418, 8.5498797, 27.4731418, 10.9027236, 27.4731418, 13.3905183, 27.4731418, 16.0000000, 27.4731418, 18.7207544, 27.4731418, 21.5443469, 27.4731418, 24.4637810, 27.4731418, 27.4731418, }; static const DECLARE_ALIGNED(16, float, codebook_vector10)[578] = { 0.0000000, 0.0000000, 0.0000000, 1.0000000, 0.0000000, 2.5198421, 0.0000000, 4.3267487, 0.0000000, 6.3496042, 0.0000000, 8.5498797, 0.0000000, 10.9027236, 0.0000000, 13.3905183, 0.0000000, 16.0000000, 0.0000000, 18.7207544, 0.0000000, 21.5443469, 0.0000000, 24.4637810, 0.0000000, 27.4731418, 0.0000000, 30.5673509, 0.0000000, 33.7419917, 0.0000000, 36.9931811, 0.0000000, 64.0f, 1.0000000, 0.0000000, 1.0000000, 1.0000000, 1.0000000, 2.5198421, 1.0000000, 4.3267487, 1.0000000, 6.3496042, 1.0000000, 8.5498797, 1.0000000, 10.9027236, 1.0000000, 13.3905183, 1.0000000, 16.0000000, 1.0000000, 18.7207544, 1.0000000, 21.5443469, 1.0000000, 24.4637810, 1.0000000, 27.4731418, 1.0000000, 30.5673509, 1.0000000, 33.7419917, 1.0000000, 36.9931811, 1.0000000, 64.0f, 2.5198421, 0.0000000, 2.5198421, 1.0000000, 2.5198421, 2.5198421, 2.5198421, 4.3267487, 2.5198421, 6.3496042, 2.5198421, 8.5498797, 2.5198421, 10.9027236, 2.5198421, 13.3905183, 2.5198421, 16.0000000, 2.5198421, 18.7207544, 2.5198421, 21.5443469, 2.5198421, 24.4637810, 2.5198421, 27.4731418, 2.5198421, 30.5673509, 2.5198421, 33.7419917, 2.5198421, 36.9931811, 2.5198421, 64.0f, 4.3267487, 0.0000000, 4.3267487, 1.0000000, 4.3267487, 2.5198421, 4.3267487, 4.3267487, 4.3267487, 6.3496042, 4.3267487, 8.5498797, 4.3267487, 10.9027236, 4.3267487, 13.3905183, 4.3267487, 16.0000000, 4.3267487, 18.7207544, 4.3267487, 21.5443469, 4.3267487, 24.4637810, 4.3267487, 27.4731418, 4.3267487, 30.5673509, 4.3267487, 33.7419917, 4.3267487, 36.9931811, 4.3267487, 64.0f, 6.3496042, 0.0000000, 6.3496042, 1.0000000, 6.3496042, 2.5198421, 6.3496042, 4.3267487, 6.3496042, 6.3496042, 6.3496042, 8.5498797, 6.3496042, 10.9027236, 6.3496042, 13.3905183, 6.3496042, 16.0000000, 6.3496042, 18.7207544, 6.3496042, 21.5443469, 6.3496042, 24.4637810, 6.3496042, 27.4731418, 6.3496042, 30.5673509, 6.3496042, 33.7419917, 6.3496042, 36.9931811, 6.3496042, 64.0f, 8.5498797, 0.0000000, 8.5498797, 1.0000000, 8.5498797, 2.5198421, 8.5498797, 4.3267487, 8.5498797, 6.3496042, 8.5498797, 8.5498797, 8.5498797, 10.9027236, 8.5498797, 13.3905183, 8.5498797, 16.0000000, 8.5498797, 18.7207544, 8.5498797, 21.5443469, 8.5498797, 24.4637810, 8.5498797, 27.4731418, 8.5498797, 30.5673509, 8.5498797, 33.7419917, 8.5498797, 36.9931811, 8.5498797, 64.0f, 10.9027236, 0.0000000, 10.9027236, 1.0000000, 10.9027236, 2.5198421, 10.9027236, 4.3267487, 10.9027236, 6.3496042, 10.9027236, 8.5498797, 10.9027236, 10.9027236, 10.9027236, 13.3905183, 10.9027236, 16.0000000, 10.9027236, 18.7207544, 10.9027236, 21.5443469, 10.9027236, 24.4637810, 10.9027236, 27.4731418, 10.9027236, 30.5673509, 10.9027236, 33.7419917, 10.9027236, 36.9931811, 10.9027236, 64.0f, 13.3905183, 0.0000000, 13.3905183, 1.0000000, 13.3905183, 2.5198421, 13.3905183, 4.3267487, 13.3905183, 6.3496042, 13.3905183, 8.5498797, 13.3905183, 10.9027236, 13.3905183, 13.3905183, 13.3905183, 16.0000000, 13.3905183, 18.7207544, 13.3905183, 21.5443469, 13.3905183, 24.4637810, 13.3905183, 27.4731418, 13.3905183, 30.5673509, 13.3905183, 33.7419917, 13.3905183, 36.9931811, 13.3905183, 64.0f, 16.0000000, 0.0000000, 16.0000000, 1.0000000, 16.0000000, 2.5198421, 16.0000000, 4.3267487, 16.0000000, 6.3496042, 16.0000000, 8.5498797, 16.0000000, 10.9027236, 16.0000000, 13.3905183, 16.0000000, 16.0000000, 16.0000000, 18.7207544, 16.0000000, 21.5443469, 16.0000000, 24.4637810, 16.0000000, 27.4731418, 16.0000000, 30.5673509, 16.0000000, 33.7419917, 16.0000000, 36.9931811, 16.0000000, 64.0f, 18.7207544, 0.0000000, 18.7207544, 1.0000000, 18.7207544, 2.5198421, 18.7207544, 4.3267487, 18.7207544, 6.3496042, 18.7207544, 8.5498797, 18.7207544, 10.9027236, 18.7207544, 13.3905183, 18.7207544, 16.0000000, 18.7207544, 18.7207544, 18.7207544, 21.5443469, 18.7207544, 24.4637810, 18.7207544, 27.4731418, 18.7207544, 30.5673509, 18.7207544, 33.7419917, 18.7207544, 36.9931811, 18.7207544, 64.0f, 21.5443469, 0.0000000, 21.5443469, 1.0000000, 21.5443469, 2.5198421, 21.5443469, 4.3267487, 21.5443469, 6.3496042, 21.5443469, 8.5498797, 21.5443469, 10.9027236, 21.5443469, 13.3905183, 21.5443469, 16.0000000, 21.5443469, 18.7207544, 21.5443469, 21.5443469, 21.5443469, 24.4637810, 21.5443469, 27.4731418, 21.5443469, 30.5673509, 21.5443469, 33.7419917, 21.5443469, 36.9931811, 21.5443469, 64.0f, 24.4637810, 0.0000000, 24.4637810, 1.0000000, 24.4637810, 2.5198421, 24.4637810, 4.3267487, 24.4637810, 6.3496042, 24.4637810, 8.5498797, 24.4637810, 10.9027236, 24.4637810, 13.3905183, 24.4637810, 16.0000000, 24.4637810, 18.7207544, 24.4637810, 21.5443469, 24.4637810, 24.4637810, 24.4637810, 27.4731418, 24.4637810, 30.5673509, 24.4637810, 33.7419917, 24.4637810, 36.9931811, 24.4637810, 64.0f, 27.4731418, 0.0000000, 27.4731418, 1.0000000, 27.4731418, 2.5198421, 27.4731418, 4.3267487, 27.4731418, 6.3496042, 27.4731418, 8.5498797, 27.4731418, 10.9027236, 27.4731418, 13.3905183, 27.4731418, 16.0000000, 27.4731418, 18.7207544, 27.4731418, 21.5443469, 27.4731418, 24.4637810, 27.4731418, 27.4731418, 27.4731418, 30.5673509, 27.4731418, 33.7419917, 27.4731418, 36.9931811, 27.4731418, 64.0f, 30.5673509, 0.0000000, 30.5673509, 1.0000000, 30.5673509, 2.5198421, 30.5673509, 4.3267487, 30.5673509, 6.3496042, 30.5673509, 8.5498797, 30.5673509, 10.9027236, 30.5673509, 13.3905183, 30.5673509, 16.0000000, 30.5673509, 18.7207544, 30.5673509, 21.5443469, 30.5673509, 24.4637810, 30.5673509, 27.4731418, 30.5673509, 30.5673509, 30.5673509, 33.7419917, 30.5673509, 36.9931811, 30.5673509, 64.0f, 33.7419917, 0.0000000, 33.7419917, 1.0000000, 33.7419917, 2.5198421, 33.7419917, 4.3267487, 33.7419917, 6.3496042, 33.7419917, 8.5498797, 33.7419917, 10.9027236, 33.7419917, 13.3905183, 33.7419917, 16.0000000, 33.7419917, 18.7207544, 33.7419917, 21.5443469, 33.7419917, 24.4637810, 33.7419917, 27.4731418, 33.7419917, 30.5673509, 33.7419917, 33.7419917, 33.7419917, 36.9931811, 33.7419917, 64.0f, 36.9931811, 0.0000000, 36.9931811, 1.0000000, 36.9931811, 2.5198421, 36.9931811, 4.3267487, 36.9931811, 6.3496042, 36.9931811, 8.5498797, 36.9931811, 10.9027236, 36.9931811, 13.3905183, 36.9931811, 16.0000000, 36.9931811, 18.7207544, 36.9931811, 21.5443469, 36.9931811, 24.4637810, 36.9931811, 27.4731418, 36.9931811, 30.5673509, 36.9931811, 33.7419917, 36.9931811, 36.9931811, 36.9931811, 64.0f, 64.0f, 0.0000000, 64.0f, 1.0000000, 64.0f, 2.5198421, 64.0f, 4.3267487, 64.0f, 6.3496042, 64.0f, 8.5498797, 64.0f, 10.9027236, 64.0f, 13.3905183, 64.0f, 16.0000000, 64.0f, 18.7207544, 64.0f, 21.5443469, 64.0f, 24.4637810, 64.0f, 27.4731418, 64.0f, 30.5673509, 64.0f, 33.7419917, 64.0f, 36.9931811, 64.0f, 64.0f, }; const float * const ff_aac_codebook_vectors[] = { codebook_vector0, codebook_vector0, codebook_vector2, codebook_vector2, codebook_vector4, codebook_vector4, codebook_vector6, codebook_vector6, codebook_vector8, codebook_vector8, codebook_vector10, }; static const float codebook_vector0_vals[] = { -1.0000000, 0.0000000, 1.0000000 }; /* * bits 0:1, 2:3, 4:5, 6:7 index into _vals array * 8:11 number of non-zero values * 12:15 bit mask of non-zero values */ static const uint16_t codebook_vector02_idx[] = { 0x0000, 0x8140, 0x8180, 0x4110, 0xc250, 0xc290, 0x4120, 0xc260, 0xc2a0, 0x2104, 0xa244, 0xa284, 0x6214, 0xe354, 0xe394, 0x6224, 0xe364, 0xe3a4, 0x2108, 0xa248, 0xa288, 0x6218, 0xe358, 0xe398, 0x6228, 0xe368, 0xe3a8, 0x1101, 0x9241, 0x9281, 0x5211, 0xd351, 0xd391, 0x5221, 0xd361, 0xd3a1, 0x3205, 0xb345, 0xb385, 0x7315, 0xf455, 0xf495, 0x7325, 0xf465, 0xf4a5, 0x3209, 0xb349, 0xb389, 0x7319, 0xf459, 0xf499, 0x7329, 0xf469, 0xf4a9, 0x1102, 0x9242, 0x9282, 0x5212, 0xd352, 0xd392, 0x5222, 0xd362, 0xd3a2, 0x3206, 0xb346, 0xb386, 0x7316, 0xf456, 0xf496, 0x7326, 0xf466, 0xf4a6, 0x320a, 0xb34a, 0xb38a, 0x731a, 0xf45a, 0xf49a, 0x732a, 0xf46a, 0xf4aa, }; static const float codebook_vector4_vals[] = { -6.3496042, -4.3267487, -2.5198421, -1.0000000, 0.0000000, 1.0000000, 2.5198421, 4.3267487, 6.3496042, }; /* * bits 0:3, 4:7 index into _vals array */ static const uint16_t codebook_vector4_idx[] = { 0x0000, 0x0010, 0x0020, 0x0030, 0x0040, 0x0050, 0x0060, 0x0070, 0x0080, 0x0001, 0x0011, 0x0021, 0x0031, 0x0041, 0x0051, 0x0061, 0x0071, 0x0081, 0x0002, 0x0012, 0x0022, 0x0032, 0x0042, 0x0052, 0x0062, 0x0072, 0x0082, 0x0003, 0x0013, 0x0023, 0x0033, 0x0043, 0x0053, 0x0063, 0x0073, 0x0083, 0x0004, 0x0014, 0x0024, 0x0034, 0x0044, 0x0054, 0x0064, 0x0074, 0x0084, 0x0005, 0x0015, 0x0025, 0x0035, 0x0045, 0x0055, 0x0065, 0x0075, 0x0085, 0x0006, 0x0016, 0x0026, 0x0036, 0x0046, 0x0056, 0x0066, 0x0076, 0x0086, 0x0007, 0x0017, 0x0027, 0x0037, 0x0047, 0x0057, 0x0067, 0x0077, 0x0087, 0x0008, 0x0018, 0x0028, 0x0038, 0x0048, 0x0058, 0x0068, 0x0078, 0x0088, }; /* * bits 0:3, 4:7 index into _vals array * 8:11 number of non-zero values * 12:15 1: only second value non-zero * 0: other cases */ static const uint16_t codebook_vector6_idx[] = { 0x0000, 0x0110, 0x0120, 0x0130, 0x0140, 0x0150, 0x0160, 0x0170, 0x1101, 0x0211, 0x0221, 0x0231, 0x0241, 0x0251, 0x0261, 0x0271, 0x1102, 0x0212, 0x0222, 0x0232, 0x0242, 0x0252, 0x0262, 0x0272, 0x1103, 0x0213, 0x0223, 0x0233, 0x0243, 0x0253, 0x0263, 0x0273, 0x1104, 0x0214, 0x0224, 0x0234, 0x0244, 0x0254, 0x0264, 0x0274, 0x1105, 0x0215, 0x0225, 0x0235, 0x0245, 0x0255, 0x0265, 0x0275, 0x1106, 0x0216, 0x0226, 0x0236, 0x0246, 0x0256, 0x0266, 0x0276, 0x1107, 0x0217, 0x0227, 0x0237, 0x0247, 0x0257, 0x0267, 0x0277, }; /* * bits 0:3, 4:7 index into _vals array * 8:11 number of non-zero values * 12:15 1: only second value non-zero * 0: other cases */ static const uint16_t codebook_vector8_idx[] = { 0x0000, 0x0110, 0x0120, 0x0130, 0x0140, 0x0150, 0x0160, 0x0170, 0x0180, 0x0190, 0x01a0, 0x01b0, 0x01c0, 0x1101, 0x0211, 0x0221, 0x0231, 0x0241, 0x0251, 0x0261, 0x0271, 0x0281, 0x0291, 0x02a1, 0x02b1, 0x02c1, 0x1102, 0x0212, 0x0222, 0x0232, 0x0242, 0x0252, 0x0262, 0x0272, 0x0282, 0x0292, 0x02a2, 0x02b2, 0x02c2, 0x1103, 0x0213, 0x0223, 0x0233, 0x0243, 0x0253, 0x0263, 0x0273, 0x0283, 0x0293, 0x02a3, 0x02b3, 0x02c3, 0x1104, 0x0214, 0x0224, 0x0234, 0x0244, 0x0254, 0x0264, 0x0274, 0x0284, 0x0294, 0x02a4, 0x02b4, 0x02c4, 0x1105, 0x0215, 0x0225, 0x0235, 0x0245, 0x0255, 0x0265, 0x0275, 0x0285, 0x0295, 0x02a5, 0x02b5, 0x02c5, 0x1106, 0x0216, 0x0226, 0x0236, 0x0246, 0x0256, 0x0266, 0x0276, 0x0286, 0x0296, 0x02a6, 0x02b6, 0x02c6, 0x1107, 0x0217, 0x0227, 0x0237, 0x0247, 0x0257, 0x0267, 0x0277, 0x0287, 0x0297, 0x02a7, 0x02b7, 0x02c7, 0x1108, 0x0218, 0x0228, 0x0238, 0x0248, 0x0258, 0x0268, 0x0278, 0x0288, 0x0298, 0x02a8, 0x02b8, 0x02c8, 0x1109, 0x0219, 0x0229, 0x0239, 0x0249, 0x0259, 0x0269, 0x0279, 0x0289, 0x0299, 0x02a9, 0x02b9, 0x02c9, 0x110a, 0x021a, 0x022a, 0x023a, 0x024a, 0x025a, 0x026a, 0x027a, 0x028a, 0x029a, 0x02aa, 0x02ba, 0x02ca, 0x110b, 0x021b, 0x022b, 0x023b, 0x024b, 0x025b, 0x026b, 0x027b, 0x028b, 0x029b, 0x02ab, 0x02bb, 0x02cb, 0x110c, 0x021c, 0x022c, 0x023c, 0x024c, 0x025c, 0x026c, 0x027c, 0x028c, 0x029c, 0x02ac, 0x02bc, 0x02cc, }; static const float codebook_vector10_vals[] = { 0.0000000, 1.0000000, 2.5198421, 4.3267487, 6.3496042, 8.5498797, 10.9027236, 13.3905183, 16.0000000, 18.7207544, 21.5443469, 24.4637810, 27.4731418, 30.5673509, 33.7419917, 36.9931811, }; /* * bits 0:3, 4:7 index into _vals array * 8:9 bit mask of escape-coded entries * 12:15 number of non-zero values */ static const uint16_t codebook_vector10_idx[] = { 0x0000, 0x1010, 0x1020, 0x1030, 0x1040, 0x1050, 0x1060, 0x1070, 0x1080, 0x1090, 0x10a0, 0x10b0, 0x10c0, 0x10d0, 0x10e0, 0x10f0, 0x1200, 0x1001, 0x2011, 0x2021, 0x2031, 0x2041, 0x2051, 0x2061, 0x2071, 0x2081, 0x2091, 0x20a1, 0x20b1, 0x20c1, 0x20d1, 0x20e1, 0x20f1, 0x2201, 0x1002, 0x2012, 0x2022, 0x2032, 0x2042, 0x2052, 0x2062, 0x2072, 0x2082, 0x2092, 0x20a2, 0x20b2, 0x20c2, 0x20d2, 0x20e2, 0x20f2, 0x2202, 0x1003, 0x2013, 0x2023, 0x2033, 0x2043, 0x2053, 0x2063, 0x2073, 0x2083, 0x2093, 0x20a3, 0x20b3, 0x20c3, 0x20d3, 0x20e3, 0x20f3, 0x2203, 0x1004, 0x2014, 0x2024, 0x2034, 0x2044, 0x2054, 0x2064, 0x2074, 0x2084, 0x2094, 0x20a4, 0x20b4, 0x20c4, 0x20d4, 0x20e4, 0x20f4, 0x2204, 0x1005, 0x2015, 0x2025, 0x2035, 0x2045, 0x2055, 0x2065, 0x2075, 0x2085, 0x2095, 0x20a5, 0x20b5, 0x20c5, 0x20d5, 0x20e5, 0x20f5, 0x2205, 0x1006, 0x2016, 0x2026, 0x2036, 0x2046, 0x2056, 0x2066, 0x2076, 0x2086, 0x2096, 0x20a6, 0x20b6, 0x20c6, 0x20d6, 0x20e6, 0x20f6, 0x2206, 0x1007, 0x2017, 0x2027, 0x2037, 0x2047, 0x2057, 0x2067, 0x2077, 0x2087, 0x2097, 0x20a7, 0x20b7, 0x20c7, 0x20d7, 0x20e7, 0x20f7, 0x2207, 0x1008, 0x2018, 0x2028, 0x2038, 0x2048, 0x2058, 0x2068, 0x2078, 0x2088, 0x2098, 0x20a8, 0x20b8, 0x20c8, 0x20d8, 0x20e8, 0x20f8, 0x2208, 0x1009, 0x2019, 0x2029, 0x2039, 0x2049, 0x2059, 0x2069, 0x2079, 0x2089, 0x2099, 0x20a9, 0x20b9, 0x20c9, 0x20d9, 0x20e9, 0x20f9, 0x2209, 0x100a, 0x201a, 0x202a, 0x203a, 0x204a, 0x205a, 0x206a, 0x207a, 0x208a, 0x209a, 0x20aa, 0x20ba, 0x20ca, 0x20da, 0x20ea, 0x20fa, 0x220a, 0x100b, 0x201b, 0x202b, 0x203b, 0x204b, 0x205b, 0x206b, 0x207b, 0x208b, 0x209b, 0x20ab, 0x20bb, 0x20cb, 0x20db, 0x20eb, 0x20fb, 0x220b, 0x100c, 0x201c, 0x202c, 0x203c, 0x204c, 0x205c, 0x206c, 0x207c, 0x208c, 0x209c, 0x20ac, 0x20bc, 0x20cc, 0x20dc, 0x20ec, 0x20fc, 0x220c, 0x100d, 0x201d, 0x202d, 0x203d, 0x204d, 0x205d, 0x206d, 0x207d, 0x208d, 0x209d, 0x20ad, 0x20bd, 0x20cd, 0x20dd, 0x20ed, 0x20fd, 0x220d, 0x100e, 0x201e, 0x202e, 0x203e, 0x204e, 0x205e, 0x206e, 0x207e, 0x208e, 0x209e, 0x20ae, 0x20be, 0x20ce, 0x20de, 0x20ee, 0x20fe, 0x220e, 0x100f, 0x201f, 0x202f, 0x203f, 0x204f, 0x205f, 0x206f, 0x207f, 0x208f, 0x209f, 0x20af, 0x20bf, 0x20cf, 0x20df, 0x20ef, 0x20ff, 0x220f, 0x1100, 0x2110, 0x2120, 0x2130, 0x2140, 0x2150, 0x2160, 0x2170, 0x2180, 0x2190, 0x21a0, 0x21b0, 0x21c0, 0x21d0, 0x21e0, 0x21f0, 0x2300, }; const float *const ff_aac_codebook_vector_vals[] = { codebook_vector0_vals, codebook_vector0_vals, codebook_vector10_vals, codebook_vector10_vals, codebook_vector4_vals, codebook_vector4_vals, codebook_vector10_vals, codebook_vector10_vals, codebook_vector10_vals, codebook_vector10_vals, codebook_vector10_vals, }; const uint16_t *const ff_aac_codebook_vector_idx[] = { codebook_vector02_idx, codebook_vector02_idx, codebook_vector02_idx, codebook_vector02_idx, codebook_vector4_idx, codebook_vector4_idx, codebook_vector6_idx, codebook_vector6_idx, codebook_vector8_idx, codebook_vector8_idx, codebook_vector10_idx, }; /* @name swb_offsets * Sample offset into the window indicating the beginning of a scalefactor * window band * * scalefactor window band - term for scalefactor bands within a window, * given in Table 4.110 to Table 4.128. * * scalefactor band - a set of spectral coefficients which are scaled by one * scalefactor. In case of EIGHT_SHORT_SEQUENCE and grouping a scalefactor band * may contain several scalefactor window bands of corresponding frequency. For * all other window_sequences scalefactor bands and scalefactor window bands are * identical. * @{ */ static const uint16_t swb_offset_1024_96[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72, 80, 88, 96, 108, 120, 132, 144, 156, 172, 188, 212, 240, 276, 320, 384, 448, 512, 576, 640, 704, 768, 832, 896, 960, 1024 }; static const uint16_t swb_offset_128_96[] = { 0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128 }; static const uint16_t swb_offset_1024_64[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 64, 72, 80, 88, 100, 112, 124, 140, 156, 172, 192, 216, 240, 268, 304, 344, 384, 424, 464, 504, 544, 584, 624, 664, 704, 744, 784, 824, 864, 904, 944, 984, 1024 }; static const uint16_t swb_offset_1024_48[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 80, 88, 96, 108, 120, 132, 144, 160, 176, 196, 216, 240, 264, 292, 320, 352, 384, 416, 448, 480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800, 832, 864, 896, 928, 1024 }; static const uint16_t swb_offset_128_48[] = { 0, 4, 8, 12, 16, 20, 28, 36, 44, 56, 68, 80, 96, 112, 128 }; static const uint16_t swb_offset_1024_32[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 80, 88, 96, 108, 120, 132, 144, 160, 176, 196, 216, 240, 264, 292, 320, 352, 384, 416, 448, 480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800, 832, 864, 896, 928, 960, 992, 1024 }; static const uint16_t swb_offset_1024_24[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 52, 60, 68, 76, 84, 92, 100, 108, 116, 124, 136, 148, 160, 172, 188, 204, 220, 240, 260, 284, 308, 336, 364, 396, 432, 468, 508, 552, 600, 652, 704, 768, 832, 896, 960, 1024 }; static const uint16_t swb_offset_128_24[] = { 0, 4, 8, 12, 16, 20, 24, 28, 36, 44, 52, 64, 76, 92, 108, 128 }; static const uint16_t swb_offset_1024_16[] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 100, 112, 124, 136, 148, 160, 172, 184, 196, 212, 228, 244, 260, 280, 300, 320, 344, 368, 396, 424, 456, 492, 532, 572, 616, 664, 716, 772, 832, 896, 960, 1024 }; static const uint16_t swb_offset_128_16[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 40, 48, 60, 72, 88, 108, 128 }; static const uint16_t swb_offset_1024_8[] = { 0, 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144, 156, 172, 188, 204, 220, 236, 252, 268, 288, 308, 328, 348, 372, 396, 420, 448, 476, 508, 544, 580, 620, 664, 712, 764, 820, 880, 944, 1024 }; static const uint16_t swb_offset_128_8[] = { 0, 4, 8, 12, 16, 20, 24, 28, 36, 44, 52, 60, 72, 88, 108, 128 }; const uint16_t * const ff_swb_offset_1024[] = { swb_offset_1024_96, swb_offset_1024_96, swb_offset_1024_64, swb_offset_1024_48, swb_offset_1024_48, swb_offset_1024_32, swb_offset_1024_24, swb_offset_1024_24, swb_offset_1024_16, swb_offset_1024_16, swb_offset_1024_16, swb_offset_1024_8, swb_offset_1024_8 }; const uint16_t * const ff_swb_offset_128[] = { /* The last entry on the following row is swb_offset_128_64 but is a duplicate of swb_offset_128_96. */ swb_offset_128_96, swb_offset_128_96, swb_offset_128_96, swb_offset_128_48, swb_offset_128_48, swb_offset_128_48, swb_offset_128_24, swb_offset_128_24, swb_offset_128_16, swb_offset_128_16, swb_offset_128_16, swb_offset_128_8, swb_offset_128_8 }; // @} /* @name ff_tns_max_bands * The maximum number of scalefactor bands on which TNS can operate for the long * and short transforms respectively. The index to these tables is related to * the sample rate of the audio. * @{ */ const uint8_t ff_tns_max_bands_1024[] = { 31, 31, 34, 40, 42, 51, 46, 46, 42, 42, 42, 39, 39 }; const uint8_t ff_tns_max_bands_128[] = { 9, 9, 10, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 }; // @}
123linslouis-android-video-cutter
jni/libavcodec/aactab.c
C
asf20
55,555
/* * Chinese AVS video (AVS1-P2, JiZhun profile) parser. * Copyright (c) 2006 Stefan Gehrer <stefan.gehrer@gmx.de> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * Chinese AVS video (AVS1-P2, JiZhun profile) parser * @author Stefan Gehrer <stefan.gehrer@gmx.de> */ #include "parser.h" #include "cavs.h" /** * finds the end of the current frame in the bitstream. * @return the position of the first byte of the next frame, or -1 */ static int cavs_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size) { int pic_found, i; uint32_t state; pic_found= pc->frame_start_found; state= pc->state; i=0; if(!pic_found){ for(i=0; i<buf_size; i++){ state= (state<<8) | buf[i]; if(state == PIC_I_START_CODE || state == PIC_PB_START_CODE){ i++; pic_found=1; break; } } } if(pic_found){ /* EOF considered as end of frame */ if (buf_size == 0) return 0; for(; i<buf_size; i++){ state= (state<<8) | buf[i]; if((state&0xFFFFFF00) == 0x100){ if(state > SLICE_MAX_START_CODE){ pc->frame_start_found=0; pc->state=-1; return i-3; } } } } pc->frame_start_found= pic_found; pc->state= state; return END_NOT_FOUND; } static int cavsvideo_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size) { ParseContext *pc = s->priv_data; int next; if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){ next= buf_size; }else{ next= cavs_find_frame_end(pc, buf, buf_size); if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { *poutbuf = NULL; *poutbuf_size = 0; return buf_size; } } *poutbuf = buf; *poutbuf_size = buf_size; return next; } AVCodecParser cavsvideo_parser = { { CODEC_ID_CAVS }, sizeof(ParseContext1), NULL, cavsvideo_parse, ff_parse1_close, ff_mpeg4video_split, };
123linslouis-android-video-cutter
jni/libavcodec/cavs_parser.c
C
asf20
3,031
/* * audio conversion * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> * Copyright (c) 2008 Peter Ross * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVCODEC_AUDIOCONVERT_H #define AVCODEC_AUDIOCONVERT_H /** * @file * Audio format conversion routines */ #include "avcodec.h" /** * Generate string corresponding to the sample format with * number sample_fmt, or a header if sample_fmt is negative. * * @param[in] buf the buffer where to write the string * @param[in] buf_size the size of buf * @param[in] sample_fmt the number of the sample format to print the corresponding info string, or * a negative value to print the corresponding header. * Meaningful values for obtaining a sample format info vary from 0 to SAMPLE_FMT_NB -1. */ void avcodec_sample_fmt_string(char *buf, int buf_size, int sample_fmt); /** * @return NULL on error */ const char *avcodec_get_sample_fmt_name(int sample_fmt); /** * @return SAMPLE_FMT_NONE on error */ enum SampleFormat avcodec_get_sample_fmt(const char* name); /** * @return NULL on error */ const char *avcodec_get_channel_name(int channel_id); /** * Return description of channel layout */ void avcodec_get_channel_layout_string(char *buf, int buf_size, int nb_channels, int64_t channel_layout); /** * Guess the channel layout * @param nb_channels * @param codec_id Codec identifier, or CODEC_ID_NONE if unknown * @param fmt_name Format name, or NULL if unknown * @return Channel layout mask */ int64_t avcodec_guess_channel_layout(int nb_channels, enum CodecID codec_id, const char *fmt_name); /** * @return the number of channels in the channel layout. */ int avcodec_channel_layout_num_channels(int64_t channel_layout); struct AVAudioConvert; typedef struct AVAudioConvert AVAudioConvert; /** * Create an audio sample format converter context * @param out_fmt Output sample format * @param out_channels Number of output channels * @param in_fmt Input sample format * @param in_channels Number of input channels * @param[in] matrix Channel mixing matrix (of dimension in_channel*out_channels). Set to NULL to ignore. * @param flags See FF_MM_xx * @return NULL on error */ AVAudioConvert *av_audio_convert_alloc(enum SampleFormat out_fmt, int out_channels, enum SampleFormat in_fmt, int in_channels, const float *matrix, int flags); /** * Free audio sample format converter context */ void av_audio_convert_free(AVAudioConvert *ctx); /** * Convert between audio sample formats * @param[in] out array of output buffers for each channel. set to NULL to ignore processing of the given channel. * @param[in] out_stride distance between consecutive output samples (measured in bytes) * @param[in] in array of input buffers for each channel * @param[in] in_stride distance between consecutive input samples (measured in bytes) * @param len length of audio frame size (measured in samples) */ int av_audio_convert(AVAudioConvert *ctx, void * const out[6], const int out_stride[6], const void * const in[6], const int in_stride[6], int len); #endif /* AVCODEC_AUDIOCONVERT_H */
123linslouis-android-video-cutter
jni/libavcodec/audioconvert.h
C
asf20
3,939
/* * H.263 parser * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * H.263 parser */ #include "parser.h" #include "h263_parser.h" int ff_h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){ int vop_found, i; uint32_t state; vop_found= pc->frame_start_found; state= pc->state; i=0; if(!vop_found){ for(i=0; i<buf_size; i++){ state= (state<<8) | buf[i]; if(state>>(32-22) == 0x20){ i++; vop_found=1; break; } } } if(vop_found){ for(; i<buf_size; i++){ state= (state<<8) | buf[i]; if(state>>(32-22) == 0x20){ pc->frame_start_found=0; pc->state=-1; return i-3; } } } pc->frame_start_found= vop_found; pc->state= state; return END_NOT_FOUND; } static int h263_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size) { ParseContext *pc = s->priv_data; int next; next= ff_h263_find_frame_end(pc, buf, buf_size); if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { *poutbuf = NULL; *poutbuf_size = 0; return buf_size; } *poutbuf = buf; *poutbuf_size = buf_size; return next; } AVCodecParser h263_parser = { { CODEC_ID_H263 }, sizeof(ParseContext), NULL, h263_parse, ff_parse_close, };
123linslouis-android-video-cutter
jni/libavcodec/h263_parser.c
C
asf20
2,361
/* * mpeg audio layer 2 tables. Most of them come from the mpeg audio * specification. * * Copyright (c) 2000, 2001 Fabrice Bellard * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * mpeg audio layer 2 tables. * Most of them come from the mpeg audio specification. */ #ifndef AVCODEC_MPEGAUDIOTAB_H #define AVCODEC_MPEGAUDIOTAB_H #include <stdint.h> #include "mpegaudio.h" #define SQRT2 1.41421356237309514547 static const int costab32[30] = { FIX(0.54119610014619701222), FIX(1.3065629648763763537), FIX(0.50979557910415917998), FIX(2.5629154477415054814), FIX(0.89997622313641556513), FIX(0.60134488693504528634), FIX(0.5024192861881556782), FIX(5.1011486186891552563), FIX(0.78815462345125020249), FIX(0.64682178335999007679), FIX(0.56694403481635768927), FIX(1.0606776859903470633), FIX(1.7224470982383341955), FIX(0.52249861493968885462), FIX(10.19000812354803287), FIX(0.674808341455005678), FIX(1.1694399334328846596), FIX(0.53104259108978413284), FIX(2.0577810099534108446), FIX(0.58293496820613388554), FIX(0.83934964541552681272), FIX(0.50547095989754364798), FIX(3.4076084184687189804), FIX(0.62250412303566482475), FIX(0.97256823786196078263), FIX(0.51544730992262455249), FIX(1.4841646163141661852), FIX(0.5531038960344445421), FIX(0.74453627100229857749), FIX(0.5006029982351962726), }; static const int bitinv32[32] = { 0, 16, 8, 24, 4, 20, 12, 28, 2, 18, 10, 26, 6, 22, 14, 30, 1, 17, 9, 25, 5, 21, 13, 29, 3, 19, 11, 27, 7, 23, 15, 31 }; static int16_t filter_bank[512]; static int scale_factor_table[64]; #ifdef USE_FLOATS static float scale_factor_inv_table[64]; #else static int8_t scale_factor_shift[64]; static unsigned short scale_factor_mult[64]; #endif static unsigned char scale_diff_table[128]; /* total number of bits per allocation group */ static unsigned short total_quant_bits[17]; /* signal to noise ratio of each quantification step (could be computed from quant_steps[]). The values are dB multiplied by 10 */ static const unsigned short quant_snr[17] = { 70, 110, 160, 208, 253, 316, 378, 439, 499, 559, 620, 680, 740, 800, 861, 920, 980 }; /* fixed psycho acoustic model. Values of SNR taken from the 'toolame' project */ static const float fixed_smr[SBLIMIT] = { 30, 17, 16, 10, 3, 12, 8, 2.5, 5, 5, 6, 6, 5, 6, 10, 6, -4, -10, -21, -30, -42, -55, -68, -75, -75, -75, -75, -75, -91, -107, -110, -108 }; static const unsigned char nb_scale_factors[4] = { 3, 2, 1, 2 }; #endif /* AVCODEC_MPEGAUDIOTAB_H */
123linslouis-android-video-cutter
jni/libavcodec/mpegaudiotab.h
C
asf20
3,395
/* * Dirac encoding support via libdirac library * Copyright (c) 2005 BBC, Andrew Kennedy <dirac at rd dot bbc dot co dot uk> * Copyright (c) 2006-2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com > * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * Dirac encoding support via libdirac library; more details about the * Dirac project can be found at http://dirac.sourceforge.net/. * The libdirac_encoder library implements Dirac specification version 2.2 * (http://dirac.sourceforge.net/specification.html). */ #include "libdirac_libschro.h" #include "libdirac.h" #undef NDEBUG #include <assert.h> #include <libdirac_encoder/dirac_encoder.h> /** Dirac encoder private data */ typedef struct FfmpegDiracEncoderParams { /** Dirac encoder context */ dirac_encoder_context_t enc_ctx; /** frame being encoded */ AVFrame picture; /** frame size */ int frame_size; /** Dirac encoder handle */ dirac_encoder_t* p_encoder; /** input frame buffer */ unsigned char *p_in_frame_buf; /** buffer to store encoder output before writing it to the frame queue */ unsigned char *enc_buf; /** size of encoder buffer */ int enc_buf_size; /** queue storing encoded frames */ FfmpegDiracSchroQueue enc_frame_queue; /** end of sequence signalled by user, 0 - false, 1 - true */ int eos_signalled; /** end of sequence returned by encoder, 0 - false, 1 - true */ int eos_pulled; } FfmpegDiracEncoderParams; /** * Works out Dirac-compatible chroma format. */ static dirac_chroma_t GetDiracChromaFormat(enum PixelFormat ff_pix_fmt) { int num_formats = sizeof(ffmpeg_dirac_pixel_format_map) / sizeof(ffmpeg_dirac_pixel_format_map[0]); int idx; for (idx = 0; idx < num_formats; ++idx) if (ffmpeg_dirac_pixel_format_map[idx].ff_pix_fmt == ff_pix_fmt) return ffmpeg_dirac_pixel_format_map[idx].dirac_pix_fmt; return formatNK; } /** * Dirac video preset table. Ensure that this tables matches up correctly * with the ff_dirac_schro_video_format_info table in libdirac_libschro.c. */ static const VideoFormat ff_dirac_video_formats[]={ VIDEO_FORMAT_CUSTOM , VIDEO_FORMAT_QSIF525 , VIDEO_FORMAT_QCIF , VIDEO_FORMAT_SIF525 , VIDEO_FORMAT_CIF , VIDEO_FORMAT_4SIF525 , VIDEO_FORMAT_4CIF , VIDEO_FORMAT_SD_480I60 , VIDEO_FORMAT_SD_576I50 , VIDEO_FORMAT_HD_720P60 , VIDEO_FORMAT_HD_720P50 , VIDEO_FORMAT_HD_1080I60 , VIDEO_FORMAT_HD_1080I50 , VIDEO_FORMAT_HD_1080P60 , VIDEO_FORMAT_HD_1080P50 , VIDEO_FORMAT_DIGI_CINEMA_2K24 , VIDEO_FORMAT_DIGI_CINEMA_4K24 , }; /** * Returns the video format preset matching the input video dimensions and * time base. */ static VideoFormat GetDiracVideoFormatPreset(AVCodecContext *avccontext) { unsigned int num_formats = sizeof(ff_dirac_video_formats) / sizeof(ff_dirac_video_formats[0]); unsigned int idx = ff_dirac_schro_get_video_format_idx(avccontext); return (idx < num_formats) ? ff_dirac_video_formats[idx] : VIDEO_FORMAT_CUSTOM; } static av_cold int libdirac_encode_init(AVCodecContext *avccontext) { FfmpegDiracEncoderParams* p_dirac_params = avccontext->priv_data; int no_local = 1; int verbose = avccontext->debug; VideoFormat preset; /* get Dirac preset */ preset = GetDiracVideoFormatPreset(avccontext); /* initialize the encoder context */ dirac_encoder_context_init(&(p_dirac_params->enc_ctx), preset); p_dirac_params->enc_ctx.src_params.chroma = GetDiracChromaFormat(avccontext->pix_fmt); if (p_dirac_params->enc_ctx.src_params.chroma == formatNK) { av_log(avccontext, AV_LOG_ERROR, "Unsupported pixel format %d. This codec supports only " "Planar YUV formats (yuv420p, yuv422p, yuv444p\n", avccontext->pix_fmt); return -1; } p_dirac_params->enc_ctx.src_params.frame_rate.numerator = avccontext->time_base.den; p_dirac_params->enc_ctx.src_params.frame_rate.denominator = avccontext->time_base.num; p_dirac_params->enc_ctx.src_params.width = avccontext->width; p_dirac_params->enc_ctx.src_params.height = avccontext->height; p_dirac_params->frame_size = avpicture_get_size(avccontext->pix_fmt, avccontext->width, avccontext->height); avccontext->coded_frame = &p_dirac_params->picture; if (no_local) { p_dirac_params->enc_ctx.decode_flag = 0; p_dirac_params->enc_ctx.instr_flag = 0; } else { p_dirac_params->enc_ctx.decode_flag = 1; p_dirac_params->enc_ctx.instr_flag = 1; } /* Intra-only sequence */ if (!avccontext->gop_size) { p_dirac_params->enc_ctx.enc_params.num_L1 = 0; if (avccontext->coder_type == FF_CODER_TYPE_VLC) p_dirac_params->enc_ctx.enc_params.using_ac = 0; } else avccontext->has_b_frames = 1; if (avccontext->flags & CODEC_FLAG_QSCALE) { if (avccontext->global_quality) { p_dirac_params->enc_ctx.enc_params.qf = avccontext->global_quality / (FF_QP2LAMBDA * 10.0); /* if it is not default bitrate then send target rate. */ if (avccontext->bit_rate >= 1000 && avccontext->bit_rate != 200000) p_dirac_params->enc_ctx.enc_params.trate = avccontext->bit_rate / 1000; } else p_dirac_params->enc_ctx.enc_params.lossless = 1; } else if (avccontext->bit_rate >= 1000) p_dirac_params->enc_ctx.enc_params.trate = avccontext->bit_rate / 1000; if ((preset > VIDEO_FORMAT_QCIF || preset < VIDEO_FORMAT_QSIF525) && avccontext->bit_rate == 200000) p_dirac_params->enc_ctx.enc_params.trate = 0; if (avccontext->flags & CODEC_FLAG_INTERLACED_ME) /* all material can be coded as interlaced or progressive * irrespective of the type of source material */ p_dirac_params->enc_ctx.enc_params.picture_coding_mode = 1; p_dirac_params->p_encoder = dirac_encoder_init(&(p_dirac_params->enc_ctx), verbose); if (!p_dirac_params->p_encoder) { av_log(avccontext, AV_LOG_ERROR, "Unrecoverable Error: dirac_encoder_init failed. "); return EXIT_FAILURE; } /* allocate enough memory for the incoming data */ p_dirac_params->p_in_frame_buf = av_malloc(p_dirac_params->frame_size); /* initialize the encoded frame queue */ ff_dirac_schro_queue_init(&p_dirac_params->enc_frame_queue); return 0; } static void DiracFreeFrame(void *data) { FfmpegDiracSchroEncodedFrame *enc_frame = data; av_freep(&(enc_frame->p_encbuf)); av_free(enc_frame); } static int libdirac_encode_frame(AVCodecContext *avccontext, unsigned char *frame, int buf_size, void *data) { int enc_size = 0; dirac_encoder_state_t state; FfmpegDiracEncoderParams* p_dirac_params = avccontext->priv_data; FfmpegDiracSchroEncodedFrame* p_frame_output = NULL; FfmpegDiracSchroEncodedFrame* p_next_output_frame = NULL; int go = 1; int last_frame_in_sequence = 0; if (!data) { /* push end of sequence if not already signalled */ if (!p_dirac_params->eos_signalled) { dirac_encoder_end_sequence(p_dirac_params->p_encoder); p_dirac_params->eos_signalled = 1; } } else { /* Allocate frame data to Dirac input buffer. * Input line size may differ from what the codec supports, * especially when transcoding from one format to another. * So use avpicture_layout to copy the frame. */ avpicture_layout((AVPicture *)data, avccontext->pix_fmt, avccontext->width, avccontext->height, p_dirac_params->p_in_frame_buf, p_dirac_params->frame_size); /* load next frame */ if (dirac_encoder_load(p_dirac_params->p_encoder, p_dirac_params->p_in_frame_buf, p_dirac_params->frame_size) < 0) { av_log(avccontext, AV_LOG_ERROR, "Unrecoverable Encoder Error." " dirac_encoder_load failed...\n"); return -1; } } if (p_dirac_params->eos_pulled) go = 0; while (go) { p_dirac_params->p_encoder->enc_buf.buffer = frame; p_dirac_params->p_encoder->enc_buf.size = buf_size; /* process frame */ state = dirac_encoder_output(p_dirac_params->p_encoder); switch (state) { case ENC_STATE_AVAIL: case ENC_STATE_EOS: assert(p_dirac_params->p_encoder->enc_buf.size > 0); /* All non-frame data is prepended to actual frame data to * be able to set the pts correctly. So we don't write data * to the frame output queue until we actually have a frame */ p_dirac_params->enc_buf = av_realloc(p_dirac_params->enc_buf, p_dirac_params->enc_buf_size + p_dirac_params->p_encoder->enc_buf.size); memcpy(p_dirac_params->enc_buf + p_dirac_params->enc_buf_size, p_dirac_params->p_encoder->enc_buf.buffer, p_dirac_params->p_encoder->enc_buf.size); p_dirac_params->enc_buf_size += p_dirac_params->p_encoder->enc_buf.size; if (state == ENC_STATE_EOS) { p_dirac_params->eos_pulled = 1; go = 0; } /* If non-frame data, don't output it until it we get an * encoded frame back from the encoder. */ if (p_dirac_params->p_encoder->enc_pparams.pnum == -1) break; /* create output frame */ p_frame_output = av_mallocz(sizeof(FfmpegDiracSchroEncodedFrame)); /* set output data */ p_frame_output->size = p_dirac_params->enc_buf_size; p_frame_output->p_encbuf = p_dirac_params->enc_buf; p_frame_output->frame_num = p_dirac_params->p_encoder->enc_pparams.pnum; if (p_dirac_params->p_encoder->enc_pparams.ptype == INTRA_PICTURE && p_dirac_params->p_encoder->enc_pparams.rtype == REFERENCE_PICTURE) p_frame_output->key_frame = 1; ff_dirac_schro_queue_push_back(&p_dirac_params->enc_frame_queue, p_frame_output); p_dirac_params->enc_buf_size = 0; p_dirac_params->enc_buf = NULL; break; case ENC_STATE_BUFFER: go = 0; break; case ENC_STATE_INVALID: av_log(avccontext, AV_LOG_ERROR, "Unrecoverable Dirac Encoder Error. Quitting...\n"); return -1; default: av_log(avccontext, AV_LOG_ERROR, "Unknown Dirac Encoder state\n"); return -1; } } /* copy 'next' frame in queue */ if (p_dirac_params->enc_frame_queue.size == 1 && p_dirac_params->eos_pulled) last_frame_in_sequence = 1; p_next_output_frame = ff_dirac_schro_queue_pop(&p_dirac_params->enc_frame_queue); if (!p_next_output_frame) return 0; memcpy(frame, p_next_output_frame->p_encbuf, p_next_output_frame->size); avccontext->coded_frame->key_frame = p_next_output_frame->key_frame; /* Use the frame number of the encoded frame as the pts. It is OK to do * so since Dirac is a constant framerate codec. It expects input to be * of constant framerate. */ avccontext->coded_frame->pts = p_next_output_frame->frame_num; enc_size = p_next_output_frame->size; /* Append the end of sequence information to the last frame in the * sequence. */ if (last_frame_in_sequence && p_dirac_params->enc_buf_size > 0) { memcpy(frame + enc_size, p_dirac_params->enc_buf, p_dirac_params->enc_buf_size); enc_size += p_dirac_params->enc_buf_size; av_freep(&p_dirac_params->enc_buf); p_dirac_params->enc_buf_size = 0; } /* free frame */ DiracFreeFrame(p_next_output_frame); return enc_size; } static av_cold int libdirac_encode_close(AVCodecContext *avccontext) { FfmpegDiracEncoderParams* p_dirac_params = avccontext->priv_data; /* close the encoder */ dirac_encoder_close(p_dirac_params->p_encoder); /* free data in the output frame queue */ ff_dirac_schro_queue_free(&p_dirac_params->enc_frame_queue, DiracFreeFrame); /* free the encoder buffer */ if (p_dirac_params->enc_buf_size) av_freep(&p_dirac_params->enc_buf); /* free the input frame buffer */ av_freep(&p_dirac_params->p_in_frame_buf); return 0; } AVCodec libdirac_encoder = { "libdirac", AVMEDIA_TYPE_VIDEO, CODEC_ID_DIRAC, sizeof(FfmpegDiracEncoderParams), libdirac_encode_init, libdirac_encode_frame, libdirac_encode_close, .capabilities = CODEC_CAP_DELAY, .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("libdirac Dirac 2.2"), };
123linslouis-android-video-cutter
jni/libavcodec/libdiracenc.c
C
asf20
14,464
/* * H.26L/H.264/AVC/JVT/14496-10/... sei decoding * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * H.264 / AVC / MPEG4 part10 sei decoding. * @author Michael Niedermayer <michaelni@gmx.at> */ #include "internal.h" #include "avcodec.h" #include "h264.h" #include "golomb.h" //#undef NDEBUG #include <assert.h> static const uint8_t sei_num_clock_ts_table[9]={ 1, 1, 1, 2, 2, 3, 3, 2, 3 }; void ff_h264_reset_sei(H264Context *h) { h->sei_recovery_frame_cnt = -1; h->sei_dpb_output_delay = 0; h->sei_cpb_removal_delay = -1; h->sei_buffering_period_present = 0; } static int decode_picture_timing(H264Context *h){ MpegEncContext * const s = &h->s; if(h->sps.nal_hrd_parameters_present_flag || h->sps.vcl_hrd_parameters_present_flag){ h->sei_cpb_removal_delay = get_bits(&s->gb, h->sps.cpb_removal_delay_length); h->sei_dpb_output_delay = get_bits(&s->gb, h->sps.dpb_output_delay_length); } if(h->sps.pic_struct_present_flag){ unsigned int i, num_clock_ts; h->sei_pic_struct = get_bits(&s->gb, 4); h->sei_ct_type = 0; if (h->sei_pic_struct > SEI_PIC_STRUCT_FRAME_TRIPLING) return -1; num_clock_ts = sei_num_clock_ts_table[h->sei_pic_struct]; for (i = 0 ; i < num_clock_ts ; i++){ if(get_bits(&s->gb, 1)){ /* clock_timestamp_flag */ unsigned int full_timestamp_flag; h->sei_ct_type |= 1<<get_bits(&s->gb, 2); skip_bits(&s->gb, 1); /* nuit_field_based_flag */ skip_bits(&s->gb, 5); /* counting_type */ full_timestamp_flag = get_bits(&s->gb, 1); skip_bits(&s->gb, 1); /* discontinuity_flag */ skip_bits(&s->gb, 1); /* cnt_dropped_flag */ skip_bits(&s->gb, 8); /* n_frames */ if(full_timestamp_flag){ skip_bits(&s->gb, 6); /* seconds_value 0..59 */ skip_bits(&s->gb, 6); /* minutes_value 0..59 */ skip_bits(&s->gb, 5); /* hours_value 0..23 */ }else{ if(get_bits(&s->gb, 1)){ /* seconds_flag */ skip_bits(&s->gb, 6); /* seconds_value range 0..59 */ if(get_bits(&s->gb, 1)){ /* minutes_flag */ skip_bits(&s->gb, 6); /* minutes_value 0..59 */ if(get_bits(&s->gb, 1)) /* hours_flag */ skip_bits(&s->gb, 5); /* hours_value 0..23 */ } } } if(h->sps.time_offset_length > 0) skip_bits(&s->gb, h->sps.time_offset_length); /* time_offset */ } } if(s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_DEBUG, "ct_type:%X pic_struct:%d\n", h->sei_ct_type, h->sei_pic_struct); } return 0; } static int decode_unregistered_user_data(H264Context *h, int size){ MpegEncContext * const s = &h->s; uint8_t user_data[16+256]; int e, build, i; if(size<16) return -1; for(i=0; i<sizeof(user_data)-1 && i<size; i++){ user_data[i]= get_bits(&s->gb, 8); } user_data[i]= 0; e= sscanf(user_data+16, "x264 - core %d"/*%s - H.264/MPEG-4 AVC codec - Copyleft 2005 - http://www.videolan.org/x264.html*/, &build); if(e==1 && build>0) h->x264_build= build; if(s->avctx->debug & FF_DEBUG_BUGS) av_log(s->avctx, AV_LOG_DEBUG, "user data:\"%s\"\n", user_data+16); for(; i<size; i++) skip_bits(&s->gb, 8); return 0; } static int decode_recovery_point(H264Context *h){ MpegEncContext * const s = &h->s; h->sei_recovery_frame_cnt = get_ue_golomb(&s->gb); skip_bits(&s->gb, 4); /* 1b exact_match_flag, 1b broken_link_flag, 2b changing_slice_group_idc */ return 0; } static int decode_buffering_period(H264Context *h){ MpegEncContext * const s = &h->s; unsigned int sps_id; int sched_sel_idx; SPS *sps; sps_id = get_ue_golomb_31(&s->gb); if(sps_id > 31 || !h->sps_buffers[sps_id]) { av_log(h->s.avctx, AV_LOG_ERROR, "non-existing SPS %d referenced in buffering period\n", sps_id); return -1; } sps = h->sps_buffers[sps_id]; // NOTE: This is really so duplicated in the standard... See H.264, D.1.1 if (sps->nal_hrd_parameters_present_flag) { for (sched_sel_idx = 0; sched_sel_idx < sps->cpb_cnt; sched_sel_idx++) { h->initial_cpb_removal_delay[sched_sel_idx] = get_bits(&s->gb, sps->initial_cpb_removal_delay_length); skip_bits(&s->gb, sps->initial_cpb_removal_delay_length); // initial_cpb_removal_delay_offset } } if (sps->vcl_hrd_parameters_present_flag) { for (sched_sel_idx = 0; sched_sel_idx < sps->cpb_cnt; sched_sel_idx++) { h->initial_cpb_removal_delay[sched_sel_idx] = get_bits(&s->gb, sps->initial_cpb_removal_delay_length); skip_bits(&s->gb, sps->initial_cpb_removal_delay_length); // initial_cpb_removal_delay_offset } } h->sei_buffering_period_present = 1; return 0; } int ff_h264_decode_sei(H264Context *h){ MpegEncContext * const s = &h->s; while(get_bits_count(&s->gb) + 16 < s->gb.size_in_bits){ int size, type; type=0; do{ type+= show_bits(&s->gb, 8); }while(get_bits(&s->gb, 8) == 255); size=0; do{ size+= show_bits(&s->gb, 8); }while(get_bits(&s->gb, 8) == 255); switch(type){ case SEI_TYPE_PIC_TIMING: // Picture timing SEI if(decode_picture_timing(h) < 0) return -1; break; case SEI_TYPE_USER_DATA_UNREGISTERED: if(decode_unregistered_user_data(h, size) < 0) return -1; break; case SEI_TYPE_RECOVERY_POINT: if(decode_recovery_point(h) < 0) return -1; break; case SEI_BUFFERING_PERIOD: if(decode_buffering_period(h) < 0) return -1; break; default: skip_bits(&s->gb, 8*size); } //FIXME check bits here align_get_bits(&s->gb); } return 0; }
123linslouis-android-video-cutter
jni/libavcodec/h264_sei.c
C
asf20
7,291
/* * XVideo Motion Compensation * Copyright (c) 2003 Ivan Kalvachev * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include <limits.h> #include <X11/extensions/XvMC.h> #include "avcodec.h" #include "dsputil.h" #include "mpegvideo.h" #undef NDEBUG #include <assert.h> #include "xvmc.h" #include "xvmc_internal.h" /** * Initializes the block field of the MpegEncContext pointer passed as * parameter after making sure that the data is not corrupted. * In order to implement something like direct rendering instead of decoding * coefficients in s->blocks and then copying them, copy them directly * into the data_blocks array provided by xvmc. */ void ff_xvmc_init_block(MpegEncContext *s) { struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt*)s->current_picture.data[2]; assert(render && render->xvmc_id == AV_XVMC_ID); s->block = (DCTELEM (*)[64])(render->data_blocks + render->next_free_data_block_num * 64); } /** * Fills individual block pointers, so there are no gaps in the data_block array * in case not all blocks in the macroblock are coded. */ void ff_xvmc_pack_pblocks(MpegEncContext *s, int cbp) { int i, j = 0; const int mb_block_count = 4 + (1 << s->chroma_format); cbp <<= 12-mb_block_count; for (i = 0; i < mb_block_count; i++) { if (cbp & (1 << 11)) s->pblocks[i] = &s->block[j++]; else s->pblocks[i] = NULL; cbp += cbp; } } /** * Finds and stores the surfaces that are used as reference frames. * This function should be called for every new field and/or frame. * It should be safe to call the function a few times for the same field. */ int ff_xvmc_field_start(MpegEncContext *s, AVCodecContext *avctx) { struct xvmc_pix_fmt *last, *next, *render = (struct xvmc_pix_fmt*)s->current_picture.data[2]; const int mb_block_count = 4 + (1 << s->chroma_format); assert(avctx); if (!render || render->xvmc_id != AV_XVMC_ID || !render->data_blocks || !render->mv_blocks || (unsigned int)render->allocated_mv_blocks > INT_MAX/(64*6) || (unsigned int)render->allocated_data_blocks > INT_MAX/64 || !render->p_surface) { av_log(avctx, AV_LOG_ERROR, "Render token doesn't look as expected.\n"); return -1; // make sure that this is a render packet } if (render->filled_mv_blocks_num) { av_log(avctx, AV_LOG_ERROR, "Rendering surface contains %i unprocessed blocks.\n", render->filled_mv_blocks_num); return -1; } if (render->allocated_mv_blocks < 1 || render->allocated_data_blocks < render->allocated_mv_blocks*mb_block_count || render->start_mv_blocks_num >= render->allocated_mv_blocks || render->next_free_data_block_num > render->allocated_data_blocks - mb_block_count*(render->allocated_mv_blocks-render->start_mv_blocks_num)) { av_log(avctx, AV_LOG_ERROR, "Rendering surface doesn't provide enough block structures to work with.\n"); return -1; } render->picture_structure = s->picture_structure; render->flags = s->first_field ? 0 : XVMC_SECOND_FIELD; render->p_future_surface = NULL; render->p_past_surface = NULL; switch(s->pict_type) { case FF_I_TYPE: return 0; // no prediction from other frames case FF_B_TYPE: next = (struct xvmc_pix_fmt*)s->next_picture.data[2]; if (!next) return -1; if (next->xvmc_id != AV_XVMC_ID) return -1; render->p_future_surface = next->p_surface; // no return here, going to set forward prediction case FF_P_TYPE: last = (struct xvmc_pix_fmt*)s->last_picture.data[2]; if (!last) last = render; // predict second field from the first if (last->xvmc_id != AV_XVMC_ID) return -1; render->p_past_surface = last->p_surface; return 0; } return -1; } /** * Completes frame/field rendering by passing any remaining blocks. * Normally ff_draw_horiz_band() is called for each slice, however, * some leftover blocks, for example from error_resilience(), may remain. * It should be safe to call the function a few times for the same field. */ void ff_xvmc_field_end(MpegEncContext *s) { struct xvmc_pix_fmt *render = (struct xvmc_pix_fmt*)s->current_picture.data[2]; assert(render); if (render->filled_mv_blocks_num > 0) ff_draw_horiz_band(s, 0, 0); } /** * Synthesizes the data needed by XvMC to render one macroblock of data. * Fills all relevant fields, if necessary do IDCT. */ void ff_xvmc_decode_mb(MpegEncContext *s) { XvMCMacroBlock *mv_block; struct xvmc_pix_fmt *render; int i, cbp, blocks_per_mb; const int mb_xy = s->mb_y * s->mb_stride + s->mb_x; if (s->encoding) { av_log(s->avctx, AV_LOG_ERROR, "XVMC doesn't support encoding!!!\n"); return; } // from MPV_decode_mb(), update DC predictors for P macroblocks if (!s->mb_intra) { s->last_dc[0] = s->last_dc[1] = s->last_dc[2] = 128 << s->intra_dc_precision; } // MC doesn't skip blocks s->mb_skipped = 0; // Do I need to export quant when I could not perform postprocessing? // Anyway, it doesn't hurt. s->current_picture.qscale_table[mb_xy] = s->qscale; // start of XVMC-specific code render = (struct xvmc_pix_fmt*)s->current_picture.data[2]; assert(render); assert(render->xvmc_id == AV_XVMC_ID); assert(render->mv_blocks); // take the next free macroblock mv_block = &render->mv_blocks[render->start_mv_blocks_num + render->filled_mv_blocks_num]; mv_block->x = s->mb_x; mv_block->y = s->mb_y; mv_block->dct_type = s->interlaced_dct; // XVMC_DCT_TYPE_FRAME/FIELD; if (s->mb_intra) { mv_block->macroblock_type = XVMC_MB_TYPE_INTRA; // no MC, all done } else { mv_block->macroblock_type = XVMC_MB_TYPE_PATTERN; if (s->mv_dir & MV_DIR_FORWARD) { mv_block->macroblock_type |= XVMC_MB_TYPE_MOTION_FORWARD; // PMV[n][dir][xy] = mv[dir][n][xy] mv_block->PMV[0][0][0] = s->mv[0][0][0]; mv_block->PMV[0][0][1] = s->mv[0][0][1]; mv_block->PMV[1][0][0] = s->mv[0][1][0]; mv_block->PMV[1][0][1] = s->mv[0][1][1]; } if (s->mv_dir & MV_DIR_BACKWARD) { mv_block->macroblock_type |= XVMC_MB_TYPE_MOTION_BACKWARD; mv_block->PMV[0][1][0] = s->mv[1][0][0]; mv_block->PMV[0][1][1] = s->mv[1][0][1]; mv_block->PMV[1][1][0] = s->mv[1][1][0]; mv_block->PMV[1][1][1] = s->mv[1][1][1]; } switch(s->mv_type) { case MV_TYPE_16X16: mv_block->motion_type = XVMC_PREDICTION_FRAME; break; case MV_TYPE_16X8: mv_block->motion_type = XVMC_PREDICTION_16x8; break; case MV_TYPE_FIELD: mv_block->motion_type = XVMC_PREDICTION_FIELD; if (s->picture_structure == PICT_FRAME) { mv_block->PMV[0][0][1] <<= 1; mv_block->PMV[1][0][1] <<= 1; mv_block->PMV[0][1][1] <<= 1; mv_block->PMV[1][1][1] <<= 1; } break; case MV_TYPE_DMV: mv_block->motion_type = XVMC_PREDICTION_DUAL_PRIME; if (s->picture_structure == PICT_FRAME) { mv_block->PMV[0][0][0] = s->mv[0][0][0]; // top from top mv_block->PMV[0][0][1] = s->mv[0][0][1] << 1; mv_block->PMV[0][1][0] = s->mv[0][0][0]; // bottom from bottom mv_block->PMV[0][1][1] = s->mv[0][0][1] << 1; mv_block->PMV[1][0][0] = s->mv[0][2][0]; // dmv00, top from bottom mv_block->PMV[1][0][1] = s->mv[0][2][1] << 1; // dmv01 mv_block->PMV[1][1][0] = s->mv[0][3][0]; // dmv10, bottom from top mv_block->PMV[1][1][1] = s->mv[0][3][1] << 1; // dmv11 } else { mv_block->PMV[0][1][0] = s->mv[0][2][0]; // dmv00 mv_block->PMV[0][1][1] = s->mv[0][2][1]; // dmv01 } break; default: assert(0); } mv_block->motion_vertical_field_select = 0; // set correct field references if (s->mv_type == MV_TYPE_FIELD || s->mv_type == MV_TYPE_16X8) { mv_block->motion_vertical_field_select |= s->field_select[0][0]; mv_block->motion_vertical_field_select |= s->field_select[1][0] << 1; mv_block->motion_vertical_field_select |= s->field_select[0][1] << 2; mv_block->motion_vertical_field_select |= s->field_select[1][1] << 3; } } // !intra // time to handle data blocks mv_block->index = render->next_free_data_block_num; blocks_per_mb = 6; if (s->chroma_format >= 2) { blocks_per_mb = 4 + (1 << s->chroma_format); } // calculate cbp cbp = 0; for (i = 0; i < blocks_per_mb; i++) { cbp += cbp; if (s->block_last_index[i] >= 0) cbp++; } if (s->flags & CODEC_FLAG_GRAY) { if (s->mb_intra) { // intra frames are always full chroma blocks for (i = 4; i < blocks_per_mb; i++) { memset(s->pblocks[i], 0, sizeof(*s->pblocks[i])); // so we need to clear them if (!render->unsigned_intra) *s->pblocks[i][0] = 1 << 10; } } else { cbp &= 0xf << (blocks_per_mb - 4); blocks_per_mb = 4; // luminance blocks only } } mv_block->coded_block_pattern = cbp; if (cbp == 0) mv_block->macroblock_type &= ~XVMC_MB_TYPE_PATTERN; for (i = 0; i < blocks_per_mb; i++) { if (s->block_last_index[i] >= 0) { // I do not have unsigned_intra MOCO to test, hope it is OK. if (s->mb_intra && (render->idct || (!render->idct && !render->unsigned_intra))) *s->pblocks[i][0] -= 1 << 10; if (!render->idct) { s->dsp.idct(*s->pblocks[i]); /* It is unclear if MC hardware requires pixel diff values to be * in the range [-255;255]. TODO: Clipping if such hardware is * ever found. As of now it would only be an unnecessary * slowdown. */ } // copy blocks only if the codec doesn't support pblocks reordering if (s->avctx->xvmc_acceleration == 1) { memcpy(&render->data_blocks[render->next_free_data_block_num*64], s->pblocks[i], sizeof(*s->pblocks[i])); } render->next_free_data_block_num++; } } render->filled_mv_blocks_num++; assert(render->filled_mv_blocks_num <= render->allocated_mv_blocks); assert(render->next_free_data_block_num <= render->allocated_data_blocks); /* The above conditions should not be able to fail as long as this function * is used and the following 'if ()' automatically calls a callback to free * blocks. */ if (render->filled_mv_blocks_num == render->allocated_mv_blocks) ff_draw_horiz_band(s, 0, 0); }
123linslouis-android-video-cutter
jni/libavcodec/mpegvideo_xvmc.c
C
asf20
12,431
/* * copyright (c) 2005 Denes Balatoni ( dbalatoni programozo hu ) * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "dsputil.h" #include "vorbis.h" const uint8_t ff_vorbis_channel_layout_offsets[8][8] = { { 0, }, { 0, 1, }, { 0, 2, 1, }, { 0, 1, 2, 3, }, { 0, 2, 1, 3, 4, }, { 0, 2, 1, 5, 3, 4, }, { 0, 2, 1, 6, 5, 3, 4, }, { 0, 2, 1, 7, 5, 6, 3, 4}, }; const int64_t ff_vorbis_channel_layouts[9] = { CH_LAYOUT_MONO, CH_LAYOUT_STEREO, CH_LAYOUT_SURROUND, CH_LAYOUT_QUAD, CH_LAYOUT_5POINT0_BACK, CH_LAYOUT_5POINT1_BACK, CH_LAYOUT_5POINT1|CH_BACK_CENTER, CH_LAYOUT_7POINT1, 0 }; DECLARE_ALIGNED(16, static const float, vwin64)[32] = { 0.0009460463F, 0.0085006468F, 0.0235352254F, 0.0458950567F, 0.0753351908F, 0.1115073077F, 0.1539457973F, 0.2020557475F, 0.2551056759F, 0.3122276645F, 0.3724270287F, 0.4346027792F, 0.4975789974F, 0.5601459521F, 0.6211085051F, 0.6793382689F, 0.7338252629F, 0.7837245849F, 0.8283939355F, 0.8674186656F, 0.9006222429F, 0.9280614787F, 0.9500073081F, 0.9669131782F, 0.9793740220F, 0.9880792941F, 0.9937636139F, 0.9971582668F, 0.9989462667F, 0.9997230082F, 0.9999638688F, 0.9999995525F, }; DECLARE_ALIGNED(16, static const float, vwin128)[64] = { 0.0002365472F, 0.0021280687F, 0.0059065254F, 0.0115626550F, 0.0190823442F, 0.0284463735F, 0.0396300935F, 0.0526030430F, 0.0673285281F, 0.0837631763F, 0.1018564887F, 0.1215504095F, 0.1427789367F, 0.1654677960F, 0.1895342001F, 0.2148867160F, 0.2414252576F, 0.2690412240F, 0.2976177952F, 0.3270303960F, 0.3571473350F, 0.3878306189F, 0.4189369387F, 0.4503188188F, 0.4818259135F, 0.5133064334F, 0.5446086751F, 0.5755826278F, 0.6060816248F, 0.6359640047F, 0.6650947483F, 0.6933470543F, 0.7206038179F, 0.7467589810F, 0.7717187213F, 0.7954024542F, 0.8177436264F, 0.8386902831F, 0.8582053981F, 0.8762669622F, 0.8928678298F, 0.9080153310F, 0.9217306608F, 0.9340480615F, 0.9450138200F, 0.9546851041F, 0.9631286621F, 0.9704194171F, 0.9766389810F, 0.9818741197F, 0.9862151938F, 0.9897546035F, 0.9925852598F, 0.9947991032F, 0.9964856900F, 0.9977308602F, 0.9986155015F, 0.9992144193F, 0.9995953200F, 0.9998179155F, 0.9999331503F, 0.9999825563F, 0.9999977357F, 0.9999999720F, }; DECLARE_ALIGNED(16, static const float, vwin256)[128] = { 0.0000591390F, 0.0005321979F, 0.0014780301F, 0.0028960636F, 0.0047854363F, 0.0071449926F, 0.0099732775F, 0.0132685298F, 0.0170286741F, 0.0212513119F, 0.0259337111F, 0.0310727950F, 0.0366651302F, 0.0427069140F, 0.0491939614F, 0.0561216907F, 0.0634851102F, 0.0712788035F, 0.0794969160F, 0.0881331402F, 0.0971807028F, 0.1066323515F, 0.1164803426F, 0.1267164297F, 0.1373318534F, 0.1483173323F, 0.1596630553F, 0.1713586755F, 0.1833933062F, 0.1957555184F, 0.2084333404F, 0.2214142599F, 0.2346852280F, 0.2482326664F, 0.2620424757F, 0.2761000481F, 0.2903902813F, 0.3048975959F, 0.3196059553F, 0.3344988887F, 0.3495595160F, 0.3647705766F, 0.3801144597F, 0.3955732382F, 0.4111287047F, 0.4267624093F, 0.4424557009F, 0.4581897696F, 0.4739456913F, 0.4897044744F, 0.5054471075F, 0.5211546088F, 0.5368080763F, 0.5523887395F, 0.5678780103F, 0.5832575361F, 0.5985092508F, 0.6136154277F, 0.6285587300F, 0.6433222619F, 0.6578896175F, 0.6722449294F, 0.6863729144F, 0.7002589187F, 0.7138889597F, 0.7272497662F, 0.7403288154F, 0.7531143679F, 0.7655954985F, 0.7777621249F, 0.7896050322F, 0.8011158947F, 0.8122872932F, 0.8231127294F, 0.8335866365F, 0.8437043850F, 0.8534622861F, 0.8628575905F, 0.8718884835F, 0.8805540765F, 0.8888543947F, 0.8967903616F, 0.9043637797F, 0.9115773078F, 0.9184344360F, 0.9249394562F, 0.9310974312F, 0.9369141608F, 0.9423961446F, 0.9475505439F, 0.9523851406F, 0.9569082947F, 0.9611289005F, 0.9650563408F, 0.9687004405F, 0.9720714191F, 0.9751798427F, 0.9780365753F, 0.9806527301F, 0.9830396204F, 0.9852087111F, 0.9871715701F, 0.9889398207F, 0.9905250941F, 0.9919389832F, 0.9931929973F, 0.9942985174F, 0.9952667537F, 0.9961087037F, 0.9968351119F, 0.9974564312F, 0.9979827858F, 0.9984239359F, 0.9987892441F, 0.9990876435F, 0.9993276081F, 0.9995171241F, 0.9996636648F, 0.9997741654F, 0.9998550016F, 0.9999119692F, 0.9999502656F, 0.9999744742F, 0.9999885497F, 0.9999958064F, 0.9999989077F, 0.9999998584F, 0.9999999983F, }; DECLARE_ALIGNED(16, static const float, vwin512)[256] = { 0.0000147849F, 0.0001330607F, 0.0003695946F, 0.0007243509F, 0.0011972759F, 0.0017882983F, 0.0024973285F, 0.0033242588F, 0.0042689632F, 0.0053312973F, 0.0065110982F, 0.0078081841F, 0.0092223540F, 0.0107533880F, 0.0124010466F, 0.0141650703F, 0.0160451800F, 0.0180410758F, 0.0201524373F, 0.0223789233F, 0.0247201710F, 0.0271757958F, 0.0297453914F, 0.0324285286F, 0.0352247556F, 0.0381335972F, 0.0411545545F, 0.0442871045F, 0.0475306997F, 0.0508847676F, 0.0543487103F, 0.0579219038F, 0.0616036982F, 0.0653934164F, 0.0692903546F, 0.0732937809F, 0.0774029356F, 0.0816170305F, 0.0859352485F, 0.0903567428F, 0.0948806375F, 0.0995060259F, 0.1042319712F, 0.1090575056F, 0.1139816300F, 0.1190033137F, 0.1241214941F, 0.1293350764F, 0.1346429333F, 0.1400439046F, 0.1455367974F, 0.1511203852F, 0.1567934083F, 0.1625545735F, 0.1684025537F, 0.1743359881F, 0.1803534820F, 0.1864536069F, 0.1926349000F, 0.1988958650F, 0.2052349715F, 0.2116506555F, 0.2181413191F, 0.2247053313F, 0.2313410275F, 0.2380467105F, 0.2448206500F, 0.2516610835F, 0.2585662164F, 0.2655342226F, 0.2725632448F, 0.2796513950F, 0.2867967551F, 0.2939973773F, 0.3012512852F, 0.3085564739F, 0.3159109111F, 0.3233125375F, 0.3307592680F, 0.3382489922F, 0.3457795756F, 0.3533488602F, 0.3609546657F, 0.3685947904F, 0.3762670121F, 0.3839690896F, 0.3916987634F, 0.3994537572F, 0.4072317788F, 0.4150305215F, 0.4228476653F, 0.4306808783F, 0.4385278181F, 0.4463861329F, 0.4542534630F, 0.4621274424F, 0.4700057001F, 0.4778858615F, 0.4857655502F, 0.4936423891F, 0.5015140023F, 0.5093780165F, 0.5172320626F, 0.5250737772F, 0.5329008043F, 0.5407107971F, 0.5485014192F, 0.5562703465F, 0.5640152688F, 0.5717338914F, 0.5794239366F, 0.5870831457F, 0.5947092801F, 0.6023001235F, 0.6098534829F, 0.6173671907F, 0.6248391059F, 0.6322671161F, 0.6396491384F, 0.6469831217F, 0.6542670475F, 0.6614989319F, 0.6686768267F, 0.6757988210F, 0.6828630426F, 0.6898676592F, 0.6968108799F, 0.7036909564F, 0.7105061843F, 0.7172549043F, 0.7239355032F, 0.7305464154F, 0.7370861235F, 0.7435531598F, 0.7499461068F, 0.7562635986F, 0.7625043214F, 0.7686670148F, 0.7747504721F, 0.7807535410F, 0.7866751247F, 0.7925141825F, 0.7982697296F, 0.8039408387F, 0.8095266395F, 0.8150263196F, 0.8204391248F, 0.8257643590F, 0.8310013848F, 0.8361496236F, 0.8412085555F, 0.8461777194F, 0.8510567129F, 0.8558451924F, 0.8605428730F, 0.8651495278F, 0.8696649882F, 0.8740891432F, 0.8784219392F, 0.8826633797F, 0.8868135244F, 0.8908724888F, 0.8948404441F, 0.8987176157F, 0.9025042831F, 0.9062007791F, 0.9098074886F, 0.9133248482F, 0.9167533451F, 0.9200935163F, 0.9233459472F, 0.9265112712F, 0.9295901680F, 0.9325833632F, 0.9354916263F, 0.9383157705F, 0.9410566504F, 0.9437151618F, 0.9462922398F, 0.9487888576F, 0.9512060252F, 0.9535447882F, 0.9558062262F, 0.9579914516F, 0.9601016078F, 0.9621378683F, 0.9641014348F, 0.9659935361F, 0.9678154261F, 0.9695683830F, 0.9712537071F, 0.9728727198F, 0.9744267618F, 0.9759171916F, 0.9773453842F, 0.9787127293F, 0.9800206298F, 0.9812705006F, 0.9824637665F, 0.9836018613F, 0.9846862258F, 0.9857183066F, 0.9866995544F, 0.9876314227F, 0.9885153662F, 0.9893528393F, 0.9901452948F, 0.9908941823F, 0.9916009470F, 0.9922670279F, 0.9928938570F, 0.9934828574F, 0.9940354423F, 0.9945530133F, 0.9950369595F, 0.9954886562F, 0.9959094633F, 0.9963007242F, 0.9966637649F, 0.9969998925F, 0.9973103939F, 0.9975965351F, 0.9978595598F, 0.9981006885F, 0.9983211172F, 0.9985220166F, 0.9987045311F, 0.9988697776F, 0.9990188449F, 0.9991527924F, 0.9992726499F, 0.9993794157F, 0.9994740570F, 0.9995575079F, 0.9996306699F, 0.9996944099F, 0.9997495605F, 0.9997969190F, 0.9998372465F, 0.9998712678F, 0.9998996704F, 0.9999231041F, 0.9999421807F, 0.9999574732F, 0.9999695157F, 0.9999788026F, 0.9999857885F, 0.9999908879F, 0.9999944746F, 0.9999968817F, 0.9999984010F, 0.9999992833F, 0.9999997377F, 0.9999999317F, 0.9999999911F, 0.9999999999F, }; DECLARE_ALIGNED(16, static const float, vwin1024)[512] = { 0.0000036962F, 0.0000332659F, 0.0000924041F, 0.0001811086F, 0.0002993761F, 0.0004472021F, 0.0006245811F, 0.0008315063F, 0.0010679699F, 0.0013339631F, 0.0016294757F, 0.0019544965F, 0.0023090133F, 0.0026930125F, 0.0031064797F, 0.0035493989F, 0.0040217533F, 0.0045235250F, 0.0050546946F, 0.0056152418F, 0.0062051451F, 0.0068243817F, 0.0074729278F, 0.0081507582F, 0.0088578466F, 0.0095941655F, 0.0103596863F, 0.0111543789F, 0.0119782122F, 0.0128311538F, 0.0137131701F, 0.0146242260F, 0.0155642855F, 0.0165333111F, 0.0175312640F, 0.0185581042F, 0.0196137903F, 0.0206982797F, 0.0218115284F, 0.0229534910F, 0.0241241208F, 0.0253233698F, 0.0265511886F, 0.0278075263F, 0.0290923308F, 0.0304055484F, 0.0317471241F, 0.0331170013F, 0.0345151222F, 0.0359414274F, 0.0373958560F, 0.0388783456F, 0.0403888325F, 0.0419272511F, 0.0434935347F, 0.0450876148F, 0.0467094213F, 0.0483588828F, 0.0500359261F, 0.0517404765F, 0.0534724575F, 0.0552317913F, 0.0570183983F, 0.0588321971F, 0.0606731048F, 0.0625410369F, 0.0644359070F, 0.0663576272F, 0.0683061077F, 0.0702812571F, 0.0722829821F, 0.0743111878F, 0.0763657775F, 0.0784466526F, 0.0805537129F, 0.0826868561F, 0.0848459782F, 0.0870309736F, 0.0892417345F, 0.0914781514F, 0.0937401128F, 0.0960275056F, 0.0983402145F, 0.1006781223F, 0.1030411101F, 0.1054290568F, 0.1078418397F, 0.1102793336F, 0.1127414119F, 0.1152279457F, 0.1177388042F, 0.1202738544F, 0.1228329618F, 0.1254159892F, 0.1280227980F, 0.1306532471F, 0.1333071937F, 0.1359844927F, 0.1386849970F, 0.1414085575F, 0.1441550230F, 0.1469242403F, 0.1497160539F, 0.1525303063F, 0.1553668381F, 0.1582254875F, 0.1611060909F, 0.1640084822F, 0.1669324936F, 0.1698779549F, 0.1728446939F, 0.1758325362F, 0.1788413055F, 0.1818708232F, 0.1849209084F, 0.1879913785F, 0.1910820485F, 0.1941927312F, 0.1973232376F, 0.2004733764F, 0.2036429541F, 0.2068317752F, 0.2100396421F, 0.2132663552F, 0.2165117125F, 0.2197755102F, 0.2230575422F, 0.2263576007F, 0.2296754753F, 0.2330109540F, 0.2363638225F, 0.2397338646F, 0.2431208619F, 0.2465245941F, 0.2499448389F, 0.2533813719F, 0.2568339669F, 0.2603023956F, 0.2637864277F, 0.2672858312F, 0.2708003718F, 0.2743298135F, 0.2778739186F, 0.2814324472F, 0.2850051576F, 0.2885918065F, 0.2921921485F, 0.2958059366F, 0.2994329219F, 0.3030728538F, 0.3067254799F, 0.3103905462F, 0.3140677969F, 0.3177569747F, 0.3214578205F, 0.3251700736F, 0.3288934718F, 0.3326277513F, 0.3363726468F, 0.3401278914F, 0.3438932168F, 0.3476683533F, 0.3514530297F, 0.3552469734F, 0.3590499106F, 0.3628615659F, 0.3666816630F, 0.3705099239F, 0.3743460698F, 0.3781898204F, 0.3820408945F, 0.3858990095F, 0.3897638820F, 0.3936352274F, 0.3975127601F, 0.4013961936F, 0.4052852405F, 0.4091796123F, 0.4130790198F, 0.4169831732F, 0.4208917815F, 0.4248045534F, 0.4287211965F, 0.4326414181F, 0.4365649248F, 0.4404914225F, 0.4444206167F, 0.4483522125F, 0.4522859146F, 0.4562214270F, 0.4601584538F, 0.4640966984F, 0.4680358644F, 0.4719756548F, 0.4759157726F, 0.4798559209F, 0.4837958024F, 0.4877351199F, 0.4916735765F, 0.4956108751F, 0.4995467188F, 0.5034808109F, 0.5074128550F, 0.5113425550F, 0.5152696149F, 0.5191937395F, 0.5231146336F, 0.5270320028F, 0.5309455530F, 0.5348549910F, 0.5387600239F, 0.5426603597F, 0.5465557070F, 0.5504457754F, 0.5543302752F, 0.5582089175F, 0.5620814145F, 0.5659474793F, 0.5698068262F, 0.5736591704F, 0.5775042283F, 0.5813417176F, 0.5851713571F, 0.5889928670F, 0.5928059689F, 0.5966103856F, 0.6004058415F, 0.6041920626F, 0.6079687761F, 0.6117357113F, 0.6154925986F, 0.6192391705F, 0.6229751612F, 0.6267003064F, 0.6304143441F, 0.6341170137F, 0.6378080569F, 0.6414872173F, 0.6451542405F, 0.6488088741F, 0.6524508681F, 0.6560799742F, 0.6596959469F, 0.6632985424F, 0.6668875197F, 0.6704626398F, 0.6740236662F, 0.6775703649F, 0.6811025043F, 0.6846198554F, 0.6881221916F, 0.6916092892F, 0.6950809269F, 0.6985368861F, 0.7019769510F, 0.7054009085F, 0.7088085484F, 0.7121996632F, 0.7155740484F, 0.7189315023F, 0.7222718263F, 0.7255948245F, 0.7289003043F, 0.7321880760F, 0.7354579530F, 0.7387097518F, 0.7419432921F, 0.7451583966F, 0.7483548915F, 0.7515326059F, 0.7546913723F, 0.7578310265F, 0.7609514077F, 0.7640523581F, 0.7671337237F, 0.7701953535F, 0.7732371001F, 0.7762588195F, 0.7792603711F, 0.7822416178F, 0.7852024259F, 0.7881426654F, 0.7910622097F, 0.7939609356F, 0.7968387237F, 0.7996954579F, 0.8025310261F, 0.8053453193F, 0.8081382324F, 0.8109096638F, 0.8136595156F, 0.8163876936F, 0.8190941071F, 0.8217786690F, 0.8244412960F, 0.8270819086F, 0.8297004305F, 0.8322967896F, 0.8348709171F, 0.8374227481F, 0.8399522213F, 0.8424592789F, 0.8449438672F, 0.8474059356F, 0.8498454378F, 0.8522623306F, 0.8546565748F, 0.8570281348F, 0.8593769787F, 0.8617030779F, 0.8640064080F, 0.8662869477F, 0.8685446796F, 0.8707795899F, 0.8729916682F, 0.8751809079F, 0.8773473059F, 0.8794908626F, 0.8816115819F, 0.8837094713F, 0.8857845418F, 0.8878368079F, 0.8898662874F, 0.8918730019F, 0.8938569760F, 0.8958182380F, 0.8977568194F, 0.8996727552F, 0.9015660837F, 0.9034368465F, 0.9052850885F, 0.9071108577F, 0.9089142057F, 0.9106951869F, 0.9124538591F, 0.9141902832F, 0.9159045233F, 0.9175966464F, 0.9192667228F, 0.9209148257F, 0.9225410313F, 0.9241454187F, 0.9257280701F, 0.9272890704F, 0.9288285075F, 0.9303464720F, 0.9318430576F, 0.9333183603F, 0.9347724792F, 0.9362055158F, 0.9376175745F, 0.9390087622F, 0.9403791881F, 0.9417289644F, 0.9430582055F, 0.9443670283F, 0.9456555521F, 0.9469238986F, 0.9481721917F, 0.9494005577F, 0.9506091252F, 0.9517980248F, 0.9529673894F, 0.9541173540F, 0.9552480557F, 0.9563596334F, 0.9574522282F, 0.9585259830F, 0.9595810428F, 0.9606175542F, 0.9616356656F, 0.9626355274F, 0.9636172915F, 0.9645811114F, 0.9655271425F, 0.9664555414F, 0.9673664664F, 0.9682600774F, 0.9691365355F, 0.9699960034F, 0.9708386448F, 0.9716646250F, 0.9724741103F, 0.9732672685F, 0.9740442683F, 0.9748052795F, 0.9755504729F, 0.9762800205F, 0.9769940950F, 0.9776928703F, 0.9783765210F, 0.9790452223F, 0.9796991504F, 0.9803384823F, 0.9809633954F, 0.9815740679F, 0.9821706784F, 0.9827534063F, 0.9833224312F, 0.9838779332F, 0.9844200928F, 0.9849490910F, 0.9854651087F, 0.9859683274F, 0.9864589286F, 0.9869370940F, 0.9874030054F, 0.9878568447F, 0.9882987937F, 0.9887290343F, 0.9891477481F, 0.9895551169F, 0.9899513220F, 0.9903365446F, 0.9907109658F, 0.9910747662F, 0.9914281260F, 0.9917712252F, 0.9921042433F, 0.9924273593F, 0.9927407516F, 0.9930445982F, 0.9933390763F, 0.9936243626F, 0.9939006331F, 0.9941680631F, 0.9944268269F, 0.9946770982F, 0.9949190498F, 0.9951528537F, 0.9953786808F, 0.9955967011F, 0.9958070836F, 0.9960099963F, 0.9962056061F, 0.9963940787F, 0.9965755786F, 0.9967502693F, 0.9969183129F, 0.9970798704F, 0.9972351013F, 0.9973841640F, 0.9975272151F, 0.9976644103F, 0.9977959036F, 0.9979218476F, 0.9980423932F, 0.9981576901F, 0.9982678862F, 0.9983731278F, 0.9984735596F, 0.9985693247F, 0.9986605645F, 0.9987474186F, 0.9988300248F, 0.9989085193F, 0.9989830364F, 0.9990537085F, 0.9991206662F, 0.9991840382F, 0.9992439513F, 0.9993005303F, 0.9993538982F, 0.9994041757F, 0.9994514817F, 0.9994959330F, 0.9995376444F, 0.9995767286F, 0.9996132960F, 0.9996474550F, 0.9996793121F, 0.9997089710F, 0.9997365339F, 0.9997621003F, 0.9997857677F, 0.9998076311F, 0.9998277836F, 0.9998463156F, 0.9998633155F, 0.9998788692F, 0.9998930603F, 0.9999059701F, 0.9999176774F, 0.9999282586F, 0.9999377880F, 0.9999463370F, 0.9999539749F, 0.9999607685F, 0.9999667820F, 0.9999720773F, 0.9999767136F, 0.9999807479F, 0.9999842344F, 0.9999872249F, 0.9999897688F, 0.9999919127F, 0.9999937009F, 0.9999951749F, 0.9999963738F, 0.9999973342F, 0.9999980900F, 0.9999986724F, 0.9999991103F, 0.9999994297F, 0.9999996543F, 0.9999998049F, 0.9999999000F, 0.9999999552F, 0.9999999836F, 0.9999999957F, 0.9999999994F, 1.0000000000F, }; DECLARE_ALIGNED(16, static const float, vwin2048)[1024] = { 0.0000009241F, 0.0000083165F, 0.0000231014F, 0.0000452785F, 0.0000748476F, 0.0001118085F, 0.0001561608F, 0.0002079041F, 0.0002670379F, 0.0003335617F, 0.0004074748F, 0.0004887765F, 0.0005774661F, 0.0006735427F, 0.0007770054F, 0.0008878533F, 0.0010060853F, 0.0011317002F, 0.0012646969F, 0.0014050742F, 0.0015528307F, 0.0017079650F, 0.0018704756F, 0.0020403610F, 0.0022176196F, 0.0024022497F, 0.0025942495F, 0.0027936173F, 0.0030003511F, 0.0032144490F, 0.0034359088F, 0.0036647286F, 0.0039009061F, 0.0041444391F, 0.0043953253F, 0.0046535621F, 0.0049191472F, 0.0051920781F, 0.0054723520F, 0.0057599664F, 0.0060549184F, 0.0063572052F, 0.0066668239F, 0.0069837715F, 0.0073080449F, 0.0076396410F, 0.0079785566F, 0.0083247884F, 0.0086783330F, 0.0090391871F, 0.0094073470F, 0.0097828092F, 0.0101655700F, 0.0105556258F, 0.0109529726F, 0.0113576065F, 0.0117695237F, 0.0121887200F, 0.0126151913F, 0.0130489335F, 0.0134899422F, 0.0139382130F, 0.0143937415F, 0.0148565233F, 0.0153265536F, 0.0158038279F, 0.0162883413F, 0.0167800889F, 0.0172790660F, 0.0177852675F, 0.0182986882F, 0.0188193231F, 0.0193471668F, 0.0198822141F, 0.0204244594F, 0.0209738974F, 0.0215305225F, 0.0220943289F, 0.0226653109F, 0.0232434627F, 0.0238287784F, 0.0244212519F, 0.0250208772F, 0.0256276481F, 0.0262415582F, 0.0268626014F, 0.0274907711F, 0.0281260608F, 0.0287684638F, 0.0294179736F, 0.0300745833F, 0.0307382859F, 0.0314090747F, 0.0320869424F, 0.0327718819F, 0.0334638860F, 0.0341629474F, 0.0348690586F, 0.0355822122F, 0.0363024004F, 0.0370296157F, 0.0377638502F, 0.0385050960F, 0.0392533451F, 0.0400085896F, 0.0407708211F, 0.0415400315F, 0.0423162123F, 0.0430993552F, 0.0438894515F, 0.0446864926F, 0.0454904698F, 0.0463013742F, 0.0471191969F, 0.0479439288F, 0.0487755607F, 0.0496140836F, 0.0504594879F, 0.0513117642F, 0.0521709031F, 0.0530368949F, 0.0539097297F, 0.0547893979F, 0.0556758894F, 0.0565691941F, 0.0574693019F, 0.0583762026F, 0.0592898858F, 0.0602103410F, 0.0611375576F, 0.0620715250F, 0.0630122324F, 0.0639596688F, 0.0649138234F, 0.0658746848F, 0.0668422421F, 0.0678164838F, 0.0687973985F, 0.0697849746F, 0.0707792005F, 0.0717800645F, 0.0727875547F, 0.0738016591F, 0.0748223656F, 0.0758496620F, 0.0768835359F, 0.0779239751F, 0.0789709668F, 0.0800244985F, 0.0810845574F, 0.0821511306F, 0.0832242052F, 0.0843037679F, 0.0853898056F, 0.0864823050F, 0.0875812525F, 0.0886866347F, 0.0897984378F, 0.0909166480F, 0.0920412513F, 0.0931722338F, 0.0943095813F, 0.0954532795F, 0.0966033140F, 0.0977596702F, 0.0989223336F, 0.1000912894F, 0.1012665227F, 0.1024480185F, 0.1036357616F, 0.1048297369F, 0.1060299290F, 0.1072363224F, 0.1084489014F, 0.1096676504F, 0.1108925534F, 0.1121235946F, 0.1133607577F, 0.1146040267F, 0.1158533850F, 0.1171088163F, 0.1183703040F, 0.1196378312F, 0.1209113812F, 0.1221909370F, 0.1234764815F, 0.1247679974F, 0.1260654674F, 0.1273688740F, 0.1286781995F, 0.1299934263F, 0.1313145365F, 0.1326415121F, 0.1339743349F, 0.1353129866F, 0.1366574490F, 0.1380077035F, 0.1393637315F, 0.1407255141F, 0.1420930325F, 0.1434662677F, 0.1448452004F, 0.1462298115F, 0.1476200814F, 0.1490159906F, 0.1504175195F, 0.1518246482F, 0.1532373569F, 0.1546556253F, 0.1560794333F, 0.1575087606F, 0.1589435866F, 0.1603838909F, 0.1618296526F, 0.1632808509F, 0.1647374648F, 0.1661994731F, 0.1676668546F, 0.1691395880F, 0.1706176516F, 0.1721010238F, 0.1735896829F, 0.1750836068F, 0.1765827736F, 0.1780871610F, 0.1795967468F, 0.1811115084F, 0.1826314234F, 0.1841564689F, 0.1856866221F, 0.1872218600F, 0.1887621595F, 0.1903074974F, 0.1918578503F, 0.1934131947F, 0.1949735068F, 0.1965387630F, 0.1981089393F, 0.1996840117F, 0.2012639560F, 0.2028487479F, 0.2044383630F, 0.2060327766F, 0.2076319642F, 0.2092359007F, 0.2108445614F, 0.2124579211F, 0.2140759545F, 0.2156986364F, 0.2173259411F, 0.2189578432F, 0.2205943168F, 0.2222353361F, 0.2238808751F, 0.2255309076F, 0.2271854073F, 0.2288443480F, 0.2305077030F, 0.2321754457F, 0.2338475493F, 0.2355239869F, 0.2372047315F, 0.2388897560F, 0.2405790329F, 0.2422725350F, 0.2439702347F, 0.2456721043F, 0.2473781159F, 0.2490882418F, 0.2508024539F, 0.2525207240F, 0.2542430237F, 0.2559693248F, 0.2576995986F, 0.2594338166F, 0.2611719498F, 0.2629139695F, 0.2646598466F, 0.2664095520F, 0.2681630564F, 0.2699203304F, 0.2716813445F, 0.2734460691F, 0.2752144744F, 0.2769865307F, 0.2787622079F, 0.2805414760F, 0.2823243047F, 0.2841106637F, 0.2859005227F, 0.2876938509F, 0.2894906179F, 0.2912907928F, 0.2930943447F, 0.2949012426F, 0.2967114554F, 0.2985249520F, 0.3003417009F, 0.3021616708F, 0.3039848301F, 0.3058111471F, 0.3076405901F, 0.3094731273F, 0.3113087266F, 0.3131473560F, 0.3149889833F, 0.3168335762F, 0.3186811024F, 0.3205315294F, 0.3223848245F, 0.3242409552F, 0.3260998886F, 0.3279615918F, 0.3298260319F, 0.3316931758F, 0.3335629903F, 0.3354354423F, 0.3373104982F, 0.3391881247F, 0.3410682882F, 0.3429509551F, 0.3448360917F, 0.3467236642F, 0.3486136387F, 0.3505059811F, 0.3524006575F, 0.3542976336F, 0.3561968753F, 0.3580983482F, 0.3600020179F, 0.3619078499F, 0.3638158096F, 0.3657258625F, 0.3676379737F, 0.3695521086F, 0.3714682321F, 0.3733863094F, 0.3753063055F, 0.3772281852F, 0.3791519134F, 0.3810774548F, 0.3830047742F, 0.3849338362F, 0.3868646053F, 0.3887970459F, 0.3907311227F, 0.3926667998F, 0.3946040417F, 0.3965428125F, 0.3984830765F, 0.4004247978F, 0.4023679403F, 0.4043124683F, 0.4062583455F, 0.4082055359F, 0.4101540034F, 0.4121037117F, 0.4140546246F, 0.4160067058F, 0.4179599190F, 0.4199142277F, 0.4218695956F, 0.4238259861F, 0.4257833627F, 0.4277416888F, 0.4297009279F, 0.4316610433F, 0.4336219983F, 0.4355837562F, 0.4375462803F, 0.4395095337F, 0.4414734797F, 0.4434380815F, 0.4454033021F, 0.4473691046F, 0.4493354521F, 0.4513023078F, 0.4532696345F, 0.4552373954F, 0.4572055533F, 0.4591740713F, 0.4611429123F, 0.4631120393F, 0.4650814151F, 0.4670510028F, 0.4690207650F, 0.4709906649F, 0.4729606651F, 0.4749307287F, 0.4769008185F, 0.4788708972F, 0.4808409279F, 0.4828108732F, 0.4847806962F, 0.4867503597F, 0.4887198264F, 0.4906890593F, 0.4926580213F, 0.4946266753F, 0.4965949840F, 0.4985629105F, 0.5005304176F, 0.5024974683F, 0.5044640255F, 0.5064300522F, 0.5083955114F, 0.5103603659F, 0.5123245790F, 0.5142881136F, 0.5162509328F, 0.5182129997F, 0.5201742774F, 0.5221347290F, 0.5240943178F, 0.5260530070F, 0.5280107598F, 0.5299675395F, 0.5319233095F, 0.5338780330F, 0.5358316736F, 0.5377841946F, 0.5397355596F, 0.5416857320F, 0.5436346755F, 0.5455823538F, 0.5475287304F, 0.5494737691F, 0.5514174337F, 0.5533596881F, 0.5553004962F, 0.5572398218F, 0.5591776291F, 0.5611138821F, 0.5630485449F, 0.5649815818F, 0.5669129570F, 0.5688426349F, 0.5707705799F, 0.5726967564F, 0.5746211290F, 0.5765436624F, 0.5784643212F, 0.5803830702F, 0.5822998743F, 0.5842146984F, 0.5861275076F, 0.5880382669F, 0.5899469416F, 0.5918534968F, 0.5937578981F, 0.5956601107F, 0.5975601004F, 0.5994578326F, 0.6013532732F, 0.6032463880F, 0.6051371429F, 0.6070255039F, 0.6089114372F, 0.6107949090F, 0.6126758856F, 0.6145543334F, 0.6164302191F, 0.6183035092F, 0.6201741706F, 0.6220421700F, 0.6239074745F, 0.6257700513F, 0.6276298674F, 0.6294868903F, 0.6313410873F, 0.6331924262F, 0.6350408745F, 0.6368864001F, 0.6387289710F, 0.6405685552F, 0.6424051209F, 0.6442386364F, 0.6460690702F, 0.6478963910F, 0.6497205673F, 0.6515415682F, 0.6533593625F, 0.6551739194F, 0.6569852082F, 0.6587931984F, 0.6605978593F, 0.6623991609F, 0.6641970728F, 0.6659915652F, 0.6677826081F, 0.6695701718F, 0.6713542268F, 0.6731347437F, 0.6749116932F, 0.6766850461F, 0.6784547736F, 0.6802208469F, 0.6819832374F, 0.6837419164F, 0.6854968559F, 0.6872480275F, 0.6889954034F, 0.6907389556F, 0.6924786566F, 0.6942144788F, 0.6959463950F, 0.6976743780F, 0.6993984008F, 0.7011184365F, 0.7028344587F, 0.7045464407F, 0.7062543564F, 0.7079581796F, 0.7096578844F, 0.7113534450F, 0.7130448359F, 0.7147320316F, 0.7164150070F, 0.7180937371F, 0.7197681970F, 0.7214383620F, 0.7231042077F, 0.7247657098F, 0.7264228443F, 0.7280755871F, 0.7297239147F, 0.7313678035F, 0.7330072301F, 0.7346421715F, 0.7362726046F, 0.7378985069F, 0.7395198556F, 0.7411366285F, 0.7427488034F, 0.7443563584F, 0.7459592717F, 0.7475575218F, 0.7491510873F, 0.7507399471F, 0.7523240803F, 0.7539034661F, 0.7554780839F, 0.7570479136F, 0.7586129349F, 0.7601731279F, 0.7617284730F, 0.7632789506F, 0.7648245416F, 0.7663652267F, 0.7679009872F, 0.7694318044F, 0.7709576599F, 0.7724785354F, 0.7739944130F, 0.7755052749F, 0.7770111035F, 0.7785118815F, 0.7800075916F, 0.7814982170F, 0.7829837410F, 0.7844641472F, 0.7859394191F, 0.7874095408F, 0.7888744965F, 0.7903342706F, 0.7917888476F, 0.7932382124F, 0.7946823501F, 0.7961212460F, 0.7975548855F, 0.7989832544F, 0.8004063386F, 0.8018241244F, 0.8032365981F, 0.8046437463F, 0.8060455560F, 0.8074420141F, 0.8088331080F, 0.8102188253F, 0.8115991536F, 0.8129740810F, 0.8143435957F, 0.8157076861F, 0.8170663409F, 0.8184195489F, 0.8197672994F, 0.8211095817F, 0.8224463853F, 0.8237777001F, 0.8251035161F, 0.8264238235F, 0.8277386129F, 0.8290478750F, 0.8303516008F, 0.8316497814F, 0.8329424083F, 0.8342294731F, 0.8355109677F, 0.8367868841F, 0.8380572148F, 0.8393219523F, 0.8405810893F, 0.8418346190F, 0.8430825345F, 0.8443248294F, 0.8455614974F, 0.8467925323F, 0.8480179285F, 0.8492376802F, 0.8504517822F, 0.8516602292F, 0.8528630164F, 0.8540601391F, 0.8552515928F, 0.8564373733F, 0.8576174766F, 0.8587918990F, 0.8599606368F, 0.8611236868F, 0.8622810460F, 0.8634327113F, 0.8645786802F, 0.8657189504F, 0.8668535195F, 0.8679823857F, 0.8691055472F, 0.8702230025F, 0.8713347503F, 0.8724407896F, 0.8735411194F, 0.8746357394F, 0.8757246489F, 0.8768078479F, 0.8778853364F, 0.8789571146F, 0.8800231832F, 0.8810835427F, 0.8821381942F, 0.8831871387F, 0.8842303777F, 0.8852679127F, 0.8862997456F, 0.8873258784F, 0.8883463132F, 0.8893610527F, 0.8903700994F, 0.8913734562F, 0.8923711263F, 0.8933631129F, 0.8943494196F, 0.8953300500F, 0.8963050083F, 0.8972742985F, 0.8982379249F, 0.8991958922F, 0.9001482052F, 0.9010948688F, 0.9020358883F, 0.9029712690F, 0.9039010165F, 0.9048251367F, 0.9057436357F, 0.9066565195F, 0.9075637946F, 0.9084654678F, 0.9093615456F, 0.9102520353F, 0.9111369440F, 0.9120162792F, 0.9128900484F, 0.9137582595F, 0.9146209204F, 0.9154780394F, 0.9163296248F, 0.9171756853F, 0.9180162296F, 0.9188512667F, 0.9196808057F, 0.9205048559F, 0.9213234270F, 0.9221365285F, 0.9229441704F, 0.9237463629F, 0.9245431160F, 0.9253344404F, 0.9261203465F, 0.9269008453F, 0.9276759477F, 0.9284456648F, 0.9292100080F, 0.9299689889F, 0.9307226190F, 0.9314709103F, 0.9322138747F, 0.9329515245F, 0.9336838721F, 0.9344109300F, 0.9351327108F, 0.9358492275F, 0.9365604931F, 0.9372665208F, 0.9379673239F, 0.9386629160F, 0.9393533107F, 0.9400385220F, 0.9407185637F, 0.9413934501F, 0.9420631954F, 0.9427278141F, 0.9433873208F, 0.9440417304F, 0.9446910576F, 0.9453353176F, 0.9459745255F, 0.9466086968F, 0.9472378469F, 0.9478619915F, 0.9484811463F, 0.9490953274F, 0.9497045506F, 0.9503088323F, 0.9509081888F, 0.9515026365F, 0.9520921921F, 0.9526768723F, 0.9532566940F, 0.9538316742F, 0.9544018300F, 0.9549671786F, 0.9555277375F, 0.9560835241F, 0.9566345562F, 0.9571808513F, 0.9577224275F, 0.9582593027F, 0.9587914949F, 0.9593190225F, 0.9598419038F, 0.9603601571F, 0.9608738012F, 0.9613828546F, 0.9618873361F, 0.9623872646F, 0.9628826591F, 0.9633735388F, 0.9638599227F, 0.9643418303F, 0.9648192808F, 0.9652922939F, 0.9657608890F, 0.9662250860F, 0.9666849046F, 0.9671403646F, 0.9675914861F, 0.9680382891F, 0.9684807937F, 0.9689190202F, 0.9693529890F, 0.9697827203F, 0.9702082347F, 0.9706295529F, 0.9710466953F, 0.9714596828F, 0.9718685362F, 0.9722732762F, 0.9726739240F, 0.9730705005F, 0.9734630267F, 0.9738515239F, 0.9742360134F, 0.9746165163F, 0.9749930540F, 0.9753656481F, 0.9757343198F, 0.9760990909F, 0.9764599829F, 0.9768170175F, 0.9771702164F, 0.9775196013F, 0.9778651941F, 0.9782070167F, 0.9785450909F, 0.9788794388F, 0.9792100824F, 0.9795370437F, 0.9798603449F, 0.9801800080F, 0.9804960554F, 0.9808085092F, 0.9811173916F, 0.9814227251F, 0.9817245318F, 0.9820228343F, 0.9823176549F, 0.9826090160F, 0.9828969402F, 0.9831814498F, 0.9834625674F, 0.9837403156F, 0.9840147169F, 0.9842857939F, 0.9845535692F, 0.9848180654F, 0.9850793052F, 0.9853373113F, 0.9855921062F, 0.9858437127F, 0.9860921535F, 0.9863374512F, 0.9865796287F, 0.9868187085F, 0.9870547136F, 0.9872876664F, 0.9875175899F, 0.9877445067F, 0.9879684396F, 0.9881894112F, 0.9884074444F, 0.9886225619F, 0.9888347863F, 0.9890441404F, 0.9892506468F, 0.9894543284F, 0.9896552077F, 0.9898533074F, 0.9900486502F, 0.9902412587F, 0.9904311555F, 0.9906183633F, 0.9908029045F, 0.9909848019F, 0.9911640779F, 0.9913407550F, 0.9915148557F, 0.9916864025F, 0.9918554179F, 0.9920219241F, 0.9921859437F, 0.9923474989F, 0.9925066120F, 0.9926633054F, 0.9928176012F, 0.9929695218F, 0.9931190891F, 0.9932663254F, 0.9934112527F, 0.9935538932F, 0.9936942686F, 0.9938324012F, 0.9939683126F, 0.9941020248F, 0.9942335597F, 0.9943629388F, 0.9944901841F, 0.9946153170F, 0.9947383593F, 0.9948593325F, 0.9949782579F, 0.9950951572F, 0.9952100516F, 0.9953229625F, 0.9954339111F, 0.9955429186F, 0.9956500062F, 0.9957551948F, 0.9958585056F, 0.9959599593F, 0.9960595769F, 0.9961573792F, 0.9962533869F, 0.9963476206F, 0.9964401009F, 0.9965308483F, 0.9966198833F, 0.9967072261F, 0.9967928971F, 0.9968769164F, 0.9969593041F, 0.9970400804F, 0.9971192651F, 0.9971968781F, 0.9972729391F, 0.9973474680F, 0.9974204842F, 0.9974920074F, 0.9975620569F, 0.9976306521F, 0.9976978122F, 0.9977635565F, 0.9978279039F, 0.9978908736F, 0.9979524842F, 0.9980127547F, 0.9980717037F, 0.9981293499F, 0.9981857116F, 0.9982408073F, 0.9982946554F, 0.9983472739F, 0.9983986810F, 0.9984488947F, 0.9984979328F, 0.9985458132F, 0.9985925534F, 0.9986381711F, 0.9986826838F, 0.9987261086F, 0.9987684630F, 0.9988097640F, 0.9988500286F, 0.9988892738F, 0.9989275163F, 0.9989647727F, 0.9990010597F, 0.9990363938F, 0.9990707911F, 0.9991042679F, 0.9991368404F, 0.9991685244F, 0.9991993358F, 0.9992292905F, 0.9992584038F, 0.9992866914F, 0.9993141686F, 0.9993408506F, 0.9993667526F, 0.9993918895F, 0.9994162761F, 0.9994399273F, 0.9994628576F, 0.9994850815F, 0.9995066133F, 0.9995274672F, 0.9995476574F, 0.9995671978F, 0.9995861021F, 0.9996043841F, 0.9996220573F, 0.9996391352F, 0.9996556310F, 0.9996715579F, 0.9996869288F, 0.9997017568F, 0.9997160543F, 0.9997298342F, 0.9997431088F, 0.9997558905F, 0.9997681914F, 0.9997800236F, 0.9997913990F, 0.9998023292F, 0.9998128261F, 0.9998229009F, 0.9998325650F, 0.9998418296F, 0.9998507058F, 0.9998592044F, 0.9998673362F, 0.9998751117F, 0.9998825415F, 0.9998896358F, 0.9998964047F, 0.9999028584F, 0.9999090066F, 0.9999148590F, 0.9999204253F, 0.9999257148F, 0.9999307368F, 0.9999355003F, 0.9999400144F, 0.9999442878F, 0.9999483293F, 0.9999521472F, 0.9999557499F, 0.9999591457F, 0.9999623426F, 0.9999653483F, 0.9999681708F, 0.9999708175F, 0.9999732959F, 0.9999756132F, 0.9999777765F, 0.9999797928F, 0.9999816688F, 0.9999834113F, 0.9999850266F, 0.9999865211F, 0.9999879009F, 0.9999891721F, 0.9999903405F, 0.9999914118F, 0.9999923914F, 0.9999932849F, 0.9999940972F, 0.9999948336F, 0.9999954989F, 0.9999960978F, 0.9999966349F, 0.9999971146F, 0.9999975411F, 0.9999979185F, 0.9999982507F, 0.9999985414F, 0.9999987944F, 0.9999990129F, 0.9999992003F, 0.9999993596F, 0.9999994939F, 0.9999996059F, 0.9999996981F, 0.9999997732F, 0.9999998333F, 0.9999998805F, 0.9999999170F, 0.9999999444F, 0.9999999643F, 0.9999999784F, 0.9999999878F, 0.9999999937F, 0.9999999972F, 0.9999999990F, 0.9999999997F, 1.0000000000F, 1.0000000000F, }; DECLARE_ALIGNED(16, static const float, vwin4096)[2048] = { 0.0000002310F, 0.0000020791F, 0.0000057754F, 0.0000113197F, 0.0000187121F, 0.0000279526F, 0.0000390412F, 0.0000519777F, 0.0000667623F, 0.0000833949F, 0.0001018753F, 0.0001222036F, 0.0001443798F, 0.0001684037F, 0.0001942754F, 0.0002219947F, 0.0002515616F, 0.0002829761F, 0.0003162380F, 0.0003513472F, 0.0003883038F, 0.0004271076F, 0.0004677584F, 0.0005102563F, 0.0005546011F, 0.0006007928F, 0.0006488311F, 0.0006987160F, 0.0007504474F, 0.0008040251F, 0.0008594490F, 0.0009167191F, 0.0009758351F, 0.0010367969F, 0.0010996044F, 0.0011642574F, 0.0012307558F, 0.0012990994F, 0.0013692880F, 0.0014413216F, 0.0015151998F, 0.0015909226F, 0.0016684898F, 0.0017479011F, 0.0018291565F, 0.0019122556F, 0.0019971983F, 0.0020839845F, 0.0021726138F, 0.0022630861F, 0.0023554012F, 0.0024495588F, 0.0025455588F, 0.0026434008F, 0.0027430847F, 0.0028446103F, 0.0029479772F, 0.0030531853F, 0.0031602342F, 0.0032691238F, 0.0033798538F, 0.0034924239F, 0.0036068338F, 0.0037230833F, 0.0038411721F, 0.0039610999F, 0.0040828664F, 0.0042064714F, 0.0043319145F, 0.0044591954F, 0.0045883139F, 0.0047192696F, 0.0048520622F, 0.0049866914F, 0.0051231569F, 0.0052614583F, 0.0054015953F, 0.0055435676F, 0.0056873748F, 0.0058330166F, 0.0059804926F, 0.0061298026F, 0.0062809460F, 0.0064339226F, 0.0065887320F, 0.0067453738F, 0.0069038476F, 0.0070641531F, 0.0072262899F, 0.0073902575F, 0.0075560556F, 0.0077236838F, 0.0078931417F, 0.0080644288F, 0.0082375447F, 0.0084124891F, 0.0085892615F, 0.0087678614F, 0.0089482885F, 0.0091305422F, 0.0093146223F, 0.0095005281F, 0.0096882592F, 0.0098778153F, 0.0100691958F, 0.0102624002F, 0.0104574281F, 0.0106542791F, 0.0108529525F, 0.0110534480F, 0.0112557651F, 0.0114599032F, 0.0116658618F, 0.0118736405F, 0.0120832387F, 0.0122946560F, 0.0125078917F, 0.0127229454F, 0.0129398166F, 0.0131585046F, 0.0133790090F, 0.0136013292F, 0.0138254647F, 0.0140514149F, 0.0142791792F, 0.0145087572F, 0.0147401481F, 0.0149733515F, 0.0152083667F, 0.0154451932F, 0.0156838304F, 0.0159242777F, 0.0161665345F, 0.0164106001F, 0.0166564741F, 0.0169041557F, 0.0171536443F, 0.0174049393F, 0.0176580401F, 0.0179129461F, 0.0181696565F, 0.0184281708F, 0.0186884883F, 0.0189506084F, 0.0192145303F, 0.0194802535F, 0.0197477772F, 0.0200171008F, 0.0202882236F, 0.0205611449F, 0.0208358639F, 0.0211123801F, 0.0213906927F, 0.0216708011F, 0.0219527043F, 0.0222364019F, 0.0225218930F, 0.0228091769F, 0.0230982529F, 0.0233891203F, 0.0236817782F, 0.0239762259F, 0.0242724628F, 0.0245704880F, 0.0248703007F, 0.0251719002F, 0.0254752858F, 0.0257804565F, 0.0260874117F, 0.0263961506F, 0.0267066722F, 0.0270189760F, 0.0273330609F, 0.0276489263F, 0.0279665712F, 0.0282859949F, 0.0286071966F, 0.0289301753F, 0.0292549303F, 0.0295814607F, 0.0299097656F, 0.0302398442F, 0.0305716957F, 0.0309053191F, 0.0312407135F, 0.0315778782F, 0.0319168122F, 0.0322575145F, 0.0325999844F, 0.0329442209F, 0.0332902231F, 0.0336379900F, 0.0339875208F, 0.0343388146F, 0.0346918703F, 0.0350466871F, 0.0354032640F, 0.0357616000F, 0.0361216943F, 0.0364835458F, 0.0368471535F, 0.0372125166F, 0.0375796339F, 0.0379485046F, 0.0383191276F, 0.0386915020F, 0.0390656267F, 0.0394415008F, 0.0398191231F, 0.0401984927F, 0.0405796086F, 0.0409624698F, 0.0413470751F, 0.0417334235F, 0.0421215141F, 0.0425113457F, 0.0429029172F, 0.0432962277F, 0.0436912760F, 0.0440880610F, 0.0444865817F, 0.0448868370F, 0.0452888257F, 0.0456925468F, 0.0460979992F, 0.0465051816F, 0.0469140931F, 0.0473247325F, 0.0477370986F, 0.0481511902F, 0.0485670064F, 0.0489845458F, 0.0494038074F, 0.0498247899F, 0.0502474922F, 0.0506719131F, 0.0510980514F, 0.0515259060F, 0.0519554756F, 0.0523867590F, 0.0528197550F, 0.0532544624F, 0.0536908800F, 0.0541290066F, 0.0545688408F, 0.0550103815F, 0.0554536274F, 0.0558985772F, 0.0563452297F, 0.0567935837F, 0.0572436377F, 0.0576953907F, 0.0581488412F, 0.0586039880F, 0.0590608297F, 0.0595193651F, 0.0599795929F, 0.0604415117F, 0.0609051202F, 0.0613704170F, 0.0618374009F, 0.0623060704F, 0.0627764243F, 0.0632484611F, 0.0637221795F, 0.0641975781F, 0.0646746555F, 0.0651534104F, 0.0656338413F, 0.0661159469F, 0.0665997257F, 0.0670851763F, 0.0675722973F, 0.0680610873F, 0.0685515448F, 0.0690436684F, 0.0695374567F, 0.0700329081F, 0.0705300213F, 0.0710287947F, 0.0715292269F, 0.0720313163F, 0.0725350616F, 0.0730404612F, 0.0735475136F, 0.0740562172F, 0.0745665707F, 0.0750785723F, 0.0755922207F, 0.0761075143F, 0.0766244515F, 0.0771430307F, 0.0776632505F, 0.0781851092F, 0.0787086052F, 0.0792337371F, 0.0797605032F, 0.0802889018F, 0.0808189315F, 0.0813505905F, 0.0818838773F, 0.0824187903F, 0.0829553277F, 0.0834934881F, 0.0840332697F, 0.0845746708F, 0.0851176899F, 0.0856623252F, 0.0862085751F, 0.0867564379F, 0.0873059119F, 0.0878569954F, 0.0884096867F, 0.0889639840F, 0.0895198858F, 0.0900773902F, 0.0906364955F, 0.0911972000F, 0.0917595019F, 0.0923233995F, 0.0928888909F, 0.0934559745F, 0.0940246485F, 0.0945949110F, 0.0951667604F, 0.0957401946F, 0.0963152121F, 0.0968918109F, 0.0974699893F, 0.0980497454F, 0.0986310773F, 0.0992139832F, 0.0997984614F, 0.1003845098F, 0.1009721267F, 0.1015613101F, 0.1021520582F, 0.1027443692F, 0.1033382410F, 0.1039336718F, 0.1045306597F, 0.1051292027F, 0.1057292990F, 0.1063309466F, 0.1069341435F, 0.1075388878F, 0.1081451776F, 0.1087530108F, 0.1093623856F, 0.1099732998F, 0.1105857516F, 0.1111997389F, 0.1118152597F, 0.1124323121F, 0.1130508939F, 0.1136710032F, 0.1142926379F, 0.1149157960F, 0.1155404755F, 0.1161666742F, 0.1167943901F, 0.1174236211F, 0.1180543652F, 0.1186866202F, 0.1193203841F, 0.1199556548F, 0.1205924300F, 0.1212307078F, 0.1218704860F, 0.1225117624F, 0.1231545349F, 0.1237988013F, 0.1244445596F, 0.1250918074F, 0.1257405427F, 0.1263907632F, 0.1270424667F, 0.1276956512F, 0.1283503142F, 0.1290064537F, 0.1296640674F, 0.1303231530F, 0.1309837084F, 0.1316457312F, 0.1323092193F, 0.1329741703F, 0.1336405820F, 0.1343084520F, 0.1349777782F, 0.1356485582F, 0.1363207897F, 0.1369944704F, 0.1376695979F, 0.1383461700F, 0.1390241842F, 0.1397036384F, 0.1403845300F, 0.1410668567F, 0.1417506162F, 0.1424358061F, 0.1431224240F, 0.1438104674F, 0.1444999341F, 0.1451908216F, 0.1458831274F, 0.1465768492F, 0.1472719844F, 0.1479685308F, 0.1486664857F, 0.1493658468F, 0.1500666115F, 0.1507687775F, 0.1514723422F, 0.1521773031F, 0.1528836577F, 0.1535914035F, 0.1543005380F, 0.1550110587F, 0.1557229631F, 0.1564362485F, 0.1571509124F, 0.1578669524F, 0.1585843657F, 0.1593031499F, 0.1600233024F, 0.1607448205F, 0.1614677017F, 0.1621919433F, 0.1629175428F, 0.1636444975F, 0.1643728047F, 0.1651024619F, 0.1658334665F, 0.1665658156F, 0.1672995067F, 0.1680345371F, 0.1687709041F, 0.1695086050F, 0.1702476372F, 0.1709879978F, 0.1717296843F, 0.1724726938F, 0.1732170237F, 0.1739626711F, 0.1747096335F, 0.1754579079F, 0.1762074916F, 0.1769583819F, 0.1777105760F, 0.1784640710F, 0.1792188642F, 0.1799749529F, 0.1807323340F, 0.1814910049F, 0.1822509628F, 0.1830122046F, 0.1837747277F, 0.1845385292F, 0.1853036062F, 0.1860699558F, 0.1868375751F, 0.1876064613F, 0.1883766114F, 0.1891480226F, 0.1899206919F, 0.1906946164F, 0.1914697932F, 0.1922462194F, 0.1930238919F, 0.1938028079F, 0.1945829643F, 0.1953643583F, 0.1961469868F, 0.1969308468F, 0.1977159353F, 0.1985022494F, 0.1992897859F, 0.2000785420F, 0.2008685145F, 0.2016597005F, 0.2024520968F, 0.2032457005F, 0.2040405084F, 0.2048365175F, 0.2056337247F, 0.2064321269F, 0.2072317211F, 0.2080325041F, 0.2088344727F, 0.2096376240F, 0.2104419547F, 0.2112474618F, 0.2120541420F, 0.2128619923F, 0.2136710094F, 0.2144811902F, 0.2152925315F, 0.2161050301F, 0.2169186829F, 0.2177334866F, 0.2185494381F, 0.2193665340F, 0.2201847712F, 0.2210041465F, 0.2218246565F, 0.2226462981F, 0.2234690680F, 0.2242929629F, 0.2251179796F, 0.2259441147F, 0.2267713650F, 0.2275997272F, 0.2284291979F, 0.2292597739F, 0.2300914518F, 0.2309242283F, 0.2317581001F, 0.2325930638F, 0.2334291160F, 0.2342662534F, 0.2351044727F, 0.2359437703F, 0.2367841431F, 0.2376255875F, 0.2384681001F, 0.2393116776F, 0.2401563165F, 0.2410020134F, 0.2418487649F, 0.2426965675F, 0.2435454178F, 0.2443953122F, 0.2452462474F, 0.2460982199F, 0.2469512262F, 0.2478052628F, 0.2486603262F, 0.2495164129F, 0.2503735194F, 0.2512316421F, 0.2520907776F, 0.2529509222F, 0.2538120726F, 0.2546742250F, 0.2555373760F, 0.2564015219F, 0.2572666593F, 0.2581327845F, 0.2589998939F, 0.2598679840F, 0.2607370510F, 0.2616070916F, 0.2624781019F, 0.2633500783F, 0.2642230173F, 0.2650969152F, 0.2659717684F, 0.2668475731F, 0.2677243257F, 0.2686020226F, 0.2694806601F, 0.2703602344F, 0.2712407419F, 0.2721221789F, 0.2730045417F, 0.2738878265F, 0.2747720297F, 0.2756571474F, 0.2765431760F, 0.2774301117F, 0.2783179508F, 0.2792066895F, 0.2800963240F, 0.2809868505F, 0.2818782654F, 0.2827705647F, 0.2836637447F, 0.2845578016F, 0.2854527315F, 0.2863485307F, 0.2872451953F, 0.2881427215F, 0.2890411055F, 0.2899403433F, 0.2908404312F, 0.2917413654F, 0.2926431418F, 0.2935457567F, 0.2944492061F, 0.2953534863F, 0.2962585932F, 0.2971645230F, 0.2980712717F, 0.2989788356F, 0.2998872105F, 0.3007963927F, 0.3017063781F, 0.3026171629F, 0.3035287430F, 0.3044411145F, 0.3053542736F, 0.3062682161F, 0.3071829381F, 0.3080984356F, 0.3090147047F, 0.3099317413F, 0.3108495414F, 0.3117681011F, 0.3126874163F, 0.3136074830F, 0.3145282972F, 0.3154498548F, 0.3163721517F, 0.3172951841F, 0.3182189477F, 0.3191434385F, 0.3200686525F, 0.3209945856F, 0.3219212336F, 0.3228485927F, 0.3237766585F, 0.3247054271F, 0.3256348943F, 0.3265650560F, 0.3274959081F, 0.3284274465F, 0.3293596671F, 0.3302925657F, 0.3312261382F, 0.3321603804F, 0.3330952882F, 0.3340308574F, 0.3349670838F, 0.3359039634F, 0.3368414919F, 0.3377796651F, 0.3387184789F, 0.3396579290F, 0.3405980113F, 0.3415387216F, 0.3424800556F, 0.3434220091F, 0.3443645779F, 0.3453077578F, 0.3462515446F, 0.3471959340F, 0.3481409217F, 0.3490865036F, 0.3500326754F, 0.3509794328F, 0.3519267715F, 0.3528746873F, 0.3538231759F, 0.3547722330F, 0.3557218544F, 0.3566720357F, 0.3576227727F, 0.3585740610F, 0.3595258964F, 0.3604782745F, 0.3614311910F, 0.3623846417F, 0.3633386221F, 0.3642931280F, 0.3652481549F, 0.3662036987F, 0.3671597548F, 0.3681163191F, 0.3690733870F, 0.3700309544F, 0.3709890167F, 0.3719475696F, 0.3729066089F, 0.3738661299F, 0.3748261285F, 0.3757866002F, 0.3767475406F, 0.3777089453F, 0.3786708100F, 0.3796331302F, 0.3805959014F, 0.3815591194F, 0.3825227796F, 0.3834868777F, 0.3844514093F, 0.3854163698F, 0.3863817549F, 0.3873475601F, 0.3883137810F, 0.3892804131F, 0.3902474521F, 0.3912148933F, 0.3921827325F, 0.3931509650F, 0.3941195865F, 0.3950885925F, 0.3960579785F, 0.3970277400F, 0.3979978725F, 0.3989683716F, 0.3999392328F, 0.4009104516F, 0.4018820234F, 0.4028539438F, 0.4038262084F, 0.4047988125F, 0.4057717516F, 0.4067450214F, 0.4077186172F, 0.4086925345F, 0.4096667688F, 0.4106413155F, 0.4116161703F, 0.4125913284F, 0.4135667854F, 0.4145425368F, 0.4155185780F, 0.4164949044F, 0.4174715116F, 0.4184483949F, 0.4194255498F, 0.4204029718F, 0.4213806563F, 0.4223585987F, 0.4233367946F, 0.4243152392F, 0.4252939281F, 0.4262728566F, 0.4272520202F, 0.4282314144F, 0.4292110345F, 0.4301908760F, 0.4311709343F, 0.4321512047F, 0.4331316828F, 0.4341123639F, 0.4350932435F, 0.4360743168F, 0.4370555794F, 0.4380370267F, 0.4390186540F, 0.4400004567F, 0.4409824303F, 0.4419645701F, 0.4429468716F, 0.4439293300F, 0.4449119409F, 0.4458946996F, 0.4468776014F, 0.4478606418F, 0.4488438162F, 0.4498271199F, 0.4508105483F, 0.4517940967F, 0.4527777607F, 0.4537615355F, 0.4547454165F, 0.4557293991F, 0.4567134786F, 0.4576976505F, 0.4586819101F, 0.4596662527F, 0.4606506738F, 0.4616351687F, 0.4626197328F, 0.4636043614F, 0.4645890499F, 0.4655737936F, 0.4665585880F, 0.4675434284F, 0.4685283101F, 0.4695132286F, 0.4704981791F, 0.4714831570F, 0.4724681577F, 0.4734531766F, 0.4744382089F, 0.4754232501F, 0.4764082956F, 0.4773933406F, 0.4783783806F, 0.4793634108F, 0.4803484267F, 0.4813334237F, 0.4823183969F, 0.4833033419F, 0.4842882540F, 0.4852731285F, 0.4862579608F, 0.4872427462F, 0.4882274802F, 0.4892121580F, 0.4901967751F, 0.4911813267F, 0.4921658083F, 0.4931502151F, 0.4941345427F, 0.4951187863F, 0.4961029412F, 0.4970870029F, 0.4980709667F, 0.4990548280F, 0.5000385822F, 0.5010222245F, 0.5020057505F, 0.5029891553F, 0.5039724345F, 0.5049555834F, 0.5059385973F, 0.5069214716F, 0.5079042018F, 0.5088867831F, 0.5098692110F, 0.5108514808F, 0.5118335879F, 0.5128155277F, 0.5137972956F, 0.5147788869F, 0.5157602971F, 0.5167415215F, 0.5177225555F, 0.5187033945F, 0.5196840339F, 0.5206644692F, 0.5216446956F, 0.5226247086F, 0.5236045035F, 0.5245840759F, 0.5255634211F, 0.5265425344F, 0.5275214114F, 0.5285000474F, 0.5294784378F, 0.5304565781F, 0.5314344637F, 0.5324120899F, 0.5333894522F, 0.5343665461F, 0.5353433670F, 0.5363199102F, 0.5372961713F, 0.5382721457F, 0.5392478287F, 0.5402232159F, 0.5411983027F, 0.5421730845F, 0.5431475569F, 0.5441217151F, 0.5450955548F, 0.5460690714F, 0.5470422602F, 0.5480151169F, 0.5489876368F, 0.5499598155F, 0.5509316484F, 0.5519031310F, 0.5528742587F, 0.5538450271F, 0.5548154317F, 0.5557854680F, 0.5567551314F, 0.5577244174F, 0.5586933216F, 0.5596618395F, 0.5606299665F, 0.5615976983F, 0.5625650302F, 0.5635319580F, 0.5644984770F, 0.5654645828F, 0.5664302709F, 0.5673955370F, 0.5683603765F, 0.5693247850F, 0.5702887580F, 0.5712522912F, 0.5722153800F, 0.5731780200F, 0.5741402069F, 0.5751019362F, 0.5760632034F, 0.5770240042F, 0.5779843341F, 0.5789441889F, 0.5799035639F, 0.5808624549F, 0.5818208575F, 0.5827787673F, 0.5837361800F, 0.5846930910F, 0.5856494961F, 0.5866053910F, 0.5875607712F, 0.5885156324F, 0.5894699703F, 0.5904237804F, 0.5913770586F, 0.5923298004F, 0.5932820016F, 0.5942336578F, 0.5951847646F, 0.5961353179F, 0.5970853132F, 0.5980347464F, 0.5989836131F, 0.5999319090F, 0.6008796298F, 0.6018267713F, 0.6027733292F, 0.6037192993F, 0.6046646773F, 0.6056094589F, 0.6065536400F, 0.6074972162F, 0.6084401833F, 0.6093825372F, 0.6103242736F, 0.6112653884F, 0.6122058772F, 0.6131457359F, 0.6140849604F, 0.6150235464F, 0.6159614897F, 0.6168987862F, 0.6178354318F, 0.6187714223F, 0.6197067535F, 0.6206414213F, 0.6215754215F, 0.6225087501F, 0.6234414028F, 0.6243733757F, 0.6253046646F, 0.6262352654F, 0.6271651739F, 0.6280943862F, 0.6290228982F, 0.6299507057F, 0.6308778048F, 0.6318041913F, 0.6327298612F, 0.6336548105F, 0.6345790352F, 0.6355025312F, 0.6364252945F, 0.6373473211F, 0.6382686070F, 0.6391891483F, 0.6401089409F, 0.6410279808F, 0.6419462642F, 0.6428637869F, 0.6437805452F, 0.6446965350F, 0.6456117524F, 0.6465261935F, 0.6474398544F, 0.6483527311F, 0.6492648197F, 0.6501761165F, 0.6510866174F, 0.6519963186F, 0.6529052162F, 0.6538133064F, 0.6547205854F, 0.6556270492F, 0.6565326941F, 0.6574375162F, 0.6583415117F, 0.6592446769F, 0.6601470079F, 0.6610485009F, 0.6619491521F, 0.6628489578F, 0.6637479143F, 0.6646460177F, 0.6655432643F, 0.6664396505F, 0.6673351724F, 0.6682298264F, 0.6691236087F, 0.6700165157F, 0.6709085436F, 0.6717996889F, 0.6726899478F, 0.6735793167F, 0.6744677918F, 0.6753553697F, 0.6762420466F, 0.6771278190F, 0.6780126832F, 0.6788966357F, 0.6797796728F, 0.6806617909F, 0.6815429866F, 0.6824232562F, 0.6833025961F, 0.6841810030F, 0.6850584731F, 0.6859350031F, 0.6868105894F, 0.6876852284F, 0.6885589168F, 0.6894316510F, 0.6903034275F, 0.6911742430F, 0.6920440939F, 0.6929129769F, 0.6937808884F, 0.6946478251F, 0.6955137837F, 0.6963787606F, 0.6972427525F, 0.6981057560F, 0.6989677678F, 0.6998287845F, 0.7006888028F, 0.7015478194F, 0.7024058309F, 0.7032628340F, 0.7041188254F, 0.7049738019F, 0.7058277601F, 0.7066806969F, 0.7075326089F, 0.7083834929F, 0.7092333457F, 0.7100821640F, 0.7109299447F, 0.7117766846F, 0.7126223804F, 0.7134670291F, 0.7143106273F, 0.7151531721F, 0.7159946602F, 0.7168350885F, 0.7176744539F, 0.7185127534F, 0.7193499837F, 0.7201861418F, 0.7210212247F, 0.7218552293F, 0.7226881526F, 0.7235199914F, 0.7243507428F, 0.7251804039F, 0.7260089715F, 0.7268364426F, 0.7276628144F, 0.7284880839F, 0.7293122481F, 0.7301353040F, 0.7309572487F, 0.7317780794F, 0.7325977930F, 0.7334163868F, 0.7342338579F, 0.7350502033F, 0.7358654202F, 0.7366795059F, 0.7374924573F, 0.7383042718F, 0.7391149465F, 0.7399244787F, 0.7407328655F, 0.7415401041F, 0.7423461920F, 0.7431511261F, 0.7439549040F, 0.7447575227F, 0.7455589797F, 0.7463592723F, 0.7471583976F, 0.7479563532F, 0.7487531363F, 0.7495487443F, 0.7503431745F, 0.7511364244F, 0.7519284913F, 0.7527193726F, 0.7535090658F, 0.7542975683F, 0.7550848776F, 0.7558709910F, 0.7566559062F, 0.7574396205F, 0.7582221314F, 0.7590034366F, 0.7597835334F, 0.7605624194F, 0.7613400923F, 0.7621165495F, 0.7628917886F, 0.7636658072F, 0.7644386030F, 0.7652101735F, 0.7659805164F, 0.7667496292F, 0.7675175098F, 0.7682841556F, 0.7690495645F, 0.7698137341F, 0.7705766622F, 0.7713383463F, 0.7720987844F, 0.7728579741F, 0.7736159132F, 0.7743725994F, 0.7751280306F, 0.7758822046F, 0.7766351192F, 0.7773867722F, 0.7781371614F, 0.7788862848F, 0.7796341401F, 0.7803807253F, 0.7811260383F, 0.7818700769F, 0.7826128392F, 0.7833543230F, 0.7840945263F, 0.7848334471F, 0.7855710833F, 0.7863074330F, 0.7870424941F, 0.7877762647F, 0.7885087428F, 0.7892399264F, 0.7899698137F, 0.7906984026F, 0.7914256914F, 0.7921516780F, 0.7928763607F, 0.7935997375F, 0.7943218065F, 0.7950425661F, 0.7957620142F, 0.7964801492F, 0.7971969692F, 0.7979124724F, 0.7986266570F, 0.7993395214F, 0.8000510638F, 0.8007612823F, 0.8014701754F, 0.8021777413F, 0.8028839784F, 0.8035888849F, 0.8042924592F, 0.8049946997F, 0.8056956048F, 0.8063951727F, 0.8070934020F, 0.8077902910F, 0.8084858381F, 0.8091800419F, 0.8098729007F, 0.8105644130F, 0.8112545774F, 0.8119433922F, 0.8126308561F, 0.8133169676F, 0.8140017251F, 0.8146851272F, 0.8153671726F, 0.8160478598F, 0.8167271874F, 0.8174051539F, 0.8180817582F, 0.8187569986F, 0.8194308741F, 0.8201033831F, 0.8207745244F, 0.8214442966F, 0.8221126986F, 0.8227797290F, 0.8234453865F, 0.8241096700F, 0.8247725781F, 0.8254341097F, 0.8260942636F, 0.8267530385F, 0.8274104334F, 0.8280664470F, 0.8287210782F, 0.8293743259F, 0.8300261889F, 0.8306766662F, 0.8313257566F, 0.8319734591F, 0.8326197727F, 0.8332646963F, 0.8339082288F, 0.8345503692F, 0.8351911167F, 0.8358304700F, 0.8364684284F, 0.8371049907F, 0.8377401562F, 0.8383739238F, 0.8390062927F, 0.8396372618F, 0.8402668305F, 0.8408949977F, 0.8415217626F, 0.8421471245F, 0.8427710823F, 0.8433936354F, 0.8440147830F, 0.8446345242F, 0.8452528582F, 0.8458697844F, 0.8464853020F, 0.8470994102F, 0.8477121084F, 0.8483233958F, 0.8489332718F, 0.8495417356F, 0.8501487866F, 0.8507544243F, 0.8513586479F, 0.8519614568F, 0.8525628505F, 0.8531628283F, 0.8537613897F, 0.8543585341F, 0.8549542611F, 0.8555485699F, 0.8561414603F, 0.8567329315F, 0.8573229832F, 0.8579116149F, 0.8584988262F, 0.8590846165F, 0.8596689855F, 0.8602519327F, 0.8608334577F, 0.8614135603F, 0.8619922399F, 0.8625694962F, 0.8631453289F, 0.8637197377F, 0.8642927222F, 0.8648642821F, 0.8654344172F, 0.8660031272F, 0.8665704118F, 0.8671362708F, 0.8677007039F, 0.8682637109F, 0.8688252917F, 0.8693854460F, 0.8699441737F, 0.8705014745F, 0.8710573485F, 0.8716117953F, 0.8721648150F, 0.8727164073F, 0.8732665723F, 0.8738153098F, 0.8743626197F, 0.8749085021F, 0.8754529569F, 0.8759959840F, 0.8765375835F, 0.8770777553F, 0.8776164996F, 0.8781538162F, 0.8786897054F, 0.8792241670F, 0.8797572013F, 0.8802888082F, 0.8808189880F, 0.8813477407F, 0.8818750664F, 0.8824009653F, 0.8829254375F, 0.8834484833F, 0.8839701028F, 0.8844902961F, 0.8850090636F, 0.8855264054F, 0.8860423218F, 0.8865568131F, 0.8870698794F, 0.8875815212F, 0.8880917386F, 0.8886005319F, 0.8891079016F, 0.8896138479F, 0.8901183712F, 0.8906214719F, 0.8911231503F, 0.8916234067F, 0.8921222417F, 0.8926196556F, 0.8931156489F, 0.8936102219F, 0.8941033752F, 0.8945951092F, 0.8950854244F, 0.8955743212F, 0.8960618003F, 0.8965478621F, 0.8970325071F, 0.8975157359F, 0.8979975490F, 0.8984779471F, 0.8989569307F, 0.8994345004F, 0.8999106568F, 0.9003854005F, 0.9008587323F, 0.9013306526F, 0.9018011623F, 0.9022702619F, 0.9027379521F, 0.9032042337F, 0.9036691074F, 0.9041325739F, 0.9045946339F, 0.9050552882F, 0.9055145376F, 0.9059723828F, 0.9064288246F, 0.9068838638F, 0.9073375013F, 0.9077897379F, 0.9082405743F, 0.9086900115F, 0.9091380503F, 0.9095846917F, 0.9100299364F, 0.9104737854F, 0.9109162397F, 0.9113573001F, 0.9117969675F, 0.9122352430F, 0.9126721275F, 0.9131076219F, 0.9135417273F, 0.9139744447F, 0.9144057750F, 0.9148357194F, 0.9152642787F, 0.9156914542F, 0.9161172468F, 0.9165416576F, 0.9169646877F, 0.9173863382F, 0.9178066102F, 0.9182255048F, 0.9186430232F, 0.9190591665F, 0.9194739359F, 0.9198873324F, 0.9202993574F, 0.9207100120F, 0.9211192973F, 0.9215272147F, 0.9219337653F, 0.9223389504F, 0.9227427713F, 0.9231452290F, 0.9235463251F, 0.9239460607F, 0.9243444371F, 0.9247414557F, 0.9251371177F, 0.9255314245F, 0.9259243774F, 0.9263159778F, 0.9267062270F, 0.9270951264F, 0.9274826774F, 0.9278688814F, 0.9282537398F, 0.9286372540F, 0.9290194254F, 0.9294002555F, 0.9297797458F, 0.9301578976F, 0.9305347125F, 0.9309101919F, 0.9312843373F, 0.9316571503F, 0.9320286323F, 0.9323987849F, 0.9327676097F, 0.9331351080F, 0.9335012816F, 0.9338661320F, 0.9342296607F, 0.9345918694F, 0.9349527596F, 0.9353123330F, 0.9356705911F, 0.9360275357F, 0.9363831683F, 0.9367374905F, 0.9370905042F, 0.9374422108F, 0.9377926122F, 0.9381417099F, 0.9384895057F, 0.9388360014F, 0.9391811985F, 0.9395250989F, 0.9398677043F, 0.9402090165F, 0.9405490371F, 0.9408877680F, 0.9412252110F, 0.9415613678F, 0.9418962402F, 0.9422298301F, 0.9425621392F, 0.9428931695F, 0.9432229226F, 0.9435514005F, 0.9438786050F, 0.9442045381F, 0.9445292014F, 0.9448525971F, 0.9451747268F, 0.9454955926F, 0.9458151963F, 0.9461335399F, 0.9464506253F, 0.9467664545F, 0.9470810293F, 0.9473943517F, 0.9477064238F, 0.9480172474F, 0.9483268246F, 0.9486351573F, 0.9489422475F, 0.9492480973F, 0.9495527087F, 0.9498560837F, 0.9501582243F, 0.9504591325F, 0.9507588105F, 0.9510572603F, 0.9513544839F, 0.9516504834F, 0.9519452609F, 0.9522388186F, 0.9525311584F, 0.9528222826F, 0.9531121932F, 0.9534008923F, 0.9536883821F, 0.9539746647F, 0.9542597424F, 0.9545436171F, 0.9548262912F, 0.9551077667F, 0.9553880459F, 0.9556671309F, 0.9559450239F, 0.9562217272F, 0.9564972429F, 0.9567715733F, 0.9570447206F, 0.9573166871F, 0.9575874749F, 0.9578570863F, 0.9581255236F, 0.9583927890F, 0.9586588849F, 0.9589238134F, 0.9591875769F, 0.9594501777F, 0.9597116180F, 0.9599719003F, 0.9602310267F, 0.9604889995F, 0.9607458213F, 0.9610014942F, 0.9612560206F, 0.9615094028F, 0.9617616433F, 0.9620127443F, 0.9622627083F, 0.9625115376F, 0.9627592345F, 0.9630058016F, 0.9632512411F, 0.9634955555F, 0.9637387471F, 0.9639808185F, 0.9642217720F, 0.9644616100F, 0.9647003349F, 0.9649379493F, 0.9651744556F, 0.9654098561F, 0.9656441534F, 0.9658773499F, 0.9661094480F, 0.9663404504F, 0.9665703593F, 0.9667991774F, 0.9670269071F, 0.9672535509F, 0.9674791114F, 0.9677035909F, 0.9679269921F, 0.9681493174F, 0.9683705694F, 0.9685907506F, 0.9688098636F, 0.9690279108F, 0.9692448948F, 0.9694608182F, 0.9696756836F, 0.9698894934F, 0.9701022503F, 0.9703139569F, 0.9705246156F, 0.9707342291F, 0.9709428000F, 0.9711503309F, 0.9713568243F, 0.9715622829F, 0.9717667093F, 0.9719701060F, 0.9721724757F, 0.9723738210F, 0.9725741446F, 0.9727734490F, 0.9729717369F, 0.9731690109F, 0.9733652737F, 0.9735605279F, 0.9737547762F, 0.9739480212F, 0.9741402656F, 0.9743315120F, 0.9745217631F, 0.9747110216F, 0.9748992901F, 0.9750865714F, 0.9752728681F, 0.9754581829F, 0.9756425184F, 0.9758258775F, 0.9760082627F, 0.9761896768F, 0.9763701224F, 0.9765496024F, 0.9767281193F, 0.9769056760F, 0.9770822751F, 0.9772579193F, 0.9774326114F, 0.9776063542F, 0.9777791502F, 0.9779510023F, 0.9781219133F, 0.9782918858F, 0.9784609226F, 0.9786290264F, 0.9787962000F, 0.9789624461F, 0.9791277676F, 0.9792921671F, 0.9794556474F, 0.9796182113F, 0.9797798615F, 0.9799406009F, 0.9801004321F, 0.9802593580F, 0.9804173813F, 0.9805745049F, 0.9807307314F, 0.9808860637F, 0.9810405046F, 0.9811940568F, 0.9813467232F, 0.9814985065F, 0.9816494095F, 0.9817994351F, 0.9819485860F, 0.9820968650F, 0.9822442750F, 0.9823908186F, 0.9825364988F, 0.9826813184F, 0.9828252801F, 0.9829683868F, 0.9831106413F, 0.9832520463F, 0.9833926048F, 0.9835323195F, 0.9836711932F, 0.9838092288F, 0.9839464291F, 0.9840827969F, 0.9842183351F, 0.9843530464F, 0.9844869337F, 0.9846199998F, 0.9847522475F, 0.9848836798F, 0.9850142993F, 0.9851441090F, 0.9852731117F, 0.9854013101F, 0.9855287073F, 0.9856553058F, 0.9857811087F, 0.9859061188F, 0.9860303388F, 0.9861537717F, 0.9862764202F, 0.9863982872F, 0.9865193756F, 0.9866396882F, 0.9867592277F, 0.9868779972F, 0.9869959993F, 0.9871132370F, 0.9872297131F, 0.9873454304F, 0.9874603918F, 0.9875746001F, 0.9876880581F, 0.9878007688F, 0.9879127348F, 0.9880239592F, 0.9881344447F, 0.9882441941F, 0.9883532104F, 0.9884614962F, 0.9885690546F, 0.9886758883F, 0.9887820001F, 0.9888873930F, 0.9889920697F, 0.9890960331F, 0.9891992859F, 0.9893018312F, 0.9894036716F, 0.9895048100F, 0.9896052493F, 0.9897049923F, 0.9898040418F, 0.9899024006F, 0.9900000717F, 0.9900970577F, 0.9901933616F, 0.9902889862F, 0.9903839343F, 0.9904782087F, 0.9905718122F, 0.9906647477F, 0.9907570180F, 0.9908486259F, 0.9909395742F, 0.9910298658F, 0.9911195034F, 0.9912084899F, 0.9912968281F, 0.9913845208F, 0.9914715708F, 0.9915579810F, 0.9916437540F, 0.9917288928F, 0.9918134001F, 0.9918972788F, 0.9919805316F, 0.9920631613F, 0.9921451707F, 0.9922265626F, 0.9923073399F, 0.9923875052F, 0.9924670615F, 0.9925460114F, 0.9926243577F, 0.9927021033F, 0.9927792508F, 0.9928558032F, 0.9929317631F, 0.9930071333F, 0.9930819167F, 0.9931561158F, 0.9932297337F, 0.9933027728F, 0.9933752362F, 0.9934471264F, 0.9935184462F, 0.9935891985F, 0.9936593859F, 0.9937290112F, 0.9937980771F, 0.9938665864F, 0.9939345418F, 0.9940019460F, 0.9940688018F, 0.9941351118F, 0.9942008789F, 0.9942661057F, 0.9943307950F, 0.9943949494F, 0.9944585717F, 0.9945216645F, 0.9945842307F, 0.9946462728F, 0.9947077936F, 0.9947687957F, 0.9948292820F, 0.9948892550F, 0.9949487174F, 0.9950076719F, 0.9950661212F, 0.9951240679F, 0.9951815148F, 0.9952384645F, 0.9952949196F, 0.9953508828F, 0.9954063568F, 0.9954613442F, 0.9955158476F, 0.9955698697F, 0.9956234132F, 0.9956764806F, 0.9957290746F, 0.9957811978F, 0.9958328528F, 0.9958840423F, 0.9959347688F, 0.9959850351F, 0.9960348435F, 0.9960841969F, 0.9961330977F, 0.9961815486F, 0.9962295521F, 0.9962771108F, 0.9963242274F, 0.9963709043F, 0.9964171441F, 0.9964629494F, 0.9965083228F, 0.9965532668F, 0.9965977840F, 0.9966418768F, 0.9966855479F, 0.9967287998F, 0.9967716350F, 0.9968140559F, 0.9968560653F, 0.9968976655F, 0.9969388591F, 0.9969796485F, 0.9970200363F, 0.9970600250F, 0.9970996170F, 0.9971388149F, 0.9971776211F, 0.9972160380F, 0.9972540683F, 0.9972917142F, 0.9973289783F, 0.9973658631F, 0.9974023709F, 0.9974385042F, 0.9974742655F, 0.9975096571F, 0.9975446816F, 0.9975793413F, 0.9976136386F, 0.9976475759F, 0.9976811557F, 0.9977143803F, 0.9977472521F, 0.9977797736F, 0.9978119470F, 0.9978437748F, 0.9978752593F, 0.9979064029F, 0.9979372079F, 0.9979676768F, 0.9979978117F, 0.9980276151F, 0.9980570893F, 0.9980862367F, 0.9981150595F, 0.9981435600F, 0.9981717406F, 0.9981996035F, 0.9982271511F, 0.9982543856F, 0.9982813093F, 0.9983079246F, 0.9983342336F, 0.9983602386F, 0.9983859418F, 0.9984113456F, 0.9984364522F, 0.9984612638F, 0.9984857825F, 0.9985100108F, 0.9985339507F, 0.9985576044F, 0.9985809743F, 0.9986040624F, 0.9986268710F, 0.9986494022F, 0.9986716583F, 0.9986936413F, 0.9987153535F, 0.9987367969F, 0.9987579738F, 0.9987788864F, 0.9987995366F, 0.9988199267F, 0.9988400587F, 0.9988599348F, 0.9988795572F, 0.9988989278F, 0.9989180487F, 0.9989369222F, 0.9989555501F, 0.9989739347F, 0.9989920780F, 0.9990099820F, 0.9990276487F, 0.9990450803F, 0.9990622787F, 0.9990792460F, 0.9990959841F, 0.9991124952F, 0.9991287812F, 0.9991448440F, 0.9991606858F, 0.9991763084F, 0.9991917139F, 0.9992069042F, 0.9992218813F, 0.9992366471F, 0.9992512035F, 0.9992655525F, 0.9992796961F, 0.9992936361F, 0.9993073744F, 0.9993209131F, 0.9993342538F, 0.9993473987F, 0.9993603494F, 0.9993731080F, 0.9993856762F, 0.9993980559F, 0.9994102490F, 0.9994222573F, 0.9994340827F, 0.9994457269F, 0.9994571918F, 0.9994684793F, 0.9994795910F, 0.9994905288F, 0.9995012945F, 0.9995118898F, 0.9995223165F, 0.9995325765F, 0.9995426713F, 0.9995526029F, 0.9995623728F, 0.9995719829F, 0.9995814349F, 0.9995907304F, 0.9995998712F, 0.9996088590F, 0.9996176954F, 0.9996263821F, 0.9996349208F, 0.9996433132F, 0.9996515609F, 0.9996596656F, 0.9996676288F, 0.9996754522F, 0.9996831375F, 0.9996906862F, 0.9996981000F, 0.9997053804F, 0.9997125290F, 0.9997195474F, 0.9997264371F, 0.9997331998F, 0.9997398369F, 0.9997463500F, 0.9997527406F, 0.9997590103F, 0.9997651606F, 0.9997711930F, 0.9997771089F, 0.9997829098F, 0.9997885973F, 0.9997941728F, 0.9997996378F, 0.9998049936F, 0.9998102419F, 0.9998153839F, 0.9998204211F, 0.9998253550F, 0.9998301868F, 0.9998349182F, 0.9998395503F, 0.9998440847F, 0.9998485226F, 0.9998528654F, 0.9998571146F, 0.9998612713F, 0.9998653370F, 0.9998693130F, 0.9998732007F, 0.9998770012F, 0.9998807159F, 0.9998843461F, 0.9998878931F, 0.9998913581F, 0.9998947424F, 0.9998980473F, 0.9999012740F, 0.9999044237F, 0.9999074976F, 0.9999104971F, 0.9999134231F, 0.9999162771F, 0.9999190601F, 0.9999217733F, 0.9999244179F, 0.9999269950F, 0.9999295058F, 0.9999319515F, 0.9999343332F, 0.9999366519F, 0.9999389088F, 0.9999411050F, 0.9999432416F, 0.9999453196F, 0.9999473402F, 0.9999493044F, 0.9999512132F, 0.9999530677F, 0.9999548690F, 0.9999566180F, 0.9999583157F, 0.9999599633F, 0.9999615616F, 0.9999631116F, 0.9999646144F, 0.9999660709F, 0.9999674820F, 0.9999688487F, 0.9999701719F, 0.9999714526F, 0.9999726917F, 0.9999738900F, 0.9999750486F, 0.9999761682F, 0.9999772497F, 0.9999782941F, 0.9999793021F, 0.9999802747F, 0.9999812126F, 0.9999821167F, 0.9999829878F, 0.9999838268F, 0.9999846343F, 0.9999854113F, 0.9999861584F, 0.9999868765F, 0.9999875664F, 0.9999882287F, 0.9999888642F, 0.9999894736F, 0.9999900577F, 0.9999906172F, 0.9999911528F, 0.9999916651F, 0.9999921548F, 0.9999926227F, 0.9999930693F, 0.9999934954F, 0.9999939015F, 0.9999942883F, 0.9999946564F, 0.9999950064F, 0.9999953390F, 0.9999956547F, 0.9999959541F, 0.9999962377F, 0.9999965062F, 0.9999967601F, 0.9999969998F, 0.9999972260F, 0.9999974392F, 0.9999976399F, 0.9999978285F, 0.9999980056F, 0.9999981716F, 0.9999983271F, 0.9999984724F, 0.9999986081F, 0.9999987345F, 0.9999988521F, 0.9999989613F, 0.9999990625F, 0.9999991562F, 0.9999992426F, 0.9999993223F, 0.9999993954F, 0.9999994625F, 0.9999995239F, 0.9999995798F, 0.9999996307F, 0.9999996768F, 0.9999997184F, 0.9999997559F, 0.9999997895F, 0.9999998195F, 0.9999998462F, 0.9999998698F, 0.9999998906F, 0.9999999088F, 0.9999999246F, 0.9999999383F, 0.9999999500F, 0.9999999600F, 0.9999999684F, 0.9999999754F, 0.9999999811F, 0.9999999858F, 0.9999999896F, 0.9999999925F, 0.9999999948F, 0.9999999965F, 0.9999999978F, 0.9999999986F, 0.9999999992F, 0.9999999996F, 0.9999999998F, 0.9999999999F, 1.0000000000F, 1.0000000000F, 1.0000000000F, }; DECLARE_ALIGNED(16, static const float, vwin8192)[4096] = { 0.0000000578F, 0.0000005198F, 0.0000014438F, 0.0000028299F, 0.0000046780F, 0.0000069882F, 0.0000097604F, 0.0000129945F, 0.0000166908F, 0.0000208490F, 0.0000254692F, 0.0000305515F, 0.0000360958F, 0.0000421021F, 0.0000485704F, 0.0000555006F, 0.0000628929F, 0.0000707472F, 0.0000790635F, 0.0000878417F, 0.0000970820F, 0.0001067842F, 0.0001169483F, 0.0001275744F, 0.0001386625F, 0.0001502126F, 0.0001622245F, 0.0001746984F, 0.0001876343F, 0.0002010320F, 0.0002148917F, 0.0002292132F, 0.0002439967F, 0.0002592421F, 0.0002749493F, 0.0002911184F, 0.0003077493F, 0.0003248421F, 0.0003423967F, 0.0003604132F, 0.0003788915F, 0.0003978316F, 0.0004172335F, 0.0004370971F, 0.0004574226F, 0.0004782098F, 0.0004994587F, 0.0005211694F, 0.0005433418F, 0.0005659759F, 0.0005890717F, 0.0006126292F, 0.0006366484F, 0.0006611292F, 0.0006860716F, 0.0007114757F, 0.0007373414F, 0.0007636687F, 0.0007904576F, 0.0008177080F, 0.0008454200F, 0.0008735935F, 0.0009022285F, 0.0009313250F, 0.0009608830F, 0.0009909025F, 0.0010213834F, 0.0010523257F, 0.0010837295F, 0.0011155946F, 0.0011479211F, 0.0011807090F, 0.0012139582F, 0.0012476687F, 0.0012818405F, 0.0013164736F, 0.0013515679F, 0.0013871235F, 0.0014231402F, 0.0014596182F, 0.0014965573F, 0.0015339576F, 0.0015718190F, 0.0016101415F, 0.0016489251F, 0.0016881698F, 0.0017278754F, 0.0017680421F, 0.0018086698F, 0.0018497584F, 0.0018913080F, 0.0019333185F, 0.0019757898F, 0.0020187221F, 0.0020621151F, 0.0021059690F, 0.0021502837F, 0.0021950591F, 0.0022402953F, 0.0022859921F, 0.0023321497F, 0.0023787679F, 0.0024258467F, 0.0024733861F, 0.0025213861F, 0.0025698466F, 0.0026187676F, 0.0026681491F, 0.0027179911F, 0.0027682935F, 0.0028190562F, 0.0028702794F, 0.0029219628F, 0.0029741066F, 0.0030267107F, 0.0030797749F, 0.0031332994F, 0.0031872841F, 0.0032417289F, 0.0032966338F, 0.0033519988F, 0.0034078238F, 0.0034641089F, 0.0035208539F, 0.0035780589F, 0.0036357237F, 0.0036938485F, 0.0037524331F, 0.0038114775F, 0.0038709817F, 0.0039309456F, 0.0039913692F, 0.0040522524F, 0.0041135953F, 0.0041753978F, 0.0042376599F, 0.0043003814F, 0.0043635624F, 0.0044272029F, 0.0044913028F, 0.0045558620F, 0.0046208806F, 0.0046863585F, 0.0047522955F, 0.0048186919F, 0.0048855473F, 0.0049528619F, 0.0050206356F, 0.0050888684F, 0.0051575601F, 0.0052267108F, 0.0052963204F, 0.0053663890F, 0.0054369163F, 0.0055079025F, 0.0055793474F, 0.0056512510F, 0.0057236133F, 0.0057964342F, 0.0058697137F, 0.0059434517F, 0.0060176482F, 0.0060923032F, 0.0061674166F, 0.0062429883F, 0.0063190183F, 0.0063955066F, 0.0064724532F, 0.0065498579F, 0.0066277207F, 0.0067060416F, 0.0067848205F, 0.0068640575F, 0.0069437523F, 0.0070239051F, 0.0071045157F, 0.0071855840F, 0.0072671102F, 0.0073490940F, 0.0074315355F, 0.0075144345F, 0.0075977911F, 0.0076816052F, 0.0077658768F, 0.0078506057F, 0.0079357920F, 0.0080214355F, 0.0081075363F, 0.0081940943F, 0.0082811094F, 0.0083685816F, 0.0084565108F, 0.0085448970F, 0.0086337401F, 0.0087230401F, 0.0088127969F, 0.0089030104F, 0.0089936807F, 0.0090848076F, 0.0091763911F, 0.0092684311F, 0.0093609276F, 0.0094538805F, 0.0095472898F, 0.0096411554F, 0.0097354772F, 0.0098302552F, 0.0099254894F, 0.0100211796F, 0.0101173259F, 0.0102139281F, 0.0103109863F, 0.0104085002F, 0.0105064700F, 0.0106048955F, 0.0107037766F, 0.0108031133F, 0.0109029056F, 0.0110031534F, 0.0111038565F, 0.0112050151F, 0.0113066289F, 0.0114086980F, 0.0115112222F, 0.0116142015F, 0.0117176359F, 0.0118215252F, 0.0119258695F, 0.0120306686F, 0.0121359225F, 0.0122416312F, 0.0123477944F, 0.0124544123F, 0.0125614847F, 0.0126690116F, 0.0127769928F, 0.0128854284F, 0.0129943182F, 0.0131036623F, 0.0132134604F, 0.0133237126F, 0.0134344188F, 0.0135455790F, 0.0136571929F, 0.0137692607F, 0.0138817821F, 0.0139947572F, 0.0141081859F, 0.0142220681F, 0.0143364037F, 0.0144511927F, 0.0145664350F, 0.0146821304F, 0.0147982791F, 0.0149148808F, 0.0150319355F, 0.0151494431F, 0.0152674036F, 0.0153858168F, 0.0155046828F, 0.0156240014F, 0.0157437726F, 0.0158639962F, 0.0159846723F, 0.0161058007F, 0.0162273814F, 0.0163494142F, 0.0164718991F, 0.0165948361F, 0.0167182250F, 0.0168420658F, 0.0169663584F, 0.0170911027F, 0.0172162987F, 0.0173419462F, 0.0174680452F, 0.0175945956F, 0.0177215974F, 0.0178490504F, 0.0179769545F, 0.0181053098F, 0.0182341160F, 0.0183633732F, 0.0184930812F, 0.0186232399F, 0.0187538494F, 0.0188849094F, 0.0190164200F, 0.0191483809F, 0.0192807923F, 0.0194136539F, 0.0195469656F, 0.0196807275F, 0.0198149394F, 0.0199496012F, 0.0200847128F, 0.0202202742F, 0.0203562853F, 0.0204927460F, 0.0206296561F, 0.0207670157F, 0.0209048245F, 0.0210430826F, 0.0211817899F, 0.0213209462F, 0.0214605515F, 0.0216006057F, 0.0217411086F, 0.0218820603F, 0.0220234605F, 0.0221653093F, 0.0223076066F, 0.0224503521F, 0.0225935459F, 0.0227371879F, 0.0228812779F, 0.0230258160F, 0.0231708018F, 0.0233162355F, 0.0234621169F, 0.0236084459F, 0.0237552224F, 0.0239024462F, 0.0240501175F, 0.0241982359F, 0.0243468015F, 0.0244958141F, 0.0246452736F, 0.0247951800F, 0.0249455331F, 0.0250963329F, 0.0252475792F, 0.0253992720F, 0.0255514111F, 0.0257039965F, 0.0258570281F, 0.0260105057F, 0.0261644293F, 0.0263187987F, 0.0264736139F, 0.0266288747F, 0.0267845811F, 0.0269407330F, 0.0270973302F, 0.0272543727F, 0.0274118604F, 0.0275697930F, 0.0277281707F, 0.0278869932F, 0.0280462604F, 0.0282059723F, 0.0283661287F, 0.0285267295F, 0.0286877747F, 0.0288492641F, 0.0290111976F, 0.0291735751F, 0.0293363965F, 0.0294996617F, 0.0296633706F, 0.0298275231F, 0.0299921190F, 0.0301571583F, 0.0303226409F, 0.0304885667F, 0.0306549354F, 0.0308217472F, 0.0309890017F, 0.0311566989F, 0.0313248388F, 0.0314934211F, 0.0316624459F, 0.0318319128F, 0.0320018220F, 0.0321721732F, 0.0323429663F, 0.0325142013F, 0.0326858779F, 0.0328579962F, 0.0330305559F, 0.0332035570F, 0.0333769994F, 0.0335508829F, 0.0337252074F, 0.0338999728F, 0.0340751790F, 0.0342508259F, 0.0344269134F, 0.0346034412F, 0.0347804094F, 0.0349578178F, 0.0351356663F, 0.0353139548F, 0.0354926831F, 0.0356718511F, 0.0358514588F, 0.0360315059F, 0.0362119924F, 0.0363929182F, 0.0365742831F, 0.0367560870F, 0.0369383297F, 0.0371210113F, 0.0373041315F, 0.0374876902F, 0.0376716873F, 0.0378561226F, 0.0380409961F, 0.0382263077F, 0.0384120571F, 0.0385982443F, 0.0387848691F, 0.0389719315F, 0.0391594313F, 0.0393473683F, 0.0395357425F, 0.0397245537F, 0.0399138017F, 0.0401034866F, 0.0402936080F, 0.0404841660F, 0.0406751603F, 0.0408665909F, 0.0410584576F, 0.0412507603F, 0.0414434988F, 0.0416366731F, 0.0418302829F, 0.0420243282F, 0.0422188088F, 0.0424137246F, 0.0426090755F, 0.0428048613F, 0.0430010819F, 0.0431977371F, 0.0433948269F, 0.0435923511F, 0.0437903095F, 0.0439887020F, 0.0441875285F, 0.0443867889F, 0.0445864830F, 0.0447866106F, 0.0449871717F, 0.0451881661F, 0.0453895936F, 0.0455914542F, 0.0457937477F, 0.0459964738F, 0.0461996326F, 0.0464032239F, 0.0466072475F, 0.0468117032F, 0.0470165910F, 0.0472219107F, 0.0474276622F, 0.0476338452F, 0.0478404597F, 0.0480475056F, 0.0482549827F, 0.0484628907F, 0.0486712297F, 0.0488799994F, 0.0490891998F, 0.0492988306F, 0.0495088917F, 0.0497193830F, 0.0499303043F, 0.0501416554F, 0.0503534363F, 0.0505656468F, 0.0507782867F, 0.0509913559F, 0.0512048542F, 0.0514187815F, 0.0516331376F, 0.0518479225F, 0.0520631358F, 0.0522787775F, 0.0524948475F, 0.0527113455F, 0.0529282715F, 0.0531456252F, 0.0533634066F, 0.0535816154F, 0.0538002515F, 0.0540193148F, 0.0542388051F, 0.0544587222F, 0.0546790660F, 0.0548998364F, 0.0551210331F, 0.0553426561F, 0.0555647051F, 0.0557871801F, 0.0560100807F, 0.0562334070F, 0.0564571587F, 0.0566813357F, 0.0569059378F, 0.0571309649F, 0.0573564168F, 0.0575822933F, 0.0578085942F, 0.0580353195F, 0.0582624689F, 0.0584900423F, 0.0587180396F, 0.0589464605F, 0.0591753049F, 0.0594045726F, 0.0596342635F, 0.0598643774F, 0.0600949141F, 0.0603258735F, 0.0605572555F, 0.0607890597F, 0.0610212862F, 0.0612539346F, 0.0614870049F, 0.0617204968F, 0.0619544103F, 0.0621887451F, 0.0624235010F, 0.0626586780F, 0.0628942758F, 0.0631302942F, 0.0633667331F, 0.0636035923F, 0.0638408717F, 0.0640785710F, 0.0643166901F, 0.0645552288F, 0.0647941870F, 0.0650335645F, 0.0652733610F, 0.0655135765F, 0.0657542108F, 0.0659952636F, 0.0662367348F, 0.0664786242F, 0.0667209316F, 0.0669636570F, 0.0672068000F, 0.0674503605F, 0.0676943384F, 0.0679387334F, 0.0681835454F, 0.0684287742F, 0.0686744196F, 0.0689204814F, 0.0691669595F, 0.0694138536F, 0.0696611637F, 0.0699088894F, 0.0701570307F, 0.0704055873F, 0.0706545590F, 0.0709039458F, 0.0711537473F, 0.0714039634F, 0.0716545939F, 0.0719056387F, 0.0721570975F, 0.0724089702F, 0.0726612565F, 0.0729139563F, 0.0731670694F, 0.0734205956F, 0.0736745347F, 0.0739288866F, 0.0741836510F, 0.0744388277F, 0.0746944166F, 0.0749504175F, 0.0752068301F, 0.0754636543F, 0.0757208899F, 0.0759785367F, 0.0762365946F, 0.0764950632F, 0.0767539424F, 0.0770132320F, 0.0772729319F, 0.0775330418F, 0.0777935616F, 0.0780544909F, 0.0783158298F, 0.0785775778F, 0.0788397349F, 0.0791023009F, 0.0793652755F, 0.0796286585F, 0.0798924498F, 0.0801566492F, 0.0804212564F, 0.0806862712F, 0.0809516935F, 0.0812175231F, 0.0814837597F, 0.0817504031F, 0.0820174532F, 0.0822849097F, 0.0825527724F, 0.0828210412F, 0.0830897158F, 0.0833587960F, 0.0836282816F, 0.0838981724F, 0.0841684682F, 0.0844391688F, 0.0847102740F, 0.0849817835F, 0.0852536973F, 0.0855260150F, 0.0857987364F, 0.0860718614F, 0.0863453897F, 0.0866193211F, 0.0868936554F, 0.0871683924F, 0.0874435319F, 0.0877190737F, 0.0879950175F, 0.0882713632F, 0.0885481105F, 0.0888252592F, 0.0891028091F, 0.0893807600F, 0.0896591117F, 0.0899378639F, 0.0902170165F, 0.0904965692F, 0.0907765218F, 0.0910568740F, 0.0913376258F, 0.0916187767F, 0.0919003268F, 0.0921822756F, 0.0924646230F, 0.0927473687F, 0.0930305126F, 0.0933140545F, 0.0935979940F, 0.0938823310F, 0.0941670653F, 0.0944521966F, 0.0947377247F, 0.0950236494F, 0.0953099704F, 0.0955966876F, 0.0958838007F, 0.0961713094F, 0.0964592136F, 0.0967475131F, 0.0970362075F, 0.0973252967F, 0.0976147805F, 0.0979046585F, 0.0981949307F, 0.0984855967F, 0.0987766563F, 0.0990681093F, 0.0993599555F, 0.0996521945F, 0.0999448263F, 0.1002378506F, 0.1005312671F, 0.1008250755F, 0.1011192757F, 0.1014138675F, 0.1017088505F, 0.1020042246F, 0.1022999895F, 0.1025961450F, 0.1028926909F, 0.1031896268F, 0.1034869526F, 0.1037846680F, 0.1040827729F, 0.1043812668F, 0.1046801497F, 0.1049794213F, 0.1052790813F, 0.1055791294F, 0.1058795656F, 0.1061803894F, 0.1064816006F, 0.1067831991F, 0.1070851846F, 0.1073875568F, 0.1076903155F, 0.1079934604F, 0.1082969913F, 0.1086009079F, 0.1089052101F, 0.1092098975F, 0.1095149699F, 0.1098204270F, 0.1101262687F, 0.1104324946F, 0.1107391045F, 0.1110460982F, 0.1113534754F, 0.1116612359F, 0.1119693793F, 0.1122779055F, 0.1125868142F, 0.1128961052F, 0.1132057781F, 0.1135158328F, 0.1138262690F, 0.1141370863F, 0.1144482847F, 0.1147598638F, 0.1150718233F, 0.1153841631F, 0.1156968828F, 0.1160099822F, 0.1163234610F, 0.1166373190F, 0.1169515559F, 0.1172661714F, 0.1175811654F, 0.1178965374F, 0.1182122874F, 0.1185284149F, 0.1188449198F, 0.1191618018F, 0.1194790606F, 0.1197966960F, 0.1201147076F, 0.1204330953F, 0.1207518587F, 0.1210709976F, 0.1213905118F, 0.1217104009F, 0.1220306647F, 0.1223513029F, 0.1226723153F, 0.1229937016F, 0.1233154615F, 0.1236375948F, 0.1239601011F, 0.1242829803F, 0.1246062319F, 0.1249298559F, 0.1252538518F, 0.1255782195F, 0.1259029586F, 0.1262280689F, 0.1265535501F, 0.1268794019F, 0.1272056241F, 0.1275322163F, 0.1278591784F, 0.1281865099F, 0.1285142108F, 0.1288422805F, 0.1291707190F, 0.1294995259F, 0.1298287009F, 0.1301582437F, 0.1304881542F, 0.1308184319F, 0.1311490766F, 0.1314800881F, 0.1318114660F, 0.1321432100F, 0.1324753200F, 0.1328077955F, 0.1331406364F, 0.1334738422F, 0.1338074129F, 0.1341413479F, 0.1344756472F, 0.1348103103F, 0.1351453370F, 0.1354807270F, 0.1358164801F, 0.1361525959F, 0.1364890741F, 0.1368259145F, 0.1371631167F, 0.1375006805F, 0.1378386056F, 0.1381768917F, 0.1385155384F, 0.1388545456F, 0.1391939129F, 0.1395336400F, 0.1398737266F, 0.1402141724F, 0.1405549772F, 0.1408961406F, 0.1412376623F, 0.1415795421F, 0.1419217797F, 0.1422643746F, 0.1426073268F, 0.1429506358F, 0.1432943013F, 0.1436383231F, 0.1439827008F, 0.1443274342F, 0.1446725229F, 0.1450179667F, 0.1453637652F, 0.1457099181F, 0.1460564252F, 0.1464032861F, 0.1467505006F, 0.1470980682F, 0.1474459888F, 0.1477942620F, 0.1481428875F, 0.1484918651F, 0.1488411942F, 0.1491908748F, 0.1495409065F, 0.1498912889F, 0.1502420218F, 0.1505931048F, 0.1509445376F, 0.1512963200F, 0.1516484516F, 0.1520009321F, 0.1523537612F, 0.1527069385F, 0.1530604638F, 0.1534143368F, 0.1537685571F, 0.1541231244F, 0.1544780384F, 0.1548332987F, 0.1551889052F, 0.1555448574F, 0.1559011550F, 0.1562577978F, 0.1566147853F, 0.1569721173F, 0.1573297935F, 0.1576878135F, 0.1580461771F, 0.1584048838F, 0.1587639334F, 0.1591233255F, 0.1594830599F, 0.1598431361F, 0.1602035540F, 0.1605643131F, 0.1609254131F, 0.1612868537F, 0.1616486346F, 0.1620107555F, 0.1623732160F, 0.1627360158F, 0.1630991545F, 0.1634626319F, 0.1638264476F, 0.1641906013F, 0.1645550926F, 0.1649199212F, 0.1652850869F, 0.1656505892F, 0.1660164278F, 0.1663826024F, 0.1667491127F, 0.1671159583F, 0.1674831388F, 0.1678506541F, 0.1682185036F, 0.1685866872F, 0.1689552044F, 0.1693240549F, 0.1696932384F, 0.1700627545F, 0.1704326029F, 0.1708027833F, 0.1711732952F, 0.1715441385F, 0.1719153127F, 0.1722868175F, 0.1726586526F, 0.1730308176F, 0.1734033121F, 0.1737761359F, 0.1741492886F, 0.1745227698F, 0.1748965792F, 0.1752707164F, 0.1756451812F, 0.1760199731F, 0.1763950918F, 0.1767705370F, 0.1771463083F, 0.1775224054F, 0.1778988279F, 0.1782755754F, 0.1786526477F, 0.1790300444F, 0.1794077651F, 0.1797858094F, 0.1801641771F, 0.1805428677F, 0.1809218810F, 0.1813012165F, 0.1816808739F, 0.1820608528F, 0.1824411530F, 0.1828217739F, 0.1832027154F, 0.1835839770F, 0.1839655584F, 0.1843474592F, 0.1847296790F, 0.1851122175F, 0.1854950744F, 0.1858782492F, 0.1862617417F, 0.1866455514F, 0.1870296780F, 0.1874141211F, 0.1877988804F, 0.1881839555F, 0.1885693461F, 0.1889550517F, 0.1893410721F, 0.1897274068F, 0.1901140555F, 0.1905010178F, 0.1908882933F, 0.1912758818F, 0.1916637828F, 0.1920519959F, 0.1924405208F, 0.1928293571F, 0.1932185044F, 0.1936079625F, 0.1939977308F, 0.1943878091F, 0.1947781969F, 0.1951688939F, 0.1955598998F, 0.1959512141F, 0.1963428364F, 0.1967347665F, 0.1971270038F, 0.1975195482F, 0.1979123990F, 0.1983055561F, 0.1986990190F, 0.1990927873F, 0.1994868607F, 0.1998812388F, 0.2002759212F, 0.2006709075F, 0.2010661974F, 0.2014617904F, 0.2018576862F, 0.2022538844F, 0.2026503847F, 0.2030471865F, 0.2034442897F, 0.2038416937F, 0.2042393982F, 0.2046374028F, 0.2050357071F, 0.2054343107F, 0.2058332133F, 0.2062324145F, 0.2066319138F, 0.2070317110F, 0.2074318055F, 0.2078321970F, 0.2082328852F, 0.2086338696F, 0.2090351498F, 0.2094367255F, 0.2098385962F, 0.2102407617F, 0.2106432213F, 0.2110459749F, 0.2114490220F, 0.2118523621F, 0.2122559950F, 0.2126599202F, 0.2130641373F, 0.2134686459F, 0.2138734456F, 0.2142785361F, 0.2146839168F, 0.2150895875F, 0.2154955478F, 0.2159017972F, 0.2163083353F, 0.2167151617F, 0.2171222761F, 0.2175296780F, 0.2179373670F, 0.2183453428F, 0.2187536049F, 0.2191621529F, 0.2195709864F, 0.2199801051F, 0.2203895085F, 0.2207991961F, 0.2212091677F, 0.2216194228F, 0.2220299610F, 0.2224407818F, 0.2228518850F, 0.2232632699F, 0.2236749364F, 0.2240868839F, 0.2244991121F, 0.2249116204F, 0.2253244086F, 0.2257374763F, 0.2261508229F, 0.2265644481F, 0.2269783514F, 0.2273925326F, 0.2278069911F, 0.2282217265F, 0.2286367384F, 0.2290520265F, 0.2294675902F, 0.2298834292F, 0.2302995431F, 0.2307159314F, 0.2311325937F, 0.2315495297F, 0.2319667388F, 0.2323842207F, 0.2328019749F, 0.2332200011F, 0.2336382988F, 0.2340568675F, 0.2344757070F, 0.2348948166F, 0.2353141961F, 0.2357338450F, 0.2361537629F, 0.2365739493F, 0.2369944038F, 0.2374151261F, 0.2378361156F, 0.2382573720F, 0.2386788948F, 0.2391006836F, 0.2395227380F, 0.2399450575F, 0.2403676417F, 0.2407904902F, 0.2412136026F, 0.2416369783F, 0.2420606171F, 0.2424845185F, 0.2429086820F, 0.2433331072F, 0.2437577936F, 0.2441827409F, 0.2446079486F, 0.2450334163F, 0.2454591435F, 0.2458851298F, 0.2463113747F, 0.2467378779F, 0.2471646389F, 0.2475916573F, 0.2480189325F, 0.2484464643F, 0.2488742521F, 0.2493022955F, 0.2497305940F, 0.2501591473F, 0.2505879549F, 0.2510170163F, 0.2514463311F, 0.2518758989F, 0.2523057193F, 0.2527357916F, 0.2531661157F, 0.2535966909F, 0.2540275169F, 0.2544585931F, 0.2548899193F, 0.2553214948F, 0.2557533193F, 0.2561853924F, 0.2566177135F, 0.2570502822F, 0.2574830981F, 0.2579161608F, 0.2583494697F, 0.2587830245F, 0.2592168246F, 0.2596508697F, 0.2600851593F, 0.2605196929F, 0.2609544701F, 0.2613894904F, 0.2618247534F, 0.2622602586F, 0.2626960055F, 0.2631319938F, 0.2635682230F, 0.2640046925F, 0.2644414021F, 0.2648783511F, 0.2653155391F, 0.2657529657F, 0.2661906305F, 0.2666285329F, 0.2670666725F, 0.2675050489F, 0.2679436616F, 0.2683825101F, 0.2688215940F, 0.2692609127F, 0.2697004660F, 0.2701402532F, 0.2705802739F, 0.2710205278F, 0.2714610142F, 0.2719017327F, 0.2723426830F, 0.2727838644F, 0.2732252766F, 0.2736669191F, 0.2741087914F, 0.2745508930F, 0.2749932235F, 0.2754357824F, 0.2758785693F, 0.2763215837F, 0.2767648251F, 0.2772082930F, 0.2776519870F, 0.2780959066F, 0.2785400513F, 0.2789844207F, 0.2794290143F, 0.2798738316F, 0.2803188722F, 0.2807641355F, 0.2812096211F, 0.2816553286F, 0.2821012574F, 0.2825474071F, 0.2829937773F, 0.2834403673F, 0.2838871768F, 0.2843342053F, 0.2847814523F, 0.2852289174F, 0.2856765999F, 0.2861244996F, 0.2865726159F, 0.2870209482F, 0.2874694962F, 0.2879182594F, 0.2883672372F, 0.2888164293F, 0.2892658350F, 0.2897154540F, 0.2901652858F, 0.2906153298F, 0.2910655856F, 0.2915160527F, 0.2919667306F, 0.2924176189F, 0.2928687171F, 0.2933200246F, 0.2937715409F, 0.2942232657F, 0.2946751984F, 0.2951273386F, 0.2955796856F, 0.2960322391F, 0.2964849986F, 0.2969379636F, 0.2973911335F, 0.2978445080F, 0.2982980864F, 0.2987518684F, 0.2992058534F, 0.2996600409F, 0.3001144305F, 0.3005690217F, 0.3010238139F, 0.3014788067F, 0.3019339995F, 0.3023893920F, 0.3028449835F, 0.3033007736F, 0.3037567618F, 0.3042129477F, 0.3046693306F, 0.3051259102F, 0.3055826859F, 0.3060396572F, 0.3064968236F, 0.3069541847F, 0.3074117399F, 0.3078694887F, 0.3083274307F, 0.3087855653F, 0.3092438920F, 0.3097024104F, 0.3101611199F, 0.3106200200F, 0.3110791103F, 0.3115383902F, 0.3119978592F, 0.3124575169F, 0.3129173627F, 0.3133773961F, 0.3138376166F, 0.3142980238F, 0.3147586170F, 0.3152193959F, 0.3156803598F, 0.3161415084F, 0.3166028410F, 0.3170643573F, 0.3175260566F, 0.3179879384F, 0.3184500023F, 0.3189122478F, 0.3193746743F, 0.3198372814F, 0.3203000685F, 0.3207630351F, 0.3212261807F, 0.3216895048F, 0.3221530069F, 0.3226166865F, 0.3230805430F, 0.3235445760F, 0.3240087849F, 0.3244731693F, 0.3249377285F, 0.3254024622F, 0.3258673698F, 0.3263324507F, 0.3267977045F, 0.3272631306F, 0.3277287286F, 0.3281944978F, 0.3286604379F, 0.3291265482F, 0.3295928284F, 0.3300592777F, 0.3305258958F, 0.3309926821F, 0.3314596361F, 0.3319267573F, 0.3323940451F, 0.3328614990F, 0.3333291186F, 0.3337969033F, 0.3342648525F, 0.3347329658F, 0.3352012427F, 0.3356696825F, 0.3361382849F, 0.3366070492F, 0.3370759749F, 0.3375450616F, 0.3380143087F, 0.3384837156F, 0.3389532819F, 0.3394230071F, 0.3398928905F, 0.3403629317F, 0.3408331302F, 0.3413034854F, 0.3417739967F, 0.3422446638F, 0.3427154860F, 0.3431864628F, 0.3436575938F, 0.3441288782F, 0.3446003158F, 0.3450719058F, 0.3455436478F, 0.3460155412F, 0.3464875856F, 0.3469597804F, 0.3474321250F, 0.3479046189F, 0.3483772617F, 0.3488500527F, 0.3493229914F, 0.3497960774F, 0.3502693100F, 0.3507426887F, 0.3512162131F, 0.3516898825F, 0.3521636965F, 0.3526376545F, 0.3531117559F, 0.3535860003F, 0.3540603870F, 0.3545349157F, 0.3550095856F, 0.3554843964F, 0.3559593474F, 0.3564344381F, 0.3569096680F, 0.3573850366F, 0.3578605432F, 0.3583361875F, 0.3588119687F, 0.3592878865F, 0.3597639402F, 0.3602401293F, 0.3607164533F, 0.3611929117F, 0.3616695038F, 0.3621462292F, 0.3626230873F, 0.3631000776F, 0.3635771995F, 0.3640544525F, 0.3645318360F, 0.3650093496F, 0.3654869926F, 0.3659647645F, 0.3664426648F, 0.3669206930F, 0.3673988484F, 0.3678771306F, 0.3683555390F, 0.3688340731F, 0.3693127322F, 0.3697915160F, 0.3702704237F, 0.3707494549F, 0.3712286091F, 0.3717078857F, 0.3721872840F, 0.3726668037F, 0.3731464441F, 0.3736262047F, 0.3741060850F, 0.3745860843F, 0.3750662023F, 0.3755464382F, 0.3760267915F, 0.3765072618F, 0.3769878484F, 0.3774685509F, 0.3779493686F, 0.3784303010F, 0.3789113475F, 0.3793925076F, 0.3798737809F, 0.3803551666F, 0.3808366642F, 0.3813182733F, 0.3817999932F, 0.3822818234F, 0.3827637633F, 0.3832458124F, 0.3837279702F, 0.3842102360F, 0.3846926093F, 0.3851750897F, 0.3856576764F, 0.3861403690F, 0.3866231670F, 0.3871060696F, 0.3875890765F, 0.3880721870F, 0.3885554007F, 0.3890387168F, 0.3895221349F, 0.3900056544F, 0.3904892748F, 0.3909729955F, 0.3914568160F, 0.3919407356F, 0.3924247539F, 0.3929088702F, 0.3933930841F, 0.3938773949F, 0.3943618021F, 0.3948463052F, 0.3953309035F, 0.3958155966F, 0.3963003838F, 0.3967852646F, 0.3972702385F, 0.3977553048F, 0.3982404631F, 0.3987257127F, 0.3992110531F, 0.3996964838F, 0.4001820041F, 0.4006676136F, 0.4011533116F, 0.4016390976F, 0.4021249710F, 0.4026109313F, 0.4030969779F, 0.4035831102F, 0.4040693277F, 0.4045556299F, 0.4050420160F, 0.4055284857F, 0.4060150383F, 0.4065016732F, 0.4069883899F, 0.4074751879F, 0.4079620665F, 0.4084490252F, 0.4089360635F, 0.4094231807F, 0.4099103763F, 0.4103976498F, 0.4108850005F, 0.4113724280F, 0.4118599315F, 0.4123475107F, 0.4128351648F, 0.4133228934F, 0.4138106959F, 0.4142985716F, 0.4147865201F, 0.4152745408F, 0.4157626330F, 0.4162507963F, 0.4167390301F, 0.4172273337F, 0.4177157067F, 0.4182041484F, 0.4186926583F, 0.4191812359F, 0.4196698805F, 0.4201585915F, 0.4206473685F, 0.4211362108F, 0.4216251179F, 0.4221140892F, 0.4226031241F, 0.4230922221F, 0.4235813826F, 0.4240706050F, 0.4245598887F, 0.4250492332F, 0.4255386379F, 0.4260281022F, 0.4265176256F, 0.4270072075F, 0.4274968473F, 0.4279865445F, 0.4284762984F, 0.4289661086F, 0.4294559743F, 0.4299458951F, 0.4304358704F, 0.4309258996F, 0.4314159822F, 0.4319061175F, 0.4323963050F, 0.4328865441F, 0.4333768342F, 0.4338671749F, 0.4343575654F, 0.4348480052F, 0.4353384938F, 0.4358290306F, 0.4363196149F, 0.4368102463F, 0.4373009241F, 0.4377916478F, 0.4382824168F, 0.4387732305F, 0.4392640884F, 0.4397549899F, 0.4402459343F, 0.4407369212F, 0.4412279499F, 0.4417190198F, 0.4422101305F, 0.4427012813F, 0.4431924717F, 0.4436837010F, 0.4441749686F, 0.4446662742F, 0.4451576169F, 0.4456489963F, 0.4461404118F, 0.4466318628F, 0.4471233487F, 0.4476148690F, 0.4481064230F, 0.4485980103F, 0.4490896302F, 0.4495812821F, 0.4500729654F, 0.4505646797F, 0.4510564243F, 0.4515481986F, 0.4520400021F, 0.4525318341F, 0.4530236942F, 0.4535155816F, 0.4540074959F, 0.4544994365F, 0.4549914028F, 0.4554833941F, 0.4559754100F, 0.4564674499F, 0.4569595131F, 0.4574515991F, 0.4579437074F, 0.4584358372F, 0.4589279881F, 0.4594201595F, 0.4599123508F, 0.4604045615F, 0.4608967908F, 0.4613890383F, 0.4618813034F, 0.4623735855F, 0.4628658841F, 0.4633581984F, 0.4638505281F, 0.4643428724F, 0.4648352308F, 0.4653276028F, 0.4658199877F, 0.4663123849F, 0.4668047940F, 0.4672972143F, 0.4677896451F, 0.4682820861F, 0.4687745365F, 0.4692669958F, 0.4697594634F, 0.4702519387F, 0.4707444211F, 0.4712369102F, 0.4717294052F, 0.4722219056F, 0.4727144109F, 0.4732069204F, 0.4736994336F, 0.4741919498F, 0.4746844686F, 0.4751769893F, 0.4756695113F, 0.4761620341F, 0.4766545571F, 0.4771470797F, 0.4776396013F, 0.4781321213F, 0.4786246392F, 0.4791171544F, 0.4796096663F, 0.4801021744F, 0.4805946779F, 0.4810871765F, 0.4815796694F, 0.4820721561F, 0.4825646360F, 0.4830571086F, 0.4835495732F, 0.4840420293F, 0.4845344763F, 0.4850269136F, 0.4855193407F, 0.4860117569F, 0.4865041617F, 0.4869965545F, 0.4874889347F, 0.4879813018F, 0.4884736551F, 0.4889659941F, 0.4894583182F, 0.4899506268F, 0.4904429193F, 0.4909351952F, 0.4914274538F, 0.4919196947F, 0.4924119172F, 0.4929041207F, 0.4933963046F, 0.4938884685F, 0.4943806116F, 0.4948727335F, 0.4953648335F, 0.4958569110F, 0.4963489656F, 0.4968409965F, 0.4973330032F, 0.4978249852F, 0.4983169419F, 0.4988088726F, 0.4993007768F, 0.4997926539F, 0.5002845034F, 0.5007763247F, 0.5012681171F, 0.5017598801F, 0.5022516132F, 0.5027433157F, 0.5032349871F, 0.5037266268F, 0.5042182341F, 0.5047098086F, 0.5052013497F, 0.5056928567F, 0.5061843292F, 0.5066757664F, 0.5071671679F, 0.5076585330F, 0.5081498613F, 0.5086411520F, 0.5091324047F, 0.5096236187F, 0.5101147934F, 0.5106059284F, 0.5110970230F, 0.5115880766F, 0.5120790887F, 0.5125700587F, 0.5130609860F, 0.5135518700F, 0.5140427102F, 0.5145335059F, 0.5150242566F, 0.5155149618F, 0.5160056208F, 0.5164962331F, 0.5169867980F, 0.5174773151F, 0.5179677837F, 0.5184582033F, 0.5189485733F, 0.5194388931F, 0.5199291621F, 0.5204193798F, 0.5209095455F, 0.5213996588F, 0.5218897190F, 0.5223797256F, 0.5228696779F, 0.5233595755F, 0.5238494177F, 0.5243392039F, 0.5248289337F, 0.5253186063F, 0.5258082213F, 0.5262977781F, 0.5267872760F, 0.5272767146F, 0.5277660932F, 0.5282554112F, 0.5287446682F, 0.5292338635F, 0.5297229965F, 0.5302120667F, 0.5307010736F, 0.5311900164F, 0.5316788947F, 0.5321677079F, 0.5326564554F, 0.5331451366F, 0.5336337511F, 0.5341222981F, 0.5346107771F, 0.5350991876F, 0.5355875290F, 0.5360758007F, 0.5365640021F, 0.5370521327F, 0.5375401920F, 0.5380281792F, 0.5385160939F, 0.5390039355F, 0.5394917034F, 0.5399793971F, 0.5404670159F, 0.5409545594F, 0.5414420269F, 0.5419294179F, 0.5424167318F, 0.5429039680F, 0.5433911261F, 0.5438782053F, 0.5443652051F, 0.5448521250F, 0.5453389644F, 0.5458257228F, 0.5463123995F, 0.5467989940F, 0.5472855057F, 0.5477719341F, 0.5482582786F, 0.5487445387F, 0.5492307137F, 0.5497168031F, 0.5502028063F, 0.5506887228F, 0.5511745520F, 0.5516602934F, 0.5521459463F, 0.5526315103F, 0.5531169847F, 0.5536023690F, 0.5540876626F, 0.5545728649F, 0.5550579755F, 0.5555429937F, 0.5560279189F, 0.5565127507F, 0.5569974884F, 0.5574821315F, 0.5579666794F, 0.5584511316F, 0.5589354875F, 0.5594197465F, 0.5599039080F, 0.5603879716F, 0.5608719367F, 0.5613558026F, 0.5618395689F, 0.5623232350F, 0.5628068002F, 0.5632902642F, 0.5637736262F, 0.5642568858F, 0.5647400423F, 0.5652230953F, 0.5657060442F, 0.5661888883F, 0.5666716272F, 0.5671542603F, 0.5676367870F, 0.5681192069F, 0.5686015192F, 0.5690837235F, 0.5695658192F, 0.5700478058F, 0.5705296827F, 0.5710114494F, 0.5714931052F, 0.5719746497F, 0.5724560822F, 0.5729374023F, 0.5734186094F, 0.5738997029F, 0.5743806823F, 0.5748615470F, 0.5753422965F, 0.5758229301F, 0.5763034475F, 0.5767838480F, 0.5772641310F, 0.5777442960F, 0.5782243426F, 0.5787042700F, 0.5791840778F, 0.5796637654F, 0.5801433322F, 0.5806227778F, 0.5811021016F, 0.5815813029F, 0.5820603814F, 0.5825393363F, 0.5830181673F, 0.5834968737F, 0.5839754549F, 0.5844539105F, 0.5849322399F, 0.5854104425F, 0.5858885179F, 0.5863664653F, 0.5868442844F, 0.5873219746F, 0.5877995353F, 0.5882769660F, 0.5887542661F, 0.5892314351F, 0.5897084724F, 0.5901853776F, 0.5906621500F, 0.5911387892F, 0.5916152945F, 0.5920916655F, 0.5925679016F, 0.5930440022F, 0.5935199669F, 0.5939957950F, 0.5944714861F, 0.5949470396F, 0.5954224550F, 0.5958977317F, 0.5963728692F, 0.5968478669F, 0.5973227244F, 0.5977974411F, 0.5982720163F, 0.5987464497F, 0.5992207407F, 0.5996948887F, 0.6001688932F, 0.6006427537F, 0.6011164696F, 0.6015900405F, 0.6020634657F, 0.6025367447F, 0.6030098770F, 0.6034828621F, 0.6039556995F, 0.6044283885F, 0.6049009288F, 0.6053733196F, 0.6058455606F, 0.6063176512F, 0.6067895909F, 0.6072613790F, 0.6077330152F, 0.6082044989F, 0.6086758295F, 0.6091470065F, 0.6096180294F, 0.6100888977F, 0.6105596108F, 0.6110301682F, 0.6115005694F, 0.6119708139F, 0.6124409011F, 0.6129108305F, 0.6133806017F, 0.6138502139F, 0.6143196669F, 0.6147889599F, 0.6152580926F, 0.6157270643F, 0.6161958746F, 0.6166645230F, 0.6171330088F, 0.6176013317F, 0.6180694910F, 0.6185374863F, 0.6190053171F, 0.6194729827F, 0.6199404828F, 0.6204078167F, 0.6208749841F, 0.6213419842F, 0.6218088168F, 0.6222754811F, 0.6227419768F, 0.6232083032F, 0.6236744600F, 0.6241404465F, 0.6246062622F, 0.6250719067F, 0.6255373795F, 0.6260026799F, 0.6264678076F, 0.6269327619F, 0.6273975425F, 0.6278621487F, 0.6283265800F, 0.6287908361F, 0.6292549163F, 0.6297188201F, 0.6301825471F, 0.6306460966F, 0.6311094683F, 0.6315726617F, 0.6320356761F, 0.6324985111F, 0.6329611662F, 0.6334236410F, 0.6338859348F, 0.6343480472F, 0.6348099777F, 0.6352717257F, 0.6357332909F, 0.6361946726F, 0.6366558704F, 0.6371168837F, 0.6375777122F, 0.6380383552F, 0.6384988123F, 0.6389590830F, 0.6394191668F, 0.6398790631F, 0.6403387716F, 0.6407982916F, 0.6412576228F, 0.6417167645F, 0.6421757163F, 0.6426344778F, 0.6430930483F, 0.6435514275F, 0.6440096149F, 0.6444676098F, 0.6449254119F, 0.6453830207F, 0.6458404356F, 0.6462976562F, 0.6467546820F, 0.6472115125F, 0.6476681472F, 0.6481245856F, 0.6485808273F, 0.6490368717F, 0.6494927183F, 0.6499483667F, 0.6504038164F, 0.6508590670F, 0.6513141178F, 0.6517689684F, 0.6522236185F, 0.6526780673F, 0.6531323146F, 0.6535863598F, 0.6540402024F, 0.6544938419F, 0.6549472779F, 0.6554005099F, 0.6558535373F, 0.6563063598F, 0.6567589769F, 0.6572113880F, 0.6576635927F, 0.6581155906F, 0.6585673810F, 0.6590189637F, 0.6594703380F, 0.6599215035F, 0.6603724598F, 0.6608232064F, 0.6612737427F, 0.6617240684F, 0.6621741829F, 0.6626240859F, 0.6630737767F, 0.6635232550F, 0.6639725202F, 0.6644215720F, 0.6648704098F, 0.6653190332F, 0.6657674417F, 0.6662156348F, 0.6666636121F, 0.6671113731F, 0.6675589174F, 0.6680062445F, 0.6684533538F, 0.6689002450F, 0.6693469177F, 0.6697933712F, 0.6702396052F, 0.6706856193F, 0.6711314129F, 0.6715769855F, 0.6720223369F, 0.6724674664F, 0.6729123736F, 0.6733570581F, 0.6738015194F, 0.6742457570F, 0.6746897706F, 0.6751335596F, 0.6755771236F, 0.6760204621F, 0.6764635747F, 0.6769064609F, 0.6773491204F, 0.6777915525F, 0.6782337570F, 0.6786757332F, 0.6791174809F, 0.6795589995F, 0.6800002886F, 0.6804413477F, 0.6808821765F, 0.6813227743F, 0.6817631409F, 0.6822032758F, 0.6826431785F, 0.6830828485F, 0.6835222855F, 0.6839614890F, 0.6844004585F, 0.6848391936F, 0.6852776939F, 0.6857159589F, 0.6861539883F, 0.6865917815F, 0.6870293381F, 0.6874666576F, 0.6879037398F, 0.6883405840F, 0.6887771899F, 0.6892135571F, 0.6896496850F, 0.6900855733F, 0.6905212216F, 0.6909566294F, 0.6913917963F, 0.6918267218F, 0.6922614055F, 0.6926958471F, 0.6931300459F, 0.6935640018F, 0.6939977141F, 0.6944311825F, 0.6948644066F, 0.6952973859F, 0.6957301200F, 0.6961626085F, 0.6965948510F, 0.6970268470F, 0.6974585961F, 0.6978900980F, 0.6983213521F, 0.6987523580F, 0.6991831154F, 0.6996136238F, 0.7000438828F, 0.7004738921F, 0.7009036510F, 0.7013331594F, 0.7017624166F, 0.7021914224F, 0.7026201763F, 0.7030486779F, 0.7034769268F, 0.7039049226F, 0.7043326648F, 0.7047601531F, 0.7051873870F, 0.7056143662F, 0.7060410902F, 0.7064675586F, 0.7068937711F, 0.7073197271F, 0.7077454264F, 0.7081708684F, 0.7085960529F, 0.7090209793F, 0.7094456474F, 0.7098700566F, 0.7102942066F, 0.7107180970F, 0.7111417274F, 0.7115650974F, 0.7119882066F, 0.7124110545F, 0.7128336409F, 0.7132559653F, 0.7136780272F, 0.7140998264F, 0.7145213624F, 0.7149426348F, 0.7153636433F, 0.7157843874F, 0.7162048668F, 0.7166250810F, 0.7170450296F, 0.7174647124F, 0.7178841289F, 0.7183032786F, 0.7187221613F, 0.7191407765F, 0.7195591239F, 0.7199772030F, 0.7203950135F, 0.7208125550F, 0.7212298271F, 0.7216468294F, 0.7220635616F, 0.7224800233F, 0.7228962140F, 0.7233121335F, 0.7237277813F, 0.7241431571F, 0.7245582604F, 0.7249730910F, 0.7253876484F, 0.7258019322F, 0.7262159422F, 0.7266296778F, 0.7270431388F, 0.7274563247F, 0.7278692353F, 0.7282818700F, 0.7286942287F, 0.7291063108F, 0.7295181160F, 0.7299296440F, 0.7303408944F, 0.7307518669F, 0.7311625609F, 0.7315729763F, 0.7319831126F, 0.7323929695F, 0.7328025466F, 0.7332118435F, 0.7336208600F, 0.7340295955F, 0.7344380499F, 0.7348462226F, 0.7352541134F, 0.7356617220F, 0.7360690478F, 0.7364760907F, 0.7368828502F, 0.7372893259F, 0.7376955176F, 0.7381014249F, 0.7385070475F, 0.7389123849F, 0.7393174368F, 0.7397222029F, 0.7401266829F, 0.7405308763F, 0.7409347829F, 0.7413384023F, 0.7417417341F, 0.7421447780F, 0.7425475338F, 0.7429500009F, 0.7433521791F, 0.7437540681F, 0.7441556674F, 0.7445569769F, 0.7449579960F, 0.7453587245F, 0.7457591621F, 0.7461593084F, 0.7465591631F, 0.7469587259F, 0.7473579963F, 0.7477569741F, 0.7481556590F, 0.7485540506F, 0.7489521486F, 0.7493499526F, 0.7497474623F, 0.7501446775F, 0.7505415977F, 0.7509382227F, 0.7513345521F, 0.7517305856F, 0.7521263229F, 0.7525217636F, 0.7529169074F, 0.7533117541F, 0.7537063032F, 0.7541005545F, 0.7544945076F, 0.7548881623F, 0.7552815182F, 0.7556745749F, 0.7560673323F, 0.7564597899F, 0.7568519474F, 0.7572438046F, 0.7576353611F, 0.7580266166F, 0.7584175708F, 0.7588082235F, 0.7591985741F, 0.7595886226F, 0.7599783685F, 0.7603678116F, 0.7607569515F, 0.7611457879F, 0.7615343206F, 0.7619225493F, 0.7623104735F, 0.7626980931F, 0.7630854078F, 0.7634724171F, 0.7638591209F, 0.7642455188F, 0.7646316106F, 0.7650173959F, 0.7654028744F, 0.7657880459F, 0.7661729100F, 0.7665574664F, 0.7669417150F, 0.7673256553F, 0.7677092871F, 0.7680926100F, 0.7684756239F, 0.7688583284F, 0.7692407232F, 0.7696228080F, 0.7700045826F, 0.7703860467F, 0.7707671999F, 0.7711480420F, 0.7715285728F, 0.7719087918F, 0.7722886989F, 0.7726682938F, 0.7730475762F, 0.7734265458F, 0.7738052023F, 0.7741835454F, 0.7745615750F, 0.7749392906F, 0.7753166921F, 0.7756937791F, 0.7760705514F, 0.7764470087F, 0.7768231508F, 0.7771989773F, 0.7775744880F, 0.7779496827F, 0.7783245610F, 0.7786991227F, 0.7790733676F, 0.7794472953F, 0.7798209056F, 0.7801941982F, 0.7805671729F, 0.7809398294F, 0.7813121675F, 0.7816841869F, 0.7820558873F, 0.7824272684F, 0.7827983301F, 0.7831690720F, 0.7835394940F, 0.7839095957F, 0.7842793768F, 0.7846488373F, 0.7850179767F, 0.7853867948F, 0.7857552914F, 0.7861234663F, 0.7864913191F, 0.7868588497F, 0.7872260578F, 0.7875929431F, 0.7879595055F, 0.7883257445F, 0.7886916601F, 0.7890572520F, 0.7894225198F, 0.7897874635F, 0.7901520827F, 0.7905163772F, 0.7908803468F, 0.7912439912F, 0.7916073102F, 0.7919703035F, 0.7923329710F, 0.7926953124F, 0.7930573274F, 0.7934190158F, 0.7937803774F, 0.7941414120F, 0.7945021193F, 0.7948624991F, 0.7952225511F, 0.7955822752F, 0.7959416711F, 0.7963007387F, 0.7966594775F, 0.7970178875F, 0.7973759685F, 0.7977337201F, 0.7980911422F, 0.7984482346F, 0.7988049970F, 0.7991614292F, 0.7995175310F, 0.7998733022F, 0.8002287426F, 0.8005838519F, 0.8009386299F, 0.8012930765F, 0.8016471914F, 0.8020009744F, 0.8023544253F, 0.8027075438F, 0.8030603298F, 0.8034127831F, 0.8037649035F, 0.8041166906F, 0.8044681445F, 0.8048192647F, 0.8051700512F, 0.8055205038F, 0.8058706222F, 0.8062204062F, 0.8065698556F, 0.8069189702F, 0.8072677499F, 0.8076161944F, 0.8079643036F, 0.8083120772F, 0.8086595151F, 0.8090066170F, 0.8093533827F, 0.8096998122F, 0.8100459051F, 0.8103916613F, 0.8107370806F, 0.8110821628F, 0.8114269077F, 0.8117713151F, 0.8121153849F, 0.8124591169F, 0.8128025108F, 0.8131455666F, 0.8134882839F, 0.8138306627F, 0.8141727027F, 0.8145144038F, 0.8148557658F, 0.8151967886F, 0.8155374718F, 0.8158778154F, 0.8162178192F, 0.8165574830F, 0.8168968067F, 0.8172357900F, 0.8175744328F, 0.8179127349F, 0.8182506962F, 0.8185883164F, 0.8189255955F, 0.8192625332F, 0.8195991295F, 0.8199353840F, 0.8202712967F, 0.8206068673F, 0.8209420958F, 0.8212769820F, 0.8216115256F, 0.8219457266F, 0.8222795848F, 0.8226131000F, 0.8229462721F, 0.8232791009F, 0.8236115863F, 0.8239437280F, 0.8242755260F, 0.8246069801F, 0.8249380901F, 0.8252688559F, 0.8255992774F, 0.8259293544F, 0.8262590867F, 0.8265884741F, 0.8269175167F, 0.8272462141F, 0.8275745663F, 0.8279025732F, 0.8282302344F, 0.8285575501F, 0.8288845199F, 0.8292111437F, 0.8295374215F, 0.8298633530F, 0.8301889382F, 0.8305141768F, 0.8308390688F, 0.8311636141F, 0.8314878124F, 0.8318116637F, 0.8321351678F, 0.8324583246F, 0.8327811340F, 0.8331035957F, 0.8334257098F, 0.8337474761F, 0.8340688944F, 0.8343899647F, 0.8347106867F, 0.8350310605F, 0.8353510857F, 0.8356707624F, 0.8359900904F, 0.8363090696F, 0.8366276999F, 0.8369459811F, 0.8372639131F, 0.8375814958F, 0.8378987292F, 0.8382156130F, 0.8385321472F, 0.8388483316F, 0.8391641662F, 0.8394796508F, 0.8397947853F, 0.8401095697F, 0.8404240037F, 0.8407380873F, 0.8410518204F, 0.8413652029F, 0.8416782347F, 0.8419909156F, 0.8423032456F, 0.8426152245F, 0.8429268523F, 0.8432381289F, 0.8435490541F, 0.8438596279F, 0.8441698502F, 0.8444797208F, 0.8447892396F, 0.8450984067F, 0.8454072218F, 0.8457156849F, 0.8460237959F, 0.8463315547F, 0.8466389612F, 0.8469460154F, 0.8472527170F, 0.8475590661F, 0.8478650625F, 0.8481707063F, 0.8484759971F, 0.8487809351F, 0.8490855201F, 0.8493897521F, 0.8496936308F, 0.8499971564F, 0.8503003286F, 0.8506031474F, 0.8509056128F, 0.8512077246F, 0.8515094828F, 0.8518108872F, 0.8521119379F, 0.8524126348F, 0.8527129777F, 0.8530129666F, 0.8533126015F, 0.8536118822F, 0.8539108087F, 0.8542093809F, 0.8545075988F, 0.8548054623F, 0.8551029712F, 0.8554001257F, 0.8556969255F, 0.8559933707F, 0.8562894611F, 0.8565851968F, 0.8568805775F, 0.8571756034F, 0.8574702743F, 0.8577645902F, 0.8580585509F, 0.8583521566F, 0.8586454070F, 0.8589383021F, 0.8592308420F, 0.8595230265F, 0.8598148556F, 0.8601063292F, 0.8603974473F, 0.8606882098F, 0.8609786167F, 0.8612686680F, 0.8615583636F, 0.8618477034F, 0.8621366874F, 0.8624253156F, 0.8627135878F, 0.8630015042F, 0.8632890646F, 0.8635762690F, 0.8638631173F, 0.8641496096F, 0.8644357457F, 0.8647215257F, 0.8650069495F, 0.8652920171F, 0.8655767283F, 0.8658610833F, 0.8661450820F, 0.8664287243F, 0.8667120102F, 0.8669949397F, 0.8672775127F, 0.8675597293F, 0.8678415894F, 0.8681230929F, 0.8684042398F, 0.8686850302F, 0.8689654640F, 0.8692455412F, 0.8695252617F, 0.8698046255F, 0.8700836327F, 0.8703622831F, 0.8706405768F, 0.8709185138F, 0.8711960940F, 0.8714733174F, 0.8717501840F, 0.8720266939F, 0.8723028469F, 0.8725786430F, 0.8728540824F, 0.8731291648F, 0.8734038905F, 0.8736782592F, 0.8739522711F, 0.8742259261F, 0.8744992242F, 0.8747721653F, 0.8750447496F, 0.8753169770F, 0.8755888475F, 0.8758603611F, 0.8761315177F, 0.8764023175F, 0.8766727603F, 0.8769428462F, 0.8772125752F, 0.8774819474F, 0.8777509626F, 0.8780196209F, 0.8782879224F, 0.8785558669F, 0.8788234546F, 0.8790906854F, 0.8793575594F, 0.8796240765F, 0.8798902368F, 0.8801560403F, 0.8804214870F, 0.8806865768F, 0.8809513099F, 0.8812156863F, 0.8814797059F, 0.8817433687F, 0.8820066749F, 0.8822696243F, 0.8825322171F, 0.8827944532F, 0.8830563327F, 0.8833178556F, 0.8835790219F, 0.8838398316F, 0.8841002848F, 0.8843603815F, 0.8846201217F, 0.8848795054F, 0.8851385327F, 0.8853972036F, 0.8856555182F, 0.8859134764F, 0.8861710783F, 0.8864283239F, 0.8866852133F, 0.8869417464F, 0.8871979234F, 0.8874537443F, 0.8877092090F, 0.8879643177F, 0.8882190704F, 0.8884734671F, 0.8887275078F, 0.8889811927F, 0.8892345216F, 0.8894874948F, 0.8897401122F, 0.8899923738F, 0.8902442798F, 0.8904958301F, 0.8907470248F, 0.8909978640F, 0.8912483477F, 0.8914984759F, 0.8917482487F, 0.8919976662F, 0.8922467284F, 0.8924954353F, 0.8927437871F, 0.8929917837F, 0.8932394252F, 0.8934867118F, 0.8937336433F, 0.8939802199F, 0.8942264417F, 0.8944723087F, 0.8947178210F, 0.8949629785F, 0.8952077815F, 0.8954522299F, 0.8956963239F, 0.8959400634F, 0.8961834486F, 0.8964264795F, 0.8966691561F, 0.8969114786F, 0.8971534470F, 0.8973950614F, 0.8976363219F, 0.8978772284F, 0.8981177812F, 0.8983579802F, 0.8985978256F, 0.8988373174F, 0.8990764556F, 0.8993152405F, 0.8995536720F, 0.8997917502F, 0.9000294751F, 0.9002668470F, 0.9005038658F, 0.9007405317F, 0.9009768446F, 0.9012128048F, 0.9014484123F, 0.9016836671F, 0.9019185693F, 0.9021531191F, 0.9023873165F, 0.9026211616F, 0.9028546546F, 0.9030877954F, 0.9033205841F, 0.9035530210F, 0.9037851059F, 0.9040168392F, 0.9042482207F, 0.9044792507F, 0.9047099293F, 0.9049402564F, 0.9051702323F, 0.9053998569F, 0.9056291305F, 0.9058580531F, 0.9060866248F, 0.9063148457F, 0.9065427159F, 0.9067702355F, 0.9069974046F, 0.9072242233F, 0.9074506917F, 0.9076768100F, 0.9079025782F, 0.9081279964F, 0.9083530647F, 0.9085777833F, 0.9088021523F, 0.9090261717F, 0.9092498417F, 0.9094731623F, 0.9096961338F, 0.9099187561F, 0.9101410295F, 0.9103629540F, 0.9105845297F, 0.9108057568F, 0.9110266354F, 0.9112471656F, 0.9114673475F, 0.9116871812F, 0.9119066668F, 0.9121258046F, 0.9123445945F, 0.9125630367F, 0.9127811314F, 0.9129988786F, 0.9132162785F, 0.9134333312F, 0.9136500368F, 0.9138663954F, 0.9140824073F, 0.9142980724F, 0.9145133910F, 0.9147283632F, 0.9149429890F, 0.9151572687F, 0.9153712023F, 0.9155847900F, 0.9157980319F, 0.9160109282F, 0.9162234790F, 0.9164356844F, 0.9166475445F, 0.9168590595F, 0.9170702296F, 0.9172810548F, 0.9174915354F, 0.9177016714F, 0.9179114629F, 0.9181209102F, 0.9183300134F, 0.9185387726F, 0.9187471879F, 0.9189552595F, 0.9191629876F, 0.9193703723F, 0.9195774136F, 0.9197841119F, 0.9199904672F, 0.9201964797F, 0.9204021495F, 0.9206074767F, 0.9208124616F, 0.9210171043F, 0.9212214049F, 0.9214253636F, 0.9216289805F, 0.9218322558F, 0.9220351896F, 0.9222377821F, 0.9224400335F, 0.9226419439F, 0.9228435134F, 0.9230447423F, 0.9232456307F, 0.9234461787F, 0.9236463865F, 0.9238462543F, 0.9240457822F, 0.9242449704F, 0.9244438190F, 0.9246423282F, 0.9248404983F, 0.9250383293F, 0.9252358214F, 0.9254329747F, 0.9256297896F, 0.9258262660F, 0.9260224042F, 0.9262182044F, 0.9264136667F, 0.9266087913F, 0.9268035783F, 0.9269980280F, 0.9271921405F, 0.9273859160F, 0.9275793546F, 0.9277724566F, 0.9279652221F, 0.9281576513F, 0.9283497443F, 0.9285415014F, 0.9287329227F, 0.9289240084F, 0.9291147586F, 0.9293051737F, 0.9294952536F, 0.9296849987F, 0.9298744091F, 0.9300634850F, 0.9302522266F, 0.9304406340F, 0.9306287074F, 0.9308164471F, 0.9310038532F, 0.9311909259F, 0.9313776654F, 0.9315640719F, 0.9317501455F, 0.9319358865F, 0.9321212951F, 0.9323063713F, 0.9324911155F, 0.9326755279F, 0.9328596085F, 0.9330433577F, 0.9332267756F, 0.9334098623F, 0.9335926182F, 0.9337750434F, 0.9339571380F, 0.9341389023F, 0.9343203366F, 0.9345014409F, 0.9346822155F, 0.9348626606F, 0.9350427763F, 0.9352225630F, 0.9354020207F, 0.9355811498F, 0.9357599503F, 0.9359384226F, 0.9361165667F, 0.9362943830F, 0.9364718716F, 0.9366490327F, 0.9368258666F, 0.9370023733F, 0.9371785533F, 0.9373544066F, 0.9375299335F, 0.9377051341F, 0.9378800087F, 0.9380545576F, 0.9382287809F, 0.9384026787F, 0.9385762515F, 0.9387494993F, 0.9389224223F, 0.9390950209F, 0.9392672951F, 0.9394392453F, 0.9396108716F, 0.9397821743F, 0.9399531536F, 0.9401238096F, 0.9402941427F, 0.9404641530F, 0.9406338407F, 0.9408032061F, 0.9409722495F, 0.9411409709F, 0.9413093707F, 0.9414774491F, 0.9416452062F, 0.9418126424F, 0.9419797579F, 0.9421465528F, 0.9423130274F, 0.9424791819F, 0.9426450166F, 0.9428105317F, 0.9429757274F, 0.9431406039F, 0.9433051616F, 0.9434694005F, 0.9436333209F, 0.9437969232F, 0.9439602074F, 0.9441231739F, 0.9442858229F, 0.9444481545F, 0.9446101691F, 0.9447718669F, 0.9449332481F, 0.9450943129F, 0.9452550617F, 0.9454154945F, 0.9455756118F, 0.9457354136F, 0.9458949003F, 0.9460540721F, 0.9462129292F, 0.9463714719F, 0.9465297003F, 0.9466876149F, 0.9468452157F, 0.9470025031F, 0.9471594772F, 0.9473161384F, 0.9474724869F, 0.9476285229F, 0.9477842466F, 0.9479396584F, 0.9480947585F, 0.9482495470F, 0.9484040243F, 0.9485581906F, 0.9487120462F, 0.9488655913F, 0.9490188262F, 0.9491717511F, 0.9493243662F, 0.9494766718F, 0.9496286683F, 0.9497803557F, 0.9499317345F, 0.9500828047F, 0.9502335668F, 0.9503840209F, 0.9505341673F, 0.9506840062F, 0.9508335380F, 0.9509827629F, 0.9511316810F, 0.9512802928F, 0.9514285984F, 0.9515765982F, 0.9517242923F, 0.9518716810F, 0.9520187646F, 0.9521655434F, 0.9523120176F, 0.9524581875F, 0.9526040534F, 0.9527496154F, 0.9528948739F, 0.9530398292F, 0.9531844814F, 0.9533288310F, 0.9534728780F, 0.9536166229F, 0.9537600659F, 0.9539032071F, 0.9540460470F, 0.9541885858F, 0.9543308237F, 0.9544727611F, 0.9546143981F, 0.9547557351F, 0.9548967723F, 0.9550375100F, 0.9551779485F, 0.9553180881F, 0.9554579290F, 0.9555974714F, 0.9557367158F, 0.9558756623F, 0.9560143112F, 0.9561526628F, 0.9562907174F, 0.9564284752F, 0.9565659366F, 0.9567031017F, 0.9568399710F, 0.9569765446F, 0.9571128229F, 0.9572488061F, 0.9573844944F, 0.9575198883F, 0.9576549879F, 0.9577897936F, 0.9579243056F, 0.9580585242F, 0.9581924497F, 0.9583260824F, 0.9584594226F, 0.9585924705F, 0.9587252264F, 0.9588576906F, 0.9589898634F, 0.9591217452F, 0.9592533360F, 0.9593846364F, 0.9595156465F, 0.9596463666F, 0.9597767971F, 0.9599069382F, 0.9600367901F, 0.9601663533F, 0.9602956279F, 0.9604246143F, 0.9605533128F, 0.9606817236F, 0.9608098471F, 0.9609376835F, 0.9610652332F, 0.9611924963F, 0.9613194733F, 0.9614461644F, 0.9615725699F, 0.9616986901F, 0.9618245253F, 0.9619500757F, 0.9620753418F, 0.9622003238F, 0.9623250219F, 0.9624494365F, 0.9625735679F, 0.9626974163F, 0.9628209821F, 0.9629442656F, 0.9630672671F, 0.9631899868F, 0.9633124251F, 0.9634345822F, 0.9635564585F, 0.9636780543F, 0.9637993699F, 0.9639204056F, 0.9640411616F, 0.9641616383F, 0.9642818359F, 0.9644017549F, 0.9645213955F, 0.9646407579F, 0.9647598426F, 0.9648786497F, 0.9649971797F, 0.9651154328F, 0.9652334092F, 0.9653511095F, 0.9654685337F, 0.9655856823F, 0.9657025556F, 0.9658191538F, 0.9659354773F, 0.9660515263F, 0.9661673013F, 0.9662828024F, 0.9663980300F, 0.9665129845F, 0.9666276660F, 0.9667420750F, 0.9668562118F, 0.9669700766F, 0.9670836698F, 0.9671969917F, 0.9673100425F, 0.9674228227F, 0.9675353325F, 0.9676475722F, 0.9677595422F, 0.9678712428F, 0.9679826742F, 0.9680938368F, 0.9682047309F, 0.9683153569F, 0.9684257150F, 0.9685358056F, 0.9686456289F, 0.9687551853F, 0.9688644752F, 0.9689734987F, 0.9690822564F, 0.9691907483F, 0.9692989750F, 0.9694069367F, 0.9695146337F, 0.9696220663F, 0.9697292349F, 0.9698361398F, 0.9699427813F, 0.9700491597F, 0.9701552754F, 0.9702611286F, 0.9703667197F, 0.9704720490F, 0.9705771169F, 0.9706819236F, 0.9707864695F, 0.9708907549F, 0.9709947802F, 0.9710985456F, 0.9712020514F, 0.9713052981F, 0.9714082859F, 0.9715110151F, 0.9716134862F, 0.9717156993F, 0.9718176549F, 0.9719193532F, 0.9720207946F, 0.9721219794F, 0.9722229080F, 0.9723235806F, 0.9724239976F, 0.9725241593F, 0.9726240661F, 0.9727237183F, 0.9728231161F, 0.9729222601F, 0.9730211503F, 0.9731197873F, 0.9732181713F, 0.9733163027F, 0.9734141817F, 0.9735118088F, 0.9736091842F, 0.9737063083F, 0.9738031814F, 0.9738998039F, 0.9739961760F, 0.9740922981F, 0.9741881706F, 0.9742837938F, 0.9743791680F, 0.9744742935F, 0.9745691707F, 0.9746637999F, 0.9747581814F, 0.9748523157F, 0.9749462029F, 0.9750398435F, 0.9751332378F, 0.9752263861F, 0.9753192887F, 0.9754119461F, 0.9755043585F, 0.9755965262F, 0.9756884496F, 0.9757801291F, 0.9758715650F, 0.9759627575F, 0.9760537071F, 0.9761444141F, 0.9762348789F, 0.9763251016F, 0.9764150828F, 0.9765048228F, 0.9765943218F, 0.9766835802F, 0.9767725984F, 0.9768613767F, 0.9769499154F, 0.9770382149F, 0.9771262755F, 0.9772140976F, 0.9773016815F, 0.9773890275F, 0.9774761360F, 0.9775630073F, 0.9776496418F, 0.9777360398F, 0.9778222016F, 0.9779081277F, 0.9779938182F, 0.9780792736F, 0.9781644943F, 0.9782494805F, 0.9783342326F, 0.9784187509F, 0.9785030359F, 0.9785870877F, 0.9786709069F, 0.9787544936F, 0.9788378484F, 0.9789209714F, 0.9790038631F, 0.9790865238F, 0.9791689538F, 0.9792511535F, 0.9793331232F, 0.9794148633F, 0.9794963742F, 0.9795776561F, 0.9796587094F, 0.9797395345F, 0.9798201316F, 0.9799005013F, 0.9799806437F, 0.9800605593F, 0.9801402483F, 0.9802197112F, 0.9802989483F, 0.9803779600F, 0.9804567465F, 0.9805353082F, 0.9806136455F, 0.9806917587F, 0.9807696482F, 0.9808473143F, 0.9809247574F, 0.9810019778F, 0.9810789759F, 0.9811557519F, 0.9812323064F, 0.9813086395F, 0.9813847517F, 0.9814606433F, 0.9815363147F, 0.9816117662F, 0.9816869981F, 0.9817620108F, 0.9818368047F, 0.9819113801F, 0.9819857374F, 0.9820598769F, 0.9821337989F, 0.9822075038F, 0.9822809920F, 0.9823542638F, 0.9824273195F, 0.9825001596F, 0.9825727843F, 0.9826451940F, 0.9827173891F, 0.9827893700F, 0.9828611368F, 0.9829326901F, 0.9830040302F, 0.9830751574F, 0.9831460720F, 0.9832167745F, 0.9832872652F, 0.9833575444F, 0.9834276124F, 0.9834974697F, 0.9835671166F, 0.9836365535F, 0.9837057806F, 0.9837747983F, 0.9838436071F, 0.9839122072F, 0.9839805990F, 0.9840487829F, 0.9841167591F, 0.9841845282F, 0.9842520903F, 0.9843194459F, 0.9843865953F, 0.9844535389F, 0.9845202771F, 0.9845868101F, 0.9846531383F, 0.9847192622F, 0.9847851820F, 0.9848508980F, 0.9849164108F, 0.9849817205F, 0.9850468276F, 0.9851117324F, 0.9851764352F, 0.9852409365F, 0.9853052366F, 0.9853693358F, 0.9854332344F, 0.9854969330F, 0.9855604317F, 0.9856237309F, 0.9856868310F, 0.9857497325F, 0.9858124355F, 0.9858749404F, 0.9859372477F, 0.9859993577F, 0.9860612707F, 0.9861229871F, 0.9861845072F, 0.9862458315F, 0.9863069601F, 0.9863678936F, 0.9864286322F, 0.9864891764F, 0.9865495264F, 0.9866096826F, 0.9866696454F, 0.9867294152F, 0.9867889922F, 0.9868483769F, 0.9869075695F, 0.9869665706F, 0.9870253803F, 0.9870839991F, 0.9871424273F, 0.9872006653F, 0.9872587135F, 0.9873165721F, 0.9873742415F, 0.9874317222F, 0.9874890144F, 0.9875461185F, 0.9876030348F, 0.9876597638F, 0.9877163057F, 0.9877726610F, 0.9878288300F, 0.9878848130F, 0.9879406104F, 0.9879962225F, 0.9880516497F, 0.9881068924F, 0.9881619509F, 0.9882168256F, 0.9882715168F, 0.9883260249F, 0.9883803502F, 0.9884344931F, 0.9884884539F, 0.9885422331F, 0.9885958309F, 0.9886492477F, 0.9887024838F, 0.9887555397F, 0.9888084157F, 0.9888611120F, 0.9889136292F, 0.9889659675F, 0.9890181273F, 0.9890701089F, 0.9891219128F, 0.9891735392F, 0.9892249885F, 0.9892762610F, 0.9893273572F, 0.9893782774F, 0.9894290219F, 0.9894795911F, 0.9895299853F, 0.9895802049F, 0.9896302502F, 0.9896801217F, 0.9897298196F, 0.9897793443F, 0.9898286961F, 0.9898778755F, 0.9899268828F, 0.9899757183F, 0.9900243823F, 0.9900728753F, 0.9901211976F, 0.9901693495F, 0.9902173314F, 0.9902651436F, 0.9903127865F, 0.9903602605F, 0.9904075659F, 0.9904547031F, 0.9905016723F, 0.9905484740F, 0.9905951086F, 0.9906415763F, 0.9906878775F, 0.9907340126F, 0.9907799819F, 0.9908257858F, 0.9908714247F, 0.9909168988F, 0.9909622086F, 0.9910073543F, 0.9910523364F, 0.9910971552F, 0.9911418110F, 0.9911863042F, 0.9912306351F, 0.9912748042F, 0.9913188117F, 0.9913626580F, 0.9914063435F, 0.9914498684F, 0.9914932333F, 0.9915364383F, 0.9915794839F, 0.9916223703F, 0.9916650981F, 0.9917076674F, 0.9917500787F, 0.9917923323F, 0.9918344286F, 0.9918763679F, 0.9919181505F, 0.9919597769F, 0.9920012473F, 0.9920425621F, 0.9920837217F, 0.9921247263F, 0.9921655765F, 0.9922062724F, 0.9922468145F, 0.9922872030F, 0.9923274385F, 0.9923675211F, 0.9924074513F, 0.9924472294F, 0.9924868557F, 0.9925263306F, 0.9925656544F, 0.9926048275F, 0.9926438503F, 0.9926827230F, 0.9927214461F, 0.9927600199F, 0.9927984446F, 0.9928367208F, 0.9928748486F, 0.9929128285F, 0.9929506608F, 0.9929883459F, 0.9930258841F, 0.9930632757F, 0.9931005211F, 0.9931376207F, 0.9931745747F, 0.9932113836F, 0.9932480476F, 0.9932845671F, 0.9933209425F, 0.9933571742F, 0.9933932623F, 0.9934292074F, 0.9934650097F, 0.9935006696F, 0.9935361874F, 0.9935715635F, 0.9936067982F, 0.9936418919F, 0.9936768448F, 0.9937116574F, 0.9937463300F, 0.9937808629F, 0.9938152565F, 0.9938495111F, 0.9938836271F, 0.9939176047F, 0.9939514444F, 0.9939851465F, 0.9940187112F, 0.9940521391F, 0.9940854303F, 0.9941185853F, 0.9941516044F, 0.9941844879F, 0.9942172361F, 0.9942498495F, 0.9942823283F, 0.9943146729F, 0.9943468836F, 0.9943789608F, 0.9944109047F, 0.9944427158F, 0.9944743944F, 0.9945059408F, 0.9945373553F, 0.9945686384F, 0.9945997902F, 0.9946308112F, 0.9946617017F, 0.9946924621F, 0.9947230926F, 0.9947535937F, 0.9947839656F, 0.9948142086F, 0.9948443232F, 0.9948743097F, 0.9949041683F, 0.9949338995F, 0.9949635035F, 0.9949929807F, 0.9950223315F, 0.9950515561F, 0.9950806549F, 0.9951096282F, 0.9951384764F, 0.9951671998F, 0.9951957987F, 0.9952242735F, 0.9952526245F, 0.9952808520F, 0.9953089564F, 0.9953369380F, 0.9953647971F, 0.9953925340F, 0.9954201491F, 0.9954476428F, 0.9954750153F, 0.9955022670F, 0.9955293981F, 0.9955564092F, 0.9955833003F, 0.9956100720F, 0.9956367245F, 0.9956632582F, 0.9956896733F, 0.9957159703F, 0.9957421494F, 0.9957682110F, 0.9957941553F, 0.9958199828F, 0.9958456937F, 0.9958712884F, 0.9958967672F, 0.9959221305F, 0.9959473784F, 0.9959725115F, 0.9959975300F, 0.9960224342F, 0.9960472244F, 0.9960719011F, 0.9960964644F, 0.9961209148F, 0.9961452525F, 0.9961694779F, 0.9961935913F, 0.9962175930F, 0.9962414834F, 0.9962652627F, 0.9962889313F, 0.9963124895F, 0.9963359377F, 0.9963592761F, 0.9963825051F, 0.9964056250F, 0.9964286361F, 0.9964515387F, 0.9964743332F, 0.9964970198F, 0.9965195990F, 0.9965420709F, 0.9965644360F, 0.9965866946F, 0.9966088469F, 0.9966308932F, 0.9966528340F, 0.9966746695F, 0.9966964001F, 0.9967180260F, 0.9967395475F, 0.9967609651F, 0.9967822789F, 0.9968034894F, 0.9968245968F, 0.9968456014F, 0.9968665036F, 0.9968873037F, 0.9969080019F, 0.9969285987F, 0.9969490942F, 0.9969694889F, 0.9969897830F, 0.9970099769F, 0.9970300708F, 0.9970500651F, 0.9970699601F, 0.9970897561F, 0.9971094533F, 0.9971290522F, 0.9971485531F, 0.9971679561F, 0.9971872617F, 0.9972064702F, 0.9972255818F, 0.9972445968F, 0.9972635157F, 0.9972823386F, 0.9973010659F, 0.9973196980F, 0.9973382350F, 0.9973566773F, 0.9973750253F, 0.9973932791F, 0.9974114392F, 0.9974295059F, 0.9974474793F, 0.9974653599F, 0.9974831480F, 0.9975008438F, 0.9975184476F, 0.9975359598F, 0.9975533806F, 0.9975707104F, 0.9975879495F, 0.9976050981F, 0.9976221566F, 0.9976391252F, 0.9976560043F, 0.9976727941F, 0.9976894950F, 0.9977061073F, 0.9977226312F, 0.9977390671F, 0.9977554152F, 0.9977716759F, 0.9977878495F, 0.9978039361F, 0.9978199363F, 0.9978358501F, 0.9978516780F, 0.9978674202F, 0.9978830771F, 0.9978986488F, 0.9979141358F, 0.9979295383F, 0.9979448566F, 0.9979600909F, 0.9979752417F, 0.9979903091F, 0.9980052936F, 0.9980201952F, 0.9980350145F, 0.9980497515F, 0.9980644067F, 0.9980789804F, 0.9980934727F, 0.9981078841F, 0.9981222147F, 0.9981364649F, 0.9981506350F, 0.9981647253F, 0.9981787360F, 0.9981926674F, 0.9982065199F, 0.9982202936F, 0.9982339890F, 0.9982476062F, 0.9982611456F, 0.9982746074F, 0.9982879920F, 0.9983012996F, 0.9983145304F, 0.9983276849F, 0.9983407632F, 0.9983537657F, 0.9983666926F, 0.9983795442F, 0.9983923208F, 0.9984050226F, 0.9984176501F, 0.9984302033F, 0.9984426827F, 0.9984550884F, 0.9984674208F, 0.9984796802F, 0.9984918667F, 0.9985039808F, 0.9985160227F, 0.9985279926F, 0.9985398909F, 0.9985517177F, 0.9985634734F, 0.9985751583F, 0.9985867727F, 0.9985983167F, 0.9986097907F, 0.9986211949F, 0.9986325297F, 0.9986437953F, 0.9986549919F, 0.9986661199F, 0.9986771795F, 0.9986881710F, 0.9986990946F, 0.9987099507F, 0.9987207394F, 0.9987314611F, 0.9987421161F, 0.9987527045F, 0.9987632267F, 0.9987736829F, 0.9987840734F, 0.9987943985F, 0.9988046584F, 0.9988148534F, 0.9988249838F, 0.9988350498F, 0.9988450516F, 0.9988549897F, 0.9988648641F, 0.9988746753F, 0.9988844233F, 0.9988941086F, 0.9989037313F, 0.9989132918F, 0.9989227902F, 0.9989322269F, 0.9989416021F, 0.9989509160F, 0.9989601690F, 0.9989693613F, 0.9989784931F, 0.9989875647F, 0.9989965763F, 0.9990055283F, 0.9990144208F, 0.9990232541F, 0.9990320286F, 0.9990407443F, 0.9990494016F, 0.9990580008F, 0.9990665421F, 0.9990750257F, 0.9990834519F, 0.9990918209F, 0.9991001331F, 0.9991083886F, 0.9991165877F, 0.9991247307F, 0.9991328177F, 0.9991408491F, 0.9991488251F, 0.9991567460F, 0.9991646119F, 0.9991724232F, 0.9991801801F, 0.9991878828F, 0.9991955316F, 0.9992031267F, 0.9992106684F, 0.9992181569F, 0.9992255925F, 0.9992329753F, 0.9992403057F, 0.9992475839F, 0.9992548101F, 0.9992619846F, 0.9992691076F, 0.9992761793F, 0.9992832001F, 0.9992901701F, 0.9992970895F, 0.9993039587F, 0.9993107777F, 0.9993175470F, 0.9993242667F, 0.9993309371F, 0.9993375583F, 0.9993441307F, 0.9993506545F, 0.9993571298F, 0.9993635570F, 0.9993699362F, 0.9993762678F, 0.9993825519F, 0.9993887887F, 0.9993949785F, 0.9994011216F, 0.9994072181F, 0.9994132683F, 0.9994192725F, 0.9994252307F, 0.9994311434F, 0.9994370107F, 0.9994428327F, 0.9994486099F, 0.9994543423F, 0.9994600303F, 0.9994656739F, 0.9994712736F, 0.9994768294F, 0.9994823417F, 0.9994878105F, 0.9994932363F, 0.9994986191F, 0.9995039592F, 0.9995092568F, 0.9995145122F, 0.9995197256F, 0.9995248971F, 0.9995300270F, 0.9995351156F, 0.9995401630F, 0.9995451695F, 0.9995501352F, 0.9995550604F, 0.9995599454F, 0.9995647903F, 0.9995695953F, 0.9995743607F, 0.9995790866F, 0.9995837734F, 0.9995884211F, 0.9995930300F, 0.9995976004F, 0.9996021324F, 0.9996066263F, 0.9996110822F, 0.9996155004F, 0.9996198810F, 0.9996242244F, 0.9996285306F, 0.9996327999F, 0.9996370326F, 0.9996412287F, 0.9996453886F, 0.9996495125F, 0.9996536004F, 0.9996576527F, 0.9996616696F, 0.9996656512F, 0.9996695977F, 0.9996735094F, 0.9996773865F, 0.9996812291F, 0.9996850374F, 0.9996888118F, 0.9996925523F, 0.9996962591F, 0.9996999325F, 0.9997035727F, 0.9997071798F, 0.9997107541F, 0.9997142957F, 0.9997178049F, 0.9997212818F, 0.9997247266F, 0.9997281396F, 0.9997315209F, 0.9997348708F, 0.9997381893F, 0.9997414767F, 0.9997447333F, 0.9997479591F, 0.9997511544F, 0.9997543194F, 0.9997574542F, 0.9997605591F, 0.9997636342F, 0.9997666797F, 0.9997696958F, 0.9997726828F, 0.9997756407F, 0.9997785698F, 0.9997814703F, 0.9997843423F, 0.9997871860F, 0.9997900016F, 0.9997927894F, 0.9997955494F, 0.9997982818F, 0.9998009869F, 0.9998036648F, 0.9998063157F, 0.9998089398F, 0.9998115373F, 0.9998141082F, 0.9998166529F, 0.9998191715F, 0.9998216642F, 0.9998241311F, 0.9998265724F, 0.9998289884F, 0.9998313790F, 0.9998337447F, 0.9998360854F, 0.9998384015F, 0.9998406930F, 0.9998429602F, 0.9998452031F, 0.9998474221F, 0.9998496171F, 0.9998517885F, 0.9998539364F, 0.9998560610F, 0.9998581624F, 0.9998602407F, 0.9998622962F, 0.9998643291F, 0.9998663394F, 0.9998683274F, 0.9998702932F, 0.9998722370F, 0.9998741589F, 0.9998760591F, 0.9998779378F, 0.9998797952F, 0.9998816313F, 0.9998834464F, 0.9998852406F, 0.9998870141F, 0.9998887670F, 0.9998904995F, 0.9998922117F, 0.9998939039F, 0.9998955761F, 0.9998972285F, 0.9998988613F, 0.9999004746F, 0.9999020686F, 0.9999036434F, 0.9999051992F, 0.9999067362F, 0.9999082544F, 0.9999097541F, 0.9999112354F, 0.9999126984F, 0.9999141433F, 0.9999155703F, 0.9999169794F, 0.9999183709F, 0.9999197449F, 0.9999211014F, 0.9999224408F, 0.9999237631F, 0.9999250684F, 0.9999263570F, 0.9999276289F, 0.9999288843F, 0.9999301233F, 0.9999313461F, 0.9999325529F, 0.9999337437F, 0.9999349187F, 0.9999360780F, 0.9999372218F, 0.9999383503F, 0.9999394635F, 0.9999405616F, 0.9999416447F, 0.9999427129F, 0.9999437665F, 0.9999448055F, 0.9999458301F, 0.9999468404F, 0.9999478365F, 0.9999488185F, 0.9999497867F, 0.9999507411F, 0.9999516819F, 0.9999526091F, 0.9999535230F, 0.9999544236F, 0.9999553111F, 0.9999561856F, 0.9999570472F, 0.9999578960F, 0.9999587323F, 0.9999595560F, 0.9999603674F, 0.9999611666F, 0.9999619536F, 0.9999627286F, 0.9999634917F, 0.9999642431F, 0.9999649828F, 0.9999657110F, 0.9999664278F, 0.9999671334F, 0.9999678278F, 0.9999685111F, 0.9999691835F, 0.9999698451F, 0.9999704960F, 0.9999711364F, 0.9999717662F, 0.9999723858F, 0.9999729950F, 0.9999735942F, 0.9999741834F, 0.9999747626F, 0.9999753321F, 0.9999758919F, 0.9999764421F, 0.9999769828F, 0.9999775143F, 0.9999780364F, 0.9999785495F, 0.9999790535F, 0.9999795485F, 0.9999800348F, 0.9999805124F, 0.9999809813F, 0.9999814417F, 0.9999818938F, 0.9999823375F, 0.9999827731F, 0.9999832005F, 0.9999836200F, 0.9999840316F, 0.9999844353F, 0.9999848314F, 0.9999852199F, 0.9999856008F, 0.9999859744F, 0.9999863407F, 0.9999866997F, 0.9999870516F, 0.9999873965F, 0.9999877345F, 0.9999880656F, 0.9999883900F, 0.9999887078F, 0.9999890190F, 0.9999893237F, 0.9999896220F, 0.9999899140F, 0.9999901999F, 0.9999904796F, 0.9999907533F, 0.9999910211F, 0.9999912830F, 0.9999915391F, 0.9999917896F, 0.9999920345F, 0.9999922738F, 0.9999925077F, 0.9999927363F, 0.9999929596F, 0.9999931777F, 0.9999933907F, 0.9999935987F, 0.9999938018F, 0.9999940000F, 0.9999941934F, 0.9999943820F, 0.9999945661F, 0.9999947456F, 0.9999949206F, 0.9999950912F, 0.9999952575F, 0.9999954195F, 0.9999955773F, 0.9999957311F, 0.9999958807F, 0.9999960265F, 0.9999961683F, 0.9999963063F, 0.9999964405F, 0.9999965710F, 0.9999966979F, 0.9999968213F, 0.9999969412F, 0.9999970576F, 0.9999971707F, 0.9999972805F, 0.9999973871F, 0.9999974905F, 0.9999975909F, 0.9999976881F, 0.9999977824F, 0.9999978738F, 0.9999979624F, 0.9999980481F, 0.9999981311F, 0.9999982115F, 0.9999982892F, 0.9999983644F, 0.9999984370F, 0.9999985072F, 0.9999985750F, 0.9999986405F, 0.9999987037F, 0.9999987647F, 0.9999988235F, 0.9999988802F, 0.9999989348F, 0.9999989873F, 0.9999990379F, 0.9999990866F, 0.9999991334F, 0.9999991784F, 0.9999992217F, 0.9999992632F, 0.9999993030F, 0.9999993411F, 0.9999993777F, 0.9999994128F, 0.9999994463F, 0.9999994784F, 0.9999995091F, 0.9999995384F, 0.9999995663F, 0.9999995930F, 0.9999996184F, 0.9999996426F, 0.9999996657F, 0.9999996876F, 0.9999997084F, 0.9999997282F, 0.9999997469F, 0.9999997647F, 0.9999997815F, 0.9999997973F, 0.9999998123F, 0.9999998265F, 0.9999998398F, 0.9999998524F, 0.9999998642F, 0.9999998753F, 0.9999998857F, 0.9999998954F, 0.9999999045F, 0.9999999130F, 0.9999999209F, 0.9999999282F, 0.9999999351F, 0.9999999414F, 0.9999999472F, 0.9999999526F, 0.9999999576F, 0.9999999622F, 0.9999999664F, 0.9999999702F, 0.9999999737F, 0.9999999769F, 0.9999999798F, 0.9999999824F, 0.9999999847F, 0.9999999868F, 0.9999999887F, 0.9999999904F, 0.9999999919F, 0.9999999932F, 0.9999999943F, 0.9999999953F, 0.9999999961F, 0.9999999969F, 0.9999999975F, 0.9999999980F, 0.9999999985F, 0.9999999988F, 0.9999999991F, 0.9999999993F, 0.9999999995F, 0.9999999997F, 0.9999999998F, 0.9999999999F, 0.9999999999F, 1.0000000000F, 1.0000000000F, 1.0000000000F, 1.0000000000F, 1.0000000000F, 1.0000000000F, 1.0000000000F, }; const float ff_vorbis_floor1_inverse_db_table[256]={ 1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F, 1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F, 1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F, 2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F, 2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F, 3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F, 4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F, 6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F, 7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F, 1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F, 1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F, 1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F, 2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F, 2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F, 3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F, 4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F, 5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F, 7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F, 9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F, 1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F, 1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F, 2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F, 2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F, 3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F, 4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F, 5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F, 7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F, 9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F, 0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F, 0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F, 0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F, 0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F, 0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F, 0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F, 0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F, 0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F, 0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F, 0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F, 0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F, 0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F, 0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F, 0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F, 0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F, 0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F, 0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F, 0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F, 0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F, 0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F, 0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F, 0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F, 0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F, 0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F, 0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F, 0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F, 0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F, 0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F, 0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F, 0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F, 0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F, 0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F, 0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F, 0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F, 0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F, 0.82788260F, 0.88168307F, 0.9389798F, 1.F, }; const float * const ff_vorbis_vwin[8] = { vwin64, vwin128, vwin256, vwin512, vwin1024, vwin2048, vwin4096, vwin8192 };
123linslouis-android-video-cutter
jni/libavcodec/vorbis_data.c
C
asf20
136,908
/* * DXVA2 H264 HW acceleration. * * copyright (c) 2009 Laurent Aimar * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "dxva2_internal.h" #include "h264.h" #include "h264data.h" struct dxva2_picture_context { DXVA_PicParams_H264 pp; DXVA_Qmatrix_H264 qm; unsigned slice_count; DXVA_Slice_H264_Short slice_short[MAX_SLICES]; DXVA_Slice_H264_Long slice_long[MAX_SLICES]; const uint8_t *bitstream; unsigned bitstream_size; }; static void fill_picture_entry(DXVA_PicEntry_H264 *pic, unsigned index, unsigned flag) { assert((index&0x7f) == index && (flag&0x01) == flag); pic->bPicEntry = index | (flag << 7); } static void fill_picture_parameters(struct dxva_context *ctx, const H264Context *h, DXVA_PicParams_H264 *pp) { const MpegEncContext *s = &h->s; const Picture *current_picture = s->current_picture_ptr; int i; memset(pp, 0, sizeof(*pp)); /* Configure current picture */ fill_picture_entry(&pp->CurrPic, ff_dxva2_get_surface_index(ctx, current_picture), s->picture_structure == PICT_BOTTOM_FIELD); /* Configure the set of references */ pp->UsedForReferenceFlags = 0; pp->NonExistingFrameFlags = 0; for (i = 0; i < FF_ARRAY_ELEMS(pp->RefFrameList); i++) { if (i < h->short_ref_count + h->long_ref_count) { const Picture *r; if (i < h->short_ref_count) { r = h->short_ref[i]; assert(!r->long_ref); } else { r = h->long_ref[i - h->short_ref_count]; assert(r->long_ref); } fill_picture_entry(&pp->RefFrameList[i], ff_dxva2_get_surface_index(ctx, r), r->long_ref != 0); if ((r->reference & PICT_TOP_FIELD) && r->field_poc[0] != INT_MAX) pp->FieldOrderCntList[i][0] = r->field_poc[0]; if ((r->reference & PICT_BOTTOM_FIELD) && r->field_poc[1] != INT_MAX) pp->FieldOrderCntList[i][1] = r->field_poc[1]; pp->FrameNumList[i] = r->long_ref ? r->pic_id : r->frame_num; if (r->reference & PICT_TOP_FIELD) pp->UsedForReferenceFlags |= 1 << (2*i + 0); if (r->reference & PICT_BOTTOM_FIELD) pp->UsedForReferenceFlags |= 1 << (2*i + 1); } else { pp->RefFrameList[i].bPicEntry = 0xff; pp->FieldOrderCntList[i][0] = 0; pp->FieldOrderCntList[i][1] = 0; pp->FrameNumList[i] = 0; } } pp->wFrameWidthInMbsMinus1 = s->mb_width - 1; pp->wFrameHeightInMbsMinus1 = s->mb_height - 1; pp->num_ref_frames = h->sps.ref_frame_count; pp->wBitFields = ((s->picture_structure != PICT_FRAME) << 0) | (h->sps.mb_aff << 1) | (h->sps.residual_color_transform_flag << 2) | /* sp_for_switch_flag (not implemented by FFmpeg) */ (0 << 3) | (h->sps.chroma_format_idc << 4) | ((h->nal_ref_idc != 0) << 6) | (h->pps.constrained_intra_pred << 7) | (h->pps.weighted_pred << 8) | (h->pps.weighted_bipred_idc << 9) | /* MbsConsecutiveFlag */ (1 << 11) | (h->sps.frame_mbs_only_flag << 12) | (h->pps.transform_8x8_mode << 13) | ((h->sps.level_idc >= 31) << 14) | /* IntraPicFlag (Modified if we detect a non * intra slice in decode_slice) */ (1 << 15); pp->bit_depth_luma_minus8 = h->sps.bit_depth_luma - 8; pp->bit_depth_chroma_minus8 = h->sps.bit_depth_chroma - 8; pp->Reserved16Bits = 3; /* FIXME is there a way to detect the right mode ? */ pp->StatusReportFeedbackNumber = 1 + ctx->report_id++; pp->CurrFieldOrderCnt[0] = 0; if ((s->picture_structure & PICT_TOP_FIELD) && current_picture->field_poc[0] != INT_MAX) pp->CurrFieldOrderCnt[0] = current_picture->field_poc[0]; pp->CurrFieldOrderCnt[1] = 0; if ((s->picture_structure & PICT_BOTTOM_FIELD) && current_picture->field_poc[1] != INT_MAX) pp->CurrFieldOrderCnt[1] = current_picture->field_poc[1]; pp->pic_init_qs_minus26 = h->pps.init_qs - 26; pp->chroma_qp_index_offset = h->pps.chroma_qp_index_offset[0]; pp->second_chroma_qp_index_offset = h->pps.chroma_qp_index_offset[1]; pp->ContinuationFlag = 1; pp->pic_init_qp_minus26 = h->pps.init_qp - 26; pp->num_ref_idx_l0_active_minus1 = h->pps.ref_count[0] - 1; pp->num_ref_idx_l1_active_minus1 = h->pps.ref_count[1] - 1; pp->Reserved8BitsA = 0; pp->frame_num = h->frame_num; pp->log2_max_frame_num_minus4 = h->sps.log2_max_frame_num - 4; pp->pic_order_cnt_type = h->sps.poc_type; if (h->sps.poc_type == 0) pp->log2_max_pic_order_cnt_lsb_minus4 = h->sps.log2_max_poc_lsb - 4; else if (h->sps.poc_type == 1) pp->delta_pic_order_always_zero_flag = h->sps.delta_pic_order_always_zero_flag; pp->direct_8x8_inference_flag = h->sps.direct_8x8_inference_flag; pp->entropy_coding_mode_flag = h->pps.cabac; pp->pic_order_present_flag = h->pps.pic_order_present; pp->num_slice_groups_minus1 = h->pps.slice_group_count - 1; pp->slice_group_map_type = h->pps.mb_slice_group_map_type; pp->deblocking_filter_control_present_flag = h->pps.deblocking_filter_parameters_present; pp->redundant_pic_cnt_present_flag= h->pps.redundant_pic_cnt_present; pp->Reserved8BitsB = 0; pp->slice_group_change_rate_minus1= 0; /* XXX not implemented by FFmpeg */ //pp->SliceGroupMap[810]; /* XXX not implemented by FFmpeg */ } static void fill_scaling_lists(const H264Context *h, DXVA_Qmatrix_H264 *qm) { unsigned i, j; memset(qm, 0, sizeof(*qm)); for (i = 0; i < 6; i++) for (j = 0; j < 16; j++) qm->bScalingLists4x4[i][j] = h->pps.scaling_matrix4[i][zigzag_scan[j]]; for (i = 0; i < 2; i++) for (j = 0; j < 64; j++) qm->bScalingLists8x8[i][j] = h->pps.scaling_matrix8[i][ff_zigzag_direct[j]]; } static int is_slice_short(struct dxva_context *ctx) { assert(ctx->cfg->ConfigBitstreamRaw == 1 || ctx->cfg->ConfigBitstreamRaw == 2); return ctx->cfg->ConfigBitstreamRaw == 2; } static void fill_slice_short(DXVA_Slice_H264_Short *slice, unsigned position, unsigned size) { memset(slice, 0, sizeof(*slice)); slice->BSNALunitDataLocation = position; slice->SliceBytesInBuffer = size; slice->wBadSliceChopping = 0; } static void fill_slice_long(AVCodecContext *avctx, DXVA_Slice_H264_Long *slice, unsigned position, unsigned size) { const H264Context *h = avctx->priv_data; struct dxva_context *ctx = avctx->hwaccel_context; const MpegEncContext *s = &h->s; unsigned list; memset(slice, 0, sizeof(*slice)); slice->BSNALunitDataLocation = position; slice->SliceBytesInBuffer = size; slice->wBadSliceChopping = 0; slice->first_mb_in_slice = (s->mb_y >> FIELD_OR_MBAFF_PICTURE) * s->mb_width + s->mb_x; slice->NumMbsForSlice = 0; /* XXX it is set once we have all slices */ slice->BitOffsetToSliceData = get_bits_count(&s->gb) + 8; slice->slice_type = ff_h264_get_slice_type(h); if (h->slice_type_fixed) slice->slice_type += 5; slice->luma_log2_weight_denom = h->luma_log2_weight_denom; slice->chroma_log2_weight_denom = h->chroma_log2_weight_denom; if (h->list_count > 0) slice->num_ref_idx_l0_active_minus1 = h->ref_count[0] - 1; if (h->list_count > 1) slice->num_ref_idx_l1_active_minus1 = h->ref_count[1] - 1; slice->slice_alpha_c0_offset_div2 = h->slice_alpha_c0_offset / 2 - 26; slice->slice_beta_offset_div2 = h->slice_beta_offset / 2 - 26; slice->Reserved8Bits = 0; for (list = 0; list < 2; list++) { unsigned i; for (i = 0; i < FF_ARRAY_ELEMS(slice->RefPicList[list]); i++) { if (list < h->list_count && i < h->ref_count[list]) { const Picture *r = &h->ref_list[list][i]; unsigned plane; fill_picture_entry(&slice->RefPicList[list][i], ff_dxva2_get_surface_index(ctx, r), r->reference == PICT_BOTTOM_FIELD); for (plane = 0; plane < 3; plane++) { int w, o; if (plane == 0 && h->luma_weight_flag[list]) { w = h->luma_weight[i][list][0]; o = h->luma_weight[i][list][1]; } else if (plane >= 1 && h->chroma_weight_flag[list]) { w = h->chroma_weight[i][list][plane-1][0]; o = h->chroma_weight[i][list][plane-1][1]; } else { w = 1 << (plane == 0 ? h->luma_log2_weight_denom : h->chroma_log2_weight_denom); o = 0; } slice->Weights[list][i][plane][0] = w; slice->Weights[list][i][plane][1] = o; } } else { unsigned plane; slice->RefPicList[list][i].bPicEntry = 0xff; for (plane = 0; plane < 3; plane++) { slice->Weights[list][i][plane][0] = 0; slice->Weights[list][i][plane][1] = 0; } } } } slice->slice_qs_delta = 0; /* XXX not implemented by FFmpeg */ slice->slice_qp_delta = s->qscale - h->pps.init_qp; slice->redundant_pic_cnt = h->redundant_pic_count; if (h->slice_type == FF_B_TYPE) slice->direct_spatial_mv_pred_flag = h->direct_spatial_mv_pred; slice->cabac_init_idc = h->pps.cabac ? h->cabac_init_idc : 0; if (h->deblocking_filter < 2) slice->disable_deblocking_filter_idc = 1 - h->deblocking_filter; else slice->disable_deblocking_filter_idc = h->deblocking_filter; slice->slice_id = h->current_slice - 1; } static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, DXVA2_DecodeBufferDesc *bs, DXVA2_DecodeBufferDesc *sc) { const H264Context *h = avctx->priv_data; const MpegEncContext *s = &h->s; const unsigned mb_count = s->mb_width * s->mb_height; struct dxva_context *ctx = avctx->hwaccel_context; const Picture *current_picture = h->s.current_picture_ptr; struct dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private; DXVA_Slice_H264_Short *slice = NULL; uint8_t *dxva_data, *current, *end; unsigned dxva_size; void *slice_data; unsigned slice_size; unsigned padding; unsigned i; /* Create an annex B bitstream buffer with only slice NAL and finalize slice */ if (FAILED(IDirectXVideoDecoder_GetBuffer(ctx->decoder, DXVA2_BitStreamDateBufferType, &dxva_data, &dxva_size))) return -1; current = dxva_data; end = dxva_data + dxva_size; for (i = 0; i < ctx_pic->slice_count; i++) { static const uint8_t start_code[] = { 0, 0, 1 }; static const unsigned start_code_size = sizeof(start_code); unsigned position, size; assert(offsetof(DXVA_Slice_H264_Short, BSNALunitDataLocation) == offsetof(DXVA_Slice_H264_Long, BSNALunitDataLocation)); assert(offsetof(DXVA_Slice_H264_Short, SliceBytesInBuffer) == offsetof(DXVA_Slice_H264_Long, SliceBytesInBuffer)); if (is_slice_short(ctx)) slice = &ctx_pic->slice_short[i]; else slice = (DXVA_Slice_H264_Short*)&ctx_pic->slice_long[i]; position = slice->BSNALunitDataLocation; size = slice->SliceBytesInBuffer; if (start_code_size + size > end - current) { av_log(avctx, AV_LOG_ERROR, "Failed to build bitstream"); break; } slice->BSNALunitDataLocation = current - dxva_data; slice->SliceBytesInBuffer = start_code_size + size; if (!is_slice_short(ctx)) { DXVA_Slice_H264_Long *slice_long = (DXVA_Slice_H264_Long*)slice; if (i < ctx_pic->slice_count - 1) slice_long->NumMbsForSlice = slice_long[1].first_mb_in_slice - slice_long[0].first_mb_in_slice; else slice_long->NumMbsForSlice = mb_count - slice_long->first_mb_in_slice; } memcpy(current, start_code, start_code_size); current += start_code_size; memcpy(current, &ctx_pic->bitstream[position], size); current += size; } padding = FFMIN(128 - ((current - dxva_data) & 127), end - current); if (slice && padding > 0) { memset(current, 0, padding); current += padding; slice->SliceBytesInBuffer += padding; } if (FAILED(IDirectXVideoDecoder_ReleaseBuffer(ctx->decoder, DXVA2_BitStreamDateBufferType))) return -1; if (i < ctx_pic->slice_count) return -1; memset(bs, 0, sizeof(*bs)); bs->CompressedBufferType = DXVA2_BitStreamDateBufferType; bs->DataSize = current - dxva_data; bs->NumMBsInBuffer = mb_count; if (is_slice_short(ctx)) { slice_data = ctx_pic->slice_short; slice_size = ctx_pic->slice_count * sizeof(*ctx_pic->slice_short); } else { slice_data = ctx_pic->slice_long; slice_size = ctx_pic->slice_count * sizeof(*ctx_pic->slice_long); } assert((bs->DataSize & 127) == 0); return ff_dxva2_commit_buffer(avctx, ctx, sc, DXVA2_SliceControlBufferType, slice_data, slice_size, mb_count); } static int start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) { const H264Context *h = avctx->priv_data; struct dxva_context *ctx = avctx->hwaccel_context; struct dxva2_picture_context *ctx_pic = h->s.current_picture_ptr->hwaccel_picture_private; if (!ctx->decoder || !ctx->cfg || ctx->surface_count <= 0) return -1; assert(ctx_pic); /* Fill up DXVA_PicParams_H264 */ fill_picture_parameters(ctx, h, &ctx_pic->pp); /* Fill up DXVA_Qmatrix_H264 */ fill_scaling_lists(h, &ctx_pic->qm); ctx_pic->slice_count = 0; ctx_pic->bitstream_size = 0; ctx_pic->bitstream = NULL; return 0; } static int decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { const H264Context *h = avctx->priv_data; struct dxva_context *ctx = avctx->hwaccel_context; const Picture *current_picture = h->s.current_picture_ptr; struct dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private; unsigned position; if (ctx_pic->slice_count >= MAX_SLICES) return -1; if (!ctx_pic->bitstream) ctx_pic->bitstream = buffer; ctx_pic->bitstream_size += size; position = buffer - ctx_pic->bitstream; if (is_slice_short(ctx)) fill_slice_short(&ctx_pic->slice_short[ctx_pic->slice_count], position, size); else fill_slice_long(avctx, &ctx_pic->slice_long[ctx_pic->slice_count], position, size); ctx_pic->slice_count++; if (h->slice_type != FF_I_TYPE && h->slice_type != FF_SI_TYPE) ctx_pic->pp.wBitFields &= ~(1 << 15); /* Set IntraPicFlag to 0 */ return 0; } static int end_frame(AVCodecContext *avctx) { H264Context *h = avctx->priv_data; MpegEncContext *s = &h->s; struct dxva2_picture_context *ctx_pic = h->s.current_picture_ptr->hwaccel_picture_private; if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0) return -1; return ff_dxva2_common_end_frame(avctx, s, &ctx_pic->pp, sizeof(ctx_pic->pp), &ctx_pic->qm, sizeof(ctx_pic->qm), commit_bitstream_and_slice_buffer); } AVHWAccel h264_dxva2_hwaccel = { .name = "h264_dxva2", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_H264, .pix_fmt = PIX_FMT_DXVA2_VLD, .capabilities = 0, .start_frame = start_frame, .decode_slice = decode_slice, .end_frame = end_frame, .priv_data_size = sizeof(struct dxva2_picture_context), };
123linslouis-android-video-cutter
jni/libavcodec/dxva2_h264.c
C
asf20
18,619
/* * PNM image format * Copyright (c) 2002, 2003 Fabrice Bellard * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avcodec.h" #include "bytestream.h" #include "put_bits.h" #include "pnm.h" static int pnm_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; PNMContext * const s = avctx->priv_data; AVFrame *picture = data; AVFrame * const p = (AVFrame*)&s->picture; int i, j, n, linesize, h, upgrade = 0; unsigned char *ptr; int components, sample_len; s->bytestream_start = s->bytestream = buf; s->bytestream_end = buf + buf_size; if (ff_pnm_decode_header(avctx, s) < 0) return -1; if (p->data[0]) avctx->release_buffer(avctx, p); p->reference = 0; if (avctx->get_buffer(avctx, p) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } p->pict_type = FF_I_TYPE; p->key_frame = 1; switch (avctx->pix_fmt) { default: return -1; case PIX_FMT_RGB48BE: n = avctx->width * 6; components=3; sample_len=16; goto do_read; case PIX_FMT_RGB24: n = avctx->width * 3; components=3; sample_len=8; goto do_read; case PIX_FMT_GRAY8: n = avctx->width; components=1; sample_len=8; if (s->maxval < 255) upgrade = 1; goto do_read; case PIX_FMT_GRAY16BE: case PIX_FMT_GRAY16LE: n = avctx->width * 2; components=1; sample_len=16; if (s->maxval < 65535) upgrade = 2; goto do_read; case PIX_FMT_MONOWHITE: case PIX_FMT_MONOBLACK: n = (avctx->width + 7) >> 3; components=1; sample_len=1; do_read: ptr = p->data[0]; linesize = p->linesize[0]; if (s->bytestream + n * avctx->height > s->bytestream_end) return -1; if(s->type < 4){ for (i=0; i<avctx->height; i++) { PutBitContext pb; init_put_bits(&pb, ptr, linesize); for(j=0; j<avctx->width * components; j++){ unsigned int c=0; int v=0; while(s->bytestream < s->bytestream_end && (*s->bytestream < '0' || *s->bytestream > '9' )) s->bytestream++; if(s->bytestream >= s->bytestream_end) return -1; do{ v= 10*v + c; c= (*s->bytestream++) - '0'; }while(c <= 9); put_bits(&pb, sample_len, (((1<<sample_len)-1)*v + (s->maxval>>1))/s->maxval); } flush_put_bits(&pb); ptr+= linesize; } }else{ for (i = 0; i < avctx->height; i++) { if (!upgrade) memcpy(ptr, s->bytestream, n); else if (upgrade == 1) { unsigned int j, f = (255 * 128 + s->maxval / 2) / s->maxval; for (j = 0; j < n; j++) ptr[j] = (s->bytestream[j] * f + 64) >> 7; } else if (upgrade == 2) { unsigned int j, v, f = (65535 * 32768 + s->maxval / 2) / s->maxval; for (j = 0; j < n / 2; j++) { v = be2me_16(((uint16_t *)s->bytestream)[j]); ((uint16_t *)ptr)[j] = (v * f + 16384) >> 15; } } s->bytestream += n; ptr += linesize; } } break; case PIX_FMT_YUV420P: { unsigned char *ptr1, *ptr2; n = avctx->width; ptr = p->data[0]; linesize = p->linesize[0]; if (s->bytestream + n * avctx->height * 3 / 2 > s->bytestream_end) return -1; for (i = 0; i < avctx->height; i++) { memcpy(ptr, s->bytestream, n); s->bytestream += n; ptr += linesize; } ptr1 = p->data[1]; ptr2 = p->data[2]; n >>= 1; h = avctx->height >> 1; for (i = 0; i < h; i++) { memcpy(ptr1, s->bytestream, n); s->bytestream += n; memcpy(ptr2, s->bytestream, n); s->bytestream += n; ptr1 += p->linesize[1]; ptr2 += p->linesize[2]; } } break; case PIX_FMT_RGB32: ptr = p->data[0]; linesize = p->linesize[0]; if (s->bytestream + avctx->width * avctx->height * 4 > s->bytestream_end) return -1; for (i = 0; i < avctx->height; i++) { int j, r, g, b, a; for (j = 0; j < avctx->width; j++) { r = *s->bytestream++; g = *s->bytestream++; b = *s->bytestream++; a = *s->bytestream++; ((uint32_t *)ptr)[j] = (a << 24) | (r << 16) | (g << 8) | b; } ptr += linesize; } break; } *picture = *(AVFrame*)&s->picture; *data_size = sizeof(AVPicture); return s->bytestream - s->bytestream_start; } #if CONFIG_PGM_DECODER AVCodec pgm_decoder = { "pgm", AVMEDIA_TYPE_VIDEO, CODEC_ID_PGM, sizeof(PNMContext), ff_pnm_init, NULL, ff_pnm_end, pnm_decode_frame, CODEC_CAP_DR1, .pix_fmts = (const enum PixelFormat[]){PIX_FMT_GRAY8, PIX_FMT_GRAY16BE, PIX_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("PGM (Portable GrayMap) image"), }; #endif #if CONFIG_PGMYUV_DECODER AVCodec pgmyuv_decoder = { "pgmyuv", AVMEDIA_TYPE_VIDEO, CODEC_ID_PGMYUV, sizeof(PNMContext), ff_pnm_init, NULL, ff_pnm_end, pnm_decode_frame, CODEC_CAP_DR1, .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("PGMYUV (Portable GrayMap YUV) image"), }; #endif #if CONFIG_PPM_DECODER AVCodec ppm_decoder = { "ppm", AVMEDIA_TYPE_VIDEO, CODEC_ID_PPM, sizeof(PNMContext), ff_pnm_init, NULL, ff_pnm_end, pnm_decode_frame, CODEC_CAP_DR1, .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB48BE, PIX_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"), }; #endif #if CONFIG_PBM_DECODER AVCodec pbm_decoder = { "pbm", AVMEDIA_TYPE_VIDEO, CODEC_ID_PBM, sizeof(PNMContext), ff_pnm_init, NULL, ff_pnm_end, pnm_decode_frame, CODEC_CAP_DR1, .pix_fmts = (const enum PixelFormat[]){PIX_FMT_MONOWHITE, PIX_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("PBM (Portable BitMap) image"), }; #endif #if CONFIG_PAM_DECODER AVCodec pam_decoder = { "pam", AVMEDIA_TYPE_VIDEO, CODEC_ID_PAM, sizeof(PNMContext), ff_pnm_init, NULL, ff_pnm_end, pnm_decode_frame, CODEC_CAP_DR1, .pix_fmts = (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_GRAY8, PIX_FMT_MONOWHITE, PIX_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"), }; #endif
123linslouis-android-video-cutter
jni/libavcodec/pnmdec.c
C
asf20
8,050
/* * MLP parser * Copyright (c) 2007 Ian Caulfield * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * MLP parser */ #include <stdint.h> #include "libavutil/crc.h" #include "get_bits.h" #include "parser.h" #include "mlp_parser.h" #include "mlp.h" static const uint8_t mlp_quants[16] = { 16, 20, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static const uint8_t mlp_channels[32] = { 1, 2, 3, 4, 3, 4, 5, 3, 4, 5, 4, 5, 6, 4, 5, 4, 5, 6, 5, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static const uint8_t thd_chancount[13] = { // LR C LFE LRs LRvh LRc LRrs Cs Ts LRsd LRw Cvh LFE2 2, 1, 1, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1 }; static int mlp_samplerate(int in) { if (in == 0xF) return 0; return (in & 8 ? 44100 : 48000) << (in & 7) ; } static int truehd_channels(int chanmap) { int channels = 0, i; for (i = 0; i < 13; i++) channels += thd_chancount[i] * ((chanmap >> i) & 1); return channels; } /** Read a major sync info header - contains high level information about * the stream - sample rate, channel arrangement etc. Most of this * information is not actually necessary for decoding, only for playback. * gb must be a freshly initialized GetBitContext with no bits read. */ int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb) { int ratebits; uint16_t checksum; assert(get_bits_count(gb) == 0); if (gb->size_in_bits < 28 << 3) { av_log(log, AV_LOG_ERROR, "packet too short, unable to read major sync\n"); return -1; } checksum = ff_mlp_checksum16(gb->buffer, 26); if (checksum != AV_RL16(gb->buffer+26)) { av_log(log, AV_LOG_ERROR, "major sync info header checksum error\n"); return -1; } if (get_bits_long(gb, 24) != 0xf8726f) /* Sync words */ return -1; mh->stream_type = get_bits(gb, 8); if (mh->stream_type == 0xbb) { mh->group1_bits = mlp_quants[get_bits(gb, 4)]; mh->group2_bits = mlp_quants[get_bits(gb, 4)]; ratebits = get_bits(gb, 4); mh->group1_samplerate = mlp_samplerate(ratebits); mh->group2_samplerate = mlp_samplerate(get_bits(gb, 4)); skip_bits(gb, 11); mh->channels_mlp = get_bits(gb, 5); } else if (mh->stream_type == 0xba) { mh->group1_bits = 24; // TODO: Is this information actually conveyed anywhere? mh->group2_bits = 0; ratebits = get_bits(gb, 4); mh->group1_samplerate = mlp_samplerate(ratebits); mh->group2_samplerate = 0; skip_bits(gb, 8); mh->channels_thd_stream1 = get_bits(gb, 5); skip_bits(gb, 2); mh->channels_thd_stream2 = get_bits(gb, 13); } else return -1; mh->access_unit_size = 40 << (ratebits & 7); mh->access_unit_size_pow2 = 64 << (ratebits & 7); skip_bits_long(gb, 48); mh->is_vbr = get_bits1(gb); mh->peak_bitrate = (get_bits(gb, 15) * mh->group1_samplerate + 8) >> 4; mh->num_substreams = get_bits(gb, 4); skip_bits_long(gb, 4 + 11 * 8); return 0; } typedef struct MLPParseContext { ParseContext pc; int bytes_left; int in_sync; int num_substreams; } MLPParseContext; static av_cold int mlp_init(AVCodecParserContext *s) { ff_mlp_init_crc(); return 0; } static int mlp_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size) { MLPParseContext *mp = s->priv_data; int sync_present; uint8_t parity_bits; int next; int i, p = 0; *poutbuf_size = 0; if (buf_size == 0) return 0; if (!mp->in_sync) { // Not in sync - find a major sync header for (i = 0; i < buf_size; i++) { mp->pc.state = (mp->pc.state << 8) | buf[i]; if ((mp->pc.state & 0xfffffffe) == 0xf8726fba && // ignore if we do not have the data for the start of header mp->pc.index + i >= 7) { mp->in_sync = 1; mp->bytes_left = 0; break; } } if (!mp->in_sync) { ff_combine_frame(&mp->pc, END_NOT_FOUND, &buf, &buf_size); return buf_size; } ff_combine_frame(&mp->pc, i - 7, &buf, &buf_size); return i - 7; } if (mp->bytes_left == 0) { // Find length of this packet /* Copy overread bytes from last frame into buffer. */ for(; mp->pc.overread>0; mp->pc.overread--) { mp->pc.buffer[mp->pc.index++]= mp->pc.buffer[mp->pc.overread_index++]; } if (mp->pc.index + buf_size < 2) { ff_combine_frame(&mp->pc, END_NOT_FOUND, &buf, &buf_size); return buf_size; } mp->bytes_left = ((mp->pc.index > 0 ? mp->pc.buffer[0] : buf[0]) << 8) | (mp->pc.index > 1 ? mp->pc.buffer[1] : buf[1-mp->pc.index]); mp->bytes_left = (mp->bytes_left & 0xfff) * 2; mp->bytes_left -= mp->pc.index; } next = (mp->bytes_left > buf_size) ? END_NOT_FOUND : mp->bytes_left; if (ff_combine_frame(&mp->pc, next, &buf, &buf_size) < 0) { mp->bytes_left -= buf_size; return buf_size; } mp->bytes_left = 0; sync_present = (AV_RB32(buf + 4) & 0xfffffffe) == 0xf8726fba; if (!sync_present) { /* The first nibble of a frame is a parity check of the 4-byte * access unit header and all the 2- or 4-byte substream headers. */ // Only check when this isn't a sync frame - syncs have a checksum. parity_bits = 0; for (i = -1; i < mp->num_substreams; i++) { parity_bits ^= buf[p++]; parity_bits ^= buf[p++]; if (i < 0 || buf[p-2] & 0x80) { parity_bits ^= buf[p++]; parity_bits ^= buf[p++]; } } if ((((parity_bits >> 4) ^ parity_bits) & 0xF) != 0xF) { av_log(avctx, AV_LOG_INFO, "mlpparse: Parity check failed.\n"); goto lost_sync; } } else { GetBitContext gb; MLPHeaderInfo mh; init_get_bits(&gb, buf + 4, (buf_size - 4) << 3); if (ff_mlp_read_major_sync(avctx, &mh, &gb) < 0) goto lost_sync; avctx->bits_per_raw_sample = mh.group1_bits; if (avctx->bits_per_raw_sample > 16) avctx->sample_fmt = SAMPLE_FMT_S32; else avctx->sample_fmt = SAMPLE_FMT_S16; avctx->sample_rate = mh.group1_samplerate; avctx->frame_size = mh.access_unit_size; if (mh.stream_type == 0xbb) { /* MLP stream */ avctx->channels = mlp_channels[mh.channels_mlp]; } else { /* mh.stream_type == 0xba */ /* TrueHD stream */ if (mh.channels_thd_stream2) avctx->channels = truehd_channels(mh.channels_thd_stream2); else avctx->channels = truehd_channels(mh.channels_thd_stream1); } if (!mh.is_vbr) /* Stream is CBR */ avctx->bit_rate = mh.peak_bitrate; mp->num_substreams = mh.num_substreams; } *poutbuf = buf; *poutbuf_size = buf_size; return next; lost_sync: mp->in_sync = 0; return 1; } AVCodecParser mlp_parser = { { CODEC_ID_MLP, CODEC_ID_TRUEHD }, sizeof(MLPParseContext), mlp_init, mlp_parse, ff_parse_close, };
123linslouis-android-video-cutter
jni/libavcodec/mlp_parser.c
C
asf20
8,265
/* * Provides registration of all codecs, parsers and bitstream filters for libavcodec. * Copyright (c) 2002 Fabrice Bellard * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * Provides registration of all codecs, parsers and bitstream filters for libavcodec. */ #include "avcodec.h" #define REGISTER_HWACCEL(X,x) { \ extern AVHWAccel x##_hwaccel; \ if(CONFIG_##X##_HWACCEL) av_register_hwaccel(&x##_hwaccel); } #define REGISTER_ENCODER(X,x) { \ extern AVCodec x##_encoder; \ if(CONFIG_##X##_ENCODER) avcodec_register(&x##_encoder); } #define REGISTER_DECODER(X,x) { \ extern AVCodec x##_decoder; \ if(CONFIG_##X##_DECODER) avcodec_register(&x##_decoder); } #define REGISTER_ENCDEC(X,x) REGISTER_ENCODER(X,x); REGISTER_DECODER(X,x) #define REGISTER_PARSER(X,x) { \ extern AVCodecParser x##_parser; \ if(CONFIG_##X##_PARSER) av_register_codec_parser(&x##_parser); } #define REGISTER_BSF(X,x) { \ extern AVBitStreamFilter x##_bsf; \ if(CONFIG_##X##_BSF) av_register_bitstream_filter(&x##_bsf); } void avcodec_register_all(void) { static int initialized; if (initialized) return; initialized = 1; /* hardware accelerators */ REGISTER_HWACCEL (H263_VAAPI, h263_vaapi); REGISTER_HWACCEL (H264_DXVA2, h264_dxva2); REGISTER_HWACCEL (H264_VAAPI, h264_vaapi); REGISTER_HWACCEL (MPEG2_VAAPI, mpeg2_vaapi); REGISTER_HWACCEL (MPEG4_VAAPI, mpeg4_vaapi); REGISTER_HWACCEL (VC1_DXVA2, vc1_dxva2); REGISTER_HWACCEL (VC1_VAAPI, vc1_vaapi); REGISTER_HWACCEL (WMV3_DXVA2, wmv3_dxva2); REGISTER_HWACCEL (WMV3_VAAPI, wmv3_vaapi); /* video codecs */ REGISTER_DECODER (AASC, aasc); REGISTER_DECODER (AMV, amv); REGISTER_DECODER (ANM, anm); REGISTER_ENCDEC (ASV1, asv1); REGISTER_ENCDEC (ASV2, asv2); REGISTER_DECODER (AURA, aura); REGISTER_DECODER (AURA2, aura2); REGISTER_DECODER (AVS, avs); REGISTER_DECODER (BETHSOFTVID, bethsoftvid); REGISTER_DECODER (BFI, bfi); REGISTER_DECODER (BINK, bink); REGISTER_ENCDEC (BMP, bmp); REGISTER_DECODER (C93, c93); REGISTER_DECODER (CAVS, cavs); REGISTER_DECODER (CDGRAPHICS, cdgraphics); REGISTER_DECODER (CINEPAK, cinepak); REGISTER_DECODER (CLJR, cljr); REGISTER_DECODER (CSCD, cscd); REGISTER_DECODER (CYUV, cyuv); REGISTER_ENCDEC (DNXHD, dnxhd); REGISTER_DECODER (DPX, dpx); REGISTER_DECODER (DSICINVIDEO, dsicinvideo); REGISTER_ENCDEC (DVVIDEO, dvvideo); REGISTER_DECODER (DXA, dxa); REGISTER_DECODER (EACMV, eacmv); REGISTER_DECODER (EAMAD, eamad); REGISTER_DECODER (EATGQ, eatgq); REGISTER_DECODER (EATGV, eatgv); REGISTER_DECODER (EATQI, eatqi); REGISTER_DECODER (EIGHTBPS, eightbps); REGISTER_DECODER (EIGHTSVX_EXP, eightsvx_exp); REGISTER_DECODER (EIGHTSVX_FIB, eightsvx_fib); REGISTER_DECODER (ESCAPE124, escape124); REGISTER_ENCDEC (FFV1, ffv1); REGISTER_ENCDEC (FFVHUFF, ffvhuff); REGISTER_ENCDEC (FLASHSV, flashsv); REGISTER_DECODER (FLIC, flic); REGISTER_ENCDEC (FLV, flv); REGISTER_DECODER (FOURXM, fourxm); REGISTER_DECODER (FRAPS, fraps); REGISTER_DECODER (FRWU, frwu); REGISTER_ENCDEC (GIF, gif); REGISTER_ENCDEC (H261, h261); REGISTER_ENCDEC (H263, h263); REGISTER_DECODER (H263I, h263i); REGISTER_ENCODER (H263P, h263p); REGISTER_DECODER (H264, h264); REGISTER_DECODER (H264_VDPAU, h264_vdpau); REGISTER_ENCDEC (HUFFYUV, huffyuv); REGISTER_DECODER (IDCIN, idcin); REGISTER_DECODER (IFF_BYTERUN1, iff_byterun1); REGISTER_DECODER (IFF_ILBM, iff_ilbm); REGISTER_DECODER (INDEO2, indeo2); REGISTER_DECODER (INDEO3, indeo3); REGISTER_DECODER (INDEO5, indeo5); REGISTER_DECODER (INTERPLAY_VIDEO, interplay_video); REGISTER_ENCDEC (JPEGLS, jpegls); REGISTER_DECODER (KGV1, kgv1); REGISTER_DECODER (KMVC, kmvc); REGISTER_ENCODER (LJPEG, ljpeg); REGISTER_DECODER (LOCO, loco); REGISTER_DECODER (MDEC, mdec); REGISTER_DECODER (MIMIC, mimic); REGISTER_ENCDEC (MJPEG, mjpeg); REGISTER_DECODER (MJPEGB, mjpegb); REGISTER_DECODER (MMVIDEO, mmvideo); REGISTER_DECODER (MOTIONPIXELS, motionpixels); REGISTER_DECODER (MPEG_XVMC, mpeg_xvmc); REGISTER_ENCDEC (MPEG1VIDEO, mpeg1video); REGISTER_ENCDEC (MPEG2VIDEO, mpeg2video); REGISTER_ENCDEC (MPEG4, mpeg4); REGISTER_DECODER (MPEG4_VDPAU, mpeg4_vdpau); REGISTER_DECODER (MPEGVIDEO, mpegvideo); REGISTER_DECODER (MPEG_VDPAU, mpeg_vdpau); REGISTER_DECODER (MPEG1_VDPAU, mpeg1_vdpau); REGISTER_ENCDEC (MSMPEG4V1, msmpeg4v1); REGISTER_ENCDEC (MSMPEG4V2, msmpeg4v2); REGISTER_ENCDEC (MSMPEG4V3, msmpeg4v3); REGISTER_DECODER (MSRLE, msrle); REGISTER_DECODER (MSVIDEO1, msvideo1); REGISTER_DECODER (MSZH, mszh); REGISTER_DECODER (NUV, nuv); REGISTER_ENCDEC (PAM, pam); REGISTER_ENCDEC (PBM, pbm); REGISTER_ENCDEC (PCX, pcx); REGISTER_ENCDEC (PGM, pgm); REGISTER_ENCDEC (PGMYUV, pgmyuv); REGISTER_ENCDEC (PNG, png); REGISTER_ENCDEC (PPM, ppm); REGISTER_DECODER (PTX, ptx); REGISTER_DECODER (QDRAW, qdraw); REGISTER_DECODER (QPEG, qpeg); REGISTER_ENCDEC (QTRLE, qtrle); REGISTER_DECODER (R210, r210); REGISTER_ENCDEC (RAWVIDEO, rawvideo); REGISTER_DECODER (RL2, rl2); REGISTER_ENCDEC (ROQ, roq); REGISTER_DECODER (RPZA, rpza); REGISTER_ENCDEC (RV10, rv10); REGISTER_ENCDEC (RV20, rv20); REGISTER_DECODER (RV30, rv30); REGISTER_DECODER (RV40, rv40); REGISTER_ENCDEC (SGI, sgi); REGISTER_DECODER (SMACKER, smacker); REGISTER_DECODER (SMC, smc); REGISTER_ENCDEC (SNOW, snow); REGISTER_DECODER (SP5X, sp5x); REGISTER_DECODER (SUNRAST, sunrast); REGISTER_ENCDEC (SVQ1, svq1); REGISTER_DECODER (SVQ3, svq3); REGISTER_ENCDEC (TARGA, targa); REGISTER_DECODER (THEORA, theora); REGISTER_DECODER (THP, thp); REGISTER_DECODER (TIERTEXSEQVIDEO, tiertexseqvideo); REGISTER_ENCDEC (TIFF, tiff); REGISTER_DECODER (TMV, tmv); REGISTER_DECODER (TRUEMOTION1, truemotion1); REGISTER_DECODER (TRUEMOTION2, truemotion2); REGISTER_DECODER (TSCC, tscc); REGISTER_DECODER (TXD, txd); REGISTER_DECODER (ULTI, ulti); REGISTER_ENCDEC (V210, v210); REGISTER_DECODER (V210X, v210x); REGISTER_DECODER (VB, vb); REGISTER_DECODER (VC1, vc1); REGISTER_DECODER (VC1_VDPAU, vc1_vdpau); REGISTER_DECODER (VCR1, vcr1); REGISTER_DECODER (VMDVIDEO, vmdvideo); REGISTER_DECODER (VMNC, vmnc); REGISTER_DECODER (VP3, vp3); REGISTER_DECODER (VP5, vp5); REGISTER_DECODER (VP6, vp6); REGISTER_DECODER (VP6A, vp6a); REGISTER_DECODER (VP6F, vp6f); REGISTER_DECODER (VQA, vqa); REGISTER_ENCDEC (WMV1, wmv1); REGISTER_ENCDEC (WMV2, wmv2); REGISTER_DECODER (WMV3, wmv3); REGISTER_DECODER (WMV3_VDPAU, wmv3_vdpau); REGISTER_DECODER (WNV1, wnv1); REGISTER_DECODER (XAN_WC3, xan_wc3); REGISTER_DECODER (XL, xl); REGISTER_DECODER (YOP, yop); REGISTER_ENCDEC (ZLIB, zlib); REGISTER_ENCDEC (ZMBV, zmbv); /* audio codecs */ REGISTER_ENCDEC (AAC, aac); REGISTER_ENCDEC (AC3, ac3); REGISTER_ENCDEC (ALAC, alac); REGISTER_DECODER (ALS, als); REGISTER_DECODER (AMRNB, amrnb); REGISTER_DECODER (APE, ape); REGISTER_DECODER (ATRAC1, atrac1); REGISTER_DECODER (ATRAC3, atrac3); REGISTER_DECODER (BINKAUDIO_DCT, binkaudio_dct); REGISTER_DECODER (BINKAUDIO_RDFT, binkaudio_rdft); REGISTER_DECODER (COOK, cook); REGISTER_DECODER (DCA, dca); REGISTER_DECODER (DSICINAUDIO, dsicinaudio); REGISTER_DECODER (EAC3, eac3); REGISTER_ENCDEC (FLAC, flac); REGISTER_DECODER (IMC, imc); REGISTER_DECODER (MACE3, mace3); REGISTER_DECODER (MACE6, mace6); REGISTER_DECODER (MLP, mlp); REGISTER_DECODER (MP1, mp1); REGISTER_ENCDEC (MP2, mp2); REGISTER_DECODER (MP3, mp3); REGISTER_DECODER (MP3ADU, mp3adu); REGISTER_DECODER (MP3ON4, mp3on4); REGISTER_DECODER (MPC7, mpc7); REGISTER_DECODER (MPC8, mpc8); REGISTER_ENCDEC (NELLYMOSER, nellymoser); REGISTER_DECODER (QCELP, qcelp); REGISTER_DECODER (QDM2, qdm2); REGISTER_DECODER (RA_144, ra_144); REGISTER_DECODER (RA_288, ra_288); REGISTER_DECODER (SHORTEN, shorten); REGISTER_DECODER (SIPR, sipr); REGISTER_DECODER (SMACKAUD, smackaud); REGISTER_ENCDEC (SONIC, sonic); REGISTER_ENCODER (SONIC_LS, sonic_ls); REGISTER_DECODER (TRUEHD, truehd); REGISTER_DECODER (TRUESPEECH, truespeech); REGISTER_DECODER (TTA, tta); REGISTER_DECODER (TWINVQ, twinvq); REGISTER_DECODER (VMDAUDIO, vmdaudio); REGISTER_DECODER (VORBIS, vorbis); REGISTER_DECODER (WAVPACK, wavpack); REGISTER_DECODER (WMAPRO, wmapro); REGISTER_ENCDEC (WMAV1, wmav1); REGISTER_ENCDEC (WMAV2, wmav2); REGISTER_DECODER (WMAVOICE, wmavoice); REGISTER_DECODER (WS_SND1, ws_snd1); /* PCM codecs */ REGISTER_ENCDEC (PCM_ALAW, pcm_alaw); REGISTER_DECODER (PCM_BLURAY, pcm_bluray); REGISTER_DECODER (PCM_DVD, pcm_dvd); REGISTER_ENCDEC (PCM_F32BE, pcm_f32be); REGISTER_ENCDEC (PCM_F32LE, pcm_f32le); REGISTER_ENCDEC (PCM_F64BE, pcm_f64be); REGISTER_ENCDEC (PCM_F64LE, pcm_f64le); REGISTER_ENCDEC (PCM_MULAW, pcm_mulaw); REGISTER_ENCDEC (PCM_S8, pcm_s8); REGISTER_ENCDEC (PCM_S16BE, pcm_s16be); REGISTER_ENCDEC (PCM_S16LE, pcm_s16le); REGISTER_DECODER (PCM_S16LE_PLANAR, pcm_s16le_planar); REGISTER_ENCDEC (PCM_S24BE, pcm_s24be); REGISTER_ENCDEC (PCM_S24DAUD, pcm_s24daud); REGISTER_ENCDEC (PCM_S24LE, pcm_s24le); REGISTER_ENCDEC (PCM_S32BE, pcm_s32be); REGISTER_ENCDEC (PCM_S32LE, pcm_s32le); REGISTER_ENCDEC (PCM_U8, pcm_u8); REGISTER_ENCDEC (PCM_U16BE, pcm_u16be); REGISTER_ENCDEC (PCM_U16LE, pcm_u16le); REGISTER_ENCDEC (PCM_U24BE, pcm_u24be); REGISTER_ENCDEC (PCM_U24LE, pcm_u24le); REGISTER_ENCDEC (PCM_U32BE, pcm_u32be); REGISTER_ENCDEC (PCM_U32LE, pcm_u32le); REGISTER_ENCDEC (PCM_ZORK , pcm_zork); /* DPCM codecs */ REGISTER_DECODER (INTERPLAY_DPCM, interplay_dpcm); REGISTER_ENCDEC (ROQ_DPCM, roq_dpcm); REGISTER_DECODER (SOL_DPCM, sol_dpcm); REGISTER_DECODER (XAN_DPCM, xan_dpcm); /* ADPCM codecs */ REGISTER_DECODER (ADPCM_4XM, adpcm_4xm); REGISTER_ENCDEC (ADPCM_ADX, adpcm_adx); REGISTER_DECODER (ADPCM_CT, adpcm_ct); REGISTER_DECODER (ADPCM_EA, adpcm_ea); REGISTER_DECODER (ADPCM_EA_MAXIS_XA, adpcm_ea_maxis_xa); REGISTER_DECODER (ADPCM_EA_R1, adpcm_ea_r1); REGISTER_DECODER (ADPCM_EA_R2, adpcm_ea_r2); REGISTER_DECODER (ADPCM_EA_R3, adpcm_ea_r3); REGISTER_DECODER (ADPCM_EA_XAS, adpcm_ea_xas); REGISTER_ENCDEC (ADPCM_G726, adpcm_g726); REGISTER_DECODER (ADPCM_IMA_AMV, adpcm_ima_amv); REGISTER_DECODER (ADPCM_IMA_DK3, adpcm_ima_dk3); REGISTER_DECODER (ADPCM_IMA_DK4, adpcm_ima_dk4); REGISTER_DECODER (ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs); REGISTER_DECODER (ADPCM_IMA_EA_SEAD, adpcm_ima_ea_sead); REGISTER_DECODER (ADPCM_IMA_ISS, adpcm_ima_iss); REGISTER_ENCDEC (ADPCM_IMA_QT, adpcm_ima_qt); REGISTER_DECODER (ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg); REGISTER_ENCDEC (ADPCM_IMA_WAV, adpcm_ima_wav); REGISTER_DECODER (ADPCM_IMA_WS, adpcm_ima_ws); REGISTER_ENCDEC (ADPCM_MS, adpcm_ms); REGISTER_DECODER (ADPCM_SBPRO_2, adpcm_sbpro_2); REGISTER_DECODER (ADPCM_SBPRO_3, adpcm_sbpro_3); REGISTER_DECODER (ADPCM_SBPRO_4, adpcm_sbpro_4); REGISTER_ENCDEC (ADPCM_SWF, adpcm_swf); REGISTER_DECODER (ADPCM_THP, adpcm_thp); REGISTER_DECODER (ADPCM_XA, adpcm_xa); REGISTER_ENCDEC (ADPCM_YAMAHA, adpcm_yamaha); /* subtitles */ REGISTER_ENCDEC (DVBSUB, dvbsub); REGISTER_ENCDEC (DVDSUB, dvdsub); REGISTER_DECODER (PGSSUB, pgssub); REGISTER_ENCDEC (XSUB, xsub); /* external libraries */ REGISTER_ENCDEC (LIBDIRAC, libdirac); REGISTER_ENCODER (LIBFAAC, libfaac); REGISTER_DECODER (LIBFAAD, libfaad); REGISTER_ENCDEC (LIBGSM, libgsm); REGISTER_ENCDEC (LIBGSM_MS, libgsm_ms); REGISTER_ENCODER (LIBMP3LAME, libmp3lame); REGISTER_ENCDEC (LIBOPENCORE_AMRNB, libopencore_amrnb); REGISTER_DECODER (LIBOPENCORE_AMRWB, libopencore_amrwb); REGISTER_DECODER (LIBOPENJPEG, libopenjpeg); REGISTER_ENCDEC (LIBSCHROEDINGER, libschroedinger); REGISTER_DECODER (LIBSPEEX, libspeex); REGISTER_ENCODER (LIBTHEORA, libtheora); REGISTER_ENCODER (LIBVORBIS, libvorbis); REGISTER_ENCDEC (LIBVPX, libvpx); REGISTER_ENCODER (LIBX264, libx264); REGISTER_ENCODER (LIBXVID, libxvid); /* parsers */ REGISTER_PARSER (AAC, aac); REGISTER_PARSER (AC3, ac3); REGISTER_PARSER (CAVSVIDEO, cavsvideo); REGISTER_PARSER (DCA, dca); REGISTER_PARSER (DIRAC, dirac); REGISTER_PARSER (DNXHD, dnxhd); REGISTER_PARSER (DVBSUB, dvbsub); REGISTER_PARSER (DVDSUB, dvdsub); REGISTER_PARSER (H261, h261); REGISTER_PARSER (H263, h263); REGISTER_PARSER (H264, h264); REGISTER_PARSER (MJPEG, mjpeg); REGISTER_PARSER (MLP, mlp); REGISTER_PARSER (MPEG4VIDEO, mpeg4video); REGISTER_PARSER (MPEGAUDIO, mpegaudio); REGISTER_PARSER (MPEGVIDEO, mpegvideo); REGISTER_PARSER (PNM, pnm); REGISTER_PARSER (VC1, vc1); REGISTER_PARSER (VP3, vp3); /* bitstream filters */ REGISTER_BSF (AAC_ADTSTOASC, aac_adtstoasc); REGISTER_BSF (DUMP_EXTRADATA, dump_extradata); REGISTER_BSF (H264_MP4TOANNEXB, h264_mp4toannexb); REGISTER_BSF (IMX_DUMP_HEADER, imx_dump_header); REGISTER_BSF (MJPEGA_DUMP_HEADER, mjpega_dump_header); REGISTER_BSF (MP3_HEADER_COMPRESS, mp3_header_compress); REGISTER_BSF (MP3_HEADER_DECOMPRESS, mp3_header_decompress); REGISTER_BSF (MOV2TEXTSUB, mov2textsub); REGISTER_BSF (NOISE, noise); REGISTER_BSF (REMOVE_EXTRADATA, remove_extradata); REGISTER_BSF (TEXT2MOVSUB, text2movsub); }
123linslouis-android-video-cutter
jni/libavcodec/allcodecs.c
C
asf20
14,918
/* * IBM Ultimotion Video Decoder * copyright (C) 2004 Konstantin Shishkov * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVCODEC_ULTI_CB_H #define AVCODEC_ULTI_CB_H static const unsigned char ulti_codebook[16384]={ 0x00, 0x01, 0x01, 0x02, 0x00, 0x01, 0x02, 0x03, 0x00, 0x02, 0x03, 0x04, 0x00, 0x01, 0x03, 0x04, 0x00, 0x01, 0x02, 0x04, 0x00, 0x02, 0x03, 0x05, 0x00, 0x02, 0x04, 0x05, 0x00, 0x01, 0x04, 0x05, 0x00, 0x01, 0x03, 0x05, 0x00, 0x02, 0x04, 0x06, 0x00, 0x03, 0x05, 0x06, 0x00, 0x01, 0x05, 0x06, 0x00, 0x01, 0x03, 0x06, 0x00, 0x06, 0x06, 0x06, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x03, 0x04, 0x07, 0x00, 0x03, 0x06, 0x07, 0x00, 0x01, 0x06, 0x07, 0x00, 0x01, 0x04, 0x07, 0x00, 0x03, 0x05, 0x08, 0x00, 0x04, 0x06, 0x08, 0x00, 0x02, 0x06, 0x08, 0x00, 0x02, 0x04, 0x08, 0x00, 0x08, 0x08, 0x08, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x04, 0x07, 0x0B, 0x00, 0x05, 0x09, 0x0B, 0x00, 0x02, 0x09, 0x0B, 0x00, 0x02, 0x06, 0x0B, 0x00, 0x0B, 0x0B, 0x0B, 0x00, 0x00, 0x0B, 0x0B, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x05, 0x09, 0x0E, 0x00, 0x07, 0x0B, 0x0E, 0x00, 0x03, 0x0B, 0x0E, 0x00, 0x03, 0x07, 0x0E, 0x00, 0x0E, 0x0E, 0x0E, 0x00, 0x00, 0x0E, 0x0E, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x06, 0x0B, 0x11, 0x00, 0x08, 0x0D, 0x11, 0x00, 0x04, 0x0D, 0x11, 0x00, 0x04, 0x09, 0x11, 0x00, 0x11, 0x11, 0x11, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x00, 0x07, 0x0D, 0x14, 0x00, 0x0A, 0x0F, 0x14, 0x00, 0x05, 0x0F, 0x14, 0x00, 0x05, 0x0A, 0x14, 0x00, 0x14, 0x14, 0x14, 0x00, 0x00, 0x14, 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, 0x0B, 0x12, 0x17, 0x00, 0x05, 0x12, 0x17, 0x00, 0x05, 0x0C, 0x17, 0x00, 0x17, 0x17, 0x17, 0x00, 0x00, 0x17, 0x17, 0x00, 0x00, 0x00, 0x17, 0x00, 0x0D, 0x14, 0x1A, 0x00, 0x06, 0x14, 0x1A, 0x00, 0x06, 0x0D, 0x1A, 0x00, 0x1A, 0x1A, 0x1A, 0x00, 0x00, 0x1A, 0x1A, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x0E, 0x16, 0x1D, 0x00, 0x07, 0x16, 0x1D, 0x00, 0x07, 0x0F, 0x1D, 0x00, 0x1D, 0x1D, 0x1D, 0x00, 0x00, 0x1D, 0x1D, 0x00, 0x00, 0x00, 0x1D, 0x00, 0x10, 0x18, 0x20, 0x00, 0x08, 0x18, 0x20, 0x00, 0x08, 0x10, 0x20, 0x00, 0x20, 0x20, 0x20, 0x00, 0x00, 0x20, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x23, 0x23, 0x23, 0x00, 0x00, 0x23, 0x23, 0x00, 0x00, 0x00, 0x23, 0x00, 0x12, 0x1B, 0x24, 0x00, 0x09, 0x1B, 0x24, 0x00, 0x09, 0x12, 0x24, 0x00, 0x28, 0x28, 0x28, 0x00, 0x00, 0x28, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x2E, 0x2E, 0x2E, 0x00, 0x00, 0x2E, 0x2E, 0x00, 0x00, 0x00, 0x2E, 0x01, 0x02, 0x02, 0x03, 0x01, 0x02, 0x03, 0x04, 0x01, 0x03, 0x04, 0x05, 0x01, 0x02, 0x04, 0x05, 0x01, 0x02, 0x03, 0x05, 0x01, 0x03, 0x04, 0x06, 0x01, 0x03, 0x05, 0x06, 0x01, 0x02, 0x05, 0x06, 0x01, 0x02, 0x04, 0x06, 0x01, 0x03, 0x05, 0x07, 0x01, 0x04, 0x06, 0x07, 0x01, 0x02, 0x06, 0x07, 0x01, 0x02, 0x04, 0x07, 0x01, 0x07, 0x07, 0x07, 0x01, 0x01, 0x07, 0x07, 0x01, 0x01, 0x01, 0x07, 0x01, 0x04, 0x05, 0x08, 0x01, 0x04, 0x07, 0x08, 0x01, 0x02, 0x07, 0x08, 0x01, 0x02, 0x05, 0x08, 0x01, 0x04, 0x06, 0x09, 0x01, 0x05, 0x07, 0x09, 0x01, 0x03, 0x07, 0x09, 0x01, 0x03, 0x05, 0x09, 0x01, 0x09, 0x09, 0x09, 0x01, 0x01, 0x09, 0x09, 0x01, 0x01, 0x01, 0x09, 0x01, 0x05, 0x08, 0x0C, 0x01, 0x06, 0x0A, 0x0C, 0x01, 0x03, 0x0A, 0x0C, 0x01, 0x03, 0x07, 0x0C, 0x01, 0x0C, 0x0C, 0x0C, 0x01, 0x01, 0x0C, 0x0C, 0x01, 0x01, 0x01, 0x0C, 0x01, 0x06, 0x0A, 0x0F, 0x01, 0x08, 0x0C, 0x0F, 0x01, 0x04, 0x0C, 0x0F, 0x01, 0x04, 0x08, 0x0F, 0x01, 0x0F, 0x0F, 0x0F, 0x01, 0x01, 0x0F, 0x0F, 0x01, 0x01, 0x01, 0x0F, 0x01, 0x07, 0x0C, 0x12, 0x01, 0x09, 0x0E, 0x12, 0x01, 0x05, 0x0E, 0x12, 0x01, 0x05, 0x0A, 0x12, 0x01, 0x12, 0x12, 0x12, 0x01, 0x01, 0x12, 0x12, 0x01, 0x01, 0x01, 0x12, 0x01, 0x08, 0x0E, 0x15, 0x01, 0x0B, 0x10, 0x15, 0x01, 0x06, 0x10, 0x15, 0x01, 0x06, 0x0B, 0x15, 0x01, 0x15, 0x15, 0x15, 0x01, 0x01, 0x15, 0x15, 0x01, 0x01, 0x01, 0x15, 0x01, 0x0C, 0x13, 0x18, 0x01, 0x06, 0x13, 0x18, 0x01, 0x06, 0x0D, 0x18, 0x01, 0x18, 0x18, 0x18, 0x01, 0x01, 0x18, 0x18, 0x01, 0x01, 0x01, 0x18, 0x01, 0x0E, 0x15, 0x1B, 0x01, 0x07, 0x15, 0x1B, 0x01, 0x07, 0x0E, 0x1B, 0x01, 0x1B, 0x1B, 0x1B, 0x01, 0x01, 0x1B, 0x1B, 0x01, 0x01, 0x01, 0x1B, 0x01, 0x0F, 0x17, 0x1E, 0x01, 0x08, 0x17, 0x1E, 0x01, 0x08, 0x10, 0x1E, 0x01, 0x1E, 0x1E, 0x1E, 0x01, 0x01, 0x1E, 0x1E, 0x01, 0x01, 0x01, 0x1E, 0x01, 0x11, 0x19, 0x21, 0x01, 0x09, 0x19, 0x21, 0x01, 0x09, 0x11, 0x21, 0x01, 0x21, 0x21, 0x21, 0x01, 0x01, 0x21, 0x21, 0x01, 0x01, 0x01, 0x21, 0x01, 0x24, 0x24, 0x24, 0x01, 0x01, 0x24, 0x24, 0x01, 0x01, 0x01, 0x24, 0x01, 0x13, 0x1C, 0x25, 0x01, 0x0A, 0x1C, 0x25, 0x01, 0x0A, 0x13, 0x25, 0x01, 0x29, 0x29, 0x29, 0x01, 0x01, 0x29, 0x29, 0x01, 0x01, 0x01, 0x29, 0x01, 0x2F, 0x2F, 0x2F, 0x01, 0x01, 0x2F, 0x2F, 0x01, 0x01, 0x01, 0x2F, 0x02, 0x03, 0x03, 0x04, 0x02, 0x03, 0x04, 0x05, 0x02, 0x04, 0x05, 0x06, 0x02, 0x03, 0x05, 0x06, 0x02, 0x03, 0x04, 0x06, 0x02, 0x04, 0x05, 0x07, 0x02, 0x04, 0x06, 0x07, 0x02, 0x03, 0x06, 0x07, 0x02, 0x03, 0x05, 0x07, 0x02, 0x04, 0x06, 0x08, 0x02, 0x05, 0x07, 0x08, 0x02, 0x03, 0x07, 0x08, 0x02, 0x03, 0x05, 0x08, 0x02, 0x08, 0x08, 0x08, 0x02, 0x02, 0x08, 0x08, 0x02, 0x02, 0x02, 0x08, 0x02, 0x05, 0x06, 0x09, 0x02, 0x05, 0x08, 0x09, 0x02, 0x03, 0x08, 0x09, 0x02, 0x03, 0x06, 0x09, 0x02, 0x05, 0x07, 0x0A, 0x02, 0x06, 0x08, 0x0A, 0x02, 0x04, 0x08, 0x0A, 0x02, 0x04, 0x06, 0x0A, 0x02, 0x0A, 0x0A, 0x0A, 0x02, 0x02, 0x0A, 0x0A, 0x02, 0x02, 0x02, 0x0A, 0x02, 0x06, 0x09, 0x0D, 0x02, 0x07, 0x0B, 0x0D, 0x02, 0x04, 0x0B, 0x0D, 0x02, 0x04, 0x08, 0x0D, 0x02, 0x0D, 0x0D, 0x0D, 0x02, 0x02, 0x0D, 0x0D, 0x02, 0x02, 0x02, 0x0D, 0x02, 0x07, 0x0B, 0x10, 0x02, 0x09, 0x0D, 0x10, 0x02, 0x05, 0x0D, 0x10, 0x02, 0x05, 0x09, 0x10, 0x02, 0x10, 0x10, 0x10, 0x02, 0x02, 0x10, 0x10, 0x02, 0x02, 0x02, 0x10, 0x02, 0x08, 0x0D, 0x13, 0x02, 0x0A, 0x0F, 0x13, 0x02, 0x06, 0x0F, 0x13, 0x02, 0x06, 0x0B, 0x13, 0x02, 0x13, 0x13, 0x13, 0x02, 0x02, 0x13, 0x13, 0x02, 0x02, 0x02, 0x13, 0x02, 0x09, 0x0F, 0x16, 0x02, 0x0C, 0x11, 0x16, 0x02, 0x07, 0x11, 0x16, 0x02, 0x07, 0x0C, 0x16, 0x02, 0x16, 0x16, 0x16, 0x02, 0x02, 0x16, 0x16, 0x02, 0x02, 0x02, 0x16, 0x02, 0x0D, 0x14, 0x19, 0x02, 0x07, 0x14, 0x19, 0x02, 0x07, 0x0E, 0x19, 0x02, 0x19, 0x19, 0x19, 0x02, 0x02, 0x19, 0x19, 0x02, 0x02, 0x02, 0x19, 0x02, 0x0F, 0x16, 0x1C, 0x02, 0x08, 0x16, 0x1C, 0x02, 0x08, 0x0F, 0x1C, 0x02, 0x1C, 0x1C, 0x1C, 0x02, 0x02, 0x1C, 0x1C, 0x02, 0x02, 0x02, 0x1C, 0x02, 0x10, 0x18, 0x1F, 0x02, 0x09, 0x18, 0x1F, 0x02, 0x09, 0x11, 0x1F, 0x02, 0x1F, 0x1F, 0x1F, 0x02, 0x02, 0x1F, 0x1F, 0x02, 0x02, 0x02, 0x1F, 0x02, 0x12, 0x1A, 0x22, 0x02, 0x0A, 0x1A, 0x22, 0x02, 0x0A, 0x12, 0x22, 0x02, 0x22, 0x22, 0x22, 0x02, 0x02, 0x22, 0x22, 0x02, 0x02, 0x02, 0x22, 0x02, 0x25, 0x25, 0x25, 0x02, 0x02, 0x25, 0x25, 0x02, 0x02, 0x02, 0x25, 0x02, 0x14, 0x1D, 0x26, 0x02, 0x0B, 0x1D, 0x26, 0x02, 0x0B, 0x14, 0x26, 0x02, 0x2A, 0x2A, 0x2A, 0x02, 0x02, 0x2A, 0x2A, 0x02, 0x02, 0x02, 0x2A, 0x02, 0x30, 0x30, 0x30, 0x02, 0x02, 0x30, 0x30, 0x02, 0x02, 0x02, 0x30, 0x03, 0x04, 0x04, 0x05, 0x03, 0x04, 0x05, 0x06, 0x03, 0x05, 0x06, 0x07, 0x03, 0x04, 0x06, 0x07, 0x03, 0x04, 0x05, 0x07, 0x03, 0x05, 0x06, 0x08, 0x03, 0x05, 0x07, 0x08, 0x03, 0x04, 0x07, 0x08, 0x03, 0x04, 0x06, 0x08, 0x03, 0x05, 0x07, 0x09, 0x03, 0x06, 0x08, 0x09, 0x03, 0x04, 0x08, 0x09, 0x03, 0x04, 0x06, 0x09, 0x03, 0x09, 0x09, 0x09, 0x03, 0x03, 0x09, 0x09, 0x03, 0x03, 0x03, 0x09, 0x03, 0x06, 0x07, 0x0A, 0x03, 0x06, 0x09, 0x0A, 0x03, 0x04, 0x09, 0x0A, 0x03, 0x04, 0x07, 0x0A, 0x03, 0x06, 0x08, 0x0B, 0x03, 0x07, 0x09, 0x0B, 0x03, 0x05, 0x09, 0x0B, 0x03, 0x05, 0x07, 0x0B, 0x03, 0x0B, 0x0B, 0x0B, 0x03, 0x03, 0x0B, 0x0B, 0x03, 0x03, 0x03, 0x0B, 0x03, 0x07, 0x0A, 0x0E, 0x03, 0x08, 0x0C, 0x0E, 0x03, 0x05, 0x0C, 0x0E, 0x03, 0x05, 0x09, 0x0E, 0x03, 0x0E, 0x0E, 0x0E, 0x03, 0x03, 0x0E, 0x0E, 0x03, 0x03, 0x03, 0x0E, 0x03, 0x08, 0x0C, 0x11, 0x03, 0x0A, 0x0E, 0x11, 0x03, 0x06, 0x0E, 0x11, 0x03, 0x06, 0x0A, 0x11, 0x03, 0x11, 0x11, 0x11, 0x03, 0x03, 0x11, 0x11, 0x03, 0x03, 0x03, 0x11, 0x03, 0x09, 0x0E, 0x14, 0x03, 0x0B, 0x10, 0x14, 0x03, 0x07, 0x10, 0x14, 0x03, 0x07, 0x0C, 0x14, 0x03, 0x14, 0x14, 0x14, 0x03, 0x03, 0x14, 0x14, 0x03, 0x03, 0x03, 0x14, 0x03, 0x0A, 0x10, 0x17, 0x03, 0x0D, 0x12, 0x17, 0x03, 0x08, 0x12, 0x17, 0x03, 0x08, 0x0D, 0x17, 0x03, 0x17, 0x17, 0x17, 0x03, 0x03, 0x17, 0x17, 0x03, 0x03, 0x03, 0x17, 0x03, 0x0E, 0x15, 0x1A, 0x03, 0x08, 0x15, 0x1A, 0x03, 0x08, 0x0F, 0x1A, 0x03, 0x1A, 0x1A, 0x1A, 0x03, 0x03, 0x1A, 0x1A, 0x03, 0x03, 0x03, 0x1A, 0x03, 0x10, 0x17, 0x1D, 0x03, 0x09, 0x17, 0x1D, 0x03, 0x09, 0x10, 0x1D, 0x03, 0x1D, 0x1D, 0x1D, 0x03, 0x03, 0x1D, 0x1D, 0x03, 0x03, 0x03, 0x1D, 0x03, 0x11, 0x19, 0x20, 0x03, 0x0A, 0x19, 0x20, 0x03, 0x0A, 0x12, 0x20, 0x03, 0x20, 0x20, 0x20, 0x03, 0x03, 0x20, 0x20, 0x03, 0x03, 0x03, 0x20, 0x03, 0x13, 0x1B, 0x23, 0x03, 0x0B, 0x1B, 0x23, 0x03, 0x0B, 0x13, 0x23, 0x03, 0x23, 0x23, 0x23, 0x03, 0x03, 0x23, 0x23, 0x03, 0x03, 0x03, 0x23, 0x03, 0x26, 0x26, 0x26, 0x03, 0x03, 0x26, 0x26, 0x03, 0x03, 0x03, 0x26, 0x03, 0x15, 0x1E, 0x27, 0x03, 0x0C, 0x1E, 0x27, 0x03, 0x0C, 0x15, 0x27, 0x03, 0x2B, 0x2B, 0x2B, 0x03, 0x03, 0x2B, 0x2B, 0x03, 0x03, 0x03, 0x2B, 0x03, 0x31, 0x31, 0x31, 0x03, 0x03, 0x31, 0x31, 0x03, 0x03, 0x03, 0x31, 0x04, 0x05, 0x05, 0x06, 0x04, 0x05, 0x06, 0x07, 0x04, 0x06, 0x07, 0x08, 0x04, 0x05, 0x07, 0x08, 0x04, 0x05, 0x06, 0x08, 0x04, 0x06, 0x07, 0x09, 0x04, 0x06, 0x08, 0x09, 0x04, 0x05, 0x08, 0x09, 0x04, 0x05, 0x07, 0x09, 0x04, 0x06, 0x08, 0x0A, 0x04, 0x07, 0x09, 0x0A, 0x04, 0x05, 0x09, 0x0A, 0x04, 0x05, 0x07, 0x0A, 0x04, 0x0A, 0x0A, 0x0A, 0x04, 0x04, 0x0A, 0x0A, 0x04, 0x04, 0x04, 0x0A, 0x04, 0x07, 0x08, 0x0B, 0x04, 0x07, 0x0A, 0x0B, 0x04, 0x05, 0x0A, 0x0B, 0x04, 0x05, 0x08, 0x0B, 0x04, 0x07, 0x09, 0x0C, 0x04, 0x08, 0x0A, 0x0C, 0x04, 0x06, 0x0A, 0x0C, 0x04, 0x06, 0x08, 0x0C, 0x04, 0x0C, 0x0C, 0x0C, 0x04, 0x04, 0x0C, 0x0C, 0x04, 0x04, 0x04, 0x0C, 0x04, 0x08, 0x0B, 0x0F, 0x04, 0x09, 0x0D, 0x0F, 0x04, 0x06, 0x0D, 0x0F, 0x04, 0x06, 0x0A, 0x0F, 0x04, 0x0F, 0x0F, 0x0F, 0x04, 0x04, 0x0F, 0x0F, 0x04, 0x04, 0x04, 0x0F, 0x04, 0x09, 0x0D, 0x12, 0x04, 0x0B, 0x0F, 0x12, 0x04, 0x07, 0x0F, 0x12, 0x04, 0x07, 0x0B, 0x12, 0x04, 0x12, 0x12, 0x12, 0x04, 0x04, 0x12, 0x12, 0x04, 0x04, 0x04, 0x12, 0x04, 0x0A, 0x0F, 0x15, 0x04, 0x0C, 0x11, 0x15, 0x04, 0x08, 0x11, 0x15, 0x04, 0x08, 0x0D, 0x15, 0x04, 0x15, 0x15, 0x15, 0x04, 0x04, 0x15, 0x15, 0x04, 0x04, 0x04, 0x15, 0x04, 0x0B, 0x11, 0x18, 0x04, 0x0E, 0x13, 0x18, 0x04, 0x09, 0x13, 0x18, 0x04, 0x09, 0x0E, 0x18, 0x04, 0x18, 0x18, 0x18, 0x04, 0x04, 0x18, 0x18, 0x04, 0x04, 0x04, 0x18, 0x04, 0x0F, 0x16, 0x1B, 0x04, 0x09, 0x16, 0x1B, 0x04, 0x09, 0x10, 0x1B, 0x04, 0x1B, 0x1B, 0x1B, 0x04, 0x04, 0x1B, 0x1B, 0x04, 0x04, 0x04, 0x1B, 0x04, 0x11, 0x18, 0x1E, 0x04, 0x0A, 0x18, 0x1E, 0x04, 0x0A, 0x11, 0x1E, 0x04, 0x1E, 0x1E, 0x1E, 0x04, 0x04, 0x1E, 0x1E, 0x04, 0x04, 0x04, 0x1E, 0x04, 0x12, 0x1A, 0x21, 0x04, 0x0B, 0x1A, 0x21, 0x04, 0x0B, 0x13, 0x21, 0x04, 0x21, 0x21, 0x21, 0x04, 0x04, 0x21, 0x21, 0x04, 0x04, 0x04, 0x21, 0x04, 0x14, 0x1C, 0x24, 0x04, 0x0C, 0x1C, 0x24, 0x04, 0x0C, 0x14, 0x24, 0x04, 0x24, 0x24, 0x24, 0x04, 0x04, 0x24, 0x24, 0x04, 0x04, 0x04, 0x24, 0x04, 0x27, 0x27, 0x27, 0x04, 0x04, 0x27, 0x27, 0x04, 0x04, 0x04, 0x27, 0x04, 0x16, 0x1F, 0x28, 0x04, 0x0D, 0x1F, 0x28, 0x04, 0x0D, 0x16, 0x28, 0x04, 0x2C, 0x2C, 0x2C, 0x04, 0x04, 0x2C, 0x2C, 0x04, 0x04, 0x04, 0x2C, 0x04, 0x32, 0x32, 0x32, 0x04, 0x04, 0x32, 0x32, 0x04, 0x04, 0x04, 0x32, 0x05, 0x06, 0x06, 0x07, 0x05, 0x06, 0x07, 0x08, 0x05, 0x07, 0x08, 0x09, 0x05, 0x06, 0x08, 0x09, 0x05, 0x06, 0x07, 0x09, 0x05, 0x07, 0x08, 0x0A, 0x05, 0x07, 0x09, 0x0A, 0x05, 0x06, 0x09, 0x0A, 0x05, 0x06, 0x08, 0x0A, 0x05, 0x07, 0x09, 0x0B, 0x05, 0x08, 0x0A, 0x0B, 0x05, 0x06, 0x0A, 0x0B, 0x05, 0x06, 0x08, 0x0B, 0x05, 0x0B, 0x0B, 0x0B, 0x05, 0x05, 0x0B, 0x0B, 0x05, 0x05, 0x05, 0x0B, 0x05, 0x08, 0x09, 0x0C, 0x05, 0x08, 0x0B, 0x0C, 0x05, 0x06, 0x0B, 0x0C, 0x05, 0x06, 0x09, 0x0C, 0x05, 0x08, 0x0A, 0x0D, 0x05, 0x09, 0x0B, 0x0D, 0x05, 0x07, 0x0B, 0x0D, 0x05, 0x07, 0x09, 0x0D, 0x05, 0x0D, 0x0D, 0x0D, 0x05, 0x05, 0x0D, 0x0D, 0x05, 0x05, 0x05, 0x0D, 0x05, 0x09, 0x0C, 0x10, 0x05, 0x0A, 0x0E, 0x10, 0x05, 0x07, 0x0E, 0x10, 0x05, 0x07, 0x0B, 0x10, 0x05, 0x10, 0x10, 0x10, 0x05, 0x05, 0x10, 0x10, 0x05, 0x05, 0x05, 0x10, 0x05, 0x0A, 0x0E, 0x13, 0x05, 0x0C, 0x10, 0x13, 0x05, 0x08, 0x10, 0x13, 0x05, 0x08, 0x0C, 0x13, 0x05, 0x13, 0x13, 0x13, 0x05, 0x05, 0x13, 0x13, 0x05, 0x05, 0x05, 0x13, 0x05, 0x0B, 0x10, 0x16, 0x05, 0x0D, 0x12, 0x16, 0x05, 0x09, 0x12, 0x16, 0x05, 0x09, 0x0E, 0x16, 0x05, 0x16, 0x16, 0x16, 0x05, 0x05, 0x16, 0x16, 0x05, 0x05, 0x05, 0x16, 0x05, 0x0C, 0x12, 0x19, 0x05, 0x0F, 0x14, 0x19, 0x05, 0x0A, 0x14, 0x19, 0x05, 0x0A, 0x0F, 0x19, 0x05, 0x19, 0x19, 0x19, 0x05, 0x05, 0x19, 0x19, 0x05, 0x05, 0x05, 0x19, 0x05, 0x10, 0x17, 0x1C, 0x05, 0x0A, 0x17, 0x1C, 0x05, 0x0A, 0x11, 0x1C, 0x05, 0x1C, 0x1C, 0x1C, 0x05, 0x05, 0x1C, 0x1C, 0x05, 0x05, 0x05, 0x1C, 0x05, 0x12, 0x19, 0x1F, 0x05, 0x0B, 0x19, 0x1F, 0x05, 0x0B, 0x12, 0x1F, 0x05, 0x1F, 0x1F, 0x1F, 0x05, 0x05, 0x1F, 0x1F, 0x05, 0x05, 0x05, 0x1F, 0x05, 0x13, 0x1B, 0x22, 0x05, 0x0C, 0x1B, 0x22, 0x05, 0x0C, 0x14, 0x22, 0x05, 0x22, 0x22, 0x22, 0x05, 0x05, 0x22, 0x22, 0x05, 0x05, 0x05, 0x22, 0x05, 0x15, 0x1D, 0x25, 0x05, 0x0D, 0x1D, 0x25, 0x05, 0x0D, 0x15, 0x25, 0x05, 0x25, 0x25, 0x25, 0x05, 0x05, 0x25, 0x25, 0x05, 0x05, 0x05, 0x25, 0x05, 0x28, 0x28, 0x28, 0x05, 0x05, 0x28, 0x28, 0x05, 0x05, 0x05, 0x28, 0x05, 0x17, 0x20, 0x29, 0x05, 0x0E, 0x20, 0x29, 0x05, 0x0E, 0x17, 0x29, 0x05, 0x2D, 0x2D, 0x2D, 0x05, 0x05, 0x2D, 0x2D, 0x05, 0x05, 0x05, 0x2D, 0x05, 0x33, 0x33, 0x33, 0x05, 0x05, 0x33, 0x33, 0x05, 0x05, 0x05, 0x33, 0x06, 0x07, 0x07, 0x08, 0x06, 0x07, 0x08, 0x09, 0x06, 0x08, 0x09, 0x0A, 0x06, 0x07, 0x09, 0x0A, 0x06, 0x07, 0x08, 0x0A, 0x06, 0x08, 0x09, 0x0B, 0x06, 0x08, 0x0A, 0x0B, 0x06, 0x07, 0x0A, 0x0B, 0x06, 0x07, 0x09, 0x0B, 0x06, 0x08, 0x0A, 0x0C, 0x06, 0x09, 0x0B, 0x0C, 0x06, 0x07, 0x0B, 0x0C, 0x06, 0x07, 0x09, 0x0C, 0x06, 0x0C, 0x0C, 0x0C, 0x06, 0x06, 0x0C, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x06, 0x09, 0x0A, 0x0D, 0x06, 0x09, 0x0C, 0x0D, 0x06, 0x07, 0x0C, 0x0D, 0x06, 0x07, 0x0A, 0x0D, 0x06, 0x09, 0x0B, 0x0E, 0x06, 0x0A, 0x0C, 0x0E, 0x06, 0x08, 0x0C, 0x0E, 0x06, 0x08, 0x0A, 0x0E, 0x06, 0x0E, 0x0E, 0x0E, 0x06, 0x06, 0x0E, 0x0E, 0x06, 0x06, 0x06, 0x0E, 0x06, 0x0A, 0x0D, 0x11, 0x06, 0x0B, 0x0F, 0x11, 0x06, 0x08, 0x0F, 0x11, 0x06, 0x08, 0x0C, 0x11, 0x06, 0x11, 0x11, 0x11, 0x06, 0x06, 0x11, 0x11, 0x06, 0x06, 0x06, 0x11, 0x06, 0x0B, 0x0F, 0x14, 0x06, 0x0D, 0x11, 0x14, 0x06, 0x09, 0x11, 0x14, 0x06, 0x09, 0x0D, 0x14, 0x06, 0x14, 0x14, 0x14, 0x06, 0x06, 0x14, 0x14, 0x06, 0x06, 0x06, 0x14, 0x06, 0x0C, 0x11, 0x17, 0x06, 0x0E, 0x13, 0x17, 0x06, 0x0A, 0x13, 0x17, 0x06, 0x0A, 0x0F, 0x17, 0x06, 0x17, 0x17, 0x17, 0x06, 0x06, 0x17, 0x17, 0x06, 0x06, 0x06, 0x17, 0x06, 0x0D, 0x13, 0x1A, 0x06, 0x10, 0x15, 0x1A, 0x06, 0x0B, 0x15, 0x1A, 0x06, 0x0B, 0x10, 0x1A, 0x06, 0x1A, 0x1A, 0x1A, 0x06, 0x06, 0x1A, 0x1A, 0x06, 0x06, 0x06, 0x1A, 0x06, 0x11, 0x18, 0x1D, 0x06, 0x0B, 0x18, 0x1D, 0x06, 0x0B, 0x12, 0x1D, 0x06, 0x1D, 0x1D, 0x1D, 0x06, 0x06, 0x1D, 0x1D, 0x06, 0x06, 0x06, 0x1D, 0x06, 0x13, 0x1A, 0x20, 0x06, 0x0C, 0x1A, 0x20, 0x06, 0x0C, 0x13, 0x20, 0x06, 0x20, 0x20, 0x20, 0x06, 0x06, 0x20, 0x20, 0x06, 0x06, 0x06, 0x20, 0x06, 0x14, 0x1C, 0x23, 0x06, 0x0D, 0x1C, 0x23, 0x06, 0x0D, 0x15, 0x23, 0x06, 0x23, 0x23, 0x23, 0x06, 0x06, 0x23, 0x23, 0x06, 0x06, 0x06, 0x23, 0x06, 0x16, 0x1E, 0x26, 0x06, 0x0E, 0x1E, 0x26, 0x06, 0x0E, 0x16, 0x26, 0x06, 0x26, 0x26, 0x26, 0x06, 0x06, 0x26, 0x26, 0x06, 0x06, 0x06, 0x26, 0x06, 0x29, 0x29, 0x29, 0x06, 0x06, 0x29, 0x29, 0x06, 0x06, 0x06, 0x29, 0x06, 0x18, 0x21, 0x2A, 0x06, 0x0F, 0x21, 0x2A, 0x06, 0x0F, 0x18, 0x2A, 0x06, 0x2E, 0x2E, 0x2E, 0x06, 0x06, 0x2E, 0x2E, 0x06, 0x06, 0x06, 0x2E, 0x06, 0x34, 0x34, 0x34, 0x06, 0x06, 0x34, 0x34, 0x06, 0x06, 0x06, 0x34, 0x07, 0x08, 0x08, 0x09, 0x07, 0x08, 0x09, 0x0A, 0x07, 0x09, 0x0A, 0x0B, 0x07, 0x08, 0x0A, 0x0B, 0x07, 0x08, 0x09, 0x0B, 0x07, 0x09, 0x0A, 0x0C, 0x07, 0x09, 0x0B, 0x0C, 0x07, 0x08, 0x0B, 0x0C, 0x07, 0x08, 0x0A, 0x0C, 0x07, 0x09, 0x0B, 0x0D, 0x07, 0x0A, 0x0C, 0x0D, 0x07, 0x08, 0x0C, 0x0D, 0x07, 0x08, 0x0A, 0x0D, 0x07, 0x0D, 0x0D, 0x0D, 0x07, 0x07, 0x0D, 0x0D, 0x07, 0x07, 0x07, 0x0D, 0x07, 0x0A, 0x0B, 0x0E, 0x07, 0x0A, 0x0D, 0x0E, 0x07, 0x08, 0x0D, 0x0E, 0x07, 0x08, 0x0B, 0x0E, 0x07, 0x0A, 0x0C, 0x0F, 0x07, 0x0B, 0x0D, 0x0F, 0x07, 0x09, 0x0D, 0x0F, 0x07, 0x09, 0x0B, 0x0F, 0x07, 0x0F, 0x0F, 0x0F, 0x07, 0x07, 0x0F, 0x0F, 0x07, 0x07, 0x07, 0x0F, 0x07, 0x0B, 0x0E, 0x12, 0x07, 0x0C, 0x10, 0x12, 0x07, 0x09, 0x10, 0x12, 0x07, 0x09, 0x0D, 0x12, 0x07, 0x12, 0x12, 0x12, 0x07, 0x07, 0x12, 0x12, 0x07, 0x07, 0x07, 0x12, 0x07, 0x0C, 0x10, 0x15, 0x07, 0x0E, 0x12, 0x15, 0x07, 0x0A, 0x12, 0x15, 0x07, 0x0A, 0x0E, 0x15, 0x07, 0x15, 0x15, 0x15, 0x07, 0x07, 0x15, 0x15, 0x07, 0x07, 0x07, 0x15, 0x07, 0x0D, 0x12, 0x18, 0x07, 0x0F, 0x14, 0x18, 0x07, 0x0B, 0x14, 0x18, 0x07, 0x0B, 0x10, 0x18, 0x07, 0x18, 0x18, 0x18, 0x07, 0x07, 0x18, 0x18, 0x07, 0x07, 0x07, 0x18, 0x07, 0x0E, 0x14, 0x1B, 0x07, 0x11, 0x16, 0x1B, 0x07, 0x0C, 0x16, 0x1B, 0x07, 0x0C, 0x11, 0x1B, 0x07, 0x1B, 0x1B, 0x1B, 0x07, 0x07, 0x1B, 0x1B, 0x07, 0x07, 0x07, 0x1B, 0x07, 0x12, 0x19, 0x1E, 0x07, 0x0C, 0x19, 0x1E, 0x07, 0x0C, 0x13, 0x1E, 0x07, 0x1E, 0x1E, 0x1E, 0x07, 0x07, 0x1E, 0x1E, 0x07, 0x07, 0x07, 0x1E, 0x07, 0x14, 0x1B, 0x21, 0x07, 0x0D, 0x1B, 0x21, 0x07, 0x0D, 0x14, 0x21, 0x07, 0x21, 0x21, 0x21, 0x07, 0x07, 0x21, 0x21, 0x07, 0x07, 0x07, 0x21, 0x07, 0x15, 0x1D, 0x24, 0x07, 0x0E, 0x1D, 0x24, 0x07, 0x0E, 0x16, 0x24, 0x07, 0x24, 0x24, 0x24, 0x07, 0x07, 0x24, 0x24, 0x07, 0x07, 0x07, 0x24, 0x07, 0x17, 0x1F, 0x27, 0x07, 0x0F, 0x1F, 0x27, 0x07, 0x0F, 0x17, 0x27, 0x07, 0x27, 0x27, 0x27, 0x07, 0x07, 0x27, 0x27, 0x07, 0x07, 0x07, 0x27, 0x07, 0x2A, 0x2A, 0x2A, 0x07, 0x07, 0x2A, 0x2A, 0x07, 0x07, 0x07, 0x2A, 0x07, 0x19, 0x22, 0x2B, 0x07, 0x10, 0x22, 0x2B, 0x07, 0x10, 0x19, 0x2B, 0x07, 0x2F, 0x2F, 0x2F, 0x07, 0x07, 0x2F, 0x2F, 0x07, 0x07, 0x07, 0x2F, 0x07, 0x35, 0x35, 0x35, 0x07, 0x07, 0x35, 0x35, 0x07, 0x07, 0x07, 0x35, 0x08, 0x09, 0x09, 0x0A, 0x08, 0x09, 0x0A, 0x0B, 0x08, 0x0A, 0x0B, 0x0C, 0x08, 0x09, 0x0B, 0x0C, 0x08, 0x09, 0x0A, 0x0C, 0x08, 0x0A, 0x0B, 0x0D, 0x08, 0x0A, 0x0C, 0x0D, 0x08, 0x09, 0x0C, 0x0D, 0x08, 0x09, 0x0B, 0x0D, 0x08, 0x0A, 0x0C, 0x0E, 0x08, 0x0B, 0x0D, 0x0E, 0x08, 0x09, 0x0D, 0x0E, 0x08, 0x09, 0x0B, 0x0E, 0x08, 0x0E, 0x0E, 0x0E, 0x08, 0x08, 0x0E, 0x0E, 0x08, 0x08, 0x08, 0x0E, 0x08, 0x0B, 0x0C, 0x0F, 0x08, 0x0B, 0x0E, 0x0F, 0x08, 0x09, 0x0E, 0x0F, 0x08, 0x09, 0x0C, 0x0F, 0x08, 0x0B, 0x0D, 0x10, 0x08, 0x0C, 0x0E, 0x10, 0x08, 0x0A, 0x0E, 0x10, 0x08, 0x0A, 0x0C, 0x10, 0x08, 0x10, 0x10, 0x10, 0x08, 0x08, 0x10, 0x10, 0x08, 0x08, 0x08, 0x10, 0x08, 0x0C, 0x0F, 0x13, 0x08, 0x0D, 0x11, 0x13, 0x08, 0x0A, 0x11, 0x13, 0x08, 0x0A, 0x0E, 0x13, 0x08, 0x13, 0x13, 0x13, 0x08, 0x08, 0x13, 0x13, 0x08, 0x08, 0x08, 0x13, 0x08, 0x0D, 0x11, 0x16, 0x08, 0x0F, 0x13, 0x16, 0x08, 0x0B, 0x13, 0x16, 0x08, 0x0B, 0x0F, 0x16, 0x08, 0x16, 0x16, 0x16, 0x08, 0x08, 0x16, 0x16, 0x08, 0x08, 0x08, 0x16, 0x08, 0x0E, 0x13, 0x19, 0x08, 0x10, 0x15, 0x19, 0x08, 0x0C, 0x15, 0x19, 0x08, 0x0C, 0x11, 0x19, 0x08, 0x19, 0x19, 0x19, 0x08, 0x08, 0x19, 0x19, 0x08, 0x08, 0x08, 0x19, 0x08, 0x0F, 0x15, 0x1C, 0x08, 0x12, 0x17, 0x1C, 0x08, 0x0D, 0x17, 0x1C, 0x08, 0x0D, 0x12, 0x1C, 0x08, 0x1C, 0x1C, 0x1C, 0x08, 0x08, 0x1C, 0x1C, 0x08, 0x08, 0x08, 0x1C, 0x08, 0x13, 0x1A, 0x1F, 0x08, 0x0D, 0x1A, 0x1F, 0x08, 0x0D, 0x14, 0x1F, 0x08, 0x1F, 0x1F, 0x1F, 0x08, 0x08, 0x1F, 0x1F, 0x08, 0x08, 0x08, 0x1F, 0x08, 0x15, 0x1C, 0x22, 0x08, 0x0E, 0x1C, 0x22, 0x08, 0x0E, 0x15, 0x22, 0x08, 0x22, 0x22, 0x22, 0x08, 0x08, 0x22, 0x22, 0x08, 0x08, 0x08, 0x22, 0x08, 0x16, 0x1E, 0x25, 0x08, 0x0F, 0x1E, 0x25, 0x08, 0x0F, 0x17, 0x25, 0x08, 0x25, 0x25, 0x25, 0x08, 0x08, 0x25, 0x25, 0x08, 0x08, 0x08, 0x25, 0x08, 0x18, 0x20, 0x28, 0x08, 0x10, 0x20, 0x28, 0x08, 0x10, 0x18, 0x28, 0x08, 0x28, 0x28, 0x28, 0x08, 0x08, 0x28, 0x28, 0x08, 0x08, 0x08, 0x28, 0x08, 0x2B, 0x2B, 0x2B, 0x08, 0x08, 0x2B, 0x2B, 0x08, 0x08, 0x08, 0x2B, 0x08, 0x1A, 0x23, 0x2C, 0x08, 0x11, 0x23, 0x2C, 0x08, 0x11, 0x1A, 0x2C, 0x08, 0x30, 0x30, 0x30, 0x08, 0x08, 0x30, 0x30, 0x08, 0x08, 0x08, 0x30, 0x08, 0x36, 0x36, 0x36, 0x08, 0x08, 0x36, 0x36, 0x08, 0x08, 0x08, 0x36, 0x09, 0x0A, 0x0A, 0x0B, 0x09, 0x0A, 0x0B, 0x0C, 0x09, 0x0B, 0x0C, 0x0D, 0x09, 0x0A, 0x0C, 0x0D, 0x09, 0x0A, 0x0B, 0x0D, 0x09, 0x0B, 0x0C, 0x0E, 0x09, 0x0B, 0x0D, 0x0E, 0x09, 0x0A, 0x0D, 0x0E, 0x09, 0x0A, 0x0C, 0x0E, 0x09, 0x0B, 0x0D, 0x0F, 0x09, 0x0C, 0x0E, 0x0F, 0x09, 0x0A, 0x0E, 0x0F, 0x09, 0x0A, 0x0C, 0x0F, 0x09, 0x0F, 0x0F, 0x0F, 0x09, 0x09, 0x0F, 0x0F, 0x09, 0x09, 0x09, 0x0F, 0x09, 0x0C, 0x0D, 0x10, 0x09, 0x0C, 0x0F, 0x10, 0x09, 0x0A, 0x0F, 0x10, 0x09, 0x0A, 0x0D, 0x10, 0x09, 0x0C, 0x0E, 0x11, 0x09, 0x0D, 0x0F, 0x11, 0x09, 0x0B, 0x0F, 0x11, 0x09, 0x0B, 0x0D, 0x11, 0x09, 0x11, 0x11, 0x11, 0x09, 0x09, 0x11, 0x11, 0x09, 0x09, 0x09, 0x11, 0x09, 0x0D, 0x10, 0x14, 0x09, 0x0E, 0x12, 0x14, 0x09, 0x0B, 0x12, 0x14, 0x09, 0x0B, 0x0F, 0x14, 0x09, 0x14, 0x14, 0x14, 0x09, 0x09, 0x14, 0x14, 0x09, 0x09, 0x09, 0x14, 0x09, 0x0E, 0x12, 0x17, 0x09, 0x10, 0x14, 0x17, 0x09, 0x0C, 0x14, 0x17, 0x09, 0x0C, 0x10, 0x17, 0x09, 0x17, 0x17, 0x17, 0x09, 0x09, 0x17, 0x17, 0x09, 0x09, 0x09, 0x17, 0x09, 0x0F, 0x14, 0x1A, 0x09, 0x11, 0x16, 0x1A, 0x09, 0x0D, 0x16, 0x1A, 0x09, 0x0D, 0x12, 0x1A, 0x09, 0x1A, 0x1A, 0x1A, 0x09, 0x09, 0x1A, 0x1A, 0x09, 0x09, 0x09, 0x1A, 0x09, 0x10, 0x16, 0x1D, 0x09, 0x13, 0x18, 0x1D, 0x09, 0x0E, 0x18, 0x1D, 0x09, 0x0E, 0x13, 0x1D, 0x09, 0x1D, 0x1D, 0x1D, 0x09, 0x09, 0x1D, 0x1D, 0x09, 0x09, 0x09, 0x1D, 0x09, 0x14, 0x1B, 0x20, 0x09, 0x0E, 0x1B, 0x20, 0x09, 0x0E, 0x15, 0x20, 0x09, 0x20, 0x20, 0x20, 0x09, 0x09, 0x20, 0x20, 0x09, 0x09, 0x09, 0x20, 0x09, 0x16, 0x1D, 0x23, 0x09, 0x0F, 0x1D, 0x23, 0x09, 0x0F, 0x16, 0x23, 0x09, 0x23, 0x23, 0x23, 0x09, 0x09, 0x23, 0x23, 0x09, 0x09, 0x09, 0x23, 0x09, 0x17, 0x1F, 0x26, 0x09, 0x10, 0x1F, 0x26, 0x09, 0x10, 0x18, 0x26, 0x09, 0x26, 0x26, 0x26, 0x09, 0x09, 0x26, 0x26, 0x09, 0x09, 0x09, 0x26, 0x09, 0x19, 0x21, 0x29, 0x09, 0x11, 0x21, 0x29, 0x09, 0x11, 0x19, 0x29, 0x09, 0x29, 0x29, 0x29, 0x09, 0x09, 0x29, 0x29, 0x09, 0x09, 0x09, 0x29, 0x09, 0x2C, 0x2C, 0x2C, 0x09, 0x09, 0x2C, 0x2C, 0x09, 0x09, 0x09, 0x2C, 0x09, 0x1B, 0x24, 0x2D, 0x09, 0x12, 0x24, 0x2D, 0x09, 0x12, 0x1B, 0x2D, 0x09, 0x31, 0x31, 0x31, 0x09, 0x09, 0x31, 0x31, 0x09, 0x09, 0x09, 0x31, 0x09, 0x37, 0x37, 0x37, 0x09, 0x09, 0x37, 0x37, 0x09, 0x09, 0x09, 0x37, 0x0A, 0x0B, 0x0B, 0x0C, 0x0A, 0x0B, 0x0C, 0x0D, 0x0A, 0x0C, 0x0D, 0x0E, 0x0A, 0x0B, 0x0D, 0x0E, 0x0A, 0x0B, 0x0C, 0x0E, 0x0A, 0x0C, 0x0D, 0x0F, 0x0A, 0x0C, 0x0E, 0x0F, 0x0A, 0x0B, 0x0E, 0x0F, 0x0A, 0x0B, 0x0D, 0x0F, 0x0A, 0x0C, 0x0E, 0x10, 0x0A, 0x0D, 0x0F, 0x10, 0x0A, 0x0B, 0x0F, 0x10, 0x0A, 0x0B, 0x0D, 0x10, 0x0A, 0x10, 0x10, 0x10, 0x0A, 0x0A, 0x10, 0x10, 0x0A, 0x0A, 0x0A, 0x10, 0x0A, 0x0D, 0x0E, 0x11, 0x0A, 0x0D, 0x10, 0x11, 0x0A, 0x0B, 0x10, 0x11, 0x0A, 0x0B, 0x0E, 0x11, 0x0A, 0x0D, 0x0F, 0x12, 0x0A, 0x0E, 0x10, 0x12, 0x0A, 0x0C, 0x10, 0x12, 0x0A, 0x0C, 0x0E, 0x12, 0x0A, 0x12, 0x12, 0x12, 0x0A, 0x0A, 0x12, 0x12, 0x0A, 0x0A, 0x0A, 0x12, 0x0A, 0x0E, 0x11, 0x15, 0x0A, 0x0F, 0x13, 0x15, 0x0A, 0x0C, 0x13, 0x15, 0x0A, 0x0C, 0x10, 0x15, 0x0A, 0x15, 0x15, 0x15, 0x0A, 0x0A, 0x15, 0x15, 0x0A, 0x0A, 0x0A, 0x15, 0x0A, 0x0F, 0x13, 0x18, 0x0A, 0x11, 0x15, 0x18, 0x0A, 0x0D, 0x15, 0x18, 0x0A, 0x0D, 0x11, 0x18, 0x0A, 0x18, 0x18, 0x18, 0x0A, 0x0A, 0x18, 0x18, 0x0A, 0x0A, 0x0A, 0x18, 0x0A, 0x10, 0x15, 0x1B, 0x0A, 0x12, 0x17, 0x1B, 0x0A, 0x0E, 0x17, 0x1B, 0x0A, 0x0E, 0x13, 0x1B, 0x0A, 0x1B, 0x1B, 0x1B, 0x0A, 0x0A, 0x1B, 0x1B, 0x0A, 0x0A, 0x0A, 0x1B, 0x0A, 0x11, 0x17, 0x1E, 0x0A, 0x14, 0x19, 0x1E, 0x0A, 0x0F, 0x19, 0x1E, 0x0A, 0x0F, 0x14, 0x1E, 0x0A, 0x1E, 0x1E, 0x1E, 0x0A, 0x0A, 0x1E, 0x1E, 0x0A, 0x0A, 0x0A, 0x1E, 0x0A, 0x15, 0x1C, 0x21, 0x0A, 0x0F, 0x1C, 0x21, 0x0A, 0x0F, 0x16, 0x21, 0x0A, 0x21, 0x21, 0x21, 0x0A, 0x0A, 0x21, 0x21, 0x0A, 0x0A, 0x0A, 0x21, 0x0A, 0x17, 0x1E, 0x24, 0x0A, 0x10, 0x1E, 0x24, 0x0A, 0x10, 0x17, 0x24, 0x0A, 0x24, 0x24, 0x24, 0x0A, 0x0A, 0x24, 0x24, 0x0A, 0x0A, 0x0A, 0x24, 0x0A, 0x18, 0x20, 0x27, 0x0A, 0x11, 0x20, 0x27, 0x0A, 0x11, 0x19, 0x27, 0x0A, 0x27, 0x27, 0x27, 0x0A, 0x0A, 0x27, 0x27, 0x0A, 0x0A, 0x0A, 0x27, 0x0A, 0x1A, 0x22, 0x2A, 0x0A, 0x12, 0x22, 0x2A, 0x0A, 0x12, 0x1A, 0x2A, 0x0A, 0x2A, 0x2A, 0x2A, 0x0A, 0x0A, 0x2A, 0x2A, 0x0A, 0x0A, 0x0A, 0x2A, 0x0A, 0x2D, 0x2D, 0x2D, 0x0A, 0x0A, 0x2D, 0x2D, 0x0A, 0x0A, 0x0A, 0x2D, 0x0A, 0x1C, 0x25, 0x2E, 0x0A, 0x13, 0x25, 0x2E, 0x0A, 0x13, 0x1C, 0x2E, 0x0A, 0x32, 0x32, 0x32, 0x0A, 0x0A, 0x32, 0x32, 0x0A, 0x0A, 0x0A, 0x32, 0x0A, 0x38, 0x38, 0x38, 0x0A, 0x0A, 0x38, 0x38, 0x0A, 0x0A, 0x0A, 0x38, 0x0B, 0x0C, 0x0C, 0x0D, 0x0B, 0x0C, 0x0D, 0x0E, 0x0B, 0x0D, 0x0E, 0x0F, 0x0B, 0x0C, 0x0E, 0x0F, 0x0B, 0x0C, 0x0D, 0x0F, 0x0B, 0x0D, 0x0E, 0x10, 0x0B, 0x0D, 0x0F, 0x10, 0x0B, 0x0C, 0x0F, 0x10, 0x0B, 0x0C, 0x0E, 0x10, 0x0B, 0x0D, 0x0F, 0x11, 0x0B, 0x0E, 0x10, 0x11, 0x0B, 0x0C, 0x10, 0x11, 0x0B, 0x0C, 0x0E, 0x11, 0x0B, 0x11, 0x11, 0x11, 0x0B, 0x0B, 0x11, 0x11, 0x0B, 0x0B, 0x0B, 0x11, 0x0B, 0x0E, 0x0F, 0x12, 0x0B, 0x0E, 0x11, 0x12, 0x0B, 0x0C, 0x11, 0x12, 0x0B, 0x0C, 0x0F, 0x12, 0x0B, 0x0E, 0x10, 0x13, 0x0B, 0x0F, 0x11, 0x13, 0x0B, 0x0D, 0x11, 0x13, 0x0B, 0x0D, 0x0F, 0x13, 0x0B, 0x13, 0x13, 0x13, 0x0B, 0x0B, 0x13, 0x13, 0x0B, 0x0B, 0x0B, 0x13, 0x0B, 0x0F, 0x12, 0x16, 0x0B, 0x10, 0x14, 0x16, 0x0B, 0x0D, 0x14, 0x16, 0x0B, 0x0D, 0x11, 0x16, 0x0B, 0x16, 0x16, 0x16, 0x0B, 0x0B, 0x16, 0x16, 0x0B, 0x0B, 0x0B, 0x16, 0x0B, 0x10, 0x14, 0x19, 0x0B, 0x12, 0x16, 0x19, 0x0B, 0x0E, 0x16, 0x19, 0x0B, 0x0E, 0x12, 0x19, 0x0B, 0x19, 0x19, 0x19, 0x0B, 0x0B, 0x19, 0x19, 0x0B, 0x0B, 0x0B, 0x19, 0x0B, 0x11, 0x16, 0x1C, 0x0B, 0x13, 0x18, 0x1C, 0x0B, 0x0F, 0x18, 0x1C, 0x0B, 0x0F, 0x14, 0x1C, 0x0B, 0x1C, 0x1C, 0x1C, 0x0B, 0x0B, 0x1C, 0x1C, 0x0B, 0x0B, 0x0B, 0x1C, 0x0B, 0x12, 0x18, 0x1F, 0x0B, 0x15, 0x1A, 0x1F, 0x0B, 0x10, 0x1A, 0x1F, 0x0B, 0x10, 0x15, 0x1F, 0x0B, 0x1F, 0x1F, 0x1F, 0x0B, 0x0B, 0x1F, 0x1F, 0x0B, 0x0B, 0x0B, 0x1F, 0x0B, 0x16, 0x1D, 0x22, 0x0B, 0x10, 0x1D, 0x22, 0x0B, 0x10, 0x17, 0x22, 0x0B, 0x22, 0x22, 0x22, 0x0B, 0x0B, 0x22, 0x22, 0x0B, 0x0B, 0x0B, 0x22, 0x0B, 0x18, 0x1F, 0x25, 0x0B, 0x11, 0x1F, 0x25, 0x0B, 0x11, 0x18, 0x25, 0x0B, 0x25, 0x25, 0x25, 0x0B, 0x0B, 0x25, 0x25, 0x0B, 0x0B, 0x0B, 0x25, 0x0B, 0x19, 0x21, 0x28, 0x0B, 0x12, 0x21, 0x28, 0x0B, 0x12, 0x1A, 0x28, 0x0B, 0x28, 0x28, 0x28, 0x0B, 0x0B, 0x28, 0x28, 0x0B, 0x0B, 0x0B, 0x28, 0x0B, 0x1B, 0x23, 0x2B, 0x0B, 0x13, 0x23, 0x2B, 0x0B, 0x13, 0x1B, 0x2B, 0x0B, 0x2B, 0x2B, 0x2B, 0x0B, 0x0B, 0x2B, 0x2B, 0x0B, 0x0B, 0x0B, 0x2B, 0x0B, 0x2E, 0x2E, 0x2E, 0x0B, 0x0B, 0x2E, 0x2E, 0x0B, 0x0B, 0x0B, 0x2E, 0x0B, 0x1D, 0x26, 0x2F, 0x0B, 0x14, 0x26, 0x2F, 0x0B, 0x14, 0x1D, 0x2F, 0x0B, 0x33, 0x33, 0x33, 0x0B, 0x0B, 0x33, 0x33, 0x0B, 0x0B, 0x0B, 0x33, 0x0B, 0x39, 0x39, 0x39, 0x0B, 0x0B, 0x39, 0x39, 0x0B, 0x0B, 0x0B, 0x39, 0x0C, 0x0D, 0x0D, 0x0E, 0x0C, 0x0D, 0x0E, 0x0F, 0x0C, 0x0E, 0x0F, 0x10, 0x0C, 0x0D, 0x0F, 0x10, 0x0C, 0x0D, 0x0E, 0x10, 0x0C, 0x0E, 0x0F, 0x11, 0x0C, 0x0E, 0x10, 0x11, 0x0C, 0x0D, 0x10, 0x11, 0x0C, 0x0D, 0x0F, 0x11, 0x0C, 0x0E, 0x10, 0x12, 0x0C, 0x0F, 0x11, 0x12, 0x0C, 0x0D, 0x11, 0x12, 0x0C, 0x0D, 0x0F, 0x12, 0x0C, 0x12, 0x12, 0x12, 0x0C, 0x0C, 0x12, 0x12, 0x0C, 0x0C, 0x0C, 0x12, 0x0C, 0x0F, 0x10, 0x13, 0x0C, 0x0F, 0x12, 0x13, 0x0C, 0x0D, 0x12, 0x13, 0x0C, 0x0D, 0x10, 0x13, 0x0C, 0x0F, 0x11, 0x14, 0x0C, 0x10, 0x12, 0x14, 0x0C, 0x0E, 0x12, 0x14, 0x0C, 0x0E, 0x10, 0x14, 0x0C, 0x14, 0x14, 0x14, 0x0C, 0x0C, 0x14, 0x14, 0x0C, 0x0C, 0x0C, 0x14, 0x0C, 0x10, 0x13, 0x17, 0x0C, 0x11, 0x15, 0x17, 0x0C, 0x0E, 0x15, 0x17, 0x0C, 0x0E, 0x12, 0x17, 0x0C, 0x17, 0x17, 0x17, 0x0C, 0x0C, 0x17, 0x17, 0x0C, 0x0C, 0x0C, 0x17, 0x0C, 0x11, 0x15, 0x1A, 0x0C, 0x13, 0x17, 0x1A, 0x0C, 0x0F, 0x17, 0x1A, 0x0C, 0x0F, 0x13, 0x1A, 0x0C, 0x1A, 0x1A, 0x1A, 0x0C, 0x0C, 0x1A, 0x1A, 0x0C, 0x0C, 0x0C, 0x1A, 0x0C, 0x12, 0x17, 0x1D, 0x0C, 0x14, 0x19, 0x1D, 0x0C, 0x10, 0x19, 0x1D, 0x0C, 0x10, 0x15, 0x1D, 0x0C, 0x1D, 0x1D, 0x1D, 0x0C, 0x0C, 0x1D, 0x1D, 0x0C, 0x0C, 0x0C, 0x1D, 0x0C, 0x13, 0x19, 0x20, 0x0C, 0x16, 0x1B, 0x20, 0x0C, 0x11, 0x1B, 0x20, 0x0C, 0x11, 0x16, 0x20, 0x0C, 0x20, 0x20, 0x20, 0x0C, 0x0C, 0x20, 0x20, 0x0C, 0x0C, 0x0C, 0x20, 0x0C, 0x17, 0x1E, 0x23, 0x0C, 0x11, 0x1E, 0x23, 0x0C, 0x11, 0x18, 0x23, 0x0C, 0x23, 0x23, 0x23, 0x0C, 0x0C, 0x23, 0x23, 0x0C, 0x0C, 0x0C, 0x23, 0x0C, 0x19, 0x20, 0x26, 0x0C, 0x12, 0x20, 0x26, 0x0C, 0x12, 0x19, 0x26, 0x0C, 0x26, 0x26, 0x26, 0x0C, 0x0C, 0x26, 0x26, 0x0C, 0x0C, 0x0C, 0x26, 0x0C, 0x1A, 0x22, 0x29, 0x0C, 0x13, 0x22, 0x29, 0x0C, 0x13, 0x1B, 0x29, 0x0C, 0x29, 0x29, 0x29, 0x0C, 0x0C, 0x29, 0x29, 0x0C, 0x0C, 0x0C, 0x29, 0x0C, 0x1C, 0x24, 0x2C, 0x0C, 0x14, 0x24, 0x2C, 0x0C, 0x14, 0x1C, 0x2C, 0x0C, 0x2C, 0x2C, 0x2C, 0x0C, 0x0C, 0x2C, 0x2C, 0x0C, 0x0C, 0x0C, 0x2C, 0x0C, 0x2F, 0x2F, 0x2F, 0x0C, 0x0C, 0x2F, 0x2F, 0x0C, 0x0C, 0x0C, 0x2F, 0x0C, 0x1E, 0x27, 0x30, 0x0C, 0x15, 0x27, 0x30, 0x0C, 0x15, 0x1E, 0x30, 0x0C, 0x34, 0x34, 0x34, 0x0C, 0x0C, 0x34, 0x34, 0x0C, 0x0C, 0x0C, 0x34, 0x0C, 0x3A, 0x3A, 0x3A, 0x0C, 0x0C, 0x3A, 0x3A, 0x0C, 0x0C, 0x0C, 0x3A, 0x0D, 0x0E, 0x0E, 0x0F, 0x0D, 0x0E, 0x0F, 0x10, 0x0D, 0x0F, 0x10, 0x11, 0x0D, 0x0E, 0x10, 0x11, 0x0D, 0x0E, 0x0F, 0x11, 0x0D, 0x0F, 0x10, 0x12, 0x0D, 0x0F, 0x11, 0x12, 0x0D, 0x0E, 0x11, 0x12, 0x0D, 0x0E, 0x10, 0x12, 0x0D, 0x0F, 0x11, 0x13, 0x0D, 0x10, 0x12, 0x13, 0x0D, 0x0E, 0x12, 0x13, 0x0D, 0x0E, 0x10, 0x13, 0x0D, 0x13, 0x13, 0x13, 0x0D, 0x0D, 0x13, 0x13, 0x0D, 0x0D, 0x0D, 0x13, 0x0D, 0x10, 0x11, 0x14, 0x0D, 0x10, 0x13, 0x14, 0x0D, 0x0E, 0x13, 0x14, 0x0D, 0x0E, 0x11, 0x14, 0x0D, 0x10, 0x12, 0x15, 0x0D, 0x11, 0x13, 0x15, 0x0D, 0x0F, 0x13, 0x15, 0x0D, 0x0F, 0x11, 0x15, 0x0D, 0x15, 0x15, 0x15, 0x0D, 0x0D, 0x15, 0x15, 0x0D, 0x0D, 0x0D, 0x15, 0x0D, 0x11, 0x14, 0x18, 0x0D, 0x12, 0x16, 0x18, 0x0D, 0x0F, 0x16, 0x18, 0x0D, 0x0F, 0x13, 0x18, 0x0D, 0x18, 0x18, 0x18, 0x0D, 0x0D, 0x18, 0x18, 0x0D, 0x0D, 0x0D, 0x18, 0x0D, 0x12, 0x16, 0x1B, 0x0D, 0x14, 0x18, 0x1B, 0x0D, 0x10, 0x18, 0x1B, 0x0D, 0x10, 0x14, 0x1B, 0x0D, 0x1B, 0x1B, 0x1B, 0x0D, 0x0D, 0x1B, 0x1B, 0x0D, 0x0D, 0x0D, 0x1B, 0x0D, 0x13, 0x18, 0x1E, 0x0D, 0x15, 0x1A, 0x1E, 0x0D, 0x11, 0x1A, 0x1E, 0x0D, 0x11, 0x16, 0x1E, 0x0D, 0x1E, 0x1E, 0x1E, 0x0D, 0x0D, 0x1E, 0x1E, 0x0D, 0x0D, 0x0D, 0x1E, 0x0D, 0x14, 0x1A, 0x21, 0x0D, 0x17, 0x1C, 0x21, 0x0D, 0x12, 0x1C, 0x21, 0x0D, 0x12, 0x17, 0x21, 0x0D, 0x21, 0x21, 0x21, 0x0D, 0x0D, 0x21, 0x21, 0x0D, 0x0D, 0x0D, 0x21, 0x0D, 0x18, 0x1F, 0x24, 0x0D, 0x12, 0x1F, 0x24, 0x0D, 0x12, 0x19, 0x24, 0x0D, 0x24, 0x24, 0x24, 0x0D, 0x0D, 0x24, 0x24, 0x0D, 0x0D, 0x0D, 0x24, 0x0D, 0x1A, 0x21, 0x27, 0x0D, 0x13, 0x21, 0x27, 0x0D, 0x13, 0x1A, 0x27, 0x0D, 0x27, 0x27, 0x27, 0x0D, 0x0D, 0x27, 0x27, 0x0D, 0x0D, 0x0D, 0x27, 0x0D, 0x1B, 0x23, 0x2A, 0x0D, 0x14, 0x23, 0x2A, 0x0D, 0x14, 0x1C, 0x2A, 0x0D, 0x2A, 0x2A, 0x2A, 0x0D, 0x0D, 0x2A, 0x2A, 0x0D, 0x0D, 0x0D, 0x2A, 0x0D, 0x1D, 0x25, 0x2D, 0x0D, 0x15, 0x25, 0x2D, 0x0D, 0x15, 0x1D, 0x2D, 0x0D, 0x2D, 0x2D, 0x2D, 0x0D, 0x0D, 0x2D, 0x2D, 0x0D, 0x0D, 0x0D, 0x2D, 0x0D, 0x30, 0x30, 0x30, 0x0D, 0x0D, 0x30, 0x30, 0x0D, 0x0D, 0x0D, 0x30, 0x0D, 0x1F, 0x28, 0x31, 0x0D, 0x16, 0x28, 0x31, 0x0D, 0x16, 0x1F, 0x31, 0x0D, 0x35, 0x35, 0x35, 0x0D, 0x0D, 0x35, 0x35, 0x0D, 0x0D, 0x0D, 0x35, 0x0D, 0x3B, 0x3B, 0x3B, 0x0D, 0x0D, 0x3B, 0x3B, 0x0D, 0x0D, 0x0D, 0x3B, 0x0E, 0x0F, 0x0F, 0x10, 0x0E, 0x0F, 0x10, 0x11, 0x0E, 0x10, 0x11, 0x12, 0x0E, 0x0F, 0x11, 0x12, 0x0E, 0x0F, 0x10, 0x12, 0x0E, 0x10, 0x11, 0x13, 0x0E, 0x10, 0x12, 0x13, 0x0E, 0x0F, 0x12, 0x13, 0x0E, 0x0F, 0x11, 0x13, 0x0E, 0x10, 0x12, 0x14, 0x0E, 0x11, 0x13, 0x14, 0x0E, 0x0F, 0x13, 0x14, 0x0E, 0x0F, 0x11, 0x14, 0x0E, 0x14, 0x14, 0x14, 0x0E, 0x0E, 0x14, 0x14, 0x0E, 0x0E, 0x0E, 0x14, 0x0E, 0x11, 0x12, 0x15, 0x0E, 0x11, 0x14, 0x15, 0x0E, 0x0F, 0x14, 0x15, 0x0E, 0x0F, 0x12, 0x15, 0x0E, 0x11, 0x13, 0x16, 0x0E, 0x12, 0x14, 0x16, 0x0E, 0x10, 0x14, 0x16, 0x0E, 0x10, 0x12, 0x16, 0x0E, 0x16, 0x16, 0x16, 0x0E, 0x0E, 0x16, 0x16, 0x0E, 0x0E, 0x0E, 0x16, 0x0E, 0x12, 0x15, 0x19, 0x0E, 0x13, 0x17, 0x19, 0x0E, 0x10, 0x17, 0x19, 0x0E, 0x10, 0x14, 0x19, 0x0E, 0x19, 0x19, 0x19, 0x0E, 0x0E, 0x19, 0x19, 0x0E, 0x0E, 0x0E, 0x19, 0x0E, 0x13, 0x17, 0x1C, 0x0E, 0x15, 0x19, 0x1C, 0x0E, 0x11, 0x19, 0x1C, 0x0E, 0x11, 0x15, 0x1C, 0x0E, 0x1C, 0x1C, 0x1C, 0x0E, 0x0E, 0x1C, 0x1C, 0x0E, 0x0E, 0x0E, 0x1C, 0x0E, 0x14, 0x19, 0x1F, 0x0E, 0x16, 0x1B, 0x1F, 0x0E, 0x12, 0x1B, 0x1F, 0x0E, 0x12, 0x17, 0x1F, 0x0E, 0x1F, 0x1F, 0x1F, 0x0E, 0x0E, 0x1F, 0x1F, 0x0E, 0x0E, 0x0E, 0x1F, 0x0E, 0x15, 0x1B, 0x22, 0x0E, 0x18, 0x1D, 0x22, 0x0E, 0x13, 0x1D, 0x22, 0x0E, 0x13, 0x18, 0x22, 0x0E, 0x22, 0x22, 0x22, 0x0E, 0x0E, 0x22, 0x22, 0x0E, 0x0E, 0x0E, 0x22, 0x0E, 0x19, 0x20, 0x25, 0x0E, 0x13, 0x20, 0x25, 0x0E, 0x13, 0x1A, 0x25, 0x0E, 0x25, 0x25, 0x25, 0x0E, 0x0E, 0x25, 0x25, 0x0E, 0x0E, 0x0E, 0x25, 0x0E, 0x1B, 0x22, 0x28, 0x0E, 0x14, 0x22, 0x28, 0x0E, 0x14, 0x1B, 0x28, 0x0E, 0x28, 0x28, 0x28, 0x0E, 0x0E, 0x28, 0x28, 0x0E, 0x0E, 0x0E, 0x28, 0x0E, 0x1C, 0x24, 0x2B, 0x0E, 0x15, 0x24, 0x2B, 0x0E, 0x15, 0x1D, 0x2B, 0x0E, 0x2B, 0x2B, 0x2B, 0x0E, 0x0E, 0x2B, 0x2B, 0x0E, 0x0E, 0x0E, 0x2B, 0x0E, 0x1E, 0x26, 0x2E, 0x0E, 0x16, 0x26, 0x2E, 0x0E, 0x16, 0x1E, 0x2E, 0x0E, 0x2E, 0x2E, 0x2E, 0x0E, 0x0E, 0x2E, 0x2E, 0x0E, 0x0E, 0x0E, 0x2E, 0x0E, 0x31, 0x31, 0x31, 0x0E, 0x0E, 0x31, 0x31, 0x0E, 0x0E, 0x0E, 0x31, 0x0E, 0x20, 0x29, 0x32, 0x0E, 0x17, 0x29, 0x32, 0x0E, 0x17, 0x20, 0x32, 0x0E, 0x36, 0x36, 0x36, 0x0E, 0x0E, 0x36, 0x36, 0x0E, 0x0E, 0x0E, 0x36, 0x0E, 0x3C, 0x3C, 0x3C, 0x0E, 0x0E, 0x3C, 0x3C, 0x0E, 0x0E, 0x0E, 0x3C, 0x0F, 0x10, 0x10, 0x11, 0x0F, 0x10, 0x11, 0x12, 0x0F, 0x11, 0x12, 0x13, 0x0F, 0x10, 0x12, 0x13, 0x0F, 0x10, 0x11, 0x13, 0x0F, 0x11, 0x12, 0x14, 0x0F, 0x11, 0x13, 0x14, 0x0F, 0x10, 0x13, 0x14, 0x0F, 0x10, 0x12, 0x14, 0x0F, 0x11, 0x13, 0x15, 0x0F, 0x12, 0x14, 0x15, 0x0F, 0x10, 0x14, 0x15, 0x0F, 0x10, 0x12, 0x15, 0x0F, 0x15, 0x15, 0x15, 0x0F, 0x0F, 0x15, 0x15, 0x0F, 0x0F, 0x0F, 0x15, 0x0F, 0x12, 0x13, 0x16, 0x0F, 0x12, 0x15, 0x16, 0x0F, 0x10, 0x15, 0x16, 0x0F, 0x10, 0x13, 0x16, 0x0F, 0x12, 0x14, 0x17, 0x0F, 0x13, 0x15, 0x17, 0x0F, 0x11, 0x15, 0x17, 0x0F, 0x11, 0x13, 0x17, 0x0F, 0x17, 0x17, 0x17, 0x0F, 0x0F, 0x17, 0x17, 0x0F, 0x0F, 0x0F, 0x17, 0x0F, 0x13, 0x16, 0x1A, 0x0F, 0x14, 0x18, 0x1A, 0x0F, 0x11, 0x18, 0x1A, 0x0F, 0x11, 0x15, 0x1A, 0x0F, 0x1A, 0x1A, 0x1A, 0x0F, 0x0F, 0x1A, 0x1A, 0x0F, 0x0F, 0x0F, 0x1A, 0x0F, 0x14, 0x18, 0x1D, 0x0F, 0x16, 0x1A, 0x1D, 0x0F, 0x12, 0x1A, 0x1D, 0x0F, 0x12, 0x16, 0x1D, 0x0F, 0x1D, 0x1D, 0x1D, 0x0F, 0x0F, 0x1D, 0x1D, 0x0F, 0x0F, 0x0F, 0x1D, 0x0F, 0x15, 0x1A, 0x20, 0x0F, 0x17, 0x1C, 0x20, 0x0F, 0x13, 0x1C, 0x20, 0x0F, 0x13, 0x18, 0x20, 0x0F, 0x20, 0x20, 0x20, 0x0F, 0x0F, 0x20, 0x20, 0x0F, 0x0F, 0x0F, 0x20, 0x0F, 0x16, 0x1C, 0x23, 0x0F, 0x19, 0x1E, 0x23, 0x0F, 0x14, 0x1E, 0x23, 0x0F, 0x14, 0x19, 0x23, 0x0F, 0x23, 0x23, 0x23, 0x0F, 0x0F, 0x23, 0x23, 0x0F, 0x0F, 0x0F, 0x23, 0x0F, 0x1A, 0x21, 0x26, 0x0F, 0x14, 0x21, 0x26, 0x0F, 0x14, 0x1B, 0x26, 0x0F, 0x26, 0x26, 0x26, 0x0F, 0x0F, 0x26, 0x26, 0x0F, 0x0F, 0x0F, 0x26, 0x0F, 0x1C, 0x23, 0x29, 0x0F, 0x15, 0x23, 0x29, 0x0F, 0x15, 0x1C, 0x29, 0x0F, 0x29, 0x29, 0x29, 0x0F, 0x0F, 0x29, 0x29, 0x0F, 0x0F, 0x0F, 0x29, 0x0F, 0x1D, 0x25, 0x2C, 0x0F, 0x16, 0x25, 0x2C, 0x0F, 0x16, 0x1E, 0x2C, 0x0F, 0x2C, 0x2C, 0x2C, 0x0F, 0x0F, 0x2C, 0x2C, 0x0F, 0x0F, 0x0F, 0x2C, 0x0F, 0x1F, 0x27, 0x2F, 0x0F, 0x17, 0x27, 0x2F, 0x0F, 0x17, 0x1F, 0x2F, 0x0F, 0x2F, 0x2F, 0x2F, 0x0F, 0x0F, 0x2F, 0x2F, 0x0F, 0x0F, 0x0F, 0x2F, 0x0F, 0x32, 0x32, 0x32, 0x0F, 0x0F, 0x32, 0x32, 0x0F, 0x0F, 0x0F, 0x32, 0x0F, 0x21, 0x2A, 0x33, 0x0F, 0x18, 0x2A, 0x33, 0x0F, 0x18, 0x21, 0x33, 0x0F, 0x37, 0x37, 0x37, 0x0F, 0x0F, 0x37, 0x37, 0x0F, 0x0F, 0x0F, 0x37, 0x0F, 0x3D, 0x3D, 0x3D, 0x0F, 0x0F, 0x3D, 0x3D, 0x0F, 0x0F, 0x0F, 0x3D, 0x10, 0x11, 0x11, 0x12, 0x10, 0x11, 0x12, 0x13, 0x10, 0x12, 0x13, 0x14, 0x10, 0x11, 0x13, 0x14, 0x10, 0x11, 0x12, 0x14, 0x10, 0x12, 0x13, 0x15, 0x10, 0x12, 0x14, 0x15, 0x10, 0x11, 0x14, 0x15, 0x10, 0x11, 0x13, 0x15, 0x10, 0x12, 0x14, 0x16, 0x10, 0x13, 0x15, 0x16, 0x10, 0x11, 0x15, 0x16, 0x10, 0x11, 0x13, 0x16, 0x10, 0x16, 0x16, 0x16, 0x10, 0x10, 0x16, 0x16, 0x10, 0x10, 0x10, 0x16, 0x10, 0x13, 0x14, 0x17, 0x10, 0x13, 0x16, 0x17, 0x10, 0x11, 0x16, 0x17, 0x10, 0x11, 0x14, 0x17, 0x10, 0x13, 0x15, 0x18, 0x10, 0x14, 0x16, 0x18, 0x10, 0x12, 0x16, 0x18, 0x10, 0x12, 0x14, 0x18, 0x10, 0x18, 0x18, 0x18, 0x10, 0x10, 0x18, 0x18, 0x10, 0x10, 0x10, 0x18, 0x10, 0x14, 0x17, 0x1B, 0x10, 0x15, 0x19, 0x1B, 0x10, 0x12, 0x19, 0x1B, 0x10, 0x12, 0x16, 0x1B, 0x10, 0x1B, 0x1B, 0x1B, 0x10, 0x10, 0x1B, 0x1B, 0x10, 0x10, 0x10, 0x1B, 0x10, 0x15, 0x19, 0x1E, 0x10, 0x17, 0x1B, 0x1E, 0x10, 0x13, 0x1B, 0x1E, 0x10, 0x13, 0x17, 0x1E, 0x10, 0x1E, 0x1E, 0x1E, 0x10, 0x10, 0x1E, 0x1E, 0x10, 0x10, 0x10, 0x1E, 0x10, 0x16, 0x1B, 0x21, 0x10, 0x18, 0x1D, 0x21, 0x10, 0x14, 0x1D, 0x21, 0x10, 0x14, 0x19, 0x21, 0x10, 0x21, 0x21, 0x21, 0x10, 0x10, 0x21, 0x21, 0x10, 0x10, 0x10, 0x21, 0x10, 0x17, 0x1D, 0x24, 0x10, 0x1A, 0x1F, 0x24, 0x10, 0x15, 0x1F, 0x24, 0x10, 0x15, 0x1A, 0x24, 0x10, 0x24, 0x24, 0x24, 0x10, 0x10, 0x24, 0x24, 0x10, 0x10, 0x10, 0x24, 0x10, 0x1B, 0x22, 0x27, 0x10, 0x15, 0x22, 0x27, 0x10, 0x15, 0x1C, 0x27, 0x10, 0x27, 0x27, 0x27, 0x10, 0x10, 0x27, 0x27, 0x10, 0x10, 0x10, 0x27, 0x10, 0x1D, 0x24, 0x2A, 0x10, 0x16, 0x24, 0x2A, 0x10, 0x16, 0x1D, 0x2A, 0x10, 0x2A, 0x2A, 0x2A, 0x10, 0x10, 0x2A, 0x2A, 0x10, 0x10, 0x10, 0x2A, 0x10, 0x1E, 0x26, 0x2D, 0x10, 0x17, 0x26, 0x2D, 0x10, 0x17, 0x1F, 0x2D, 0x10, 0x2D, 0x2D, 0x2D, 0x10, 0x10, 0x2D, 0x2D, 0x10, 0x10, 0x10, 0x2D, 0x10, 0x20, 0x28, 0x30, 0x10, 0x18, 0x28, 0x30, 0x10, 0x18, 0x20, 0x30, 0x10, 0x30, 0x30, 0x30, 0x10, 0x10, 0x30, 0x30, 0x10, 0x10, 0x10, 0x30, 0x10, 0x33, 0x33, 0x33, 0x10, 0x10, 0x33, 0x33, 0x10, 0x10, 0x10, 0x33, 0x10, 0x22, 0x2B, 0x34, 0x10, 0x19, 0x2B, 0x34, 0x10, 0x19, 0x22, 0x34, 0x10, 0x38, 0x38, 0x38, 0x10, 0x10, 0x38, 0x38, 0x10, 0x10, 0x10, 0x38, 0x10, 0x3E, 0x3E, 0x3E, 0x10, 0x10, 0x3E, 0x3E, 0x10, 0x10, 0x10, 0x3E, 0x11, 0x12, 0x12, 0x13, 0x11, 0x12, 0x13, 0x14, 0x11, 0x13, 0x14, 0x15, 0x11, 0x12, 0x14, 0x15, 0x11, 0x12, 0x13, 0x15, 0x11, 0x13, 0x14, 0x16, 0x11, 0x13, 0x15, 0x16, 0x11, 0x12, 0x15, 0x16, 0x11, 0x12, 0x14, 0x16, 0x11, 0x13, 0x15, 0x17, 0x11, 0x14, 0x16, 0x17, 0x11, 0x12, 0x16, 0x17, 0x11, 0x12, 0x14, 0x17, 0x11, 0x17, 0x17, 0x17, 0x11, 0x11, 0x17, 0x17, 0x11, 0x11, 0x11, 0x17, 0x11, 0x14, 0x15, 0x18, 0x11, 0x14, 0x17, 0x18, 0x11, 0x12, 0x17, 0x18, 0x11, 0x12, 0x15, 0x18, 0x11, 0x14, 0x16, 0x19, 0x11, 0x15, 0x17, 0x19, 0x11, 0x13, 0x17, 0x19, 0x11, 0x13, 0x15, 0x19, 0x11, 0x19, 0x19, 0x19, 0x11, 0x11, 0x19, 0x19, 0x11, 0x11, 0x11, 0x19, 0x11, 0x15, 0x18, 0x1C, 0x11, 0x16, 0x1A, 0x1C, 0x11, 0x13, 0x1A, 0x1C, 0x11, 0x13, 0x17, 0x1C, 0x11, 0x1C, 0x1C, 0x1C, 0x11, 0x11, 0x1C, 0x1C, 0x11, 0x11, 0x11, 0x1C, 0x11, 0x16, 0x1A, 0x1F, 0x11, 0x18, 0x1C, 0x1F, 0x11, 0x14, 0x1C, 0x1F, 0x11, 0x14, 0x18, 0x1F, 0x11, 0x1F, 0x1F, 0x1F, 0x11, 0x11, 0x1F, 0x1F, 0x11, 0x11, 0x11, 0x1F, 0x11, 0x17, 0x1C, 0x22, 0x11, 0x19, 0x1E, 0x22, 0x11, 0x15, 0x1E, 0x22, 0x11, 0x15, 0x1A, 0x22, 0x11, 0x22, 0x22, 0x22, 0x11, 0x11, 0x22, 0x22, 0x11, 0x11, 0x11, 0x22, 0x11, 0x18, 0x1E, 0x25, 0x11, 0x1B, 0x20, 0x25, 0x11, 0x16, 0x20, 0x25, 0x11, 0x16, 0x1B, 0x25, 0x11, 0x25, 0x25, 0x25, 0x11, 0x11, 0x25, 0x25, 0x11, 0x11, 0x11, 0x25, 0x11, 0x1C, 0x23, 0x28, 0x11, 0x16, 0x23, 0x28, 0x11, 0x16, 0x1D, 0x28, 0x11, 0x28, 0x28, 0x28, 0x11, 0x11, 0x28, 0x28, 0x11, 0x11, 0x11, 0x28, 0x11, 0x1E, 0x25, 0x2B, 0x11, 0x17, 0x25, 0x2B, 0x11, 0x17, 0x1E, 0x2B, 0x11, 0x2B, 0x2B, 0x2B, 0x11, 0x11, 0x2B, 0x2B, 0x11, 0x11, 0x11, 0x2B, 0x11, 0x1F, 0x27, 0x2E, 0x11, 0x18, 0x27, 0x2E, 0x11, 0x18, 0x20, 0x2E, 0x11, 0x2E, 0x2E, 0x2E, 0x11, 0x11, 0x2E, 0x2E, 0x11, 0x11, 0x11, 0x2E, 0x11, 0x21, 0x29, 0x31, 0x11, 0x19, 0x29, 0x31, 0x11, 0x19, 0x21, 0x31, 0x11, 0x31, 0x31, 0x31, 0x11, 0x11, 0x31, 0x31, 0x11, 0x11, 0x11, 0x31, 0x11, 0x34, 0x34, 0x34, 0x11, 0x11, 0x34, 0x34, 0x11, 0x11, 0x11, 0x34, 0x11, 0x23, 0x2C, 0x35, 0x11, 0x1A, 0x2C, 0x35, 0x11, 0x1A, 0x23, 0x35, 0x11, 0x39, 0x39, 0x39, 0x11, 0x11, 0x39, 0x39, 0x11, 0x11, 0x11, 0x39, 0x11, 0x3F, 0x3F, 0x3F, 0x11, 0x11, 0x3F, 0x3F, 0x11, 0x11, 0x11, 0x3F, 0x12, 0x13, 0x13, 0x14, 0x12, 0x13, 0x14, 0x15, 0x12, 0x14, 0x15, 0x16, 0x12, 0x13, 0x15, 0x16, 0x12, 0x13, 0x14, 0x16, 0x12, 0x14, 0x15, 0x17, 0x12, 0x14, 0x16, 0x17, 0x12, 0x13, 0x16, 0x17, 0x12, 0x13, 0x15, 0x17, 0x12, 0x14, 0x16, 0x18, 0x12, 0x15, 0x17, 0x18, 0x12, 0x13, 0x17, 0x18, 0x12, 0x13, 0x15, 0x18, 0x12, 0x18, 0x18, 0x18, 0x12, 0x12, 0x18, 0x18, 0x12, 0x12, 0x12, 0x18, 0x12, 0x15, 0x16, 0x19, 0x12, 0x15, 0x18, 0x19, 0x12, 0x13, 0x18, 0x19, 0x12, 0x13, 0x16, 0x19, 0x12, 0x15, 0x17, 0x1A, 0x12, 0x16, 0x18, 0x1A, 0x12, 0x14, 0x18, 0x1A, 0x12, 0x14, 0x16, 0x1A, 0x12, 0x1A, 0x1A, 0x1A, 0x12, 0x12, 0x1A, 0x1A, 0x12, 0x12, 0x12, 0x1A, 0x12, 0x16, 0x19, 0x1D, 0x12, 0x17, 0x1B, 0x1D, 0x12, 0x14, 0x1B, 0x1D, 0x12, 0x14, 0x18, 0x1D, 0x12, 0x1D, 0x1D, 0x1D, 0x12, 0x12, 0x1D, 0x1D, 0x12, 0x12, 0x12, 0x1D, 0x12, 0x17, 0x1B, 0x20, 0x12, 0x19, 0x1D, 0x20, 0x12, 0x15, 0x1D, 0x20, 0x12, 0x15, 0x19, 0x20, 0x12, 0x20, 0x20, 0x20, 0x12, 0x12, 0x20, 0x20, 0x12, 0x12, 0x12, 0x20, 0x12, 0x18, 0x1D, 0x23, 0x12, 0x1A, 0x1F, 0x23, 0x12, 0x16, 0x1F, 0x23, 0x12, 0x16, 0x1B, 0x23, 0x12, 0x23, 0x23, 0x23, 0x12, 0x12, 0x23, 0x23, 0x12, 0x12, 0x12, 0x23, 0x12, 0x19, 0x1F, 0x26, 0x12, 0x1C, 0x21, 0x26, 0x12, 0x17, 0x21, 0x26, 0x12, 0x17, 0x1C, 0x26, 0x12, 0x26, 0x26, 0x26, 0x12, 0x12, 0x26, 0x26, 0x12, 0x12, 0x12, 0x26, 0x12, 0x1D, 0x24, 0x29, 0x12, 0x17, 0x24, 0x29, 0x12, 0x17, 0x1E, 0x29, 0x12, 0x29, 0x29, 0x29, 0x12, 0x12, 0x29, 0x29, 0x12, 0x12, 0x12, 0x29, 0x12, 0x1F, 0x26, 0x2C, 0x12, 0x18, 0x26, 0x2C, 0x12, 0x18, 0x1F, 0x2C, 0x12, 0x2C, 0x2C, 0x2C, 0x12, 0x12, 0x2C, 0x2C, 0x12, 0x12, 0x12, 0x2C, 0x12, 0x20, 0x28, 0x2F, 0x12, 0x19, 0x28, 0x2F, 0x12, 0x19, 0x21, 0x2F, 0x12, 0x2F, 0x2F, 0x2F, 0x12, 0x12, 0x2F, 0x2F, 0x12, 0x12, 0x12, 0x2F, 0x12, 0x22, 0x2A, 0x32, 0x12, 0x1A, 0x2A, 0x32, 0x12, 0x1A, 0x22, 0x32, 0x12, 0x32, 0x32, 0x32, 0x12, 0x12, 0x32, 0x32, 0x12, 0x12, 0x12, 0x32, 0x12, 0x35, 0x35, 0x35, 0x12, 0x12, 0x35, 0x35, 0x12, 0x12, 0x12, 0x35, 0x12, 0x24, 0x2D, 0x36, 0x12, 0x1B, 0x2D, 0x36, 0x12, 0x1B, 0x24, 0x36, 0x12, 0x3A, 0x3A, 0x3A, 0x12, 0x12, 0x3A, 0x3A, 0x12, 0x12, 0x12, 0x3A, 0x13, 0x14, 0x14, 0x15, 0x13, 0x14, 0x15, 0x16, 0x13, 0x15, 0x16, 0x17, 0x13, 0x14, 0x16, 0x17, 0x13, 0x14, 0x15, 0x17, 0x13, 0x15, 0x16, 0x18, 0x13, 0x15, 0x17, 0x18, 0x13, 0x14, 0x17, 0x18, 0x13, 0x14, 0x16, 0x18, 0x13, 0x15, 0x17, 0x19, 0x13, 0x16, 0x18, 0x19, 0x13, 0x14, 0x18, 0x19, 0x13, 0x14, 0x16, 0x19, 0x13, 0x19, 0x19, 0x19, 0x13, 0x13, 0x19, 0x19, 0x13, 0x13, 0x13, 0x19, 0x13, 0x16, 0x17, 0x1A, 0x13, 0x16, 0x19, 0x1A, 0x13, 0x14, 0x19, 0x1A, 0x13, 0x14, 0x17, 0x1A, 0x13, 0x16, 0x18, 0x1B, 0x13, 0x17, 0x19, 0x1B, 0x13, 0x15, 0x19, 0x1B, 0x13, 0x15, 0x17, 0x1B, 0x13, 0x1B, 0x1B, 0x1B, 0x13, 0x13, 0x1B, 0x1B, 0x13, 0x13, 0x13, 0x1B, 0x13, 0x17, 0x1A, 0x1E, 0x13, 0x18, 0x1C, 0x1E, 0x13, 0x15, 0x1C, 0x1E, 0x13, 0x15, 0x19, 0x1E, 0x13, 0x1E, 0x1E, 0x1E, 0x13, 0x13, 0x1E, 0x1E, 0x13, 0x13, 0x13, 0x1E, 0x13, 0x18, 0x1C, 0x21, 0x13, 0x1A, 0x1E, 0x21, 0x13, 0x16, 0x1E, 0x21, 0x13, 0x16, 0x1A, 0x21, 0x13, 0x21, 0x21, 0x21, 0x13, 0x13, 0x21, 0x21, 0x13, 0x13, 0x13, 0x21, 0x13, 0x19, 0x1E, 0x24, 0x13, 0x1B, 0x20, 0x24, 0x13, 0x17, 0x20, 0x24, 0x13, 0x17, 0x1C, 0x24, 0x13, 0x24, 0x24, 0x24, 0x13, 0x13, 0x24, 0x24, 0x13, 0x13, 0x13, 0x24, 0x13, 0x1A, 0x20, 0x27, 0x13, 0x1D, 0x22, 0x27, 0x13, 0x18, 0x22, 0x27, 0x13, 0x18, 0x1D, 0x27, 0x13, 0x27, 0x27, 0x27, 0x13, 0x13, 0x27, 0x27, 0x13, 0x13, 0x13, 0x27, 0x13, 0x1E, 0x25, 0x2A, 0x13, 0x18, 0x25, 0x2A, 0x13, 0x18, 0x1F, 0x2A, 0x13, 0x2A, 0x2A, 0x2A, 0x13, 0x13, 0x2A, 0x2A, 0x13, 0x13, 0x13, 0x2A, 0x13, 0x20, 0x27, 0x2D, 0x13, 0x19, 0x27, 0x2D, 0x13, 0x19, 0x20, 0x2D, 0x13, 0x2D, 0x2D, 0x2D, 0x13, 0x13, 0x2D, 0x2D, 0x13, 0x13, 0x13, 0x2D, 0x13, 0x21, 0x29, 0x30, 0x13, 0x1A, 0x29, 0x30, 0x13, 0x1A, 0x22, 0x30, 0x13, 0x30, 0x30, 0x30, 0x13, 0x13, 0x30, 0x30, 0x13, 0x13, 0x13, 0x30, 0x13, 0x23, 0x2B, 0x33, 0x13, 0x1B, 0x2B, 0x33, 0x13, 0x1B, 0x23, 0x33, 0x13, 0x33, 0x33, 0x33, 0x13, 0x13, 0x33, 0x33, 0x13, 0x13, 0x13, 0x33, 0x13, 0x36, 0x36, 0x36, 0x13, 0x13, 0x36, 0x36, 0x13, 0x13, 0x13, 0x36, 0x13, 0x25, 0x2E, 0x37, 0x13, 0x1C, 0x2E, 0x37, 0x13, 0x1C, 0x25, 0x37, 0x13, 0x3B, 0x3B, 0x3B, 0x13, 0x13, 0x3B, 0x3B, 0x13, 0x13, 0x13, 0x3B, 0x14, 0x15, 0x15, 0x16, 0x14, 0x15, 0x16, 0x17, 0x14, 0x16, 0x17, 0x18, 0x14, 0x15, 0x17, 0x18, 0x14, 0x15, 0x16, 0x18, 0x14, 0x16, 0x17, 0x19, 0x14, 0x16, 0x18, 0x19, 0x14, 0x15, 0x18, 0x19, 0x14, 0x15, 0x17, 0x19, 0x14, 0x16, 0x18, 0x1A, 0x14, 0x17, 0x19, 0x1A, 0x14, 0x15, 0x19, 0x1A, 0x14, 0x15, 0x17, 0x1A, 0x14, 0x1A, 0x1A, 0x1A, 0x14, 0x14, 0x1A, 0x1A, 0x14, 0x14, 0x14, 0x1A, 0x14, 0x17, 0x18, 0x1B, 0x14, 0x17, 0x1A, 0x1B, 0x14, 0x15, 0x1A, 0x1B, 0x14, 0x15, 0x18, 0x1B, 0x14, 0x17, 0x19, 0x1C, 0x14, 0x18, 0x1A, 0x1C, 0x14, 0x16, 0x1A, 0x1C, 0x14, 0x16, 0x18, 0x1C, 0x14, 0x1C, 0x1C, 0x1C, 0x14, 0x14, 0x1C, 0x1C, 0x14, 0x14, 0x14, 0x1C, 0x14, 0x18, 0x1B, 0x1F, 0x14, 0x19, 0x1D, 0x1F, 0x14, 0x16, 0x1D, 0x1F, 0x14, 0x16, 0x1A, 0x1F, 0x14, 0x1F, 0x1F, 0x1F, 0x14, 0x14, 0x1F, 0x1F, 0x14, 0x14, 0x14, 0x1F, 0x14, 0x19, 0x1D, 0x22, 0x14, 0x1B, 0x1F, 0x22, 0x14, 0x17, 0x1F, 0x22, 0x14, 0x17, 0x1B, 0x22, 0x14, 0x22, 0x22, 0x22, 0x14, 0x14, 0x22, 0x22, 0x14, 0x14, 0x14, 0x22, 0x14, 0x1A, 0x1F, 0x25, 0x14, 0x1C, 0x21, 0x25, 0x14, 0x18, 0x21, 0x25, 0x14, 0x18, 0x1D, 0x25, 0x14, 0x25, 0x25, 0x25, 0x14, 0x14, 0x25, 0x25, 0x14, 0x14, 0x14, 0x25, 0x14, 0x1B, 0x21, 0x28, 0x14, 0x1E, 0x23, 0x28, 0x14, 0x19, 0x23, 0x28, 0x14, 0x19, 0x1E, 0x28, 0x14, 0x28, 0x28, 0x28, 0x14, 0x14, 0x28, 0x28, 0x14, 0x14, 0x14, 0x28, 0x14, 0x1F, 0x26, 0x2B, 0x14, 0x19, 0x26, 0x2B, 0x14, 0x19, 0x20, 0x2B, 0x14, 0x2B, 0x2B, 0x2B, 0x14, 0x14, 0x2B, 0x2B, 0x14, 0x14, 0x14, 0x2B, 0x14, 0x21, 0x28, 0x2E, 0x14, 0x1A, 0x28, 0x2E, 0x14, 0x1A, 0x21, 0x2E, 0x14, 0x2E, 0x2E, 0x2E, 0x14, 0x14, 0x2E, 0x2E, 0x14, 0x14, 0x14, 0x2E, 0x14, 0x22, 0x2A, 0x31, 0x14, 0x1B, 0x2A, 0x31, 0x14, 0x1B, 0x23, 0x31, 0x14, 0x31, 0x31, 0x31, 0x14, 0x14, 0x31, 0x31, 0x14, 0x14, 0x14, 0x31, 0x14, 0x24, 0x2C, 0x34, 0x14, 0x1C, 0x2C, 0x34, 0x14, 0x1C, 0x24, 0x34, 0x14, 0x34, 0x34, 0x34, 0x14, 0x14, 0x34, 0x34, 0x14, 0x14, 0x14, 0x34, 0x14, 0x37, 0x37, 0x37, 0x14, 0x14, 0x37, 0x37, 0x14, 0x14, 0x14, 0x37, 0x14, 0x26, 0x2F, 0x38, 0x14, 0x1D, 0x2F, 0x38, 0x14, 0x1D, 0x26, 0x38, 0x14, 0x3C, 0x3C, 0x3C, 0x14, 0x14, 0x3C, 0x3C, 0x14, 0x14, 0x14, 0x3C, 0x15, 0x16, 0x16, 0x17, 0x15, 0x16, 0x17, 0x18, 0x15, 0x17, 0x18, 0x19, 0x15, 0x16, 0x18, 0x19, 0x15, 0x16, 0x17, 0x19, 0x15, 0x17, 0x18, 0x1A, 0x15, 0x17, 0x19, 0x1A, 0x15, 0x16, 0x19, 0x1A, 0x15, 0x16, 0x18, 0x1A, 0x15, 0x17, 0x19, 0x1B, 0x15, 0x18, 0x1A, 0x1B, 0x15, 0x16, 0x1A, 0x1B, 0x15, 0x16, 0x18, 0x1B, 0x15, 0x1B, 0x1B, 0x1B, 0x15, 0x15, 0x1B, 0x1B, 0x15, 0x15, 0x15, 0x1B, 0x15, 0x18, 0x19, 0x1C, 0x15, 0x18, 0x1B, 0x1C, 0x15, 0x16, 0x1B, 0x1C, 0x15, 0x16, 0x19, 0x1C, 0x15, 0x18, 0x1A, 0x1D, 0x15, 0x19, 0x1B, 0x1D, 0x15, 0x17, 0x1B, 0x1D, 0x15, 0x17, 0x19, 0x1D, 0x15, 0x1D, 0x1D, 0x1D, 0x15, 0x15, 0x1D, 0x1D, 0x15, 0x15, 0x15, 0x1D, 0x15, 0x19, 0x1C, 0x20, 0x15, 0x1A, 0x1E, 0x20, 0x15, 0x17, 0x1E, 0x20, 0x15, 0x17, 0x1B, 0x20, 0x15, 0x20, 0x20, 0x20, 0x15, 0x15, 0x20, 0x20, 0x15, 0x15, 0x15, 0x20, 0x15, 0x1A, 0x1E, 0x23, 0x15, 0x1C, 0x20, 0x23, 0x15, 0x18, 0x20, 0x23, 0x15, 0x18, 0x1C, 0x23, 0x15, 0x23, 0x23, 0x23, 0x15, 0x15, 0x23, 0x23, 0x15, 0x15, 0x15, 0x23, 0x15, 0x1B, 0x20, 0x26, 0x15, 0x1D, 0x22, 0x26, 0x15, 0x19, 0x22, 0x26, 0x15, 0x19, 0x1E, 0x26, 0x15, 0x26, 0x26, 0x26, 0x15, 0x15, 0x26, 0x26, 0x15, 0x15, 0x15, 0x26, 0x15, 0x1C, 0x22, 0x29, 0x15, 0x1F, 0x24, 0x29, 0x15, 0x1A, 0x24, 0x29, 0x15, 0x1A, 0x1F, 0x29, 0x15, 0x29, 0x29, 0x29, 0x15, 0x15, 0x29, 0x29, 0x15, 0x15, 0x15, 0x29, 0x15, 0x20, 0x27, 0x2C, 0x15, 0x1A, 0x27, 0x2C, 0x15, 0x1A, 0x21, 0x2C, 0x15, 0x2C, 0x2C, 0x2C, 0x15, 0x15, 0x2C, 0x2C, 0x15, 0x15, 0x15, 0x2C, 0x15, 0x22, 0x29, 0x2F, 0x15, 0x1B, 0x29, 0x2F, 0x15, 0x1B, 0x22, 0x2F, 0x15, 0x2F, 0x2F, 0x2F, 0x15, 0x15, 0x2F, 0x2F, 0x15, 0x15, 0x15, 0x2F, 0x15, 0x23, 0x2B, 0x32, 0x15, 0x1C, 0x2B, 0x32, 0x15, 0x1C, 0x24, 0x32, 0x15, 0x32, 0x32, 0x32, 0x15, 0x15, 0x32, 0x32, 0x15, 0x15, 0x15, 0x32, 0x15, 0x25, 0x2D, 0x35, 0x15, 0x1D, 0x2D, 0x35, 0x15, 0x1D, 0x25, 0x35, 0x15, 0x35, 0x35, 0x35, 0x15, 0x15, 0x35, 0x35, 0x15, 0x15, 0x15, 0x35, 0x15, 0x38, 0x38, 0x38, 0x15, 0x15, 0x38, 0x38, 0x15, 0x15, 0x15, 0x38, 0x15, 0x27, 0x30, 0x39, 0x15, 0x1E, 0x30, 0x39, 0x15, 0x1E, 0x27, 0x39, 0x15, 0x3D, 0x3D, 0x3D, 0x15, 0x15, 0x3D, 0x3D, 0x15, 0x15, 0x15, 0x3D, 0x16, 0x17, 0x17, 0x18, 0x16, 0x17, 0x18, 0x19, 0x16, 0x18, 0x19, 0x1A, 0x16, 0x17, 0x19, 0x1A, 0x16, 0x17, 0x18, 0x1A, 0x16, 0x18, 0x19, 0x1B, 0x16, 0x18, 0x1A, 0x1B, 0x16, 0x17, 0x1A, 0x1B, 0x16, 0x17, 0x19, 0x1B, 0x16, 0x18, 0x1A, 0x1C, 0x16, 0x19, 0x1B, 0x1C, 0x16, 0x17, 0x1B, 0x1C, 0x16, 0x17, 0x19, 0x1C, 0x16, 0x1C, 0x1C, 0x1C, 0x16, 0x16, 0x1C, 0x1C, 0x16, 0x16, 0x16, 0x1C, 0x16, 0x19, 0x1A, 0x1D, 0x16, 0x19, 0x1C, 0x1D, 0x16, 0x17, 0x1C, 0x1D, 0x16, 0x17, 0x1A, 0x1D, 0x16, 0x19, 0x1B, 0x1E, 0x16, 0x1A, 0x1C, 0x1E, 0x16, 0x18, 0x1C, 0x1E, 0x16, 0x18, 0x1A, 0x1E, 0x16, 0x1E, 0x1E, 0x1E, 0x16, 0x16, 0x1E, 0x1E, 0x16, 0x16, 0x16, 0x1E, 0x16, 0x1A, 0x1D, 0x21, 0x16, 0x1B, 0x1F, 0x21, 0x16, 0x18, 0x1F, 0x21, 0x16, 0x18, 0x1C, 0x21, 0x16, 0x21, 0x21, 0x21, 0x16, 0x16, 0x21, 0x21, 0x16, 0x16, 0x16, 0x21, 0x16, 0x1B, 0x1F, 0x24, 0x16, 0x1D, 0x21, 0x24, 0x16, 0x19, 0x21, 0x24, 0x16, 0x19, 0x1D, 0x24, 0x16, 0x24, 0x24, 0x24, 0x16, 0x16, 0x24, 0x24, 0x16, 0x16, 0x16, 0x24, 0x16, 0x1C, 0x21, 0x27, 0x16, 0x1E, 0x23, 0x27, 0x16, 0x1A, 0x23, 0x27, 0x16, 0x1A, 0x1F, 0x27, 0x16, 0x27, 0x27, 0x27, 0x16, 0x16, 0x27, 0x27, 0x16, 0x16, 0x16, 0x27, 0x16, 0x1D, 0x23, 0x2A, 0x16, 0x20, 0x25, 0x2A, 0x16, 0x1B, 0x25, 0x2A, 0x16, 0x1B, 0x20, 0x2A, 0x16, 0x2A, 0x2A, 0x2A, 0x16, 0x16, 0x2A, 0x2A, 0x16, 0x16, 0x16, 0x2A, 0x16, 0x21, 0x28, 0x2D, 0x16, 0x1B, 0x28, 0x2D, 0x16, 0x1B, 0x22, 0x2D, 0x16, 0x2D, 0x2D, 0x2D, 0x16, 0x16, 0x2D, 0x2D, 0x16, 0x16, 0x16, 0x2D, 0x16, 0x23, 0x2A, 0x30, 0x16, 0x1C, 0x2A, 0x30, 0x16, 0x1C, 0x23, 0x30, 0x16, 0x30, 0x30, 0x30, 0x16, 0x16, 0x30, 0x30, 0x16, 0x16, 0x16, 0x30, 0x16, 0x24, 0x2C, 0x33, 0x16, 0x1D, 0x2C, 0x33, 0x16, 0x1D, 0x25, 0x33, 0x16, 0x33, 0x33, 0x33, 0x16, 0x16, 0x33, 0x33, 0x16, 0x16, 0x16, 0x33, 0x16, 0x26, 0x2E, 0x36, 0x16, 0x1E, 0x2E, 0x36, 0x16, 0x1E, 0x26, 0x36, 0x16, 0x36, 0x36, 0x36, 0x16, 0x16, 0x36, 0x36, 0x16, 0x16, 0x16, 0x36, 0x16, 0x39, 0x39, 0x39, 0x16, 0x16, 0x39, 0x39, 0x16, 0x16, 0x16, 0x39, 0x16, 0x28, 0x31, 0x3A, 0x16, 0x1F, 0x31, 0x3A, 0x16, 0x1F, 0x28, 0x3A, 0x16, 0x3E, 0x3E, 0x3E, 0x16, 0x16, 0x3E, 0x3E, 0x16, 0x16, 0x16, 0x3E, 0x17, 0x18, 0x18, 0x19, 0x17, 0x18, 0x19, 0x1A, 0x17, 0x19, 0x1A, 0x1B, 0x17, 0x18, 0x1A, 0x1B, 0x17, 0x18, 0x19, 0x1B, 0x17, 0x19, 0x1A, 0x1C, 0x17, 0x19, 0x1B, 0x1C, 0x17, 0x18, 0x1B, 0x1C, 0x17, 0x18, 0x1A, 0x1C, 0x17, 0x19, 0x1B, 0x1D, 0x17, 0x1A, 0x1C, 0x1D, 0x17, 0x18, 0x1C, 0x1D, 0x17, 0x18, 0x1A, 0x1D, 0x17, 0x1D, 0x1D, 0x1D, 0x17, 0x17, 0x1D, 0x1D, 0x17, 0x17, 0x17, 0x1D, 0x17, 0x1A, 0x1B, 0x1E, 0x17, 0x1A, 0x1D, 0x1E, 0x17, 0x18, 0x1D, 0x1E, 0x17, 0x18, 0x1B, 0x1E, 0x17, 0x1A, 0x1C, 0x1F, 0x17, 0x1B, 0x1D, 0x1F, 0x17, 0x19, 0x1D, 0x1F, 0x17, 0x19, 0x1B, 0x1F, 0x17, 0x1F, 0x1F, 0x1F, 0x17, 0x17, 0x1F, 0x1F, 0x17, 0x17, 0x17, 0x1F, 0x17, 0x1B, 0x1E, 0x22, 0x17, 0x1C, 0x20, 0x22, 0x17, 0x19, 0x20, 0x22, 0x17, 0x19, 0x1D, 0x22, 0x17, 0x22, 0x22, 0x22, 0x17, 0x17, 0x22, 0x22, 0x17, 0x17, 0x17, 0x22, 0x17, 0x1C, 0x20, 0x25, 0x17, 0x1E, 0x22, 0x25, 0x17, 0x1A, 0x22, 0x25, 0x17, 0x1A, 0x1E, 0x25, 0x17, 0x25, 0x25, 0x25, 0x17, 0x17, 0x25, 0x25, 0x17, 0x17, 0x17, 0x25, 0x17, 0x1D, 0x22, 0x28, 0x17, 0x1F, 0x24, 0x28, 0x17, 0x1B, 0x24, 0x28, 0x17, 0x1B, 0x20, 0x28, 0x17, 0x28, 0x28, 0x28, 0x17, 0x17, 0x28, 0x28, 0x17, 0x17, 0x17, 0x28, 0x17, 0x1E, 0x24, 0x2B, 0x17, 0x21, 0x26, 0x2B, 0x17, 0x1C, 0x26, 0x2B, 0x17, 0x1C, 0x21, 0x2B, 0x17, 0x2B, 0x2B, 0x2B, 0x17, 0x17, 0x2B, 0x2B, 0x17, 0x17, 0x17, 0x2B, 0x17, 0x22, 0x29, 0x2E, 0x17, 0x1C, 0x29, 0x2E, 0x17, 0x1C, 0x23, 0x2E, 0x17, 0x2E, 0x2E, 0x2E, 0x17, 0x17, 0x2E, 0x2E, 0x17, 0x17, 0x17, 0x2E, 0x17, 0x24, 0x2B, 0x31, 0x17, 0x1D, 0x2B, 0x31, 0x17, 0x1D, 0x24, 0x31, 0x17, 0x31, 0x31, 0x31, 0x17, 0x17, 0x31, 0x31, 0x17, 0x17, 0x17, 0x31, 0x17, 0x25, 0x2D, 0x34, 0x17, 0x1E, 0x2D, 0x34, 0x17, 0x1E, 0x26, 0x34, 0x17, 0x34, 0x34, 0x34, 0x17, 0x17, 0x34, 0x34, 0x17, 0x17, 0x17, 0x34, 0x17, 0x27, 0x2F, 0x37, 0x17, 0x1F, 0x2F, 0x37, 0x17, 0x1F, 0x27, 0x37, 0x17, 0x37, 0x37, 0x37, 0x17, 0x17, 0x37, 0x37, 0x17, 0x17, 0x17, 0x37, 0x17, 0x3A, 0x3A, 0x3A, 0x17, 0x17, 0x3A, 0x3A, 0x17, 0x17, 0x17, 0x3A, 0x17, 0x29, 0x32, 0x3B, 0x17, 0x20, 0x32, 0x3B, 0x17, 0x20, 0x29, 0x3B, 0x17, 0x3F, 0x3F, 0x3F, 0x17, 0x17, 0x3F, 0x3F, 0x17, 0x17, 0x17, 0x3F, 0x18, 0x19, 0x19, 0x1A, 0x18, 0x19, 0x1A, 0x1B, 0x18, 0x1A, 0x1B, 0x1C, 0x18, 0x19, 0x1B, 0x1C, 0x18, 0x19, 0x1A, 0x1C, 0x18, 0x1A, 0x1B, 0x1D, 0x18, 0x1A, 0x1C, 0x1D, 0x18, 0x19, 0x1C, 0x1D, 0x18, 0x19, 0x1B, 0x1D, 0x18, 0x1A, 0x1C, 0x1E, 0x18, 0x1B, 0x1D, 0x1E, 0x18, 0x19, 0x1D, 0x1E, 0x18, 0x19, 0x1B, 0x1E, 0x18, 0x1E, 0x1E, 0x1E, 0x18, 0x18, 0x1E, 0x1E, 0x18, 0x18, 0x18, 0x1E, 0x18, 0x1B, 0x1C, 0x1F, 0x18, 0x1B, 0x1E, 0x1F, 0x18, 0x19, 0x1E, 0x1F, 0x18, 0x19, 0x1C, 0x1F, 0x18, 0x1B, 0x1D, 0x20, 0x18, 0x1C, 0x1E, 0x20, 0x18, 0x1A, 0x1E, 0x20, 0x18, 0x1A, 0x1C, 0x20, 0x18, 0x20, 0x20, 0x20, 0x18, 0x18, 0x20, 0x20, 0x18, 0x18, 0x18, 0x20, 0x18, 0x1C, 0x1F, 0x23, 0x18, 0x1D, 0x21, 0x23, 0x18, 0x1A, 0x21, 0x23, 0x18, 0x1A, 0x1E, 0x23, 0x18, 0x23, 0x23, 0x23, 0x18, 0x18, 0x23, 0x23, 0x18, 0x18, 0x18, 0x23, 0x18, 0x1D, 0x21, 0x26, 0x18, 0x1F, 0x23, 0x26, 0x18, 0x1B, 0x23, 0x26, 0x18, 0x1B, 0x1F, 0x26, 0x18, 0x26, 0x26, 0x26, 0x18, 0x18, 0x26, 0x26, 0x18, 0x18, 0x18, 0x26, 0x18, 0x1E, 0x23, 0x29, 0x18, 0x20, 0x25, 0x29, 0x18, 0x1C, 0x25, 0x29, 0x18, 0x1C, 0x21, 0x29, 0x18, 0x29, 0x29, 0x29, 0x18, 0x18, 0x29, 0x29, 0x18, 0x18, 0x18, 0x29, 0x18, 0x1F, 0x25, 0x2C, 0x18, 0x22, 0x27, 0x2C, 0x18, 0x1D, 0x27, 0x2C, 0x18, 0x1D, 0x22, 0x2C, 0x18, 0x2C, 0x2C, 0x2C, 0x18, 0x18, 0x2C, 0x2C, 0x18, 0x18, 0x18, 0x2C, 0x18, 0x23, 0x2A, 0x2F, 0x18, 0x1D, 0x2A, 0x2F, 0x18, 0x1D, 0x24, 0x2F, 0x18, 0x2F, 0x2F, 0x2F, 0x18, 0x18, 0x2F, 0x2F, 0x18, 0x18, 0x18, 0x2F, 0x18, 0x25, 0x2C, 0x32, 0x18, 0x1E, 0x2C, 0x32, 0x18, 0x1E, 0x25, 0x32, 0x18, 0x32, 0x32, 0x32, 0x18, 0x18, 0x32, 0x32, 0x18, 0x18, 0x18, 0x32, 0x18, 0x26, 0x2E, 0x35, 0x18, 0x1F, 0x2E, 0x35, 0x18, 0x1F, 0x27, 0x35, 0x18, 0x35, 0x35, 0x35, 0x18, 0x18, 0x35, 0x35, 0x18, 0x18, 0x18, 0x35, 0x18, 0x28, 0x30, 0x38, 0x18, 0x20, 0x30, 0x38, 0x18, 0x20, 0x28, 0x38, 0x18, 0x38, 0x38, 0x38, 0x18, 0x18, 0x38, 0x38, 0x18, 0x18, 0x18, 0x38, 0x18, 0x3B, 0x3B, 0x3B, 0x18, 0x18, 0x3B, 0x3B, 0x18, 0x18, 0x18, 0x3B, 0x18, 0x2A, 0x33, 0x3C, 0x18, 0x21, 0x33, 0x3C, 0x18, 0x21, 0x2A, 0x3C, 0x19, 0x1A, 0x1A, 0x1B, 0x19, 0x1A, 0x1B, 0x1C, 0x19, 0x1B, 0x1C, 0x1D, 0x19, 0x1A, 0x1C, 0x1D, 0x19, 0x1A, 0x1B, 0x1D, 0x19, 0x1B, 0x1C, 0x1E, 0x19, 0x1B, 0x1D, 0x1E, 0x19, 0x1A, 0x1D, 0x1E, 0x19, 0x1A, 0x1C, 0x1E, 0x19, 0x1B, 0x1D, 0x1F, 0x19, 0x1C, 0x1E, 0x1F, 0x19, 0x1A, 0x1E, 0x1F, 0x19, 0x1A, 0x1C, 0x1F, 0x19, 0x1F, 0x1F, 0x1F, 0x19, 0x19, 0x1F, 0x1F, 0x19, 0x19, 0x19, 0x1F, 0x19, 0x1C, 0x1D, 0x20, 0x19, 0x1C, 0x1F, 0x20, 0x19, 0x1A, 0x1F, 0x20, 0x19, 0x1A, 0x1D, 0x20, 0x19, 0x1C, 0x1E, 0x21, 0x19, 0x1D, 0x1F, 0x21, 0x19, 0x1B, 0x1F, 0x21, 0x19, 0x1B, 0x1D, 0x21, 0x19, 0x21, 0x21, 0x21, 0x19, 0x19, 0x21, 0x21, 0x19, 0x19, 0x19, 0x21, 0x19, 0x1D, 0x20, 0x24, 0x19, 0x1E, 0x22, 0x24, 0x19, 0x1B, 0x22, 0x24, 0x19, 0x1B, 0x1F, 0x24, 0x19, 0x24, 0x24, 0x24, 0x19, 0x19, 0x24, 0x24, 0x19, 0x19, 0x19, 0x24, 0x19, 0x1E, 0x22, 0x27, 0x19, 0x20, 0x24, 0x27, 0x19, 0x1C, 0x24, 0x27, 0x19, 0x1C, 0x20, 0x27, 0x19, 0x27, 0x27, 0x27, 0x19, 0x19, 0x27, 0x27, 0x19, 0x19, 0x19, 0x27, 0x19, 0x1F, 0x24, 0x2A, 0x19, 0x21, 0x26, 0x2A, 0x19, 0x1D, 0x26, 0x2A, 0x19, 0x1D, 0x22, 0x2A, 0x19, 0x2A, 0x2A, 0x2A, 0x19, 0x19, 0x2A, 0x2A, 0x19, 0x19, 0x19, 0x2A, 0x19, 0x20, 0x26, 0x2D, 0x19, 0x23, 0x28, 0x2D, 0x19, 0x1E, 0x28, 0x2D, 0x19, 0x1E, 0x23, 0x2D, 0x19, 0x2D, 0x2D, 0x2D, 0x19, 0x19, 0x2D, 0x2D, 0x19, 0x19, 0x19, 0x2D, 0x19, 0x24, 0x2B, 0x30, 0x19, 0x1E, 0x2B, 0x30, 0x19, 0x1E, 0x25, 0x30, 0x19, 0x30, 0x30, 0x30, 0x19, 0x19, 0x30, 0x30, 0x19, 0x19, 0x19, 0x30, 0x19, 0x26, 0x2D, 0x33, 0x19, 0x1F, 0x2D, 0x33, 0x19, 0x1F, 0x26, 0x33, 0x19, 0x33, 0x33, 0x33, 0x19, 0x19, 0x33, 0x33, 0x19, 0x19, 0x19, 0x33, 0x19, 0x27, 0x2F, 0x36, 0x19, 0x20, 0x2F, 0x36, 0x19, 0x20, 0x28, 0x36, 0x19, 0x36, 0x36, 0x36, 0x19, 0x19, 0x36, 0x36, 0x19, 0x19, 0x19, 0x36, 0x19, 0x29, 0x31, 0x39, 0x19, 0x21, 0x31, 0x39, 0x19, 0x21, 0x29, 0x39, 0x19, 0x39, 0x39, 0x39, 0x19, 0x19, 0x39, 0x39, 0x19, 0x19, 0x19, 0x39, 0x19, 0x3C, 0x3C, 0x3C, 0x19, 0x19, 0x3C, 0x3C, 0x19, 0x19, 0x19, 0x3C, 0x19, 0x2B, 0x34, 0x3D, 0x19, 0x22, 0x34, 0x3D, 0x19, 0x22, 0x2B, 0x3D, 0x1A, 0x1B, 0x1B, 0x1C, 0x1A, 0x1B, 0x1C, 0x1D, 0x1A, 0x1C, 0x1D, 0x1E, 0x1A, 0x1B, 0x1D, 0x1E, 0x1A, 0x1B, 0x1C, 0x1E, 0x1A, 0x1C, 0x1D, 0x1F, 0x1A, 0x1C, 0x1E, 0x1F, 0x1A, 0x1B, 0x1E, 0x1F, 0x1A, 0x1B, 0x1D, 0x1F, 0x1A, 0x1C, 0x1E, 0x20, 0x1A, 0x1D, 0x1F, 0x20, 0x1A, 0x1B, 0x1F, 0x20, 0x1A, 0x1B, 0x1D, 0x20, 0x1A, 0x20, 0x20, 0x20, 0x1A, 0x1A, 0x20, 0x20, 0x1A, 0x1A, 0x1A, 0x20, 0x1A, 0x1D, 0x1E, 0x21, 0x1A, 0x1D, 0x20, 0x21, 0x1A, 0x1B, 0x20, 0x21, 0x1A, 0x1B, 0x1E, 0x21, 0x1A, 0x1D, 0x1F, 0x22, 0x1A, 0x1E, 0x20, 0x22, 0x1A, 0x1C, 0x20, 0x22, 0x1A, 0x1C, 0x1E, 0x22, 0x1A, 0x22, 0x22, 0x22, 0x1A, 0x1A, 0x22, 0x22, 0x1A, 0x1A, 0x1A, 0x22, 0x1A, 0x1E, 0x21, 0x25, 0x1A, 0x1F, 0x23, 0x25, 0x1A, 0x1C, 0x23, 0x25, 0x1A, 0x1C, 0x20, 0x25, 0x1A, 0x25, 0x25, 0x25, 0x1A, 0x1A, 0x25, 0x25, 0x1A, 0x1A, 0x1A, 0x25, 0x1A, 0x1F, 0x23, 0x28, 0x1A, 0x21, 0x25, 0x28, 0x1A, 0x1D, 0x25, 0x28, 0x1A, 0x1D, 0x21, 0x28, 0x1A, 0x28, 0x28, 0x28, 0x1A, 0x1A, 0x28, 0x28, 0x1A, 0x1A, 0x1A, 0x28, 0x1A, 0x20, 0x25, 0x2B, 0x1A, 0x22, 0x27, 0x2B, 0x1A, 0x1E, 0x27, 0x2B, 0x1A, 0x1E, 0x23, 0x2B, 0x1A, 0x2B, 0x2B, 0x2B, 0x1A, 0x1A, 0x2B, 0x2B, 0x1A, 0x1A, 0x1A, 0x2B, 0x1A, 0x21, 0x27, 0x2E, 0x1A, 0x24, 0x29, 0x2E, 0x1A, 0x1F, 0x29, 0x2E, 0x1A, 0x1F, 0x24, 0x2E, 0x1A, 0x2E, 0x2E, 0x2E, 0x1A, 0x1A, 0x2E, 0x2E, 0x1A, 0x1A, 0x1A, 0x2E, 0x1A, 0x25, 0x2C, 0x31, 0x1A, 0x1F, 0x2C, 0x31, 0x1A, 0x1F, 0x26, 0x31, 0x1A, 0x31, 0x31, 0x31, 0x1A, 0x1A, 0x31, 0x31, 0x1A, 0x1A, 0x1A, 0x31, 0x1A, 0x27, 0x2E, 0x34, 0x1A, 0x20, 0x2E, 0x34, 0x1A, 0x20, 0x27, 0x34, 0x1A, 0x34, 0x34, 0x34, 0x1A, 0x1A, 0x34, 0x34, 0x1A, 0x1A, 0x1A, 0x34, 0x1A, 0x28, 0x30, 0x37, 0x1A, 0x21, 0x30, 0x37, 0x1A, 0x21, 0x29, 0x37, 0x1A, 0x37, 0x37, 0x37, 0x1A, 0x1A, 0x37, 0x37, 0x1A, 0x1A, 0x1A, 0x37, 0x1A, 0x2A, 0x32, 0x3A, 0x1A, 0x22, 0x32, 0x3A, 0x1A, 0x22, 0x2A, 0x3A, 0x1A, 0x3A, 0x3A, 0x3A, 0x1A, 0x1A, 0x3A, 0x3A, 0x1A, 0x1A, 0x1A, 0x3A, 0x1A, 0x3D, 0x3D, 0x3D, 0x1A, 0x1A, 0x3D, 0x3D, 0x1A, 0x1A, 0x1A, 0x3D, 0x1A, 0x2C, 0x35, 0x3E, 0x1A, 0x23, 0x35, 0x3E, 0x1A, 0x23, 0x2C, 0x3E, 0x1B, 0x1C, 0x1C, 0x1D, 0x1B, 0x1C, 0x1D, 0x1E, 0x1B, 0x1D, 0x1E, 0x1F, 0x1B, 0x1C, 0x1E, 0x1F, 0x1B, 0x1C, 0x1D, 0x1F, 0x1B, 0x1D, 0x1E, 0x20, 0x1B, 0x1D, 0x1F, 0x20, 0x1B, 0x1C, 0x1F, 0x20, 0x1B, 0x1C, 0x1E, 0x20, 0x1B, 0x1D, 0x1F, 0x21, 0x1B, 0x1E, 0x20, 0x21, 0x1B, 0x1C, 0x20, 0x21, 0x1B, 0x1C, 0x1E, 0x21, 0x1B, 0x21, 0x21, 0x21, 0x1B, 0x1B, 0x21, 0x21, 0x1B, 0x1B, 0x1B, 0x21, 0x1B, 0x1E, 0x1F, 0x22, 0x1B, 0x1E, 0x21, 0x22, 0x1B, 0x1C, 0x21, 0x22, 0x1B, 0x1C, 0x1F, 0x22, 0x1B, 0x1E, 0x20, 0x23, 0x1B, 0x1F, 0x21, 0x23, 0x1B, 0x1D, 0x21, 0x23, 0x1B, 0x1D, 0x1F, 0x23, 0x1B, 0x23, 0x23, 0x23, 0x1B, 0x1B, 0x23, 0x23, 0x1B, 0x1B, 0x1B, 0x23, 0x1B, 0x1F, 0x22, 0x26, 0x1B, 0x20, 0x24, 0x26, 0x1B, 0x1D, 0x24, 0x26, 0x1B, 0x1D, 0x21, 0x26, 0x1B, 0x26, 0x26, 0x26, 0x1B, 0x1B, 0x26, 0x26, 0x1B, 0x1B, 0x1B, 0x26, 0x1B, 0x20, 0x24, 0x29, 0x1B, 0x22, 0x26, 0x29, 0x1B, 0x1E, 0x26, 0x29, 0x1B, 0x1E, 0x22, 0x29, 0x1B, 0x29, 0x29, 0x29, 0x1B, 0x1B, 0x29, 0x29, 0x1B, 0x1B, 0x1B, 0x29, 0x1B, 0x21, 0x26, 0x2C, 0x1B, 0x23, 0x28, 0x2C, 0x1B, 0x1F, 0x28, 0x2C, 0x1B, 0x1F, 0x24, 0x2C, 0x1B, 0x2C, 0x2C, 0x2C, 0x1B, 0x1B, 0x2C, 0x2C, 0x1B, 0x1B, 0x1B, 0x2C, 0x1B, 0x22, 0x28, 0x2F, 0x1B, 0x25, 0x2A, 0x2F, 0x1B, 0x20, 0x2A, 0x2F, 0x1B, 0x20, 0x25, 0x2F, 0x1B, 0x2F, 0x2F, 0x2F, 0x1B, 0x1B, 0x2F, 0x2F, 0x1B, 0x1B, 0x1B, 0x2F, 0x1B, 0x26, 0x2D, 0x32, 0x1B, 0x20, 0x2D, 0x32, 0x1B, 0x20, 0x27, 0x32, 0x1B, 0x32, 0x32, 0x32, 0x1B, 0x1B, 0x32, 0x32, 0x1B, 0x1B, 0x1B, 0x32, 0x1B, 0x28, 0x2F, 0x35, 0x1B, 0x21, 0x2F, 0x35, 0x1B, 0x21, 0x28, 0x35, 0x1B, 0x35, 0x35, 0x35, 0x1B, 0x1B, 0x35, 0x35, 0x1B, 0x1B, 0x1B, 0x35, 0x1B, 0x29, 0x31, 0x38, 0x1B, 0x22, 0x31, 0x38, 0x1B, 0x22, 0x2A, 0x38, 0x1B, 0x38, 0x38, 0x38, 0x1B, 0x1B, 0x38, 0x38, 0x1B, 0x1B, 0x1B, 0x38, 0x1B, 0x2B, 0x33, 0x3B, 0x1B, 0x23, 0x33, 0x3B, 0x1B, 0x23, 0x2B, 0x3B, 0x1B, 0x3B, 0x3B, 0x3B, 0x1B, 0x1B, 0x3B, 0x3B, 0x1B, 0x1B, 0x1B, 0x3B, 0x1B, 0x3E, 0x3E, 0x3E, 0x1B, 0x1B, 0x3E, 0x3E, 0x1B, 0x1B, 0x1B, 0x3E, 0x1B, 0x2D, 0x36, 0x3F, 0x1B, 0x24, 0x36, 0x3F, 0x1B, 0x24, 0x2D, 0x3F, 0x1C, 0x1D, 0x1D, 0x1E, 0x1C, 0x1D, 0x1E, 0x1F, 0x1C, 0x1E, 0x1F, 0x20, 0x1C, 0x1D, 0x1F, 0x20, 0x1C, 0x1D, 0x1E, 0x20, 0x1C, 0x1E, 0x1F, 0x21, 0x1C, 0x1E, 0x20, 0x21, 0x1C, 0x1D, 0x20, 0x21, 0x1C, 0x1D, 0x1F, 0x21, 0x1C, 0x1E, 0x20, 0x22, 0x1C, 0x1F, 0x21, 0x22, 0x1C, 0x1D, 0x21, 0x22, 0x1C, 0x1D, 0x1F, 0x22, 0x1C, 0x22, 0x22, 0x22, 0x1C, 0x1C, 0x22, 0x22, 0x1C, 0x1C, 0x1C, 0x22, 0x1C, 0x1F, 0x20, 0x23, 0x1C, 0x1F, 0x22, 0x23, 0x1C, 0x1D, 0x22, 0x23, 0x1C, 0x1D, 0x20, 0x23, 0x1C, 0x1F, 0x21, 0x24, 0x1C, 0x20, 0x22, 0x24, 0x1C, 0x1E, 0x22, 0x24, 0x1C, 0x1E, 0x20, 0x24, 0x1C, 0x24, 0x24, 0x24, 0x1C, 0x1C, 0x24, 0x24, 0x1C, 0x1C, 0x1C, 0x24, 0x1C, 0x20, 0x23, 0x27, 0x1C, 0x21, 0x25, 0x27, 0x1C, 0x1E, 0x25, 0x27, 0x1C, 0x1E, 0x22, 0x27, 0x1C, 0x27, 0x27, 0x27, 0x1C, 0x1C, 0x27, 0x27, 0x1C, 0x1C, 0x1C, 0x27, 0x1C, 0x21, 0x25, 0x2A, 0x1C, 0x23, 0x27, 0x2A, 0x1C, 0x1F, 0x27, 0x2A, 0x1C, 0x1F, 0x23, 0x2A, 0x1C, 0x2A, 0x2A, 0x2A, 0x1C, 0x1C, 0x2A, 0x2A, 0x1C, 0x1C, 0x1C, 0x2A, 0x1C, 0x22, 0x27, 0x2D, 0x1C, 0x24, 0x29, 0x2D, 0x1C, 0x20, 0x29, 0x2D, 0x1C, 0x20, 0x25, 0x2D, 0x1C, 0x2D, 0x2D, 0x2D, 0x1C, 0x1C, 0x2D, 0x2D, 0x1C, 0x1C, 0x1C, 0x2D, 0x1C, 0x23, 0x29, 0x30, 0x1C, 0x26, 0x2B, 0x30, 0x1C, 0x21, 0x2B, 0x30, 0x1C, 0x21, 0x26, 0x30, 0x1C, 0x30, 0x30, 0x30, 0x1C, 0x1C, 0x30, 0x30, 0x1C, 0x1C, 0x1C, 0x30, 0x1C, 0x27, 0x2E, 0x33, 0x1C, 0x21, 0x2E, 0x33, 0x1C, 0x21, 0x28, 0x33, 0x1C, 0x33, 0x33, 0x33, 0x1C, 0x1C, 0x33, 0x33, 0x1C, 0x1C, 0x1C, 0x33, 0x1C, 0x29, 0x30, 0x36, 0x1C, 0x22, 0x30, 0x36, 0x1C, 0x22, 0x29, 0x36, 0x1C, 0x36, 0x36, 0x36, 0x1C, 0x1C, 0x36, 0x36, 0x1C, 0x1C, 0x1C, 0x36, 0x1C, 0x2A, 0x32, 0x39, 0x1C, 0x23, 0x32, 0x39, 0x1C, 0x23, 0x2B, 0x39, 0x1C, 0x39, 0x39, 0x39, 0x1C, 0x1C, 0x39, 0x39, 0x1C, 0x1C, 0x1C, 0x39, 0x1C, 0x2C, 0x34, 0x3C, 0x1C, 0x24, 0x34, 0x3C, 0x1C, 0x24, 0x2C, 0x3C, 0x1C, 0x3C, 0x3C, 0x3C, 0x1C, 0x1C, 0x3C, 0x3C, 0x1C, 0x1C, 0x1C, 0x3C, 0x1C, 0x3F, 0x3F, 0x3F, 0x1C, 0x1C, 0x3F, 0x3F, 0x1C, 0x1C, 0x1C, 0x3F, 0x1D, 0x1E, 0x1E, 0x1F, 0x1D, 0x1E, 0x1F, 0x20, 0x1D, 0x1F, 0x20, 0x21, 0x1D, 0x1E, 0x20, 0x21, 0x1D, 0x1E, 0x1F, 0x21, 0x1D, 0x1F, 0x20, 0x22, 0x1D, 0x1F, 0x21, 0x22, 0x1D, 0x1E, 0x21, 0x22, 0x1D, 0x1E, 0x20, 0x22, 0x1D, 0x1F, 0x21, 0x23, 0x1D, 0x20, 0x22, 0x23, 0x1D, 0x1E, 0x22, 0x23, 0x1D, 0x1E, 0x20, 0x23, 0x1D, 0x23, 0x23, 0x23, 0x1D, 0x1D, 0x23, 0x23, 0x1D, 0x1D, 0x1D, 0x23, 0x1D, 0x20, 0x21, 0x24, 0x1D, 0x20, 0x23, 0x24, 0x1D, 0x1E, 0x23, 0x24, 0x1D, 0x1E, 0x21, 0x24, 0x1D, 0x20, 0x22, 0x25, 0x1D, 0x21, 0x23, 0x25, 0x1D, 0x1F, 0x23, 0x25, 0x1D, 0x1F, 0x21, 0x25, 0x1D, 0x25, 0x25, 0x25, 0x1D, 0x1D, 0x25, 0x25, 0x1D, 0x1D, 0x1D, 0x25, 0x1D, 0x21, 0x24, 0x28, 0x1D, 0x22, 0x26, 0x28, 0x1D, 0x1F, 0x26, 0x28, 0x1D, 0x1F, 0x23, 0x28, 0x1D, 0x28, 0x28, 0x28, 0x1D, 0x1D, 0x28, 0x28, 0x1D, 0x1D, 0x1D, 0x28, 0x1D, 0x22, 0x26, 0x2B, 0x1D, 0x24, 0x28, 0x2B, 0x1D, 0x20, 0x28, 0x2B, 0x1D, 0x20, 0x24, 0x2B, 0x1D, 0x2B, 0x2B, 0x2B, 0x1D, 0x1D, 0x2B, 0x2B, 0x1D, 0x1D, 0x1D, 0x2B, 0x1D, 0x23, 0x28, 0x2E, 0x1D, 0x25, 0x2A, 0x2E, 0x1D, 0x21, 0x2A, 0x2E, 0x1D, 0x21, 0x26, 0x2E, 0x1D, 0x2E, 0x2E, 0x2E, 0x1D, 0x1D, 0x2E, 0x2E, 0x1D, 0x1D, 0x1D, 0x2E, 0x1D, 0x24, 0x2A, 0x31, 0x1D, 0x27, 0x2C, 0x31, 0x1D, 0x22, 0x2C, 0x31, 0x1D, 0x22, 0x27, 0x31, 0x1D, 0x31, 0x31, 0x31, 0x1D, 0x1D, 0x31, 0x31, 0x1D, 0x1D, 0x1D, 0x31, 0x1D, 0x28, 0x2F, 0x34, 0x1D, 0x22, 0x2F, 0x34, 0x1D, 0x22, 0x29, 0x34, 0x1D, 0x34, 0x34, 0x34, 0x1D, 0x1D, 0x34, 0x34, 0x1D, 0x1D, 0x1D, 0x34, 0x1D, 0x2A, 0x31, 0x37, 0x1D, 0x23, 0x31, 0x37, 0x1D, 0x23, 0x2A, 0x37, 0x1D, 0x37, 0x37, 0x37, 0x1D, 0x1D, 0x37, 0x37, 0x1D, 0x1D, 0x1D, 0x37, 0x1D, 0x2B, 0x33, 0x3A, 0x1D, 0x24, 0x33, 0x3A, 0x1D, 0x24, 0x2C, 0x3A, 0x1D, 0x3A, 0x3A, 0x3A, 0x1D, 0x1D, 0x3A, 0x3A, 0x1D, 0x1D, 0x1D, 0x3A, 0x1D, 0x2D, 0x35, 0x3D, 0x1D, 0x25, 0x35, 0x3D, 0x1D, 0x25, 0x2D, 0x3D, 0x1D, 0x3D, 0x3D, 0x3D, 0x1D, 0x1D, 0x3D, 0x3D, 0x1D, 0x1D, 0x1D, 0x3D, 0x1E, 0x1F, 0x1F, 0x20, 0x1E, 0x1F, 0x20, 0x21, 0x1E, 0x20, 0x21, 0x22, 0x1E, 0x1F, 0x21, 0x22, 0x1E, 0x1F, 0x20, 0x22, 0x1E, 0x20, 0x21, 0x23, 0x1E, 0x20, 0x22, 0x23, 0x1E, 0x1F, 0x22, 0x23, 0x1E, 0x1F, 0x21, 0x23, 0x1E, 0x20, 0x22, 0x24, 0x1E, 0x21, 0x23, 0x24, 0x1E, 0x1F, 0x23, 0x24, 0x1E, 0x1F, 0x21, 0x24, 0x1E, 0x24, 0x24, 0x24, 0x1E, 0x1E, 0x24, 0x24, 0x1E, 0x1E, 0x1E, 0x24, 0x1E, 0x21, 0x22, 0x25, 0x1E, 0x21, 0x24, 0x25, 0x1E, 0x1F, 0x24, 0x25, 0x1E, 0x1F, 0x22, 0x25, 0x1E, 0x21, 0x23, 0x26, 0x1E, 0x22, 0x24, 0x26, 0x1E, 0x20, 0x24, 0x26, 0x1E, 0x20, 0x22, 0x26, 0x1E, 0x26, 0x26, 0x26, 0x1E, 0x1E, 0x26, 0x26, 0x1E, 0x1E, 0x1E, 0x26, 0x1E, 0x22, 0x25, 0x29, 0x1E, 0x23, 0x27, 0x29, 0x1E, 0x20, 0x27, 0x29, 0x1E, 0x20, 0x24, 0x29, 0x1E, 0x29, 0x29, 0x29, 0x1E, 0x1E, 0x29, 0x29, 0x1E, 0x1E, 0x1E, 0x29, 0x1E, 0x23, 0x27, 0x2C, 0x1E, 0x25, 0x29, 0x2C, 0x1E, 0x21, 0x29, 0x2C, 0x1E, 0x21, 0x25, 0x2C, 0x1E, 0x2C, 0x2C, 0x2C, 0x1E, 0x1E, 0x2C, 0x2C, 0x1E, 0x1E, 0x1E, 0x2C, 0x1E, 0x24, 0x29, 0x2F, 0x1E, 0x26, 0x2B, 0x2F, 0x1E, 0x22, 0x2B, 0x2F, 0x1E, 0x22, 0x27, 0x2F, 0x1E, 0x2F, 0x2F, 0x2F, 0x1E, 0x1E, 0x2F, 0x2F, 0x1E, 0x1E, 0x1E, 0x2F, 0x1E, 0x25, 0x2B, 0x32, 0x1E, 0x28, 0x2D, 0x32, 0x1E, 0x23, 0x2D, 0x32, 0x1E, 0x23, 0x28, 0x32, 0x1E, 0x32, 0x32, 0x32, 0x1E, 0x1E, 0x32, 0x32, 0x1E, 0x1E, 0x1E, 0x32, 0x1E, 0x29, 0x30, 0x35, 0x1E, 0x23, 0x30, 0x35, 0x1E, 0x23, 0x2A, 0x35, 0x1E, 0x35, 0x35, 0x35, 0x1E, 0x1E, 0x35, 0x35, 0x1E, 0x1E, 0x1E, 0x35, 0x1E, 0x2B, 0x32, 0x38, 0x1E, 0x24, 0x32, 0x38, 0x1E, 0x24, 0x2B, 0x38, 0x1E, 0x38, 0x38, 0x38, 0x1E, 0x1E, 0x38, 0x38, 0x1E, 0x1E, 0x1E, 0x38, 0x1E, 0x2C, 0x34, 0x3B, 0x1E, 0x25, 0x34, 0x3B, 0x1E, 0x25, 0x2D, 0x3B, 0x1E, 0x3B, 0x3B, 0x3B, 0x1E, 0x1E, 0x3B, 0x3B, 0x1E, 0x1E, 0x1E, 0x3B, 0x1E, 0x2E, 0x36, 0x3E, 0x1E, 0x26, 0x36, 0x3E, 0x1E, 0x26, 0x2E, 0x3E, 0x1E, 0x3E, 0x3E, 0x3E, 0x1E, 0x1E, 0x3E, 0x3E, 0x1E, 0x1E, 0x1E, 0x3E, 0x1F, 0x20, 0x20, 0x21, 0x1F, 0x20, 0x21, 0x22, 0x1F, 0x21, 0x22, 0x23, 0x1F, 0x20, 0x22, 0x23, 0x1F, 0x20, 0x21, 0x23, 0x1F, 0x21, 0x22, 0x24, 0x1F, 0x21, 0x23, 0x24, 0x1F, 0x20, 0x23, 0x24, 0x1F, 0x20, 0x22, 0x24, 0x1F, 0x21, 0x23, 0x25, 0x1F, 0x22, 0x24, 0x25, 0x1F, 0x20, 0x24, 0x25, 0x1F, 0x20, 0x22, 0x25, 0x1F, 0x25, 0x25, 0x25, 0x1F, 0x1F, 0x25, 0x25, 0x1F, 0x1F, 0x1F, 0x25, 0x1F, 0x22, 0x23, 0x26, 0x1F, 0x22, 0x25, 0x26, 0x1F, 0x20, 0x25, 0x26, 0x1F, 0x20, 0x23, 0x26, 0x1F, 0x22, 0x24, 0x27, 0x1F, 0x23, 0x25, 0x27, 0x1F, 0x21, 0x25, 0x27, 0x1F, 0x21, 0x23, 0x27, 0x1F, 0x27, 0x27, 0x27, 0x1F, 0x1F, 0x27, 0x27, 0x1F, 0x1F, 0x1F, 0x27, 0x1F, 0x23, 0x26, 0x2A, 0x1F, 0x24, 0x28, 0x2A, 0x1F, 0x21, 0x28, 0x2A, 0x1F, 0x21, 0x25, 0x2A, 0x1F, 0x2A, 0x2A, 0x2A, 0x1F, 0x1F, 0x2A, 0x2A, 0x1F, 0x1F, 0x1F, 0x2A, 0x1F, 0x24, 0x28, 0x2D, 0x1F, 0x26, 0x2A, 0x2D, 0x1F, 0x22, 0x2A, 0x2D, 0x1F, 0x22, 0x26, 0x2D, 0x1F, 0x2D, 0x2D, 0x2D, 0x1F, 0x1F, 0x2D, 0x2D, 0x1F, 0x1F, 0x1F, 0x2D, 0x1F, 0x25, 0x2A, 0x30, 0x1F, 0x27, 0x2C, 0x30, 0x1F, 0x23, 0x2C, 0x30, 0x1F, 0x23, 0x28, 0x30, 0x1F, 0x30, 0x30, 0x30, 0x1F, 0x1F, 0x30, 0x30, 0x1F, 0x1F, 0x1F, 0x30, 0x1F, 0x26, 0x2C, 0x33, 0x1F, 0x29, 0x2E, 0x33, 0x1F, 0x24, 0x2E, 0x33, 0x1F, 0x24, 0x29, 0x33, 0x1F, 0x33, 0x33, 0x33, 0x1F, 0x1F, 0x33, 0x33, 0x1F, 0x1F, 0x1F, 0x33, 0x1F, 0x2A, 0x31, 0x36, 0x1F, 0x24, 0x31, 0x36, 0x1F, 0x24, 0x2B, 0x36, 0x1F, 0x36, 0x36, 0x36, 0x1F, 0x1F, 0x36, 0x36, 0x1F, 0x1F, 0x1F, 0x36, 0x1F, 0x2C, 0x33, 0x39, 0x1F, 0x25, 0x33, 0x39, 0x1F, 0x25, 0x2C, 0x39, 0x1F, 0x39, 0x39, 0x39, 0x1F, 0x1F, 0x39, 0x39, 0x1F, 0x1F, 0x1F, 0x39, 0x1F, 0x2D, 0x35, 0x3C, 0x1F, 0x26, 0x35, 0x3C, 0x1F, 0x26, 0x2E, 0x3C, 0x1F, 0x3C, 0x3C, 0x3C, 0x1F, 0x1F, 0x3C, 0x3C, 0x1F, 0x1F, 0x1F, 0x3C, 0x1F, 0x2F, 0x37, 0x3F, 0x1F, 0x27, 0x37, 0x3F, 0x1F, 0x27, 0x2F, 0x3F, 0x1F, 0x3F, 0x3F, 0x3F, 0x1F, 0x1F, 0x3F, 0x3F, 0x1F, 0x1F, 0x1F, 0x3F, 0x20, 0x21, 0x21, 0x22, 0x20, 0x21, 0x22, 0x23, 0x20, 0x22, 0x23, 0x24, 0x20, 0x21, 0x23, 0x24, 0x20, 0x21, 0x22, 0x24, 0x20, 0x22, 0x23, 0x25, 0x20, 0x22, 0x24, 0x25, 0x20, 0x21, 0x24, 0x25, 0x20, 0x21, 0x23, 0x25, 0x20, 0x22, 0x24, 0x26, 0x20, 0x23, 0x25, 0x26, 0x20, 0x21, 0x25, 0x26, 0x20, 0x21, 0x23, 0x26, 0x20, 0x26, 0x26, 0x26, 0x20, 0x20, 0x26, 0x26, 0x20, 0x20, 0x20, 0x26, 0x20, 0x23, 0x24, 0x27, 0x20, 0x23, 0x26, 0x27, 0x20, 0x21, 0x26, 0x27, 0x20, 0x21, 0x24, 0x27, 0x20, 0x23, 0x25, 0x28, 0x20, 0x24, 0x26, 0x28, 0x20, 0x22, 0x26, 0x28, 0x20, 0x22, 0x24, 0x28, 0x20, 0x28, 0x28, 0x28, 0x20, 0x20, 0x28, 0x28, 0x20, 0x20, 0x20, 0x28, 0x20, 0x24, 0x27, 0x2B, 0x20, 0x25, 0x29, 0x2B, 0x20, 0x22, 0x29, 0x2B, 0x20, 0x22, 0x26, 0x2B, 0x20, 0x2B, 0x2B, 0x2B, 0x20, 0x20, 0x2B, 0x2B, 0x20, 0x20, 0x20, 0x2B, 0x20, 0x25, 0x29, 0x2E, 0x20, 0x27, 0x2B, 0x2E, 0x20, 0x23, 0x2B, 0x2E, 0x20, 0x23, 0x27, 0x2E, 0x20, 0x2E, 0x2E, 0x2E, 0x20, 0x20, 0x2E, 0x2E, 0x20, 0x20, 0x20, 0x2E, 0x20, 0x26, 0x2B, 0x31, 0x20, 0x28, 0x2D, 0x31, 0x20, 0x24, 0x2D, 0x31, 0x20, 0x24, 0x29, 0x31, 0x20, 0x31, 0x31, 0x31, 0x20, 0x20, 0x31, 0x31, 0x20, 0x20, 0x20, 0x31, 0x20, 0x27, 0x2D, 0x34, 0x20, 0x2A, 0x2F, 0x34, 0x20, 0x25, 0x2F, 0x34, 0x20, 0x25, 0x2A, 0x34, 0x20, 0x34, 0x34, 0x34, 0x20, 0x20, 0x34, 0x34, 0x20, 0x20, 0x20, 0x34, 0x20, 0x2B, 0x32, 0x37, 0x20, 0x25, 0x32, 0x37, 0x20, 0x25, 0x2C, 0x37, 0x20, 0x37, 0x37, 0x37, 0x20, 0x20, 0x37, 0x37, 0x20, 0x20, 0x20, 0x37, 0x20, 0x2D, 0x34, 0x3A, 0x20, 0x26, 0x34, 0x3A, 0x20, 0x26, 0x2D, 0x3A, 0x20, 0x3A, 0x3A, 0x3A, 0x20, 0x20, 0x3A, 0x3A, 0x20, 0x20, 0x20, 0x3A, 0x20, 0x2E, 0x36, 0x3D, 0x20, 0x27, 0x36, 0x3D, 0x20, 0x27, 0x2F, 0x3D, 0x20, 0x3D, 0x3D, 0x3D, 0x20, 0x20, 0x3D, 0x3D, 0x20, 0x20, 0x20, 0x3D, 0x21, 0x22, 0x22, 0x23, 0x21, 0x22, 0x23, 0x24, 0x21, 0x23, 0x24, 0x25, 0x21, 0x22, 0x24, 0x25, 0x21, 0x22, 0x23, 0x25, 0x21, 0x23, 0x24, 0x26, 0x21, 0x23, 0x25, 0x26, 0x21, 0x22, 0x25, 0x26, 0x21, 0x22, 0x24, 0x26, 0x21, 0x23, 0x25, 0x27, 0x21, 0x24, 0x26, 0x27, 0x21, 0x22, 0x26, 0x27, 0x21, 0x22, 0x24, 0x27, 0x21, 0x27, 0x27, 0x27, 0x21, 0x21, 0x27, 0x27, 0x21, 0x21, 0x21, 0x27, 0x21, 0x24, 0x25, 0x28, 0x21, 0x24, 0x27, 0x28, 0x21, 0x22, 0x27, 0x28, 0x21, 0x22, 0x25, 0x28, 0x21, 0x24, 0x26, 0x29, 0x21, 0x25, 0x27, 0x29, 0x21, 0x23, 0x27, 0x29, 0x21, 0x23, 0x25, 0x29, 0x21, 0x29, 0x29, 0x29, 0x21, 0x21, 0x29, 0x29, 0x21, 0x21, 0x21, 0x29, 0x21, 0x25, 0x28, 0x2C, 0x21, 0x26, 0x2A, 0x2C, 0x21, 0x23, 0x2A, 0x2C, 0x21, 0x23, 0x27, 0x2C, 0x21, 0x2C, 0x2C, 0x2C, 0x21, 0x21, 0x2C, 0x2C, 0x21, 0x21, 0x21, 0x2C, 0x21, 0x26, 0x2A, 0x2F, 0x21, 0x28, 0x2C, 0x2F, 0x21, 0x24, 0x2C, 0x2F, 0x21, 0x24, 0x28, 0x2F, 0x21, 0x2F, 0x2F, 0x2F, 0x21, 0x21, 0x2F, 0x2F, 0x21, 0x21, 0x21, 0x2F, 0x21, 0x27, 0x2C, 0x32, 0x21, 0x29, 0x2E, 0x32, 0x21, 0x25, 0x2E, 0x32, 0x21, 0x25, 0x2A, 0x32, 0x21, 0x32, 0x32, 0x32, 0x21, 0x21, 0x32, 0x32, 0x21, 0x21, 0x21, 0x32, 0x21, 0x28, 0x2E, 0x35, 0x21, 0x2B, 0x30, 0x35, 0x21, 0x26, 0x30, 0x35, 0x21, 0x26, 0x2B, 0x35, 0x21, 0x35, 0x35, 0x35, 0x21, 0x21, 0x35, 0x35, 0x21, 0x21, 0x21, 0x35, 0x21, 0x2C, 0x33, 0x38, 0x21, 0x26, 0x33, 0x38, 0x21, 0x26, 0x2D, 0x38, 0x21, 0x38, 0x38, 0x38, 0x21, 0x21, 0x38, 0x38, 0x21, 0x21, 0x21, 0x38, 0x21, 0x2E, 0x35, 0x3B, 0x21, 0x27, 0x35, 0x3B, 0x21, 0x27, 0x2E, 0x3B, 0x21, 0x3B, 0x3B, 0x3B, 0x21, 0x21, 0x3B, 0x3B, 0x21, 0x21, 0x21, 0x3B, 0x21, 0x2F, 0x37, 0x3E, 0x21, 0x28, 0x37, 0x3E, 0x21, 0x28, 0x30, 0x3E, 0x21, 0x3E, 0x3E, 0x3E, 0x21, 0x21, 0x3E, 0x3E, 0x21, 0x21, 0x21, 0x3E, 0x22, 0x23, 0x23, 0x24, 0x22, 0x23, 0x24, 0x25, 0x22, 0x24, 0x25, 0x26, 0x22, 0x23, 0x25, 0x26, 0x22, 0x23, 0x24, 0x26, 0x22, 0x24, 0x25, 0x27, 0x22, 0x24, 0x26, 0x27, 0x22, 0x23, 0x26, 0x27, 0x22, 0x23, 0x25, 0x27, 0x22, 0x24, 0x26, 0x28, 0x22, 0x25, 0x27, 0x28, 0x22, 0x23, 0x27, 0x28, 0x22, 0x23, 0x25, 0x28, 0x22, 0x28, 0x28, 0x28, 0x22, 0x22, 0x28, 0x28, 0x22, 0x22, 0x22, 0x28, 0x22, 0x25, 0x26, 0x29, 0x22, 0x25, 0x28, 0x29, 0x22, 0x23, 0x28, 0x29, 0x22, 0x23, 0x26, 0x29, 0x22, 0x25, 0x27, 0x2A, 0x22, 0x26, 0x28, 0x2A, 0x22, 0x24, 0x28, 0x2A, 0x22, 0x24, 0x26, 0x2A, 0x22, 0x2A, 0x2A, 0x2A, 0x22, 0x22, 0x2A, 0x2A, 0x22, 0x22, 0x22, 0x2A, 0x22, 0x26, 0x29, 0x2D, 0x22, 0x27, 0x2B, 0x2D, 0x22, 0x24, 0x2B, 0x2D, 0x22, 0x24, 0x28, 0x2D, 0x22, 0x2D, 0x2D, 0x2D, 0x22, 0x22, 0x2D, 0x2D, 0x22, 0x22, 0x22, 0x2D, 0x22, 0x27, 0x2B, 0x30, 0x22, 0x29, 0x2D, 0x30, 0x22, 0x25, 0x2D, 0x30, 0x22, 0x25, 0x29, 0x30, 0x22, 0x30, 0x30, 0x30, 0x22, 0x22, 0x30, 0x30, 0x22, 0x22, 0x22, 0x30, 0x22, 0x28, 0x2D, 0x33, 0x22, 0x2A, 0x2F, 0x33, 0x22, 0x26, 0x2F, 0x33, 0x22, 0x26, 0x2B, 0x33, 0x22, 0x33, 0x33, 0x33, 0x22, 0x22, 0x33, 0x33, 0x22, 0x22, 0x22, 0x33, 0x22, 0x29, 0x2F, 0x36, 0x22, 0x2C, 0x31, 0x36, 0x22, 0x27, 0x31, 0x36, 0x22, 0x27, 0x2C, 0x36, 0x22, 0x36, 0x36, 0x36, 0x22, 0x22, 0x36, 0x36, 0x22, 0x22, 0x22, 0x36, 0x22, 0x2D, 0x34, 0x39, 0x22, 0x27, 0x34, 0x39, 0x22, 0x27, 0x2E, 0x39, 0x22, 0x39, 0x39, 0x39, 0x22, 0x22, 0x39, 0x39, 0x22, 0x22, 0x22, 0x39, 0x22, 0x2F, 0x36, 0x3C, 0x22, 0x28, 0x36, 0x3C, 0x22, 0x28, 0x2F, 0x3C, 0x22, 0x3C, 0x3C, 0x3C, 0x22, 0x22, 0x3C, 0x3C, 0x22, 0x22, 0x22, 0x3C, 0x22, 0x30, 0x38, 0x3F, 0x22, 0x29, 0x38, 0x3F, 0x22, 0x29, 0x31, 0x3F, 0x22, 0x3F, 0x3F, 0x3F, 0x22, 0x22, 0x3F, 0x3F, 0x22, 0x22, 0x22, 0x3F, 0x23, 0x24, 0x24, 0x25, 0x23, 0x24, 0x25, 0x26, 0x23, 0x25, 0x26, 0x27, 0x23, 0x24, 0x26, 0x27, 0x23, 0x24, 0x25, 0x27, 0x23, 0x25, 0x26, 0x28, 0x23, 0x25, 0x27, 0x28, 0x23, 0x24, 0x27, 0x28, 0x23, 0x24, 0x26, 0x28, 0x23, 0x25, 0x27, 0x29, 0x23, 0x26, 0x28, 0x29, 0x23, 0x24, 0x28, 0x29, 0x23, 0x24, 0x26, 0x29, 0x23, 0x29, 0x29, 0x29, 0x23, 0x23, 0x29, 0x29, 0x23, 0x23, 0x23, 0x29, 0x23, 0x26, 0x27, 0x2A, 0x23, 0x26, 0x29, 0x2A, 0x23, 0x24, 0x29, 0x2A, 0x23, 0x24, 0x27, 0x2A, 0x23, 0x26, 0x28, 0x2B, 0x23, 0x27, 0x29, 0x2B, 0x23, 0x25, 0x29, 0x2B, 0x23, 0x25, 0x27, 0x2B, 0x23, 0x2B, 0x2B, 0x2B, 0x23, 0x23, 0x2B, 0x2B, 0x23, 0x23, 0x23, 0x2B, 0x23, 0x27, 0x2A, 0x2E, 0x23, 0x28, 0x2C, 0x2E, 0x23, 0x25, 0x2C, 0x2E, 0x23, 0x25, 0x29, 0x2E, 0x23, 0x2E, 0x2E, 0x2E, 0x23, 0x23, 0x2E, 0x2E, 0x23, 0x23, 0x23, 0x2E, 0x23, 0x28, 0x2C, 0x31, 0x23, 0x2A, 0x2E, 0x31, 0x23, 0x26, 0x2E, 0x31, 0x23, 0x26, 0x2A, 0x31, 0x23, 0x31, 0x31, 0x31, 0x23, 0x23, 0x31, 0x31, 0x23, 0x23, 0x23, 0x31, 0x23, 0x29, 0x2E, 0x34, 0x23, 0x2B, 0x30, 0x34, 0x23, 0x27, 0x30, 0x34, 0x23, 0x27, 0x2C, 0x34, 0x23, 0x34, 0x34, 0x34, 0x23, 0x23, 0x34, 0x34, 0x23, 0x23, 0x23, 0x34, 0x23, 0x2A, 0x30, 0x37, 0x23, 0x2D, 0x32, 0x37, 0x23, 0x28, 0x32, 0x37, 0x23, 0x28, 0x2D, 0x37, 0x23, 0x37, 0x37, 0x37, 0x23, 0x23, 0x37, 0x37, 0x23, 0x23, 0x23, 0x37, 0x23, 0x2E, 0x35, 0x3A, 0x23, 0x28, 0x35, 0x3A, 0x23, 0x28, 0x2F, 0x3A, 0x23, 0x3A, 0x3A, 0x3A, 0x23, 0x23, 0x3A, 0x3A, 0x23, 0x23, 0x23, 0x3A, 0x23, 0x30, 0x37, 0x3D, 0x23, 0x29, 0x37, 0x3D, 0x23, 0x29, 0x30, 0x3D, 0x23, 0x3D, 0x3D, 0x3D, 0x23, 0x23, 0x3D, 0x3D, 0x23, 0x23, 0x23, 0x3D, 0x24, 0x25, 0x25, 0x26, 0x24, 0x25, 0x26, 0x27, 0x24, 0x26, 0x27, 0x28, 0x24, 0x25, 0x27, 0x28, 0x24, 0x25, 0x26, 0x28, 0x24, 0x26, 0x27, 0x29, 0x24, 0x26, 0x28, 0x29, 0x24, 0x25, 0x28, 0x29, 0x24, 0x25, 0x27, 0x29, 0x24, 0x26, 0x28, 0x2A, 0x24, 0x27, 0x29, 0x2A, 0x24, 0x25, 0x29, 0x2A, 0x24, 0x25, 0x27, 0x2A, 0x24, 0x2A, 0x2A, 0x2A, 0x24, 0x24, 0x2A, 0x2A, 0x24, 0x24, 0x24, 0x2A, 0x24, 0x27, 0x28, 0x2B, 0x24, 0x27, 0x2A, 0x2B, 0x24, 0x25, 0x2A, 0x2B, 0x24, 0x25, 0x28, 0x2B, 0x24, 0x27, 0x29, 0x2C, 0x24, 0x28, 0x2A, 0x2C, 0x24, 0x26, 0x2A, 0x2C, 0x24, 0x26, 0x28, 0x2C, 0x24, 0x2C, 0x2C, 0x2C, 0x24, 0x24, 0x2C, 0x2C, 0x24, 0x24, 0x24, 0x2C, 0x24, 0x28, 0x2B, 0x2F, 0x24, 0x29, 0x2D, 0x2F, 0x24, 0x26, 0x2D, 0x2F, 0x24, 0x26, 0x2A, 0x2F, 0x24, 0x2F, 0x2F, 0x2F, 0x24, 0x24, 0x2F, 0x2F, 0x24, 0x24, 0x24, 0x2F, 0x24, 0x29, 0x2D, 0x32, 0x24, 0x2B, 0x2F, 0x32, 0x24, 0x27, 0x2F, 0x32, 0x24, 0x27, 0x2B, 0x32, 0x24, 0x32, 0x32, 0x32, 0x24, 0x24, 0x32, 0x32, 0x24, 0x24, 0x24, 0x32, 0x24, 0x2A, 0x2F, 0x35, 0x24, 0x2C, 0x31, 0x35, 0x24, 0x28, 0x31, 0x35, 0x24, 0x28, 0x2D, 0x35, 0x24, 0x35, 0x35, 0x35, 0x24, 0x24, 0x35, 0x35, 0x24, 0x24, 0x24, 0x35, 0x24, 0x2B, 0x31, 0x38, 0x24, 0x2E, 0x33, 0x38, 0x24, 0x29, 0x33, 0x38, 0x24, 0x29, 0x2E, 0x38, 0x24, 0x38, 0x38, 0x38, 0x24, 0x24, 0x38, 0x38, 0x24, 0x24, 0x24, 0x38, 0x24, 0x2F, 0x36, 0x3B, 0x24, 0x29, 0x36, 0x3B, 0x24, 0x29, 0x30, 0x3B, 0x24, 0x3B, 0x3B, 0x3B, 0x24, 0x24, 0x3B, 0x3B, 0x24, 0x24, 0x24, 0x3B, 0x24, 0x31, 0x38, 0x3E, 0x24, 0x2A, 0x38, 0x3E, 0x24, 0x2A, 0x31, 0x3E, 0x24, 0x3E, 0x3E, 0x3E, 0x24, 0x24, 0x3E, 0x3E, 0x24, 0x24, 0x24, 0x3E, 0x25, 0x26, 0x26, 0x27, 0x25, 0x26, 0x27, 0x28, 0x25, 0x27, 0x28, 0x29, 0x25, 0x26, 0x28, 0x29, 0x25, 0x26, 0x27, 0x29, 0x25, 0x27, 0x28, 0x2A, 0x25, 0x27, 0x29, 0x2A, 0x25, 0x26, 0x29, 0x2A, 0x25, 0x26, 0x28, 0x2A, 0x25, 0x27, 0x29, 0x2B, 0x25, 0x28, 0x2A, 0x2B, 0x25, 0x26, 0x2A, 0x2B, 0x25, 0x26, 0x28, 0x2B, 0x25, 0x2B, 0x2B, 0x2B, 0x25, 0x25, 0x2B, 0x2B, 0x25, 0x25, 0x25, 0x2B, 0x25, 0x28, 0x29, 0x2C, 0x25, 0x28, 0x2B, 0x2C, 0x25, 0x26, 0x2B, 0x2C, 0x25, 0x26, 0x29, 0x2C, 0x25, 0x28, 0x2A, 0x2D, 0x25, 0x29, 0x2B, 0x2D, 0x25, 0x27, 0x2B, 0x2D, 0x25, 0x27, 0x29, 0x2D, 0x25, 0x2D, 0x2D, 0x2D, 0x25, 0x25, 0x2D, 0x2D, 0x25, 0x25, 0x25, 0x2D, 0x25, 0x29, 0x2C, 0x30, 0x25, 0x2A, 0x2E, 0x30, 0x25, 0x27, 0x2E, 0x30, 0x25, 0x27, 0x2B, 0x30, 0x25, 0x30, 0x30, 0x30, 0x25, 0x25, 0x30, 0x30, 0x25, 0x25, 0x25, 0x30, 0x25, 0x2A, 0x2E, 0x33, 0x25, 0x2C, 0x30, 0x33, 0x25, 0x28, 0x30, 0x33, 0x25, 0x28, 0x2C, 0x33, 0x25, 0x33, 0x33, 0x33, 0x25, 0x25, 0x33, 0x33, 0x25, 0x25, 0x25, 0x33, 0x25, 0x2B, 0x30, 0x36, 0x25, 0x2D, 0x32, 0x36, 0x25, 0x29, 0x32, 0x36, 0x25, 0x29, 0x2E, 0x36, 0x25, 0x36, 0x36, 0x36, 0x25, 0x25, 0x36, 0x36, 0x25, 0x25, 0x25, 0x36, 0x25, 0x2C, 0x32, 0x39, 0x25, 0x2F, 0x34, 0x39, 0x25, 0x2A, 0x34, 0x39, 0x25, 0x2A, 0x2F, 0x39, 0x25, 0x39, 0x39, 0x39, 0x25, 0x25, 0x39, 0x39, 0x25, 0x25, 0x25, 0x39, 0x25, 0x30, 0x37, 0x3C, 0x25, 0x2A, 0x37, 0x3C, 0x25, 0x2A, 0x31, 0x3C, 0x25, 0x3C, 0x3C, 0x3C, 0x25, 0x25, 0x3C, 0x3C, 0x25, 0x25, 0x25, 0x3C, 0x25, 0x32, 0x39, 0x3F, 0x25, 0x2B, 0x39, 0x3F, 0x25, 0x2B, 0x32, 0x3F, 0x25, 0x3F, 0x3F, 0x3F, 0x25, 0x25, 0x3F, 0x3F, 0x25, 0x25, 0x25, 0x3F, 0x26, 0x27, 0x27, 0x28, 0x26, 0x27, 0x28, 0x29, 0x26, 0x28, 0x29, 0x2A, 0x26, 0x27, 0x29, 0x2A, 0x26, 0x27, 0x28, 0x2A, 0x26, 0x28, 0x29, 0x2B, 0x26, 0x28, 0x2A, 0x2B, 0x26, 0x27, 0x2A, 0x2B, 0x26, 0x27, 0x29, 0x2B, 0x26, 0x28, 0x2A, 0x2C, 0x26, 0x29, 0x2B, 0x2C, 0x26, 0x27, 0x2B, 0x2C, 0x26, 0x27, 0x29, 0x2C, 0x26, 0x2C, 0x2C, 0x2C, 0x26, 0x26, 0x2C, 0x2C, 0x26, 0x26, 0x26, 0x2C, 0x26, 0x29, 0x2A, 0x2D, 0x26, 0x29, 0x2C, 0x2D, 0x26, 0x27, 0x2C, 0x2D, 0x26, 0x27, 0x2A, 0x2D, 0x26, 0x29, 0x2B, 0x2E, 0x26, 0x2A, 0x2C, 0x2E, 0x26, 0x28, 0x2C, 0x2E, 0x26, 0x28, 0x2A, 0x2E, 0x26, 0x2E, 0x2E, 0x2E, 0x26, 0x26, 0x2E, 0x2E, 0x26, 0x26, 0x26, 0x2E, 0x26, 0x2A, 0x2D, 0x31, 0x26, 0x2B, 0x2F, 0x31, 0x26, 0x28, 0x2F, 0x31, 0x26, 0x28, 0x2C, 0x31, 0x26, 0x31, 0x31, 0x31, 0x26, 0x26, 0x31, 0x31, 0x26, 0x26, 0x26, 0x31, 0x26, 0x2B, 0x2F, 0x34, 0x26, 0x2D, 0x31, 0x34, 0x26, 0x29, 0x31, 0x34, 0x26, 0x29, 0x2D, 0x34, 0x26, 0x34, 0x34, 0x34, 0x26, 0x26, 0x34, 0x34, 0x26, 0x26, 0x26, 0x34, 0x26, 0x2C, 0x31, 0x37, 0x26, 0x2E, 0x33, 0x37, 0x26, 0x2A, 0x33, 0x37, 0x26, 0x2A, 0x2F, 0x37, 0x26, 0x37, 0x37, 0x37, 0x26, 0x26, 0x37, 0x37, 0x26, 0x26, 0x26, 0x37, 0x26, 0x2D, 0x33, 0x3A, 0x26, 0x30, 0x35, 0x3A, 0x26, 0x2B, 0x35, 0x3A, 0x26, 0x2B, 0x30, 0x3A, 0x26, 0x3A, 0x3A, 0x3A, 0x26, 0x26, 0x3A, 0x3A, 0x26, 0x26, 0x26, 0x3A, 0x26, 0x31, 0x38, 0x3D, 0x26, 0x2B, 0x38, 0x3D, 0x26, 0x2B, 0x32, 0x3D, 0x26, 0x3D, 0x3D, 0x3D, 0x26, 0x26, 0x3D, 0x3D, 0x26, 0x26, 0x26, 0x3D, 0x27, 0x28, 0x28, 0x29, 0x27, 0x28, 0x29, 0x2A, 0x27, 0x29, 0x2A, 0x2B, 0x27, 0x28, 0x2A, 0x2B, 0x27, 0x28, 0x29, 0x2B, 0x27, 0x29, 0x2A, 0x2C, 0x27, 0x29, 0x2B, 0x2C, 0x27, 0x28, 0x2B, 0x2C, 0x27, 0x28, 0x2A, 0x2C, 0x27, 0x29, 0x2B, 0x2D, 0x27, 0x2A, 0x2C, 0x2D, 0x27, 0x28, 0x2C, 0x2D, 0x27, 0x28, 0x2A, 0x2D, 0x27, 0x2D, 0x2D, 0x2D, 0x27, 0x27, 0x2D, 0x2D, 0x27, 0x27, 0x27, 0x2D, 0x27, 0x2A, 0x2B, 0x2E, 0x27, 0x2A, 0x2D, 0x2E, 0x27, 0x28, 0x2D, 0x2E, 0x27, 0x28, 0x2B, 0x2E, 0x27, 0x2A, 0x2C, 0x2F, 0x27, 0x2B, 0x2D, 0x2F, 0x27, 0x29, 0x2D, 0x2F, 0x27, 0x29, 0x2B, 0x2F, 0x27, 0x2F, 0x2F, 0x2F, 0x27, 0x27, 0x2F, 0x2F, 0x27, 0x27, 0x27, 0x2F, 0x27, 0x2B, 0x2E, 0x32, 0x27, 0x2C, 0x30, 0x32, 0x27, 0x29, 0x30, 0x32, 0x27, 0x29, 0x2D, 0x32, 0x27, 0x32, 0x32, 0x32, 0x27, 0x27, 0x32, 0x32, 0x27, 0x27, 0x27, 0x32, 0x27, 0x2C, 0x30, 0x35, 0x27, 0x2E, 0x32, 0x35, 0x27, 0x2A, 0x32, 0x35, 0x27, 0x2A, 0x2E, 0x35, 0x27, 0x35, 0x35, 0x35, 0x27, 0x27, 0x35, 0x35, 0x27, 0x27, 0x27, 0x35, 0x27, 0x2D, 0x32, 0x38, 0x27, 0x2F, 0x34, 0x38, 0x27, 0x2B, 0x34, 0x38, 0x27, 0x2B, 0x30, 0x38, 0x27, 0x38, 0x38, 0x38, 0x27, 0x27, 0x38, 0x38, 0x27, 0x27, 0x27, 0x38, 0x27, 0x2E, 0x34, 0x3B, 0x27, 0x31, 0x36, 0x3B, 0x27, 0x2C, 0x36, 0x3B, 0x27, 0x2C, 0x31, 0x3B, 0x27, 0x3B, 0x3B, 0x3B, 0x27, 0x27, 0x3B, 0x3B, 0x27, 0x27, 0x27, 0x3B, 0x27, 0x32, 0x39, 0x3E, 0x27, 0x2C, 0x39, 0x3E, 0x27, 0x2C, 0x33, 0x3E, 0x27, 0x3E, 0x3E, 0x3E, 0x27, 0x27, 0x3E, 0x3E, 0x27, 0x27, 0x27, 0x3E, 0x28, 0x29, 0x29, 0x2A, 0x28, 0x29, 0x2A, 0x2B, 0x28, 0x2A, 0x2B, 0x2C, 0x28, 0x29, 0x2B, 0x2C, 0x28, 0x29, 0x2A, 0x2C, 0x28, 0x2A, 0x2B, 0x2D, 0x28, 0x2A, 0x2C, 0x2D, 0x28, 0x29, 0x2C, 0x2D, 0x28, 0x29, 0x2B, 0x2D, 0x28, 0x2A, 0x2C, 0x2E, 0x28, 0x2B, 0x2D, 0x2E, 0x28, 0x29, 0x2D, 0x2E, 0x28, 0x29, 0x2B, 0x2E, 0x28, 0x2E, 0x2E, 0x2E, 0x28, 0x28, 0x2E, 0x2E, 0x28, 0x28, 0x28, 0x2E, 0x28, 0x2B, 0x2C, 0x2F, 0x28, 0x2B, 0x2E, 0x2F, 0x28, 0x29, 0x2E, 0x2F, 0x28, 0x29, 0x2C, 0x2F, 0x28, 0x2B, 0x2D, 0x30, 0x28, 0x2C, 0x2E, 0x30, 0x28, 0x2A, 0x2E, 0x30, 0x28, 0x2A, 0x2C, 0x30, 0x28, 0x30, 0x30, 0x30, 0x28, 0x28, 0x30, 0x30, 0x28, 0x28, 0x28, 0x30, 0x28, 0x2C, 0x2F, 0x33, 0x28, 0x2D, 0x31, 0x33, 0x28, 0x2A, 0x31, 0x33, 0x28, 0x2A, 0x2E, 0x33, 0x28, 0x33, 0x33, 0x33, 0x28, 0x28, 0x33, 0x33, 0x28, 0x28, 0x28, 0x33, 0x28, 0x2D, 0x31, 0x36, 0x28, 0x2F, 0x33, 0x36, 0x28, 0x2B, 0x33, 0x36, 0x28, 0x2B, 0x2F, 0x36, 0x28, 0x36, 0x36, 0x36, 0x28, 0x28, 0x36, 0x36, 0x28, 0x28, 0x28, 0x36, 0x28, 0x2E, 0x33, 0x39, 0x28, 0x30, 0x35, 0x39, 0x28, 0x2C, 0x35, 0x39, 0x28, 0x2C, 0x31, 0x39, 0x28, 0x39, 0x39, 0x39, 0x28, 0x28, 0x39, 0x39, 0x28, 0x28, 0x28, 0x39, 0x28, 0x2F, 0x35, 0x3C, 0x28, 0x32, 0x37, 0x3C, 0x28, 0x2D, 0x37, 0x3C, 0x28, 0x2D, 0x32, 0x3C, 0x28, 0x3C, 0x3C, 0x3C, 0x28, 0x28, 0x3C, 0x3C, 0x28, 0x28, 0x28, 0x3C, 0x28, 0x33, 0x3A, 0x3F, 0x28, 0x2D, 0x3A, 0x3F, 0x28, 0x2D, 0x34, 0x3F, 0x28, 0x3F, 0x3F, 0x3F, 0x28, 0x28, 0x3F, 0x3F, 0x28, 0x28, 0x28, 0x3F, 0x29, 0x2A, 0x2A, 0x2B, 0x29, 0x2A, 0x2B, 0x2C, 0x29, 0x2B, 0x2C, 0x2D, 0x29, 0x2A, 0x2C, 0x2D, 0x29, 0x2A, 0x2B, 0x2D, 0x29, 0x2B, 0x2C, 0x2E, 0x29, 0x2B, 0x2D, 0x2E, 0x29, 0x2A, 0x2D, 0x2E, 0x29, 0x2A, 0x2C, 0x2E, 0x29, 0x2B, 0x2D, 0x2F, 0x29, 0x2C, 0x2E, 0x2F, 0x29, 0x2A, 0x2E, 0x2F, 0x29, 0x2A, 0x2C, 0x2F, 0x29, 0x2F, 0x2F, 0x2F, 0x29, 0x29, 0x2F, 0x2F, 0x29, 0x29, 0x29, 0x2F, 0x29, 0x2C, 0x2D, 0x30, 0x29, 0x2C, 0x2F, 0x30, 0x29, 0x2A, 0x2F, 0x30, 0x29, 0x2A, 0x2D, 0x30, 0x29, 0x2C, 0x2E, 0x31, 0x29, 0x2D, 0x2F, 0x31, 0x29, 0x2B, 0x2F, 0x31, 0x29, 0x2B, 0x2D, 0x31, 0x29, 0x31, 0x31, 0x31, 0x29, 0x29, 0x31, 0x31, 0x29, 0x29, 0x29, 0x31, 0x29, 0x2D, 0x30, 0x34, 0x29, 0x2E, 0x32, 0x34, 0x29, 0x2B, 0x32, 0x34, 0x29, 0x2B, 0x2F, 0x34, 0x29, 0x34, 0x34, 0x34, 0x29, 0x29, 0x34, 0x34, 0x29, 0x29, 0x29, 0x34, 0x29, 0x2E, 0x32, 0x37, 0x29, 0x30, 0x34, 0x37, 0x29, 0x2C, 0x34, 0x37, 0x29, 0x2C, 0x30, 0x37, 0x29, 0x37, 0x37, 0x37, 0x29, 0x29, 0x37, 0x37, 0x29, 0x29, 0x29, 0x37, 0x29, 0x2F, 0x34, 0x3A, 0x29, 0x31, 0x36, 0x3A, 0x29, 0x2D, 0x36, 0x3A, 0x29, 0x2D, 0x32, 0x3A, 0x29, 0x3A, 0x3A, 0x3A, 0x29, 0x29, 0x3A, 0x3A, 0x29, 0x29, 0x29, 0x3A, 0x29, 0x30, 0x36, 0x3D, 0x29, 0x33, 0x38, 0x3D, 0x29, 0x2E, 0x38, 0x3D, 0x29, 0x2E, 0x33, 0x3D, 0x29, 0x3D, 0x3D, 0x3D, 0x29, 0x29, 0x3D, 0x3D, 0x29, 0x29, 0x29, 0x3D, 0x2A, 0x2B, 0x2B, 0x2C, 0x2A, 0x2B, 0x2C, 0x2D, 0x2A, 0x2C, 0x2D, 0x2E, 0x2A, 0x2B, 0x2D, 0x2E, 0x2A, 0x2B, 0x2C, 0x2E, 0x2A, 0x2C, 0x2D, 0x2F, 0x2A, 0x2C, 0x2E, 0x2F, 0x2A, 0x2B, 0x2E, 0x2F, 0x2A, 0x2B, 0x2D, 0x2F, 0x2A, 0x2C, 0x2E, 0x30, 0x2A, 0x2D, 0x2F, 0x30, 0x2A, 0x2B, 0x2F, 0x30, 0x2A, 0x2B, 0x2D, 0x30, 0x2A, 0x30, 0x30, 0x30, 0x2A, 0x2A, 0x30, 0x30, 0x2A, 0x2A, 0x2A, 0x30, 0x2A, 0x2D, 0x2E, 0x31, 0x2A, 0x2D, 0x30, 0x31, 0x2A, 0x2B, 0x30, 0x31, 0x2A, 0x2B, 0x2E, 0x31, 0x2A, 0x2D, 0x2F, 0x32, 0x2A, 0x2E, 0x30, 0x32, 0x2A, 0x2C, 0x30, 0x32, 0x2A, 0x2C, 0x2E, 0x32, 0x2A, 0x32, 0x32, 0x32, 0x2A, 0x2A, 0x32, 0x32, 0x2A, 0x2A, 0x2A, 0x32, 0x2A, 0x2E, 0x31, 0x35, 0x2A, 0x2F, 0x33, 0x35, 0x2A, 0x2C, 0x33, 0x35, 0x2A, 0x2C, 0x30, 0x35, 0x2A, 0x35, 0x35, 0x35, 0x2A, 0x2A, 0x35, 0x35, 0x2A, 0x2A, 0x2A, 0x35, 0x2A, 0x2F, 0x33, 0x38, 0x2A, 0x31, 0x35, 0x38, 0x2A, 0x2D, 0x35, 0x38, 0x2A, 0x2D, 0x31, 0x38, 0x2A, 0x38, 0x38, 0x38, 0x2A, 0x2A, 0x38, 0x38, 0x2A, 0x2A, 0x2A, 0x38, 0x2A, 0x30, 0x35, 0x3B, 0x2A, 0x32, 0x37, 0x3B, 0x2A, 0x2E, 0x37, 0x3B, 0x2A, 0x2E, 0x33, 0x3B, 0x2A, 0x3B, 0x3B, 0x3B, 0x2A, 0x2A, 0x3B, 0x3B, 0x2A, 0x2A, 0x2A, 0x3B, 0x2A, 0x31, 0x37, 0x3E, 0x2A, 0x34, 0x39, 0x3E, 0x2A, 0x2F, 0x39, 0x3E, 0x2A, 0x2F, 0x34, 0x3E, 0x2A, 0x3E, 0x3E, 0x3E, 0x2A, 0x2A, 0x3E, 0x3E, 0x2A, 0x2A, 0x2A, 0x3E, 0x2B, 0x2C, 0x2C, 0x2D, 0x2B, 0x2C, 0x2D, 0x2E, 0x2B, 0x2D, 0x2E, 0x2F, 0x2B, 0x2C, 0x2E, 0x2F, 0x2B, 0x2C, 0x2D, 0x2F, 0x2B, 0x2D, 0x2E, 0x30, 0x2B, 0x2D, 0x2F, 0x30, 0x2B, 0x2C, 0x2F, 0x30, 0x2B, 0x2C, 0x2E, 0x30, 0x2B, 0x2D, 0x2F, 0x31, 0x2B, 0x2E, 0x30, 0x31, 0x2B, 0x2C, 0x30, 0x31, 0x2B, 0x2C, 0x2E, 0x31, 0x2B, 0x31, 0x31, 0x31, 0x2B, 0x2B, 0x31, 0x31, 0x2B, 0x2B, 0x2B, 0x31, 0x2B, 0x2E, 0x2F, 0x32, 0x2B, 0x2E, 0x31, 0x32, 0x2B, 0x2C, 0x31, 0x32, 0x2B, 0x2C, 0x2F, 0x32, 0x2B, 0x2E, 0x30, 0x33, 0x2B, 0x2F, 0x31, 0x33, 0x2B, 0x2D, 0x31, 0x33, 0x2B, 0x2D, 0x2F, 0x33, 0x2B, 0x33, 0x33, 0x33, 0x2B, 0x2B, 0x33, 0x33, 0x2B, 0x2B, 0x2B, 0x33, 0x2B, 0x2F, 0x32, 0x36, 0x2B, 0x30, 0x34, 0x36, 0x2B, 0x2D, 0x34, 0x36, 0x2B, 0x2D, 0x31, 0x36, 0x2B, 0x36, 0x36, 0x36, 0x2B, 0x2B, 0x36, 0x36, 0x2B, 0x2B, 0x2B, 0x36, 0x2B, 0x30, 0x34, 0x39, 0x2B, 0x32, 0x36, 0x39, 0x2B, 0x2E, 0x36, 0x39, 0x2B, 0x2E, 0x32, 0x39, 0x2B, 0x39, 0x39, 0x39, 0x2B, 0x2B, 0x39, 0x39, 0x2B, 0x2B, 0x2B, 0x39, 0x2B, 0x31, 0x36, 0x3C, 0x2B, 0x33, 0x38, 0x3C, 0x2B, 0x2F, 0x38, 0x3C, 0x2B, 0x2F, 0x34, 0x3C, 0x2B, 0x3C, 0x3C, 0x3C, 0x2B, 0x2B, 0x3C, 0x3C, 0x2B, 0x2B, 0x2B, 0x3C, 0x2B, 0x32, 0x38, 0x3F, 0x2B, 0x35, 0x3A, 0x3F, 0x2B, 0x30, 0x3A, 0x3F, 0x2B, 0x30, 0x35, 0x3F, 0x2B, 0x3F, 0x3F, 0x3F, 0x2B, 0x2B, 0x3F, 0x3F, 0x2B, 0x2B, 0x2B, 0x3F, 0x2C, 0x2D, 0x2D, 0x2E, 0x2C, 0x2D, 0x2E, 0x2F, 0x2C, 0x2E, 0x2F, 0x30, 0x2C, 0x2D, 0x2F, 0x30, 0x2C, 0x2D, 0x2E, 0x30, 0x2C, 0x2E, 0x2F, 0x31, 0x2C, 0x2E, 0x30, 0x31, 0x2C, 0x2D, 0x30, 0x31, 0x2C, 0x2D, 0x2F, 0x31, 0x2C, 0x2E, 0x30, 0x32, 0x2C, 0x2F, 0x31, 0x32, 0x2C, 0x2D, 0x31, 0x32, 0x2C, 0x2D, 0x2F, 0x32, 0x2C, 0x32, 0x32, 0x32, 0x2C, 0x2C, 0x32, 0x32, 0x2C, 0x2C, 0x2C, 0x32, 0x2C, 0x2F, 0x30, 0x33, 0x2C, 0x2F, 0x32, 0x33, 0x2C, 0x2D, 0x32, 0x33, 0x2C, 0x2D, 0x30, 0x33, 0x2C, 0x2F, 0x31, 0x34, 0x2C, 0x30, 0x32, 0x34, 0x2C, 0x2E, 0x32, 0x34, 0x2C, 0x2E, 0x30, 0x34, 0x2C, 0x34, 0x34, 0x34, 0x2C, 0x2C, 0x34, 0x34, 0x2C, 0x2C, 0x2C, 0x34, 0x2C, 0x30, 0x33, 0x37, 0x2C, 0x31, 0x35, 0x37, 0x2C, 0x2E, 0x35, 0x37, 0x2C, 0x2E, 0x32, 0x37, 0x2C, 0x37, 0x37, 0x37, 0x2C, 0x2C, 0x37, 0x37, 0x2C, 0x2C, 0x2C, 0x37, 0x2C, 0x31, 0x35, 0x3A, 0x2C, 0x33, 0x37, 0x3A, 0x2C, 0x2F, 0x37, 0x3A, 0x2C, 0x2F, 0x33, 0x3A, 0x2C, 0x3A, 0x3A, 0x3A, 0x2C, 0x2C, 0x3A, 0x3A, 0x2C, 0x2C, 0x2C, 0x3A, 0x2C, 0x32, 0x37, 0x3D, 0x2C, 0x34, 0x39, 0x3D, 0x2C, 0x30, 0x39, 0x3D, 0x2C, 0x30, 0x35, 0x3D, 0x2C, 0x3D, 0x3D, 0x3D, 0x2C, 0x2C, 0x3D, 0x3D, 0x2C, 0x2C, 0x2C, 0x3D, 0x2D, 0x2E, 0x2E, 0x2F, 0x2D, 0x2E, 0x2F, 0x30, 0x2D, 0x2F, 0x30, 0x31, 0x2D, 0x2E, 0x30, 0x31, 0x2D, 0x2E, 0x2F, 0x31, 0x2D, 0x2F, 0x30, 0x32, 0x2D, 0x2F, 0x31, 0x32, 0x2D, 0x2E, 0x31, 0x32, 0x2D, 0x2E, 0x30, 0x32, 0x2D, 0x2F, 0x31, 0x33, 0x2D, 0x30, 0x32, 0x33, 0x2D, 0x2E, 0x32, 0x33, 0x2D, 0x2E, 0x30, 0x33, 0x2D, 0x33, 0x33, 0x33, 0x2D, 0x2D, 0x33, 0x33, 0x2D, 0x2D, 0x2D, 0x33, 0x2D, 0x30, 0x31, 0x34, 0x2D, 0x30, 0x33, 0x34, 0x2D, 0x2E, 0x33, 0x34, 0x2D, 0x2E, 0x31, 0x34, 0x2D, 0x30, 0x32, 0x35, 0x2D, 0x31, 0x33, 0x35, 0x2D, 0x2F, 0x33, 0x35, 0x2D, 0x2F, 0x31, 0x35, 0x2D, 0x35, 0x35, 0x35, 0x2D, 0x2D, 0x35, 0x35, 0x2D, 0x2D, 0x2D, 0x35, 0x2D, 0x31, 0x34, 0x38, 0x2D, 0x32, 0x36, 0x38, 0x2D, 0x2F, 0x36, 0x38, 0x2D, 0x2F, 0x33, 0x38, 0x2D, 0x38, 0x38, 0x38, 0x2D, 0x2D, 0x38, 0x38, 0x2D, 0x2D, 0x2D, 0x38, 0x2D, 0x32, 0x36, 0x3B, 0x2D, 0x34, 0x38, 0x3B, 0x2D, 0x30, 0x38, 0x3B, 0x2D, 0x30, 0x34, 0x3B, 0x2D, 0x3B, 0x3B, 0x3B, 0x2D, 0x2D, 0x3B, 0x3B, 0x2D, 0x2D, 0x2D, 0x3B, 0x2D, 0x33, 0x38, 0x3E, 0x2D, 0x35, 0x3A, 0x3E, 0x2D, 0x31, 0x3A, 0x3E, 0x2D, 0x31, 0x36, 0x3E, 0x2D, 0x3E, 0x3E, 0x3E, 0x2D, 0x2D, 0x3E, 0x3E, 0x2D, 0x2D, 0x2D, 0x3E, 0x2E, 0x2F, 0x2F, 0x30, 0x2E, 0x2F, 0x30, 0x31, 0x2E, 0x30, 0x31, 0x32, 0x2E, 0x2F, 0x31, 0x32, 0x2E, 0x2F, 0x30, 0x32, 0x2E, 0x30, 0x31, 0x33, 0x2E, 0x30, 0x32, 0x33, 0x2E, 0x2F, 0x32, 0x33, 0x2E, 0x2F, 0x31, 0x33, 0x2E, 0x30, 0x32, 0x34, 0x2E, 0x31, 0x33, 0x34, 0x2E, 0x2F, 0x33, 0x34, 0x2E, 0x2F, 0x31, 0x34, 0x2E, 0x34, 0x34, 0x34, 0x2E, 0x2E, 0x34, 0x34, 0x2E, 0x2E, 0x2E, 0x34, 0x2E, 0x31, 0x32, 0x35, 0x2E, 0x31, 0x34, 0x35, 0x2E, 0x2F, 0x34, 0x35, 0x2E, 0x2F, 0x32, 0x35, 0x2E, 0x31, 0x33, 0x36, 0x2E, 0x32, 0x34, 0x36, 0x2E, 0x30, 0x34, 0x36, 0x2E, 0x30, 0x32, 0x36, 0x2E, 0x36, 0x36, 0x36, 0x2E, 0x2E, 0x36, 0x36, 0x2E, 0x2E, 0x2E, 0x36, 0x2E, 0x32, 0x35, 0x39, 0x2E, 0x33, 0x37, 0x39, 0x2E, 0x30, 0x37, 0x39, 0x2E, 0x30, 0x34, 0x39, 0x2E, 0x39, 0x39, 0x39, 0x2E, 0x2E, 0x39, 0x39, 0x2E, 0x2E, 0x2E, 0x39, 0x2E, 0x33, 0x37, 0x3C, 0x2E, 0x35, 0x39, 0x3C, 0x2E, 0x31, 0x39, 0x3C, 0x2E, 0x31, 0x35, 0x3C, 0x2E, 0x3C, 0x3C, 0x3C, 0x2E, 0x2E, 0x3C, 0x3C, 0x2E, 0x2E, 0x2E, 0x3C, 0x2E, 0x34, 0x39, 0x3F, 0x2E, 0x36, 0x3B, 0x3F, 0x2E, 0x32, 0x3B, 0x3F, 0x2E, 0x32, 0x37, 0x3F, 0x2E, 0x3F, 0x3F, 0x3F, 0x2E, 0x2E, 0x3F, 0x3F, 0x2E, 0x2E, 0x2E, 0x3F, 0x2F, 0x30, 0x30, 0x31, 0x2F, 0x30, 0x31, 0x32, 0x2F, 0x31, 0x32, 0x33, 0x2F, 0x30, 0x32, 0x33, 0x2F, 0x30, 0x31, 0x33, 0x2F, 0x31, 0x32, 0x34, 0x2F, 0x31, 0x33, 0x34, 0x2F, 0x30, 0x33, 0x34, 0x2F, 0x30, 0x32, 0x34, 0x2F, 0x31, 0x33, 0x35, 0x2F, 0x32, 0x34, 0x35, 0x2F, 0x30, 0x34, 0x35, 0x2F, 0x30, 0x32, 0x35, 0x2F, 0x35, 0x35, 0x35, 0x2F, 0x2F, 0x35, 0x35, 0x2F, 0x2F, 0x2F, 0x35, 0x2F, 0x32, 0x33, 0x36, 0x2F, 0x32, 0x35, 0x36, 0x2F, 0x30, 0x35, 0x36, 0x2F, 0x30, 0x33, 0x36, 0x2F, 0x32, 0x34, 0x37, 0x2F, 0x33, 0x35, 0x37, 0x2F, 0x31, 0x35, 0x37, 0x2F, 0x31, 0x33, 0x37, 0x2F, 0x37, 0x37, 0x37, 0x2F, 0x2F, 0x37, 0x37, 0x2F, 0x2F, 0x2F, 0x37, 0x2F, 0x33, 0x36, 0x3A, 0x2F, 0x34, 0x38, 0x3A, 0x2F, 0x31, 0x38, 0x3A, 0x2F, 0x31, 0x35, 0x3A, 0x2F, 0x3A, 0x3A, 0x3A, 0x2F, 0x2F, 0x3A, 0x3A, 0x2F, 0x2F, 0x2F, 0x3A, 0x2F, 0x34, 0x38, 0x3D, 0x2F, 0x36, 0x3A, 0x3D, 0x2F, 0x32, 0x3A, 0x3D, 0x2F, 0x32, 0x36, 0x3D, 0x2F, 0x3D, 0x3D, 0x3D, 0x2F, 0x2F, 0x3D, 0x3D, 0x2F, 0x2F, 0x2F, 0x3D, 0x30, 0x31, 0x31, 0x32, 0x30, 0x31, 0x32, 0x33, 0x30, 0x32, 0x33, 0x34, 0x30, 0x31, 0x33, 0x34, 0x30, 0x31, 0x32, 0x34, 0x30, 0x32, 0x33, 0x35, 0x30, 0x32, 0x34, 0x35, 0x30, 0x31, 0x34, 0x35, 0x30, 0x31, 0x33, 0x35, 0x30, 0x32, 0x34, 0x36, 0x30, 0x33, 0x35, 0x36, 0x30, 0x31, 0x35, 0x36, 0x30, 0x31, 0x33, 0x36, 0x30, 0x36, 0x36, 0x36, 0x30, 0x30, 0x36, 0x36, 0x30, 0x30, 0x30, 0x36, 0x30, 0x33, 0x34, 0x37, 0x30, 0x33, 0x36, 0x37, 0x30, 0x31, 0x36, 0x37, 0x30, 0x31, 0x34, 0x37, 0x30, 0x33, 0x35, 0x38, 0x30, 0x34, 0x36, 0x38, 0x30, 0x32, 0x36, 0x38, 0x30, 0x32, 0x34, 0x38, 0x30, 0x38, 0x38, 0x38, 0x30, 0x30, 0x38, 0x38, 0x30, 0x30, 0x30, 0x38, 0x30, 0x34, 0x37, 0x3B, 0x30, 0x35, 0x39, 0x3B, 0x30, 0x32, 0x39, 0x3B, 0x30, 0x32, 0x36, 0x3B, 0x30, 0x3B, 0x3B, 0x3B, 0x30, 0x30, 0x3B, 0x3B, 0x30, 0x30, 0x30, 0x3B, 0x30, 0x35, 0x39, 0x3E, 0x30, 0x37, 0x3B, 0x3E, 0x30, 0x33, 0x3B, 0x3E, 0x30, 0x33, 0x37, 0x3E, 0x30, 0x3E, 0x3E, 0x3E, 0x30, 0x30, 0x3E, 0x3E, 0x30, 0x30, 0x30, 0x3E, 0x31, 0x32, 0x32, 0x33, 0x31, 0x32, 0x33, 0x34, 0x31, 0x33, 0x34, 0x35, 0x31, 0x32, 0x34, 0x35, 0x31, 0x32, 0x33, 0x35, 0x31, 0x33, 0x34, 0x36, 0x31, 0x33, 0x35, 0x36, 0x31, 0x32, 0x35, 0x36, 0x31, 0x32, 0x34, 0x36, 0x31, 0x33, 0x35, 0x37, 0x31, 0x34, 0x36, 0x37, 0x31, 0x32, 0x36, 0x37, 0x31, 0x32, 0x34, 0x37, 0x31, 0x37, 0x37, 0x37, 0x31, 0x31, 0x37, 0x37, 0x31, 0x31, 0x31, 0x37, 0x31, 0x34, 0x35, 0x38, 0x31, 0x34, 0x37, 0x38, 0x31, 0x32, 0x37, 0x38, 0x31, 0x32, 0x35, 0x38, 0x31, 0x34, 0x36, 0x39, 0x31, 0x35, 0x37, 0x39, 0x31, 0x33, 0x37, 0x39, 0x31, 0x33, 0x35, 0x39, 0x31, 0x39, 0x39, 0x39, 0x31, 0x31, 0x39, 0x39, 0x31, 0x31, 0x31, 0x39, 0x31, 0x35, 0x38, 0x3C, 0x31, 0x36, 0x3A, 0x3C, 0x31, 0x33, 0x3A, 0x3C, 0x31, 0x33, 0x37, 0x3C, 0x31, 0x3C, 0x3C, 0x3C, 0x31, 0x31, 0x3C, 0x3C, 0x31, 0x31, 0x31, 0x3C, 0x31, 0x36, 0x3A, 0x3F, 0x31, 0x38, 0x3C, 0x3F, 0x31, 0x34, 0x3C, 0x3F, 0x31, 0x34, 0x38, 0x3F, 0x31, 0x3F, 0x3F, 0x3F, 0x31, 0x31, 0x3F, 0x3F, 0x31, 0x31, 0x31, 0x3F, 0x32, 0x33, 0x33, 0x34, 0x32, 0x33, 0x34, 0x35, 0x32, 0x34, 0x35, 0x36, 0x32, 0x33, 0x35, 0x36, 0x32, 0x33, 0x34, 0x36, 0x32, 0x34, 0x35, 0x37, 0x32, 0x34, 0x36, 0x37, 0x32, 0x33, 0x36, 0x37, 0x32, 0x33, 0x35, 0x37, 0x32, 0x34, 0x36, 0x38, 0x32, 0x35, 0x37, 0x38, 0x32, 0x33, 0x37, 0x38, 0x32, 0x33, 0x35, 0x38, 0x32, 0x38, 0x38, 0x38, 0x32, 0x32, 0x38, 0x38, 0x32, 0x32, 0x32, 0x38, 0x32, 0x35, 0x36, 0x39, 0x32, 0x35, 0x38, 0x39, 0x32, 0x33, 0x38, 0x39, 0x32, 0x33, 0x36, 0x39, 0x32, 0x35, 0x37, 0x3A, 0x32, 0x36, 0x38, 0x3A, 0x32, 0x34, 0x38, 0x3A, 0x32, 0x34, 0x36, 0x3A, 0x32, 0x3A, 0x3A, 0x3A, 0x32, 0x32, 0x3A, 0x3A, 0x32, 0x32, 0x32, 0x3A, 0x32, 0x36, 0x39, 0x3D, 0x32, 0x37, 0x3B, 0x3D, 0x32, 0x34, 0x3B, 0x3D, 0x32, 0x34, 0x38, 0x3D, 0x32, 0x3D, 0x3D, 0x3D, 0x32, 0x32, 0x3D, 0x3D, 0x32, 0x32, 0x32, 0x3D, 0x33, 0x34, 0x34, 0x35, 0x33, 0x34, 0x35, 0x36, 0x33, 0x35, 0x36, 0x37, 0x33, 0x34, 0x36, 0x37, 0x33, 0x34, 0x35, 0x37, 0x33, 0x35, 0x36, 0x38, 0x33, 0x35, 0x37, 0x38, 0x33, 0x34, 0x37, 0x38, 0x33, 0x34, 0x36, 0x38, 0x33, 0x35, 0x37, 0x39, 0x33, 0x36, 0x38, 0x39, 0x33, 0x34, 0x38, 0x39, 0x33, 0x34, 0x36, 0x39, 0x33, 0x39, 0x39, 0x39, 0x33, 0x33, 0x39, 0x39, 0x33, 0x33, 0x33, 0x39, 0x33, 0x36, 0x37, 0x3A, 0x33, 0x36, 0x39, 0x3A, 0x33, 0x34, 0x39, 0x3A, 0x33, 0x34, 0x37, 0x3A, 0x33, 0x36, 0x38, 0x3B, 0x33, 0x37, 0x39, 0x3B, 0x33, 0x35, 0x39, 0x3B, 0x33, 0x35, 0x37, 0x3B, 0x33, 0x3B, 0x3B, 0x3B, 0x33, 0x33, 0x3B, 0x3B, 0x33, 0x33, 0x33, 0x3B, 0x33, 0x37, 0x3A, 0x3E, 0x33, 0x38, 0x3C, 0x3E, 0x33, 0x35, 0x3C, 0x3E, 0x33, 0x35, 0x39, 0x3E, 0x33, 0x3E, 0x3E, 0x3E, 0x33, 0x33, 0x3E, 0x3E, 0x33, 0x33, 0x33, 0x3E, 0x34, 0x35, 0x35, 0x36, 0x34, 0x35, 0x36, 0x37, 0x34, 0x36, 0x37, 0x38, 0x34, 0x35, 0x37, 0x38, 0x34, 0x35, 0x36, 0x38, 0x34, 0x36, 0x37, 0x39, 0x34, 0x36, 0x38, 0x39, 0x34, 0x35, 0x38, 0x39, 0x34, 0x35, 0x37, 0x39, 0x34, 0x36, 0x38, 0x3A, 0x34, 0x37, 0x39, 0x3A, 0x34, 0x35, 0x39, 0x3A, 0x34, 0x35, 0x37, 0x3A, 0x34, 0x3A, 0x3A, 0x3A, 0x34, 0x34, 0x3A, 0x3A, 0x34, 0x34, 0x34, 0x3A, 0x34, 0x37, 0x38, 0x3B, 0x34, 0x37, 0x3A, 0x3B, 0x34, 0x35, 0x3A, 0x3B, 0x34, 0x35, 0x38, 0x3B, 0x34, 0x37, 0x39, 0x3C, 0x34, 0x38, 0x3A, 0x3C, 0x34, 0x36, 0x3A, 0x3C, 0x34, 0x36, 0x38, 0x3C, 0x34, 0x3C, 0x3C, 0x3C, 0x34, 0x34, 0x3C, 0x3C, 0x34, 0x34, 0x34, 0x3C, 0x34, 0x38, 0x3B, 0x3F, 0x34, 0x39, 0x3D, 0x3F, 0x34, 0x36, 0x3D, 0x3F, 0x34, 0x36, 0x3A, 0x3F, 0x34, 0x3F, 0x3F, 0x3F, 0x34, 0x34, 0x3F, 0x3F, 0x34, 0x34, 0x34, 0x3F, 0x35, 0x36, 0x36, 0x37, 0x35, 0x36, 0x37, 0x38, 0x35, 0x37, 0x38, 0x39, 0x35, 0x36, 0x38, 0x39, 0x35, 0x36, 0x37, 0x39, 0x35, 0x37, 0x38, 0x3A, 0x35, 0x37, 0x39, 0x3A, 0x35, 0x36, 0x39, 0x3A, 0x35, 0x36, 0x38, 0x3A, 0x35, 0x37, 0x39, 0x3B, 0x35, 0x38, 0x3A, 0x3B, 0x35, 0x36, 0x3A, 0x3B, 0x35, 0x36, 0x38, 0x3B, 0x35, 0x3B, 0x3B, 0x3B, 0x35, 0x35, 0x3B, 0x3B, 0x35, 0x35, 0x35, 0x3B, 0x35, 0x38, 0x39, 0x3C, 0x35, 0x38, 0x3B, 0x3C, 0x35, 0x36, 0x3B, 0x3C, 0x35, 0x36, 0x39, 0x3C, 0x35, 0x38, 0x3A, 0x3D, 0x35, 0x39, 0x3B, 0x3D, 0x35, 0x37, 0x3B, 0x3D, 0x35, 0x37, 0x39, 0x3D, 0x35, 0x3D, 0x3D, 0x3D, 0x35, 0x35, 0x3D, 0x3D, 0x35, 0x35, 0x35, 0x3D, 0x36, 0x37, 0x37, 0x38, 0x36, 0x37, 0x38, 0x39, 0x36, 0x38, 0x39, 0x3A, 0x36, 0x37, 0x39, 0x3A, 0x36, 0x37, 0x38, 0x3A, 0x36, 0x38, 0x39, 0x3B, 0x36, 0x38, 0x3A, 0x3B, 0x36, 0x37, 0x3A, 0x3B, 0x36, 0x37, 0x39, 0x3B, 0x36, 0x38, 0x3A, 0x3C, 0x36, 0x39, 0x3B, 0x3C, 0x36, 0x37, 0x3B, 0x3C, 0x36, 0x37, 0x39, 0x3C, 0x36, 0x3C, 0x3C, 0x3C, 0x36, 0x36, 0x3C, 0x3C, 0x36, 0x36, 0x36, 0x3C, 0x36, 0x39, 0x3A, 0x3D, 0x36, 0x39, 0x3C, 0x3D, 0x36, 0x37, 0x3C, 0x3D, 0x36, 0x37, 0x3A, 0x3D, 0x36, 0x39, 0x3B, 0x3E, 0x36, 0x3A, 0x3C, 0x3E, 0x36, 0x38, 0x3C, 0x3E, 0x36, 0x38, 0x3A, 0x3E, 0x36, 0x3E, 0x3E, 0x3E, 0x36, 0x36, 0x3E, 0x3E, 0x36, 0x36, 0x36, 0x3E, 0x37, 0x38, 0x38, 0x39, 0x37, 0x38, 0x39, 0x3A, 0x37, 0x39, 0x3A, 0x3B, 0x37, 0x38, 0x3A, 0x3B, 0x37, 0x38, 0x39, 0x3B, 0x37, 0x39, 0x3A, 0x3C, 0x37, 0x39, 0x3B, 0x3C, 0x37, 0x38, 0x3B, 0x3C, 0x37, 0x38, 0x3A, 0x3C, 0x37, 0x39, 0x3B, 0x3D, 0x37, 0x3A, 0x3C, 0x3D, 0x37, 0x38, 0x3C, 0x3D, 0x37, 0x38, 0x3A, 0x3D, 0x37, 0x3D, 0x3D, 0x3D, 0x37, 0x37, 0x3D, 0x3D, 0x37, 0x37, 0x37, 0x3D, 0x37, 0x3A, 0x3B, 0x3E, 0x37, 0x3A, 0x3D, 0x3E, 0x37, 0x38, 0x3D, 0x3E, 0x37, 0x38, 0x3B, 0x3E, 0x37, 0x3A, 0x3C, 0x3F, 0x37, 0x3B, 0x3D, 0x3F, 0x37, 0x39, 0x3D, 0x3F, 0x37, 0x39, 0x3B, 0x3F, 0x37, 0x3F, 0x3F, 0x3F, 0x37, 0x37, 0x3F, 0x3F, 0x37, 0x37, 0x37, 0x3F, 0x38, 0x39, 0x39, 0x3A, 0x38, 0x39, 0x3A, 0x3B, 0x38, 0x3A, 0x3B, 0x3C, 0x38, 0x39, 0x3B, 0x3C, 0x38, 0x39, 0x3A, 0x3C, 0x38, 0x3A, 0x3B, 0x3D, 0x38, 0x3A, 0x3C, 0x3D, 0x38, 0x39, 0x3C, 0x3D, 0x38, 0x39, 0x3B, 0x3D, 0x38, 0x3A, 0x3C, 0x3E, 0x38, 0x3B, 0x3D, 0x3E, 0x38, 0x39, 0x3D, 0x3E, 0x38, 0x39, 0x3B, 0x3E, 0x38, 0x3E, 0x3E, 0x3E, 0x38, 0x38, 0x3E, 0x3E, 0x38, 0x38, 0x38, 0x3E, 0x38, 0x3B, 0x3C, 0x3F, 0x38, 0x3B, 0x3E, 0x3F, 0x38, 0x39, 0x3E, 0x3F, 0x38, 0x39, 0x3C, 0x3F, 0x39, 0x3A, 0x3A, 0x3B, 0x39, 0x3A, 0x3B, 0x3C, 0x39, 0x3B, 0x3C, 0x3D, 0x39, 0x3A, 0x3C, 0x3D, 0x39, 0x3A, 0x3B, 0x3D, 0x39, 0x3B, 0x3C, 0x3E, 0x39, 0x3B, 0x3D, 0x3E, 0x39, 0x3A, 0x3D, 0x3E, 0x39, 0x3A, 0x3C, 0x3E, 0x39, 0x3B, 0x3D, 0x3F, 0x39, 0x3C, 0x3E, 0x3F, 0x39, 0x3A, 0x3E, 0x3F, 0x39, 0x3A, 0x3C, 0x3F, 0x39, 0x3F, 0x3F, 0x3F, 0x39, 0x39, 0x3F, 0x3F, 0x39, 0x39, 0x39, 0x3F, 0x3A, 0x3B, 0x3B, 0x3C, 0x3A, 0x3B, 0x3C, 0x3D, 0x3A, 0x3C, 0x3D, 0x3E, 0x3A, 0x3B, 0x3D, 0x3E, 0x3A, 0x3B, 0x3C, 0x3E, 0x3A, 0x3C, 0x3D, 0x3F, 0x3A, 0x3C, 0x3E, 0x3F, 0x3A, 0x3B, 0x3E, 0x3F, 0x3A, 0x3B, 0x3D, 0x3F, 0x3B, 0x3C, 0x3C, 0x3D, 0x3B, 0x3C, 0x3D, 0x3E, 0x3B, 0x3D, 0x3E, 0x3F, 0x3B, 0x3C, 0x3E, 0x3F, 0x3B, 0x3C, 0x3D, 0x3F, 0x3C, 0x3D, 0x3D, 0x3E, 0x3C, 0x3D, 0x3E, 0x3F, 0x3D, 0x3E, 0x3E, 0x3F }; #endif /* AVCODEC_ULTI_CB_H */
123linslouis-android-video-cutter
jni/libavcodec/ulti_cb.h
C
asf20
115,666
/* * VC-1 and WMV3 decoder * Copyright (c) 2006-2007 Konstantin Shishkov * Partly based on vc9.c (c) 2005 Anonymous, Alex Beregszaszi, Michael Niedermayer * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVCODEC_VC1_H #define AVCODEC_VC1_H #include "avcodec.h" #include "mpegvideo.h" #include "intrax8.h" /** Markers used in VC-1 AP frame data */ //@{ enum VC1Code{ VC1_CODE_RES0 = 0x00000100, VC1_CODE_ENDOFSEQ = 0x0000010A, VC1_CODE_SLICE, VC1_CODE_FIELD, VC1_CODE_FRAME, VC1_CODE_ENTRYPOINT, VC1_CODE_SEQHDR, }; //@} #define IS_MARKER(x) (((x) & ~0xFF) == VC1_CODE_RES0) /** Available Profiles */ //@{ enum Profile { PROFILE_SIMPLE, PROFILE_MAIN, PROFILE_COMPLEX, ///< TODO: WMV9 specific PROFILE_ADVANCED }; //@} /** Sequence quantizer mode */ //@{ enum QuantMode { QUANT_FRAME_IMPLICIT, ///< Implicitly specified at frame level QUANT_FRAME_EXPLICIT, ///< Explicitly specified at frame level QUANT_NON_UNIFORM, ///< Non-uniform quant used for all frames QUANT_UNIFORM ///< Uniform quant used for all frames }; //@} /** Where quant can be changed */ //@{ enum DQProfile { DQPROFILE_FOUR_EDGES, DQPROFILE_DOUBLE_EDGES, DQPROFILE_SINGLE_EDGE, DQPROFILE_ALL_MBS }; //@} /** @name Where quant can be changed */ //@{ enum DQSingleEdge { DQSINGLE_BEDGE_LEFT, DQSINGLE_BEDGE_TOP, DQSINGLE_BEDGE_RIGHT, DQSINGLE_BEDGE_BOTTOM }; //@} /** Which pair of edges is quantized with ALTPQUANT */ //@{ enum DQDoubleEdge { DQDOUBLE_BEDGE_TOPLEFT, DQDOUBLE_BEDGE_TOPRIGHT, DQDOUBLE_BEDGE_BOTTOMRIGHT, DQDOUBLE_BEDGE_BOTTOMLEFT }; //@} /** MV modes for P frames */ //@{ enum MVModes { MV_PMODE_1MV_HPEL_BILIN, MV_PMODE_1MV, MV_PMODE_1MV_HPEL, MV_PMODE_MIXED_MV, MV_PMODE_INTENSITY_COMP }; //@} /** @name MV types for B frames */ //@{ enum BMVTypes { BMV_TYPE_BACKWARD, BMV_TYPE_FORWARD, BMV_TYPE_INTERPOLATED }; //@} /** @name Block types for P/B frames */ //@{ enum TransformTypes { TT_8X8, TT_8X4_BOTTOM, TT_8X4_TOP, TT_8X4, //Both halves TT_4X8_RIGHT, TT_4X8_LEFT, TT_4X8, //Both halves TT_4X4 }; //@} enum CodingSet { CS_HIGH_MOT_INTRA = 0, CS_HIGH_MOT_INTER, CS_LOW_MOT_INTRA, CS_LOW_MOT_INTER, CS_MID_RATE_INTRA, CS_MID_RATE_INTER, CS_HIGH_RATE_INTRA, CS_HIGH_RATE_INTER }; /** @name Overlap conditions for Advanced Profile */ //@{ enum COTypes { CONDOVER_NONE = 0, CONDOVER_ALL, CONDOVER_SELECT }; //@} /** The VC1 Context * @todo Change size wherever another size is more efficient * Many members are only used for Advanced Profile */ typedef struct VC1Context{ MpegEncContext s; IntraX8Context x8; int bits; /** Simple/Main Profile sequence header */ //@{ int res_sm; ///< reserved, 2b int res_x8; ///< reserved int multires; ///< frame-level RESPIC syntax element present int res_fasttx; ///< reserved, always 1 int res_transtab; ///< reserved, always 0 int rangered; ///< RANGEREDFRM (range reduction) syntax element present ///< at frame level int res_rtm_flag; ///< reserved, set to 1 int reserved; ///< reserved //@} /** Advanced Profile */ //@{ int level; ///< 3bits, for Advanced/Simple Profile, provided by TS layer int chromaformat; ///< 2bits, 2=4:2:0, only defined int postprocflag; ///< Per-frame processing suggestion flag present int broadcast; ///< TFF/RFF present int interlace; ///< Progressive/interlaced (RPTFTM syntax element) int tfcntrflag; ///< TFCNTR present int panscanflag; ///< NUMPANSCANWIN, TOPLEFT{X,Y}, BOTRIGHT{X,Y} present int refdist_flag; ///< REFDIST syntax element present in II, IP, PI or PP field picture headers int extended_dmv; ///< Additional extended dmv range at P/B frame-level int color_prim; ///< 8bits, chroma coordinates of the color primaries int transfer_char; ///< 8bits, Opto-electronic transfer characteristics int matrix_coef; ///< 8bits, Color primaries->YCbCr transform matrix int hrd_param_flag; ///< Presence of Hypothetical Reference ///< Decoder parameters int psf; ///< Progressive Segmented Frame //@} /** Sequence header data for all Profiles * TODO: choose between ints, uint8_ts and monobit flags */ //@{ int profile; ///< 2bits, Profile int frmrtq_postproc; ///< 3bits, int bitrtq_postproc; ///< 5bits, quantized framerate-based postprocessing strength int fastuvmc; ///< Rounding of qpel vector to hpel ? (not in Simple) int extended_mv; ///< Ext MV in P/B (not in Simple) int dquant; ///< How qscale varies with MBs, 2bits (not in Simple) int vstransform; ///< variable-size [48]x[48] transform type + info int overlap; ///< overlapped transforms in use int quantizer_mode; ///< 2bits, quantizer mode used for sequence, see QUANT_* int finterpflag; ///< INTERPFRM present //@} /** Frame decoding info for all profiles */ //@{ uint8_t mv_mode; ///< MV coding monde uint8_t mv_mode2; ///< Secondary MV coding mode (B frames) int k_x; ///< Number of bits for MVs (depends on MV range) int k_y; ///< Number of bits for MVs (depends on MV range) int range_x, range_y; ///< MV range uint8_t pq, altpq; ///< Current/alternate frame quantizer scale const uint8_t* zz_8x4;///< Zigzag scan table for TT_8x4 coding mode const uint8_t* zz_4x8;///< Zigzag scan table for TT_4x8 coding mode /** pquant parameters */ //@{ uint8_t dquantfrm; uint8_t dqprofile; uint8_t dqsbedge; uint8_t dqbilevel; //@} /** AC coding set indexes * @see 8.1.1.10, p(1)10 */ //@{ int c_ac_table_index; ///< Chroma index from ACFRM element int y_ac_table_index; ///< Luma index from AC2FRM element //@} int ttfrm; ///< Transform type info present at frame level uint8_t ttmbf; ///< Transform type flag uint8_t ttblk4x4; ///< Value of ttblk which indicates a 4x4 transform int codingset; ///< index of current table set from 11.8 to use for luma block decoding int codingset2; ///< index of current table set from 11.8 to use for chroma block decoding int pqindex; ///< raw pqindex used in coding set selection int a_avail, c_avail; uint8_t *mb_type_base, *mb_type[3]; /** Luma compensation parameters */ //@{ uint8_t lumscale; uint8_t lumshift; //@} int16_t bfraction; ///< Relative position % anchors=> how to scale MVs uint8_t halfpq; ///< Uniform quant over image and qp+.5 uint8_t respic; ///< Frame-level flag for resized images int buffer_fullness; ///< HRD info /** Ranges: * -# 0 -> [-64n 63.f] x [-32, 31.f] * -# 1 -> [-128, 127.f] x [-64, 63.f] * -# 2 -> [-512, 511.f] x [-128, 127.f] * -# 3 -> [-1024, 1023.f] x [-256, 255.f] */ uint8_t mvrange; uint8_t pquantizer; ///< Uniform (over sequence) quantizer in use VLC *cbpcy_vlc; ///< CBPCY VLC table int tt_index; ///< Index for Transform Type tables uint8_t* mv_type_mb_plane; ///< bitplane for mv_type == (4MV) uint8_t* direct_mb_plane; ///< bitplane for "direct" MBs int mv_type_is_raw; ///< mv type mb plane is not coded int dmb_is_raw; ///< direct mb plane is raw int skip_is_raw; ///< skip mb plane is not coded uint8_t luty[256], lutuv[256]; // lookup tables used for intensity compensation int use_ic; ///< use intensity compensation in B-frames int rnd; ///< rounding control /** Frame decoding info for S/M profiles only */ //@{ uint8_t rangeredfrm; ///< out_sample = CLIP((in_sample-128)*2+128) uint8_t interpfrm; //@} /** Frame decoding info for Advanced profile */ //@{ uint8_t fcm; ///< 0->Progressive, 2->Frame-Interlace, 3->Field-Interlace uint8_t numpanscanwin; uint8_t tfcntr; uint8_t rptfrm, tff, rff; uint16_t topleftx; uint16_t toplefty; uint16_t bottomrightx; uint16_t bottomrighty; uint8_t uvsamp; uint8_t postproc; int hrd_num_leaky_buckets; uint8_t bit_rate_exponent; uint8_t buffer_size_exponent; uint8_t* acpred_plane; ///< AC prediction flags bitplane int acpred_is_raw; uint8_t* over_flags_plane; ///< Overflags bitplane int overflg_is_raw; uint8_t condover; uint16_t *hrd_rate, *hrd_buffer; uint8_t *hrd_fullness; uint8_t range_mapy_flag; uint8_t range_mapuv_flag; uint8_t range_mapy; uint8_t range_mapuv; //@} int p_frame_skipped; int bi_type; int x8_type; uint32_t *cbp_base, *cbp; uint8_t bfraction_lut_index;///< Index for BFRACTION value (see Table 40, reproduced into ff_vc1_bfraction_lut[]) uint8_t broken_link; ///< Broken link flag (BROKEN_LINK syntax element) uint8_t closed_entry; ///< Closed entry point flag (CLOSED_ENTRY syntax element) int parse_only; ///< Context is used within parser int warn_interlaced; } VC1Context; /** Find VC-1 marker in buffer * @return position where next marker starts or end of buffer if no marker found */ static av_always_inline const uint8_t* find_next_marker(const uint8_t *src, const uint8_t *end) { uint32_t mrk = 0xFFFFFFFF; if(end-src < 4) return end; while(src < end){ mrk = (mrk << 8) | *src++; if(IS_MARKER(mrk)) return src-4; } return end; } static av_always_inline int vc1_unescape_buffer(const uint8_t *src, int size, uint8_t *dst) { int dsize = 0, i; if(size < 4){ for(dsize = 0; dsize < size; dsize++) *dst++ = *src++; return size; } for(i = 0; i < size; i++, src++) { if(src[0] == 3 && i >= 2 && !src[-1] && !src[-2] && i < size-1 && src[1] < 4) { dst[dsize++] = src[1]; src++; i++; } else dst[dsize++] = *src; } return dsize; } /** * Decode Simple/Main Profiles sequence header * @see Figure 7-8, p16-17 * @param avctx Codec context * @param gb GetBit context initialized from Codec context extra_data * @return Status */ int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb); int vc1_decode_entry_point(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb); int vc1_parse_frame_header (VC1Context *v, GetBitContext *gb); int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext *gb); #endif /* AVCODEC_VC1_H */
123linslouis-android-video-cutter
jni/libavcodec/vc1.h
C
asf20
11,699
/* * The simplest mpeg audio layer 2 encoder * Copyright (c) 2000, 2001 Fabrice Bellard * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * The simplest mpeg audio layer 2 encoder. */ #include "avcodec.h" #include "put_bits.h" #undef CONFIG_MPEGAUDIO_HP #define CONFIG_MPEGAUDIO_HP 0 #include "mpegaudio.h" /* currently, cannot change these constants (need to modify quantization stage) */ #define MUL(a,b) (((int64_t)(a) * (int64_t)(b)) >> FRAC_BITS) #define SAMPLES_BUF_SIZE 4096 typedef struct MpegAudioContext { PutBitContext pb; int nb_channels; int freq, bit_rate; int lsf; /* 1 if mpeg2 low bitrate selected */ int bitrate_index; /* bit rate */ int freq_index; int frame_size; /* frame size, in bits, without padding */ int64_t nb_samples; /* total number of samples encoded */ /* padding computation */ int frame_frac, frame_frac_incr, do_padding; short samples_buf[MPA_MAX_CHANNELS][SAMPLES_BUF_SIZE]; /* buffer for filter */ int samples_offset[MPA_MAX_CHANNELS]; /* offset in samples_buf */ int sb_samples[MPA_MAX_CHANNELS][3][12][SBLIMIT]; unsigned char scale_factors[MPA_MAX_CHANNELS][SBLIMIT][3]; /* scale factors */ /* code to group 3 scale factors */ unsigned char scale_code[MPA_MAX_CHANNELS][SBLIMIT]; int sblimit; /* number of used subbands */ const unsigned char *alloc_table; } MpegAudioContext; /* define it to use floats in quantization (I don't like floats !) */ #define USE_FLOATS #include "mpegaudiodata.h" #include "mpegaudiotab.h" static av_cold int MPA_encode_init(AVCodecContext *avctx) { MpegAudioContext *s = avctx->priv_data; int freq = avctx->sample_rate; int bitrate = avctx->bit_rate; int channels = avctx->channels; int i, v, table; float a; if (channels <= 0 || channels > 2){ av_log(avctx, AV_LOG_ERROR, "encoding %d channel(s) is not allowed in mp2\n", channels); return -1; } bitrate = bitrate / 1000; s->nb_channels = channels; s->freq = freq; s->bit_rate = bitrate * 1000; avctx->frame_size = MPA_FRAME_SIZE; /* encoding freq */ s->lsf = 0; for(i=0;i<3;i++) { if (ff_mpa_freq_tab[i] == freq) break; if ((ff_mpa_freq_tab[i] / 2) == freq) { s->lsf = 1; break; } } if (i == 3){ av_log(avctx, AV_LOG_ERROR, "Sampling rate %d is not allowed in mp2\n", freq); return -1; } s->freq_index = i; /* encoding bitrate & frequency */ for(i=0;i<15;i++) { if (ff_mpa_bitrate_tab[s->lsf][1][i] == bitrate) break; } if (i == 15){ av_log(avctx, AV_LOG_ERROR, "bitrate %d is not allowed in mp2\n", bitrate); return -1; } s->bitrate_index = i; /* compute total header size & pad bit */ a = (float)(bitrate * 1000 * MPA_FRAME_SIZE) / (freq * 8.0); s->frame_size = ((int)a) * 8; /* frame fractional size to compute padding */ s->frame_frac = 0; s->frame_frac_incr = (int)((a - floor(a)) * 65536.0); /* select the right allocation table */ table = ff_mpa_l2_select_table(bitrate, s->nb_channels, freq, s->lsf); /* number of used subbands */ s->sblimit = ff_mpa_sblimit_table[table]; s->alloc_table = ff_mpa_alloc_tables[table]; dprintf(avctx, "%d kb/s, %d Hz, frame_size=%d bits, table=%d, padincr=%x\n", bitrate, freq, s->frame_size, table, s->frame_frac_incr); for(i=0;i<s->nb_channels;i++) s->samples_offset[i] = 0; for(i=0;i<257;i++) { int v; v = ff_mpa_enwindow[i]; #if WFRAC_BITS != 16 v = (v + (1 << (16 - WFRAC_BITS - 1))) >> (16 - WFRAC_BITS); #endif filter_bank[i] = v; if ((i & 63) != 0) v = -v; if (i != 0) filter_bank[512 - i] = v; } for(i=0;i<64;i++) { v = (int)(pow(2.0, (3 - i) / 3.0) * (1 << 20)); if (v <= 0) v = 1; scale_factor_table[i] = v; #ifdef USE_FLOATS scale_factor_inv_table[i] = pow(2.0, -(3 - i) / 3.0) / (float)(1 << 20); #else #define P 15 scale_factor_shift[i] = 21 - P - (i / 3); scale_factor_mult[i] = (1 << P) * pow(2.0, (i % 3) / 3.0); #endif } for(i=0;i<128;i++) { v = i - 64; if (v <= -3) v = 0; else if (v < 0) v = 1; else if (v == 0) v = 2; else if (v < 3) v = 3; else v = 4; scale_diff_table[i] = v; } for(i=0;i<17;i++) { v = ff_mpa_quant_bits[i]; if (v < 0) v = -v; else v = v * 3; total_quant_bits[i] = 12 * v; } avctx->coded_frame= avcodec_alloc_frame(); avctx->coded_frame->key_frame= 1; return 0; } /* 32 point floating point IDCT without 1/sqrt(2) coef zero scaling */ static void idct32(int *out, int *tab) { int i, j; int *t, *t1, xr; const int *xp = costab32; for(j=31;j>=3;j-=2) tab[j] += tab[j - 2]; t = tab + 30; t1 = tab + 2; do { t[0] += t[-4]; t[1] += t[1 - 4]; t -= 4; } while (t != t1); t = tab + 28; t1 = tab + 4; do { t[0] += t[-8]; t[1] += t[1-8]; t[2] += t[2-8]; t[3] += t[3-8]; t -= 8; } while (t != t1); t = tab; t1 = tab + 32; do { t[ 3] = -t[ 3]; t[ 6] = -t[ 6]; t[11] = -t[11]; t[12] = -t[12]; t[13] = -t[13]; t[15] = -t[15]; t += 16; } while (t != t1); t = tab; t1 = tab + 8; do { int x1, x2, x3, x4; x3 = MUL(t[16], FIX(SQRT2*0.5)); x4 = t[0] - x3; x3 = t[0] + x3; x2 = MUL(-(t[24] + t[8]), FIX(SQRT2*0.5)); x1 = MUL((t[8] - x2), xp[0]); x2 = MUL((t[8] + x2), xp[1]); t[ 0] = x3 + x1; t[ 8] = x4 - x2; t[16] = x4 + x2; t[24] = x3 - x1; t++; } while (t != t1); xp += 2; t = tab; t1 = tab + 4; do { xr = MUL(t[28],xp[0]); t[28] = (t[0] - xr); t[0] = (t[0] + xr); xr = MUL(t[4],xp[1]); t[ 4] = (t[24] - xr); t[24] = (t[24] + xr); xr = MUL(t[20],xp[2]); t[20] = (t[8] - xr); t[ 8] = (t[8] + xr); xr = MUL(t[12],xp[3]); t[12] = (t[16] - xr); t[16] = (t[16] + xr); t++; } while (t != t1); xp += 4; for (i = 0; i < 4; i++) { xr = MUL(tab[30-i*4],xp[0]); tab[30-i*4] = (tab[i*4] - xr); tab[ i*4] = (tab[i*4] + xr); xr = MUL(tab[ 2+i*4],xp[1]); tab[ 2+i*4] = (tab[28-i*4] - xr); tab[28-i*4] = (tab[28-i*4] + xr); xr = MUL(tab[31-i*4],xp[0]); tab[31-i*4] = (tab[1+i*4] - xr); tab[ 1+i*4] = (tab[1+i*4] + xr); xr = MUL(tab[ 3+i*4],xp[1]); tab[ 3+i*4] = (tab[29-i*4] - xr); tab[29-i*4] = (tab[29-i*4] + xr); xp += 2; } t = tab + 30; t1 = tab + 1; do { xr = MUL(t1[0], *xp); t1[0] = (t[0] - xr); t[0] = (t[0] + xr); t -= 2; t1 += 2; xp++; } while (t >= tab); for(i=0;i<32;i++) { out[i] = tab[bitinv32[i]]; } } #define WSHIFT (WFRAC_BITS + 15 - FRAC_BITS) static void filter(MpegAudioContext *s, int ch, short *samples, int incr) { short *p, *q; int sum, offset, i, j; int tmp[64]; int tmp1[32]; int *out; // print_pow1(samples, 1152); offset = s->samples_offset[ch]; out = &s->sb_samples[ch][0][0][0]; for(j=0;j<36;j++) { /* 32 samples at once */ for(i=0;i<32;i++) { s->samples_buf[ch][offset + (31 - i)] = samples[0]; samples += incr; } /* filter */ p = s->samples_buf[ch] + offset; q = filter_bank; /* maxsum = 23169 */ for(i=0;i<64;i++) { sum = p[0*64] * q[0*64]; sum += p[1*64] * q[1*64]; sum += p[2*64] * q[2*64]; sum += p[3*64] * q[3*64]; sum += p[4*64] * q[4*64]; sum += p[5*64] * q[5*64]; sum += p[6*64] * q[6*64]; sum += p[7*64] * q[7*64]; tmp[i] = sum; p++; q++; } tmp1[0] = tmp[16] >> WSHIFT; for( i=1; i<=16; i++ ) tmp1[i] = (tmp[i+16]+tmp[16-i]) >> WSHIFT; for( i=17; i<=31; i++ ) tmp1[i] = (tmp[i+16]-tmp[80-i]) >> WSHIFT; idct32(out, tmp1); /* advance of 32 samples */ offset -= 32; out += 32; /* handle the wrap around */ if (offset < 0) { memmove(s->samples_buf[ch] + SAMPLES_BUF_SIZE - (512 - 32), s->samples_buf[ch], (512 - 32) * 2); offset = SAMPLES_BUF_SIZE - 512; } } s->samples_offset[ch] = offset; // print_pow(s->sb_samples, 1152); } static void compute_scale_factors(unsigned char scale_code[SBLIMIT], unsigned char scale_factors[SBLIMIT][3], int sb_samples[3][12][SBLIMIT], int sblimit) { int *p, vmax, v, n, i, j, k, code; int index, d1, d2; unsigned char *sf = &scale_factors[0][0]; for(j=0;j<sblimit;j++) { for(i=0;i<3;i++) { /* find the max absolute value */ p = &sb_samples[i][0][j]; vmax = abs(*p); for(k=1;k<12;k++) { p += SBLIMIT; v = abs(*p); if (v > vmax) vmax = v; } /* compute the scale factor index using log 2 computations */ if (vmax > 1) { n = av_log2(vmax); /* n is the position of the MSB of vmax. now use at most 2 compares to find the index */ index = (21 - n) * 3 - 3; if (index >= 0) { while (vmax <= scale_factor_table[index+1]) index++; } else { index = 0; /* very unlikely case of overflow */ } } else { index = 62; /* value 63 is not allowed */ } #if 0 printf("%2d:%d in=%x %x %d\n", j, i, vmax, scale_factor_table[index], index); #endif /* store the scale factor */ assert(index >=0 && index <= 63); sf[i] = index; } /* compute the transmission factor : look if the scale factors are close enough to each other */ d1 = scale_diff_table[sf[0] - sf[1] + 64]; d2 = scale_diff_table[sf[1] - sf[2] + 64]; /* handle the 25 cases */ switch(d1 * 5 + d2) { case 0*5+0: case 0*5+4: case 3*5+4: case 4*5+0: case 4*5+4: code = 0; break; case 0*5+1: case 0*5+2: case 4*5+1: case 4*5+2: code = 3; sf[2] = sf[1]; break; case 0*5+3: case 4*5+3: code = 3; sf[1] = sf[2]; break; case 1*5+0: case 1*5+4: case 2*5+4: code = 1; sf[1] = sf[0]; break; case 1*5+1: case 1*5+2: case 2*5+0: case 2*5+1: case 2*5+2: code = 2; sf[1] = sf[2] = sf[0]; break; case 2*5+3: case 3*5+3: code = 2; sf[0] = sf[1] = sf[2]; break; case 3*5+0: case 3*5+1: case 3*5+2: code = 2; sf[0] = sf[2] = sf[1]; break; case 1*5+3: code = 2; if (sf[0] > sf[2]) sf[0] = sf[2]; sf[1] = sf[2] = sf[0]; break; default: assert(0); //cannot happen code = 0; /* kill warning */ } #if 0 printf("%d: %2d %2d %2d %d %d -> %d\n", j, sf[0], sf[1], sf[2], d1, d2, code); #endif scale_code[j] = code; sf += 3; } } /* The most important function : psycho acoustic module. In this encoder there is basically none, so this is the worst you can do, but also this is the simpler. */ static void psycho_acoustic_model(MpegAudioContext *s, short smr[SBLIMIT]) { int i; for(i=0;i<s->sblimit;i++) { smr[i] = (int)(fixed_smr[i] * 10); } } #define SB_NOTALLOCATED 0 #define SB_ALLOCATED 1 #define SB_NOMORE 2 /* Try to maximize the smr while using a number of bits inferior to the frame size. I tried to make the code simpler, faster and smaller than other encoders :-) */ static void compute_bit_allocation(MpegAudioContext *s, short smr1[MPA_MAX_CHANNELS][SBLIMIT], unsigned char bit_alloc[MPA_MAX_CHANNELS][SBLIMIT], int *padding) { int i, ch, b, max_smr, max_ch, max_sb, current_frame_size, max_frame_size; int incr; short smr[MPA_MAX_CHANNELS][SBLIMIT]; unsigned char subband_status[MPA_MAX_CHANNELS][SBLIMIT]; const unsigned char *alloc; memcpy(smr, smr1, s->nb_channels * sizeof(short) * SBLIMIT); memset(subband_status, SB_NOTALLOCATED, s->nb_channels * SBLIMIT); memset(bit_alloc, 0, s->nb_channels * SBLIMIT); /* compute frame size and padding */ max_frame_size = s->frame_size; s->frame_frac += s->frame_frac_incr; if (s->frame_frac >= 65536) { s->frame_frac -= 65536; s->do_padding = 1; max_frame_size += 8; } else { s->do_padding = 0; } /* compute the header + bit alloc size */ current_frame_size = 32; alloc = s->alloc_table; for(i=0;i<s->sblimit;i++) { incr = alloc[0]; current_frame_size += incr * s->nb_channels; alloc += 1 << incr; } for(;;) { /* look for the subband with the largest signal to mask ratio */ max_sb = -1; max_ch = -1; max_smr = INT_MIN; for(ch=0;ch<s->nb_channels;ch++) { for(i=0;i<s->sblimit;i++) { if (smr[ch][i] > max_smr && subband_status[ch][i] != SB_NOMORE) { max_smr = smr[ch][i]; max_sb = i; max_ch = ch; } } } #if 0 printf("current=%d max=%d max_sb=%d alloc=%d\n", current_frame_size, max_frame_size, max_sb, bit_alloc[max_sb]); #endif if (max_sb < 0) break; /* find alloc table entry (XXX: not optimal, should use pointer table) */ alloc = s->alloc_table; for(i=0;i<max_sb;i++) { alloc += 1 << alloc[0]; } if (subband_status[max_ch][max_sb] == SB_NOTALLOCATED) { /* nothing was coded for this band: add the necessary bits */ incr = 2 + nb_scale_factors[s->scale_code[max_ch][max_sb]] * 6; incr += total_quant_bits[alloc[1]]; } else { /* increments bit allocation */ b = bit_alloc[max_ch][max_sb]; incr = total_quant_bits[alloc[b + 1]] - total_quant_bits[alloc[b]]; } if (current_frame_size + incr <= max_frame_size) { /* can increase size */ b = ++bit_alloc[max_ch][max_sb]; current_frame_size += incr; /* decrease smr by the resolution we added */ smr[max_ch][max_sb] = smr1[max_ch][max_sb] - quant_snr[alloc[b]]; /* max allocation size reached ? */ if (b == ((1 << alloc[0]) - 1)) subband_status[max_ch][max_sb] = SB_NOMORE; else subband_status[max_ch][max_sb] = SB_ALLOCATED; } else { /* cannot increase the size of this subband */ subband_status[max_ch][max_sb] = SB_NOMORE; } } *padding = max_frame_size - current_frame_size; assert(*padding >= 0); #if 0 for(i=0;i<s->sblimit;i++) { printf("%d ", bit_alloc[i]); } printf("\n"); #endif } /* * Output the mpeg audio layer 2 frame. Note how the code is small * compared to other encoders :-) */ static void encode_frame(MpegAudioContext *s, unsigned char bit_alloc[MPA_MAX_CHANNELS][SBLIMIT], int padding) { int i, j, k, l, bit_alloc_bits, b, ch; unsigned char *sf; int q[3]; PutBitContext *p = &s->pb; /* header */ put_bits(p, 12, 0xfff); put_bits(p, 1, 1 - s->lsf); /* 1 = mpeg1 ID, 0 = mpeg2 lsf ID */ put_bits(p, 2, 4-2); /* layer 2 */ put_bits(p, 1, 1); /* no error protection */ put_bits(p, 4, s->bitrate_index); put_bits(p, 2, s->freq_index); put_bits(p, 1, s->do_padding); /* use padding */ put_bits(p, 1, 0); /* private_bit */ put_bits(p, 2, s->nb_channels == 2 ? MPA_STEREO : MPA_MONO); put_bits(p, 2, 0); /* mode_ext */ put_bits(p, 1, 0); /* no copyright */ put_bits(p, 1, 1); /* original */ put_bits(p, 2, 0); /* no emphasis */ /* bit allocation */ j = 0; for(i=0;i<s->sblimit;i++) { bit_alloc_bits = s->alloc_table[j]; for(ch=0;ch<s->nb_channels;ch++) { put_bits(p, bit_alloc_bits, bit_alloc[ch][i]); } j += 1 << bit_alloc_bits; } /* scale codes */ for(i=0;i<s->sblimit;i++) { for(ch=0;ch<s->nb_channels;ch++) { if (bit_alloc[ch][i]) put_bits(p, 2, s->scale_code[ch][i]); } } /* scale factors */ for(i=0;i<s->sblimit;i++) { for(ch=0;ch<s->nb_channels;ch++) { if (bit_alloc[ch][i]) { sf = &s->scale_factors[ch][i][0]; switch(s->scale_code[ch][i]) { case 0: put_bits(p, 6, sf[0]); put_bits(p, 6, sf[1]); put_bits(p, 6, sf[2]); break; case 3: case 1: put_bits(p, 6, sf[0]); put_bits(p, 6, sf[2]); break; case 2: put_bits(p, 6, sf[0]); break; } } } } /* quantization & write sub band samples */ for(k=0;k<3;k++) { for(l=0;l<12;l+=3) { j = 0; for(i=0;i<s->sblimit;i++) { bit_alloc_bits = s->alloc_table[j]; for(ch=0;ch<s->nb_channels;ch++) { b = bit_alloc[ch][i]; if (b) { int qindex, steps, m, sample, bits; /* we encode 3 sub band samples of the same sub band at a time */ qindex = s->alloc_table[j+b]; steps = ff_mpa_quant_steps[qindex]; for(m=0;m<3;m++) { sample = s->sb_samples[ch][k][l + m][i]; /* divide by scale factor */ #ifdef USE_FLOATS { float a; a = (float)sample * scale_factor_inv_table[s->scale_factors[ch][i][k]]; q[m] = (int)((a + 1.0) * steps * 0.5); } #else { int q1, e, shift, mult; e = s->scale_factors[ch][i][k]; shift = scale_factor_shift[e]; mult = scale_factor_mult[e]; /* normalize to P bits */ if (shift < 0) q1 = sample << (-shift); else q1 = sample >> shift; q1 = (q1 * mult) >> P; q[m] = ((q1 + (1 << P)) * steps) >> (P + 1); } #endif if (q[m] >= steps) q[m] = steps - 1; assert(q[m] >= 0 && q[m] < steps); } bits = ff_mpa_quant_bits[qindex]; if (bits < 0) { /* group the 3 values to save bits */ put_bits(p, -bits, q[0] + steps * (q[1] + steps * q[2])); #if 0 printf("%d: gr1 %d\n", i, q[0] + steps * (q[1] + steps * q[2])); #endif } else { #if 0 printf("%d: gr3 %d %d %d\n", i, q[0], q[1], q[2]); #endif put_bits(p, bits, q[0]); put_bits(p, bits, q[1]); put_bits(p, bits, q[2]); } } } /* next subband in alloc table */ j += 1 << bit_alloc_bits; } } } /* padding */ for(i=0;i<padding;i++) put_bits(p, 1, 0); /* flush */ flush_put_bits(p); } static int MPA_encode_frame(AVCodecContext *avctx, unsigned char *frame, int buf_size, void *data) { MpegAudioContext *s = avctx->priv_data; short *samples = data; short smr[MPA_MAX_CHANNELS][SBLIMIT]; unsigned char bit_alloc[MPA_MAX_CHANNELS][SBLIMIT]; int padding, i; for(i=0;i<s->nb_channels;i++) { filter(s, i, samples + i, s->nb_channels); } for(i=0;i<s->nb_channels;i++) { compute_scale_factors(s->scale_code[i], s->scale_factors[i], s->sb_samples[i], s->sblimit); } for(i=0;i<s->nb_channels;i++) { psycho_acoustic_model(s, smr[i]); } compute_bit_allocation(s, smr, bit_alloc, &padding); init_put_bits(&s->pb, frame, MPA_MAX_CODED_FRAME_SIZE); encode_frame(s, bit_alloc, padding); s->nb_samples += MPA_FRAME_SIZE; return put_bits_ptr(&s->pb) - s->pb.buf; } static av_cold int MPA_encode_close(AVCodecContext *avctx) { av_freep(&avctx->coded_frame); return 0; } AVCodec mp2_encoder = { "mp2", AVMEDIA_TYPE_AUDIO, CODEC_ID_MP2, sizeof(MpegAudioContext), MPA_encode_init, MPA_encode_frame, MPA_encode_close, NULL, .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, .supported_samplerates= (const int[]){44100, 48000, 32000, 22050, 24000, 16000, 0}, .long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"), }; #undef FIX
123linslouis-android-video-cutter
jni/libavcodec/mpegaudioenc.c
C
asf20
23,656
/* * Escape 124 Video Decoder * Copyright (C) 2008 Eli Friedman (eli.friedman@gmail.com) * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avcodec.h" #define ALT_BITSTREAM_READER_LE #include "get_bits.h" typedef union MacroBlock { uint16_t pixels[4]; uint32_t pixels32[2]; } MacroBlock; typedef union SuperBlock { uint16_t pixels[64]; uint32_t pixels32[32]; } SuperBlock; typedef struct CodeBook { unsigned depth; unsigned size; MacroBlock* blocks; } CodeBook; typedef struct Escape124Context { AVFrame frame; unsigned num_superblocks; CodeBook codebooks[3]; } Escape124Context; static int can_safely_read(GetBitContext* gb, int bits) { return get_bits_count(gb) + bits <= gb->size_in_bits; } /** * Initialize the decoder * @param avctx decoder context * @return 0 success, negative on error */ static av_cold int escape124_decode_init(AVCodecContext *avctx) { Escape124Context *s = avctx->priv_data; avctx->pix_fmt = PIX_FMT_RGB555; s->num_superblocks = ((unsigned)avctx->width / 8) * ((unsigned)avctx->height / 8); return 0; } static av_cold int escape124_decode_close(AVCodecContext *avctx) { unsigned i; Escape124Context *s = avctx->priv_data; for (i = 0; i < 3; i++) av_free(s->codebooks[i].blocks); if (s->frame.data[0]) avctx->release_buffer(avctx, &s->frame); return 0; } static CodeBook unpack_codebook(GetBitContext* gb, unsigned depth, unsigned size) { unsigned i, j; CodeBook cb = { 0 }; if (!can_safely_read(gb, size * 34)) return cb; if (size >= INT_MAX / sizeof(MacroBlock)) return cb; cb.blocks = av_malloc(size ? size * sizeof(MacroBlock) : 1); if (!cb.blocks) return cb; cb.depth = depth; cb.size = size; for (i = 0; i < size; i++) { unsigned mask_bits = get_bits(gb, 4); unsigned color0 = get_bits(gb, 15); unsigned color1 = get_bits(gb, 15); for (j = 0; j < 4; j++) { if (mask_bits & (1 << j)) cb.blocks[i].pixels[j] = color1; else cb.blocks[i].pixels[j] = color0; } } return cb; } static unsigned decode_skip_count(GetBitContext* gb) { unsigned value; // This function reads a maximum of 23 bits, // which is within the padding space if (!can_safely_read(gb, 1)) return -1; value = get_bits1(gb); if (!value) return value; value += get_bits(gb, 3); if (value != (1 + ((1 << 3) - 1))) return value; value += get_bits(gb, 7); if (value != (1 + ((1 << 3) - 1)) + ((1 << 7) - 1)) return value; return value + get_bits(gb, 12); } static MacroBlock decode_macroblock(Escape124Context* s, GetBitContext* gb, int* codebook_index, int superblock_index) { // This function reads a maximum of 22 bits; the callers // guard this function appropriately unsigned block_index, depth; if (get_bits1(gb)) { static const char transitions[3][2] = { {2, 1}, {0, 2}, {1, 0} }; *codebook_index = transitions[*codebook_index][get_bits1(gb)]; } depth = s->codebooks[*codebook_index].depth; // depth = 0 means that this shouldn't read any bits; // in theory, this is the same as get_bits(gb, 0), but // that doesn't actually work. block_index = depth ? get_bits(gb, depth) : 0; if (*codebook_index == 1) { block_index += superblock_index << s->codebooks[1].depth; } // This condition can occur with invalid bitstreams and // *codebook_index == 2 if (block_index >= s->codebooks[*codebook_index].size) return (MacroBlock) { { 0 } }; return s->codebooks[*codebook_index].blocks[block_index]; } static void insert_mb_into_sb(SuperBlock* sb, MacroBlock mb, unsigned index) { // Formula: ((index / 4) * 16 + (index % 4) * 2) / 2 uint32_t *dst = sb->pixels32 + index + (index & -4); // This technically violates C99 aliasing rules, but it should be safe. dst[0] = mb.pixels32[0]; dst[4] = mb.pixels32[1]; } static void copy_superblock(uint16_t* dest, unsigned dest_stride, uint16_t* src, unsigned src_stride) { unsigned y; if (src) for (y = 0; y < 8; y++) memcpy(dest + y * dest_stride, src + y * src_stride, sizeof(uint16_t) * 8); else for (y = 0; y < 8; y++) memset(dest + y * dest_stride, 0, sizeof(uint16_t) * 8); } static const uint16_t mask_matrix[] = {0x1, 0x2, 0x10, 0x20, 0x4, 0x8, 0x40, 0x80, 0x100, 0x200, 0x1000, 0x2000, 0x400, 0x800, 0x4000, 0x8000}; /** * Decode a single frame * @param avctx decoder context * @param data decoded frame * @param data_size size of the decoded frame * @param buf input buffer * @param buf_size input buffer size * @return 0 success, -1 on error */ static int escape124_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; Escape124Context *s = avctx->priv_data; GetBitContext gb; unsigned frame_flags, frame_size; unsigned i; unsigned superblock_index, cb_index = 1, superblock_col_index = 0, superblocks_per_row = avctx->width / 8, skip = -1; uint16_t* old_frame_data, *new_frame_data; unsigned old_stride, new_stride; AVFrame new_frame = { { 0 } }; init_get_bits(&gb, buf, buf_size * 8); // This call also guards the potential depth reads for the // codebook unpacking. if (!can_safely_read(&gb, 64)) return -1; frame_flags = get_bits_long(&gb, 32); frame_size = get_bits_long(&gb, 32); // Leave last frame unchanged // FIXME: Is this necessary? I haven't seen it in any real samples if (!(frame_flags & 0x114) || !(frame_flags & 0x7800000)) { av_log(NULL, AV_LOG_DEBUG, "Skipping frame\n"); *data_size = sizeof(AVFrame); *(AVFrame*)data = s->frame; return frame_size; } for (i = 0; i < 3; i++) { if (frame_flags & (1 << (17 + i))) { unsigned cb_depth, cb_size; if (i == 2) { // This codebook can be cut off at places other than // powers of 2, leaving some of the entries undefined. cb_size = get_bits_long(&gb, 20); cb_depth = av_log2(cb_size - 1) + 1; } else { cb_depth = get_bits(&gb, 4); if (i == 0) { // This is the most basic codebook: pow(2,depth) entries // for a depth-length key cb_size = 1 << cb_depth; } else { // This codebook varies per superblock // FIXME: I don't think this handles integer overflow // properly cb_size = s->num_superblocks << cb_depth; } } av_free(s->codebooks[i].blocks); s->codebooks[i] = unpack_codebook(&gb, cb_depth, cb_size); if (!s->codebooks[i].blocks) return -1; } } new_frame.reference = 3; if (avctx->get_buffer(avctx, &new_frame)) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } new_frame_data = (uint16_t*)new_frame.data[0]; new_stride = new_frame.linesize[0] / 2; old_frame_data = (uint16_t*)s->frame.data[0]; old_stride = s->frame.linesize[0] / 2; for (superblock_index = 0; superblock_index < s->num_superblocks; superblock_index++) { MacroBlock mb; SuperBlock sb; unsigned multi_mask = 0; if (skip == -1) { // Note that this call will make us skip the rest of the blocks // if the frame prematurely ends skip = decode_skip_count(&gb); } if (skip) { copy_superblock(new_frame_data, new_stride, old_frame_data, old_stride); } else { copy_superblock(sb.pixels, 8, old_frame_data, old_stride); while (can_safely_read(&gb, 1) && !get_bits1(&gb)) { unsigned mask; mb = decode_macroblock(s, &gb, &cb_index, superblock_index); mask = get_bits(&gb, 16); multi_mask |= mask; for (i = 0; i < 16; i++) { if (mask & mask_matrix[i]) { insert_mb_into_sb(&sb, mb, i); } } } if (can_safely_read(&gb, 1) && !get_bits1(&gb)) { unsigned inv_mask = get_bits(&gb, 4); for (i = 0; i < 4; i++) { if (inv_mask & (1 << i)) { multi_mask ^= 0xF << i*4; } else { multi_mask ^= get_bits(&gb, 4) << i*4; } } for (i = 0; i < 16; i++) { if (multi_mask & mask_matrix[i]) { if (!can_safely_read(&gb, 1)) break; mb = decode_macroblock(s, &gb, &cb_index, superblock_index); insert_mb_into_sb(&sb, mb, i); } } } else if (frame_flags & (1 << 16)) { while (can_safely_read(&gb, 1) && !get_bits1(&gb)) { mb = decode_macroblock(s, &gb, &cb_index, superblock_index); insert_mb_into_sb(&sb, mb, get_bits(&gb, 4)); } } copy_superblock(new_frame_data, new_stride, sb.pixels, 8); } superblock_col_index++; new_frame_data += 8; if (old_frame_data) old_frame_data += 8; if (superblock_col_index == superblocks_per_row) { new_frame_data += new_stride * 8 - superblocks_per_row * 8; if (old_frame_data) old_frame_data += old_stride * 8 - superblocks_per_row * 8; superblock_col_index = 0; } skip--; } av_log(NULL, AV_LOG_DEBUG, "Escape sizes: %i, %i, %i\n", frame_size, buf_size, get_bits_count(&gb) / 8); if (s->frame.data[0]) avctx->release_buffer(avctx, &s->frame); *(AVFrame*)data = s->frame = new_frame; *data_size = sizeof(AVFrame); return frame_size; } AVCodec escape124_decoder = { "escape124", AVMEDIA_TYPE_VIDEO, CODEC_ID_ESCAPE124, sizeof(Escape124Context), escape124_decode_init, NULL, escape124_decode_close, escape124_decode_frame, CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("Escape 124"), };
123linslouis-android-video-cutter
jni/libavcodec/escape124.c
C
asf20
11,867
/* * DCA compatible decoder data * Copyright (C) 2004 Gildas Bazin * Copyright (c) 2006 Benjamin Larsson * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVCODEC_DCADATA_H #define AVCODEC_DCADATA_H #include <stdint.h> #include "libavutil/mem.h" /* Generic tables */ static const uint32_t dca_sample_rates[16] = { 0, 8000, 16000, 32000, 0, 0, 11025, 22050, 44100, 0, 0, 12000, 24000, 48000, 96000, 192000 }; static const uint32_t dca_bit_rates[32] = { 32000, 56000, 64000, 96000, 112000, 128000, 192000, 224000, 256000, 320000, 384000, 448000, 512000, 576000, 640000, 768000, 896000, 1024000, 1152000, 1280000, 1344000, 1408000, 1411200, 1472000, 1536000, 1920000, 2048000, 3072000, 3840000, 1/*open*/, 2/*variable*/, 3/*lossless*/ }; static const uint8_t dca_channels[16] = { 1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 6, 7, 8, 8 }; static const uint8_t dca_bits_per_sample[7] = { 16, 16, 20, 20, 0, 24, 24 }; /* Adpcm data */ /* 16bits signed fractional Q13 binary codes */ static const int16_t adpcm_vb[4096][4] = { { 9928, -2618, -1093, -1263 }, { 11077, -2876, -1747, -308 }, { 10503, -1082, -1426, -1167 }, { 9337, -2403, -1495, 274 }, { 10698, -2529, -532, -1122 }, { 10368, -3974, -1264, -750 }, { 10070, -3667, 346, 863 }, { 10278, -3093, 311, -576 }, { 9894, -1330, -1428, -860 }, { 10544, -1923, -1058, -971 }, { 10996, -1632, -841, -1404 }, { 11832, -3465, 1658, -1990 }, { 10852, -688, -2658, -499 }, { 10546, -1749, -147, -1733 }, { 10801, -1004, -708, -1453 }, { 10588, -441, -2113, -952 }, { 10141, -3331, -582, -1432 }, { 9608, -2590, 383, 258 }, { 11422, -3265, 229, -1544 }, { 10460, -1338, -713, -1568 }, { 10306, -1721, -1660, -603 }, { 9580, -1812, -1235, -1061 }, { 11471, -2285, -1617, -607 }, { 10081, -2225, -1408, -868 }, { 10715, -2624, -1367, -704 }, { 10616, -1871, -2770, -35 }, { 9352, -2340, -1024, -1566 }, { 11065, -1458, -1926, -735 }, { 11334, -2056, -1041, -1144 }, { 9825, -2048, -794, -1536 }, { 11850, -2695, -1123, -867 }, { 10654, -2226, -1891, -373 }, { 10024, -1557, -808, -1069 }, { 11142, -1266, -3238, 128 }, { 11729, -3282, -514, -1011 }, { 11402, -2094, -2335, -189 }, { 10195, -3658, 181, -1875 }, { 11431, -2626, -404, -1377 }, { 11001, -3868, -619, -1077 }, { 10894, -2559, 274, -1758 }, { 9633, -1482, -2253, -773 }, { 11245, -3321, 830, -1972 }, { 9768, -2701, -199, -1859 }, { 10500, -2042, 525, -2043 }, { 11669, -4069, 293, -1468 }, { 9192, -1991, -583, -61 }, { 10057, -3220, -2015, -473 }, { 9497, -2315, -2490, -467 }, { 10455, -3069, -1194, -1007 }, { 9994, -1936, -60, -1225 }, { 9295, -2156, -1761, -1134 }, { 10085, -3748, -1026, 197 }, { 9334, -2360, 804, -351 }, { 11561, -2553, 1352, -2313 }, { 12837, -3998, 1195, -1958 }, { 10114, -1100, -2414, -394 }, { 9341, -2530, 315, 755 }, { 10131, -3164, 1411, -674 }, { 9535, -905, -1551, 579 }, { 11717, -1519, -3051, 91 }, { 9824, -2911, -2775, 192 }, { 9662, -2934, -561, 1450 }, { 11085, -3392, -1298, -659 }, { 8955, -2102, -1899, 703 }, { 8607, -1742, -4348, 814 }, { 7640, -2063, -3617, 52 }, { 7074, -826, -4325, 4375 }, { 7714, 584, -4238, 1927 }, { 6355, -952, -4912, 3127 }, { 7069, -660, -6413, 4087 }, { 8313, -132, -2964, -876 }, { 6952, -1422, -3962, -24 }, { 9299, -734, -3088, -263 }, { 9484, -574, -4513, 466 }, { 7246, -91, -3735, -704 }, { 8325, -1417, -3090, -530 }, { 6469, -1226, -4757, 829 }, { 6652, -368, -5682, 1393 }, { 7971, -1278, -2284, 1205 }, { 7229, -699, -3556, 1840 }, { 7994, 1284, -2729, 732 }, { 9005, -698, -4522, 2189 }, { 6963, 197, -2727, 380 }, { 8527, 135, -3991, -213 }, { 8840, 934, -3014, -567 }, { 10125, 418, -3284, -371 }, { 6367, 361, -2318, 2554 }, { 7892, 172, -5247, 4673 }, { 6674, 387, -5424, 4398 }, { 6240, 684, -4047, 1219 }, { 11170, -794, -5081, 1195 }, { 11765, -648, -6265, 2052 }, { 10845, -775, -3837, 366 }, { 12496, -689, -8260, 3562 }, { 7893, -1166, -4972, 988 }, { 8592, 1052, -5986, 3087 }, { 7277, 1874, -5685, 3579 }, { 6900, 2016, -4809, 3491 }, { 8530, -2405, -3250, 1986 }, { 9426, 494, -7067, 5038 }, { 10285, 564, -8210, 5370 }, { 8749, -2207, -3980, 2852 }, { 9653, -2686, -4300, 1400 }, { 9770, -2286, -5663, 4233 }, { 8490, -4, -7048, 4496 }, { 7697, -1209, -5328, 3183 }, { 6451, 801, -4324, -554 }, { 7387, 1806, -5265, 545 }, { 7450, -2302, -4445, 1418 }, { 8817, -1370, -5827, 2168 }, { 10324, -2406, -5629, 2579 }, { 8863, -2578, -3537, 467 }, { 6901, -1624, -3169, 3392 }, { 7846, 156, -6948, 3381 }, { 7928, -1115, -5972, 4816 }, { 6089, -599, -4368, -320 }, { 7833, 1246, -3960, -621 }, { 8931, 2521, -6768, 2052 }, { 8900, 1944, -4126, 40 }, { 7661, -34, -2855, 2480 }, { 5873, 474, -3262, 3712 }, { 7535, -234, -4699, 216 }, { 5856, 143, -5142, 73 }, { 8944, -106, -5874, 3663 }, { 7134, 426, -5879, 2895 }, { 10199, 1011, -4762, 369 }, { 8454, 264, -5971, 1291 }, { 7822, -2449, -4333, 4540 }, { 6200, -2758, -2632, 1497 }, { 6070, -4315, -2699, 414 }, { 7047, -3739, -3210, 1060 }, { 5675, -3801, -2717, -407 }, { 4789, -4063, -2628, -744 }, { 4023, -3366, -3133, -726 }, { 4296, -2407, -3381, -513 }, { 4388, -2931, -2820, 1512 }, { 4559, -4233, -1941, 1976 }, { 6702, -3208, -1755, 1680 }, { 4416, -3521, -1052, 2984 }, { 7154, -4266, -1203, 3732 }, { 3625, -4242, -3244, 1395 }, { 6518, -2856, -1304, 2887 }, { 6170, -1949, -3014, 3973 }, { 5189, -2451, -4020, 3477 }, { 6218, -2988, -1921, 3844 }, { 4827, -3688, -1928, 3343 }, { 6668, -3991, -2805, 3095 }, { 5297, -3115, -3684, 2390 }, { 5354, -4614, -2662, 1504 }, { 4196, -3091, -4147, 1135 }, { 3540, -2893, -4007, 100 }, { 5569, -1602, -4007, 1909 }, { 4341, -2091, -4272, 252 }, { 5559, -2878, -3832, 498 }, { 4548, -4479, -2898, -27 }, { 5176, -2494, -4635, 1476 }, { 3294, -3485, -3738, 716 }, { 4920, -1229, -4195, -365 }, { 3257, -3518, -3349, 2862 }, { 5286, -1948, -3485, -778 }, { 6502, -3051, -152, 2854 }, { 5864, -4192, -1076, 3451 }, { 4656, -3122, -3448, 179 }, { 5907, -754, -1596, 3116 }, { 7229, -3680, -1590, 2892 }, { 5107, -3888, -3364, 806 }, { 6764, -2635, -3450, 134 }, { 5258, -2827, -2844, -1052 }, { 5798, -1725, -4305, 205 }, { 5404, -1213, -3362, 449 }, { 6224, -2738, -3046, -581 }, { 4223, -2438, -2725, 3745 }, { 4751, -3411, -2123, 116 }, { 3868, -3000, -3954, 2297 }, { 6819, -2899, -4277, 2825 }, { 4207, -4754, -2808, 865 }, { 4804, -1494, -1997, 4688 }, { 5282, -2213, -548, 3559 }, { 5580, -1912, -566, 4370 }, { 6168, -2857, -672, 4053 }, { 6583, -4515, -2850, 1670 }, { 6511, -3093, -3988, 1421 }, { 4646, -1790, -1443, 3650 }, { 5915, -924, -2020, 896 }, { 7814, -4181, -3152, 2007 }, { 6190, -2238, -4817, 2279 }, { 4737, -4034, -3288, 1835 }, { 8161, -3633, -3423, 3137 }, { 7415, -2351, -2088, 4290 }, { 4106, -2517, -62, 2905 }, { 4909, -3145, -614, 4112 }, { 4938, -3281, -397, 1100 }, { -173, 919, 1589, -5363 }, { -13, 796, -295, -6655 }, { -1860, -829, 1141, -4555 }, { 2298, -838, -664, -5005 }, { -884, -1097, 2074, -4613 }, { -101, 281, 2846, -4535 }, { 1166, 453, 2429, -5910 }, { 879, -664, 2370, -5452 }, { 1415, -370, -1699, -4727 }, { -1413, 1277, -669, -6649 }, { 2133, 304, -968, -4624 }, { 380, 586, -2087, -4892 }, { 1336, 275, -82, -5789 }, { -2459, 1057, -34, -5416 }, { 2278, -1758, 866, -5653 }, { 1945, -2295, -149, -5302 }, { 1287, -3525, 996, -5255 }, { 2297, 803, 1177, -6067 }, { 187, -180, -619, -6202 }, { -793, -2537, 1554, -5057 }, { -2703, -204, -629, -5853 }, { -1007, -146, 313, -5582 }, { 830, 357, 869, -6363 }, { -228, -575, -3177, -4433 }, { -1001, -1553, -142, -5708 }, { -1644, 1683, 1721, -4533 }, { 893, 1924, -15, -5791 }, { 2195, 2061, -262, -5471 }, { 3031, 270, 311, -5096 }, { 1912, 1638, -1523, -4677 }, { -3142, -55, 253, -4914 }, { 356, -1680, 343, -6123 }, { -2241, -1734, -976, -5939 }, { -2196, -2893, 547, -4938 }, { -1245, 126, -1916, -5419 }, { -249, -3755, -1422, -5594 }, { 575, -2683, -1926, -4566 }, { -762, 1885, 192, -5880 }, { -811, -2562, -1068, -6013 }, { -2264, -3086, -976, -4775 }, { 70, -1215, 2880, -4410 }, { 714, -3760, 2916, -4691 }, { -244, -3404, 1740, -4493 }, { 684, -5137, -328, -5608 }, { -529, -3825, -1786, -4535 }, { -713, -4743, -1118, -5546 }, { 2718, -3788, 1798, -5708 }, { -1639, -3679, -1564, -6095 }, { 1693, -2642, -1389, -4539 }, { 505, -1573, -1651, -4878 }, { -835, -2256, -1941, -5352 }, { 1464, -411, 1993, -6441 }, { 493, -3184, -145, -6148 }, { -1413, 499, -1617, -6479 }, { -294, 1722, -1419, -5725 }, { -2937, -1528, -175, -4624 }, { -594, -5911, -56, -6146 }, { -300, -4275, 1156, -5947 }, { 552, -2643, 2669, -3959 }, { 905, -4158, 1789, -5809 }, { 1336, -2009, 2108, -5903 }, { 1555, -3600, 1110, -6759 }, { -1294, -3464, 77, -6084 }, { -1139, -4006, -1270, -4181 }, { -5094, -3296, 1092, -2847 }, { -5503, -2883, 1984, -2067 }, { -4671, -4218, -1417, -4132 }, { -3763, -3818, 1262, -3082 }, { -5132, -3430, 2928, -728 }, { -5957, -2877, 1251, -2446 }, { -4425, -2319, -212, -4276 }, { -6201, -1993, 1774, -2182 }, { -5500, -3836, 2201, -1396 }, { -6934, -2334, 2366, -1293 }, { -6124, -4140, 1337, -1977 }, { -6553, -4186, 1756, -1325 }, { -5126, -1258, 744, -3656 }, { -5167, -1390, 1581, -2895 }, { -4525, -3398, 2429, -1865 }, { -4076, -3183, 2027, -2510 }, { -6191, -3274, 1838, -1814 }, { -4454, -2753, 2723, -1185 }, { -6655, -4797, 251, -2595 }, { -6332, -2232, 1832, 217 }, { -5869, -1698, 134, 340 }, { -6614, -1045, 2126, -1932 }, { -4859, -2107, 2010, -2435 }, { -6274, -1622, 2808, -1374 }, { -3119, -3209, 521, -3988 }, { -5676, -2082, -420, -2711 }, { -7073, -3623, 696, -2343 }, { -5986, -4224, 572, -2454 }, { -4340, -4521, 882, -2771 }, { -6178, -1933, 535, -1444 }, { -4923, -4163, 1744, -2066 }, { -6410, -1519, 1058, -2683 }, { -5077, -1185, 856, -2216 }, { -7091, -2444, 687, -2597 }, { -5284, -2165, 3239, -993 }, { -4763, -1497, 197, -3179 }, { -4128, -4958, -396, -3578 }, { -5054, -3878, -647, -2672 }, { -7005, -3348, 1679, -1579 }, { -5767, -1017, 2582, -1915 }, { -7069, -2787, 1331, -2070 }, { -5532, -2296, 706, -2950 }, { -5059, -3543, -821, -3637 }, { -6639, -1835, 1016, -696 }, { -5611, -5220, -694, -3371 }, { -5994, -2803, 2933, -729 }, { -5948, -619, 1596, -2676 }, { -5486, -4419, 153, -3265 }, { -4329, -3440, 1646, -1439 }, { -4083, -3978, 177, -3569 }, { -4289, -2599, 1224, -3075 }, { -5707, -3253, 1912, -759 }, { -6606, -3437, 2562, -571 }, { -5254, -2444, 769, -352 }, { -6545, -3154, 582, -1103 }, { -5328, -2241, 2566, -1775 }, { -7216, -1936, 1538, -1983 }, { -3730, -2451, 426, -3869 }, { -5110, -1385, 2031, -1169 }, { -6470, -2715, 269, -3123 }, { -5806, -2480, -97, -3832 }, { -3683, -4916, -490, -4330 }, { -6341, -2083, -669, -115 }, { -4913, -4079, -837, -4673 }, { -3274, -2497, 2334, -2652 }, { -1286, -1731, 2550, -3756 }, { -3375, -877, 926, -3977 }, { -2525, -2079, 2879, -2625 }, { -5308, -504, 3111, -1607 }, { -4904, 460, 4093, -1232 }, { -1993, 1616, 4656, -1913 }, { -3481, -1176, 3119, -2236 }, { -4132, -1502, 2339, -2545 }, { -2542, 1151, 3569, -2550 }, { -4381, 430, 3147, -2082 }, { -3888, 867, 3899, -1657 }, { -2861, 1290, 4202, -1979 }, { -3893, -253, 2363, -2764 }, { -1705, 688, 3827, -2923 }, { -2223, 2312, 3700, -3148 }, { -1986, -720, 5021, -795 }, { -3177, 242, 1952, -3352 }, { -1854, 1509, 2528, -3815 }, { -3173, 97, 5019, -706 }, { -2689, -145, 1375, -3915 }, { -4838, -385, 2488, -2427 }, { -4557, -355, 1603, -3060 }, { -3522, 1832, 3292, -2674 }, { -3769, 780, 2378, -2704 }, { -4323, -1932, 3414, -1169 }, { -2740, 1158, 2729, -3273 }, { -3647, 210, 1464, -2892 }, { -2342, -2097, 1513, -3727 }, { -4422, -1242, 3130, -1833 }, { -1308, -1039, 4290, -1875 }, { -1754, -2535, 3298, -2314 }, { -4102, -186, 4037, -1094 }, { -1008, 1570, 3290, 171 }, { -3322, -2621, 2791, -1536 }, { -2539, -2597, 3442, -1672 }, { -3411, -2015, 3670, -1174 }, { -2097, 730, 5581, -1399 }, { -1510, -74, 4820, -2004 }, { -4086, -868, 4425, -771 }, { -956, -986, 3640, -2925 }, { -2087, -1250, 3464, -2458 }, { -3308, -2411, 1334, -3667 }, { -2264, -389, 4004, -1854 }, { -680, 239, 4058, -3388 }, { -1357, 30, 2993, -3658 }, { -3601, -552, 1177, -1136 }, { -2641, 442, 4374, -1625 }, { -2525, 770, 1640, -3895 }, { -3172, -891, 3893, -1608 }, { -2996, 13, 3277, -2414 }, { -899, 1055, 4470, -2501 }, { -422, -584, 3475, -3787 }, { -1978, -593, 2566, -3415 }, { -3150, -1280, 2362, -3047 }, { -3592, 224, 1026, -3932 }, { -4840, -1189, 3633, -879 }, { -3952, -2255, 2916, -1826 }, { -1695, 28, 1810, -349 }, { -745, -2484, 3308, -3293 }, { -1016, 1563, 5365, -1823 }, { -2172, -1787, 4266, -1287 }, { -1241, -1951, 3982, -2413 }, { -2009, -2639, 2330, -3480 }, { 5105, -1618, -2588, -2015 }, { 6497, -1523, -3218, -910 }, { 6526, -2305, -2029, -1790 }, { 5289, -99, -3436, -400 }, { 5781, -1623, -1577, -2617 }, { 5259, -670, -3125, -1700 }, { 6343, -1256, -331, -3222 }, { 7967, -678, -2195, -1462 }, { 6119, -695, -2988, -1538 }, { 6108, 494, -3359, -1548 }, { 5067, 969, -2328, -2707 }, { 7595, -435, -1497, -2056 }, { 6929, -719, -2420, -1665 }, { 5190, 584, -2982, -2103 }, { 6106, -444, -1411, -2739 }, { 5584, 289, -1804, -2803 }, { 5276, 227, -1180, -3361 }, { 7544, -1525, -1834, -1725 }, { 5986, -1470, -2606, -1701 }, { 5096, -765, -1712, -3006 }, { 5423, -149, -3933, -1157 }, { 7651, 26, -2445, -1507 }, { 4745, -464, -1735, -2362 }, { 5352, -1011, -1094, -1999 }, { 6300, -672, -542, -1950 }, { 6675, -1020, -1318, -1059 }, { 7218, -2036, -603, -2462 }, { 7755, -1514, -2430, -1229 }, { 5041, 449, -1056, -2405 }, { 6710, -2277, -1344, -2284 }, { 6824, -1347, -2254, 251 }, { 6068, -1857, -983, -1316 }, { 5603, -2177, -2730, -1477 }, { 5838, -1059, -3604, -970 }, { 5076, -789, -335, -2413 }, { 6191, -1634, -2000, -2129 }, { 5092, -1292, -2543, -1034 }, { 5305, 435, -1710, -1850 }, { 6140, 561, -2176, -2380 }, { 6752, 348, -2496, -1890 }, { 6405, 273, -1098, -2778 }, { 6942, -1340, -496, -1381 }, { 5238, -687, -2454, -2349 }, { 6959, -882, -1833, -2061 }, { 6292, -253, -2125, -2199 }, { 5838, -574, -759, -3215 }, { 6954, -1484, -640, -2771 }, { 7498, -1706, -1210, -2154 }, { 6772, -1003, -1235, -2532 }, { 6014, 228, -2154, -1108 }, { 6943, -2178, -2644, -1122 }, { 7262, -763, -3056, -1090 }, { 6273, -1478, -1072, 177 }, { 4734, 425, -2912, 357 }, { 7129, 168, -1537, -2327 }, { 7204, -434, -746, -2660 }, { 6879, 57, -3087, -1310 }, { 4623, -610, -718, -3459 }, { 6565, -543, -1998, -339 }, { 4752, -277, -2066, -1405 }, { 7435, -1416, -1904, -505 }, { 4076, 150, -1222, -3556 }, { 7082, -28, -1456, -1174 }, { 5941, -446, -1326, -1158 }, { 3870, -1648, -2474, -2589 }, { 858, 37, -3387, -3721 }, { 3557, -1503, -1664, -3383 }, { 3336, -1972, -3079, -2216 }, { 3186, 60, -4185, -863 }, { 3456, -773, -3066, -2457 }, { 4131, -913, -2060, -2601 }, { 4431, -691, -4114, -972 }, { 3461, -334, -3680, -1751 }, { 2006, -459, -2214, -3827 }, { 1322, 32, -2816, -3203 }, { 4425, -1897, -2791, -1946 }, { 4504, 23, -3421, -1909 }, { 3090, -885, -2366, -3264 }, { 3209, -2363, -3730, -834 }, { 3312, -1471, -3641, -1579 }, { 4184, -1669, -3323, -1248 }, { 2190, -931, -3302, -2944 }, { 2947, -229, -4791, -1195 }, { 2020, -1626, -2700, -3125 }, { 2214, -326, -4352, -1683 }, { 3286, -2619, -2412, -2458 }, { 1000, -2571, -4129, -2158 }, { 2496, -2627, -3611, -1433 }, { 2043, -2191, -2167, -3827 }, { 2571, -2544, -1915, -3222 }, { 2022, -1501, -3856, -2165 }, { 2685, -1180, -1461, -4038 }, { 1610, -2313, -4391, -1173 }, { 2340, -2490, -4215, -516 }, { 1742, -2615, -3632, -2146 }, { 523, -1293, -4246, -2442 }, { 3725, -2723, -3014, -1576 }, { 3554, -1381, -4200, -824 }, { 1291, -1594, -4777, -1430 }, { 1452, 515, -2960, -3830 }, { 4264, -894, -3305, -1826 }, { 2606, -1452, -4522, -966 }, { 1196, -830, -4807, -1816 }, { 1054, -775, -2616, -4071 }, { 4206, 415, -4344, -1132 }, { 3044, 491, -4126, -1934 }, { 988, -901, -3353, -3443 }, { 1729, -3063, -2267, -3370 }, { 3915, 912, -2989, -2387 }, { 3781, 300, -2457, -3050 }, { 2712, 924, -1350, -1206 }, { 4230, 405, -2343, 665 }, { 1878, -873, -225, -29 }, { 3510, 56, -1334, -3420 }, { 2850, 1447, -2651, -3150 }, { 1510, -706, -4125, -2483 }, { 3115, 793, -1692, -3894 }, { 2667, 213, -2973, -2786 }, { 1184, -2384, -3051, -3173 }, { 2139, 796, -2079, -3697 }, { 1464, -1483, -3726, -2754 }, { 2407, -1148, -3915, -1569 }, { 2612, -1779, -3217, -2271 }, { 2406, -2870, -2937, -2496 }, { 2140, 126, -3646, -2758 }, { 2952, -1036, 268, -1423 }, { 93, -1931, -3841, -3535 }, { 389, -2953, -3383, -3343 }, { 8652, -5511, -1662, 565 }, { 7427, -2791, -2535, -842 }, { 8541, -4253, -1407, -988 }, { 8018, -3203, -2998, 105 }, { 7231, -3926, -958, 1308 }, { 7331, -3690, -363, 2586 }, { 6803, -3646, -2226, -903 }, { 8163, -2811, -477, -2235 }, { 9356, -3818, -1685, -684 }, { 8466, -2854, -302, -698 }, { 8458, -3224, 517, 279 }, { 8074, -2619, -1326, 2596 }, { 8779, -2761, -2527, -441 }, { 6533, -2887, -899, -696 }, { 7394, -2305, -1642, -120 }, { 8281, -3780, -22, 1305 }, { 9158, -4413, -779, 901 }, { 9031, -5240, -1109, 1678 }, { 8717, -3650, 410, -1075 }, { 7317, -3197, -818, -2264 }, { 7934, -2385, -1214, -1886 }, { 8256, -4441, -291, -587 }, { 7358, -3395, 1090, -270 }, { 9446, -4910, -1343, -473 }, { 8187, -4726, -808, 1166 }, { 7504, -3845, -47, 267 }, { 8029, -2146, -1283, -383 }, { 7461, -2705, -853, 783 }, { 9367, -3636, -645, -354 }, { 8955, -3473, -308, -1947 }, { 8676, -2683, -2099, 1485 }, { 7481, -3003, -871, -444 }, { 8015, -2839, -1673, 1175 }, { 6947, -4643, -1527, -1047 }, { 7622, -2575, -137, -960 }, { 9388, -4279, -707, -1322 }, { 8382, -5259, -1283, -565 }, { 6856, -4138, -1030, 630 }, { 8659, -2571, -1124, -1666 }, { 8763, -3807, -537, 2543 }, { 8049, -3578, -2186, -604 }, { 8272, -2351, -1985, -1214 }, { 6855, -3796, -1527, -1631 }, { 7178, -2896, -1600, -1756 }, { 7040, -2888, -89, -1586 }, { 6261, -3403, -264, 998 }, { 7756, -4699, -1543, -834 }, { 7682, -4622, -758, -1721 }, { 8839, -4232, -2932, 1959 }, { 9363, -4679, -1956, 39 }, { 7883, -3616, -1414, -1432 }, { 8828, -3188, -1356, -1312 }, { 7746, -3987, -121, -2424 }, { 9262, -3256, -693, 818 }, { 7670, -3420, -148, 3504 }, { 7344, -3183, 608, 1595 }, { 8976, -4139, -1848, 1304 }, { 6708, -4131, 33, -852 }, { 7840, -4429, -2275, 79 }, { 8980, -3858, -2838, 453 }, { 7815, -4604, -2563, 944 }, { 8372, -4422, -1783, 3071 }, { 8623, -5128, -1754, 2888 }, { 7462, -3281, 889, 920 }, { 8416, -59, -1320, -1825 }, { 7928, -1488, -414, -2499 }, { 8110, -977, -1047, -2042 }, { 8278, -687, -1597, -1550 }, { 7988, -174, -977, -2106 }, { 8609, -1547, -1628, -1527 }, { 9000, -1798, -946, -1761 }, { 8954, -872, -1404, -1594 }, { 8939, 466, -748, -1212 }, { 9549, -329, -177, -1360 }, { 9411, -18, -1126, -1568 }, { 8859, -782, -488, -1338 }, { 8955, -218, -43, -1209 }, { 9131, -69, -453, -1001 }, { 9069, -1519, -1091, -1199 }, { 9247, -1309, -566, -1146 }, { 8528, -1617, -287, -1313 }, { 7763, -745, -149, -2040 }, { 8294, -343, 257, -2633 }, { 10149, -893, -552, -1649 }, { 9398, -915, 218, -2042 }, { 9703, -1194, -675, -1592 }, { 9586, -700, -427, -1710 }, { 8930, 497, -1445, -1218 }, { 9285, -1323, -163, -1552 }, { 8431, -1289, -985, -1404 }, { 8965, -655, 653, -1483 }, { 9542, -1001, -951, -1128 }, { 9205, -647, -37, -882 }, { 8603, -56, 514, -1793 }, { 9300, -12, -1324, -567 }, { 8773, 238, -184, -1456 }, { 9941, -1306, -69, -1792 }, { 9360, 279, -376, -1919 }, { 9180, -285, 95, -2170 }, { 9922, -501, -970, -1570 }, { 8341, -1493, -856, -2092 }, { 8780, -981, -850, -1014 }, { 9721, -548, -1504, -1094 }, { 9973, -1493, 482, -2105 }, { 8707, -333, -1027, -1087 }, { 9098, -469, -315, -1723 }, { 8879, -1050, -661, -2020 }, { 8857, 602, -866, -1918 }, { 8945, -1025, -2154, -1071 }, { 8484, -1930, -468, -2179 }, { 9177, -1903, -224, -2112 }, { 8652, -137, -2097, -1214 }, { 9063, -973, -1405, -772 }, { 9328, -456, 662, -2469 }, { 10101, -697, 127, -2113 }, { 9685, 811, -2359, -1024 }, { 8586, -94, -460, -1982 }, { 7924, -141, -509, -2513 }, { 7773, -669, -107, -2835 }, { 8636, -1064, -46, -2409 }, { 9748, 596, -1815, -1349 }, { 8924, 304, 547, -2614 }, { 9442, 746, -1153, -1679 }, { 9454, -278, -529, -1976 }, { 8488, 561, -32, -2160 }, { 10083, -63, -1544, -1364 }, { 9390, -1278, 568, -1131 }, { 9740, -49, -2253, -910 }, { 3636, -2391, -1115, -3614 }, { 6014, -3204, -1902, -1808 }, { 5787, -3497, -1116, -2590 }, { 4365, -3046, -1632, -2668 }, { 4733, -2192, -2029, -2468 }, { 5412, -2753, -1633, -2464 }, { 4455, -3375, -767, -3399 }, { 4456, -1644, -983, -2841 }, { 4039, -2523, 38, -3967 }, { 3406, -2662, 72, -4757 }, { 4279, -2005, 1055, -4399 }, { 4321, -1377, -860, -3786 }, { 3743, -5739, -651, -3047 }, { 3528, -5510, 361, -4060 }, { 6496, -4886, -136, -2689 }, { 4513, -5254, 551, -4010 }, { 6557, -3413, -92, -3063 }, { 4186, -2059, 187, 47 }, { 6210, -4117, -1256, -1985 }, { 6038, -4343, 351, -2124 }, { 4305, -4780, -2077, -1897 }, { 4480, -3815, -2228, -1533 }, { 5582, -3689, 1221, -3429 }, { 5532, -4874, 1195, -2765 }, { 6518, -2853, -905, -2568 }, { 5467, -2192, 470, -4115 }, { 4139, -1577, 240, -3493 }, { 5281, -1926, -729, -3340 }, { 5214, -2870, 1359, -4289 }, { 3046, -3510, -1536, -3214 }, { 5433, -2881, -1230, -1184 }, { 4861, -3932, -1071, -2791 }, { 5693, -4234, -1906, -1502 }, { 4004, -3935, -1804, -2383 }, { 3728, -3792, 681, -4773 }, { 3621, -3030, -1951, -2598 }, { 5133, -3903, 44, -3700 }, { 3561, -3451, 1183, -5301 }, { 5026, -2762, -2341, -1780 }, { 5841, -2492, -467, -3210 }, { 5591, -1791, 497, -2472 }, { 5054, -3898, -1822, -2097 }, { 5813, -2792, 83, -1469 }, { 4432, -4497, 1670, -5193 }, { 5338, -4653, -1109, -2200 }, { 3239, -4401, -648, -3655 }, { 2147, -3598, -1200, -4242 }, { 4417, -2271, -1552, -3210 }, { 6494, -4360, 852, -3565 }, { 2393, -6358, -856, -4524 }, { 4959, -4196, -847, -1403 }, { 4924, -5438, -226, -3026 }, { 4254, -5303, -1306, -2424 }, { 4121, -3126, -2334, -1981 }, { 3437, -4443, -1464, -2953 }, { 3203, -3459, -529, -4339 }, { 5896, -5945, 543, -3246 }, { 1987, -4733, -220, -4863 }, { 4358, -4431, -514, -3081 }, { 4583, -2416, -492, -2287 }, { 2943, -5035, 419, -4927 }, { 5358, -5129, 987, -4309 }, { 4460, -3392, 1752, -5634 }, { 3415, -4633, 1507, -5945 }, { 811, -4692, -445, 2333 }, { 1009, -5613, -1857, 1360 }, { 1338, -2712, -2720, 3036 }, { 1002, -3754, -2582, 2344 }, { 750, -4608, -2334, 714 }, { 2043, -3207, -2822, 2173 }, { -140, -4654, -2953, 357 }, { -54, -4026, -2376, 2695 }, { 1858, -5022, -717, 2287 }, { 2064, -3894, -722, 3255 }, { 2727, -4558, -332, 2603 }, { 1810, -5378, 283, 1826 }, { 3935, -4326, 762, 3383 }, { -767, -4697, -2510, 1922 }, { 2146, -4312, -3090, 1641 }, { 54, -5881, -2114, 921 }, { 1992, -5766, -640, 1574 }, { 1200, -5371, -1114, 1828 }, { 2973, -5337, 34, 2266 }, { 1531, -5018, -2817, 1192 }, { 3078, -4570, 117, 1990 }, { 924, -4286, -1388, 2713 }, { 142, -5058, -2848, 1487 }, { -106, -6180, -881, 842 }, { 673, -5433, -229, 1596 }, { 783, -5710, -2784, 562 }, { 1935, -5729, -2009, 856 }, { -410, -3375, -3326, 2734 }, { 234, -3000, -2628, 3260 }, { 733, -3405, -3806, 1589 }, { 771, -4285, -3544, 1314 }, { 1192, -3563, -3960, 2178 }, { 206, -5555, -1250, 1546 }, { -130, -3815, -1210, 3041 }, { 646, -3940, -393, 2992 }, { -184, -4931, -1767, 1925 }, { 2746, -5120, -2275, 1464 }, { 2440, -3731, -3352, 2729 }, { -490, -4942, -3779, 997 }, { 68, -2636, -4167, 3778 }, { 48, -3986, -4118, 2106 }, { -978, -5486, -1336, 1390 }, { 1126, -5297, -855, 640 }, { -472, -3975, -3622, 1557 }, { 2456, -5344, -1523, 1648 }, { -774, -5652, -2417, 1147 }, { 995, -6122, -812, 1132 }, { 3282, -4571, -1763, 2175 }, { 3655, -3862, -676, 3568 }, { 3038, -3647, -1672, 3381 }, { 2595, -2964, -2772, 3263 }, { 4176, -3353, -1148, 4354 }, { 1603, -3442, -1500, 3444 }, { 828, -6226, -1783, 678 }, { 1421, -3333, -3080, 3403 }, { 1121, -4727, -1924, 1984 }, { -186, -5083, -682, 1796 }, { 819, -2778, -3488, 530 }, { 421, -2873, -3832, 2596 }, { 2164, -4263, -1605, 2282 }, { 585, -4437, -682, -491 }, { -644, -4452, -1157, 2325 }, { 1991, -4299, 210, 2834 }, { 2135, -3632, -2113, 665 }, { -7482, -2724, -2662, -1380 }, { -6983, -2166, -3756, -3509 }, { -7085, -1439, -2397, -3112 }, { -7760, -3049, -3319, -2822 }, { -8413, -2760, -4406, -3298 }, { -5995, -3943, -1260, -3750 }, { -7879, -1554, -3464, -2606 }, { -6314, -2034, -3878, -1681 }, { -8849, -2084, -1399, -1231 }, { -7153, -2602, -1384, -817 }, { -8041, -2571, -407, -2785 }, { -7246, -2233, -1578, 260 }, { -7336, -3883, -4061, -1342 }, { -7619, -3908, -2342, 382 }, { -8684, -3724, -1662, -727 }, { -7850, -2922, -1770, -3449 }, { -6766, -2034, -1293, -1988 }, { -6895, -2116, -968, -3744 }, { -7136, -5147, -2618, -2809 }, { -8224, -3724, -2519, -1589 }, { -6711, -2750, -3021, -219 }, { -8059, -1638, -1102, -3175 }, { -8710, -4839, -3963, -3143 }, { -9363, -4965, -3257, -1002 }, { -6099, -1751, -3157, -395 }, { -6453, -3216, -4597, -483 }, { -7879, -5477, -839, -2638 }, { -7202, -4038, -526, -2856 }, { -8022, -1228, -1910, -1646 }, { -9117, -1393, -1582, -2535 }, { -9095, -2693, -636, -2605 }, { -9076, -2580, -3481, -2519 }, { -8327, -4859, -2422, 83 }, { -8368, -2129, -2324, -2173 }, { -8554, -4563, -3842, -2007 }, { -10462, -4261, -1934, -2084 }, { -9717, -3187, -2294, -1896 }, { -9625, -3889, -3020, -3224 }, { -9857, -4955, -4239, -2184 }, { -9752, -2351, -2277, -3129 }, { -7219, -1302, -2639, -1603 }, { -7477, -4360, -3718, -559 }, { -5680, -2033, -2326, -3078 }, { -10190, -5548, -4643, -3601 }, { -9431, -4121, -879, -2479 }, { -8365, -5450, -2020, -1439 }, { -6289, -5178, -1605, -3845 }, { -8319, -3866, -687, -2792 }, { -8131, -1031, -3608, -3947 }, { -10510, -2560, -1199, -2082 }, { -11015, -3640, -2748, -3041 }, { -8762, -5022, -5231, -1162 }, { -10153, -2715, -4648, -4859 }, { -7930, -5205, -1900, -3600 }, { -9561, -3548, -4812, -3722 }, { -7663, -4709, -1180, -1475 }, { -9073, -5707, -1815, -2980 }, { -8602, -2363, -2675, -3770 }, { -9967, -5614, -3575, -3838 }, { -8324, -1005, -2131, -3254 }, { -10331, -5737, -2550, -2940 }, { -8234, -3354, -3361, -4479 }, { -8140, -1951, -4526, -4545 }, { -6679, -2662, -2284, -4182 }, { -1122, -1514, -6427, -212 }, { 54, -1660, -5424, -1404 }, { 254, -2778, -5222, 846 }, { -267, -1661, -6577, 814 }, { -305, -2021, -5759, 1484 }, { -1791, -2446, -6867, -86 }, { -2929, -3158, -6603, -1799 }, { -1391, -3189, -5557, -1053 }, { -1602, -884, -6767, -1213 }, { -361, -318, -6219, -44 }, { -4078, -2635, -5523, -433 }, { -956, 478, -4382, 1470 }, { -3300, -2462, -6021, -2721 }, { 708, -2434, -5085, -540 }, { -2435, -3607, -5647, -2110 }, { -491, -1134, -4681, -2886 }, { 87, -3435, -4641, -1194 }, { -586, -2927, -4784, 366 }, { -1394, -2326, -6021, 350 }, { 97, -2519, -4678, -2120 }, { -1547, -1907, -5069, -2993 }, { 268, -3724, -4719, 127 }, { -827, -1190, -5912, 1144 }, { -3959, -2322, -6898, -1974 }, { -2728, -2228, -6426, -562 }, { -456, -666, -5785, -1609 }, { 531, -1096, -5731, -656 }, { -3569, -688, -3915, 110 }, { -4752, -1725, -4393, -377 }, { -3210, -3315, -6960, -840 }, { -688, -3416, -4971, 1221 }, { -1833, 77, -6491, -2434 }, { -239, -255, -6850, -886 }, { -2112, -1490, -6291, -2689 }, { -1544, -4579, -5198, -1261 }, { -2771, -4014, -5520, 683 }, { -1635, -2829, -5512, 1214 }, { -958, -2582, -4823, 2360 }, { -2077, -4566, -4642, 365 }, { -3112, -4214, -5960, -823 }, { -2467, -2510, -4858, 1467 }, { -1561, -3399, -5822, 211 }, { -775, -1081, -4424, 2636 }, { -1263, 25, -6378, -1392 }, { -3476, -366, -5417, -1393 }, { -3176, -1476, -4149, 1466 }, { -2479, 518, -4448, -257 }, { -2992, 158, -4660, -1279 }, { -1320, -3872, -4479, 1147 }, { -1475, -312, -5318, 539 }, { -3527, -1679, -5860, -1681 }, { -3397, -3438, -5593, 1866 }, { -4089, -2439, -4763, 1275 }, { -748, -4513, -4687, -48 }, { -2166, -4531, -4691, -2856 }, { -2385, -853, -6035, -627 }, { -1194, -4091, -4472, -1963 }, { -682, -3234, -4084, -3033 }, { -3255, -5015, -5328, -12 }, { -2313, -3436, -4601, -155 }, { -2792, -1038, -6947, -2019 }, { -1244, -1526, -5771, -1882 }, { -4679, -3731, -5506, 283 }, { -3062, -66, -3558, -758 }, { -4895, -1187, 4751, 3728 }, { -7600, -2752, 3320, 4613 }, { -5703, -2975, 3944, 2659 }, { -4972, -1257, -246, 2952 }, { -4221, -2487, 1702, 4295 }, { -2900, -1529, 2458, 4935 }, { -5061, 407, 2416, 4050 }, { -6931, -3478, 2761, 2213 }, { -6037, -3921, 3192, 1866 }, { -6113, -811, 2407, 3782 }, { -5878, -1716, 1207, 3478 }, { -5953, -2853, 2207, 2712 }, { -6807, -3223, 2749, 3595 }, { -3272, -3157, 1389, 3788 }, { -5368, -1904, 1980, 5077 }, { -7235, -1398, 3075, 4548 }, { -4765, -3487, 2755, 2796 }, { -7658, -4435, 2694, 2582 }, { -6997, -4282, 456, 3832 }, { -5563, -3115, -63, 3713 }, { -4244, -4220, 1450, 2767 }, { -3801, -2194, 190, 4303 }, { -5458, -4119, 1958, 2274 }, { -7300, -3469, 3514, 3193 }, { -4594, -2067, 775, 4752 }, { -3389, -1654, 1464, 5412 }, { -4845, -3483, 964, 3437 }, { -6007, -2818, 1666, 4659 }, { -8709, -5007, 1757, 3287 }, { -5833, -4389, 1025, 3171 }, { -5788, -1780, 3944, 3661 }, { -4430, -920, 1938, 4753 }, { -7066, -1857, 4591, 4538 }, { -3549, -513, 1427, 5317 }, { -7517, -1220, 2883, 3049 }, { -7605, -2687, 1874, 2735 }, { -8718, -4035, 2676, 3730 }, { -7990, -3907, 1185, 2607 }, { -6058, -1744, 3349, 5157 }, { -5954, 565, 3161, 3250 }, { -6478, -612, 1930, 2271 }, { -6535, -1445, -2, 1618 }, { -8963, -4151, 1192, 4044 }, { -7227, -3570, 1600, 4234 }, { -4674, 79, 595, 3015 }, { -3974, 430, 2727, 5137 }, { -5299, 9, 3714, 4779 }, { -6779, -2699, -8, 2436 }, { -7016, -1145, 1293, 2310 }, { -6955, -3312, 1534, 1801 }, { -4025, 740, 1850, 4054 }, { -9589, -3460, 4154, 5270 }, { -4404, -1181, 4298, 5173 }, { -7356, -4583, -18, 2644 }, { -6516, -1235, 4439, 6234 }, { -3453, -301, 4344, 4464 }, { -4643, 1530, 3315, 4340 }, { -4575, -2557, 3754, 3682 }, { -3643, -3501, 2051, 2997 }, { -5412, -2475, 2301, 1579 }, { -5846, 259, 1360, 2348 }, { -5258, -1358, 1050, 838 }, { -5542, -219, 6377, 5750 }, { -5713, -2952, 922, 899 }, { -2049, -1135, 5206, 1033 }, { -1693, -1886, 4835, -106 }, { -2344, -3504, 4232, -13 }, { -2475, -2334, 5043, 1126 }, { -787, -2549, 3880, 2138 }, { -3159, -2341, 4830, 2887 }, { -1780, -1009, 6240, 2061 }, { -4327, -3363, 2818, 886 }, { -3376, -2743, 4104, 207 }, { -3250, -4640, 2718, 1498 }, { -382, -1075, 4382, 3460 }, { -2416, -4168, 3530, 816 }, { -1756, -2708, 4861, 622 }, { -1879, -2097, 5156, 2889 }, { -2496, -2418, 3722, 2671 }, { -2717, -3252, 3341, 1944 }, { -4063, -4091, 3306, 267 }, { -3549, -3808, 3747, 842 }, { -2635, 546, 5794, 1894 }, { -1857, -1121, 4383, 3964 }, { -2226, -2166, 3489, 3678 }, { -3492, -660, 5323, 1063 }, { -3033, -3130, 4382, 1828 }, { -2703, -625, 6369, 2851 }, { -1656, -2842, 4584, -528 }, { -4781, -2622, 4390, 2097 }, { -413, -2045, 5081, 3035 }, { -3810, -2662, 4532, 1095 }, { -3144, -1858, 5215, 1880 }, { -3562, -1795, 4928, 670 }, { -4800, -1509, 5189, 1859 }, { -1085, -3832, 4169, 900 }, { -1969, -3270, 2857, 2878 }, { -4267, -4140, 3176, 1805 }, { -5145, -3727, 3524, 1168 }, { -1346, -1876, 5501, 1748 }, { -4998, -2945, 3699, 338 }, { -3458, -3096, 3406, -635 }, { -1751, -3209, 3508, 395 }, { -2507, 170, 5987, 705 }, { -3756, -1072, 5647, 3536 }, { -2870, -1439, 5026, 3212 }, { -3913, -3225, 3669, 2144 }, { -3739, 226, 5747, 764 }, { -2052, -820, 5266, 3093 }, { -3214, -3820, 2409, 2391 }, { -4398, -2588, 3501, -218 }, { -4484, -1763, 4180, -198 }, { -3368, -1525, 4362, -134 }, { -2407, 224, 4905, 3533 }, { -1369, -2937, 4728, 1788 }, { -4848, -1707, 4159, 851 }, { -3454, -1749, 4281, 3230 }, { -1990, -3853, 3487, 1735 }, { -3117, 92, 6155, 4075 }, { -2676, -2472, 4078, -589 }, { -1547, -2012, 2626, 1835 }, { -4275, -588, 4824, 725 }, { -601, -2249, 3736, 3548 }, { -4060, -61, 5333, 3097 }, { -4303, 7, 6551, 3054 }, { -5003, -1029, 5786, 3319 }, { -2810, -728, 5392, 199 }, { -1232, -200, 5228, 3121 }, { 2621, 165, -6255, 298 }, { 3669, 537, -6844, 1564 }, { 1598, -1190, -6235, 2523 }, { 2164, -32, -6894, 1383 }, { 853, -1597, -6069, 1449 }, { 1377, -1661, -5266, 108 }, { 2660, 48, -5172, -517 }, { 1903, -391, -5677, 1010 }, { 3792, 206, -5274, -11 }, { 1239, 2776, -2929, 2721 }, { 4071, 149, -7259, 3125 }, { 1436, -480, -6156, -196 }, { 1373, -1960, -5005, 3122 }, { 3413, -1271, -5176, 3283 }, { 3060, -68, -6495, 2238 }, { 2700, -2075, -4681, 91 }, { 2928, -1728, -5168, 1858 }, { 4424, 828, -4471, 88 }, { 2672, -2604, -4038, 2753 }, { 5223, -123, -6749, 2295 }, { 4237, -420, -5538, 1353 }, { 4744, -1281, -4097, 4708 }, { 1103, -2764, -4751, 2024 }, { 3747, -1913, -3911, 3960 }, { 2470, -1416, -5542, 615 }, { 4847, -1354, -5334, 1733 }, { 5336, 88, -7593, 4007 }, { 2388, -2880, -4807, 1037 }, { 4495, 1391, -5685, -139 }, { 5253, 1637, -6450, 1533 }, { 1199, 795, -5515, 1261 }, { 1397, -1259, -4252, 3838 }, { 746, 70, -6640, 604 }, { 1584, 166, -4972, 3072 }, { 380, -999, -5397, 2267 }, { 2974, 1707, -3242, 5360 }, { 5202, -403, -5453, 2832 }, { 3718, -1731, -4760, 714 }, { 4150, -975, -4792, 61 }, { 2925, -818, -4841, 15 }, { 5301, 577, -4006, 3259 }, { 5265, 1986, -5679, 3028 }, { 3752, 1928, -4509, 3729 }, { 3278, 1925, -6370, 1247 }, { 5107, 1721, -4853, 3127 }, { 3279, 2982, -2515, 4005 }, { 4622, 668, -6204, 759 }, { 6034, 317, -5763, 4818 }, { -558, 57, -3785, 2817 }, { 4476, 1616, -3965, 4536 }, { 5953, 2056, -8215, 2715 }, { 4387, 2613, -7463, 868 }, { 5834, 1088, -4736, 4924 }, { 6473, -856, -6991, 4172 }, { 4959, -293, -5162, 76 }, { 2731, -843, -6119, 3847 }, { 3245, 1202, -6833, 616 }, { 2553, 1383, -3829, 3859 }, { 4332, 2099, -3480, 3622 }, { 2110, 2683, -2728, 3990 }, { 876, 1167, -3290, 3466 }, { 3991, 1709, -2410, 4077 }, { 5105, 939, -2584, 3256 }, { 4719, 688, -1566, 3040 }, { -3632, 4335, 1266, -3303 }, { -4956, 3207, 1312, -2806 }, { -4669, 2627, 2663, -2435 }, { -4282, 3708, 2303, -3038 }, { -4536, 2297, -175, -3350 }, { -5234, 2503, -139, -880 }, { -3978, 1512, 1092, -3619 }, { -4519, 4649, 1363, -2455 }, { -5118, 3132, 1961, -1577 }, { -5196, 3379, -182, -1378 }, { -6420, 4486, 2397, -1993 }, { -5030, 5046, 1292, -1118 }, { -4559, 2573, -927, -1406 }, { -3501, 3730, 691, -4930 }, { -4364, 2758, 1007, -3909 }, { -4026, 2839, -1559, -2340 }, { -5037, 4053, 836, -1571 }, { -4727, 5136, 1110, -3588 }, { -5245, 2799, -999, -2164 }, { -4954, 1501, 422, -3963 }, { -5994, 2726, 1462, -2833 }, { -5621, 5159, 2038, -2512 }, { -4991, 2291, 1917, -3151 }, { -5469, 4382, -148, -2978 }, { -5858, 1983, 807, -2720 }, { -4709, 3556, 952, -467 }, { -2489, 2362, 1714, -4230 }, { -4717, 5004, -1180, -3672 }, { -5914, 3653, 1359, -1317 }, { -5506, 2995, 780, -1059 }, { -5287, 3945, 2480, -2293 }, { -3849, 4358, 322, -1770 }, { -3911, 3570, 252, -3185 }, { -3660, 5128, 158, -3719 }, { -4599, 3277, -503, -2727 }, { -3673, 3760, -1252, -3339 }, { -5161, 2337, 388, -1943 }, { -3529, 2216, 2156, -3080 }, { -4309, 4331, 1808, -1460 }, { -4782, 3820, 480, -2504 }, { -4166, 3544, -378, -1567 }, { -5572, 2466, -418, -2909 }, { -6096, 2930, 119, -1878 }, { -5963, 3554, 1011, -2233 }, { -6433, 4335, 935, -2930 }, { -5004, 3314, -1352, -3430 }, { -6042, 3463, -1008, -3940 }, { -4671, 2214, -640, -5040 }, { -2795, 3759, 1412, -3803 }, { -3647, 4436, 729, -515 }, { -3594, 1033, 56, -4148 }, { -2908, 3027, 2889, -3485 }, { -3338, 2234, 313, -4285 }, { -3825, 4497, -561, -2634 }, { -6167, 3012, -48, -3149 }, { -4828, 3515, -969, -4475 }, { -5789, 2757, -539, -4173 }, { -2452, 3067, 564, -4249 }, { -4921, 1358, 1331, -2889 }, { -3127, 4239, -1045, -1523 }, { -4780, 2326, -1118, -3446 }, { -3908, 5546, 152, -2622 }, { -6972, 2976, 337, -2809 }, { -4839, 4613, -35, -4077 }, { -1408, 4822, -1149, -4997 }, { -981, 4979, -912, -6304 }, { -2098, 5689, -888, -2878 }, { -3343, 4814, -657, -4434 }, { -2461, 3601, -967, -4869 }, { -2652, 3944, 87, -5520 }, { -1104, 6076, 174, -6407 }, { 355, 5370, -1721, -5869 }, { 1242, 4497, -1107, -5091 }, { -89, 4002, -1491, -5182 }, { 1059, 5693, -1591, -4905 }, { 1323, 4682, -2078, -4768 }, { 818, 3996, -549, -5468 }, { -287, 4529, 929, -5543 }, { -919, 5519, -2791, -2844 }, { -1407, 5679, -3289, -3974 }, { -189, 6530, -3547, -4002 }, { -900, 7039, -3371, -4855 }, { -2983, 7211, -363, -4835 }, { -814, 6503, -104, -5106 }, { -2386, 6896, 809, -4919 }, { 845, 4492, 352, -6621 }, { -1998, 7237, -1646, -4231 }, { -3380, 6251, 471, -4577 }, { -1908, 7059, 84, -5726 }, { -340, 6346, -803, -6265 }, { -2279, 5834, -47, -4633 }, { -1532, 5286, -1748, -1901 }, { -2757, 6188, -453, -3415 }, { -1255, 6405, -2043, -6357 }, { 918, 5581, -121, -5667 }, { 1840, 5336, -821, -5034 }, { -2475, 4992, -1825, -3104 }, { -2413, 5606, -1789, -4298 }, { 132, 5128, -2389, -4442 }, { 223, 6400, -2653, -4742 }, { -673, 5012, 680, -4582 }, { -1657, 6624, -349, -3596 }, { -755, 6289, -1860, -3978 }, { -572, 6894, -1946, -5207 }, { -1141, 4756, -2665, -5586 }, { -1073, 4269, -431, -4030 }, { 186, 5761, 916, -5868 }, { -1907, 4836, 1017, -5106 }, { -963, 3363, -1248, -6348 }, { -3262, 4774, -1818, -5858 }, { 847, 3812, -2538, -4302 }, { -1223, 5903, 1360, -5479 }, { -1094, 6923, -1244, -2381 }, { 267, 6276, -709, -2846 }, { -157, 5840, 1124, -4266 }, { 889, 3206, -910, -5305 }, { -1736, 3344, 582, -4838 }, { -2357, 5676, -2695, -6277 }, { -1916, 6901, -986, -5397 }, { -3062, 6028, -695, -5687 }, { 1836, 3566, -1357, -5226 }, { -2176, 4938, 646, -3872 }, { -2199, 3055, -208, -6124 }, { -236, 3032, -821, -5325 }, { -3989, 7277, -565, -3899 }, { -595, 4362, 74, -5975 }, { 684, 5874, -841, -4424 }, { -2731, 6305, -2389, -5465 }, { -5775, 1325, -56, -2528 }, { -7029, -534, -1890, -3278 }, { -5798, -15, -2734, -2210 }, { -5504, -1198, -353, -3659 }, { -5079, 960, -894, -4336 }, { -6073, -36, -133, -3014 }, { -5782, -259, -1025, -3986 }, { -6843, 1262, -807, -1639 }, { -5263, -918, -3290, -579 }, { -4840, 461, -2158, -533 }, { -6014, -50, -620, 504 }, { -5843, 241, -1359, -282 }, { -5898, 577, 769, -3271 }, { -6833, -946, -466, -3347 }, { -6026, 1459, -512, -729 }, { -7361, 747, -388, -1110 }, { -6391, 2142, -1160, -2513 }, { -6995, 304, 498, -2673 }, { -6757, 679, -386, -433 }, { -5222, 1688, -1093, -1032 }, { -5019, 575, 184, -3627 }, { -4237, 628, -3507, -1243 }, { -7479, -456, -1722, -1486 }, { -6464, 713, -1273, -1153 }, { -6255, 1682, -606, -3607 }, { -7033, 1497, -71, -1955 }, { -6694, 1556, -1721, -3214 }, { -6114, -356, 813, -2575 }, { -5308, 632, -1851, -1636 }, { -5742, -911, -1733, 383 }, { -6083, -387, -2313, -879 }, { -6535, -530, -1505, -2083 }, { -4896, 1223, -2750, -1816 }, { -6392, -463, -3247, -2093 }, { -5373, 1264, -2706, -3042 }, { -3894, -1390, -1020, -891 }, { -6179, 1168, -1966, -1922 }, { -5162, 1668, -1617, -1916 }, { -6453, 920, -1169, -2432 }, { -6130, 2005, -536, -1519 }, { -6552, -98, -518, -1938 }, { -7528, 355, -1101, -1772 }, { -5745, 610, -247, -1360 }, { -7003, 177, -2064, -1958 }, { -6956, -570, -2220, -4225 }, { -7830, 791, -1394, -2774 }, { -7634, 480, -3171, -4224 }, { -7913, 1154, -350, -2381 }, { -5063, 1704, -1804, -2977 }, { -4887, -524, -2703, 188 }, { -5551, 406, -1620, -3063 }, { -7109, 1342, 381, -3021 }, { -6846, 631, -458, -3398 }, { -4606, -605, 11, -3930 }, { -8134, -225, -1738, -2648 }, { -7043, 402, -2734, -3059 }, { -7417, 1825, -2545, -4389 }, { -6971, -236, -1031, -665 }, { -5752, 2111, -1632, -3808 }, { -7660, -78, -624, -3135 }, { -6358, 619, -1951, -3911 }, { -8134, 408, -1935, -3695 }, { -6335, 1911, -2368, -4505 }, { -7116, 2163, -344, -2753 }, { 2357, 4488, 2220, -5682 }, { 1385, 3206, 2300, -5305 }, { 1419, 2557, 5203, -3516 }, { 262, 4315, 3920, -1847 }, { 3316, 3187, 1612, -5609 }, { 1729, 2350, 1673, -6068 }, { 1603, 6126, 1467, -2839 }, { -1339, 3316, 3691, -3530 }, { -563, 4618, 3180, -4548 }, { 463, 4624, 3111, -5614 }, { 1246, 5455, 3356, -5720 }, { 480, 2149, 5422, -2893 }, { 1768, 4827, 913, -5579 }, { -149, 5381, 4366, -3297 }, { 985, 3672, 2644, -92 }, { -258, 2911, 5817, -2213 }, { 3428, 3289, 3351, -3541 }, { -666, 3295, 4727, -2869 }, { 35, 6641, 4160, -4052 }, { 623, 6787, 3156, -4560 }, { 2654, 4360, 4676, -4632 }, { 1386, 5246, 4834, -4497 }, { 3488, 4574, 3856, -5946 }, { 383, 4481, 4168, -4110 }, { 1753, 3652, 4288, -3326 }, { 1344, 4905, 2508, -4660 }, { 1580, 4106, 3104, -2224 }, { 2027, 5038, 1683, -1554 }, { 446, 3699, 5872, -3013 }, { 4637, 4087, 3578, -5018 }, { 2629, 3560, 5331, -4900 }, { 1527, 6674, 2523, -4131 }, { -1437, 2804, 2528, -4464 }, { -229, 3355, 2016, -5537 }, { 3666, 3418, 4374, -4581 }, { 1192, 3799, 923, -6596 }, { 2040, 2956, 448, -5322 }, { 2468, 5768, 4029, -5869 }, { 3438, 6516, 3529, -6667 }, { 2737, 5495, 680, -5535 }, { 3896, 5727, 1801, -4958 }, { 4988, 4957, 3592, -6518 }, { -542, 4416, 5794, -2787 }, { 4136, 4354, 2064, -4696 }, { 3067, 5936, 1207, -3396 }, { 2789, 4966, 2405, -3854 }, { 1731, 3270, 3251, -1063 }, { 1767, 5537, 2084, -2349 }, { 465, 3116, 4532, -837 }, { 1499, 2627, 4610, -2212 }, { 122, 3095, 3642, -3552 }, { 2542, 2866, 2705, -6402 }, { 3134, 4323, 698, -4785 }, { 731, 1859, 3112, -5242 }, { 2553, 2980, 3241, -4846 }, { 1329, 5310, 1607, -6624 }, { 2468, 1858, 3476, -1034 }, { -172, 4996, 2000, -5562 }, { 2621, 4220, 1574, -3386 }, { -333, 1832, 3362, -4117 }, { 2169, 6762, 3065, -6225 }, { 2844, 5528, 3223, -4765 }, { 526, 5175, 1644, -4267 }, { 2922, 4426, 2414, -2610 }, { 452, 1399, -4516, -2636 }, { 2872, 1720, -4667, -1435 }, { 1279, 702, -5424, -1984 }, { 2187, 870, -5021, -1341 }, { 583, -144, -4628, -2464 }, { 3, 2237, -5284, -2827 }, { -19, 1005, -5460, -1819 }, { 2897, 2084, -5885, -515 }, { -400, 3370, -5527, -2947 }, { 1505, 2593, -5518, -1802 }, { 1341, 4534, -5094, -1899 }, { 3241, 3670, -5493, -1252 }, { -1287, 921, -5994, -1675 }, { 627, 408, -6652, -364 }, { -260, 1127, -4849, -3247 }, { 371, 3400, -5976, -2285 }, { 1533, 1566, -6373, -610 }, { 2462, 4274, -6184, -1254 }, { 1782, 3363, -6222, -1381 }, { 572, 4650, -5673, -2754 }, { 2674, 3414, -4460, -2154 }, { 3614, 3820, -6883, -398 }, { 1136, -1, -5511, -1112 }, { -1773, 1137, -5647, -2377 }, { -753, 2104, -6085, -2565 }, { -204, 3025, -4731, -1418 }, { -1486, 1438, -4380, -216 }, { 302, 858, -5786, -264 }, { 3486, 1495, -5234, -783 }, { 888, 2327, -3423, -3720 }, { -259, 772, -6596, -1311 }, { -1197, 2073, -5174, -1826 }, { 1500, 3470, -4462, -2645 }, { 3072, 1960, -3277, -2264 }, { 1841, 952, -4324, -2340 }, { 1994, 2200, -3940, -2923 }, { -1782, 1699, -4667, -1075 }, { -1464, 2906, -3468, -375 }, { 366, 2380, -3747, 1467 }, { -545, 1645, -4619, 376 }, { 1724, 2350, -2374, -3512 }, { 3184, 2628, -2996, -3275 }, { 734, 2010, -6239, -1479 }, { 524, 3756, -4496, -3263 }, { 1492, 3570, -3494, -3600 }, { -932, 618, -5389, -2894 }, { -133, 2161, -4083, -3267 }, { 786, 774, -3279, -3731 }, { 1078, 803, -3843, -3007 }, { -332, 3405, -3347, 40 }, { -17, 6, -4005, -3690 }, { -189, 4372, -4488, -2561 }, { -450, 3846, -3790, -1370 }, { 362, 2212, -5272, -15 }, { -1529, 791, -6802, -2296 }, { 2145, 4241, -4474, 376 }, { 1813, 2426, -2932, -2726 }, { -542, 4557, -3140, -1080 }, { 1192, 3784, -4371, -20 }, { 2784, 5188, -6399, -1394 }, { 431, 4561, -3673, -1398 }, { 1382, 3096, -4083, 1253 }, { 1209, 4224, -2930, 1500 }, { 2798, 2684, -6676, -606 }, { -2396, 1510, -5381, -2713 }, { -2625, 2542, -4032, -2880 }, { -1231, 3967, -4098, -2886 }, { -1393, 2374, -3862, -4525 }, { -2495, 1665, -1637, -5445 }, { -3854, 1759, -1750, -4944 }, { -2373, 1668, -2856, -6251 }, { -2668, 1981, -886, -4557 }, { -2927, 4427, -3451, -6172 }, { -1925, 2596, -4696, -2527 }, { -3202, 2847, -3928, -5896 }, { -3332, 1665, -5025, -3412 }, { -3212, 3115, -4155, -4062 }, { -1013, 3205, -5133, -3751 }, { -2022, 4595, -3947, -5611 }, { -3556, 1755, -3715, -2300 }, { -1784, 4114, -2723, -1773 }, { -3586, 4081, -2733, -4942 }, { -1608, 3685, -4154, -4573 }, { -3368, 4042, -4452, -6227 }, { -1407, 3881, -5729, -3719 }, { -2751, 3281, -5077, -4999 }, { -3791, 2410, -4906, -5288 }, { -730, 2303, -4217, -3755 }, { -1812, 2311, -5492, -3709 }, { -610, 4336, -3915, -3783 }, { -2841, 4337, -4278, -4430 }, { -1662, 4666, -4661, -3964 }, { -589, 5209, -4923, -3682 }, { -4155, 2234, -4076, -4218 }, { -3951, 2770, -2665, -2805 }, { -2302, 3228, -3717, -1908 }, { -3129, 4373, -2264, -2851 }, { -447, 1363, -3578, -4323 }, { -2648, 4237, -3159, -3071 }, { -4072, 3241, -3541, -4605 }, { -4507, 3458, -2339, -3838 }, { -1646, 997, -4926, -3970 }, { -3025, 1614, -3940, -1242 }, { -1337, 1756, -3163, -5529 }, { -3203, 1865, -3282, -4354 }, { -1646, 2118, -2203, -6018 }, { 174, 1871, -2707, -4639 }, { -2607, 1485, -4778, -4750 }, { -2199, 3991, -3134, -4879 }, { -2962, 3323, -2816, -2419 }, { -5286, 2495, -4548, -5395 }, { -2810, 3710, -2274, -4211 }, { -330, 3006, -2993, -4678 }, { -1187, 2411, -2743, -5196 }, { -664, 4033, -3101, -5641 }, { -1458, 3602, -2816, -5371 }, { -4116, 4923, -3321, -5630 }, { -4165, 2528, -2592, -4798 }, { -2759, 3080, -2333, -5719 }, { -5157, 3011, -5526, -6348 }, { -3095, 2126, -5881, -4234 }, { -4377, 3849, -3600, -6099 }, { -1994, 4947, -5235, -4753 }, { -1067, 600, -3258, -5133 }, { -4992, 3302, -2208, -5051 }, { -3377, 2981, -1655, -4815 }, { -3325, 2446, -1787, -6116 }, { -2341, 2737, -3240, -6347 }, { -2258, -3732, 3710, -1235 }, { -1558, -3849, 2694, -3012 }, { -599, -4837, 3050, -2951 }, { -2246, -5433, 2798, -1910 }, { -2255, -4989, 3260, 270 }, { -3026, -5353, 2693, -1036 }, { -1151, -6097, 1097, -3782 }, { -3391, -6012, 2130, -1303 }, { -2850, -4422, 3375, -480 }, { -1138, -3779, 1491, -4162 }, { -551, -3892, 3787, -2082 }, { -3221, -3676, 3144, -1202 }, { -3023, -5196, 2650, 605 }, { -1756, -5729, 2646, 321 }, { -2693, -4409, 494, -4797 }, { -1913, -4573, 3372, -1730 }, { -1277, -3604, 4061, -993 }, { -420, -4993, 1351, -4796 }, { -3052, -5333, 1435, -1242 }, { -602, -5034, 3869, -1141 }, { -2436, -4680, 1665, -3019 }, { -2657, -3658, 1459, -3391 }, { -1220, -6246, 2749, -525 }, { -3838, -4844, 2265, -1735 }, { -1247, -5679, 3356, -1417 }, { -917, -5448, 3342, 105 }, { -1756, -6839, 2276, -2350 }, { -412, -5206, 1764, -3539 }, { -1439, -6915, 1442, -3750 }, { -1381, -4439, 3863, -282 }, { -3482, -4953, 2726, -336 }, { -1376, -5931, 1714, -1987 }, { -1716, -4405, 2608, 105 }, { -1590, -5191, 2652, -2704 }, { -2149, -6442, 2453, -1263 }, { -3426, -3832, 2334, -1829 }, { -2747, -5948, 2362, -173 }, { -2435, -3267, 2966, -1710 }, { -3979, -4282, 2705, -775 }, { -356, -4238, 2544, -4343 }, { -1363, -6471, 2817, -1836 }, { -2878, -5117, 218, -3149 }, { -3539, -5196, 1710, -2356 }, { -2888, -4537, 2746, -1701 }, { -1870, -4439, 1496, -4121 }, { -1486, -3388, 3349, -2145 }, { -3333, -4138, 1467, -2876 }, { -345, -5340, 1012, -1190 }, { -1672, -4992, 2289, -1029 }, { -2146, -5528, 3038, -635 }, { -316, -3656, 3426, -3152 }, { -2695, -5812, 2336, -2050 }, { -2067, -6052, 737, -3258 }, { -2664, -4205, -350, -1266 }, { -617, -5406, 80, -4853 }, { -2418, -3825, 1853, -1326 }, { -1961, -4339, 583, -4315 }, { -1495, -5141, -133, -5205 }, { -3208, -6440, 1691, -2069 }, { -2632, -3633, 2325, -2761 }, { -2624, -5670, 1252, -3676 }, { -3687, -5608, 687, -2833 }, { -3320, -5707, 16, -3877 }, { -2738, -6112, 84, -5135 }, { 2277, -5661, 3076, 843 }, { 1555, -5769, 2821, -5236 }, { 536, -6381, 603, -4910 }, { 734, -4609, 3314, -4092 }, { 1836, -4547, 3267, -4322 }, { -13, -5976, 3752, -1607 }, { 1423, -6318, 2336, 398 }, { 365, -7779, 1498, -534 }, { 2104, -8366, 2946, -1345 }, { 143, -5545, 1898, -3756 }, { 655, -6852, 1430, 148 }, { 4, -6653, 2397, -59 }, { 2346, -5996, 4562, -934 }, { 1229, -7104, 2963, -598 }, { -528, -7048, 2887, -1790 }, { 1451, -6857, 3900, -1637 }, { 554, -6018, 3336, 9 }, { 3278, -5758, 4034, 129 }, { 3541, -7145, 4905, -1575 }, { 2339, -6907, 3464, -301 }, { 2775, -7301, 1667, -3894 }, { 539, -7887, 991, -4156 }, { 2115, -7421, 3131, -3075 }, { 2803, -8546, 2564, -5836 }, { 2869, -5833, 1620, -4561 }, { 2591, -7281, 3215, -4719 }, { -1228, -8477, 706, -4782 }, { 1967, -5243, 4813, -1940 }, { 701, -7010, 2273, -3893 }, { 915, -8470, 1918, -5620 }, { -94, -6715, 156, -3873 }, { 1074, -5607, 4389, -1017 }, { 2739, -6551, 1227, -3521 }, { 725, -7835, 2701, -1291 }, { -493, -7475, 2263, -1075 }, { -412, -6508, 2984, -744 }, { 665, -5451, 3725, -2692 }, { 1499, -8129, 3564, -2072 }, { 2870, -6333, 4487, -2108 }, { 706, -5007, 3911, -152 }, { -482, -8660, 1483, -2900 }, { 2481, -6596, 2518, -1715 }, { 1403, -6414, 1398, -5387 }, { 652, -6267, 583, -5942 }, { 694, -7540, 646, -6272 }, { 2275, -7614, 256, -5015 }, { 1416, -9727, 1900, -3153 }, { 2760, -6433, 3875, -3771 }, { 2325, -11196, 2182, -5155 }, { 1223, -11061, 1377, -5097 }, { 108, -10603, 307, -4952 }, { -118, -8268, 1650, -1572 }, { 1839, -7943, 1755, -612 }, { 2501, -9056, 981, -2969 }, { 2902, -8476, 1491, -5780 }, { 1995, -11175, 1585, -3643 }, { 696, -8212, 828, -2474 }, { 1526, -8649, 1380, -1210 }, { 461, -7253, 3222, -2229 }, { 2966, -8641, 4121, -3271 }, { 833, -6039, 2361, -1086 }, { 3565, -7312, 1980, -5427 }, { 2850, -8671, 3760, -1846 }, { 2643, -7281, 2163, -173 }, { 3463, -3706, -3132, -923 }, { 1315, -3825, -3443, 2 }, { 2594, -4083, -3815, 670 }, { 1826, -4291, -2741, -155 }, { 868, -3749, -4175, -298 }, { 2008, -4237, -3897, -517 }, { 1242, -3493, -4335, -1335 }, { -88, -4142, -3390, -1529 }, { 2176, -3488, -3822, -975 }, { 1706, -5188, -3415, -637 }, { 2717, -6159, -2333, -882 }, { 1276, -3978, -4361, 537 }, { 2471, -5556, -2866, -208 }, { 799, -4673, -4086, 56 }, { 1901, -4786, -3533, 270 }, { 3036, -3902, -3606, -333 }, { 2249, -3317, -4319, -144 }, { 2594, -4207, -2105, -2930 }, { 4008, -4774, -2626, -902 }, { 1038, -3659, -3496, -2454 }, { 2725, -3597, -3298, -1535 }, { 1662, -5803, -2813, 175 }, { 705, -3757, -3441, -1484 }, { 1860, -5987, -2821, -886 }, { 3786, -4918, -2199, -1929 }, { 3683, -4235, -2547, -1287 }, { 2531, -4896, -2956, -1593 }, { 1005, -5585, -3324, -180 }, { 1625, -5229, -1756, -3642 }, { 1494, -5041, -2989, -2685 }, { 2718, -4655, -3224, -867 }, { 2374, -6640, -1745, -2975 }, { 2133, -6436, -2477, -1499 }, { 1833, -4418, -3523, -1512 }, { 1128, -4910, -2658, -1106 }, { 689, -4777, -2831, -2085 }, { 3593, -5280, -2627, -315 }, { 3264, -3771, -2673, -1861 }, { 3202, -5602, -2409, 402 }, { 552, -4618, -2221, -3002 }, { 3095, -5356, -2666, -1083 }, { 3401, -4609, -3146, 45 }, { 3051, -4662, -2192, -2232 }, { 2798, -5552, -2462, -1941 }, { 2354, -5815, -2223, -2619 }, { 192, -3708, -2807, -2658 }, { 1886, -4226, -1862, -3529 }, { 2526, -3976, -2819, -2332 }, { 1577, -3870, -2711, -2806 }, { 1288, -5588, -3382, -1403 }, { 2711, -5399, -1564, -3253 }, { 1459, -5492, -2222, -322 }, { 2823, -5091, -2886, 776 }, { 3559, -5821, -2109, -1360 }, { 1587, -6331, -2760, -1909 }, { 2139, -5213, -2874, -2120 }, { 1318, -4337, -3695, -2098 }, { 821, -4471, -1849, -565 }, { 3329, -4782, -1725, -89 }, { 582, -4914, -4105, -1119 }, { 417, -4144, -4072, -2529 }, { -199, -3803, -2765, -4042 }, { 2731, -4283, -2143, 1 }, { 2911, -6187, -1951, -2116 }, { 1573, -6094, -493, -2838 }, { 2081, -6927, -864, -3211 }, { 1058, -7826, 79, -364 }, { 3147, -5570, -684, -978 }, { 3572, -5856, 1060, 1824 }, { 1143, -6702, -1478, 338 }, { 2341, -7220, -88, 260 }, { 3639, -6861, 668, 815 }, { 2227, -6268, -1706, 446 }, { 3390, -6082, -353, 1302 }, { 1123, -7556, -1237, -430 }, { 1729, -7742, 729, -218 }, { 1457, -6774, 587, 579 }, { 505, -6919, -569, 371 }, { 1106, -7245, 78, 158 }, { 2755, -6745, -1122, 338 }, { 3069, -6040, -1415, 986 }, { 2174, -7064, -1430, -283 }, { 1390, -8626, -446, -3031 }, { 3534, -6890, -431, 547 }, { 2267, -9618, 475, -2994 }, { 3672, -7673, 75, -115 }, { 2131, -7560, -1206, -750 }, { 2972, -7477, -685, -262 }, { 1604, -6637, -672, 699 }, { 1666, -7577, -577, -240 }, { 1591, -6554, -2158, -94 }, { 2348, -6286, -353, 1123 }, { 2017, -8810, -412, -1805 }, { 2892, -6713, -1765, -554 }, { 2500, -6828, -1995, -1197 }, { 3877, -6639, -224, -1655 }, { 2392, -7872, -91, -333 }, { 3562, -7370, -532, -2836 }, { 2552, -7614, 164, -1805 }, { 990, -6104, 218, 438 }, { 910, -7861, 312, -1195 }, { 1472, -6327, 372, -640 }, { 1576, -7143, -1983, -843 }, { 422, -7625, -457, -278 }, { 1797, -8532, 405, -1011 }, { 1088, -7396, -238, -2277 }, { 3209, -6753, -1431, -2072 }, { 2617, -6839, 100, -2573 }, { 2575, -8573, -387, -3188 }, { 3618, -6971, -1190, -321 }, { 2205, -7361, -1695, -2008 }, { 2985, -6297, 1464, 1179 }, { 2804, -7310, 1053, 338 }, { 1362, -6074, -1163, -840 }, { 3336, -6325, -1794, 21 }, { 2836, -8109, 818, -329 }, { 2791, -5879, 560, 1546 }, { 2392, -6064, 135, 100 }, { 1838, -6194, 596, 1085 }, { 1926, -7515, -414, -4901 }, { 3225, -7298, -1202, -1189 }, { 3960, -7558, -659, -719 }, { 3442, -6647, -1692, -1095 }, { 3381, -6441, 262, -886 }, { 1431, -8150, -1186, -1406 }, { 340, -8498, -150, -899 }, { 3004, -8149, -260, -953 }, { 2749, -6611, 563, 873 }, { -6647, -1325, -4517, -4691 }, { -6005, -1657, -4089, -3797 }, { -3157, 588, -5213, -3068 }, { -3311, -1425, -6329, -3726 }, { -5866, -819, -3857, -2744 }, { -5001, -1799, -1075, -4621 }, { -5330, -2650, -2672, -4664 }, { -4930, -539, -2363, -4010 }, { -2984, 10, -3863, -5749 }, { -1055, -2106, -3713, -4267 }, { -5476, -502, -4279, -6504 }, { -5231, -1543, -5018, -6425 }, { -5134, -363, -3165, -5109 }, { -3953, -771, -4107, -6393 }, { -2159, -563, -3652, -5342 }, { -3888, -2321, -919, -5057 }, { -1236, -597, -4235, -4193 }, { -4053, 675, -3083, -6174 }, { -2793, -1089, -5396, -3460 }, { -3000, -44, -2209, -6575 }, { -3336, -1531, -4313, -5160 }, { -2127, 128, -4851, -3692 }, { -3321, 136, -2067, -5660 }, { -5215, 1404, -4374, -4356 }, { -2747, 400, -6340, -3691 }, { -3926, -599, -5361, -5006 }, { -2875, -2592, -5143, -4092 }, { -4991, -1958, -5322, -4891 }, { -4965, -1318, -6652, -5333 }, { -4920, -1691, -3388, -5561 }, { -3644, -3354, -2688, -5982 }, { -5076, -919, -4563, -2984 }, { -6114, 250, -3884, -3915 }, { -4014, 744, -3973, -1924 }, { -5543, -1041, -5557, -3847 }, { -4711, -1352, -5649, -2603 }, { -3362, 775, -5305, -4879 }, { -5001, 107, -3554, -2888 }, { -6258, -1651, -6356, -6566 }, { -4529, 407, -5003, -3865 }, { -5154, 550, -5278, -5465 }, { -4195, -467, -1894, -3129 }, { -5022, 1127, -3349, -3314 }, { -6075, 1250, -4313, -5641 }, { -2677, -2283, -2312, -5903 }, { -4113, 193, -1195, -4833 }, { -3940, -1048, -1389, -5079 }, { -3703, 917, -4043, -4451 }, { -3366, -4231, -1534, -5488 }, { -3326, -3583, -2091, -4903 }, { -5144, 1254, -2532, -4949 }, { -5982, -870, -2545, -4555 }, { -3925, -157, -5367, -2281 }, { -6419, -746, -5668, -4371 }, { -5787, 518, -7096, -5805 }, { -4258, 954, -6453, -4321 }, { -4771, -695, -4158, -1639 }, { -7078, -760, -5195, -5877 }, { -7348, 83, -4101, -4586 }, { -2430, 184, -2874, -1679 }, { -2284, -3943, -2924, -5034 }, { -1804, -1785, -3002, -4710 }, { -4399, -2772, -1815, -4637 }, { -6340, -2626, -2824, -5191 }, { -4998, -5168, -3480, 1905 }, { -3958, -5492, -1599, 1579 }, { -2471, -3755, -276, 3182 }, { -3033, -5779, -1063, 1554 }, { -2936, -4829, -1290, 2386 }, { -1835, -5073, -3051, 1299 }, { -1724, -3771, -3935, 2324 }, { -5070, -2550, -3692, 768 }, { -4326, -5333, -297, 1878 }, { -3472, -5619, -3094, 992 }, { -3027, -4384, -3038, 2265 }, { -3201, -5332, 67, 2200 }, { -1681, -4373, -1947, 2461 }, { -3221, -3329, -4238, 2564 }, { -1262, -2968, -2915, 3227 }, { -3419, -1878, -3373, 2110 }, { -2244, -5583, -2012, 1288 }, { -1971, -5266, -990, 1812 }, { -2975, -2778, -452, 4063 }, { -2198, -1165, -3298, 2965 }, { -4782, -4894, -4767, 664 }, { -6002, -3950, -2806, 2025 }, { -3142, -3162, -2859, 3295 }, { -3262, -3340, -4123, 1596 }, { -4014, -3918, -1955, 3361 }, { -1700, -3463, -1346, 3449 }, { -4245, -4445, -4743, 1644 }, { -4180, -3969, -401, 3281 }, { -2782, -5240, -4117, 1156 }, { -5744, -4040, -1439, 3470 }, { -5063, -4663, -323, 3172 }, { -4531, -3319, -844, 3988 }, { -6226, -5125, -2064, 2976 }, { -3115, -3267, -1531, 3898 }, { -4628, -4421, -2864, 2808 }, { -4559, -2989, -3442, 2024 }, { -1775, -4487, -656, 2477 }, { -2664, -1865, -1884, 4081 }, { -1828, -2575, -3894, 3378 }, { -6441, -3677, -2025, 1677 }, { -4141, -2156, -1191, 3474 }, { -4802, -1623, -1727, 2160 }, { -5474, -2745, -1475, 2498 }, { -3664, -1056, -1975, 2491 }, { -4672, -3062, -2235, 2933 }, { -4205, -5960, -2849, 1517 }, { -4995, -5708, -1739, 1805 }, { -4892, -6080, -4793, 872 }, { -4270, -4172, -4263, 2185 }, { -4687, -1470, -2905, 1023 }, { -6446, -5017, -3919, 1000 }, { -6046, -5538, -3943, 2006 }, { -6028, -3750, -3953, 771 }, { -5959, -4582, -5024, 824 }, { -5818, -2576, -2249, 1326 }, { -5659, -5345, -1119, 2500 }, { -3346, -4155, 606, 2749 }, { -5680, -4827, -2501, 1838 }, { -6193, -2543, -1295, 840 }, { -6871, -4925, -3512, 1801 }, { -5605, -1788, -1895, 779 }, { -3922, -5712, -4644, 510 }, { -4745, -3869, -4533, 99 }, { -2984, -4907, -399, 1497 }, { 1847, -478, 3061, -5812 }, { 4450, -1116, 3609, -6570 }, { 3139, 99, 3007, -5532 }, { 2590, -3782, 3138, -4770 }, { 1881, 1204, 5778, -3404 }, { 3631, 2060, 5566, -5038 }, { 3461, 1961, 5167, -3800 }, { 2947, 273, 4536, -4389 }, { 4453, -1730, 5788, -4370 }, { 4032, 1805, 2666, -4534 }, { 3487, -944, 2313, -6028 }, { 1313, 34, 4210, -4067 }, { 5632, -1502, 5825, -5855 }, { 7736, -547, 4879, -5476 }, { 4906, -1512, 4760, -5760 }, { 3843, 447, 1091, -4958 }, { 2982, -1135, 5442, -4386 }, { 3579, 271, 3031, -6770 }, { 3932, -211, 4688, -5507 }, { 4411, 1720, 2387, -5584 }, { 5379, -479, 4575, -6280 }, { 3613, -362, 2012, -4885 }, { 3744, -2013, 4493, -5073 }, { 5693, 109, 4379, -3362 }, { 5475, -621, 5317, -3985 }, { 6411, -673, 5708, -4752 }, { 4933, -796, 7262, -4290 }, { 2804, 444, 6276, -3655 }, { 4120, -517, 6078, -4531 }, { 5119, 841, 3486, -3910 }, { 4738, 1539, 3525, -2970 }, { 5086, 370, 5895, -5640 }, { 4235, 2716, 4589, -5044 }, { 3691, 682, 6199, -4700 }, { 6111, -570, 6271, -6528 }, { 2611, 1277, 3756, -4802 }, { 4395, 970, 3807, -5879 }, { 5225, 2299, 3242, -4333 }, { 5144, 1778, 4946, -5545 }, { 2989, -3016, 3247, -5495 }, { 2983, 920, 2071, -6059 }, { 5270, -903, 4434, -2350 }, { 6415, -585, 3970, -3554 }, { 3866, -197, 5216, -2884 }, { 3767, -1298, 6702, -3315 }, { 6299, 2620, 5284, -6824 }, { 6654, 646, 3653, -4927 }, { 4770, 3047, 5160, -6287 }, { 5364, 434, 2919, -5207 }, { 2998, 1344, 4801, -2456 }, { 3896, 1013, 3773, -1864 }, { 2115, 655, 2999, -6344 }, { 5170, -981, 2849, -4464 }, { 2735, -2159, 2717, -5776 }, { 2430, -1952, 4392, -4559 }, { 6143, -1180, 3659, -4746 }, { 4978, -1483, 1726, -4875 }, { 3486, -2383, 3306, -4301 }, { 1434, -1372, 4171, -4770 }, { 3354, -2627, 1525, -5093 }, { 6790, 2386, 3995, -5909 }, { 1475, -2674, 3451, -4204 }, { 1999, -3494, 3693, -5556 }, { 4764, -2848, 2856, -5589 }, { -3677, 5131, 2827, -2934 }, { -2844, 7078, 2852, -3580 }, { -3902, 6434, 4118, -1911 }, { -1769, 7530, 3492, -3541 }, { -1937, 5679, -447, -1127 }, { -2456, 4680, 4196, -2407 }, { -2778, 8241, 1698, -4288 }, { -2876, 6104, 5182, -2387 }, { -2802, 7341, 4463, -2938 }, { -1025, 6267, 4752, -3201 }, { -2349, 5413, 2041, -3794 }, { -2252, 8225, 2856, -4269 }, { -1465, 4967, 4976, -2500 }, { -636, 7565, 3517, -4233 }, { -1905, 5618, 3904, -2942 }, { -302, 6816, 3343, -3316 }, { -2210, 4156, 2817, -3511 }, { -717, 6568, 1863, -2951 }, { -3873, 5682, 2164, -575 }, { -2878, 5835, 440, -2597 }, { -3228, 7701, 2610, -2514 }, { -3608, 8888, 3377, -2468 }, { -2582, 9717, 2519, -3126 }, { -5238, 6202, 2866, -2831 }, { -3428, 7370, 3056, -335 }, { -1681, 8836, 1210, -2010 }, { -3276, 6724, 1156, -3930 }, { -894, 8149, 827, -1258 }, { -2965, 8631, 2549, -1320 }, { -3961, 6902, 3581, 55 }, { -1894, 7745, 1750, -841 }, { -821, 6844, 850, -676 }, { -608, 6948, -4, -1376 }, { 615, 6524, 1089, -1147 }, { -2972, 5668, 1091, -489 }, { -157, 4649, 2904, -413 }, { 673, 5121, 1498, -66 }, { -390, 5902, 1611, -245 }, { -2349, 5478, 4772, -1320 }, { 88, 6798, 1972, -1859 }, { -1213, 5120, 2991, 200 }, { -2347, 6040, 2839, 376 }, { -578, 5976, 3364, -1796 }, { -1391, 5872, 3002, -965 }, { -564, 4496, 3946, -1186 }, { -2299, 6386, 3135, -2176 }, { -2131, 5641, 2011, 1223 }, { -772, 5807, 1124, 895 }, { -2837, 6758, 2297, -740 }, { -3091, 6298, 1415, -2126 }, { -4197, 6036, 1843, -3022 }, { -41, 6459, 92, 344 }, { -2241, 6860, 2095, -4396 }, { -1931, 7088, 2117, -2135 }, { -2375, 4422, 1688, -3169 }, { -1742, 6674, 1538, -119 }, { -4818, 7749, 4192, -1577 }, { -2004, 5672, 193, -430 }, { -3825, 6042, 2128, -1898 }, { -1108, 8033, 2119, -3013 }, { -2370, 5453, 1721, 266 }, { -1570, 7134, 614, -2638 }, { -1519, 8752, 3503, -4330 }, { -2050, 3845, 2907, -1126 }, { 5085, 4412, -335, -1923 }, { 3618, 1423, -613, -4012 }, { 4481, 3729, 589, -4631 }, { 4270, 3216, -1763, -3168 }, { 4241, 1796, -1701, -2796 }, { 4787, 2338, -487, -3639 }, { 2915, 3429, -621, -4753 }, { 5175, 1660, -1265, -3223 }, { 4280, 4057, -684, -4079 }, { 4980, 4419, -1455, -2719 }, { 5436, 2464, 387, -4197 }, { 4507, 4018, 1121, -3314 }, { 6020, 2401, -413, -3201 }, { 4200, 3789, -333, -2813 }, { 5229, 2493, -1194, -1878 }, { 5851, 2695, -492, -2292 }, { 5743, 3288, -697, -1221 }, { 5692, 2612, 979, -2227 }, { 5085, 2067, 1046, -1214 }, { 3163, 2240, -2098, -3435 }, { 5228, 1898, 145, -2397 }, { 5860, 3976, -418, -2872 }, { 6008, 3399, 1027, -3506 }, { 4126, 2035, 1865, -893 }, { 5375, 3596, 511, -2362 }, { 1937, 1493, -852, -122 }, { 3473, 4849, 547, -2603 }, { 4631, 2977, 1141, -1768 }, { 6149, 3050, -71, -1886 }, { 4069, 4353, -289, -1429 }, { 2884, 1225, -1388, 365 }, { 5485, 2518, -235, -571 }, { 1216, 4375, 1443, 398 }, { 4988, 3106, 107, -1435 }, { 4511, 2801, 307, -444 }, { 3235, 4386, 327, -676 }, { 2055, 3708, 1657, -305 }, { 5839, 2374, 290, -1385 }, { 5110, 3305, 1936, -4206 }, { 6416, 2920, 338, -2736 }, { 3350, 2824, -1269, -3881 }, { 4840, 1815, 464, 186 }, { 2399, 3332, 238, 1238 }, { 3516, 1363, 1582, 688 }, { 3582, 1874, 154, -4770 }, { 3261, 2878, 886, 283 }, { 3877, 2658, -327, 884 }, { 4151, 3436, 2173, -2923 }, { 3592, 3674, 1281, -1295 }, { 4561, 3730, -1114, -1747 }, { 4595, 3625, -558, -575 }, { 2577, 2348, 2267, 120 }, { 5242, 3299, 32, -3412 }, { 4264, 3637, 709, -2320 }, { 6556, 3570, -838, -2472 }, { 5745, 4014, -940, -1973 }, { 5629, 4475, 477, -3328 }, { 5269, 3199, 1682, -3085 }, { 4432, 2416, 1145, -3299 }, { 4465, 2505, 2162, -2186 }, { 4643, 4941, -88, -2885 }, { 4568, 5231, 552, -3915 }, { 5667, 3075, -1406, -2963 }, { 5418, 5259, -771, -2818 }, { -256, -7875, 511, -471 }, { -1813, -7971, -424, -396 }, { -306, -7006, 862, 282 }, { -2306, -6422, -1440, 508 }, { -245, -6787, 375, -100 }, { -1309, -6065, -20, 779 }, { -1656, -6047, -641, 1307 }, { -1496, -6522, 964, 726 }, { -2291, -6588, -202, 795 }, { -762, -7522, 1454, -558 }, { -2270, -7004, -834, -580 }, { -1139, -7078, 259, 362 }, { -2535, -7568, -1040, 49 }, { -3786, -7280, 934, -476 }, { -3336, -6368, 606, 1056 }, { -3602, -6924, 52, 714 }, { -2278, -6550, 1674, 204 }, { -2855, -5765, 930, 1530 }, { -2889, -7325, -215, 305 }, { -2749, -6080, -237, 1452 }, { -985, -6667, 1577, 400 }, { -2036, -6083, 380, 1267 }, { -2077, -7460, 380, -30 }, { -1775, -7175, 1540, -386 }, { -3065, -6927, 989, 168 }, { -2836, -7602, 117, -3392 }, { -1058, -6396, 593, -3078 }, { -844, -6062, 999, -236 }, { -3261, -6951, 1491, -720 }, { -2186, -8484, 75, -1287 }, { -2882, -7756, 456, -510 }, { -1800, -6879, 960, -1183 }, { -2554, -7241, 1614, -1474 }, { -2608, -5305, 392, 851 }, { -2973, -6562, -859, 858 }, { -2640, -5989, 1031, -416 }, { -977, -8366, 705, -1434 }, { -1213, -7409, -77, -1390 }, { -1335, -6657, 2125, -123 }, { -2544, -6862, 1852, -737 }, { -3235, -6422, 1752, -103 }, { -1300, -7557, 939, -348 }, { -3476, -7579, 202, -109 }, { -2482, -6572, 753, 619 }, { -2554, -8136, -648, -429 }, { -1012, -7870, -3, -421 }, { -3604, -6247, 32, -3102 }, { -1486, -7271, 2013, -1021 }, { -578, -6799, -523, 405 }, { -2841, -5948, 1644, 911 }, { -2411, -7473, 1084, -484 }, { -2238, -6033, 294, -1059 }, { -3459, -6470, -201, -790 }, { -2027, -6009, 1833, 805 }, { -1433, -8047, 1531, -1754 }, { -3258, -7884, 763, -1422 }, { -1544, -6928, -729, 478 }, { -2314, -8415, 74, -3757 }, { -3201, -5684, 95, -2214 }, { -2423, -8694, 725, -3631 }, { -3545, -7071, 1162, -1798 }, { -294, -9662, 403, -2274 }, { -2290, -5460, 1196, 402 }, { -1603, -6713, 903, -2363 }, { 4121, 2491, -3142, -2482 }, { 4500, 3305, -3671, -1567 }, { 5973, 3172, -1348, -534 }, { 4830, 3379, -1549, 643 }, { 5214, 3938, -2641, -2302 }, { 4639, 4826, -5532, -847 }, { 5639, 2731, -2170, -963 }, { 6084, 3487, -3525, -1346 }, { 5971, 3154, -2190, -2316 }, { 5618, 4865, -6927, 116 }, { 5345, 3568, -7391, 709 }, { 5429, 5078, -3811, -1524 }, { 6960, 2037, -3515, -1096 }, { 7092, 2531, -4557, -588 }, { 6061, 4247, -5651, -478 }, { 4595, 3684, -4907, -827 }, { 7497, 3213, -3048, -424 }, { 5996, 2137, -3098, -1745 }, { 6198, 5199, -2223, -2274 }, { 6888, 2851, -2768, -1675 }, { 6114, 4210, -2316, -954 }, { 7127, 4242, -3041, -1408 }, { 6126, 3668, -1517, -1427 }, { 6245, 6129, -4225, -1186 }, { 6816, 3213, -2101, -964 }, { 5345, 5276, -2643, -847 }, { 6592, 4665, -4338, 484 }, { 6746, 3751, -3443, 124 }, { 5453, 1980, -2738, 2606 }, { 4662, 2179, -4226, -1059 }, { 5571, 3208, -3554, 174 }, { 5256, 4447, -1815, -1481 }, { 5400, 2570, -1210, 235 }, { 7056, 2549, -2674, 318 }, { 4574, 4340, -2892, -130 }, { 6203, 4587, -3273, -305 }, { 5103, 1925, -2715, -2137 }, { 3905, 4296, -1700, 247 }, { 4421, 4605, -3299, 811 }, { 5671, 1273, -3870, -924 }, { 5486, 1805, -4901, 133 }, { 6437, 2578, -1828, -106 }, { 5530, 5253, -5058, 1223 }, { 4816, 2025, -1215, 1443 }, { 3457, 3525, -2456, 3217 }, { 3316, 2595, -1108, 2459 }, { 3068, 3810, -2207, 1926 }, { 6351, 5436, -6470, 600 }, { 6324, 4240, -5365, 2416 }, { 4851, 4774, -4075, 1878 }, { 4900, 3679, -5198, 1078 }, { 8347, 3633, -4565, -171 }, { 5244, 5718, -3853, 173 }, { 3960, 3492, -2939, 2105 }, { 6070, 3473, -2351, 161 }, { 8228, 3034, -3360, -901 }, { 7006, 3985, -1940, -1926 }, { 7123, 4681, -4301, -878 }, { 5122, 4097, -1851, -449 }, { 6200, 2060, -2251, 1049 }, { 7106, 3844, -7209, 2625 }, { 7108, 3370, -6734, 533 }, { 6859, 2849, -3992, 1360 }, { 5458, 2278, -3253, 1131 }, { -1072, -2109, 4783, -1073 }, { -319, -2604, 4257, -2418 }, { 2466, 1300, 3476, -314 }, { 2847, -1502, 5296, -141 }, { 1667, -1273, 5559, -2725 }, { 2877, -3402, 6434, 204 }, { 53, -2637, 5275, -1181 }, { 1091, -2215, 5803, -1549 }, { 2397, -922, 4327, 1182 }, { 219, -3747, 4647, -1564 }, { -29, -2705, 4812, 1277 }, { 1499, -2608, 5648, 1407 }, { 2139, -2399, 4202, 2791 }, { -426, -2064, 5528, 151 }, { 2560, -2803, 6179, -2806 }, { 4537, -2479, 3797, 1095 }, { 888, -3357, 5341, -415 }, { 4460, -1814, 5388, -1227 }, { 3920, -3268, 6364, -703 }, { 3343, -4698, 4410, 784 }, { 309, -1897, 6306, 1223 }, { 958, -3318, 4254, -3167 }, { -99, 1596, 6018, -1983 }, { -429, -853, 6407, 878 }, { 1170, -1322, 6290, -417 }, { 2288, -505, 6303, -1999 }, { 3312, -1674, 6749, -2494 }, { -415, -3401, 4721, -371 }, { -189, -1210, 4844, -2002 }, { 888, -4142, 4377, 130 }, { 2469, -4381, 5398, -2492 }, { 2879, -2912, 5094, -2598 }, { -717, -617, 5650, -685 }, { 1470, -3863, 5352, -1684 }, { 3935, -96, 3823, -730 }, { 3769, -430, 3168, 694 }, { 2556, 385, 3539, 512 }, { 77, -1415, 5111, 2655 }, { 2724, -2158, 6715, -822 }, { 1832, 1001, 5385, -1900 }, { 900, 2198, 4464, -559 }, { 441, 69, 5921, -1743 }, { -1161, 738, 6732, -308 }, { 257, 2035, 4091, 736 }, { 1607, 1288, 4355, -23 }, { -13, 1316, 4180, 1672 }, { 1511, 1336, 3057, 1435 }, { 2189, -3813, 4530, 939 }, { 3632, -706, 2646, 1375 }, { 4266, -3761, 4241, 1077 }, { 3101, -427, 5273, -1202 }, { 2293, 276, 4810, -313 }, { 3430, -1851, 3101, 2045 }, { 3453, -2979, 5142, 942 }, { 1683, -3281, 4802, 2002 }, { 3954, -4715, 5611, 578 }, { 1272, -155, 5085, 454 }, { 128, -194, 5095, 1409 }, { 820, 880, 5797, -2658 }, { -1095, 656, 5774, 1095 }, { 813, -1669, 4320, -3251 }, { -119, 518, 6372, -651 }, { 2922, -4299, 6115, -877 }, { 4205, -4273, 4004, 2642 }, { -1211, -3892, 224, 3127 }, { -34, -4371, 1321, 2318 }, { 77, -6326, 1201, 828 }, { 3995, -3775, 1958, 3233 }, { 178, -3301, 1985, 3318 }, { 2330, -3801, 1033, 3195 }, { 1413, -5536, 826, 1709 }, { 2468, -3499, 3653, 3631 }, { 741, -4617, 1723, 2008 }, { 1246, -3043, 2978, 3949 }, { -343, -4308, 2258, 2189 }, { -682, -4640, 454, 2272 }, { 1236, -4829, 2491, 1642 }, { -512, -3766, 1182, 3052 }, { 119, -3939, 3712, 971 }, { -1145, -4624, 1360, 2281 }, { 101, -4746, 2866, 1255 }, { -1500, -5455, 539, 1637 }, { -969, -5909, 1414, 1128 }, { -1261, -4939, -231, 2022 }, { -226, -5345, 1207, 705 }, { 2712, -5109, 3205, 1866 }, { -476, -5913, 273, 1208 }, { -2039, -4464, 624, 2545 }, { -2351, -3930, 2019, 2673 }, { -2675, -4849, 1522, 1990 }, { -1524, -3461, 1446, 3204 }, { 477, -5314, 1710, 1577 }, { 656, -3729, 2346, 2511 }, { 550, -5917, 1975, 1040 }, { 1728, -4704, 3067, 1058 }, { -9, -5247, 506, 1760 }, { -574, -5135, 1675, 1672 }, { 2129, -3781, 3444, 2313 }, { 1144, -4439, 2214, 2529 }, { 1292, -4160, 3185, 1833 }, { 2445, -3262, 2534, 3227 }, { 2266, -4401, 2023, 2400 }, { -587, -3602, 3408, 2067 }, { -885, -4951, 3228, 1174 }, { -728, -2711, 2807, 3552 }, { 1019, -3043, 3195, 2954 }, { 1888, -4615, 1140, 2454 }, { 660, -5616, 754, 800 }, { -1975, -5371, 1649, 1585 }, { -1544, -5436, 2422, 1081 }, { -422, -5882, 2390, 750 }, { 1336, -5557, 2441, 1230 }, { 136, -4001, 267, 2854 }, { -522, -3289, 2226, 2728 }, { -971, -4580, 2471, 708 }, { 704, -5306, 3300, 1001 }, { 325, -3464, 3555, 2398 }, { 794, -3686, 848, 3169 }, { 660, -3017, 4584, 3242 }, { -1486, -3978, 2170, 1644 }, { -1615, -4650, 2688, 1844 }, { 750, -4578, 538, 2239 }, { 1668, -5849, 1455, 1031 }, { 3486, -4681, 2030, 2183 }, { 2642, -5429, 1696, 1761 }, { 4491, -4502, 3538, 2767 }, { 3545, -4528, 3514, 2982 }, { 3269, -3676, 2758, 3966 }, { 5572, 1146, 209, -3379 }, { 7459, 1053, 593, -1896 }, { 4480, 200, -310, -4259 }, { 5577, -939, 242, -3992 }, { 8142, 442, 1257, -3083 }, { 5442, 1261, 1424, -3236 }, { 6260, -183, 3125, -2532 }, { 7179, 889, 1618, -2548 }, { 6416, 932, 2379, -2487 }, { 7094, 2560, 961, -3392 }, { 7322, 463, 2732, -3735 }, { 6632, 1577, 1912, -3272 }, { 6312, 1349, 3028, -3460 }, { 6105, 386, 1213, -977 }, { 5478, 1158, 1114, -486 }, { 6493, 410, 1686, -2180 }, { 6378, 1881, 1333, -2240 }, { 5711, 812, 1958, -1300 }, { 6844, 877, 730, -1189 }, { 6824, -245, 2249, -2000 }, { 7515, 1521, 1251, -3058 }, { 6697, 1051, 1300, -1749 }, { 6476, 1425, 811, -2773 }, { 7350, 465, -76, -2849 }, { 6975, 2095, 567, -2492 }, { 4691, 1736, 2660, -2289 }, { 7837, 1456, 340, -2767 }, { 7930, 507, 838, -2074 }, { 6106, 1502, 766, -1110 }, { 4891, -659, 835, -3954 }, { 7250, 141, 1369, -1523 }, { 7651, 67, 1651, -2298 }, { 7364, -305, 601, -3132 }, { 7179, 193, 2491, -2871 }, { 6504, -272, 2167, -1322 }, { 4456, 983, 2300, -421 }, { 4817, 457, 1695, 371 }, { 6914, 555, 850, -3159 }, { 5904, 1030, 202, -1959 }, { 6258, 880, 2233, -4503 }, { 6029, 10, 2130, -3600 }, { 6449, 985, 1129, -3963 }, { 6616, -18, -111, -3285 }, { 4496, 775, 817, -4276 }, { 6134, 2338, 1470, -2973 }, { 6911, 152, 430, -1946 }, { 4053, 991, 3218, -1193 }, { 5435, 1285, 3124, -2412 }, { 5507, 1836, 1935, -1988 }, { 5240, 689, 2189, -2670 }, { 6638, 1719, 606, -1799 }, { 5556, -180, 129, -2595 }, { 5644, 1918, 1281, -4316 }, { 6410, 1088, -282, -3117 }, { 6503, 1841, 312, -3514 }, { 6947, 20, 1358, -3886 }, { 5464, 2109, 2398, -3194 }, { 5616, -407, 2140, -498 }, { 6121, 2707, 2379, -4096 }, { 7303, 1846, 2266, -4095 }, { 5444, 470, 2718, -1553 }, { 5817, -645, 3285, -1349 }, { 5625, 1427, 1103, -1991 }, { 6041, -806, 1196, -2943 }, { 3050, -5722, 4070, -5460 }, { 3420, -4386, 4078, -5155 }, { 6020, -3982, 7268, -2689 }, { 7502, -4317, 7894, -3973 }, { 4156, -3558, 5247, -4316 }, { 4725, -4401, 7290, -1540 }, { 6688, -5122, 8216, -3210 }, { 9176, -6576, 9276, -4963 }, { 8706, -5708, 7987, -4621 }, { 7060, -3535, 6532, -3308 }, { 5600, -2719, 5363, -1568 }, { 4661, -2803, 6263, -4716 }, { 3673, -3636, 6147, -3433 }, { 5305, -2585, 6073, -2638 }, { 7614, -1962, 6079, -5266 }, { 6760, -3366, 7382, -4322 }, { 6385, -3883, 4797, -1353 }, { 8182, -5120, 4298, -4641 }, { 9130, -6198, 4975, -3063 }, { 7421, -5436, 5576, -3713 }, { 3483, -4898, 5443, -2745 }, { 4907, -5643, 6390, -4105 }, { 8119, -7008, 7992, -6764 }, { 6528, -6122, 6967, -5590 }, { 5890, -4190, 6624, -5688 }, { 6815, -7934, 7275, -5456 }, { 5434, -4306, 5169, -5378 }, { 4364, -6436, 5376, -2604 }, { 8152, -3404, 5913, -5048 }, { 7983, -4863, 4262, -2461 }, { 8023, -6188, 6238, -5062 }, { 6753, -3692, 3935, -3723 }, { 6826, -4760, 3284, -4051 }, { 7224, -7423, 4492, -3875 }, { 6904, -2590, 6587, -6248 }, { 6106, -1944, 7345, -5506 }, { 4956, -2990, 7808, -3146 }, { 6908, -6885, 5949, -1288 }, { 7162, -6058, 3419, -3401 }, { 7015, -7080, 6907, -3018 }, { 6971, -6832, 5646, -3273 }, { 8014, -5546, 5471, -1544 }, { 6792, -2220, 5105, -2879 }, { 8494, -3974, 4408, -3999 }, { 9591, -4866, 6027, -4558 }, { 5264, -5161, 6101, -738 }, { 5803, -6141, 5197, -5231 }, { 4657, -6822, 3232, -5189 }, { 4791, -5135, 3809, -4665 }, { 6108, -5103, 2379, -3873 }, { 4680, -3909, 3234, -5093 }, { 5802, -3853, 3795, -4984 }, { 4360, -7483, 4802, -3877 }, { 5429, -7517, 5911, -3717 }, { 6866, -2280, 4880, -4634 }, { 10131, -4628, 4414, -4092 }, { 10811, -5189, 7746, -5337 }, { 5663, -8941, 5287, -5680 }, { 8023, -5991, 7403, -2796 }, { 9669, -6919, 6525, -4932 }, { 7275, -3796, 4962, -2547 }, { 8848, -4806, 5677, -3080 }, { 8128, -4308, 7749, -6569 }, { 4032, -5196, 2282, -6239 }, { 6593, 700, -229, 304 }, { 8260, 539, -66, -1259 }, { 6605, 176, -814, -109 }, { 8057, 0, -1, -136 }, { 7382, -38, -484, -1129 }, { 8373, -929, 682, -454 }, { 7674, 690, -1278, 546 }, { 7326, -517, 406, -1283 }, { 7612, -1715, -1167, 1175 }, { 8590, 441, -782, -710 }, { 8572, -1202, -291, 260 }, { 7308, -147, -1785, 414 }, { 6787, -353, -672, 934 }, { 5177, -133, 179, 82 }, { 4161, -34, 447, 1497 }, { 5997, -902, 1533, -121 }, { 5727, -871, -1370, 945 }, { 8386, -252, 293, -823 }, { 6573, -1354, 682, 616 }, { 7650, -2096, 725, 457 }, { 8122, 78, 636, -1400 }, { 8421, 428, -1620, 131 }, { 7341, -1292, -717, 186 }, { 7998, -49, -720, 266 }, { 5987, -351, 669, 844 }, { 7314, -1620, 250, -603 }, { 7219, -1562, -572, 1994 }, { 8682, -358, -290, -388 }, { 5810, 155, -178, 1199 }, { 7246, -12, 1042, -786 }, { 7357, -923, 1468, -475 }, { 7801, 621, -212, -724 }, { 5346, -514, 1210, 1356 }, { 8459, 36, -127, -779 }, { 6878, -2429, 854, 1750 }, { 7280, -1401, -1353, 2845 }, { 7579, -2148, -1463, 2087 }, { 6637, 946, -872, 750 }, { 4807, -1100, 1289, 2602 }, { 4495, 219, 1551, 1128 }, { 7639, 506, 446, -1107 }, { 6359, 188, 1009, -115 }, { 6641, -1820, 1655, 723 }, { 5394, -2382, 1604, 2542 }, { 6021, -2644, 2396, 1407 }, { 4698, 882, 245, 1525 }, { 8103, 573, -798, -349 }, { 8045, -519, 997, -1092 }, { 7571, -122, 227, -338 }, { 5347, -1200, 630, 1718 }, { 7070, 790, 218, -544 }, { 7440, 728, -527, -20 }, { 6402, -355, 197, -736 }, { 4031, 771, 866, 1895 }, { 6009, 896, 445, -31 }, { 5160, 1098, -856, 1784 }, { 7980, -886, -1293, 1396 }, { 6318, -1361, 2423, 252 }, { 7547, -699, 133, 506 }, { 8562, -2344, 940, 264 }, { 5890, 1187, -1425, 2194 }, { 6558, -645, -1311, 2621 }, { 4634, -1671, 2075, 1623 }, { 5614, 105, -816, 2376 }, { 6646, 1558, -1365, 630 }, { 6998, 1150, -2117, -990 }, { 6555, 2311, -1093, -1783 }, { 6682, 1430, -2391, -1940 }, { 7861, 1555, -2977, -1188 }, { 6745, 1723, -459, -2085 }, { 7504, 1229, -1666, -2060 }, { 7937, 671, -2128, -1529 }, { 7139, 991, -735, -2632 }, { 6867, 1592, -1303, -2324 }, { 6401, 2230, -1732, -2508 }, { 7201, 2184, -2169, -1988 }, { 6636, 2190, -995, -2840 }, { 7620, 2306, -2089, -651 }, { 7584, 1875, -1438, -631 }, { 9214, 1561, -2464, -1139 }, { 6154, 1318, -1237, -2917 }, { 7917, 2847, -1797, -1599 }, { 8309, 2029, -2555, -465 }, { 8204, 1282, -584, -2405 }, { 8440, 1035, -1147, -1137 }, { 7107, 1858, -60, -1568 }, { 6781, 2912, -873, -1463 }, { 7603, 1316, -319, -1249 }, { 7833, 1335, -78, -1849 }, { 7930, 1141, -1016, -695 }, { 7883, 1610, -1017, -1314 }, { 8069, 1409, -1811, -196 }, { 8319, 1031, -582, -1590 }, { 5948, 1537, -2153, -2373 }, { 8684, 1171, -1871, -850 }, { 8357, 2484, -2411, -1292 }, { 6516, 2092, -193, -1167 }, { 6112, 1697, 22, -525 }, { 7161, 703, -602, -1879 }, { 6047, 2351, -807, -219 }, { 8072, 1854, -1817, -1553 }, { 6956, 1304, 76, -1011 }, { 6607, 1481, -544, -162 }, { 6958, 2541, -265, -1938 }, { 6416, 2514, -777, -850 }, { 7272, 2110, -899, -1171 }, { 7741, 2153, -283, -2614 }, { 6482, 2041, -1758, -1221 }, { 6762, 940, -1862, -2281 }, { 5610, 1194, -1691, -1561 }, { 7833, 2164, -823, -1952 }, { 5460, 1438, -848, 1189 }, { 6011, 1377, -771, -1557 }, { 7679, 544, -1134, -2214 }, { 7209, 1292, -2714, -1564 }, { 5567, 1200, -404, -169 }, { 5853, 1461, -1465, -518 }, { 6782, 689, -844, -860 }, { 7330, 1337, -1152, -71 }, { 7189, 1506, -653, -685 }, { 6860, 2116, -1403, -240 }, { 8804, 1516, -1391, -1760 }, { 7210, 2689, -1498, -989 }, { 7030, 3022, -1441, -2083 }, { 5649, 1836, -407, 525 }, { 7451, 3099, -717, -2464 }, { 7384, 1656, -2007, 398 }, { 6504, 707, -1919, -134 }, { -1851, 3639, -2279, -695 }, { -4037, 1644, -77, 1329 }, { -4025, 1960, -1565, -567 }, { -3430, 2495, -795, 368 }, { -4771, 2480, 993, 756 }, { -3431, 2058, -2539, -971 }, { -3802, 3418, 380, 217 }, { -3074, 3350, -1652, -1056 }, { -3705, 326, -1650, 1535 }, { -3122, 1281, -1192, 1607 }, { -4601, 1367, -968, 53 }, { -3808, 958, 44, 2560 }, { -2079, 2530, -1485, 1166 }, { -3707, 343, -2889, 180 }, { -5249, 1431, -31, 688 }, { -4990, 125, -704, 1270 }, { -2771, 1334, -2446, 746 }, { -2292, 994, -1527, 2630 }, { -1261, 3070, -2519, 268 }, { -2544, 3890, -1057, -552 }, { -4421, 255, -1980, 530 }, { -2951, 454, -13, 3643 }, { -2262, 1815, -370, 2880 }, { -2383, 3657, -649, 576 }, { -3541, -161, -1389, 2550 }, { -4241, 1575, 1325, 2561 }, { -2767, 4037, 1221, 1578 }, { -3748, 2697, 1148, 1801 }, { -4686, 2385, -220, 0 }, { -1531, 1645, -2751, 1327 }, { -45, 4032, -799, 2298 }, { -2915, 2280, 709, 2495 }, { -1199, 3278, -406, 2346 }, { -2471, 116, -2706, 2060 }, { -2440, 2173, -2894, -344 }, { -3375, 2287, 1781, 3226 }, { -2153, 3568, 1827, 2918 }, { -862, 2267, -1626, 2527 }, { -2698, 1135, 301, 4239 }, { -2364, 2123, 1010, 3710 }, { -2447, 3281, -81, 1408 }, { -2660, 4735, 472, 258 }, { -1053, 3097, 2682, 2398 }, { -3366, -1037, -1152, -868 }, { -643, 4242, 2212, 1259 }, { 971, 3991, 934, 643 }, { -1617, 2002, 2139, 2195 }, { -4897, 972, 784, 1719 }, { -1275, 2992, 1039, 3821 }, { -392, 4973, -209, 1821 }, { -1028, 4718, -1479, -137 }, { 50, 3914, 553, 2210 }, { 678, 4364, 359, 1303 }, { -582, 4911, 514, 1671 }, { 1276, 3914, -1252, 2934 }, { -1496, 3984, 857, 2330 }, { 772, 4744, -655, 2332 }, { -799, 5283, -439, 624 }, { 1341, 2937, 650, 2027 }, { -1739, 4892, 1275, 1702 }, { -892, 2596, -151, 3951 }, { -3532, 1090, 1292, 32 }, { 321, 3146, 2647, 1475 }, { 264, 4199, -1591, 1317 }, { -452, -2357, 2266, 4192 }, { 3022, -1033, -2389, 5678 }, { -1162, -1342, 3543, 4990 }, { -474, -1477, -1223, 5016 }, { -699, -2857, 900, 3835 }, { -461, -2255, -117, 4626 }, { 1204, -2062, -1211, 4403 }, { 2192, -3035, -337, 3966 }, { 108, -831, 279, 5643 }, { 1457, -620, -2908, 5276 }, { -2527, -78, 1085, 5460 }, { -1978, -1918, -949, 4733 }, { 32, 367, -1904, 5166 }, { 1890, -1665, 440, 4752 }, { -518, -348, 2816, 4891 }, { 3695, -2490, -1374, 4603 }, { 246, -1965, 3549, 3969 }, { 1100, -3111, 656, 3737 }, { -1379, 870, -414, 4575 }, { 628, -357, -1227, 6179 }, { -1129, -1318, -2457, 4576 }, { -425, -98, -73, 6336 }, { 367, -887, 2990, 4207 }, { 2091, -1251, 2444, 3557 }, { -1759, -1610, 2046, 5273 }, { 3210, 1414, -20, 2616 }, { 3303, -2636, 1005, 4237 }, { -327, -3107, -640, 3687 }, { -197, 764, 572, 5486 }, { 646, -767, 1388, 5464 }, { 104, 2742, -228, 3907 }, { -236, 1829, -579, 4585 }, { -2150, -474, -1525, 4006 }, { -23, -2632, -2400, 3892 }, { -12, -1739, -2910, 4867 }, { -2310, -368, -102, 4583 }, { -1991, -2061, 533, 4531 }, { 3884, -1446, -153, 4393 }, { 1568, 14, -289, 5268 }, { -1376, -253, -2797, 3417 }, { 3193, -2577, 2475, 3566 }, { 3418, 617, 1350, 1857 }, { 3792, -24, -272, 3370 }, { 153, 1159, 2906, 2877 }, { 511, 2162, 1548, 2741 }, { 262, 819, -2791, 3734 }, { 4232, -2015, 1486, 3477 }, { 2943, -1110, -1014, 5480 }, { 2842, 369, 703, 3476 }, { 3011, 1634, -933, 3553 }, { 4412, -1548, -942, 5021 }, { -1405, 593, 2372, 5267 }, { 2093, 2129, 896, 2365 }, { 4845, -1980, 0, 3823 }, { -2140, 81, 3278, 5637 }, { 1484, 2665, -324, 3653 }, { 10, 192, 1620, 5291 }, { 2152, 738, -2269, 5000 }, { 2102, 2748, -1652, 4707 }, { 2855, -2131, -387, 5188 }, { 1173, 676, 1338, 3277 }, { 2340, -2329, -2064, 4095 }, { 861, -2024, 1296, 5055 }, { 2189, 3225, -695, 2626 }, { 6196, -7079, 1943, -822 }, { 4547, -4813, 3261, 1856 }, { 4243, -6904, 3443, 448 }, { 4581, -7503, 946, 506 }, { 6626, -7754, 3427, 470 }, { 3407, -9088, 3269, -1496 }, { 4079, -6464, 2304, 777 }, { 5621, -9336, 2684, -768 }, { 5351, -6464, 5238, -214 }, { 5961, -8007, 1724, -3091 }, { 4213, -8067, 603, -246 }, { 7208, -7403, 3168, -1738 }, { 6098, -7700, 329, -1379 }, { 6525, -6735, 4248, -1072 }, { 6073, -6241, 2167, -2378 }, { 4609, -9218, 3051, -1033 }, { 6813, -7283, 1581, -1897 }, { 6126, -6275, 2789, 681 }, { 4423, -6538, 1621, -1692 }, { 6272, -8298, 3167, -1855 }, { 6172, -8558, 4498, -1169 }, { 4844, -8588, 1647, -366 }, { 6209, -8807, 1581, -369 }, { 5389, -8059, 550, -192 }, { 6654, -9775, 2504, -1063 }, { 7103, -7998, 806, 530 }, { 5662, -6736, 1565, -3620 }, { 4165, -9564, 4191, -2131 }, { 4526, -7181, 576, -2875 }, { 4633, -8623, 2807, -4742 }, { 3709, -7794, 1815, 34 }, { 3634, -8622, 2313, -826 }, { 6991, -8447, 2063, -3198 }, { 7757, -9486, 2255, -558 }, { 4149, -7778, 4728, -1696 }, { 5767, -7427, 1113, 707 }, { 4592, -6261, 2329, 1864 }, { 3159, -10498, 1677, -4273 }, { 3534, -9010, 2437, -3565 }, { 4479, -10821, 2715, -4942 }, { 3207, -9805, 3054, -3886 }, { 4627, -8189, 3018, -2354 }, { 5527, -10566, 3244, -2749 }, { 4346, -10127, 3335, -3084 }, { 6132, -10085, 3316, -1308 }, { 5629, -9704, 2178, -3058 }, { 3603, -8538, 1246, -624 }, { 3737, -8488, 395, -3167 }, { 5465, -11414, 2810, -4640 }, { 5306, -7745, 2721, -3988 }, { 7000, -9111, 1695, -1409 }, { 6663, -7741, 2466, -4079 }, { 4083, -7175, 1836, -4831 }, { 3613, -9926, 1342, -3455 }, { 6588, -8033, 457, -258 }, { 4720, -8102, 17, -1209 }, { 7414, -8709, 1294, -344 }, { 5437, -10030, 4043, -1704 }, { 4862, -9281, 1558, -1431 }, { 6800, -6403, 5113, 862 }, { 4623, -8242, 2667, -228 }, { 5919, -5083, 3348, 2135 }, { 5985, -8889, 2733, -5105 }, { 5029, -5767, 4407, 719 }, { 354, -6158, -838, -3001 }, { 351, -5943, -2104, -1534 }, { -633, -7190, -25, -4798 }, { -1595, -7235, -3812, -1400 }, { 103, -6197, -2933, -78 }, { -1722, -5020, -3441, -4333 }, { -1963, -5644, -4365, -270 }, { -846, -5743, -3477, 196 }, { -191, -5348, -4054, -469 }, { -2515, -7754, -3495, -818 }, { -2090, -6710, -2701, 117 }, { -546, -7036, -1398, 163 }, { -278, -7091, -2662, -536 }, { -622, -7962, -2731, -1464 }, { -1555, -8118, -3612, -2057 }, { -1094, -6280, -2314, 505 }, { -2556, -8538, -4024, -2247 }, { 109, -7134, -3107, -1823 }, { -900, -6954, -3340, -717 }, { -605, -7113, -3656, -2154 }, { 837, -6263, -3211, -2177 }, { -417, -5810, -3871, -1469 }, { -1318, -5649, -4207, -3198 }, { 413, -6765, -2082, -33 }, { -3101, -6450, -4362, -766 }, { 755, -6489, -2967, -846 }, { 1117, -7106, -2452, -1352 }, { -1202, -8387, -3072, -2897 }, { -365, -4894, -3561, -2937 }, { -2372, -8776, -265, -4441 }, { -1224, -8678, -896, -5074 }, { -755, -10096, -600, -6623 }, { 300, -8206, -225, -4568 }, { -1176, -6824, -2633, -3527 }, { -2006, -5443, -1526, -5849 }, { -1115, -5540, -2363, -4785 }, { 1059, -6812, -2543, -2654 }, { -1976, -6861, -3062, -5508 }, { -379, -5328, -2321, -3624 }, { -2108, -5860, -4518, -1915 }, { -379, -7885, -1329, -594 }, { 774, -5389, -581, -5213 }, { -2601, -5083, -1849, -4921 }, { -176, -5580, 74, -5075 }, { -204, -6780, -190, -6232 }, { 418, -7594, -1987, -820 }, { -1873, -8529, -2926, -1609 }, { 1340, -6362, -919, -4975 }, { 577, -7990, -2044, -1873 }, { -2572, -7413, -1745, -2224 }, { -2037, -7030, -1461, -7138 }, { -2559, -8756, -2039, -5836 }, { -2079, -6764, -1209, -5669 }, { -1613, -7801, -2006, -685 }, { -1865, -6583, -722, -3529 }, { -589, -6358, -1377, -1003 }, { -540, -7514, -1331, -3542 }, { 419, -6192, -1677, -4927 }, { -2786, -8763, -2966, -5065 }, { -2172, -8411, -1726, -4675 }, { -3382, -9833, -3497, -5722 }, { -2433, -10169, -2077, -5775 }, { -424, -9451, -1096, -3658 }, { -537, -8522, -910, -1897 }, { -5550, 2807, 1683, -693 }, { -6395, 635, 3573, -1246 }, { -7544, 2280, 2140, 44 }, { -8751, 1136, 2951, -794 }, { -5605, 2709, 2052, 916 }, { -7650, 654, 869, 135 }, { -6939, 967, 1409, 870 }, { -7834, 2123, 3310, 974 }, { -6935, 2818, 1274, -1678 }, { -5605, 2233, 1013, 471 }, { -7095, 1849, 1648, 198 }, { -6636, 1634, 712, -37 }, { -7279, 978, 296, -315 }, { -7664, 3504, 3292, -216 }, { -7836, 1209, 1221, -257 }, { -7913, 2201, 1765, -1529 }, { -7077, 3783, 2632, -1407 }, { -5565, 1645, 1410, -622 }, { -6494, 2879, 1181, -759 }, { -7073, 3137, 3010, 550 }, { -7249, 1839, 847, -805 }, { -6630, 2197, 282, -1096 }, { -8836, 1573, 1988, -1090 }, { -7809, 1274, 836, -1198 }, { -7895, 2970, 3511, -1097 }, { -6960, 1664, 1356, -2442 }, { -6582, 2866, 2273, 307 }, { -7221, 821, 2851, -1435 }, { -6015, 1703, 2001, -2367 }, { -8082, 1034, 2103, 239 }, { -5952, 1912, 301, -465 }, { -6099, 841, 379, 567 }, { -6343, 50, 494, 658 }, { -6586, 983, 591, -893 }, { -5500, 869, 2187, -2479 }, { -6482, 60, 1545, -979 }, { -6705, 515, 1974, -53 }, { -6460, 1755, 1325, -1275 }, { -6093, 2617, 2465, -623 }, { -7330, 2161, 594, -2115 }, { -7324, 762, 1593, -2004 }, { -6385, 679, 1510, -2514 }, { -6159, 241, 2976, -1631 }, { -8583, 3030, 4045, -162 }, { -6299, 66, 2209, -2103 }, { -5428, 1279, 3267, -1846 }, { -6438, 1335, 2728, -1631 }, { -8012, 1070, 2428, -1151 }, { -6201, 2781, 2349, -1918 }, { -5918, 1139, 3121, -148 }, { -6314, 2481, 3137, -1808 }, { -7180, 1722, 2435, -1602 }, { -6750, 1829, 3763, -1145 }, { -6713, 1777, 2221, 1212 }, { -7479, 1835, 3627, -479 }, { -7299, 10, 2406, -1593 }, { -8249, 3129, 996, -2870 }, { -8374, 1534, 1333, -1882 }, { -7507, 3353, 1598, -2299 }, { -7379, 2701, 2326, -1167 }, { -8440, 2276, 2796, -542 }, { -10348, 1527, 2649, -1165 }, { -8184, 3614, 2574, -1738 }, { -5539, 1574, 1733, 1138 }, { 9404, -7652, 67, 79 }, { 8654, -3972, 1358, -60 }, { 8617, -4794, 117, 2318 }, { 7886, -4505, 1784, 1200 }, { 8636, -6125, 3879, -1003 }, { 9654, -6836, 1816, 205 }, { 9374, -6553, 913, 1875 }, { 8020, -6150, 1134, 2390 }, { 7786, -4970, 2078, -1857 }, { 8691, -6119, 711, 708 }, { 9039, -5568, 2944, -1902 }, { 9955, -5048, 1433, -601 }, { 8089, -6927, 3093, -2846 }, { 8487, -7024, 2415, 19 }, { 9388, -5287, 3577, -2655 }, { 8591, -7371, 2300, -996 }, { 9104, -4763, 1453, -2558 }, { 7615, -5457, 596, 164 }, { 9860, -7047, 3433, -614 }, { 8756, -4404, 2235, -964 }, { 9462, -4660, 299, -1822 }, { 10119, -5550, 2689, -1273 }, { 10915, -7471, 2705, -1007 }, { 11433, -7090, 1410, -1198 }, { 9882, -7431, 2965, -1895 }, { 7628, -5219, 769, -2661 }, { 8169, -5318, 2262, 70 }, { 8846, -6320, 1939, -754 }, { 7147, -5593, 1248, -971 }, { 10652, -5485, 935, 137 }, { 7778, -6533, 2564, -1932 }, { 8878, -5173, 1214, -361 }, { 9828, -4943, 282, 510 }, { 10042, -6134, 3895, -1914 }, { 7965, -6630, 3566, -433 }, { 8573, -4502, 3574, -1209 }, { 8398, -4801, 1031, -1347 }, { 10136, -7772, 2612, 1547 }, { 9890, -7280, 1768, -1083 }, { 8407, -6585, -706, -58 }, { 7976, -7582, 229, -131 }, { 10481, -8866, 1166, -147 }, { 10914, -4342, 3189, -2412 }, { 10440, -5198, -104, -1109 }, { 11227, -6530, 2381, -2449 }, { 8487, -8064, 1086, 230 }, { 9975, -6123, -857, -134 }, { 8339, -6498, 1232, -2337 }, { 11042, -4506, 1119, -2098 }, { 12563, -5592, 1837, -2062 }, { 11801, -5590, 632, -1296 }, { 10152, -5617, 1511, -1917 }, { 7800, -6473, 51, -1337 }, { 7941, -5560, 2438, -3270 }, { 6554, -3834, 2100, 1476 }, { 9065, -5520, -226, -1120 }, { 10794, -7120, -243, 122 }, { 10429, -6968, 272, -806 }, { 8942, -8914, 1442, -392 }, { 9969, -5051, 2033, -2953 }, { 7275, -4152, 3058, -64 }, { 11127, -5488, 4589, -3227 }, { 9626, -6666, 2739, -2958 }, { 6943, -5362, 4470, 1008 }, { -7456, -967, 2936, -1002 }, { -8622, -333, 6962, 2606 }, { -7486, -3392, 3668, 1287 }, { -8053, -827, 5148, 1097 }, { -6610, 454, 4952, 96 }, { -7701, -1982, 3161, -468 }, { -7307, -1132, 4071, -36 }, { -8125, -271, 5199, 3862 }, { -9182, -1950, 2813, 1878 }, { -9855, -952, 4794, 3010 }, { -7241, 1431, 4202, 2468 }, { -9646, 157, 4766, 1046 }, { -9371, 1230, 6009, 2958 }, { -11514, -64, 8630, 5248 }, { -6766, 565, 2766, 2140 }, { -8426, -9, 2852, 1271 }, { -11291, -1113, 5087, 2937 }, { -8297, 2092, 4495, 1264 }, { -9983, 735, 3809, -51 }, { -9048, -1000, 3191, -308 }, { -7331, -1987, 2655, 1391 }, { -7144, -21, 4333, 2161 }, { -6032, -1540, 3543, 896 }, { -7987, -1036, 1985, 1529 }, { -9264, 2004, 5194, 290 }, { -11308, -840, 5754, 1654 }, { -9130, -2398, 4292, 2973 }, { -6248, 838, 3563, 1223 }, { -6819, -2760, 3511, 119 }, { -7213, -2006, 4364, 762 }, { -5431, -1047, 4533, 166 }, { -7098, -641, 2021, 639 }, { -8628, -2249, 3588, 399 }, { -6352, -1498, 3560, -648 }, { -7033, -2190, 4870, 2562 }, { -7405, -46, 3772, -581 }, { -6104, 796, 5143, 1965 }, { -5787, 943, 5784, 3030 }, { -8367, 1465, 7192, 4097 }, { -8259, 789, 5694, 1963 }, { -10614, -1899, 5748, 2645 }, { -8258, -805, 3698, 2275 }, { -6877, -972, 6431, 3160 }, { -6483, 363, 7018, 3129 }, { -6283, -1358, 5191, 1524 }, { -8853, -3157, 4119, 1741 }, { -6086, -267, 3883, -835 }, { -7254, 1032, 6613, 4017 }, { -11470, -3350, 4649, 3426 }, { -6743, 481, 6148, 1239 }, { -5394, -166, 5309, 3165 }, { -7958, 1068, 4268, -240 }, { -10520, 2256, 7916, 2828 }, { -5132, -4, 5739, 1176 }, { -8643, 120, 3255, -629 }, { -9631, 1974, 8870, 4362 }, { -10663, -1221, 3733, 589 }, { -8224, -1843, 5806, 2655 }, { -8282, 1255, 8647, 3478 }, { -12311, -1505, 9043, 6256 }, { -11312, -856, 7136, 4681 }, { -11944, -722, 7941, 3309 }, { -7868, -463, 6846, 4196 }, { -8679, -241, 7410, 5347 }, { 6759, -4680, -508, 1220 }, { 5176, -6111, 944, 121 }, { 6843, -5667, -1368, -533 }, { 5616, -5884, -1471, -695 }, { 6030, -5089, -1808, -940 }, { 7444, -5463, -52, 1881 }, { 4207, -6079, -506, 1571 }, { 6785, -4410, -649, 3084 }, { 4838, -5214, 2026, 2998 }, { 4201, -5790, 645, 1811 }, { 6930, -5129, -1940, 1698 }, { 6332, -4627, 692, 3027 }, { 6285, -4314, -106, 3644 }, { 6255, -5450, -1975, 742 }, { 4199, -4676, -459, 1796 }, { 5592, -5500, 1345, 1300 }, { 4358, -5556, -2236, 114 }, { 4620, -5875, -1563, 888 }, { 4892, -7550, -327, -419 }, { 4734, -7085, 7, 613 }, { 3883, -5562, -1969, 1080 }, { 5610, -4990, -204, 834 }, { 4117, -6482, -1271, 341 }, { 6585, -5107, 892, 1169 }, { 6632, -3683, 302, 3002 }, { 6326, -5351, -983, -1250 }, { 4382, -7192, -730, -158 }, { 5227, -6540, -451, 1123 }, { 5468, -6472, -870, -1471 }, { 5191, -6402, -1365, -127 }, { 7407, -6317, -973, -336 }, { 4611, -6530, -820, -1980 }, { 4963, -5159, -2050, -966 }, { 4414, -5691, -211, -998 }, { 5954, -5873, 750, -1749 }, { 4394, -4796, -1268, 254 }, { 7161, -6214, -1010, 689 }, { 4965, -3598, 2372, 1711 }, { 6248, -6180, 981, 864 }, { 6473, -5336, 525, -600 }, { 4591, -6864, -1131, -900 }, { 6314, -6440, -1021, -375 }, { 5838, -6209, -1199, 944 }, { 5308, -5283, -2100, 1267 }, { 4342, -5860, -1637, -1356 }, { 5680, -4388, -1227, -104 }, { 4900, -4098, 1449, 4046 }, { 4677, -4284, -106, 3190 }, { 7574, -6173, -848, 1859 }, { 6493, -7207, -131, 726 }, { 5513, -5261, -2117, 4 }, { 6191, -7352, -193, -505 }, { 5885, -4333, 324, -134 }, { 6162, -6081, -312, -2044 }, { 4216, -6200, -1810, -572 }, { 5652, -7035, -696, -197 }, { 7131, -7189, -366, -60 }, { 5032, -4803, -1514, 2832 }, { 7386, -4610, -606, 3489 }, { 4211, -5031, 1221, 3047 }, { 4050, -4653, 1584, 1469 }, { 6852, -5302, -1861, 206 }, { 7736, -4816, -1794, 3359 }, { 6290, -3439, 1522, 2454 }, { 1768, 5990, -5560, -2594 }, { 3903, 5326, -1530, -1501 }, { 2472, 3738, -2117, -4240 }, { 3260, 5448, -904, -4733 }, { 1435, 7297, -3676, -4102 }, { 4096, 5951, -656, -3312 }, { 2178, 6009, -3146, -3724 }, { 3787, 5493, -5473, -1633 }, { 2998, 7286, -3334, -3571 }, { 2894, 6576, -4708, -2804 }, { 830, 6163, -4286, -3348 }, { 4755, 5569, -1730, -2739 }, { 4604, 6065, -3562, -2605 }, { 2749, 5141, -3986, -2775 }, { 3942, 4875, -2143, -3340 }, { 2819, 8517, -2004, -2724 }, { 2146, 6298, -689, -3093 }, { 5196, 6504, -3393, -1475 }, { 1851, 8386, -1748, -1420 }, { 3474, 8572, -3534, -2688 }, { 4503, 7560, -3561, -2245 }, { 4433, 6219, -2393, -1575 }, { 3506, 7248, -2275, -1977 }, { 3490, 7409, -3147, -604 }, { 4214, 6447, -3520, 516 }, { 619, 7034, -829, -1705 }, { 1732, 7395, -356, -2208 }, { 1226, 5204, -3294, -3732 }, { 2027, 5619, -1813, -4146 }, { 3078, 5877, 47, -2651 }, { 1654, 5458, 424, -682 }, { 3163, 5464, -2026, -270 }, { 2884, 5375, -685, -530 }, { 2950, 7286, -35, -2967 }, { 1986, 5066, -597, 482 }, { 3459, 4308, -3845, -2333 }, { 3155, 7037, -1346, -4345 }, { 2193, 6696, -717, -1319 }, { 3677, 5089, -3892, -487 }, { 2186, 5136, -4186, -1492 }, { 773, 5796, -917, 817 }, { 2489, 6546, -3570, -2117 }, { 1223, 6469, -1362, -33 }, { 271, 6061, -1466, -1725 }, { 2540, 5171, -1847, 1032 }, { 2548, 5251, -2697, 1677 }, { 771, 7600, -768, -632 }, { 4710, 6647, -4736, -1275 }, { 1369, 5917, -2971, -1056 }, { 163, 5239, -3499, -2275 }, { 2104, 4285, -3211, -3286 }, { 1107, 7411, -1972, -1671 }, { 2196, 7262, -2310, -1926 }, { -244, 6439, -1745, -839 }, { 3293, 3832, -2890, -3000 }, { 419, 6443, -379, -407 }, { 3077, 4930, -1156, -2869 }, { 2131, 5874, -2330, 224 }, { 690, 6538, -2212, -2841 }, { 1602, 4421, -2515, 1542 }, { 3318, 9373, -3032, -3477 }, { 5646, 7462, -5153, -1463 }, { 4139, 7137, -1539, -3321 }, { 3481, 9077, -1645, -3653 }, { -7747, 375, -106, -543 }, { -8587, -1379, -586, -461 }, { -10146, -892, 2094, 694 }, { -8103, 382, 504, -325 }, { -8548, -92, 94, -656 }, { -7460, 38, 152, 388 }, { -8266, -271, -459, -883 }, { -7935, -664, -1026, -802 }, { -8341, -109, 853, 161 }, { -8802, -1355, 1099, 630 }, { -8957, -6, 1108, -669 }, { -7260, -1520, -43, -407 }, { -7555, -174, 668, -2562 }, { -9014, -126, 227, -1191 }, { -8184, 769, 290, -1375 }, { -9476, 55, 962, -1528 }, { -8679, 541, 755, -1030 }, { -9842, -1626, 838, -1588 }, { -8513, -702, 788, -1998 }, { -10101, -1558, -366, -1841 }, { -8135, 78, 1479, -1813 }, { -9128, -454, 313, -1786 }, { -7554, -1084, 831, -2442 }, { -7576, -701, 2068, -1665 }, { -7791, -1481, 1587, -1808 }, { -6701, -596, -97, 802 }, { -7418, -15, 684, -963 }, { -7127, -477, -139, -426 }, { -8097, -110, -36, -264 }, { -7620, -1922, -590, -101 }, { -7647, -1201, 279, 660 }, { -7856, -1974, 758, -2271 }, { -8496, -167, 2232, -1143 }, { -8506, -1359, 624, -740 }, { -7274, -1052, 1062, -139 }, { -7800, -217, 91, -1794 }, { -7030, -1694, -955, 615 }, { -9020, -1864, 101, -2182 }, { -9400, -740, 598, -667 }, { -8448, -1184, 2024, -1272 }, { -8812, -570, -897, -2384 }, { -10559, -1286, 538, -1536 }, { -8728, -888, -1089, -1397 }, { -7080, -1185, 636, -1252 }, { -9880, 233, 2344, -782 }, { -7952, -1326, -378, -1947 }, { -7207, -378, 1408, -2237 }, { -8467, -1545, 902, -1987 }, { -9163, -1474, 924, -1739 }, { -8159, -992, -77, -2744 }, { -8343, 148, -423, -1573 }, { -9105, -649, -254, -1214 }, { -8939, 456, 281, -1905 }, { -8837, 179, -394, -2634 }, { -9145, 757, 1547, -1319 }, { -9775, -723, 441, -1680 }, { -8910, -686, 1529, -1525 }, { -9492, -1134, 2064, -938 }, { -6111, -943, 677, -31 }, { -7411, -613, -814, 46 }, { -9479, -922, -430, -2061 }, { -11298, -1268, 1318, -1117 }, { -8190, 832, 671, -2214 }, { -10453, -550, 1672, -886 }, { 1044, 9353, -1651, -5423 }, { 1034, 8149, -455, -6166 }, { 761, 8293, -3214, -4838 }, { 938, 8077, 164, -5130 }, { 1295, 8673, 2582, -5490 }, { -314, 7973, -2395, -5231 }, { -507, 9012, -2497, -5775 }, { 2396, 8314, -1022, -4673 }, { -1516, 8501, 1950, -4969 }, { -308, 7401, 1549, -4866 }, { -112, 8340, 3003, -4920 }, { -50, 9315, 1371, -5666 }, { -659, 9449, 2496, -5547 }, { 2573, 9148, -2270, -4783 }, { 830, 7104, -438, -3907 }, { 522, 10672, -677, -6483 }, { -1190, 10108, -510, -6518 }, { -427, 8271, -579, -6315 }, { 1602, 8113, -1927, -4418 }, { -2266, 8180, 448, -5190 }, { -1633, 8816, -226, -5771 }, { 759, 9481, -105, -5813 }, { 2254, 6679, -466, -5662 }, { -88, 6946, 895, -5958 }, { -1705, 10009, 1394, -5574 }, { 748, 7943, 540, -6692 }, { 1411, 7009, 232, -6145 }, { 697, 7290, -1221, -5342 }, { -1764, 10580, 1944, -3981 }, { -1334, 9124, 1195, -3903 }, { -905, 10067, 635, -5039 }, { 664, 10680, 49, -4625 }, { 1374, 9536, -777, -3591 }, { 252, 9698, -597, -2931 }, { 824, 9164, -1014, -2144 }, { 2438, 10569, -2289, -4424 }, { 2101, 7102, 507, -3614 }, { 294, 8051, -432, -1518 }, { -665, 10337, 547, -2852 }, { 1168, 11989, -492, -5427 }, { 1344, 6416, 302, -5061 }, { -1727, 12264, 1507, -4543 }, { 674, 10889, -902, -3605 }, { -582, 9504, 300, -3618 }, { 641, 7654, 689, -2109 }, { 2065, 9243, 508, -4367 }, { 1055, 8373, 688, -3144 }, { -641, 8185, 986, -3307 }, { 1120, 7426, 1785, -3757 }, { 1660, 8070, -593, -3104 }, { 2002, 9467, -1722, -3475 }, { 2361, 8368, 100, -3709 }, { -772, 7845, -613, -4988 }, { 1485, 7430, 1896, -6127 }, { -432, 7823, -947, -2882 }, { 313, 11122, -760, -4871 }, { 412, 8412, -283, -4231 }, { 1585, 10402, -1884, -3267 }, { 321, 6952, 773, -3016 }, { -105, 9014, 121, -2249 }, { 1585, 10313, -977, -4812 }, { 1619, 11869, 1306, -6876 }, { -1168, 8886, -81, -2500 }, { -395, 10886, 733, -6490 }, { -4949, 4274, 3992, -1054 }, { -4241, 5299, 4262, -1584 }, { -2710, 3862, 4552, -1673 }, { -4608, 2472, 3672, -1715 }, { -2843, 2816, 4003, -2326 }, { -5229, 2964, 5636, 90 }, { -4924, 3442, 5015, -1096 }, { -1281, 3313, 5537, -2066 }, { -3808, 1939, 4351, -919 }, { -1915, 2585, 4939, -1614 }, { -3470, 1843, 5562, -682 }, { -3800, 870, 5827, 144 }, { -4985, 1452, 4728, -709 }, { -3745, 2750, 7220, 259 }, { -1875, 1900, 6514, -826 }, { -4329, 1574, 7192, 1304 }, { -5408, 1444, 6208, 631 }, { -3327, 5312, 5707, -1541 }, { -6966, 3334, 4034, 1028 }, { -7484, 4245, 4218, -212 }, { -6567, 5839, 4539, -512 }, { -5715, 5935, 3747, -1186 }, { -6410, 4881, 3356, -1610 }, { -5146, 2590, 2850, 2172 }, { -5196, 4095, 2569, -373 }, { -5043, 6025, 4318, 692 }, { -5525, 4884, 3513, 370 }, { -6804, 7533, 5812, -488 }, { -5657, 2480, 4061, 1234 }, { -3155, 1472, 6071, 1188 }, { -3427, 5217, 3442, 858 }, { -4698, 3013, 5517, 2586 }, { -4449, 2226, 5418, 3580 }, { -6395, 3547, 5487, 2028 }, { -3500, 5019, 4787, 1 }, { -4038, 2578, 3073, 3151 }, { -2750, 1955, 4469, 3856 }, { -5696, 1659, 6118, 2469 }, { -4350, 1241, 6840, 3126 }, { -5565, 5058, 5196, 1314 }, { -1642, 4190, 3948, 607 }, { -1233, 4108, 4850, -640 }, { -997, 3428, 3239, 1378 }, { -6488, 2741, 6926, 2792 }, { -4188, 3763, 4235, 2018 }, { -3210, 3224, 5646, 1427 }, { -5526, 6909, 5070, -627 }, { -2815, 3994, 3425, 1903 }, { -2163, 2734, 5423, 145 }, { -4149, 4247, 2355, 734 }, { -410, 2521, 4138, -16 }, { -2411, 2385, 4927, 2105 }, { -6077, 3591, 3114, 594 }, { -4186, 4834, 5926, -1004 }, { -7315, 3369, 5966, 448 }, { -7042, 5721, 5771, 238 }, { -4466, 3907, 3535, -1751 }, { -2116, 3970, 6163, -1392 }, { -7239, 2143, 8407, 3630 }, { -5431, 4486, 6486, -42 }, { -1874, 1617, 6333, 519 }, { -6478, 2629, 4634, -505 }, { -7784, 2342, 7216, 1365 }, { -1154, 1432, 4831, 1544 }, { -4964, -5801, 1797, 506 }, { -4436, -6905, 1059, -1237 }, { -5400, -6886, 884, -290 }, { -6259, -7103, 523, -227 }, { -4819, -6450, 1412, -450 }, { -4056, -6213, 1725, -943 }, { -5642, -6091, 1357, 605 }, { -4196, -5678, 2187, -173 }, { -4726, -5126, 2470, 321 }, { -6642, -5091, 1507, -1005 }, { -5304, -5250, 1944, 1579 }, { -7179, -5520, 1468, -425 }, { -6033, -4895, 1876, -955 }, { -6595, -5143, 2207, 1291 }, { -4224, -4943, 1846, 1792 }, { -7128, -6950, 539, 724 }, { -4369, -4901, 2590, 1103 }, { -7413, -5696, 1712, 1440 }, { -5885, -6821, 418, 871 }, { -6828, -5599, 710, -1563 }, { -6123, -5817, 1358, 1631 }, { -5291, -5622, 578, 2138 }, { -7171, -6004, 347, 2208 }, { -6083, -5251, 2132, 425 }, { -4329, -5721, 407, -2993 }, { -5326, -5056, 1119, -1837 }, { -5485, -5856, 185, -2389 }, { -6529, -5178, 403, -697 }, { -6719, -4412, 2726, 871 }, { -5126, -5629, 1835, -771 }, { -5622, -4361, 2973, 858 }, { -5282, -5895, 45, -335 }, { -4357, -5656, 1696, -1558 }, { -7139, -6659, 627, -409 }, { -4415, -6328, 35, 1306 }, { -7639, -6110, 1134, 197 }, { -3626, -5592, 2019, 901 }, { -3547, -5064, 1176, 1738 }, { -5075, -3899, 2087, 266 }, { -4086, -6311, 1479, 360 }, { -6210, -5220, -199, -1477 }, { -3910, -5063, 1356, -15 }, { -7616, -4977, 461, 2401 }, { -6118, -6131, 1258, -563 }, { -6127, -4968, 1286, -27 }, { -4121, -5852, 1113, 1476 }, { -5157, -4881, 1162, -662 }, { -4637, -5031, 1179, 709 }, { -5509, -5452, -397, 1224 }, { -4597, -6861, 646, 467 }, { -6247, -4043, 468, 278 }, { -5336, -6465, 874, -1472 }, { -6998, -6346, 78, -1798 }, { -4915, -4530, 2756, -203 }, { -6048, -4373, 1468, 1052 }, { -4273, -7100, 942, -323 }, { -6552, -4287, 2351, 69 }, { -6954, -4613, 722, 1521 }, { -4201, -5361, 763, -1562 }, { -6881, -5596, -748, 669 }, { -6695, -3547, -34, 1299 }, { -3981, -5728, 84, 111 }, { -4663, -4809, 2173, -1031 }, { -6599, -6077, 1303, 256 }, { -7596, -4265, -5791, -4140 }, { -6610, -2758, -5288, -3936 }, { -5880, -3865, -6563, -3088 }, { -7228, -5510, -7677, -3912 }, { -8854, -6553, -8318, -5361 }, { -9362, -5249, -6413, -4319 }, { -4418, -3110, -6368, -4358 }, { -5544, -4203, -6863, -5013 }, { -3056, -4316, -5567, -3181 }, { -3078, -5999, -5051, -2657 }, { -5884, -6292, -5756, -4013 }, { -4825, -4549, -5535, -4053 }, { -4443, -6126, -5316, -1368 }, { -3972, -6341, -6098, -2686 }, { -5751, -2781, -5398, -6230 }, { -4466, -6135, -5570, -3679 }, { -4291, -5992, -3564, -5189 }, { -7189, -4429, -7279, -6082 }, { -5076, -4433, -2748, -5366 }, { -6225, -2825, -6833, -5663 }, { -2989, -4792, -3960, -4492 }, { -7836, -7773, -7722, -5741 }, { -6559, -5703, -5844, -5589 }, { -7612, -5438, -4136, -3774 }, { -4218, -4176, -6591, -2333 }, { -4837, -5063, -6581, 322 }, { -6590, -5990, -2980, -3847 }, { -5558, -2971, -5489, -1932 }, { -7001, -5323, -4975, -1697 }, { -4694, -2688, -6904, -3044 }, { -8511, -5379, -5767, -2549 }, { -7548, -5412, -6522, -2572 }, { -6597, -4973, -6423, -1274 }, { -6415, -4022, -5168, -1072 }, { -5528, -5530, -7218, -2345 }, { -4845, -4805, -5943, -1227 }, { -6049, -7150, -6744, -2161 }, { -9061, -7299, -8542, -4375 }, { -5010, -5546, -5416, -82 }, { -4135, -4205, -5109, -3373 }, { -3311, -5869, -4007, -5061 }, { -5993, -6472, -3962, -4718 }, { -2966, -5832, -2821, -6305 }, { -4851, -5152, -2067, -3930 }, { -3620, -4441, -3362, -5836 }, { -4469, -5221, -4534, -5592 }, { -4022, -6335, -4321, -6107 }, { -4899, -4503, -3084, -3725 }, { -4490, -8276, -4620, -6236 }, { -6591, -4342, -7365, -4063 }, { -6498, -5057, -5553, 485 }, { -6060, -2714, -7093, -4144 }, { -6199, -7774, -7094, -4057 }, { -7536, -6424, -6415, -4265 }, { -7439, -2454, -6348, -4827 }, { -5333, -7565, -4417, -4639 }, { -4353, -7103, -4197, -2689 }, { -5229, -6549, -5129, -6804 }, { -6129, -7701, -5236, -4836 }, { -6797, -3983, -3884, -4406 }, { -6624, -4467, -4745, -5052 }, { -3324, -7596, -2720, -6553 }, { -5473, -6284, -1704, -4511 }, { -4131, -7263, -3180, -5196 }, { -7116, -5565, -3469, 685 }, { -6002, -6021, -3858, 576 }, { -3144, -8203, -1291, -434 }, { -6096, -7027, -4004, 1353 }, { -3943, -7709, -2344, -36 }, { -4510, -6767, -2642, 631 }, { -3657, -11541, -2570, -3984 }, { -5959, -8854, -1333, -867 }, { -6699, -8866, -1606, -344 }, { -3836, -7961, -2334, -2028 }, { -3430, -8045, -3037, -672 }, { -3868, -9184, -3635, -1819 }, { -4258, -9060, -2621, -1008 }, { -3595, -8693, -2022, -752 }, { -4573, -8048, -3166, -2622 }, { -4852, -7903, -1405, 256 }, { -4591, -7057, -1560, 965 }, { -6963, -7655, -980, 808 }, { -5179, -6641, -3356, 1196 }, { -7102, -6941, -2798, 2123 }, { -6867, -5834, -3320, -770 }, { -5977, -7369, -2500, -778 }, { -6160, -6400, -934, -2543 }, { -6741, -7608, -355, -1289 }, { -6856, -6466, -1433, -1643 }, { -4786, -6292, -4970, 376 }, { -5407, -8866, -2255, -400 }, { -3814, -6506, -1387, -3620 }, { -4998, -6137, -1200, -4092 }, { -5123, -9557, -2849, -1306 }, { -4259, -6444, -4395, -338 }, { -5221, -6810, -883, 1225 }, { -6137, -6215, -2165, 554 }, { -3895, -6557, -3176, -1829 }, { -3886, -8188, -87, -954 }, { -7243, -6707, -2216, -316 }, { -5592, -7606, 85, -432 }, { -3957, -7945, -504, -144 }, { -4617, -7624, 218, -312 }, { -4797, -8737, -844, -1051 }, { -4478, -8516, -1401, -454 }, { -4557, -7058, -302, -2332 }, { -6623, -7736, -271, -50 }, { -3157, -7532, -1111, -2207 }, { -3590, -7300, -1271, 517 }, { -4442, -7306, -507, 590 }, { -6458, -7524, -2807, 666 }, { -4991, -8466, -3363, -785 }, { -7474, -7541, -1056, -1839 }, { -7501, -8316, -938, -180 }, { -5329, -7739, -579, -2341 }, { -4549, -7063, -176, -3539 }, { -5191, -8612, -1504, -4250 }, { -3083, -7058, -2251, 32 }, { -4003, -7043, -1093, -791 }, { -5523, -8093, -678, -114 }, { -3022, -10265, -2070, -3109 }, { -3905, -6274, -182, -3652 }, { -3269, -9217, -551, -2650 }, { -3138, -9314, -1726, -1704 }, { -4420, -10339, -1744, -3459 }, { -4163, -8609, -2298, -4113 }, { -5566, -6505, -1241, -463 }, { -3130, -9746, -2352, -4884 }, { -7825, -3439, 1451, -1468 }, { -8451, -3318, 2360, -435 }, { -8462, -4130, 1438, -1024 }, { -9425, -4564, 1328, -689 }, { -11014, -3202, 2278, 2080 }, { -8269, -2761, -146, -440 }, { -7497, -2618, -166, 413 }, { -8250, -3060, 522, -2133 }, { -8365, -5366, 1347, -451 }, { -8589, -3979, 2943, 714 }, { -8111, -2572, 1272, -1748 }, { -7830, -5193, 605, -1484 }, { -8119, -4736, 2141, 256 }, { -7724, -4769, 1463, -812 }, { -7363, -3911, 2540, 4 }, { -7974, -3397, 2363, 1366 }, { -7359, -4204, 1752, -958 }, { -7622, -3505, 660, 916 }, { -9934, -3665, 3165, 828 }, { -8721, -4162, 62, 1718 }, { -9433, -4768, 2722, 1234 }, { -7960, -4496, 138, 1528 }, { -8198, -3454, -443, 631 }, { -7756, -2246, 655, 1137 }, { -8841, -3145, 1113, 829 }, { -7817, -3298, 1251, 230 }, { -9413, -2733, 323, -1862 }, { -9408, -4168, 1270, 1549 }, { -9037, -3892, -942, 283 }, { -8255, -3849, 1301, 1762 }, { -9057, -3987, -41, -682 }, { -9441, -4187, 2019, -111 }, { -9740, -3178, 1602, -871 }, { -8344, -2474, 1461, 1506 }, { -9752, -2925, 1996, 1243 }, { -9199, -3796, 180, 537 }, { -9060, -2405, 1140, -1562 }, { -9348, -2376, 309, -162 }, { -10786, -3182, -5, -1500 }, { -8142, -4540, -434, -826 }, { -7528, -2341, 1104, -73 }, { -9360, -2658, 3062, 56 }, { -8267, -2335, 2000, -1193 }, { -12169, -3154, 1287, -640 }, { -11398, -2120, 946, -1163 }, { -8940, -4559, 328, -1696 }, { -11025, -4213, 2813, 840 }, { -9224, -3581, 2224, 2039 }, { -8943, -3337, 1248, -1298 }, { -7900, -4042, 485, -2080 }, { -9221, -1947, 2191, -880 }, { -10762, -1800, 2516, -324 }, { -10095, -2238, 981, -1335 }, { -11908, -2808, 3255, 645 }, { -10640, -4105, 1283, -595 }, { -7663, -2863, 2467, -797 }, { -10712, -3854, 3710, 1538 }, { -10823, -2893, 1408, -801 }, { -9874, -3832, 256, -1638 }, { -10394, -3391, 2315, -94 }, { -11525, -4079, 4153, 2122 }, { -9546, -2088, 1541, 481 }, { -8731, -2433, 1042, 2160 }, { -7852, -3977, -1370, 1677 }, { 7072, -3420, 1398, -1741 }, { 6180, -1976, 1280, -3557 }, { 7692, -1793, 2844, -1700 }, { 8363, -1773, 3104, -2679 }, { 9213, -3266, 3756, -3542 }, { 9650, -2644, 1426, -1318 }, { 7712, -2796, 3686, -1975 }, { 7316, -3517, 2821, -622 }, { 7434, -2594, 2305, -2264 }, { 7237, -1797, 255, -3114 }, { 8663, -1983, 1338, -3056 }, { 6616, -952, 4059, -2652 }, { 8823, -1327, 1362, -1356 }, { 9938, -1722, 1287, -2362 }, { 7207, -1057, 1913, -1315 }, { 7508, -1585, 870, -1982 }, { 8217, -3680, 1417, -3170 }, { 8329, -2541, 1684, -585 }, { 8062, -2335, 252, -2800 }, { 8204, -4108, 3097, -2569 }, { 7701, -3367, 576, -3008 }, { 7350, -786, 2414, -2129 }, { 6948, -2568, 1607, -225 }, { 7684, -2387, 1308, -3449 }, { 8306, -3458, 2394, -1454 }, { 8438, -2781, 1043, -1362 }, { 9175, -2076, 2144, -1987 }, { 8347, -2709, 3489, -4301 }, { 5696, -2377, 2870, 851 }, { 8825, -1243, 2219, -2603 }, { 8801, -1614, 584, -2513 }, { 8413, -384, 1421, -2244 }, { 9228, -3050, 3279, -2164 }, { 6342, -2698, 3547, -107 }, { 10053, -2476, 2837, -3168 }, { 7439, -604, 3177, -3991 }, { 7749, -1064, 4329, -4855 }, { 8655, -2177, 2252, -3519 }, { 8490, -228, 1958, -3233 }, { 10513, -2968, 1911, -2340 }, { 8146, -862, 1884, -1723 }, { 7788, -666, 3004, -2891 }, { 7785, -1620, 4133, -3417 }, { 10262, -3731, 3455, -2971 }, { 8570, -905, 4519, -4649 }, { 9129, -2562, 463, -2465 }, { 9451, -3587, 1904, -3056 }, { 6549, -2236, 3010, -4523 }, { 7175, -2684, 2967, -3458 }, { 9872, -3278, 1054, -2472 }, { 9153, -931, 1217, -2565 }, { 8789, -3469, 753, -2568 }, { 6683, -3791, 1797, -3968 }, { 6801, -1977, 2311, -452 }, { 6336, -1572, 2612, -3264 }, { 7996, -1008, 730, -2964 }, { 7521, -1059, 1573, -3694 }, { 8148, -3973, 2600, -3572 }, { 7765, -1532, 2528, -3856 }, { 7404, -3918, 4472, -143 }, { 8894, -1398, 3299, -3685 }, { 5768, -2041, 1487, -637 }, { 5131, -2865, 2463, -811 }, { 6439, -1568, 3500, -1550 }, { -8878, -6798, -5319, -1452 }, { -6332, -9713, -3112, -990 }, { -8444, -6316, -3694, -687 }, { -6123, -10840, -3637, -4358 }, { -4784, -9580, -4577, -2581 }, { -6108, -10515, -4859, -2524 }, { -7605, -7518, -2327, -2797 }, { -9662, -8775, -2467, -2010 }, { -6494, -7523, -4715, -118 }, { -8290, -8982, -1672, -317 }, { -8798, -11051, -3888, -1426 }, { -6273, -6623, -6791, -142 }, { -8313, -7668, -2141, -1275 }, { -6453, -8412, -3589, -4102 }, { -6747, -7750, -5690, -2498 }, { -7814, -6693, -3174, -2446 }, { -10383, -10130, -3931, -2364 }, { -10606, -8467, -5539, -2772 }, { -9475, -6671, -3305, -2271 }, { -8982, -9457, -5635, -4005 }, { -10111, -7965, -6515, -4180 }, { -7301, -6479, -5364, 720 }, { -9543, -8999, -7921, -912 }, { -9534, -8562, -3469, -384 }, { -7601, -10344, -3205, -1127 }, { -8088, -8620, -4954, -2888 }, { -8202, -8406, -7038, -3775 }, { -7312, -8324, -3334, -1775 }, { -8566, -9262, -8071, -4174 }, { -7068, -11300, -5573, -2907 }, { -8295, -8952, -4366, -1544 }, { -11104, -10210, -2285, -384 }, { -5213, -7520, -5008, -1339 }, { -5889, -7940, -5987, -1385 }, { -10816, -8201, -4153, -1485 }, { -10277, -8919, -6315, -1652 }, { -5888, -10320, -3821, -1733 }, { -10497, -7181, -6083, -3032 }, { -7721, -9724, -6591, -5336 }, { -5688, -7894, -3486, -2552 }, { -10014, -10500, -3247, -820 }, { -6301, -8765, -4506, -2923 }, { -8261, -7847, -6213, -1552 }, { -10212, -7481, -8113, -3954 }, { -6938, -10874, -6074, -4703 }, { -7183, -10968, -4446, -1773 }, { -7120, -9193, -1966, -2509 }, { -6234, -9263, -2313, -4284 }, { -8503, -9857, -2429, -608 }, { -9372, -7844, -8391, -2120 }, { -7951, -7157, -6535, -11 }, { -7256, -9473, -2172, -660 }, { -10063, -9612, -2515, -15 }, { -6684, -9134, -6109, -4206 }, { -8204, -11932, -5220, -2306 }, { -9710, -6706, -4115, -3275 }, { -6855, -7078, -2409, -4447 }, { -7344, -7673, -4479, -4116 }, { -8851, -6842, -4927, -2948 }, { -8927, -10452, -5633, -2194 }, { -8627, -9002, -7176, -1575 }, { -8209, -9722, -7021, -3324 }, { -3770, -10249, -3623, -4816 }, { -8183, -7465, -4090, 646 }, { -8163, -7149, 200, 498 }, { -8289, -6266, 686, -206 }, { -10030, -6241, -1032, -1864 }, { -8793, -8327, -773, -169 }, { -9149, -6215, 969, -15 }, { -8303, -5859, -7, 2006 }, { -9682, -7283, 255, 1322 }, { -9293, -7227, 71, -231 }, { -8525, -6215, 287, -837 }, { -10477, -5379, 1159, 1449 }, { -10726, -7856, -130, 102 }, { -8694, -7461, -1210, 690 }, { -9367, -5324, 1103, 3170 }, { -10686, -8055, -831, 1633 }, { -9201, -6873, -2704, 2258 }, { -8421, -5358, -1405, 226 }, { -9066, -5830, -307, -1571 }, { -11150, -7381, -2746, -900 }, { -9978, -5925, -2006, -437 }, { -9464, -4741, -273, 1061 }, { -10543, -6684, -1113, 1660 }, { -10073, -5576, 1083, -269 }, { -8826, -5763, 1600, 1486 }, { -10445, -9071, -1253, -64 }, { -12085, -5799, 2, 769 }, { -12939, -6663, 1650, 1437 }, { -10932, -6434, -1252, -649 }, { -11650, -7826, -2053, 710 }, { -12122, -6733, -1889, -731 }, { -9093, -6095, -2463, -842 }, { -10977, -4364, 469, 420 }, { -11488, -6908, -521, 893 }, { -9669, -5478, -842, 337 }, { -10606, -5203, -632, -1361 }, { -10198, -6284, 1662, 1277 }, { -10135, -5292, 2435, 3493 }, { -11027, -6561, 655, 56 }, { -10977, -5030, 1127, -358 }, { -12766, -3986, 1348, -335 }, { -14244, -7731, 264, 317 }, { -15124, -10309, -508, 1447 }, { -12821, -8638, -608, 137 }, { -13076, -8693, -2852, -431 }, { -11156, -5546, -2252, -1600 }, { -8692, -7366, -819, -1223 }, { -12507, -9816, -1714, -121 }, { -10712, -6666, 544, 3349 }, { -12462, -5890, -2491, -2318 }, { -12468, -7226, 437, 232 }, { -11300, -5226, 2068, 687 }, { -11994, -8320, -626, 2728 }, { -12222, -5476, 1142, 18 }, { -10277, -8122, -2418, 2003 }, { -13418, -6115, -3563, -2802 }, { -14759, -9834, -1243, 21 }, { -13699, -5665, 1525, 507 }, { -16269, -9476, -701, 163 }, { -12677, -5437, -247, -1019 }, { -11827, -4295, -181, -1243 }, { -12847, -4496, 2984, 1123 }, { -13860, -7915, -1166, -547 }, { -12276, -8145, -2290, -1527 }, { -11417, -4830, 2983, 1854 }, { -11793, -6002, 1163, 1940 }, { 11443, -4920, -3235, 3151 }, { 11300, -6616, -1506, 1175 }, { 9198, -4628, -2060, 2390 }, { 10532, -4027, -643, 912 }, { 9902, -3573, -1606, 1327 }, { 9653, -3536, -2240, 1869 }, { 9948, -5171, -423, 2662 }, { 12316, -4004, -1989, 281 }, { 12125, -4800, -1265, -163 }, { 10650, -2617, -2337, 1462 }, { 9909, -4968, -2376, 916 }, { 12944, -4647, -1958, 460 }, { 12988, -5283, -1141, 41 }, { 12321, -2915, -3621, 1025 }, { 11449, -2894, -2728, 351 }, { 12087, -3041, -2002, -32 }, { 11558, -4031, -1343, -399 }, { 12983, -3740, -3516, 1245 }, { 12099, -2515, -2752, 225 }, { 12515, -3465, -2701, 550 }, { 14683, -5022, -5272, 2996 }, { 12260, -3383, -1215, -528 }, { 13810, -5422, -2443, 1166 }, { 13421, -5378, -1886, 721 }, { 12961, -4259, -2594, 796 }, { 12266, -2104, -4768, 1591 }, { 13523, -4710, -3045, 1342 }, { 12437, -2099, -5610, 2117 }, { 11850, -2183, -3497, 661 }, { 12275, -3936, -597, -697 }, { 12459, -5253, -517, -544 }, { 12835, -4094, -1322, -168 }, { 14360, -5677, -3305, 1859 }, { 13905, -4552, -4309, 2117 }, { 11559, -3412, -1847, -81 }, { 13379, -3167, -5764, 2746 }, { 11910, -1634, -4342, 1052 }, { 12662, -4742, 71, -974 }, { 13057, -3254, -4424, 1705 }, { 15046, -5706, -4851, 3019 }, { 14162, -4142, -5514, 2843 }, { 12764, -1845, -6684, 2888 }, { 13714, -2374, -7838, 3857 }, { 13295, -1663, -8293, 4073 }, { 10032, -4152, -3403, 1421 }, { 10942, -5386, -2222, 950 }, { 10532, -6385, -1750, 1925 }, { 10273, -5972, -1534, 643 }, { 10605, -4782, -1695, 27 }, { 10988, -5153, -1123, -341 }, { 11629, -5884, -1060, 48 }, { 10441, -4045, -2431, 311 }, { 10788, -3595, -4171, 1807 }, { 12110, -5686, -2127, 976 }, { 11746, -4773, -2639, 891 }, { 11541, -5299, -3031, 1732 }, { 11416, -2559, -5359, 2198 }, { 11583, -5376, -704, 677 }, { 10416, -3214, -3516, 872 }, { 9651, -5435, -1618, 3255 }, { 9973, -5133, -996, 3923 }, { 11707, -4643, -430, -796 }, { 10994, -2709, -3587, 2302 }, { 10716, -5118, -645, 270 }, { 14100, -10314, 1095, 1531 }, { 12944, -8049, 1105, -741 }, { 13276, -7035, -511, 274 }, { 14008, -7254, -283, 139 }, { 11594, -6536, -91, 1671 }, { 11732, -8645, 746, 15 }, { 14613, -7085, -1578, 1183 }, { 13083, -6224, -750, -4 }, { 13988, -6256, -1592, 820 }, { 14678, -8683, 441, 126 }, { 15571, -8872, -521, 1139 }, { 15642, -9533, 341, 697 }, { 15960, -9586, -168, 1121 }, { 15464, -10239, 1433, -1 }, { 14934, -7887, -1046, 1080 }, { 15252, -7630, -1899, 1628 }, { 15485, -8384, -1234, 1484 }, { 15962, -8638, -1815, 1931 }, { 16501, -10664, 398, 1167 }, { 16146, -10145, 411, 918 }, { 14573, -7475, -697, 601 }, { 14302, -7996, 28, 257 }, { 14769, -6792, -2286, 1574 }, { 14144, -6137, -2169, 1257 }, { 14770, -6271, -3111, 1933 }, { 14110, -8312, 1083, -531 }, { 15235, -6991, -2993, 2174 }, { 13222, -5805, 547, -891 }, { 14796, -8762, 1254, -246 }, { 16040, -9181, -1005, 1551 }, { 16487, -10086, -373, 1420 }, { 15077, -9479, 966, 51 }, { 13026, -6468, 932, -1080 }, { 12703, -6152, -33, -573 }, { 15641, -6810, -4128, 2874 }, { 13282, -7673, 1583, -1283 }, { 12373, -7150, 1512, -917 }, { 12992, -7751, -678, 783 }, { 10907, -6858, -313, 2597 }, { 13026, -8963, 125, 2152 }, { 12770, -9946, 1957, -505 }, { 12482, -6849, -1268, 833 }, { 13790, -6181, -138, -279 }, { 12709, -8382, 2044, 227 }, { 12244, -6630, 203, -457 }, { 14209, -6816, -1032, 632 }, { 15134, -8267, -288, 640 }, { 13619, -6157, -1090, 356 }, { 14044, -7413, 725, -484 }, { 12958, -7753, 2585, -1980 }, { 13188, -8396, 2306, -1558 }, { 14379, -9980, 2132, -688 }, { 14275, -9857, 1162, 179 }, { 13690, -8648, 1621, -889 }, { 11770, -6829, -746, 278 }, { 12732, -8202, 286, 90 }, { 13630, -10146, 1867, -207 }, { 12072, -8740, 1299, -645 }, { 12852, -9492, 1226, 62 }, { 11792, -7382, -54, -116 }, { 13779, -9014, 487, 351 }, { 11951, -7729, 121, 834 }, { 11970, -9781, 2276, -4 }, { 12680, -7984, 2787, -787 }, { 13300, -14488, 6408, -1927 }, { 13635, -15355, 9153, -3073 }, { 12804, -13566, 5517, -1625 }, { 16624, -10854, 1690, 28 }, { 20387, -18532, 6162, -261 }, { 16515, -12642, 3392, -519 }, { 15800, -11095, 2151, -202 }, { 16824, -11790, 1651, 599 }, { 17604, -13213, 2563, 538 }, { 17892, -14177, 3562, 147 }, { 16987, -11399, 869, 1052 }, { 17003, -12456, 2442, 265 }, { 21657, -21806, 9198, -1250 }, { 16825, -13341, 3980, -686 }, { 17525, -12714, 1887, 805 }, { 16419, -11034, 1216, 617 }, { 20931, -19939, 7469, -684 }, { 18452, -15390, 4573, -191 }, { 14778, -10077, 2841, -1209 }, { 17402, -13319, 3042, 160 }, { 19365, -17922, 7087, -1061 }, { 16298, -11941, 2810, -351 }, { 19087, -16176, 4775, -84 }, { 17666, -12289, 938, 1224 }, { 18581, -15894, 5132, -430 }, { 19823, -16717, 4142, 545 }, { 19960, -19423, 8400, -1492 }, { 18973, -16817, 5906, -594 }, { 19079, -15431, 3528, 503 }, { 16667, -12485, 4467, -1302 }, { 19791, -17797, 6196, -529 }, { 20005, -17606, 5354, -20 }, { 20123, -18599, 6886, -728 }, { 19068, -14805, 2394, 1105 }, { 14443, -13723, 5631, -2029 }, { 14730, -14231, 5631, -1450 }, { 16089, -15959, 7271, -2029 }, { 13473, -11200, 3236, -924 }, { 14413, -10902, 2347, -267 }, { 17666, -18662, 11381, -3496 }, { 14749, -11042, 3305, -275 }, { 15304, -10486, 1869, -240 }, { 14809, -12126, 3369, -616 }, { 16896, -16561, 7307, -1845 }, { 15782, -14336, 5380, -1264 }, { 16395, -15520, 6415, -1588 }, { 13681, -11114, 2584, -320 }, { 14244, -12326, 4480, -1632 }, { 15247, -13119, 4265, -898 }, { 13987, -12091, 3469, -597 }, { 13941, -12770, 4240, -839 }, { 13771, -13627, 5252, -1384 }, { 15010, -16074, 7592, -2249 }, { 15852, -17226, 8619, -2655 }, { 18921, -16916, 6875, -1501 }, { 14909, -11678, 2768, -295 }, { 18988, -18353, 8424, -2070 }, { 15457, -15080, 6218, -1513 }, { 14916, -15512, 6949, -1883 }, { 18108, -14702, 4681, -701 }, { 17600, -15733, 5616, -775 }, { 14070, -13683, 6472, -2626 }, { 13832, -11914, 5201, -2232 }, { 18846, -19009, 9192, -1961 }, { -11981, -10994, -6324, -2264 }, { -10976, -9047, -6546, -3828 }, { -11288, -10532, -7014, -4191 }, { -10139, -10189, -7799, -2688 }, { -10555, -9988, -9181, -2040 }, { -11596, -11339, -10022, -2707 }, { -13400, -13395, -11306, -4206 }, { -9774, -12281, -7466, -4133 }, { -10842, -13125, -8777, -4956 }, { -11964, -15082, -9779, -5095 }, { -9382, -10188, -9053, -4927 }, { -11562, -11296, -3651, -985 }, { -9287, -10083, -7918, -4069 }, { -12821, -16556, -11410, -6195 }, { -12628, -8959, -4521, -1113 }, { -13845, -11581, -3649, -681 }, { -12685, -10269, -5483, -1275 }, { -14988, -12874, -5107, -1189 }, { -13761, -11367, -6202, -1804 }, { -13225, -11249, -7820, -3354 }, { -14809, -11992, -3202, -312 }, { -15620, -15519, -10210, -3433 }, { -12954, -10200, -3139, -611 }, { -11536, -9981, -5284, -923 }, { -13034, -12417, -4612, -1098 }, { -16911, -15505, -6123, -1352 }, { -17396, -17685, -8330, -2171 }, { -14120, -10764, -2265, -99 }, { -12598, -7367, -5406, -3530 }, { -14143, -12793, -10909, -5226 }, { -14692, -16871, -11626, -5554 }, { -12581, -11197, -9194, -3837 }, { -16752, -16726, -9746, -2808 }, { -10600, -10358, -6560, -1227 }, { -14573, -13312, -8957, -3393 }, { -10172, -8463, -8579, -3387 }, { -11418, -12421, -5522, -1842 }, { -11855, -14204, -6669, -2625 }, { -13308, -8191, -3941, -2194 }, { -10007, -12266, -5022, -1811 }, { -13532, -15771, -9497, -3175 }, { -11760, -11148, -10339, -5529 }, { -12149, -12763, -11198, -3697 }, { -12029, -12119, -8555, -1792 }, { -16995, -19957, -11447, -3471 }, { -13144, -14504, -9988, -3191 }, { -9938, -11064, -6139, -3162 }, { -8873, -11550, -8294, -6550 }, { -9303, -13010, -6150, -2711 }, { -15463, -10469, -1766, -170 }, { -15985, -11693, -3007, -650 }, { -17142, -10671, -1434, 47 }, { -16063, -13858, -4817, -1058 }, { -19446, -19599, -9594, -2464 }, { -20076, -18744, -8313, -1889 }, { -15047, -16085, -7590, -2250 }, { -13481, -16195, -8552, -2998 }, { -13829, -14869, -6704, -1932 }, { -16357, -18484, -9802, -2959 }, { -10551, -8393, -9303, -5070 }, { -11345, -9156, -5641, -3107 }, { -13217, -13449, -9270, -4541 }, { -11988, -13732, -9995, -6374 }, { -11007, -9519, -5168, -4107 }, { 9930, -7858, 8061, -4375 }, { 8274, -7867, 5992, -2096 }, { 9692, -9675, 7621, -3670 }, { 9589, -8110, 6509, -3010 }, { 12617, -11976, 10122, -5360 }, { 11867, -8895, 7948, -5323 }, { 10388, -10482, 9234, -4324 }, { 8188, -8220, 7810, -2737 }, { 10407, -8787, 4806, -1930 }, { 10348, -8845, 9233, -6614 }, { 9422, -7091, 4820, -2878 }, { 9758, -9796, 5584, -2256 }, { 10188, -7994, 5347, -3343 }, { 11133, -7455, 4015, -2306 }, { 10676, -10744, 6093, -2629 }, { 11522, -12184, 7848, -3375 }, { 8805, -9883, 5317, -3071 }, { 9498, -9654, 6555, -3592 }, { 10488, -8008, 4066, -1252 }, { 11261, -8930, 6068, -2738 }, { 12180, -10397, 5027, -1531 }, { 9138, -8531, 3601, -1959 }, { 8107, -8380, 4970, -2061 }, { 9737, -13248, 6438, -2617 }, { 11178, -10423, 2622, -522 }, { 9572, -12372, 5199, -2019 }, { 12057, -12144, 4147, -1099 }, { 9047, -9925, 2516, -665 }, { 10790, -8030, 5882, -4386 }, { 7199, -8426, 6337, -2841 }, { 7778, -8285, 3529, -3442 }, { 7559, -10569, 3484, -1332 }, { 9404, -8115, 7484, -5541 }, { 7792, -11976, 5546, -2573 }, { 9313, -10264, 7661, -5195 }, { 6701, -10725, 4370, -1784 }, { 4918, -11361, 4507, -4527 }, { 5147, -12305, 3978, -5556 }, { 6525, -9899, 4481, -3129 }, { 7538, -12855, 6060, -4826 }, { 8659, -12111, 7159, -4430 }, { 8440, -11304, 4547, -1747 }, { 9216, -10918, 3507, -1195 }, { 6165, -9254, 4771, -4677 }, { 9163, -11019, 5637, -4935 }, { 13441, -11509, 6676, -2434 }, { 7912, -9398, 6663, -4048 }, { 11723, -13745, 8131, -4148 }, { 6065, -10257, 5005, -6327 }, { 11618, -12417, 5336, -1894 }, { 8891, -13924, 8407, -6131 }, { 9622, -12563, 7908, -5109 }, { 11479, -10315, 8349, -3991 }, { 11676, -14103, 6611, -2330 }, { 11951, -8953, 3829, -1550 }, { 10486, -8044, 10493, -5920 }, { 11801, -10769, 9763, -5305 }, { 6109, -8676, 5827, -1346 }, { 7030, -9611, 5624, -5761 }, { 12808, -12886, 8683, -4148 }, { 13213, -10464, 6381, -3189 }, { 11796, -13681, 10703, -6075 }, { 9639, -7949, 9625, -3944 }, { 8538, -6997, 5309, 453 } }; /* quantization tables */ static const uint32_t scale_factor_quant6[64] = { 1, 2, 2, 3, 3, 4, 6, 7, 10, 12, 16, 20, 26, 34, 44, 56, 72, 93, 120, 155, 200, 257, 331, 427, 550, 708, 912, 1175, 1514, 1950, 2512, 3236, 4169, 5370, 6918, 8913, 11482, 14791, 19055, 24547, 31623, 40738, 52481, 67608, 87096, 112202, 144544, 186209, 239883, 309030, 398107, 512861, 660693, 851138, 1096478, 1412538, 1819701, 2344229, 3019952, 3890451, 5011872, 6456542, 8317638, 0 }; static const uint32_t scale_factor_quant7[128] = { 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 6, 7, 7, 8, 10, 11, 12, 14, 16, 18, 20, 23, 26, 30, 34, 38, 44, 50, 56, 64, 72, 82, 93, 106, 120, 136, 155, 176, 200, 226, 257, 292, 331, 376, 427, 484, 550, 624, 708, 804, 912, 1035, 1175, 1334, 1514, 1718, 1950, 2213, 2512, 2851, 3236, 3673, 4169, 4732, 5370, 6095, 6918, 7852, 8913, 10116, 11482, 13032, 14791, 16788, 19055, 21627, 24547, 27861, 31623, 35892, 40738, 46238, 52481, 59566, 67608, 76736, 87096, 98855, 112202, 127350, 144544, 164059, 186209, 211349, 239883, 272270, 309030, 350752, 398107, 451856, 512861, 582103, 660693, 749894, 851138, 966051, 1096478, 1244515, 1412538, 1603245, 1819701, 2065380, 2344229, 2660725, 3019952, 3427678, 3890451, 4415704, 5011872, 5688529, 6456542, 7328245, 8317638, 0, 0, 0 }; /* 20bits unsigned fractional binary codes */ static const uint32_t lossy_quant[32] = { 0, 6710886, 4194304, 3355443, 2474639, 2097152, 1761608, 1426063, 796918, 461373, 251658, 146801, 79692, 46137, 27263, 16777, 10486, 5872, 3355, 1887, 1258, 713, 336, 168, 84, 42, 21, 0, 0, 0, 0, 0 }; static const float lossy_quant_d[32] = { 0, 1.6, 1.0, 0.8, 0.59, 0.50, 0.42, 0.34, 0.19, 0.11, 0.06, 0.035, 0.019, 0.011, 0.0065, 0.0040, 0.0025, 0.0014, 0.0008, 0.00045, 0.00030, 0.00017, 0.00008, 0.00004, 0.00002, 0.00001, 0.000005, 0, 0, 0, 0, 0 }; /* 20bits unsigned fractional binary codes */ static const uint32_t lossless_quant[32] = { 0, 4194304, 2097152, 1384120, 1048576, 696254, 524288, 348127, 262144, 131072, 65431, 33026, 16450, 8208, 4100, 2049, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 0, 0, 0, 0, 0 }; static const float lossless_quant_d[32] = { 0, 1.0, 0.5, 0.33, 0.25, 0.166, 0.125, 0.083, 0.0625, 0.03125, 0.0156, 7.874E-3, 3.922E-3, 1.957E-3, 9.775E-4, 4.885E-4, 2.442E-4, 1.221E-4, 6.104E-5, 3.052E-5, 1.526E-5, 7.629E-6, 3.815E-6, 1.907E-6, 9.537E-7, 4.768E-7, 2.384E-7, 0, 0, 0, 0, 0 }; /* Vector quantization tables */ static const int8_t high_freq_vq[1024][32] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { -4, -2, 2, 1, -16, -10, 1, 3, 1, 0, 6, 1, -3, 7, 1, -22, 2, -4, -3, 11, 14, 6, -1, 1, -13, 29, -28, 10, 10, -8, 0, -9 }, { -8, 8, -7, 10, -3, -12, -5, -8, 1, -2, 9, -2, -5, -18, 1, 9, -8, -8, 3, 41, 7, -9, -9, 22, -42, -29, 14, -18, -14, -32, 1, -15 }, { -16, 8, 15, 16, -16, 5, 2, 7, -6, -16, -7, 1, 1, -3, -2, 0, 8, 20, -26, -11, 2, -17, 0, -3, -34, -37, 10, 44, -2, 22, 2, -4 }, { 7, 14, 5, 6, 15, -1, 3, -3, -9, -23, -5, -14, 8, -1, -14, -6, -5, -8, 54, 31, -6, 18, 2, -19, -2, -11, -30, -6, -19, 2, -2, -14 }, { 1, 2, -2, -1, -3, -3, 1, -5, 1, -3, -4, -8, 5, -4, 0, 1, 3, 7, -5, -4, -3, -12, 3, -2, -3, 12, -53, -51, 6, -1, 6, 8 }, { 0, -1, 5, 1, -6, -8, 7, 5, -18, -4, -1, 1, 0, -3, -3, -14, -1, -6, 0, -14, -1, -1, 5, -3, -11, 1, -20, 10, 2, 19, -2, -2 }, { 2, 4, 3, 0, 5, 0, 3, 1, -2, 0, -6, -3, -4, -5, -3, -3, -7, 0, -34, 4, -43, 17, 0, -53, -13, -7, 24, 14, 5, -18, 9, -20 }, { 1, 0, -3, 2, 3, -5, -2, 7, -21, 5, -25, 23, 11, -28, 2, 1, -11, 9, 13, -6, -12, 5, 7, 2, 4, -11, -6, -1, 8, 0, 1, -2 }, { 2, -4, -6, -4, 0, -5, -29, 13, -6, -22, -3, -43, 12, -41, 5, 24, 18, -9, -36, -6, 4, -7, -4, 13, 4, -15, -1, -5, 1, 2, -5, 4 }, { 0, -1, 13, -6, -5, 1, 0, -3, 1, -5, 19, -22, 31, -27, 4, -15, -6, 15, 9, -13, 1, -9, 10, -17, 4, -1, -1, 4, 2, 0, -3, -5 }, { -7, 3, -8, 13, 19, -12, 8, -19, -3, -2, -24, 31, 14, 0, 7, -13, -18, 0, 3, 6, 13, -2, 1, -12, -21, 9, -2, 30, 21, -14, 2, -14 }, { -3, -7, 8, -1, -2, -9, 6, 1, -7, 7, 13, 3, -1, -10, 30, 4, -10, 12, 5, 6, -13, -7, -4, -2, -2, 7, -3, -6, 3, 4, 1, 2 }, { -8, 9, 2, -3, -5, 2, 0, 9, 3, 7, -4, -16, -13, 3, 23, -27, 18, 46, -38, 6, 4, 43, -1, 0, 8, -7, -4, -1, 11, -7, 6, -3 }, { 1, 1, 18, -8, -6, 0, 3, 4, 22, -3, -4, -2, -4, -11, 40, -7, -3, -13, -14, -7, -10, 14, 7, 5, -14, 11, -5, 7, 21, -2, 9, -3 }, { 0, 0, -2, 4, -2, 0, 2, 0, -1, 2, -1, 0, 0, 2, 2, 2, -1, 1, -3, -1, -15, -2, -63, -27, -21, -47, -14, 1, -14, 10, 0, 2 }, { 1, 0, -4, 0, -3, -9, 4, 2, 6, -6, 0, -5, 11, -7, -15, 6, -7, -6, 3, 7, -15, -5, 23, -13, -6, 12, -8, 9, 2, -3, 3, 4 }, { 6, 0, 3, 0, -2, -4, 2, 1, 1, -1, 1, -2, -1, -4, -22, -15, -46, -66, 10, 20, 2, -17, 12, -6, 1, -2, -2, 0, 1, -5, 1, 2 }, { -1, 0, 0, 1, 0, -4, 0, 1, -10, -3, -8, 5, 7, -11, 2, -11, 29, -25, 11, 10, 0, -1, 5, -7, -2, -5, -2, 4, 4, -3, 5, -2 }, { 1, -1, -1, -3, -2, 1, -8, -3, 2, -2, 4, -5, -1, -7, -2, 1, -14, -7, 3, -30, -15, -14, 3, -4, -1, 3, -13, -1, -3, 1, 2, 3 }, { -1, -2, -3, 2, 2, -3, 3, 1, -3, 2, 0, -4, 6, 5, -5, 10, -57, 3, 22, -50, 1, -2, -5, -6, -1, 5, 1, 2, 2, 1, -2, 2 }, { 2, 0, -1, -7, 2, 1, 3, 2, 0, 4, 3, -2, 3, -3, 4, -4, 24, -35, -3, 38, -6, -5, 15, 20, 3, 16, -7, -5, 0, -4, -5, 0 }, { 0, 1, 0, 0, 0, -1, -1, 1, 1, -1, 1, -2, 0, 0, 0, 0, 0, -1, -2, -1, -5, -2, -43, -3, 46, -52, -10, 7, -8, 11, -2, -1 }, { 0, 0, -1, 0, -1, 2, -41, 33, -44, -48, -15, -26, -9, 6, 3, 3, -3, 2, 2, 2, 2, -1, -1, -2, 1, 3, 0, 0, 5, 2, 3, 1 }, { -4, 1, 6, 1, -6, -1, -2, 1, -14, -4, 0, -5, -2, 2, -2, 0, -6, 1, 0, 8, -21, 32, -3, -36, -6, -2, -1, -7, 3, 0, 1, -6 }, { -3, -2, 3, 0, 2, 2, 8, -4, -4, 6, 2, 1, 3, -6, 4, 3, 13, 0, -12, -1, 25, -20, -2, -23, -15, 7, -3, -11, -3, 6, -1, 0 }, { 0, 0, -3, -1, 0, 0, -2, -1, -2, -2, 1, -1, 0, 0, 10, 3, -2, 3, 3, -7, -6, -5, 0, -4, -60, -16, -6, 38, 5, 6, -5, 0 }, { 0, 1, 0, 0, 0, 0, 0, 0, 1, -1, -1, 0, 1, 0, 0, 1, 0, 0, -1, 0, -8, 2, -9, 10, 40, 31, -56, -21, 4, 20, -4, 7 }, { -2, -2, 0, 4, -3, -1, 7, 3, 1, 3, -8, 0, 3, 1, 2, 5, 1, -2, 14, 5, 4, 5, 5, 5, -5, 9, -66, 0, -20, -2, -8, 4 }, { -2, -1, 4, -1, -8, -2, -4, -1, -3, -3, 2, -7, -3, 5, 7, -2, 45, 31, -17, -16, -2, -2, -1, -22, 1, -1, -3, 3, 5, -3, 5, -1 }, { -4, 0, 7, 5, 8, 7, 2, 9, -9, -9, -7, -11, -3, -8, 17, -4, 34, 32, 18, 22, 1, 2, 1, -7, -5, 6, -1, 6, 4, 10, -2, -7 }, { 6, 0, 14, 9, 6, -1, -2, -3, 4, -6, -8, 4, 7, -1, 28, 38, 15, -1, 16, -11, 5, 8, 4, -10, 3, -10, -17, 5, 3, 3, 3, 1 }, { 1, 1, 2, -1, 2, 1, 0, 0, -1, 0, 0, -2, 1, -3, 0, 1, 2, -2, -4, -2, 0, -1, 1, -3, 1, 1, 1, -1, 8, 8, 66, 33 }, { -5, 2, -3, -7, 2, -8, -4, 10, 17, -18, -7, 4, -4, -7, -6, -6, -5, 5, -12, 2, 0, 6, 8, -2, 1, 4, -11, 2, 1, 8, 31, 19 }, { 6, 9, 16, -6, -6, -1, -2, -3, -11, -2, 7, 7, 17, 3, 4, 10, 2, 5, -13, 8, 7, 1, 4, 5, 7, 6, 7, -8, 9, -8, 33, 6 }, { 3, -1, 1, 0, -7, -5, 0, 14, -7, 1, -7, 1, 2, -4, 7, 10, -16, 12, 1, -6, 3, 8, -1, 10, -13, -6, -12, -23, 12, -3, 30, 14 }, { -2, -15, 0, 8, 3, -19, 5, -3, 2, 3, 13, 7, 14, -3, -10, 0, 8, 5, -6, -16, -8, -8, 14, 2, -1, 1, -9, -11, 11, -5, 27, 9 }, { -8, 6, -4, 4, -4, -1, 5, 4, 1, -7, -5, -4, -15, 1, 9, 0, 8, 4, 1, -17, 11, -2, -19, -1, -6, -8, 3, -12, 3, -17, 33, -10 }, { -3, -1, 2, 7, 7, -2, 9, 8, -18, -1, -13, -10, -3, -3, 11, 8, -2, -12, -8, 1, 4, 9, 14, 10, -3, 0, 2, 1, -2, 3, 31, 10 }, { -3, -10, 8, -1, -5, -11, 7, -5, 3, 6, 1, 4, -16, 10, 5, -4, -2, -10, -1, 13, 6, -5, -7, 12, 7, -3, -17, 1, 12, -4, 29, 8 }, { 1, 2, 5, 2, -6, -7, 0, -1, 6, -1, 10, 6, -4, 5, 2, 2, -2, -8, -6, -11, 14, -13, 27, 3, -2, -12, 5, -16, 2, -26, 20, 15 }, { -1, -3, -5, -3, -3, 6, -1, 3, -5, 1, 7, 2, 1, 0, -1, -1, 0, -1, 9, 7, -6, -3, 4, -5, -4, 8, -8, -25, -8, -4, 34, 23 }, { -1, -2, 1, 1, -1, -2, -1, 1, -1, 0, 0, 0, 0, -2, -1, 1, 0, 2, 1, -1, 4, 0, 0, 1, -1, 0, 5, 3, 12, -9, 68, -16 }, { 10, 0, -8, 14, -6, 1, -12, 0, 0, -3, -5, -11, -6, 12, 9, -10, -3, 5, 0, 7, 11, 2, 4, -3, -8, -3, 7, 4, 3, -3, 34, 4 }, { -12, 13, -5, 7, -11, -2, -1, 1, -4, -14, -21, 3, -3, -3, -4, -7, -9, -4, 3, -17, -2, -13, 10, -2, 12, -4, 0, -9, 1, -5, 31, 10 }, { -10, 6, 5, 6, 4, -7, 10, 0, -28, -3, 0, -11, -1, -5, 16, -10, -16, 7, 20, 2, -4, 2, -5, 0, 15, 6, 5, -10, 7, -9, 20, 4 }, { 1, -7, -2, -7, 4, -3, -2, -7, -1, -14, 6, -16, 4, -5, -4, -6, -5, 0, -2, 2, -6, 9, -5, 4, -18, 8, -10, 8, 15, 0, 32, 1 }, { -5, 7, -3, 7, 15, -4, 0, -16, 9, 5, -5, 5, 4, -3, -12, -9, -18, 10, 2, 2, -3, 7, 3, -1, 6, -9, -10, 3, 15, -4, 35, -7 }, { -1, -10, 2, 2, -4, -2, 10, 2, -1, 2, -2, 1, -1, -14, -11, 3, -8, 5, -8, -2, 6, -1, -7, 1, 7, 5, 7, 8, 30, -4, 30, 14 }, { 2, -2, 1, 2, 3, -8, 3, 0, -2, 0, -9, 2, 1, 4, -6, -1, -2, 5, 0, 1, -2, 12, 6, -3, 9, -3, 4, -12, 21, -39, 24, -2 }, { 3, 5, 1, -2, -2, -2, -3, 6, -8, -2, -11, -8, -1, 4, 2, 2, -4, -10, 12, -5, -11, 1, -15, -34, -11, -7, -11, -1, 7, -14, 38, -1 }, { -4, 4, 8, 9, 8, 1, -5, -9, 4, -2, 15, -4, 11, -15, 20, -1, -1, -3, 4, -9, -2, -2, -2, 8, 6, 12, -5, 0, 11, -12, 27, -4 }, { 0, 8, -4, 3, -11, 6, -11, 2, 3, 0, 5, -8, -7, -6, -9, -21, 4, -11, -1, -16, -7, 16, -3, 7, -7, 4, -5, 0, 11, -7, 31, 3 }, { 1, 3, 4, 11, -11, -2, -3, -6, 6, 5, 0, 3, -9, -6, 4, -4, 0, 4, -8, 13, -6, -13, -1, -5, -1, 4, 0, 0, 9, -22, 24, 18 }, { -7, 3, 10, -13, -6, 6, -6, 6, 22, 1, 0, -14, 2, 3, 7, -1, 8, 20, -1, 5, -4, 13, 9, -9, -9, 6, 0, -4, 0, -8, 31, -4 }, { -3, -4, 0, 1, 7, 3, -7, 0, 5, -2, 1, 3, 3, 1, -5, -2, 5, 2, -11, 4, 0, -1, 12, 0, -3, -13, 15, 8, -6, -27, 34, 0 }, { -3, -3, 10, -4, 2, -1, -3, 0, -1, -1, -4, 2, 6, -2, 12, 1, 3, -6, -7, -6, -5, 4, -19, -6, -8, -34, -4, -8, 10, -7, 23, 10 }, { -7, 0, -1, -6, 8, 4, -4, 2, -5, -8, -7, -9, -8, 5, 9, 7, -6, 1, -12, -12, -1, -16, 5, 0, 16, 3, -7, -8, 27, -4, 23, 15 }, { -8, 4, 8, 5, 6, 11, -3, 5, 3, -1, -11, 6, -5, 0, 2, -6, -3, -6, 4, -1, 5, -5, -12, -6, 7, -5, 9, 3, 6, -7, 29, 1 }, { 1, 3, -2, -2, -6, -2, 1, 6, -6, -3, 1, 2, 3, 4, 1, 5, -1, 0, 4, 2, 11, 6, 2, -3, 13, -9, -19, 18, -15, -10, 36, 21 }, { -3, -3, 2, -1, -7, 6, -4, 1, -3, -1, -2, 2, 3, -7, -3, 0, -2, 0, -2, 6, -19, 3, -8, 2, -6, 7, -1, 0, 29, -6, 28, -10 }, { -5, 1, -3, -7, -12, -4, 1, 1, -1, 13, -10, -1, -9, -5, -13, 6, 13, 3, -4, 2, 3, 11, 2, 6, -25, -16, -6, 0, 14, -1, 27, 16 }, { -6, -1, -7, -5, -2, -5, -5, -1, 9, 1, 0, 3, -8, -12, -6, 5, -6, 5, 3, -9, 1, 4, -7, -10, -9, -7, -17, -5, -15, -23, 25, 3 }, { -8, -2, 9, -3, -4, 3, -1, 8, -7, -7, -5, -4, -2, 9, 4, -1, -7, -4, -5, -16, 3, -6, 18, -13, -9, 16, -15, 8, 15, -10, 24, 5 }, { 1, -38, 2, 34, 9, 10, 11, 2, 2, -6, 3, 2, -2, 5, 4, -7, -1, 1, 4, 0, 3, 1, -8, -1, -6, 5, 4, 2, -4, 5, 2, -1 }, { 1, -22, 15, 18, -2, 10, -16, -9, -8, -11, 8, 4, 0, 7, -14, -5, -1, -7, 12, 17, 9, 5, -7, -4, -12, -6, 7, 0, 7, 2, -2, 1 }, { -11, -29, 7, 10, 19, -1, -8, -9, 7, 1, 9, 6, 8, -7, -14, 8, -3, -11, -13, 0, -7, -23, -2, -8, 12, 9, 2, 14, 19, 1, -1, 5 }, { -24, -27, -11, 36, 2, 6, -3, 4, -6, 8, 0, 12, -1, -4, -6, 3, 4, -1, 2, -3, -2, 3, 2, -1, -2, -4, 0, -1, -2, 7, 2, 3 }, { -9, -24, 11, 13, -10, -12, 12, -2, 7, 4, 8, 13, -3, -3, 2, 9, -3, -4, 4, 13, 5, 13, -6, -3, 1, 15, 7, -3, 0, 19, -2, -9 }, { -8, -15, 7, 14, -4, -5, 2, -18, -19, -2, 2, 17, 16, 6, -10, 10, -9, 14, -1, -5, -1, -6, -7, 2, 9, 11, 13, 6, -5, -12, 3, 2 }, { -10, -37, 13, 1, 3, -14, 0, -20, 4, -3, 8, 2, -2, -3, -9, -5, -3, -17, -1, 13, -11, 2, -6, 4, 4, 0, 3, 1, -9, -4, -5, -4 }, { -2, -22, -5, 46, -8, 5, 9, -11, 8, 7, 7, -1, -1, -2, -7, 2, -3, 3, -1, -2, 7, 0, 2, -1, 1, -2, -2, -3, 6, 0, -4, -6 }, { -16, -27, 15, 16, -4, 14, -7, -26, 2, -2, 6, 5, -3, 11, 0, 2, 3, 9, -7, -1, 2, -4, -4, -1, 6, 10, 1, 1, -3, -2, 3, 0 }, { -3, -22, 10, 26, 1, 2, -3, 3, 17, -3, -7, 9, 1, -21, -4, 5, 3, 0, -7, -6, 3, 3, -8, -7, -9, 3, 7, 1, -8, 12, 6, -7 }, { -9, -25, 3, 18, 9, -6, -11, 0, -5, -12, 9, -8, -7, -6, -6, 22, 2, -6, -3, 15, 3, 2, -2, 9, 14, -10, -7, 15, 13, 6, -2, 11 }, { 5, -20, -5, 28, 11, 10, -4, -4, 0, -7, 3, 5, 2, -5, -8, 2, 6, 10, 9, -9, -18, 3, 14, 1, 3, -3, -1, -6, 7, 7, 2, -1 }, { -8, -30, 7, 12, 10, 8, 7, -13, -16, 0, 1, -1, -6, -11, -15, 4, 1, -2, 10, -15, 1, 11, -2, 8, 9, -7, -7, 9, -5, 2, 7, -18 }, { -10, -32, 10, 11, 3, -1, 3, -5, 5, 2, 14, -6, 3, 1, 5, -15, -11, 6, 20, 4, 0, -12, -7, 3, 1, -1, 10, 6, -1, -9, -4, -1 }, { 1, -25, -14, 12, -11, 9, 9, -16, -24, -17, 22, -9, 11, -30, -3, -4, 6, -7, 9, 2, -1, -5, -6, 2, -1, -1, 10, 1, -3, 3, 4, 8 }, { -14, -26, -6, 9, 8, 17, -11, -24, -7, -4, -8, -2, 10, 2, 2, -1, 2, 13, 12, -7, 4, -6, -10, 6, 6, -13, -11, -7, -16, 0, -2, 5 }, { -4, -30, -13, 12, 16, -6, 12, -16, -13, 5, 15, -2, -2, -10, -7, 7, 11, -1, -4, -2, -4, 7, 4, -8, 1, 3, 0, 11, 3, -2, -5, 4 }, { -4, -21, 20, 22, 2, 20, -8, 1, -12, -5, -9, 4, -10, -17, -3, -8, -3, 3, -12, 1, -3, 0, 7, 4, 7, 7, -3, 7, 5, 3, 1, -5 }, { -12, -20, 2, 29, 11, -6, 9, -7, -6, -4, 0, 6, 17, -13, -2, -10, -17, -1, -18, 2, 0, 14, -6, 1, 0, 3, 2, -10, 1, -5, -2, 5 }, { 16, -37, -1, 26, -2, -14, 1, -5, -14, 2, 2, 3, 6, 1, 1, 4, 0, -1, 0, -2, -2, 4, 9, -6, 0, -2, 10, -7, -2, 4, 1, 0 }, { -9, -24, -12, 5, 5, 3, -17, -14, 4, 3, 2, -4, 10, -22, -8, -3, 6, 1, 12, -8, 4, 1, 9, -1, 18, -3, 6, 5, 3, -5, 9, -5 }, { -14, -33, -2, 20, -13, -10, 2, -7, -1, 11, -9, -8, 18, -3, 1, 8, 0, -2, 10, 7, -2, -13, 9, -3, -4, 5, -2, -2, -1, -5, 1, -7 }, { -10, -23, 8, 14, 1, 7, 1, -3, -7, 4, 1, 1, 8, -7, 15, -14, 13, 14, 2, 5, -13, -5, -8, -1, 6, 3, 6, 9, 6, 15, 14, 5 }, { -13, -25, -10, 13, -17, -24, -7, -13, -6, -10, -8, 2, 0, -13, -10, -4, -8, 4, -9, 9, -4, 4, -3, -3, 3, 3, -5, -9, 1, -2, 11, 2 }, { -12, -23, 1, 18, -11, -2, 5, 9, -5, 5, 14, -9, -3, -2, -6, 2, -2, 11, -13, 1, -3, 11, -9, -4, -2, -6, 8, 10, 1, 4, 2, 1 }, { -5, -18, 16, 22, 2, 0, 8, -6, -9, -7, 10, -16, 23, 10, -11, -1, 7, 2, 7, 2, 1, -5, 6, 1, 0, -4, 9, 2, -3, 1, 0, -4 }, { -3, -26, 14, 11, 2, -9, 17, -2, -1, -5, -16, -9, -5, 10, -13, 1, 6, 12, 10, 11, 0, 0, -3, -14, 6, -2, 0, 4, -5, -1, -7, -1 }, { -10, -33, 1, 8, 11, -5, 1, -6, 7, 4, 5, 6, 1, -2, -10, -5, -6, 12, -11, 5, -10, 4, 12, -1, -1, -3, 4, -1, 9, 0, 16, -17 }, { -14, -37, 7, 7, -2, 5, -8, -11, 2, -13, 4, -19, 1, 8, 8, 4, -9, 2, -4, 3, 12, 2, 4, -4, -8, 8, 1, 4, 8, -1, 6, -2 }, { -6, -30, 18, 17, 1, -22, -3, 4, -7, -10, 7, 0, -8, 8, -1, 4, 2, 8, 6, -2, 2, 7, 4, 4, 3, -6, 2, 1, -3, 1, -1, -5 }, { -17, -18, -3, 22, -8, 1, 9, -2, -17, 20, -5, -5, -12, -5, 4, -5, -9, 8, -2, 16, -3, 0, 19, -8, 8, 1, 2, -4, 0, 11, 0, -3 }, { -9, -23, 3, 10, 4, 4, -3, -2, -2, -2, 1, -22, 11, 0, -2, 5, -2, 14, -9, -11, -4, 7, 5, 32, 1, -3, -7, 0, 21, -9, 7, -6 }, { 0, 0, 0, 2, -1, 1, 0, 1, 3, 0, 0, 1, 0, 1, 0, 1, -3, 0, -1, -2, 0, -1, -1, -3, -1, 1, -4, 1, -1, -5, -69, -19 }, { -3, -5, -8, -12, 4, -3, -19, -11, -5, 0, -14, 7, 18, -6, 7, 22, 8, 14, 15, 10, 3, -1, -3, 5, -1, 7, -7, 1, -6, 3, -26, -11 }, { -1, -6, 4, -4, -5, -16, 0, -6, -3, 11, 1, 0, 9, 5, 16, 3, -4, -33, -4, 4, -7, 0, 1, 6, -11, -2, -13, -2, -18, 20, -25, -16 }, { 4, 0, -1, 0, -5, 1, 0, 2, 0, 11, -10, 4, -10, 7, 16, 2, 16, 15, 2, -1, 2, 9, 2, 8, -3, -5, -2, 0, -3, 0, -33, -2 }, { -3, -15, 10, 10, -9, -1, 7, 3, 5, -5, -8, -8, -3, 15, -9, 4, 12, 13, -13, -14, 10, -6, 9, 22, -27, 23, -1, 5, -24, 2, -30, 5 }, { 0, -2, 7, -5, -5, 3, 5, 3, -3, -5, 2, 1, -4, 3, -3, -1, 1, -2, 10, 22, -3, -4, -2, -2, -7, 3, 8, 1, 14, 4, -37, 9 }, { -3, -4, -1, 1, -4, 0, 6, 2, 6, -7, -10, -10, -1, -4, 11, -3, 7, -6, 4, -12, -1, 5, 1, -7, 10, -6, 17, -4, 8, 3, -40, 13 }, { 2, 12, 4, -7, 14, -3, 16, -2, 18, 2, 13, 5, 5, 1, 11, -1, 0, 9, 2, -6, -1, 2, -6, 2, -5, 3, 5, 1, -1, 1, -32, -7 }, { -16, 11, 7, -4, 2, -5, -9, 9, 11, 11, 15, -13, -11, 11, 9, 4, 3, -8, -10, 12, 12, 0, 0, -16, -9, 13, 2, 9, 4, -13, -33, 3 }, { 6, 4, 5, 4, 3, -1, 5, 6, 4, 2, -11, -1, -15, -11, -1, 1, 11, -3, -2, 24, -4, -6, -25, -10, -15, -8, 0, 0, -5, 4, -30, 2 }, { 10, -3, -6, 1, -9, -5, 6, 9, -10, -3, 8, -1, 4, -1, 11, -11, 3, 9, 11, -3, 6, -17, 5, -8, -33, 9, -13, 19, -2, 9, -25, 2 }, { 0, 0, -1, -3, 0, -2, 1, 0, 0, 2, 1, 0, -2, 0, -1, 2, 0, -1, 4, -1, 2, -3, 4, -2, 3, 3, 1, 0, -15, 12, -63, 27 }, { -2, 14, 9, -1, 3, 0, 1, 1, -19, 15, 3, 4, 0, -10, 1, -5, 3, 0, -5, -10, 2, -16, -4, 8, -12, -6, 7, -5, -10, -1, -33, -4 }, { 0, 3, 1, 3, 1, 2, 4, 4, 9, -6, -8, -5, 1, -12, 3, 8, -10, 6, -1, 1, 13, -5, -5, 2, -4, 13, -18, -10, -7, -9, -33, 10 }, { -6, -3, -12, 5, -1, 11, -6, 0, -2, 1, 2, -7, 3, 1, 3, -2, 1, 8, -10, 7, -1, -3, 3, 0, 13, 1, 6, 7, -16, -7, -39, 8 }, { -6, -1, 11, 6, -3, 8, 3, -5, 3, 0, -5, -2, -6, -3, -4, 2, -3, 13, -11, 1, 7, 5, 19, -5, -3, -15, -1, 7, -1, 6, -33, 8 }, { -7, 3, -4, -3, -4, 1, 6, -5, -5, 6, -8, -1, -7, 4, -1, -6, -2, 1, 7, 0, 1, 1, -5, 2, -2, 0, -13, -2, -31, -14, -39, -12 }, { -10, 9, 0, -3, 1, -1, -1, 0, 1, -5, -1, -4, -2, 5, 2, -7, 18, -8, -2, -19, -7, -7, -12, -14, -11, -1, -9, -13, -7, -12, -31, -9 }, { -3, -16, 10, 9, 1, -10, -12, 2, -2, 2, 7, -3, -3, 1, -4, -5, -9, 5, 7, 3, -1, 4, -11, -8, 4, 13, -10, 13, 10, -4, -36, 1 }, { -7, -12, 4, -20, -7, -7, 2, 11, -1, -2, 3, -12, 1, 0, -6, -7, 6, 4, 13, 3, -3, 4, 3, -6, -12, 5, -5, -22, -13, -8, -37, -6 }, { -7, 5, 3, 5, 7, 9, -14, -3, 10, 17, -1, 1, -12, 5, -6, 0, -4, -9, 0, -11, -14, 3, 13, 6, -25, -8, -12, 4, -10, 18, -30, -1 }, { -10, 6, -10, 6, 6, 1, -10, 0, -7, 5, -2, 17, -18, -4, 0, -3, -16, -6, -3, -8, 5, 1, -4, 6, -7, 16, 6, 10, -1, 0, -32, -11 }, { -1, 9, 9, -5, 4, 9, 6, 9, -4, -2, 7, 11, 4, 2, -5, -4, -6, 0, 2, -3, -1, 5, 10, 0, 12, -10, -18, -3, -1, 14, -33, 2 }, { 4, -8, -18, -4, -5, -11, 4, -10, -4, 9, 13, -12, 1, -6, 1, 2, 4, -9, 8, 3, -6, 21, 13, -1, -2, 1, -2, 6, -7, 0, -30, 1 }, { 6, -1, 2, -3, -1, -4, 6, -4, 0, 4, 2, 2, -9, 2, 6, 3, -2, 4, -1, 9, -6, 0, 7, -8, 5, 19, -2, 9, -5, 2, -33, -8 }, { 2, 1, 12, -5, -8, 8, 3, -2, -4, 1, -2, 5, -4, -9, -8, -8, 7, -11, -4, 6, -10, 7, -1, -1, -2, -1, 16, 32, -7, 20, -33, -6 }, { -18, 2, 6, 13, 9, 9, -1, 3, -17, 24, -2, -6, 28, 8, -2, 6, 3, -10, -34, -16, -13, -4, -15, -11, -12, -3, -10, 4, -8, 4, -31, -4 }, { -11, 0, 18, 2, -16, -9, -13, -2, -2, -12, -3, -22, 30, 0, 8, 3, 9, -4, -16, 1, 0, -11, 15, -2, -4, 6, -5, 6, 1, 2, -25, -12 }, { 14, -1, 5, 7, 3, -15, -8, 1, 5, -2, 12, 13, 11, -25, 3, 1, 0, -2, -4, -16, -23, 0, -5, -17, 7, 5, -9, 6, -5, 2, -32, -7 }, { 3, -1, 6, 14, 2, -12, -9, -9, 4, 7, 4, 6, 5, -8, 4, 2, 4, 5, -2, 8, 8, -6, 0, 10, -20, -1, 3, -1, 8, 23, -33, -5 }, { -3, 11, -6, 3, -4, 5, 7, 3, 4, 5, -2, 3, -1, 30, 6, 1, 8, -6, 0, 0, -9, 6, -9, 4, 2, 9, -6, 1, -12, 0, -34, 18 }, { -17, 13, 0, 1, 9, -4, -11, 0, 7, 0, -10, -4, -1, 6, -6, 4, 1, 6, -9, 3, -5, -6, -11, 2, -4, 14, 23, -3, 2, 5, -30, 12 }, { -14, 5, -27, 2, 0, 7, 1, 4, 30, 8, 7, 5, 1, -1, 0, 5, 8, -10, 48, -11, 12, 33, 6, 8, -15, 20, -2, -5, 32, 5, -19, 10 }, { -16, -4, -12, -7, -2, 0, 8, -6, -20, -18, 16, -3, 0, 31, -2, 11, 2, -9, 49, -19, -12, -23, 10, 26, 16, -2, 4, -21, -14, 13, -11, -9 }, { -5, -9, -1, 3, -5, -21, 2, 10, 0, 0, 10, -21, -7, 7, -26, -9, 22, 32, 58, 11, -3, 11, -5, -8, -13, 6, -5, -9, 1, 10, 14, -8 }, { 7, 7, 10, 3, -2, -1, -11, -11, -6, -43, -3, 14, -19, -18, 19, 18, -32, 10, 45, -6, 6, 21, -20, -12, 2, 4, 6, 6, -4, 3, 3, 1 }, { 21, 22, -3, -2, -11, -6, -1, -2, 8, 8, 32, -21, 7, 28, -4, -6, -3, -2, 50, 2, 2, 27, -5, -8, 12, 7, -5, -1, -4, -17, 27, 6 }, { 13, 7, 2, -6, -12, 2, -10, -5, -17, 11, 4, 17, -12, -2, 5, -17, 37, -16, 48, -14, -18, 29, 8, 24, 11, -5, -9, 11, -1, 1, -13, -3 }, { 1, 1, -1, 2, 0, 0, 0, -1, 1, -1, 7, 2, -3, 3, 0, 6, 2, 10, 54, -25, 7, 54, -5, -6, -1, -15, 9, 13, -24, -15, -12, 3 }, { 21, 5, 8, 3, -3, -4, -2, -4, 3, -11, -5, -8, 9, 16, 8, -9, -10, -3, 46, -46, 2, 1, -10, 10, 17, 11, -20, -36, 10, 14, 0, -5 }, { 7, -13, -6, -9, -24, 45, 2, 8, 8, 0, 17, 20, 12, -24, 1, -7, -15, -3, 46, -13, -2, 20, 1, -13, -11, -13, 2, 15, 1, 10, -1, 3 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -2, -1, -16, -9, 31, -69, -34, 26, 7, 17, -1, -6, -1, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -4, -5, -20, 18, -82, 22, 3, -7, 9, 4, 6, 2, -4, -1, 0, -2, 2 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, -1, 15, -5, 62, -36, 4, 52, -7, 5, 0, 6, 1, 2, 1, 1, -1, 0 }, { 3, -19, 19, -20, 13, -4, -11, 8, 8, -16, 10, 1, -14, 30, 1, -33, 10, -11, 45, -30, 3, -4, -3, -13, 7, 12, 3, -22, 3, -2, -4, -2 }, { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 1, 11, 8, 70, 48, -10, 21, 4, 9, -9, -9, -4, -6, 0, -1, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, -1, 80, 2, -15, -36, -10, -5, -2, 8, -2, 2, 0, 0, 0, 0 }, { 10, 8, -8, -8, -24, 12, -1, 0, 20, 9, -1, -2, 2, -2, 12, -10, -2, -13, 35, -43, 44, 15, -10, -25, 4, 10, -3, -5, -5, 7, -1, 3 }, { 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -2, -1, -18, 9, 49, -72, 7, -8, 7, -5, 2, 3, 2, -2, 1, -2, -3, 1 }, { -1, 4, -3, 10, 19, 4, 3, 20, 6, -24, 6, 9, 8, 15, 18, 18, -36, 19, 57, -11, 4, -3, 8, 7, 2, -3, -2, -9, -15, -2, 12, -4 }, { 20, 3, 11, -9, -4, 22, 42, -25, 1, 5, -10, -19, 0, 9, -16, 5, 2, 10, 44, -29, 17, -3, -9, -2, -1, 8, 14, -7, -1, 16, -5, 1 }, { -7, 16, -11, 12, 6, 33, -15, 14, -23, 2, -26, 8, 2, 10, 0, -5, 8, -8, 38, -38, -4, 5, 5, 5, 1, 22, -15, 7, 6, 0, 4, 28 }, { -1, -12, 2, 10, -2, 0, 7, 17, 12, 22, -4, 10, 25, 29, 5, 18, 4, 1, 27, -39, 31, 17, 2, 2, 22, -23, 13, 16, 1, -7, -4, -5 }, { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -2, 0, -14, 0, -7, -11, 49, -22, -4, 19, 17, -39, 4, -29, 10, 2, 36, -4, 23, -1 }, { -2, -2, -2, -2, 1, 15, -5, -7, -16, -8, -19, 16, -3, -20, 36, -9, -3, 20, 39, -20, 0, 2, 27, -16, 10, 10, -14, -22, -16, -3, 13, -8 }, { 5, -9, 6, -25, 7, 37, 13, -10, -5, 3, -5, 7, 18, -22, -7, 9, -5, -4, 50, -11, -4, -5, -5, 8, -4, -2, -4, -27, 14, 20, 7, -9 }, { 0, -14, -10, -27, -14, -17, -6, 26, 10, 2, 14, -12, -5, 0, 8, 9, 0, -28, 55, -7, -12, -7, 4, -10, 10, 7, -12, 11, 3, 5, 9, -8 }, { 2, 23, 4, -2, -1, -20, -2, 14, 10, -9, -9, -24, 10, 0, 11, -12, 12, 11, 49, -25, -2, 29, 7, -13, 21, -10, 11, -17, 3, 1, -8, 5 }, { 3, 0, -14, -6, 18, -2, 17, -9, -19, 9, -5, 9, 14, 6, 19, -3, 27, 1, 41, -21, 20, -15, 33, 0, 26, 14, 7, 10, 3, 20, -3, -12 }, { -1, 16, 15, -8, 3, -8, -8, 21, -5, -16, -29, 4, 1, -6, -4, -28, 2, 31, 37, -26, -2, 13, 24, 8, -9, -6, -29, 10, 7, 2, 7, 8 }, { -10, -10, 11, 13, -32, 2, 16, 9, 14, 23, -15, -13, 24, 13, 4, -27, 14, 12, 31, -18, 17, 23, -2, -7, -14, 9, -17, -6, -10, 20, 9, 6 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 5, 1, 89, 8, 10, -6, 2, -1, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -1, 4, -7, 64, -50, 7, 37, 2, 5, 0, 0, 0, 0, 0, 0, 0, 0 }, { -2, 5, 3, -4, -4, -3, 2, -3, 3, -3, 5, 4, 1, -6, -1, 1, 6, -2, 50, -35, -7, 43, 7, -7, -5, -26, 24, 21, 3, -15, 5, 6 }, { -8, 21, -19, 33, -8, 22, -11, 17, 3, 0, 0, -2, 1, -3, 6, -1, 10, -8, 4, -11, -4, -5, 0, 8, -4, 3, 1, -4, 4, 2, 8, 4 }, { -7, 5, -20, 9, -22, 3, -14, 1, 6, 13, 23, -2, -4, -7, 2, 0, 11, 4, 6, 3, -7, -11, -7, 4, 5, 5, -12, 8, 2, 4, 7, -3 }, { -7, 6, -4, 20, -20, 16, -2, 7, 6, 16, 11, 12, -7, -7, 5, 3, -9, -4, 1, 2, 5, 2, 1, -9, -2, -17, -4, 6, -10, 7, -7, -6 }, { -9, 18, -17, 12, -24, 1, -1, 4, 14, 9, 4, 3, 2, 8, -12, -14, 4, -8, -4, 7, 7, 6, -1, 13, -9, -4, -1, 1, 0, -4, 15, 8 }, { -25, 2, -11, 6, -5, 24, -28, -5, 8, 12, -2, 6, 8, -3, 8, -9, -1, -5, -1, -5, 6, -1, -1, -1, -4, 8, -12, -2, -13, 7, 2, 1 }, { -14, 14, -18, 20, -10, 12, -2, 9, 1, 0, 12, -2, 15, -10, 26, -17, 16, -11, 10, -10, 9, -2, 4, -8, 2, -3, 4, 4, 2, -3, -5, 1 }, { -18, 12, -18, 21, -6, 12, -6, 13, -25, 18, 1, 11, -9, -5, 0, 10, -5, 3, -3, 8, -9, 7, 4, 2, -9, 0, 5, 0, 2, -3, 9, -8 }, { -4, 16, 1, 18, -30, 9, 1, 6, -8, 13, 13, -12, -6, -1, 13, 7, 6, 2, -15, -3, 5, 5, 1, -6, 1, -5, 0, 2, -16, 0, 3, -4 }, { -21, 1, -2, 6, -43, 18, -1, 5, -1, 4, 6, -2, -1, -3, -1, -3, 0, 1, 2, -9, 0, -1, 0, -2, 0, -1, -1, -2, 6, 0, 1, -2 }, { -23, 10, 4, 7, -32, -11, -18, 2, -2, -7, -6, -3, -3, -12, 19, 3, -5, -6, 16, -6, 16, 2, 16, 16, 8, -2, 13, 8, -15, -11, 2, 10 }, { -8, 2, -13, 2, -29, 24, -20, 19, 1, 10, -4, 10, 1, 2, -9, 11, -1, -2, 9, -5, 19, -7, 16, -9, -2, -18, 11, 1, 1, 0, 7, -3 }, { -6, 3, 4, 13, -26, 10, -10, 28, -7, 28, 1, 7, 0, -14, 5, 7, 4, -4, 3, -2, 3, 3, -11, 7, 6, 4, 0, -1, 2, -1, -3, 2 }, { -6, 16, -31, 13, -10, 17, -6, 4, -14, 4, 4, -1, -10, 12, -5, 1, -14, 15, 0, -8, 1, -5, 3, 3, 9, -5, 7, -20, 7, 4, 11, -5 }, { -19, 3, -17, 14, -12, 16, -22, 18, 14, 8, -2, 4, 10, 12, -14, 4, -3, 2, 3, 7, -7, 7, -6, 2, -2, -4, -5, 0, -5, -2, 2, 1 }, { -9, -7, -11, 24, -36, -9, -11, 5, 7, -12, -13, 18, -2, 20, 1, -4, -1, -10, 15, -6, 14, 1, 0, 2, 1, 2, -9, -16, -11, 7, 13, 0 }, { -24, 24, -18, 18, -22, 14, -11, 13, -12, 11, -10, 11, -7, 11, -5, -4, -1, 1, 5, 2, 3, -1, 1, -5, 7, -4, 5, -6, 8, -7, 8, -6 }, { -6, 18, -22, 22, 5, 11, -1, 6, 19, 22, 8, 4, -8, 20, -2, 15, -6, -18, 0, -33, -9, -12, -1, 6, 5, 2, 5, 5, -5, -17, -3, -3 }, { 1, 11, -16, 9, -18, 11, -4, 18, 20, 26, -10, 8, 1, -11, 8, -4, 0, 7, 3, 5, 2, 2, 10, -2, -4, 4, -4, -2, 1, -4, -5, -1 }, { -10, 6, -1, 18, -17, 27, -3, 10, -2, 12, -7, -9, 1, 1, -1, 7, -12, -1, -7, -6, -1, 8, 3, -15, 8, 9, 3, -7, 4, -1, 1, -1 }, { -14, 6, -16, 22, 2, 5, 0, 5, -18, 11, 6, -3, 22, -20, -9, -3, 6, -6, -7, -15, 1, 15, -8, 11, 8, -3, -8, 1, -8, 2, 6, -2 }, { -21, 5, -19, 19, -7, 4, -7, 0, -8, 6, 12, 5, -3, -22, -13, -6, -1, -3, -2, -14, 6, -3, 1, -8, -7, -5, -6, 11, -3, -10, -5, 2 }, { -1, 9, -12, 15, -6, 6, -19, 14, -9, 11, 3, 12, -17, -3, 8, -4, -3, -4, 1, -5, 4, 5, -7, -15, -7, 15, -6, -5, 1, -5, -3, 1 }, { -12, 20, -15, 20, -14, 3, -14, 9, -6, 33, -13, 6, -2, 8, -6, 7, -5, -6, -3, -3, 0, 8, -3, -3, 1, -2, 2, 2, 6, -5, -5, -2 }, { -7, 12, -18, 12, -18, 10, -4, 8, 2, 4, 8, 9, 0, 3, -8, 3, 6, -12, -4, 1, 25, -5, -9, 6, -7, 0, -9, -7, 3, -5, -4, -4 }, { -18, 12, -10, 11, -22, 0, -15, 5, -2, 2, -3, 6, -4, -4, -3, -15, -2, -3, 21, 6, -12, -11, 19, 3, 3, -14, 7, 0, -11, -22, -10, 0 }, { -15, 2, -30, 15, -17, 13, -16, 8, -7, 10, -8, 2, 11, 3, 10, -7, 7, -22, 12, -10, 3, -12, 6, -10, 12, -10, 7, -8, 5, 2, 9, 1 }, { -9, 11, -14, 6, -10, 21, 5, 12, -5, 5, 7, 21, 6, 2, -2, -1, -1, 4, 2, -20, -18, -1, -14, 3, -1, 4, -7, 10, 1, 11, 4, -4 }, { -22, 8, -30, 13, -21, -4, 4, -1, 12, 9, -2, -3, 2, -6, 4, -13, -2, 8, 8, 1, -7, 3, -4, -5, -1, -7, -2, 8, 8, 7, 8, 0 }, { -6, -4, -35, 16, -13, 15, -11, 14, -7, 9, -1, 11, 7, 0, 13, 10, -1, 8, 1, 1, -2, 8, -1, 2, 2, 3, -10, -1, 7, -13, -3, -7 }, { -15, 7, -16, 14, -18, 17, -6, 14, 3, 4, 7, -3, 10, -22, 5, -15, 4, -4, -11, 15, -15, 11, -11, 20, 1, 0, 2, 1, 11, -3, 11, -7 }, { -12, 3, 5, 16, -37, -1, 15, 15, -15, 10, 3, -10, 1, 15, 7, -15, -13, 8, 9, -3, 2, 12, -8, 2, -5, 0, -3, 4, 5, -9, -4, 5 }, { -16, 26, -4, 14, -22, 26, 6, -3, -8, 4, 21, 6, 16, -4, -11, 7, -10, 3, 3, 7, -4, 2, -9, 8, -2, 2, 5, -2, -4, -2, 7, -1 }, { -7, -10, 4, 3, 2, -4, -12, -10, -4, -5, 16, 19, -16, 1, 2, -9, -10, 0, 9, 7, -8, 3, 12, 8, -6, -11, -13, -1, -3, -20, 6, -5 }, { -14, -17, 3, -5, 14, -12, -12, 8, -6, -25, 21, 21, 10, -8, -12, 4, 10, -4, 3, -9, 11, 9, 0, 4, 2, -15, 1, -14, 4, 1, 0, -4 }, { -4, -9, -3, -1, 6, 3, -6, 6, -10, -4, 14, 8, 2, -3, -12, -19, 0, 11, -20, 1, 6, -2, -27, -6, 10, -17, -14, -17, -9, 8, -8, 3 }, { -12, -13, 16, -4, -2, 12, -7, -11, 2, -13, 3, 7, -16, -18, -1, -12, -2, 1, -12, -9, -2, -6, 2, 9, -22, -3, -4, -14, -7, 7, -1, 2 }, { -7, -8, -8, 15, 15, 18, 15, 16, -4, -37, 11, 15, -12, -1, -3, 3, 6, 6, 0, -5, -3, -5, 9, 1, 1, -11, -1, -8, -6, 2, 3, 0 }, { -6, 7, -5, -12, 13, 10, -18, -4, -3, -21, 6, 16, -15, -7, -12, -9, 1, -12, -1, 10, -2, -1, -3, 4, -4, 1, -16, -1, 12, -9, 5, 9 }, { -14, -5, 9, 3, 4, 26, -28, 3, -6, -24, 4, 5, 3, 13, 5, -1, 3, -1, 3, 1, 1, -5, 3, 0, -7, -8, -7, -3, 3, -5, 4, 0 }, { -4, 2, -10, -6, 25, 26, -6, 10, -6, -8, 15, 11, -6, -3, 2, -7, 5, 14, 9, -1, 0, -12, 4, -4, -10, 1, -3, 3, -2, -2, -6, -1 }, { -10, 8, -15, -10, 19, 17, -8, 0, -3, -7, 7, 5, -13, -1, 7, -7, 1, 13, -12, -13, 17, -12, 1, 26, -18, -3, -5, -6, 4, 5, 8, 1 }, { 2, -5, 3, 0, 0, 0, 2, -3, -2, -5, 7, 13, -4, 9, 0, -5, 4, -1, -11, -8, -4, 0, -13, 2, -47, -23, -8, -11, -4, 4, -2, -3 }, { -18, -4, 4, 5, -1, 17, -12, -8, 1, -12, 7, 20, -12, 3, -2, -11, 16, 12, -6, 1, -13, -16, -6, -3, -3, -5, 4, -12, -5, -9, 10, 1 }, { -11, 0, 4, 7, 7, 8, 3, -1, 3, -19, 32, 8, -19, -8, 2, 4, -12, 15, -16, 3, 1, 9, -2, 1, -2, 8, 5, 6, -4, -1, 11, -8 }, { 3, -1, 4, -2, 14, 32, -9, -23, -10, -12, 22, 15, -1, -2, 10, 0, 4, 6, -8, 4, -15, -2, -1, -4, 0, -8, 4, 1, -8, 3, 4, 1 }, { -17, -12, 6, -8, 16, 13, -20, -8, -1, -16, 10, 21, -19, 11, -9, -5, 7, 18, -6, 7, -7, -18, 13, 2, -2, 8, -12, -9, 2, 4, -5, 16 }, { 4, 0, 17, -11, 12, 7, -12, 5, -1, -25, 30, -8, -7, -6, -4, -7, 9, 8, 7, 3, 3, -16, 8, 0, -2, -2, -18, -3, -4, -5, 1, 4 }, { -3, -6, 6, -16, 17, 6, -3, 2, -9, -17, 12, 11, 11, 2, -20, 8, 1, 1, 0, 2, -2, -6, -21, -13, -9, -15, -1, -8, -6, -8, 0, -2 }, { -11, -7, 6, -9, 3, 6, 8, 16, 4, -5, 23, 26, -10, -3, 4, 0, 2, 2, -4, 4, -2, -12, 12, 10, -11, 0, -10, -16, 3, 0, 0, -10 }, { -5, -16, 10, -6, 27, 13, -3, 4, -2, -13, 15, 5, 2, 5, 3, -4, 13, 12, -11, -7, 0, 1, 11, 12, 2, 13, -15, -8, 9, -2, 3, 8 }, { -5, -8, 4, 3, 9, 3, -11, 10, 14, -25, 14, 8, -2, 5, -12, -21, 2, 10, -7, 2, -3, 2, 0, 2, -1, -3, -5, -6, -1, -16, 2, 8 }, { -1, 5, 1, -11, 5, 9, -7, 8, -13, -12, 4, 12, -4, 1, -1, -1, 27, 29, 10, 15, 2, -6, -3, 4, -21, 10, -9, -11, -6, -1, -9, -3 }, { -6, -3, -1, -6, 11, -5, 0, -2, -5, -31, 11, 3, -1, 5, -3, 4, 5, 7, -10, 5, -10, -13, 4, 12, -15, -2, 2, -7, 1, -9, -3, -10 }, { -3, -7, 17, -8, -5, 36, 8, -7, -8, -20, 12, 8, 1, -1, 3, 0, 1, 4, -10, 3, 1, 4, -2, -3, -2, -3, -10, 4, -1, -7, 3, 2 }, { -13, -3, -5, 9, 22, 6, -23, 3, -10, -7, 17, 17, 18, -14, -8, -8, 2, 4, -8, 2, -3, -8, 6, 4, -1, 7, 0, 0, -3, 0, -12, -3 }, { -3, -10, -15, -3, 9, 3, -23, -9, -13, -18, 12, 13, -2, 0, 1, 8, -1, 2, -7, -12, -5, 14, 2, 1, -22, 6, -10, -8, -9, 28, -7, -14 }, { -3, 1, 2, -1, 13, 7, -2, -7, 1, -3, 6, 9, -3, -2, 4, -2, 2, 1, -10, -2, -2, -22, -2, -7, -10, -5, -11, -27, -12, -16, 4, -7 }, { 2, -6, -3, 1, 8, 0, -2, 12, -3, -4, 58, 15, -10, -4, -2, 2, -2, 0, -2, -6, 2, 4, -1, 1, -4, 1, -1, -5, -4, -3, 3, 1 }, { 10, -1, 0, 5, 21, 7, -14, 6, -3, -16, 15, 17, -16, 13, 3, -6, -4, 6, -12, -5, 1, -4, -7, -8, 2, 3, -6, 6, -1, -8, 5, 4 }, { -6, -2, -8, -11, 15, 10, 0, 8, -6, -15, 33, 8, -2, 18, -15, -11, 5, -1, 0, 15, -15, -4, -4, -1, 10, 7, -13, 4, -4, 0, 8, 3 }, { -7, -2, 0, -2, 0, -2, -4, -5, -14, -16, 12, 38, 7, 12, 6, -4, 0, -1, 0, 3, -2, -6, 0, 2, -9, 1, 0, -1, 0, -2, 4, 1 }, { -8, -4, 18, 1, 14, 5, -12, -3, 20, -17, 5, 19, -11, -8, 11, -3, 3, 9, -7, -8, 9, -17, 2, 15, -10, -11, 5, -5, 7, 15, -6, -2 }, { -7, 2, 38, 5, 19, 16, -5, 4, -13, -20, 0, 4, -4, 6, 4, 2, -7, 6, -8, -2, -5, -7, 6, 3, -4, -3, -2, -3, 7, -6, -4, 0 }, { -11, -12, 8, -15, -3, 14, -7, -22, -11, 2, 22, 14, -19, 2, -19, -6, 1, 3, -18, 14, 2, -6, -2, -8, -3, -6, 5, -7, -8, -4, 1, 1 }, { 8, 7, 25, -21, 12, -6, -5, -4, -10, 6, 0, 10, 1, -12, 18, -5, -15, 4, 1, 14, -1, 5, 8, -7, 1, -7, -3, 9, 10, 1, -1, 0 }, { 9, 10, 32, -15, 8, 2, 11, -7, -18, -8, 2, -6, -9, -16, -3, 3, -1, 3, 1, -5, 4, -2, 1, -8, 0, -6, -3, -11, 1, 5, 0, 0 }, { 14, 0, 23, -25, 22, 3, 7, 10, 0, -2, 7, 8, 0, 10, 0, 0, 3, 2, 3, -10, 0, 10, 0, -7, 0, 10, -1, -5, -7, 1, -1, 2 }, { 12, 0, 25, -18, -5, -4, 13, -10, 3, -6, 7, 21, 0, -16, 3, -10, -6, 5, -7, -3, 2, 5, 3, -6, 4, 9, -8, 12, -2, 3, 2, 4 }, { 31, 15, 27, -20, 10, -7, 15, -10, 9, -8, 4, -5, 3, -3, 5, 6, 11, -2, -12, -2, 6, -2, 1, 2, -1, -1, 1, 1, 3, 1, 1, 2 }, { 12, -4, 13, -23, 12, -6, 2, 4, -3, 13, 6, -7, 5, -19, -7, 18, 1, -7, 7, 1, 16, -7, 3, 0, 3, 0, -12, 8, -11, 9, 4, 7 }, { 29, 1, 3, -22, -5, 6, 0, 12, -14, 11, 1, 6, -3, 4, 6, -2, 4, -13, 12, 1, 1, 3, -11, 9, -10, -1, -7, 16, -11, -1, 3, 9 }, { 4, 4, 36, -23, -5, -8, -15, 1, -6, 3, 13, -1, -5, -7, 4, 9, 2, -11, -3, 5, 1, 3, -6, -1, -4, -4, -2, 2, 3, -1, -5, -2 }, { 19, 10, 6, -17, 2, -4, -2, -4, -3, 13, 2, 2, -13, -7, -3, -11, 9, -6, 1, -9, -5, 4, -5, -9, -18, -7, -11, 9, 4, -11, 8, 4 }, { 16, -3, 9, -16, 18, -2, -12, -16, -11, 11, -18, 16, -13, 6, 2, 8, 3, 8, -4, -16, 10, -11, -1, -3, -8, 5, -9, -4, 9, -4, 0, -3 }, { 14, 15, 3, -23, -5, 7, -8, -6, 2, 17, 2, 12, -8, -12, 13, -1, -9, 3, 1, 1, 19, 15, 4, -1, 1, 2, -3, 2, -3, 1, 5, 3 }, { 32, 5, -10, -47, -5, -1, 4, 11, -7, 0, 2, -2, 1, -7, 6, -4, 6, 2, -4, -2, 2, -2, 0, -4, 1, -6, -5, 2, -2, -1, -3, -4 }, { 20, 8, 10, -21, -7, -9, -16, 12, 1, 4, 6, -5, 9, -11, -7, 4, -11, 28, -3, 2, 4, -6, 10, -8, -5, -5, -9, 9, -2, -1, 6, -5 }, { 38, 3, 23, -25, -6, -18, 3, -10, -8, 6, -10, 1, -10, 2, 2, 0, -7, 2, -4, 5, -1, 8, -3, 0, 3, 3, -1, 1, 0, -4, -4, 0 }, { 20, 5, 16, -22, 24, -18, 2, -12, -14, -7, -3, 10, 2, 7, -10, 2, -8, 1, 8, -1, 4, 1, 4, -2, 5, -9, -18, -8, -13, 5, -11, 10 }, { 14, 8, -12, -16, 9, -11, -3, -6, -25, -7, 6, 5, -7, -16, 10, 2, -7, -1, -9, -3, 16, 4, 3, 3, -3, -3, -15, 13, -3, 4, 13, -7 }, { 16, -9, 19, -23, 7, -19, -3, -5, -15, 11, -21, 21, -16, 18, -1, 6, 10, -10, 18, -14, 16, -15, 6, -5, -9, 5, -17, 13, -10, 13, 0, 10 }, { 8, -4, 4, -24, 8, -21, -18, 9, -11, 4, -6, 17, 5, -9, -2, -2, 2, 15, -2, -3, -2, 1, 7, -13, 15, -10, -8, -11, 3, 3, -1, -1 }, { 14, 17, 6, -32, 5, -17, -2, 0, 15, -1, -5, 16, 1, -5, -2, 9, -3, 8, 4, -2, -2, -4, -3, 1, 0, 7, -3, 4, -5, 0, -7, 2 }, { 24, 6, 22, -12, 8, 3, -14, 4, -7, 8, 6, 5, 6, 1, 6, -12, 15, 10, 4, 11, 9, 6, -7, -4, 10, -9, 2, -1, -5, 11, 15, 3 }, { 17, 12, 3, -23, 5, -1, -2, 1, -9, -1, -3, 1, 8, 1, -5, 17, 11, 0, -2, -11, 7, 4, 0, -27, -7, 1, 2, -8, 9, 7, 5, 3 }, { 12, 10, 12, -10, -4, 5, -1, 2, -24, 5, -8, 2, 6, -17, 19, 5, 12, -2, 16, -7, -6, -14, 4, 1, -3, 13, -16, 5, -1, 4, 1, 1 }, { 31, 9, 11, -17, 10, -3, -7, 7, 1, 2, 2, 4, -3, -1, 11, 4, -5, -8, 1, 4, 15, -6, -28, 1, 8, 3, -6, 5, 17, -2, 2, -4 }, { 11, 19, 16, -26, 0, -7, -7, 2, -13, -15, -12, 9, -3, 27, 8, 4, -6, 1, 4, -6, 11, -1, -6, -7, -3, 0, -6, 4, -6, -7, -3, -1 }, { 10, 18, 16, -32, 19, -9, -4, -3, -7, 8, 8, -3, -11, -2, -6, -16, 13, 13, -6, -1, 10, -2, -2, -9, 0, -3, 9, 4, 11, -2, -6, 6 }, { 9, 4, 19, -33, 4, 7, -12, 36, -3, -1, 8, -2, 2, -8, -9, -4, -8, 0, 1, -1, 0, -4, -4, 3, 0, 3, 6, 0, -6, 2, 0, -2 }, { 25, 7, 15, -12, 2, -24, -1, 24, -4, 4, 9, 0, -2, -9, 4, 6, 3, 13, -3, 1, 5, -1, -3, -5, -1, 7, -2, 3, 4, 4, 1, 0 }, { 19, 6, 8, -20, 9, -9, 5, -4, -13, 7, 11, -3, 5, -13, -9, 6, -11, -1, 0, 4, 11, 26, 3, 6, -7, 12, 6, -3, 1, -9, 7, 1 }, { 15, 6, 19, -23, -3, -9, 3, 16, -6, -4, 6, -5, -10, 1, 16, -14, 2, 0, 2, -13, -3, 8, -6, 3, 1, 1, 2, -5, 12, -4, -8, -3 }, { 14, 4, 16, -20, 1, 12, 0, 6, -3, 9, 4, 16, 10, -16, 5, 7, 5, -4, -4, -18, -3, -11, -4, 4, -7, 3, 13, 7, 3, 3, 2, -7 }, { 22, 3, -1, -30, 18, -3, -9, 9, -2, 11, -16, -2, -14, 12, 0, 4, -5, 4, -1, 3, -20, 12, 4, -10, -2, -2, -12, -12, 10, 6, 11, -3 }, { 15, 7, 2, -21, 5, 4, 9, -9, -33, 7, 7, 3, -6, -14, -8, 10, 12, 0, 2, -1, 5, 4, -2, 0, -7, 0, 2, 4, 0, 1, -3, 8 }, { -7, 0, 12, 3, 0, -6, 8, -4, 0, 2, 14, -15, 2, -7, -31, -3, 14, 0, 14, -15, -1, -4, -15, 10, 1, -3, 1, 2, 5, 2, -8, 1 }, { -2, 5, 1, 0, -3, 3, 3, -6, -1, 2, -4, 1, -19, 0, -11, 18, 11, 10, 21, 5, 6, 2, 10, 3, -6, 0, -2, 13, 5, -1, -2, 9 }, { -9, 1, -5, 0, 0, -15, 8, 4, 8, 3, 8, 12, -13, -2, -39, -2, 4, -4, 5, -3, -4, 3, -3, 3, 10, 5, 3, 2, -3, 5, -2, 8 }, { -9, 6, 6, -8, 12, -12, 23, -18, 4, -15, -5, 2, -20, 13, -7, 7, 7, -12, 14, -12, 6, 1, 1, -3, -8, 9, 0, 1, -7, 3, 7, -6 }, { -18, 13, 4, 3, -10, -30, -10, -6, -14, 1, -7, -4, -35, 5, -25, 11, 9, 8, 19, -4, -7, -3, -18, -8, 1, 5, 10, -4, -14, -9, 3, -4 }, { -6, -1, 4, -9, -9, 4, 20, 0, 0, 3, 11, 7, -16, -17, -20, 11, -6, -14, 1, 4, 19, 2, -8, 6, -15, 3, 6, -5, -14, 3, 7, 2 }, { 1, 6, -2, -8, -5, -3, 3, -8, 21, 1, 3, 16, -14, -2, -9, -4, 13, -2, 18, 14, 14, 19, -13, 5, -10, 2, -3, 3, 5, 5, 1, -1 }, { -1, -5, -6, -2, -11, -7, 5, -4, 5, -1, 0, 3, -3, 2, -19, 18, 16, 4, 14, -22, -2, -11, -22, 1, -1, 11, 1, 2, 11, -10, 7, -12 }, { 1, 4, 5, -1, -9, -5, 1, 12, 5, 6, 12, 9, -24, 23, 1, 20, 14, -11, 13, 5, -2, -2, 5, 6, 2, 1, -9, 6, 10, 5, -4, 11 }, { -1, -1, 1, 7, -3, -4, 8, -16, 15, -1, -7, 9, -22, -11, -11, 10, 16, 9, -2, 4, 13, 10, 6, 16, 4, 7, 1, -8, -7, -14, -7, 4 }, { 1, 3, -6, 0, 15, -9, -4, 0, 4, 6, 12, 9, -6, -5, -22, 17, 7, -11, 15, -5, 1, 3, -19, 0, -15, -3, 16, 5, 5, -7, -11, 12 }, { -2, -1, 13, 2, 4, -24, 37, -5, -2, -6, 12, 7, -2, -23, -4, 9, 2, -3, 3, 2, 3, 3, -14, 11, 0, -4, -2, -2, 3, 10, -10, 4 }, { 2, 9, 8, -6, -28, 14, 28, -11, 18, -11, 0, 2, -2, 4, -12, 3, 6, 0, 7, -7, -6, 2, 5, -1, -1, -1, 5, 2, 3, 0, -3, 9 }, { -7, 14, 5, -10, -3, 7, 4, -5, 7, -8, -7, 4, -12, 14, -16, 25, 3, 0, 1, -5, 12, -10, 0, -10, 0, 12, 12, 17, 12, 10, -1, 0 }, { -4, -2, 5, -2, -17, -3, 5, -5, 7, -17, 1, 5, -4, 4, -20, 0, 11, -15, 13, -8, 10, 1, 1, 5, -12, 9, -8, 0, 6, -1, -11, 4 }, { -3, 12, 13, -15, -7, -7, 0, 5, 33, 3, 3, -6, -13, -7, -15, 10, 3, 3, 3, -5, 2, 7, -1, 0, -12, 2, 11, -6, -9, 0, 5, 11 }, { -8, 5, 10, -7, -14, -4, 13, 0, 18, -3, -6, 7, 1, -6, 0, 21, 8, -7, 10, -8, -3, 17, -9, 0, -5, 1, 4, 8, -3, 11, -5, 0 }, { -8, 8, -3, -8, 8, -11, 16, -16, 17, 0, 8, 16, -17, 10, -16, 10, -8, 6, 11, 0, 10, 7, 4, 5, 7, -5, -5, -6, -7, -5, -1, 16 }, { -6, 0, 6, 1, -8, -8, 8, -7, -5, -10, -11, 8, -19, 6, -7, 13, 5, -3, 4, -8, 7, -1, -18, 9, 0, -5, 6, 26, 3, 8, 2, 4 }, { -2, -2, 23, -2, -20, 2, 7, -7, -6, -15, 3, 9, -19, -2, -10, 7, -2, 7, 9, 11, 0, 4, -4, 6, 9, -2, 4, -3, 4, 3, 2, 8 }, { -6, 12, 10, -10, -7, 4, 17, 11, -6, 1, 12, 11, -18, 8, -12, 4, 1, 13, 6, -13, 23, 9, -5, 8, -2, -5, 1, 3, 0, -2, -4, 4 }, { 7, 1, 7, -17, -8, 8, -1, -7, 5, -6, 4, -3, -16, 9, -24, 18, -3, 10, 13, -11, -6, -11, -4, 10, 0, 11, 8, 2, 6, -5, -11, 4 }, { -4, 1, -5, -10, 0, -3, 9, -2, 4, -1, 1, 5, -41, -10, -7, 4, -3, 3, 1, 0, -12, 4, -3, 0, 2, -1, -2, -5, 3, 2, -7, 5 }, { -2, 1, 4, 4, -3, -6, 1, 0, 12, -5, 11, 0, -17, -3, -1, 11, 4, 1, 27, -12, 0, -14, 2, -15, -3, -9, 0, -7, -3, 15, -8, 6 }, { -6, 4, 9, 2, 4, 3, 7, -10, 28, 1, -2, 48, 7, 0, -10, 10, 1, -9, 2, -1, 0, 3, -5, 5, -4, -2, 7, 7, 1, 3, 2, 5 }, { -3, 3, -1, 3, -9, 0, -1, 3, 2, -6, 39, -14, -12, 5, -19, 21, 7, -6, 4, -1, -4, 0, -4, 1, 0, -9, 1, 10, 0, -2, 0, 7 }, { 4, 2, -29, 12, 5, -3, 16, -6, 15, -13, -4, -1, -13, 22, -16, 17, 16, 4, 9, -4, 4, -6, -4, 11, -8, 7, 8, 4, 3, -3, -7, -13 }, { 0, 3, 3, -6, -4, 0, 9, 0, 5, 0, 10, 10, 4, -13, -12, 16, 23, -4, -12, -6, -4, 20, 2, 0, -4, 23, 1, 8, 11, -4, -5, 15 }, { -6, 4, -15, -9, -1, -19, 12, -30, -17, -4, 1, -13, -13, 4, -3, 26, 5, -25, 11, -14, -6, -13, 0, -7, 9, 2, 8, -1, -8, 1, -8, 13 }, { 1, 6, 1, -4, -4, 1, 2, 0, -3, 2, 10, 6, -6, -2, -11, 4, 32, 15, 15, -47, -8, 3, -12, 4, -5, 4, -1, 0, -5, 5, 1, -7 }, { 2, -1, 0, 0, -1, -6, 0, -6, 4, -4, 5, 9, -5, 1, -3, 51, 4, -5, 4, -14, -1, -4, -3, 1, -4, -1, 0, 2, -8, 0, 1, 2 }, { 0, 4, -2, -7, -2, -9, 6, -8, 11, -3, -6, 3, -11, -8, -12, 8, 11, 5, 19, 3, -24, 19, -14, 11, -5, -18, -8, -12, -5, -4, -1, 4 }, { 16, 9, 10, 14, -18, -2, -18, -27, 10, -5, 12, 14, 4, 0, -2, -6, -12, -7, -1, 3, 4, 7, 11, 10, 5, -5, -7, -16, -3, -6, 6, 9 }, { 7, 15, -9, 10, -19, 4, -5, -37, -2, -4, 8, 2, 4, -1, 1, 9, -5, -5, -12, 1, -1, -8, 3, -3, 4, 6, 9, 3, 3, -1, 2, 4 }, { 13, 17, 3, 9, -7, -7, -15, -17, -8, -13, -4, -8, 19, 2, 16, 25, 7, 15, 2, 16, -5, -6, -10, -9, -7, -6, -2, -7, 7, 2, 4, 5 }, { 24, 7, 9, 8, -13, -2, 0, -4, 1, -13, 3, 6, 7, 10, -4, 15, 5, 7, -4, 5, -5, 3, 13, -7, 5, 15, -11, -2, 7, 5, 8, 6 }, { 17, 6, -15, 23, -2, -1, -6, -2, 0, -4, 11, -3, 12, 15, 6, -8, -15, 10, -9, 7, -1, -11, 2, -8, -4, 3, 4, -10, 4, 4, 11, 1 }, { 21, 12, -3, 6, -8, 8, -11, -8, -5, -5, 3, 7, -1, -5, 12, 15, -10, -11, 3, 15, 8, 4, 2, -15, 0, 14, 1, -8, -1, 3, 10, -7 }, { 16, 12, 5, 13, -6, 15, -23, 0, -17, -9, 0, 4, -9, 13, 6, 18, 0, 0, -4, -1, 0, 14, 5, -1, 8, -4, -8, -6, 5, -2, -2, 0 }, { 14, 16, -1, 12, -15, -9, -6, -20, 4, 6, 8, 9, 3, 1, -9, -4, -1, -11, 9, 11, -12, 1, -14, -7, 2, -8, 11, 9, -4, 10, 4, -16 }, { 13, 10, 3, 7, 0, -8, -33, -6, 4, -4, 19, -2, 14, 6, 5, 7, 6, -3, -1, -10, -10, -9, 4, -3, 5, 9, 2, 2, 10, 9, -2, -3 }, { 11, 10, 25, 18, -1, -6, -21, -21, -11, -16, 6, 5, 14, 4, 8, 7, 0, -10, -7, -9, -5, -4, 3, -1, 1, 6, -1, 6, -2, 2, -3, -9 }, { 15, 9, 5, 22, -17, 15, -9, 7, 7, -9, 13, 9, 10, -1, 8, -3, -2, 6, 1, 17, 8, -14, 7, -3, 12, 9, 1, 0, 1, -5, 17, -18 }, { 25, 19, -17, 12, -4, -10, 1, -13, -19, -7, -3, 9, 6, -2, 3, 1, 4, -2, -11, -14, -1, -7, -5, -9, 7, -1, -3, 4, -5, 1, 0, -1 }, { 20, 8, -3, -10, -24, 3, -6, -2, 0, -12, 14, 6, 7, 11, 4, 7, -12, -5, -8, -10, 5, -1, -4, 4, 16, 7, -14, 6, -1, -2, -7, -11 }, { 16, 18, 17, 1, -15, -6, -5, -3, -1, -19, 8, -2, 2, 8, 12, -19, -12, 8, 0, -3, -1, -1, 4, -14, 9, -1, -12, -1, -7, 10, -3, 5 }, { 18, 12, -7, 7, 0, -3, -13, 0, -1, -4, 9, -2, 6, -1, 0, 1, 15, -21, 1, -8, 25, -19, 13, -9, 2, 12, 5, -7, -3, -1, -3, 1 }, { 13, 16, -4, 9, -2, 2, -1, -19, -7, -4, 18, -6, 14, 18, -5, 4, -6, -3, -19, -14, -1, -12, 10, 6, 7, 17, -12, -13, -10, -4, 5, 4 }, { 27, 17, 4, 14, -9, -2, -4, -8, 0, -6, 14, -11, -7, 2, -3, -3, -2, -3, -13, 12, 16, 1, -5, -9, -10, -11, -2, 3, -7, 5, 11, -7 }, { 7, 17, -16, -2, -14, -28, -7, -8, 15, -10, 7, 15, 8, 17, 13, -1, 4, -7, -12, -11, 0, 0, 2, 3, -3, 7, -6, 6, 1, -16, 1, -2 }, { 23, 11, -9, 15, -23, -4, -6, -4, 2, -9, -7, 9, -8, 3, -13, -4, 8, 18, -6, -2, 1, -5, 6, -14, -5, -2, -6, -5, -3, -2, 4, -5 }, { 12, 13, 18, 18, -35, 2, 7, -17, 3, -11, 6, 9, -3, -2, 10, -4, 3, 3, -2, -7, 0, 2, -4, 0, -4, 0, -6, 5, 10, 4, -3, -1 }, { 19, 11, 1, 20, -14, 4, -9, -13, -2, 11, 0, 17, -1, -1, -1, -1, -5, -8, 0, 5, -1, -8, 5, -1, 3, 2, -12, 21, -2, -24, 5, 7 }, { 15, 15, -15, 17, -14, -22, 3, -4, -11, -3, -7, 1, 18, 10, 1, 10, -6, -3, 8, 2, -7, 0, -2, 1, 1, 2, -9, -2, 1, 2, -3, 4 }, { 45, 13, 8, 17, -5, 2, -16, 2, 8, -2, 8, -15, 4, 5, -1, 7, -6, -2, -6, 2, -3, 0, 0, -9, -1, 7, 2, 3, -3, -3, -1, 5 }, { 1, 18, -8, 18, -12, -10, 3, 4, -22, -12, 20, 8, -3, 9, 2, 10, -10, -3, 9, 3, 6, -3, 10, -1, -3, 2, -2, 4, 2, 3, -3, -18 }, { 9, 10, -5, 9, -35, -21, -18, -16, -1, -12, -6, -7, -15, -19, 12, 4, 4, 9, -7, 2, 14, 1, 4, 0, -1, 6, -7, 2, 1, 1, -4, 4 }, { 31, 8, -17, 35, -8, 1, -5, -6, -7, -6, 10, -2, -3, 6, 9, 3, -6, -2, 3, 3, 5, -3, 0, 6, 0, 1, -5, -3, -2, -4, -1, 0 }, { 18, 4, -8, 7, -8, -15, -1, -16, 12, 18, 3, 19, 2, 4, 8, 8, 0, -5, -8, -12, 10, -5, 0, 1, 0, 4, -3, 16, 11, 11, -2, -6 }, { 27, 15, -17, -10, -23, -22, -1, -14, -4, -7, 20, -2, -7, 6, 15, -5, 32, 4, 9, -11, -3, -8, 11, -4, -1, -4, -8, -6, -4, -5, -2, -7 }, { 22, 4, -7, 2, -15, -11, -17, -10, 2, 0, 15, 11, 7, 12, -8, 6, -10, -18, -6, -12, 7, 3, 22, 3, -7, 14, -5, -2, -13, -7, -1, -7 }, { 18, 13, 9, 24, -4, -19, -9, -11, 13, 8, 2, 4, -1, 8, 14, 10, -12, 0, 0, 5, 10, 5, 4, -1, 5, 1, -1, 11, 2, -4, 0, -9 }, { 15, 19, -5, 1, -4, -10, -8, -27, 6, 8, 5, 10, 4, 11, 5, -5, -11, 0, -11, -14, -4, -9, -8, -8, 6, -9, 4, -5, -1, 1, 5, -4 }, { 18, 1, -13, 14, -14, 9, -15, -7, 12, 1, 13, -4, -20, 12, 10, 12, -12, 7, 1, -13, 10, -6, 5, -3, 4, 8, 10, -13, -3, -6, 9, -3 }, { 19, -14, 5, -8, -6, 2, -5, 5, -3, -1, -28, 11, 18, -6, -4, -2, 11, 14, -43, -42, 9, 2, 20, -23, 6, 32, 0, 5, 0, 6, 9, 5 }, { 8, 11, -14, -1, 7, 12, -7, 2, -16, 2, 10, -3, -1, -7, -7, -1, 1, -10, -60, -23, -18, 42, -13, 9, 18, -11, 0, 1, 0, 2, -5, 1 }, { -5, -1, 2, 0, 3, -3, 3, -2, -6, 0, -3, -3, 7, 2, 0, -2, -2, 3, -34, -15, 37, 47, 10, 20, 9, 1, 3, -21, -25, -33, -14, 8 }, { 5, 6, 2, -2, -2, -2, 6, 5, -5, 7, -3, 1, -5, -13, 9, 3, -17, -19, -2, -79, -12, -7, -8, -6, -2, -2, -1, -1, -7, -13, 6, -1 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 3, 4, -87, 6, -11, 16, -9, -1, 8, 0, 5, 0, 1, 2, 1 }, { -5, 6, 2, -24, 5, -9, -7, 0, 7, 3, -3, 16, -14, -16, 0, 18, 15, -9, -14, -28, -17, 53, 14, -6, -28, -1, -3, -10, -7, -14, 19, -15 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3, 0, -13, 0, -53, 3, -22, 63, 19, 16, 1, -11, 0, -3, 0, -3, 0, 1 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -6, -43, -43, -2, 65, -13, -4, 9, 1, 1, 2, 1, 0, 0, 1 }, { 0, 1, 0, 0, -1, 0, 1, 1, 0, 0, 1, 2, -1, -1, -3, -1, -23, 1, -61, -55, 3, -28, -6, -4, -4, 8, 2, 1, 1, -1, 0, 0 }, { 0, 1, -1, 1, -1, 0, -1, 0, 1, -1, 0, 1, -1, 0, -9, -4, -48, -19, -52, -46, 11, -12, 5, -14, 0, -10, 0, 0, -1, -2, -1, 0 }, { 0, -3, -1, -4, 2, -1, -7, 3, 1, 3, -1, 1, -3, 0, -7, 0, 3, -7, -61, -51, -4, -21, -16, -21, -11, 14, -7, 8, 3, -5, 1, 2 }, { 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, -1, 9, -3, 56, -11, -6, -67, -1, 13, 0, 7, 1, -9, -1, -1, 0, 0, 1, 0 }, { 14, 9, -2, 14, -10, -10, 9, -5, 1, -8, -23, 30, 8, -7, 23, 8, 2, 10, -1, -27, -17, 57, 22, 4, -5, 2, -12, -6, 2, -7, -4, -9 }, { 1, 5, 12, -2, -2, -3, 2, -3, 6, 0, 4, -2, -8, -6, 0, 16, -15, 29, -55, -29, -24, 29, 3, 10, 6, 13, 10, -5, 21, 11, -14, 5 }, { 4, 2, 26, -6, 10, 11, -23, -10, -27, -20, 3, -24, -11, -10, -13, 25, -10, 5, -9, -36, -7, 43, 3, -13, 6, 13, -2, 0, 1, 3, -3, -4 }, { -1, 0, -1, 0, 0, 0, 0, -1, 1, 0, -1, 0, 0, 0, -1, 1, -12, 12, -26, -64, -15, 29, 37, -7, -3, -12, -5, 14, 8, -8, -10, -2 }, { 19, -4, -11, -16, 8, 14, 5, 19, 3, 22, -11, -21, -1, -6, -11, 11, 10, -24, -23, -40, -8, 20, 17, 5, 13, -6, 3, 14, -20, -8, 3, 28 }, { 2, -12, 10, -14, -18, 26, -22, 4, -2, 5, -21, 8, 3, 1, 19, 0, -12, 24, -14, -40, 15, 29, -15, 6, 15, 1, -19, 2, 4, 7, -12, -3 }, { 0, 17, 13, 7, -5, -11, 2, -19, 3, 38, -21, -3, -6, -4, 7, 1, 1, -5, -40, -10, -2, 35, 8, 8, -10, -8, -9, 33, 4, 4, 0, -2 }, { -2, -12, 7, 29, -24, 2, 16, -1, -7, 16, 10, -2, -2, -2, 13, -2, -37, 15, -22, -40, -11, 33, 10, -1, 8, 10, 6, 8, 9, 0, -12, 2 }, { 15, -8, -9, -2, 7, -17, 7, 19, 14, 4, 12, 27, 11, 10, 4, 11, -15, 14, -13, -48, 5, 18, 0, -9, -36, -11, 2, 4, 5, 5, -15, -12 }, { -12, 0, 3, 4, 7, -5, 5, -14, -24, -18, -6, -15, -8, -20, 1, -7, -33, -28, -40, -38, -18, -10, -5, 17, -12, 4, 3, -5, 5, -13, 4, -7 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 3, -2, 9, -29, -11, 55, 8, 32, -36, -13, -7, 37, 4, 11, 0, 3 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, -1, -39, -4, -30, 63, 28, -17, -6, 10, 7, -14, -9, 11, 9, 7 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 13, -2, -50, -32, 22, 51, 4, 7, 6, 11, -20, -13, 9, -5, 21, -4 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -3, -9, -49, -60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 3, -2, 9, -29, -11, 55, 8, 32, -36, -13, -7, 37, 4, 11, 0, 3 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, -1, -39, -4, -30, 63, 28, -17, -6, 10, 7, -14, -9, 11, 9, 7 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 13, -2, -50, -32, 22, 51, 4, 7, 6, 11, -20, -13, 9, -5, 21, -4 }, { -8, 2, 1, 22, -31, -6, -25, -3, -3, 1, -15, -11, -2, -3, 4, -13, -9, 15, -18, 37, -7, -37, 12, -13, -11, -25, -10, -11, -22, 7, 16, 7 }, { 14, 10, 4, -10, -1, -5, -7, -3, 16, 13, -5, -15, 5, 11, -1, 8, -27, 7, -12, 49, 17, -22, 9, -2, -9, -1, 2, -15, -1, 41, -18, -17 }, { -4, -9, -15, -3, 3, 4, 4, 2, 7, -3, -7, -8, -5, 17, -19, -7, 36, -9, -38, 17, 1, -48, 11, -18, -13, -2, -8, 4, -10, -5, 21, 11 }, { 15, -13, 4, 2, 1, -5, -2, 1, -10, 7, -1, 3, -6, 0, 11, -11, 8, 20, -17, 51, -17, -41, 2, 15, 4, 8, -2, 16, -32, -1, 17, 6 }, { -8, 8, -18, -5, 4, 6, -3, 8, 0, -4, 2, 0, -1, -4, 5, 8, 30, 30, -8, 70, 2, 8, 2, 0, 7, 1, 13, -1, -6, -7, -11, 2 }, { -8, -7, 9, -10, -13, 6, -11, -14, 13, 25, -26, 5, 2, -5, -5, 5, -8, 4, 0, 33, 12, -38, -4, 6, 13, 6, 25, 34, -1, 25, -19, -5 }, { 18, 3, -17, 4, -8, 7, 20, 1, -1, 5, -5, -2, -8, 8, -35, 15, 24, 43, -5, 51, 5, -12, -3, 1, -2, 3, -3, -3, -9, 8, -9, 2 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 10, 24, 76, -2, -22, 11, -1, 4, 33, 4, 1, -1, 1, 2, 0 }, { 0, -1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 2, 0, 24, 13, 32, 70, 26, 5, -21, -9, -6, -15, 2, -2, 2, 4, 1, 1 }, { 5, -4, -11, 4, -4, 22, 10, -2, 13, -11, -4, -21, -17, 0, -7, 4, 10, -34, 11, 52, 2, -46, -5, 0, 0, -1, 2, 4, -9, 1, 1, -7 }, { 0, 1, 1, 0, -1, 0, 1, 0, 1, 1, 0, 1, 0, 0, -3, 1, -8, 9, -1, 64, -13, -61, -3, 3, -5, 10, 1, 3, -1, -1, -1, -1 }, { 0, 1, 0, -1, 0, -1, 0, 0, 1, 0, 0, 0, 1, 1, 2, 1, 10, -2, -31, 79, -10, 27, 0, -1, 3, 8, 1, 1, 0, -1, 0, -1 }, { 3, 12, 10, 26, -19, 10, -9, 6, -4, -15, 10, 3, -16, 6, 11, -19, 3, 10, 18, 44, 5, -30, 5, -9, 21, 4, 20, 10, 14, -25, 8, -17 }, { 0, 0, 0, 1, -1, 0, -1, 0, 1, 0, 1, 1, 0, 0, -6, -2, 8, -8, 13, 69, 26, -19, -25, -17, 16, 6, -12, 22, 2, -6, 9, 5 }, { 0, -1, 0, 1, 0, -1, -1, 0, 0, 1, -2, 1, 0, 0, -4, -1, -34, -15, -33, 56, 9, -42, 9, 10, 6, 9, -8, -11, 0, -6, 15, 5 }, { 10, 2, -14, -3, -15, -35, -1, 7, -18, 14, 8, -1, -15, -26, 6, -15, -18, 22, 9, 33, 0, -32, -9, 3, -11, 7, 4, -1, 5, 30, 9, 1 }, { 4, 15, 0, 6, -5, -11, 9, 6, 6, 6, 14, 2, -1, 10, -24, -25, -2, -4, -1, 37, 2, -29, 14, -9, 22, 17, -2, 33, 10, -25, 11, -11 }, { 0, 5, 2, 18, -12, 21, 22, 33, -7, 21, -9, -7, 7, -15, -7, 16, 7, 0, -14, 44, 10, -25, 5, -4, 15, -8, 10, -4, 5, 9, -1, 16 }, { 3, 13, 12, 12, 8, 25, -23, 8, -22, -3, -18, -8, 15, 12, 9, 19, 0, 0, -9, 49, -27, -15, -9, -15, 12, -8, -16, -7, 13, 5, 13, 2 }, { 12, -6, 7, -2, 20, -9, -14, 12, 13, -5, -17, 22, -8, -4, 2, 7, -13, -2, -15, 43, -5, -30, 27, 4, 10, -27, 5, 27, -10, -10, -18, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 }, { 15, -13, -20, 16, 2, 13, 5, -11, -8, -5, -3, 2, 24, -23, 30, -7, 11, 30, -15, 43, 5, -15, 15, -3, -14, 1, -23, 8, 3, 9, 4, -11 }, { 0, -1, 0, 1, 0, -1, -1, 0, 0, 1, -2, 1, 0, 0, -4, -1, -34, -15, -33, 56, 9, -42, 9, 10, 6, 9, -8, -11, 0, -6, 15, 5 }, { 10, 2, -14, -3, -15, -35, -1, 7, -18, 14, 8, -1, -15, -26, 6, -15, -18, 22, 9, 33, 0, -32, -9, 3, -11, 7, 4, -1, 5, 30, 9, 1 }, { 4, 15, 0, 6, -5, -11, 9, 6, 6, 6, 14, 2, -1, 10, -24, -25, -2, -4, -1, 37, 2, -29, 14, -9, 22, 17, -2, 33, 10, -25, 11, -11 }, { 0, 5, 2, 18, -12, 21, 22, 33, -7, 21, -9, -7, 7, -15, -7, 16, 7, 0, -14, 44, 10, -25, 5, -4, 15, -8, 10, -4, 5, 9, -1, 16 }, { 3, 13, 12, 12, 8, 25, -23, 8, -22, -3, -18, -8, 15, 12, 9, 19, 0, 0, -9, 49, -27, -15, -9, -15, 12, -8, -16, -7, 13, 5, 13, 2 }, { 12, -6, 7, -2, 20, -9, -14, 12, 13, -5, -17, 22, -8, -4, 2, 7, -13, -2, -15, 43, -5, -30, 27, 4, 10, -27, 5, 27, -10, -10, -18, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 10, -18, 70, -2, -52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 }, { 15, -13, -20, 16, 2, 13, 5, -11, -8, -5, -3, 2, 24, -23, 30, -7, 11, 30, -15, 43, 5, -15, 15, -3, -14, 1, -23, 8, 3, 9, 4, -11 }, { 16, -18, 7, -4, 31, -15, -9, -13, 20, -12, -6, 0, 12, -6, -2, 4, 3, -3, -1, 0, 1, 3, 3, -2, 1, 6, 4, 0, -3, 2, -5, 1 }, { 38, -5, -13, -4, 8, -15, 11, 1, 2, -4, -1, 9, 13, 4, -12, -7, 0, -2, 7, 2, -6, -2, -3, -2, 3, -4, 6, 15, 1, 1, -11, -2 }, { 47, -22, 9, -26, 3, -5, 2, -7, 4, -2, 2, -2, 3, 0, 3, -4, 3, -3, 2, -3, 7, -3, -1, 1, 1, -5, 5, 0, 2, -5, -3, -2 }, { 14, -16, 2, -6, 7, -2, -7, -4, -4, -7, 14, -3, 7, -19, -14, -17, -29, 6, 26, 16, -5, 13, -4, -1, 21, 14, 1, 3, -6, 0, -7, -1 }, { 29, -11, 5, -3, 4, 11, 4, -10, 1, -22, -3, -10, 5, 4, 2, 8, -2, -7, -12, -12, -8, -3, -18, -2, -9, -5, -1, -3, 2, -14, -14, 7 }, { 28, -12, 5, 3, 9, -7, 0, -2, 2, 1, 4, 0, -7, -3, -2, 4, 4, 14, 8, -1, -4, 14, -7, 17, -2, -2, -9, 2, 19, -7, 9, -8 }, { 31, -18, -22, 8, 15, -5, -10, -15, 1, 10, 6, 7, 6, -8, 2, -1, 12, -3, 3, -1, 1, 5, -6, -4, 0, 1, 7, -10, -2, 4, -3, -4 }, { 53, -30, -4, 12, 2, 3, -3, -3, 0, 1, 6, 5, -5, -4, -7, 1, 0, 2, 1, 3, 1, 5, 0, 2, 2, -1, 0, 4, 2, 0, -2, 0 }, { 27, -18, -3, -2, 4, -8, 3, -2, -11, 2, 10, -8, -8, -4, 0, -2, 8, 0, 9, 0, -16, 11, 1, -6, 13, -3, -10, -13, -15, 25, 1, 0 }, { 35, -5, -1, -8, 23, 11, -14, -3, 2, -2, 8, -6, 17, -2, 7, 0, -2, 10, -17, 13, -2, -2, 11, 11, -14, 2, -2, -3, -8, -1, -12, -5 }, { 29, -9, 7, 3, 2, -10, 0, 3, 9, 0, -3, 5, 1, -10, 10, -5, 3, 6, -20, -9, -6, -4, 1, 0, 12, 17, -8, 9, 3, -1, -9, 0 }, { 15, -16, 18, -19, 16, -15, 17, -18, 13, -16, 17, -14, 15, -9, 13, -17, 9, -7, 4, -5, 3, -4, -3, 0, -6, 7, -9, 7, -2, 7, -9, 9 }, { 21, -10, 7, -2, 12, -7, 13, -17, 11, -2, 20, 3, 5, -11, -6, -6, -15, 0, -9, 5, -11, 7, -1, 7, 8, -10, -9, 3, -5, 9, -8, -2 }, { 23, -22, 15, -5, 16, -4, -3, -12, 9, 3, -1, -2, -8, 2, -2, -16, 3, 4, -2, -6, -7, 12, -8, 2, -14, 2, -7, 11, -2, 6, -4, -1 }, { 34, -17, -4, 8, 4, -6, 1, 8, 4, 16, 3, 6, 12, -1, -1, -15, 6, 4, -7, -6, 6, 0, 2, 1, -2, 2, 3, 3, -3, -2, 8, -6 }, { 18, -18, 2, -2, 10, 1, 18, -23, -3, -10, 0, 4, 20, -19, -3, -4, 2, 8, 6, 1, -3, 1, 1, 3, 5, -1, -11, 3, -7, 5, -1, 1 }, { 15, -14, 2, 3, 10, -8, 12, -13, 13, -15, 6, -8, -4, -10, 14, -9, 24, 2, -7, -18, 13, -11, 8, 14, -6, -2, 3, -1, -4, 7, -7, -4 }, { 20, -12, 13, 5, -1, -10, 15, -6, 8, -1, -3, -10, 17, 0, -6, -19, 2, -1, 8, -3, -16, 0, -3, 2, -2, 0, 8, -9, 0, 1, -10, -9 }, { 32, 0, -9, -5, -1, 5, 13, -11, 8, 3, 11, -11, 0, -8, -2, -14, 7, 10, 6, -5, 1, 10, 2, 12, -10, 4, 4, 6, 4, 0, -7, -10 }, { 16, -14, 10, -7, 11, -11, 11, -11, 18, -13, 8, -15, 16, -11, 13, -9, 8, -7, 12, -11, 7, -6, 3, -5, 9, -5, 4, -1, 7, -4, 8, -3 }, { 24, -27, -1, 5, 8, -5, 12, 7, 4, -3, 3, -1, -9, -11, -13, -5, 10, 0, -13, 7, 1, -5, 4, -9, 7, -3, 13, 2, -5, -3, -17, -2 }, { 23, -19, 15, 1, -10, -18, -12, -6, 8, -3, 12, 0, -12, -10, -4, -4, 8, -10, 4, 2, -2, -8, 13, -3, -2, -6, 2, -3, 5, -2, 2, 11 }, { 25, -12, 4, 2, 24, -3, 3, -6, 14, 11, 0, -21, -3, -3, 1, -8, 7, 0, 0, 3, 3, -6, -7, 6, 2, 1, -4, 5, -1, 10, -2, 9 }, { 24, -8, -6, 7, 16, -12, 13, -1, 11, -21, 2, -6, 3, -12, 0, 9, 4, 11, -7, 1, 4, 1, -8, 3, 3, -6, 3, 3, 0, -8, 8, 4 }, { 25, -21, 13, 14, 13, -18, 4, -3, 0, -5, -4, 5, -3, 0, 4, 12, 7, 3, 5, -5, 2, -2, 3, -10, 2, -9, -15, 6, 1, 7, -5, 1 }, { 23, -16, -2, 10, 4, -1, 3, 1, 32, 3, -5, -2, 9, 10, -1, -4, -6, 2, 9, -1, 14, 12, -6, -1, -17, -2, -4, -9, -7, -6, -8, 3 }, { 50, -8, 5, 2, -11, 10, 0, 0, 6, -3, 7, 0, -3, -2, -3, 0, 6, -4, 2, -5, -9, 0, 3, 10, 1, -7, -2, -3, -6, -9, 1, -2 }, { 28, -17, 0, -2, 2, -9, 1, 5, -4, -1, 0, 0, 19, -27, 5, -12, 7, -14, -3, -6, 10, -2, -4, -2, 4, -5, -2, -7, 1, 7, -9, 4 }, { 22, -19, -6, -6, 3, -22, 3, 5, 20, -8, -14, -5, 1, 1, 20, 2, 16, 6, 3, 14, 4, 3, 5, 1, 5, -7, -10, -6, 3, -6, 1, -14 }, { 29, -14, -8, 13, 8, -10, -6, 4, 4, -6, 5, -7, 1, 12, 14, 11, -7, 1, 2, -9, -11, -9, 0, 4, -1, 7, 10, 4, 4, 20, -1, -11 }, { 18, -9, 4, 1, 7, -29, 12, 1, -1, -9, -2, -1, -2, 2, 9, -8, -13, 5, 4, -13, -4, 2, -5, -7, -6, 14, -10, -34, -3, 1, -3, -13 }, { 38, -9, 24, 8, 11, 4, -6, -11, -2, -12, 1, 1, -11, -8, -5, -2, -15, -8, 8, 0, 1, -7, 5, 4, -1, 8, -2, 11, -3, -1, -5, -5 }, { -20, 11, -4, 24, -11, 1, 15, 4, 0, -28, -10, -1, 10, 10, -6, 5, -6, 2, 7, -2, 1, -2, -6, -3, -7, 1, 2, 12, -1, 7, 0, -2 }, { -9, 10, -23, 27, -4, -17, 20, -6, 14, -17, 5, -1, 5, -9, -7, 5, -6, 4, -2, 9, 0, 8, 0, 1, -3, -3, -5, -8, 5, -2, -2, 12 }, { -10, 19, 4, 9, 1, -16, 17, -2, 9, -29, -16, -11, -4, 7, -5, 4, -1, -3, 3, 2, 3, -4, 5, -12, -2, 6, 5, -4, 4, 1, 4, 10 }, { -20, 10, -24, 14, -5, 11, 9, 0, 16, -20, 10, -5, -6, -6, -1, 2, -4, 5, -16, 8, -2, 5, 5, -11, 9, -11, 4, -11, -1, -1, 4, 3 }, { -9, 11, 3, 19, 24, 4, 5, -14, 30, -17, -4, -2, -17, 7, 2, 3, 1, 3, -7, -4, 2, -3, 1, 4, -1, -1, 3, -12, -2, 3, -3, 10 }, { -19, 18, 11, 19, 19, 19, 10, 4, 13, 6, 5, 4, 8, 3, -2, 12, -6, -2, 7, -6, 15, 12, 16, 16, 18, -3, -4, -20, 0, 10, -9, -3 }, { -21, 9, 20, 12, 0, -3, 5, -9, 15, -13, 5, -5, -6, 24, 2, 9, -5, 2, -7, 2, 5, 7, -5, 2, 15, 3, 1, -1, -4, -2, 7, 0 }, { -18, 16, 13, 15, 2, -10, 14, -11, 4, -11, 5, 12, 12, 20, 8, 30, 2, 11, -9, 7, 0, -3, -16, -5, -6, 5, -4, -21, 0, 5, 6, 1 }, { -26, 8, -13, 9, 6, -10, 2, -11, 7, -4, 6, -19, -11, -6, -12, 16, 0, 5, -7, 8, 5, 6, 17, -9, 10, -10, 5, -3, -11, 2, 4, 10 }, { -11, 17, -3, 22, -5, 18, 3, 1, 4, -5, 14, -27, 5, -7, -4, -5, -10, 11, 1, 15, 1, 1, -6, -5, 10, -22, -7, -7, -15, 13, -4, 5 }, { -17, 14, -7, 13, 3, 0, 13, -6, 9, -14, -22, -1, 1, 19, 14, -3, 4, -13, -13, 2, -4, 8, -2, -2, 13, -12, 13, -12, -7, -5, -3, 6 }, { -17, 17, -1, 33, 6, 3, 9, -16, 3, -14, -8, 6, -17, 8, 3, 13, 8, -6, 3, 1, -2, 0, -2, 8, 4, 9, 13, -10, 4, -17, 0, -6 }, { -20, 7, 7, 21, 1, -3, 7, -3, -2, -12, 9, -7, 2, -3, 14, 1, -1, -7, 12, -10, 5, -20, 11, -2, 0, -24, -17, 6, 6, -4, 3, -1 }, { -8, 10, 6, 7, -1, -6, 28, -6, 10, -33, 1, -20, 0, -12, 10, 1, -6, 8, -3, -1, -10, 8, 5, 0, 10, -2, 8, 16, -5, -3, -7, 4 }, { -17, 13, 3, 15, 1, -5, 27, -5, 6, -6, 12, 2, -4, 8, -1, -3, -2, 12, -15, 3, 4, 1, 2, -9, 0, -16, -21, 2, -4, 16, -7, 4 }, { -15, 20, 8, 17, 5, -14, 15, -11, 21, -11, 13, -13, 2, -15, -13, 1, -5, 5, 2, 10, -9, 4, -1, 3, 2, -4, 13, -5, 1, -4, 5, -3 }, { -21, 8, 2, 16, -1, 2, 15, -16, 13, -12, -12, -7, -8, 2, -7, 11, -8, 5, 2, -7, 16, -4, 1, -7, 3, -15, 6, -5, -8, 2, -8, 5 }, { -15, 17, -6, 3, -3, 3, 9, -7, 14, -23, 11, 1, -1, 4, 7, 6, -1, -14, 7, 6, -8, 5, 1, -15, 10, -9, 2, -3, -1, 4, -10, -4 }, { -10, 18, 3, 11, 1, 4, 14, -14, 7, -4, 15, -10, 10, -11, 10, -4, 5, -14, 10, 4, 15, -12, 15, -13, 20, -15, 14, -15, 8, -11, 4, -6 }, { -7, 23, 2, 20, 7, 8, 19, -5, 9, -16, -8, -17, -5, 1, 5, -6, -8, 1, -6, -4, 10, 6, 6, 2, -11, -4, 0, 2, 4, 7, 9, -4 }, { -15, 20, -5, 22, 11, -8, 9, -5, 10, -13, -8, 8, 2, -2, -3, 7, 6, 10, 1, 2, -5, -9, 1, 10, 16, -22, -7, 0, 7, 7, 6, 1 }, { -26, 19, -5, 3, 5, 25, 18, -5, 9, -14, -8, -6, -2, -6, 2, 3, -8, -2, -7, 7, -3, 7, 3, 4, -8, 0, 1, -8, -4, -2, -2, 1 }, { -20, 14, -10, 6, -3, 7, 8, -32, -2, -7, -2, -10, 16, -12, -9, 15, -2, -5, -6, 2, -7, 5, 9, 1, 6, -7, -1, 0, -2, -4, -7, 3 }, { -14, 16, 4, 11, -8, 1, 23, -4, 17, -13, -10, 1, 12, 9, 12, -4, 7, -1, -1, 5, -8, -6, 3, 3, -6, -3, -18, 0, 18, 20, 4, -2 }, { -33, 19, -10, 30, 15, 2, -3, -1, -4, -14, 7, -7, -1, 7, -8, 9, -1, -3, -5, 2, 2, 4, 0, 5, 0, 0, 2, 3, 3, -3, -3, 4 }, { -6, 20, 0, 5, 17, -10, 18, -17, 9, -16, 4, -13, -6, 2, -14, 14, -28, 9, -12, 25, -4, 7, 7, -8, 6, -6, -2, -10, 2, -11, -1, 2 }, { -12, 14, 12, 52, -3, 5, -5, 4, 8, -13, 2, -5, -4, 2, -2, -1, -2, 3, 3, 5, 2, 3, 0, 1, -5, 2, -4, -3, 1, -5, -2, 0 }, { -13, 6, 9, 24, 0, 8, 14, -15, 18, -9, -11, -8, 3, 15, -2, -4, -9, 4, -3, 12, 14, -13, 11, -4, 2, -4, 0, -6, -6, -6, -14, -1 }, { -10, 28, 3, 12, 9, 3, 11, -28, 6, -11, -7, 4, 0, 7, 8, -9, 0, -6, 0, -16, 4, 7, 4, 4, 7, 3, 4, -7, 0, -3, -10, 6 }, { -11, 14, -2, 19, -1, -1, 7, 9, -2, -27, 10, -14, 15, -4, 12, -4, 2, -2, -6, 12, -6, 0, -5, -4, -5, 1, 3, -11, 5, -9, 3, -8 }, { -18, 7, 13, 16, -4, 3, 9, -10, 10, -10, -3, -22, -4, -12, 3, -16, 0, -3, -16, 8, -11, 1, 10, -7, 15, 3, 0, -1, -13, 8, 1, 6 }, { -20, 10, -10, 10, 8, -1, 6, 0, 16, -12, 9, -10, -1, -5, -4, -13, 13, 16, -8, 12, -2, 14, 18, 13, 0, -16, 2, -5, -5, -5, -4, 3 }, { -14, 5, -7, -17, 5, -13, 23, 20, -4, -1, 1, -6, 13, 5, -1, 4, -14, -2, -7, 8, 3, 2, 2, -7, 2, -1, 4, 7, 3, -9, -1, -5 }, { -19, 3, -24, -28, -9, -7, 19, 3, 2, 19, 7, 5, -13, 8, -15, -17, 3, -11, 4, 13, 3, 2, -1, -3, -4, -4, 2, 0, -5, -6, 6, 2 }, { -17, 18, -30, -20, -2, -3, 1, 15, -1, -11, 6, -4, 11, 11, -4, -5, -10, 0, 0, 1, 3, -7, 8, 2, 5, 1, 5, -5, 1, 6, 4, 1 }, { -6, 1, -30, -25, -1, -8, -2, -9, -17, 16, 3, -1, -2, -9, -6, -7, -3, 12, 6, -4, -10, 0, 10, -8, -6, -5, -3, -11, -4, 0, -1, -3 }, { -1, -1, -34, -28, 1, -10, 2, 9, 4, 16, 2, 6, 14, 17, 0, 7, -4, 4, 4, 4, 0, 1, -1, -5, 8, 1, -4, 1, -9, -2, 5, 6 }, { -11, 14, 1, -31, -7, -24, 9, 7, 6, 5, -13, 1, -1, 3, 4, -1, -2, -8, -6, 3, 5, -4, -6, 7, -2, 5, 3, 3, 0, 0, -5, 2 }, { -25, 8, -11, -18, 1, -4, 8, -3, -4, 15, 6, -5, 8, 2, 3, 4, -4, 5, 6, 8, -7, 6, 1, -11, -15, -13, 9, -4, -14, 10, 12, 7 }, { -20, 11, -15, -25, 3, 4, 18, 13, -4, -5, -9, -1, -5, -2, -2, -7, 16, 5, -4, -5, -7, -2, -3, -9, 11, -2, 0, -7, -17, -6, -11, 6 }, { -11, 18, -5, -20, -15, -3, 9, 11, -20, 12, 5, 5, 11, -3, 7, 1, 10, -6, -3, -3, 3, 3, 14, -7, 10, -17, 9, -11, -2, -6, 7, -12 }, { -20, 8, -14, -17, -9, -13, -3, 0, -27, -14, -3, -14, 4, 3, 6, -6, 7, 4, 23, 9, 11, 9, 3, -4, 9, 2, 4, -1, -6, 1, -8, -11 }, { -9, 14, 2, -37, -7, 13, 6, -11, -6, 9, 18, -11, -6, 2, 12, 4, -1, 3, 1, -2, -2, 1, -9, -4, -2, -3, 3, 5, -6, 0, -2, -8 }, { -29, 8, -1, -13, -2, 8, 23, 2, -10, 7, 13, -6, -5, 11, 13, 0, -10, -13, 11, -12, -10, 6, 4, 6, 4, 3, 6, -5, -9, -2, -1, 3 }, { -18, 6, -10, -55, -4, -11, -2, 0, 1, -3, -9, -6, 3, -2, -1, 6, 3, -1, 3, 1, -4, -7, -2, 6, 3, -2, -1, -3, -2, 0, 4, 1 }, { -14, 5, 3, -21, -8, -16, -4, -2, -11, 27, 15, -20, 3, 0, 1, 1, 2, -5, -5, 4, 1, -9, 5, -3, 3, 0, -4, -2, -11, -4, -3, 7 }, { -17, -1, -9, -17, -8, -18, 12, -13, -9, 13, -3, 3, 3, -3, 1, -2, 0, 16, -9, 6, 12, 9, 5, 11, 2, -15, 1, -4, -16, 7, -4, -12 }, { -18, 8, -6, -11, -8, -7, 13, 7, 1, 6, 8, -1, 21, -4, 14, 15, 18, -4, -3, 15, 0, 9, 4, 7, 3, -1, 9, -2, 0, 7, -8, 2 }, { -10, 7, -18, -29, 3, 12, 12, 9, 11, 4, -1, -15, 1, -1, 8, -2, -2, 10, -15, -1, 0, 6, 12, -6, -1, 10, -6, -3, -11, -4, 9, -6 }, { -14, 14, -9, -21, -12, -2, -1, -7, -5, -10, 5, -8, 0, 6, 9, -11, 11, -3, -5, 3, 8, 15, -2, -4, -22, 4, -6, 12, 2, 13, 6, -7 }, { -12, 11, -5, -29, -25, 4, 12, -13, -11, -7, 4, 2, 2, -5, 5, 8, 7, -5, -5, 6, 3, -10, 1, -6, 6, -6, -5, -1, -2, -4, 7, 6 }, { -15, 11, -5, -16, 0, -13, 26, -23, -6, -3, 5, -2, -2, 21, -6, -3, -5, -1, 6, -1, 0, -13, 2, -3, -9, -1, -4, -3, 5, -4, 12, -16 }, { -9, 9, -1, -17, -3, -6, 12, 6, -18, -2, 11, -14, -6, 3, 14, -12, -11, -5, 14, 2, 5, -8, -4, -11, 2, -5, 16, 6, -7, -4, 8, 13 }, { -13, 5, 3, -28, -14, 0, 6, 23, 5, 4, -1, -17, 1, -3, 0, 0, 5, 4, 0, -18, 14, 10, 4, 2, 5, -2, 4, -3, 2, 0, 2, 0 }, { -15, 4, -13, -16, -3, -12, -2, 2, 7, 10, 9, 3, 11, 4, 23, 14, 9, 16, 4, 1, -12, -3, 4, -7, -15, -7, -10, -14, -6, -8, -1, -6 }, { -7, 10, -5, -10, -3, -13, 16, -1, -12, 7, -3, -12, 2, 13, 13, 2, 17, 15, -13, 1, -5, -2, 3, -1, 1, -3, 6, -3, -12, -16, 7, -7 }, { -11, -5, -12, -30, -6, -22, 1, 4, -6, -3, 12, 6, 7, 0, 16, 6, -2, 0, -22, -2, -9, 2, -13, 8, 6, -8, 4, -7, -1, -6, 4, 6 }, { -14, 5, 1, -27, -4, 2, 1, 14, -11, -7, -8, -4, 1, 8, 0, -6, -13, 11, -12, -7, -5, 1, 10, 7, 3, -2, 0, 6, -8, 2, 10, -1 }, { -10, 10, -25, -13, -20, -4, 19, 3, 13, 5, 5, 7, -8, 2, 4, 2, 3, -1, -1, -9, 14, 10, 9, 14, 3, 3, -6, 0, -5, 4, 1, -1 }, { -9, 15, -18, -17, 4, -11, 6, 7, -12, 8, -1, -11, 2, 3, 7, 16, -3, -9, 7, -12, 23, 0, 6, 7, -14, -9, 8, 1, -2, 6, -2, -1 }, { -6, 9, -16, -26, -14, -11, 9, -6, 5, -2, 13, 17, 21, 7, 18, -19, 6, -23, -2, -15, -2, 2, -10, -8, 2, 1, -2, 4, -3, -4, -5, -4 }, { 0, 6, -5, -28, -17, -32, 2, -10, 11, 3, -5, 9, 10, 3, 11, 11, -3, 12, -2, 2, 4, -6, 9, -4, -4, -4, -4, -9, 2, 0, 2, 4 }, { 0, -8, -18, -34, -9, -7, -4, -11, 10, 15, 11, -1, -8, 15, 6, -13, 9, 2, -4, -12, 0, -1, 19, 12, 6, 5, 0, -3, -10, -12, 3, -5 }, { -10, 6, -9, -17, -12, -11, 9, -6, 11, 11, 18, -7, 0, 16, 4, 2, -6, 3, -12, -1, 0, 1, -5, -22, -2, -12, 0, 6, 17, 5, 5, 6 }, { 12, -5, 7, 1, -5, -2, -1, 2, 2, -4, -3, -3, -3, -2, -29, 11, 5, -13, -73, 24, 12, 4, -14, -10, 5, 1, 0, -11, -7, -7, 7, 3 }, { 10, -3, -1, -3, 4, -11, -5, -2, -8, 7, 9, 2, -8, -6, 6, 7, 21, 17, -54, 47, -14, -10, 14, 19, 13, 21, -4, 3, 1, 2, -4, 2 }, { -12, 4, -16, -12, 5, -9, -4, 19, -7, -22, -22, -17, 3, 0, -6, 8, 23, -4, -55, -28, 2, -26, 2, 1, 4, 0, -13, 6, 0, 10, -7, -11 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1, 35, -1, -67, -35, -24, -24, -6, 2, 2, -2, 1, 3, 2, 0, -1, 1 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 5, 0, 41, -4, -73, -15, 18, 4, 17, 8, -1, -16, -1, -2, 1, 0, 0, 0 }, { -4, -4, 4, 6, -1, 2, -16, -10, -15, -10, 21, -2, -6, -2, 14, -7, 10, -5, -55, 34, -12, 11, -13, -2, 2, 28, -26, 0, 7, 4, 21, -7 }, { 2, 1, 15, -22, 10, -3, 14, -6, -2, 15, -2, -7, 20, 6, -15, -7, 23, 10, -60, 8, -4, 29, -22, 2, -13, 9, -10, 12, -1, -3, 4, 7 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, -2, 11, -5, -21, -11, -60, -27, -17, -39, 6, 36, 0, -8, 2, 2, 0, 0, -2, 3 }, { 2, -5, 9, -17, -1, 2, -3, -6, 8, 12, 7, -6, -33, -11, -14, -40, 10, 36, -46, 0, -19, 5, 0, -10, 3, 12, -6, -8, 6, -12, -7, 1 }, { 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 1, 0, -2, 0, 4, -2, -87, -3, -2, 2, -2, 20, 2, 6, -1, 6, 0, 0, 2, -1 }, { 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1, 1, 7, -76, 41, -7, -24, 0, -6, 3, 6, 0, -2, -1, 1, 0, 0 }, { 0, -3, 4, 2, 3, 2, 2, 0, 3, -1, 4, 0, -1, 4, -2, -4, -32, -11, -64, -29, -9, -43, 2, -11, -1, -7, 0, -4, -2, -2, -2, 2 }, { 10, -20, 3, -3, 13, 13, 0, -4, 2, 7, -8, 7, -2, 2, -20, -20, -19, 3, -47, -18, -16, -6, -15, -42, -17, 14, -6, 8, 12, -10, 11, -12 }, { -3, -2, -2, -1, -1, 4, -3, -1, -6, -2, 3, 2, -3, 6, -1, -9, 10, 13, -68, -9, 26, 3, 5, 3, -21, 10, -15, 21, -22, 19, 11, -14 }, { 1, 5, 18, -19, -29, -13, -2, 18, -10, 20, 2, 10, -10, 11, 1, 8, -16, -17, -41, 10, -14, -25, 0, -14, -19, 17, 7, -12, 14, -11, 14, 5 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1, -43, 5, 6, -12, -48, 19, 8, -38, -8, -3, 22, -21, -10, 15, 20, -9, -5, 8 }, { 0, 0, 0, 0, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 6, -3, 22, -14, -71, -24, -2, -33, 23, 7, -8, 7, -3, 2, -4, 1, -8, -2 }, { 1, 0, -1, 2, 0, -2, 0, 0, -1, 0, 4, 0, 26, -1, 10, -11, -17, -32, -58, 14, -14, -11, -2, 15, 2, -8, 12, 10, -9, 13, -33, -14 }, { 15, -17, -19, 7, -8, -15, -32, -22, 7, 12, 18, 0, 0, -15, -4, 16, 37, -2, -46, 11, 2, -8, -10, -8, 14, 9, -4, 5, 7, -17, 4, 3 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1, 1, 7, -76, 41, -7, -24, 0, -6, 3, 6, 0, -2, -1, 1, 0, 0 }, { 0, -3, 4, 2, 3, 2, 2, 0, 3, -1, 4, 0, -1, 4, -2, -4, -32, -11, -64, -29, -9, -43, 2, -11, -1, -7, 0, -4, -2, -2, -2, 2 }, { 10, -20, 3, -3, 13, 13, 0, -4, 2, 7, -8, 7, -2, 2, -20, -20, -19, 3, -47, -18, -16, -6, -15, -42, -17, 14, -6, 8, 12, -10, 11, -12 }, { -3, -2, -2, -1, -1, 4, -3, -1, -6, -2, 3, 2, -3, 6, -1, -9, 10, 13, -68, -9, 26, 3, 5, 3, -21, 10, -15, 21, -22, 19, 11, -14 }, { 1, 5, 18, -19, -29, -13, -2, 18, -10, 20, 2, 10, -10, 11, 1, 8, -16, -17, -41, 10, -14, -25, 0, -14, -19, 17, 7, -12, 14, -11, 14, 5 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1, -43, 5, 6, -12, -48, 19, 8, -38, -8, -3, 22, -21, -10, 15, 20, -9, -5, 8 }, { 0, 0, 0, 0, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 6, -3, 22, -14, -71, -24, -2, -33, 23, 7, -8, 7, -3, 2, -4, 1, -8, -2 }, { 1, 0, -1, 2, 0, -2, 0, 0, -1, 0, 4, 0, 26, -1, 10, -11, -17, -32, -58, 14, -14, -11, -2, 15, 2, -8, 12, 10, -9, 13, -33, -14 }, { 15, -17, -19, 7, -8, -15, -32, -22, 7, 12, 18, 0, 0, -15, -4, 16, 37, -2, -46, 11, 2, -8, -10, -8, 14, 9, -4, 5, 7, -17, 4, 3 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, -5, 3, -85, 23, -9, -17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 }, { 16, 65, -2, -2, 4, 3, 0, -7, 3, 1, 3, 1, 0, 5, 1, -5, 0, 2, -1, 3, 0, 0, -1, -2, 6, 0, -2, 0, 0, -1, 1, 1 }, { 5, 37, -4, 8, -4, -1, 9, 17, 6, -7, 5, -1, 11, 6, -4, 7, -2, 4, 1, -3, 11, 3, 3, -9, 6, 0, -2, -4, -5, 4, -12, -11 }, { 15, 24, -14, 2, 6, 17, 26, 5, 8, 11, -9, -7, -6, -8, 3, -5, 9, 10, -3, 10, 0, 1, 4, -9, 4, 9, 3, 0, 4, 0, -5, 3 }, { 9, 36, -9, -8, 7, 7, 4, 3, -1, -16, -2, 7, -5, -6, 6, 12, -11, -12, 9, -1, -3, -9, 12, 6, -6, 2, 2, 5, 0, 5, 6, -6 }, { 25, 39, -5, 24, 3, 10, 3, -6, 13, -8, 3, -7, 2, -10, -5, 2, -2, 3, 5, -2, 1, 5, -2, 3, -4, 1, -5, -4, 0, 1, -2, 0 }, { 16, 27, -1, 0, -14, 6, 4, -5, 7, -2, -6, 0, -3, -5, 2, -1, -1, -19, 5, -8, 0, 11, 12, 5, 0, 3, 10, 6, -14, 14, -13, -15 }, { 12, 23, -14, 2, 1, 4, -3, 16, 7, -8, 2, -8, 8, 6, -8, -7, -3, 0, 2, 8, -13, 7, 13, -6, -4, 6, -13, -16, 14, 11, -7, 5 }, { 16, 28, -7, -1, 6, -3, 9, 0, -7, 3, 0, 3, -12, 20, 8, 9, 8, 23, 8, -13, -2, 4, 9, 3, -5, 13, 5, -2, 12, 14, 5, -1 }, { 19, 37, 19, 5, 7, 5, 10, 5, 19, 10, 14, 0, 2, 5, 1, -4, -4, 2, 2, -5, -2, -1, 2, -6, -4, -4, -5, -3, 2, -2, -2, -2 }, { 24, 21, 1, -11, -10, 17, -14, 14, 6, -1, -6, -1, 0, -13, -1, -12, -2, -5, 6, -4, -12, 14, 5, -2, -8, -8, 15, -7, -30, -12, 4, 0 }, { 11, 26, -3, 3, 5, -1, -2, 3, -2, 10, 15, -4, 10, -28, 10, -17, -8, 1, 2, -7, -1, -6, -15, -1, 4, 5, -7, 9, 0, -5, -4, 4 }, { 18, 32, 1, 2, -7, 4, 15, 2, -9, -2, 12, -11, 7, 11, 13, 2, 0, 5, 9, -10, 16, 3, -3, 5, -9, -23, 2, -2, -1, 5, 2, 11 }, { 35, 24, -20, 2, 4, -1, 5, 14, -10, -9, 8, -7, 0, 5, -7, -7, 11, 1, 5, 3, 2, 0, -2, 3, 0, 1, 4, 0, -2, -8, 0, -4 }, { 9, 35, -1, 2, -1, -19, -3, 12, -1, 8, 8, -13, -1, -2, 2, 5, -8, -1, 13, -2, 11, 1, 0, -10, 0, -3, -7, 2, 1, -12, 3, 12 }, { 20, 27, -12, -12, 7, 4, -1, -13, -1, -9, 2, 13, -11, 5, 7, -9, 9, 1, 1, 8, -9, 0, -6, 7, 4, 2, -2, 7, 3, -2, 1, -9 }, { 8, 37, -20, -5, 0, -21, 10, -8, 3, 19, -9, 7, -3, -8, 10, -2, 0, 5, 6, -4, -2, -1, 0, -7, 6, 1, 0, 4, -5, 6, -8, 2 }, { 8, 27, 1, -3, -5, 1, 6, 0, 15, 2, 17, -1, 3, -17, 10, 5, 5, -6, -6, 6, -10, 18, -5, 0, 0, 13, 7, 10, -5, -6, -2, -4 }, { 14, 29, -20, -4, -3, 1, -5, -1, 2, 12, -10, -3, 4, -18, 4, 14, -4, -1, -9, 15, -2, 2, -5, -3, 2, 9, -2, -14, -3, 4, -4, -7 }, { 23, 23, -23, -11, 27, 4, 4, -1, 7, 0, -5, 9, 2, -11, 3, 7, -2, -5, 2, -7, -7, 13, -3, -6, 2, 3, 3, -4, -1, -8, 5, -2 }, { 16, 26, -6, 8, -9, -1, -2, -1, -8, 4, -2, 0, -12, 9, -1, 0, -17, -9, 30, -5, -15, -16, -13, 0, 10, -11, -7, -3, -1, 0, -11, -2 }, { 12, 32, -4, -5, 10, 19, -10, 4, -12, 5, -6, 9, -12, -6, -6, -8, 4, 1, 3, 0, 8, 0, -3, -4, -7, -4, 10, 8, 6, 5, -1, 4 }, { 46, 42, -3, -14, -2, -6, 6, -2, -5, -1, -3, -3, 1, -1, 3, 1, 1, 4, -1, 2, 3, 1, -2, 6, 0, -1, -2, 4, -2, -1, 2, 2 }, { 9, 33, -13, 4, -11, 3, -8, 22, 12, -2, 4, 0, -16, 5, 4, -1, 7, -6, -9, 1, 7, 5, 0, -5, 5, -1, 10, 3, -2, -1, 3, -2 }, { 9, 30, 6, -3, 6, 1, -7, 5, 11, 14, 7, 1, 0, 2, 2, -1, 8, 7, -6, -13, -10, -2, 1, -6, 10, 7, 6, 5, -2, -5, -1, -16 }, { 9, 28, -11, -10, 9, -10, 15, 8, 4, 9, -4, -7, 0, -5, 9, 8, -7, 2, -15, -23, 4, -4, 4, 16, -8, -3, 0, -8, 14, 5, -3, 15 }, { 17, 26, -5, -5, -1, -8, 20, 18, -7, -2, 4, -7, -8, -5, -4, 16, 0, 0, -7, -2, -13, -5, -2, 3, 12, 1, 3, -5, 2, 2, 0, -1 }, { 11, 37, 7, -23, 6, -1, 15, 13, 4, -9, 7, 5, 3, -3, -5, -8, -2, 3, -5, -1, -8, 7, 2, 13, 1, 3, 0, -3, -1, 2, 0, -2 }, { 21, 33, 7, 20, 21, -10, 6, -5, -5, -6, -9, 2, 10, 0, 8, -4, 10, 2, -2, -2, 0, -10, -6, -2, 0, -5, 3, -11, 3, -9, -3, 1 }, { 6, 30, -15, -8, 16, 1, 4, 6, 4, 5, 8, -3, 8, -9, -1, -6, 8, 2, -2, 4, -2, 5, 11, -21, 3, -10, 16, -11, 24, 10, 14, -6 }, { 15, 36, -3, -9, -20, 12, 0, -7, -18, -4, -8, -9, 9, -7, -3, -1, 2, 7, -5, -8, 6, 2, 2, -1, 7, 1, 1, -3, 3, -4, -8, 1 }, { 16, 34, 21, 3, -9, 10, 7, 9, -7, 1, -4, -9, -4, -5, -5, 3, 3, -19, 1, 5, 4, -2, -6, -5, -10, -11, -8, -2, 2, -5, -8, -7 }, { 28, 29, -3, 18, -2, 0, -6, 12, -2, 10, -11, -4, -13, -12, -6, -4, 0, 4, -1, -8, 6, 4, 12, 11, 10, 10, -3, -6, 1, 2, 1, 7 }, { 3, 8, 22, -8, 3, 36, -8, -1, 9, 6, -13, -14, 8, -1, 1, 2, -2, -8, 0, 3, 1, 2, -1, 5, -1, -8, 0, -2, 2, 2, -1, 1 }, { 0, 6, 0, 0, 4, 13, -7, -16, -6, 15, -14, -21, -9, -10, -10, -6, -21, 5, 4, 2, 12, 4, 12, 11, -4, -6, -6, -10, -7, -18, 1, 4 }, { -1, 3, 10, 1, -1, 15, 4, -7, -16, 3, 0, -22, 10, 2, -3, -2, 13, 5, -8, 16, -5, 4, 0, -11, -10, -22, 0, -4, -17, 5, 2, 1 }, { 12, 8, -4, -9, 14, 40, -21, 0, 1, -15, -10, -12, 12, 6, -10, 2, 8, 6, -12, -10, -11, 1, 0, -11, 2, 1, 13, 0, 6, 3, 8, 4 }, { -10, 3, 5, -4, -3, 3, 0, -9, 2, 8, -22, -23, 17, 8, -17, -3, 14, -8, -4, 1, -8, 3, 0, 5, -1, -3, -2, -4, 1, -10, 0, -2 }, { 0, -1, 5, -7, 4, 12, -2, 0, -7, 2, -16, -15, 12, 21, -7, -4, 7, -7, -11, -15, -7, -9, -5, -8, 0, -6, 8, -3, -8, 22, -7, -9 }, { 7, 19, 4, -9, 24, 22, 2, -6, 8, 13, -14, -20, -4, 11, 8, -4, -1, 2, 0, -7, 5, -17, -3, 3, -6, 5, 3, 4, -5, -7, -3, 14 }, { -2, 6, 2, 8, -2, 5, -4, -2, -10, 3, -45, -30, -3, -3, -12, -4, -3, -3, -1, 9, -6, -6, 5, -4, 0, 5, -1, -2, -1, 0, -6, -1 }, { -3, 14, -16, -10, 10, 0, -2, -40, -9, 12, 2, -19, 15, -4, 4, 3, 3, -4, 7, 1, -4, -5, 0, 4, -1, 0, -9, -2, -4, -1, -2, 0 }, { 7, 16, 2, -7, 8, 2, 0, 1, 5, 21, -10, -26, 7, 2, -9, -7, -3, -16, 8, 5, 5, -6, 10, 4, -14, -6, 5, 3, -2, -2, -4, 1 }, { -9, 14, -1, 3, 3, 11, 1, -5, -3, 13, -16, -18, 20, 6, -5, 0, -3, 2, 8, 4, -19, -9, 12, 0, -8, 2, 2, 1, 6, 13, -7, -11 }, { 2, 5, 16, -4, 19, 15, 4, 0, -11, 7, -10, -10, -16, 18, -11, -12, -9, -4, 7, -4, -4, -17, 1, 1, -8, -3, -3, 5, -2, -6, -11, -5 }, { 2, 12, 0, -9, -10, 14, 6, 2, -3, 2, -12, -28, 12, 1, -1, 2, 0, -3, -4, 7, 16, 5, -7, 8, -4, -3, -1, 3, -12, 4, -17, -5 }, { -4, 7, 11, 6, 1, 14, -4, -6, 5, 5, -6, -24, 23, -9, -15, 13, -7, -9, -15, 10, -1, 8, -5, 1, 12, 6, 2, 0, 4, -2, 9, -10 }, { 1, 5, 11, 3, 6, 12, -3, 8, -21, 5, -7, -20, 12, -2, -9, -3, 17, -7, -8, -9, -14, 3, -13, 18, -8, 9, 2, -8, 4, -8, -5, -2 }, { -3, -3, -1, 5, -2, 15, 3, 2, 1, -8, 1, -39, -6, 13, -13, 0, -2, -5, -6, -3, 0, -5, -2, 15, -9, 5, -3, -6, -2, 7, 0, -13 }, { 2, 8, 5, -12, -13, 22, 8, -16, 11, 5, -2, -32, -2, -4, 11, 5, 5, -6, 1, 3, 1, 5, 3, 6, -5, 4, 4, -8, 8, 4, 1, 3 }, { 13, 9, 5, -4, 9, 18, -11, 2, -1, 15, -10, -19, -2, 14, 0, -10, 1, 1, -18, 3, 2, -6, -8, 20, 7, -8, 16, 9, 9, -13, -3, -2 }, { -13, 11, 11, -9, -10, 13, -3, -18, 2, 10, 5, -21, 6, 15, -11, -21, 3, 14, 0, -12, 9, -1, -2, -4, 3, -3, -9, -8, -5, -2, -8, 2 }, { 3, 3, 11, 4, 0, 13, 1, -8, 10, 13, -6, -26, 2, 12, -3, -5, 12, -2, 1, 8, -7, -17, -19, 5, 10, 7, -3, 2, -3, 0, 5, 0 }, { 5, 0, 3, -3, -9, 5, -15, -5, -5, 17, -5, -31, 0, 13, 13, 5, -1, -6, -14, 7, -8, 9, -14, -2, -16, -4, -4, -6, 6, -6, -10, 6 }, { 13, 3, 1, 7, -3, 4, -1, -2, -1, 4, -8, -32, -1, -4, 0, 3, -10, 7, 10, -10, 4, -1, 6, 2, -16, -9, 4, 3, 13, -23, -3, -4 }, { 4, 11, -4, -9, 4, 11, -12, -12, -12, 6, 1, -28, -3, 14, 18, -2, -12, 7, 15, -3, -5, -7, -3, 2, -6, 4, 4, -2, -5, -3, 2, -13 }, { 8, 7, -7, 0, 13, 7, -8, -7, 8, 36, -10, -22, 3, 23, -3, -10, -3, 11, 1, -7, 3, 3, -1, -7, -4, 2, 3, 2, 5, 3, -4, -1 }, { -1, 1, 13, 1, -6, -1, -6, -9, -18, 17, -5, -37, -1, -1, -6, -4, 1, -6, -15, 2, 17, -9, 0, -3, 0, 4, 0, -5, 0, 4, 1, -5 }, { 0, 14, 5, 0, -7, 2, -6, 17, -6, -9, 7, -16, -5, 23, -14, -13, 8, -15, 11, 10, -11, -13, -33, -5, -2, 1, 6, 8, 0, -13, -9, 5 }, { 11, 7, -2, -8, 9, 11, 25, -14, 7, 3, -1, -33, 14, 8, -6, -19, 3, 3, 2, -1, -3, -1, -2, -10, -3, 1, 2, 1, 4, 2, -3, 4 }, { -2, 8, 4, -2, 9, 13, -4, -2, -15, -3, 19, -37, 9, 25, -9, 2, -5, -2, -2, -4, 4, 2, 2, 0, 3, 3, 3, 5, -2, -3, -4, -3 }, { 10, 13, -1, -15, 4, 6, -18, -4, 25, 1, -23, -17, 15, 13, -8, -8, 7, 4, -5, 3, 6, 9, -7, 6, 0, -5, 8, 0, -6, -1, -2, -2 }, { 1, 3, 9, -5, 27, 15, -9, -31, -1, 23, -2, -9, 1, 8, -1, -7, -2, -8, -4, -4, -2, -1, 3, 5, 0, 0, -1, 1, -7, 7, -3, -3 }, { -8, 7, 3, -6, 8, 3, -11, -2, 36, 14, 1, -30, 6, 10, -12, -6, -6, -2, -4, -3, -5, 0, 9, 4, -5, -5, -8, 12, 4, -3, 1, -8 }, { -2, 9, 33, 0, 12, -3, -7, -4, -4, -1, 6, -25, 11, -6, -9, -11, -2, -4, -2, 6, -1, -3, -6, 15, -6, 3, 10, -4, 1, 0, 5, 8 }, { -22, -21, -9, -19, -5, -7, -12, -15, -8, 9, -19, 14, -7, -4, 5, -8, -2, 7, 1, -3, 4, -4, 6, 11, 2, 6, -3, -5, 2, -2, 0, -3 }, { -32, -13, 3, -24, 3, -8, 4, 1, -10, 14, -15, 0, 4, 6, -1, 6, 7, -1, 6, 4, -3, -17, 1, 4, -6, -1, 1, 0, 3, 3, -7, -4 }, { -32, -11, 7, -8, -12, 13, -5, -22, -4, 12, -16, 2, 0, 4, 0, 1, 0, 6, -5, -8, 2, 6, 5, 0, -3, -6, 5, 6, 5, 5, 13, -4 }, { -44, -33, 6, -4, 2, 0, -9, 10, 3, 4, 7, 0, -1, 7, 5, 1, 1, -3, 1, 6, -1, 0, 2, 3, -4, 0, 0, 1, 0, -1, -2, -1 }, { -30, -18, -24, -8, 5, 0, -2, 14, 7, 0, 1, 12, 6, 4, -9, 7, 5, 7, -11, -5, 1, -8, -1, 2, 2, -9, 7, -1, 7, 5, 6, 6 }, { -22, -20, -13, -9, 20, -3, 10, -8, 6, -4, 2, -7, 10, 8, 0, -1, 2, -3, 6, -19, 2, 4, 3, 3, -7, 2, -1, -6, 1, 1, 6, -2 }, { -27, -8, -1, 3, -1, -11, 24, 4, -1, 1, -8, 8, 5, -11, 15, -3, -15, -1, -1, -13, -1, 1, -5, 5, 2, 3, -9, 0, 4, 3, -7, 6 }, { -33, -16, -1, -8, 10, -23, 6, 13, -1, -3, -9, 0, 5, -7, -5, -12, -2, 3, 3, 6, -2, -3, 2, -3, 9, -6, -3, -2, 0, 5, -3, -4 }, { -22, -17, 11, -3, 3, 1, -1, -5, 17, 2, -15, -2, 10, -9, 6, 14, -16, -12, 20, -1, -7, 6, -3, -12, 1, 10, -10, -1, 7, -3, -1, 10 }, { -28, -13, 1, -3, -1, -1, 0, 3, 3, 5, 1, 10, -10, -3, 7, 2, 4, 19, -1, -1, 10, 5, -8, 1, 11, -15, -4, -3, -5, 4, -13, 3 }, { -22, -13, 42, -20, 5, -13, 7, -11, 1, 1, -1, 1, 6, 3, 6, -11, 3, 3, -2, 0, -4, 4, -3, -1, -5, 2, 0, 0, -9, -1, 4, 4 }, { -26, -15, -2, -6, -4, -2, 16, 8, 21, 8, 1, -3, -10, 7, -8, -12, -5, 12, -9, 3, -2, -3, 18, 1, -12, -15, -4, 5, -3, 0, 12, 7 }, { -26, -16, 5, 6, 14, -3, 15, 6, 1, -7, -13, 16, -15, 5, 11, -2, 9, -7, -4, -2, 0, 0, -2, 7, -8, -6, -5, 2, 7, -3, 2, 12 }, { -31, -17, -8, -30, 4, 14, 6, -6, 6, -11, 0, 3, -4, 0, 0, -4, 0, -4, 1, 4, 3, 4, 0, -5, 3, 2, 2, 0, 2, 1, 3, 5 }, { -61, -10, 4, 10, 4, 7, 0, -3, 0, 1, 0, -3, 0, 1, 0, -2, -1, 1, 2, -2, 4, -3, 1, 1, -1, 1, -2, -4, -4, 4, 0, 0 }, { -28, -13, -8, -4, 3, -3, 2, 1, 11, 14, 3, 9, 1, 13, 3, 5, -3, -2, -2, -12, -14, -9, -11, -15, -12, -5, -4, -12, 3, -3, 0, -5 }, { -41, 0, 12, -24, 13, 4, 5, 16, -5, -4, 0, 0, 13, -4, 1, -9, 9, -6, -1, 6, -2, 5, 2, 9, 6, -9, -8, 8, -2, -3, -6, -4 }, { -26, -19, -2, -15, 4, -14, 6, 0, 26, 20, 8, 9, 9, 3, -4, -5, -8, 1, 0, -1, 5, 9, 3, 4, 4, 7, 1, 3, -2, -2, -10, 0 }, { -29, -18, 9, -4, 1, -5, -14, -12, 5, -10, -5, 4, -5, 0, -1, -1, 4, -5, 7, -16, -11, 2, 7, -15, 2, -4, 6, -4, -6, 7, -3, 7 }, { -27, -16, 9, -14, 3, -8, 9, 0, 7, -4, -3, -7, 0, -10, -1, 2, 1, -2, 15, -10, 14, 7, 6, 17, 3, -4, 3, -10, 8, -8, 3, 11 }, { -21, -20, -8, -8, 4, 5, -3, -2, 0, -5, 14, -10, 11, -4, 13, 0, 5, -11, 19, -18, 18, 3, -5, -3, -4, -8, 11, -10, 10, 3, 4, -9 }, { -35, -15, 13, -12, 4, 0, -2, -4, -12, -3, -8, -24, -7, 1, 7, 8, -3, 0, -2, -1, 3, -2, -2, -6, 8, 1, 0, 1, -6, -1, 2, -6 }, { -19, -14, 13, -10, 9, -1, 1, 3, -12, 5, -16, 7, 13, 9, 4, -4, 6, -5, 4, 9, -3, 17, -4, 12, -11, -6, -5, -6, 13, 2, 7, -9 }, { -34, -8, -4, 1, 2, -1, 3, 6, -20, -11, 8, -1, 4, 2, -9, 4, -4, -5, 16, 10, -4, 14, -13, 1, -6, 0, 2, -10, 0, -3, -3, 7 }, { -36, -10, -8, -3, 2, -2, 14, -4, -1, -7, -4, 10, -1, -3, 15, -11, 0, 2, 3, -1, 4, 0, 8, -1, 0, 18, -11, -5, 15, -5, 13, -12 }, { -22, -13, 14, -20, 15, 25, 16, 10, 8, -2, -10, -5, -1, -8, 11, 8, -1, -2, -4, 1, 2, -1, -7, 0, 0, 0, -3, 0, 2, -1, 0, 2 }, { -31, -22, 7, 6, -2, 5, -20, 14, -6, 7, 0, 14, 3, -7, 3, -6, -2, 1, -3, -5, 1, -10, 1, -24, 6, -2, 3, -7, 1, -7, 8, 7 }, { -25, -20, -3, -9, 10, 6, 12, 7, 5, 4, -3, 6, -1, -5, -6, -8, 3, 5, 6, 5, -10, 10, -4, -15, -15, -2, -9, 2, 18, 1, 8, 12 }, { -24, -19, -2, -4, -7, 11, 6, 9, 16, 2, -7, 18, 6, -7, 6, 6, -2, -9, 3, 12, -2, 3, -1, 6, 7, 8, 0, 8, -11, 8, 4, 2 }, { -26, -20, -12, -12, -2, -3, 1, -5, -1, -2, 0, 3, 7, 9, -2, 2, 9, 22, 13, 4, -4, -1, -2, -14, 5, 15, -8, -5, -7, -11, -14, -6 }, { -21, -18, -1, -4, 0, 3, 7, -2, 10, 8, -8, -1, 15, 1, -9, 3, 1, 3, -5, -2, 2, 4, 0, -1, 10, 2, -19, -8, 8, 30, -7, 8 }, { -25, -6, 26, 4, -8, 4, -2, 21, 5, -4, -16, 5, 13, 4, -10, -1, -6, -2, 2, -10, -13, 1, 3, -3, -6, -8, 2, 11, 1, -7, 0, 5 }, { 0, -1, -2, 19, -12, -48, -6, 11, 8, -2, -4, -2, -7, 5, -3, 2, -2, -1, -1, -7, 0, -3, -3, -4, -4, 4, 1, 3, -3, -1, -2, -5 }, { -11, -8, -28, 18, 16, -24, -8, 19, 4, 8, -12, 9, -4, -2, 4, -7, 6, 2, 3, 3, -4, 0, 1, -6, -4, -2, 2, 6, 0, -3, 1, -16 }, { -9, -5, -26, 7, -3, -37, -16, -2, 2, -7, 4, -13, 0, -4, -6, -5, -6, -4, 0, 3, 4, -3, -4, -4, 4, -3, 9, -4, -2, 2, 7, -4 }, { 2, 9, -18, 7, 29, -24, -1, 7, 14, 10, 3, -3, -2, -5, 6, -10, -6, -3, -8, 0, 5, 1, 4, 3, -12, 2, 6, 1, 3, 4, 1, -3 }, { -20, 2, 8, 20, -9, -24, -4, 18, 3, 11, -1, -11, 6, 9, -1, -3, 1, -1, -15, 3, 15, 9, 3, 2, -13, 2, -8, 8, 1, -1, 1, -8 }, { -12, 5, -11, 6, 19, -26, -17, -6, 4, 14, 6, -8, 9, 5, -6, -5, 2, -1, 20, 1, -11, -10, -18, 20, -7, 0, -3, 4, 2, 0, 10, 4 }, { -15, 1, -2, 13, -8, -21, -22, 4, 4, 3, 3, -7, -31, 4, -10, -14, 0, 8, 4, 5, 8, 11, 2, -8, 6, 7, 0, -2, 6, 8, 8, 7 }, { -13, -10, -9, 12, 19, -16, -3, -2, 9, 2, 11, -29, -1, 9, 4, -3, 1, -10, -10, 16, 1, 7, -7, -6, -4, -1, -5, 3, 6, 0, 3, 1 }, { -17, -1, -5, 19, 12, -9, -21, -5, 2, 12, -7, -7, -3, 8, 7, -2, 6, -9, -9, 1, -4, 1, 1, 3, -14, 2, -8, 0, 10, 1, -12, -6 }, { -13, -5, 8, 15, 0, -20, -2, 20, 8, -8, 8, -19, 12, 10, 2, -11, 0, 12, 1, -11, 0, -11, -15, 5, -11, 2, 4, -4, -11, 5, -4, -5 }, { 3, -11, -7, 8, 0, -17, -26, 15, 19, -7, 10, -9, -5, -5, 14, -25, 0, -8, 2, -9, -3, 9, 1, -6, 4, -4, 3, -9, -1, 6, 2, 2 }, { -12, 5, 5, 9, 14, -18, -19, 4, 2, 16, 14, -21, -15, -9, -1, 16, 12, -11, -10, -5, -7, 4, 15, -8, -5, -1, 1, 14, 13, -7, -1, -4 }, { -10, -5, -1, 8, 7, -23, -10, 14, 6, 11, 10, -16, -3, 16, 6, 0, 0, 9, 6, -2, -7, 1, 22, 5, 3, -8, 0, 3, -2, -10, 3, 0 }, { -2, -14, 2, 16, 15, -17, -17, 6, 19, 4, -10, -15, -1, 15, 11, -14, -8, 5, 8, 8, -2, -8, -11, 10, 10, -8, -14, 2, 13, 4, -2, -12 }, { -10, 3, 6, 4, 19, -23, -19, 1, 4, -9, -30, 3, -6, 18, 0, 2, 0, -11, 0, 3, 7, -2, 8, 5, 2, -3, 6, -9, 1, -4, 7, -6 }, { 9, 5, -2, 21, 20, -33, -13, 7, -10, 8, 8, -15, -6, -4, 1, 5, 3, 7, -2, -9, -1, 4, -6, 1, 0, 9, -1, -5, 2, 1, -3, 3 }, { -9, -3, 3, 15, -3, -30, -7, -7, -25, 6, 2, -6, 1, 19, 1, -12, 1, -8, -13, 9, 13, 1, 8, 2, 5, 15, -2, 3, -9, 0, -4, 4 }, { -6, -12, -17, 25, 22, -13, -10, 9, 2, 11, -7, -16, 4, 6, 1, 0, 0, 18, -4, -5, 4, -2, -1, -5, 0, -4, 6, 1, 6, -1, 7, 0 }, { -1, 0, -10, 8, 8, -27, 0, -2, 29, 16, -2, -4, 9, -1, 2, 0, 6, 10, 6, 4, 2, -7, 9, -18, 3, 3, 3, -10, 17, 10, 9, -6 }, { -3, -12, -6, 11, 20, -32, 5, 21, 3, -4, -9, 2, -10, 1, 7, -4, 5, 0, 0, -1, -8, -9, -7, 4, -10, 5, 0, 2, -5, 4, 9, 1 }, { -5, -1, -5, 1, 2, -19, -13, 1, 6, 12, 2, -16, -17, 11, 10, 13, 16, -12, -11, 3, -6, 0, 6, 4, -3, 1, 8, 2, 5, -11, 3, -14 }, { -19, 5, 10, 11, 2, -23, -9, 16, -2, 7, 0, -11, -7, 10, 6, -7, 26, -15, -4, 8, 6, -4, 7, -9, -15, 1, 8, -4, 4, 2, -12, 16 }, { -11, 1, 11, -4, 1, -31, -13, -1, 8, 5, 4, -2, 0, 13, 7, -17, 7, -10, -6, 1, 4, -1, 2, -9, -4, 9, 3, 3, -4, -5, 3, 4 }, { -3, 1, 10, -1, 0, -15, -22, 4, 40, -11, -4, -3, -14, 9, 11, -1, 9, -1, -6, 6, 3, -6, 0, 0, -12, 7, -2, 0, 9, 3, 1, 3 }, { -1, -1, -1, 14, 8, -24, -14, -8, 5, 8, 5, -12, -17, 8, 2, 7, 10, -8, 0, 4, -6, -6, -10, 8, 4, -12, 3, -9, -12, 5, 4, -3 }, { -5, 1, -11, 8, 9, -24, 0, 2, 2, 14, -12, -13, 1, 6, 7, 0, 7, -6, 9, 26, 11, -14, 8, 10, 1, 9, 0, 11, -2, 6, 2, -10 }, { -13, 1, 4, 34, 19, -17, -15, 0, 3, -2, -7, -1, 0, -3, -3, -1, 1, -1, -10, 8, 5, 0, -8, 4, -17, 9, -2, 0, 0, 6, 2, -3 }, { -6, -4, 1, 2, 2, -14, -29, 0, 9, 34, -3, -5, -14, 6, -10, -9, -5, -1, 0, 3, 3, 0, 1, -1, -2, -1, -1, -3, -3, -4, 3, -3 }, { -4, 6, 3, 14, 14, -8, -29, 31, 11, 14, -4, -5, -6, 10, 6, -9, -1, -11, -7, 1, 7, 4, 1, -6, 4, 0, 10, -7, -5, -1, 2, 4 }, { -4, -4, -2, 14, 6, -32, -6, -14, 14, -5, -11, 10, -18, -4, 6, -8, 9, 5, -4, 1, -4, 5, -2, -9, 3, 5, 2, -10, -6, -17, 3, 17 }, { -16, 9, 21, 19, 4, -20, -17, 14, 9, 15, -6, -17, -1, 1, 6, -3, 1, 1, 8, -3, -6, 6, 9, 4, 9, -9, -5, 1, -1, 0, -1, 2 }, { -7, -5, 3, 19, 1, -20, -9, 14, 21, -7, -18, -9, 26, -7, -17, -7, 12, 6, 0, -9, -6, 14, 9, -9, -8, 4, 15, -7, -9, -1, 9, 1 }, { -20, 30, -6, 11, 24, -4, 0, -6, -2, 8, -4, 12, -8, -17, 0, 5, -4, 1, -1, 3, -3, 5, 3, 3, 7, -2, -3, -2, 4, 0, 0, -1 }, { -35, 17, 6, 1, -9, -1, -16, 3, -20, -13, 8, 7, -4, -7, -4, -20, 7, 12, -5, 5, -5, -11, 12, -1, 15, -9, -6, 16, -4, -9, -13, 4 }, { -21, 36, -19, 9, 0, -7, -8, 9, -4, -3, 3, 0, 7, -8, -2, -2, -11, 13, -1, 5, -3, 7, 2, 3, -1, -2, -5, 1, -1, -2, -5, -3 }, { -12, 33, -4, 1, -12, -9, 0, -13, -1, 2, -8, 4, -10, 6, -16, -7, -1, -4, -10, 15, -1, 0, -5, -8, 5, 5, -3, 0, 2, -7, 1, -7 }, { -14, 32, 5, -7, -15, 3, -5, 8, 14, 5, 9, 13, 3, 18, -3, 7, 4, -10, -10, 10, -1, 2, 0, -2, -11, 5, -3, -4, 2, 2, 7, 4 }, { -14, 34, 1, 20, -1, -12, 0, -3, -7, -4, 7, 18, 9, -3, 14, -7, -9, -20, -7, -4, -13, 12, 1, 12, 5, -6, 2, -4, 0, -15, 1, 3 }, { -21, 23, 7, -8, 3, -13, -3, 0, -6, -2, -7, 6, -12, 9, -6, -2, -2, -4, -1, 6, 9, 5, -9, 15, 0, 8, -8, 7, 6, -15, 3, -5 }, { -27, 32, -1, -4, -2, 4, -10, 12, -3, 8, 13, 7, 0, -15, 4, -2, 3, 5, 7, -4, 9, -12, -1, -2, -1, -4, 0, -4, 2, -5, 6, -6 }, { -17, 29, 15, 0, -1, -4, -10, 13, 12, -1, -8, -10, -10, 4, 7, -2, 6, -5, -13, 19, 6, 1, -7, 2, -9, -2, 12, -4, -8, -3, 2, 4 }, { -38, 27, 16, -15, -6, 3, -7, -4, 0, -1, 6, -2, -3, -6, 6, -6, -3, 0, 2, 0, -4, 6, 1, -1, 0, 4, -1, 3, 4, 1, -2, 5 }, { -33, 40, -4, 2, 1, 0, 0, -10, -14, 0, -7, 4, -1, 3, -2, 5, 7, 6, -1, 4, 1, 3, 1, -7, 1, -4, 5, 7, 0, 4, 3, -4 }, { -20, 25, 12, -4, 16, -4, 2, 2, -14, -2, -3, 29, -1, 1, 3, 1, 9, -5, 2, -8, -3, 1, -7, -2, -7, 1, 0, 4, 16, -2, -1, -1 }, { -10, 30, 17, 3, -5, -2, 0, -5, -22, 4, 5, 5, -3, -18, -6, 10, -5, -7, 2, 8, 7, -7, -11, -2, 0, -3, 3, 2, 11, -4, 4, -4 }, { -11, 30, 11, 4, -3, -8, 1, -2, 4, 18, 3, 1, -1, 0, -8, -4, -3, 10, 13, 14, 5, -5, 1, 1, -10, 2, 15, 4, 9, -1, -5, -3 }, { -17, 32, 18, -18, -3, -5, 6, 10, 1, -15, -5, 9, 8, -12, -10, -6, 11, 9, -5, -8, -7, 10, 5, -10, -14, -4, -3, 1, 9, -11, 2, 1 }, { -13, 28, -11, -1, 2, -16, -2, 7, -24, 0, 3, 6, 3, -1, -8, -7, -12, 2, 2, -20, 10, 4, 0, -13, -2, -2, 1, 8, -14, 0, 4, 1 }, { -14, 23, 12, 8, 8, -26, 2, -4, -14, 13, -14, 15, 3, -9, -1, -13, -10, -2, -10, 6, -16, 12, 8, 0, 9, -10, -7, -4, -4, 7, -8, 8 }, { -20, 45, 10, -14, 4, 16, 8, -9, 1, -8, 10, 5, -7, -2, 2, -5, -1, 0, -5, 4, -6, -2, 4, 1, 3, 4, -4, 2, -2, -2, 5, 1 }, { -20, 26, -4, 1, 7, 4, -8, 1, -5, -13, 2, 13, -7, -3, 6, -6, 22, 0, 5, 11, -4, -11, 8, -9, 2, -2, -4, -2, 2, -13, -4, -8 }, { -28, 18, 17, 3, -8, -23, -16, -6, 5, -10, 14, 10, 5, -1, -8, 4, -2, 13, -3, -2, 3, 4, 3, -2, -3, -4, 0, 1, 3, 4, 0, 4 }, { -12, 32, -6, -16, 18, 12, -16, 0, 7, 13, -4, 5, -8, -1, -3, 4, 6, -2, -1, -13, 4, -1, 3, 12, -3, -10, 1, 6, 8, -11, -2, 4 }, { -18, 26, 2, 5, 0, -9, -17, 14, 5, 1, 7, -3, -8, -3, 11, 7, -5, -12, -8, 7, 0, -7, 2, -12, -9, 13, -11, 9, 6, -11, -5, 11 }, { -24, 22, -15, -9, 8, 1, -7, -12, -9, 3, 11, 15, 14, -11, 12, -15, -5, 7, -2, 0, -8, 3, 3, -1, 2, 11, -11, 14, -6, 13, 1, -6 }, { -20, 28, 18, -4, -6, -5, 12, 14, 2, 10, -13, -6, -8, -6, -13, -1, -26, 22, -3, -14, 6, 0, 10, -15, -13, -9, 6, -7, 1, -5, -4, -1 }, { -19, 26, -8, -3, -14, -6, -9, -4, -8, 15, -8, 3, -12, -4, -2, -7, -5, 3, 13, -3, -4, -25, 4, -1, 5, -12, -1, -13, 5, 2, 0, 6 }, { -18, 43, 14, -8, 1, -23, -2, -2, 1, 3, -7, 0, 0, 8, -1, -3, -5, 1, 5, 2, 0, -2, -2, -2, 1, -1, -1, -7, 0, 3, -3, 9 }, { -11, 30, 10, -14, 3, 1, 10, -11, 1, -7, -4, 14, 2, 1, -9, 1, -11, -2, -7, 5, -11, 1, 3, 14, 1, -16, -8, 3, -5, 7, -4, 4 }, { -18, 24, 6, 3, 8, 7, -22, -7, -7, 3, -8, 4, 23, 9, 3, -1, 3, 6, 7, -1, -7, 6, 4, 1, -3, 1, -6, -1, 2, -7, 3, 3 }, { -15, 38, -7, -1, -11, 2, -17, -24, 24, 8, 7, -4, -5, 2, 2, -7, 1, 4, 0, -9, 5, 0, -1, 1, -1, -5, -6, 3, 0, 7, 8, -3 }, { -14, 22, 1, -5, 9, -12, -9, -5, -6, 5, 7, 8, -1, -4, -9, -3, -33, -16, -9, -1, 12, -11, 17, -7, -3, -1, -7, 3, 2, -3, 16, -4 }, { -14, 20, 6, 4, -10, -4, -4, -4, 1, -7, 2, 6, 8, -12, 4, 1, -1, 12, 10, 3, -14, -10, -3, 18, -2, 33, -5, -17, 17, -5, 9, 7 }, { -12, 23, 13, 0, -11, -8, -11, 12, -5, -9, -16, 11, 6, 4, 12, -5, 5, -13, 7, -12, -3, 1, 2, 12, 1, -4, -1, 5, 4, 11, -12, -3 }, { 15, 2, 14, 7, 1, 2, 1, 12, 10, 23, 4, 6, -20, -10, 4, 26, -6, 13, 4, 3, 2, -11, 5, -7, -10, 4, 9, 1, 10, -4, 11, 4 }, { 17, 15, 31, 17, 18, 16, 11, 24, 2, 4, 2, 3, -8, -3, 7, -3, -5, -7, -2, -6, -4, -5, -4, -1, -4, -2, -5, -6, 2, -1, 4, -2 }, { 16, 8, 15, 14, 3, 7, 21, 9, 8, 15, 21, 6, 8, 12, 5, -5, 7, -3, 10, 2, -3, 8, 6, 0, 5, 5, 6, -3, 2, 4, 0, -5 }, { 5, -4, 6, 12, 6, 13, 24, 17, -5, 17, -1, -6, -7, -10, -8, -18, 3, -2, 2, 7, -15, -11, 12, -3, -2, -2, -4, -7, 2, 0, 5, 5 }, { 10, -6, 8, 11, 12, 20, 22, -11, -3, 15, -3, 15, -2, -2, 0, 2, 5, -8, 4, -5, -9, -4, -1, 2, -1, -3, 1, 3, 13, -1, 9, 7 }, { -5, 8, 5, 11, 14, -5, 14, -9, 2, 35, 8, 15, 1, -2, 2, -2, 4, -9, -3, -14, -12, -2, -2, -4, -2, -8, -3, 1, -6, 3, 10, 0 }, { 16, 0, -6, 15, -3, 4, 4, 3, 3, 20, 5, -4, 10, 9, -9, -3, -10, -2, -7, 11, -11, -10, 17, -1, 3, -15, 2, 9, -15, -10, 16, 10 }, { 14, 4, -7, 19, 3, 0, 19, 8, 16, 34, -9, 6, -13, -1, 6, 5, -1, -2, 4, 3, 2, 1, 1, -1, 0, -7, 2, -1, 1, 0, 6, -1 }, { 1, 6, 9, 13, 9, 10, 15, 16, 10, 18, 13, 17, 3, -1, -7, 2, -15, -11, -10, -4, -13, -6, -17, -13, -6, -14, 1, -10, 6, 4, -1, -1 }, { 13, 1, 7, 10, 14, 13, -7, 5, 5, 28, 14, 14, -2, 2, 3, -3, -13, -4, 10, -9, 19, -4, -3, 4, -5, -5, 0, 5, -5, 0, 3, -4 }, { 1, 0, 6, 22, 9, 18, 18, -3, 5, 10, 12, -2, 1, -3, -8, -12, 9, -10, -7, 1, -1, 19, 0, 2, -8, -11, -10, 9, 6, 11, 0, 3 }, { 10, 11, 19, 44, 0, 14, 1, -7, 6, 22, 2, -1, 9, 2, 0, -4, 4, 0, -6, -6, 3, 0, 0, -2, 2, -5, 1, -2, 0, 1, 1, 1 }, { 5, 7, 0, 32, 30, 26, 5, 4, -7, -3, 15, -6, 3, -10, 7, 6, -8, -7, 2, -13, -5, -1, -3, 7, 3, -2, -8, 0, 6, 4, 5, 0 }, { 9, 8, -2, 4, 2, 11, 4, 29, -5, 14, 8, -5, -14, 8, 0, 9, 8, -10, 5, -15, -6, -9, 9, -1, 18, -16, 9, -21, -3, -13, -2, 8 }, { 25, 7, -9, 23, 20, 18, 6, 16, -9, 8, 8, -5, 11, 13, -8, 7, 4, 10, -2, -1, -7, -9, -7, -9, -4, 1, 1, -5, -10, 8, 4, -5 }, { 9, 2, 16, 14, -5, 14, 1, 0, -21, 17, -1, 9, 12, -3, -3, 4, -4, 14, 10, 3, 0, -10, 7, 4, 4, -11, 2, 4, -1, -3, 9, -1 }, { 17, 8, 11, 26, 15, -3, 14, -1, 12, 9, 10, -8, 8, -18, -11, -3, -14, -7, 7, -3, -3, -4, 1, -7, -3, 2, -3, 16, 10, 0, 9, 6 }, { 9, 8, 3, 8, 18, 14, 11, 1, 10, 6, 1, -4, -16, -2, 14, -2, 1, 8, 12, 14, 3, -3, 8, 8, 12, -15, 3, -3, 3, -2, 14, 10 }, { 22, -3, -11, 13, -7, 11, 4, 11, 3, 14, 0, -6, -2, -9, 4, 2, -2, 0, -5, -27, -10, 3, -1, 5, 8, -24, -3, -11, -3, 2, 11, -1 }, { 19, 2, 8, 36, 5, -6, 3, 15, -3, -4, -5, 14, -10, 1, -12, -10, -3, -4, 3, -2, 1, -8, 4, 3, 5, -3, 0, 4, 8, -2, 8, 4 }, { 8, 14, 15, 9, -4, 10, 5, 11, 9, 10, 8, 9, -15, 15, 6, -8, -10, -13, 5, -8, -20, -13, -6, -11, -1, -3, -6, -4, -1, 0, 13, 15 }, { -2, -1, 9, 12, 2, 2, 13, 3, -23, 33, 15, 2, -4, -1, 3, 8, 8, 6, 6, -7, 8, 6, 9, -1, 3, -8, 0, -4, 1, -8, 11, -1 }, { 6, 5, -6, 16, 2, -3, 31, 21, -9, 12, 0, -1, -4, 1, -12, 3, -13, -18, 2, -11, -9, 2, -8, -6, 11, -3, -1, 0, -1, 0, 13, 5 }, { 5, -1, 2, 0, 25, 5, 10, 16, -5, 21, 14, 12, 13, 2, -5, 5, 5, -3, -2, -14, 0, -12, 7, 11, -1, -7, 19, -1, -1, -1, 8, -1 }, { 10, 7, 3, 11, 0, 8, 22, 3, 3, 19, -4, 12, 15, 9, 5, 15, 2, 1, 2, -10, -10, 0, 2, -1, 0, 1, -12, -1, 21, 16, 9, -7 }, { 11, -4, -5, 24, -7, 11, 20, 11, -15, 18, 5, -13, -15, 0, -5, 9, 1, 0, -1, -9, 4, -8, 6, -8, 1, -2, -7, 20, 9, 3, 9, 3 }, { 20, 0, -12, -6, 9, 31, 9, 12, 8, 27, 15, 7, -16, 5, -3, -7, -1, -9, -2, -7, -3, 4, -8, -3, 3, -6, -2, -2, -3, -6, -1, 2 }, { 6, -6, 48, 8, -3, 19, 12, 11, -7, 2, 3, 0, -1, 1, 8, -4, 4, -6, 0, -4, -4, -3, 3, 6, 3, -13, -8, 5, -3, -7, 8, 5 }, { 7, -2, 6, 11, 12, 2, 14, 4, -5, 12, 2, 9, 4, 2, 0, -1, 2, 0, -15, -9, -16, -2, 8, -17, -5, -22, -19, -5, -1, -10, 1, -2 }, { 11, -9, 3, 12, 6, 6, 1, 17, -6, 19, 14, 7, -7, -1, -1, -9, 9, -11, -17, 0, -6, 16, 0, 1, 9, -24, 3, 3, -9, -3, 3, -2 }, { 9, 0, 1, 8, 1, 7, 2, -5, -3, 8, -1, 7, 2, 6, -3, -6, 5, -2, 6, -2, -4, -3, 0, -3, 13, -50, 1, -2, 2, 4, 4, 3 }, { 7, 0, 26, 21, -4, 2, 17, 8, 7, 11, -7, 1, -1, -15, -1, -15, -11, -4, -17, -4, 1, -7, 3, 6, 3, -9, 2, 3, 6, 10, 6, 12 }, { 1, -2, 2, -1, -10, -4, 6, -3, -5, -2, -8, 2, 2, 2, 8, 0, 1, 1, 6, 0, 11, 13, 3, 4, 0, -12, 11, -5, 19, 20, 2, 5 }, { 5, 3, -13, -2, 1, -12, 11, -7, -12, 7, 10, 0, 7, 0, -2, 4, -6, -9, -11, -12, -23, 12, 10, -3, 0, 6, 19, -1, 24, 18, 9, 12 }, { 6, -3, 2, 5, 2, 2, -2, -5, -8, -11, -4, 3, -8, -4, 5, -3, -16, -4, 3, -12, -4, 3, 32, 7, 2, 8, 32, -18, -1, 12, 1, 7 }, { 0, -8, -1, 0, -8, 7, -8, -1, -1, 4, -12, -1, 3, 0, 1, -18, 8, 8, -14, -10, -11, 19, 9, 5, -7, 6, 8, -4, 26, 12, -1, 6 }, { 3, 5, -14, 7, 14, 8, 20, -13, -16, -10, -2, 17, -7, 4, -8, -9, 14, -5, 3, -4, -12, 7, 14, -10, -19, -20, 35, 8, 13, 14, -2, 9 }, { -2, -4, -1, 1, -3, 0, -1, 1, 2, 2, 6, 0, 0, 4, 5, -2, 3, 3, 3, -2, -7, -3, -3, -1, 6, -2, 29, 22, 13, 34, 0, 14 }, { -3, -9, 3, 1, 5, -4, 2, 0, 7, -9, 0, 2, -5, -3, 0, 6, -1, -1, -1, 2, 2, 4, 8, 7, 20, -6, 7, 16, 33, 20, 6, -1 }, { -11, 1, -3, -3, -11, 3, -9, -25, -1, -16, 4, -8, 15, 1, -2, 7, 8, 23, 2, 18, -13, 16, 3, -7, 6, 3, 16, -8, 12, 16, 3, 4 }, { 0, 5, 5, -5, 1, -1, 2, -3, -2, 1, -13, 2, 2, 10, 6, 7, 18, 18, 7, 9, 8, 9, 21, 14, 7, 12, 15, 14, 15, 12, 11, 5 }, { 1, -5, 11, -2, 17, 8, 3, 0, -1, 6, 11, -7, 6, 6, 7, 5, -15, 14, 1, 11, 4, 10, 12, 1, 2, 4, 30, 1, 11, 1, 6, 13 }, { 2, 4, 3, -7, 5, 8, -11, 7, -5, 9, -10, 6, 8, -10, -3, 10, 1, -29, -4, -26, 5, -8, 13, 4, 3, 6, 35, 1, 3, 6, 3, 0 }, { -2, 1, 0, 0, -1, -3, -7, -3, -9, -3, -1, -6, 3, 4, 4, 0, 5, -1, -2, -2, -1, -4, -10, 8, 0, -6, 10, -4, 46, 12, 2, 28 }, { 4, -1, 4, 1, 0, 4, -2, -2, -2, -1, 2, -4, 1, 5, 0, -3, 1, 1, -2, 0, 1, -2, -1, -1, 3, -6, 35, -11, 13, 53, -3, -1 }, { -5, -2, 0, -13, -16, 5, -12, -11, 1, -30, 3, -18, -24, -8, -5, -19, 1, -3, -8, 7, -7, -8, 15, -19, 4, 10, 30, 24, 6, 1, -9, 10 }, { -4, 8, -7, -4, -6, 12, -1, -9, -4, 2, -9, 3, 2, -2, 4, 2, 22, 9, 4, -5, 0, 5, -2, -9, -3, 1, 18, -12, 18, 16, 4, 16 }, { -5, -8, -3, -5, -3, 6, -7, -3, -2, -5, -3, 1, 2, 2, 4, -6, 10, 3, 12, -3, 20, 0, 27, -4, 16, 5, 18, -3, 23, 4, 12, 11 }, { 0, 1, 0, 1, -2, 1, 2, 1, -1, 0, -2, 2, -2, -4, 1, -2, -2, -1, -5, -2, 0, 0, -2, 2, 9, 7, 63, 5, 12, -1, 1, 0 }, { 4, -3, -7, -5, -11, -5, -12, -10, -10, -12, -15, -12, -14, -14, 1, 1, 10, -10, 16, 6, 2, 9, 11, 9, 9, 8, 12, -1, 13, 12, 6, 3 }, { 7, -3, -2, 4, 6, -8, 2, -3, -12, -5, -9, -8, -10, 15, -2, -4, 8, 9, 7, -13, -18, 34, -5, 7, 12, 22, 16, -11, 13, 25, -15, -11 }, { -3, -2, 0, -4, 1, 0, -3, -13, -7, 13, 12, -7, -10, 13, 19, 6, 16, 15, -12, -15, -3, 34, 1, 5, 1, -9, 11, 21, 8, 17, -5, -6 }, { 3, -5, 0, -4, 0, 4, -11, 4, -7, -3, -1, -8, 3, -2, 2, 1, 11, 5, 6, 14, -3, 2, -4, -7, 0, 31, 15, -2, 24, 11, 5, 4 }, { -1, -4, -9, 5, -8, -18, -4, -9, -20, -18, 7, -14, -16, 3, 8, -3, 29, 11, -13, -13, 7, 1, 17, 6, 6, 21, 11, 1, 14, -8, 2, 5 }, { -3, 8, -10, -6, 12, 2, 1, 3, 3, 3, 3, -6, -8, -14, 15, -5, 16, 4, 16, 0, 7, -1, 0, 16, 2, 1, 22, 4, 19, 13, -11, 1 }, { 2, -3, 10, 20, -4, -1, -8, 5, -8, -9, -6, -2, -4, -7, 8, -10, 0, 8, -6, 1, -8, 14, 13, 5, 17, -6, 26, -1, 7, -1, 0, 12 }, { -4, -7, -31, -2, -7, -1, 5, -5, -5, -12, 4, -7, -6, 3, 15, -2, 5, -2, 7, -1, 10, 7, 8, -1, 14, 20, 14, 9, 16, 16, 8, 24 }, { -7, 0, -3, -6, 1, 3, -13, -6, -4, -4, -5, -9, -1, -10, -4, -8, 2, 0, -1, 1, 24, 24, 21, 31, 5, 2, 11, 12, 7, 4, 3, 6 }, { -3, -5, 6, -4, -3, -1, 2, -1, -2, 1, 0, -8, -1, 2, 0, -4, 6, 22, -1, -5, 8, 12, -1, -2, 28, 27, 20, -27, 14, 1, 2, -3 }, { 1, -5, -2, -2, 6, -2, 9, 1, -2, -5, 3, 4, 11, 5, 2, 8, -3, -1, 1, -2, -3, -5, 5, 8, 49, 12, 8, -3, 9, 20, 12, 17 }, { -6, 0, 1, 7, 0, 9, -2, -4, 8, 0, -2, -10, 0, 7, 21, -1, 0, 1, 17, -7, -5, 2, 4, 16, -2, 17, 14, -20, 15, 14, 4, 15 }, { 0, 3, -4, 9, -4, 0, 6, 4, -6, -6, -5, -7, 2, -9, -10, -2, -5, 0, -3, -21, 9, 14, -11, 13, 29, 2, 25, 4, 22, -1, 2, -3 }, { 2, 12, -11, 2, 16, 9, -4, 7, 1, -10, -15, 11, -4, 3, -2, 4, 4, -5, -10, 1, 4, 19, -15, 6, -4, -2, 30, -7, 11, 21, -12, 5 }, { -2, -3, -2, 4, -1, -5, -3, -7, -5, 1, 0, -6, 1, -6, 7, 0, 8, -7, -3, -2, 2, 14, 2, -3, -26, -1, 26, 22, 32, 1, -2, 6 }, { 1, -38, -1, -20, -2, -3, -6, -4, 2, 2, 7, 0, 3, 5, 3, 10, 6, 1, -3, -5, 7, 5, -5, -4, 8, 3, 1, -14, -1, -9, -5, -4 }, { -5, -26, -7, -19, -10, -5, -11, 5, -11, -25, -8, -14, -9, -16, -8, -6, -17, -14, -1, -1, 6, 2, 2, 2, 3, 0, 2, 8, -8, 3, 0, -3 }, { 17, -49, -3, -23, -1, 11, 7, 3, 4, -4, 0, 0, -1, 4, 2, 4, -2, -4, 2, -2, -1, -2, 2, 0, 0, -1, 0, 0, 1, 2, 0, 0 }, { 4, -34, -6, -9, 1, 21, -7, 3, -2, -1, -3, 18, 2, -16, 7, -3, 8, 7, -5, 7, 2, 4, 8, -6, -7, -2, -5, -1, 4, 1, 2, -4 }, { 5, -29, 13, -2, -14, 3, 1, 18, -15, 4, -8, 8, -10, 8, 2, 1, -8, 15, 3, -10, -4, -4, -2, 0, -3, -4, 2, -3, -4, -3, 12, -6 }, { 13, -20, 3, -18, -17, 4, -14, 13, 28, 11, -8, -6, 16, 6, 0, 10, 3, 4, -9, 13, 5, -7, 12, -5, 0, -7, 5, 1, 3, 3, 2, 1 }, { 3, -27, -5, -11, -21, -11, -12, 0, -5, 7, -22, 1, 3, 5, 0, -5, 8, 7, 1, -5, -7, 2, -5, 4, 1, 3, -8, -2, 0, 4, -2, 6 }, { 31, -45, 0, -1, -12, 1, 2, -6, 4, 3, -1, 3, 3, 0, 5, 3, -5, 12, 4, 6, 2, 1, -2, 1, 3, 2, 5, 2, 2, 2, 3, -1 }, { 9, -45, 6, 5, -1, -17, -2, 18, -3, 2, 0, 1, 0, -1, 10, 8, -7, -2, -5, -8, 6, -1, 0, 4, 6, -3, 12, -1, -2, 0, 5, -7 }, { 3, -26, -2, -12, -12, 2, -10, 16, -3, 12, 4, 5, 11, 8, -16, -17, -2, -3, -3, 2, 5, -9, 13, 1, 10, 11, 3, 5, -2, 2, 2, -7 }, { 8, -26, 32, -7, -5, 22, 2, 14, -10, -8, -7, 3, 3, 7, 0, -5, 0, -1, -3, 0, 8, 4, -5, -7, 6, -1, 4, 8, 1, 1, 7, -6 }, { 4, -31, 2, -14, 2, 0, 1, 8, -6, -1, 17, -3, 13, -6, 5, -10, -2, -10, -2, -10, -3, 7, 1, 5, -8, 8, -14, -3, -15, 7, -10, -6 }, { 16, -27, 13, -4, -23, 7, -9, 6, -7, 5, 4, 2, -1, -3, 23, -18, 7, 0, -3, 4, -3, 9, -6, -2, -1, 8, -6, 2, 6, -3, 2, -2 }, { -1, -35, -2, -8, 11, -1, -7, -3, -2, 11, 7, 6, -6, -10, 9, 6, -3, -5, -6, -3, 9, 16, -16, -9, -20, 12, 3, 5, -3, 1, -9, 4 }, { 2, -24, 1, -12, -16, 5, -4, 3, -4, -1, -11, -11, -8, -14, 14, 10, -8, 20, 8, -3, -11, 1, 1, -4, -4, -7, -3, 15, 2, -6, -2, 7 }, { 9, -21, 2, -19, -7, -5, -8, 25, 3, 17, 5, -3, 9, -12, 8, 2, -4, 3, 3, 1, 11, -9, -4, -3, 4, 3, -22, 6, 4, 6, 11, -5 }, { 16, -23, 13, -17, -21, -12, 5, 9, -20, 7, 6, -6, 0, 2, -9, 6, -6, -13, -7, -1, 5, -3, 5, -7, -10, 1, 0, 8, -9, 11, 0, -8 }, { 10, -26, -9, -7, -19, -4, 6, 16, -7, 5, -4, 4, 8, 0, 4, -1, 6, -7, 1, -8, -11, 10, -14, 0, -16, 6, -3, 5, -1, 14, 12, 1 }, { 8, -27, 12, -14, -1, -1, -19, 10, -11, 21, -14, 9, -8, -3, 8, -1, 12, -13, 3, -4, -2, 0, -9, 0, -7, 2, -3, 12, 1, -3, 3, 1 }, { 18, -20, -14, -14, -16, -3, -24, 6, -17, 2, -3, -11, 2, -3, 12, 10, 10, 1, 10, 7, 8, 5, 5, 4, -1, 7, 2, 2, 0, 4, 7, 0 }, { 0, -30, 9, -16, -18, 15, 12, -3, 4, -4, -5, -11, -4, -12, -10, 0, 2, -2, -4, -1, 2, 0, -1, -6, 2, -3, 4, -5, 7, 3, 5, 7 }, { 25, -24, -1, -6, -9, 6, -13, -2, 3, 15, -3, 11, 4, -8, -11, 2, 0, -9, -2, 7, 4, 8, 5, -8, 5, 6, -1, -11, -15, -5, 0, 11 }, { 0, -34, -7, -11, -7, 9, -3, 19, 4, -8, 3, -11, 11, -3, -9, 12, 9, 9, 2, 1, -7, 1, -3, 0, -6, -2, -1, 3, 0, -7, -2, -5 }, { 6, -34, -4, -5, -3, -9, 2, 9, -1, 9, -5, -3, -26, -12, 8, -6, -7, 11, -8, 4, 4, 1, -1, 0, 8, 9, -4, 7, -1, 1, -3, -1 }, { 3, -30, 5, 6, -10, 3, -7, 6, 3, 3, -26, -19, -3, 1, 7, 5, -4, -5, 6, 10, 13, -10, 4, -7, -4, 5, -3, 9, -6, 3, 9, 5 }, { 4, -24, 9, -19, 2, -4, -5, 8, -3, 2, 0, -15, -1, 9, -4, 22, 6, 9, 3, 7, 11, -9, 0, -3, 4, 5, -5, 10, -8, 5, -7, -3 }, { 8, -27, 7, -3, -1, 2, -9, 13, 7, 12, -4, -6, -6, 5, 0, 7, 5, 1, 15, -3, -4, 0, -5, -2, 7, -5, -7, 1, -2, 13, -8, 13 }, { 17, -22, -15, -11, -8, 16, -14, 18, 2, -1, 14, -7, 14, -6, -6, -7, -8, 17, 6, 4, 4, -7, -5, -9, -14, -6, -1, 9, -3, 1, 6, -5 }, { 25, -30, 2, -12, -13, 18, -18, 16, 8, -3, 10, -8, -3, -1, -6, 3, -5, -7, 4, 6, 7, 1, 1, -11, -5, 6, 2, -4, 9, -1, -5, -2 }, { 7, -23, 7, -15, -1, -3, -1, 0, -10, 12, 2, 5, -4, 0, 4, 6, -1, 5, -9, -1, -1, -7, 1, 17, 9, -17, -16, 8, 4, -14, 11, 14 }, { 0, -31, 7, -13, 3, -11, -7, 6, 1, -11, 8, -7, 15, -3, 16, -11, -1, -15, 16, -3, 5, 0, -2, -2, -6, 11, 5, 6, 5, -5, 6, 3 }, { 13, -24, -2, -20, -10, 7, -3, -1, 15, 2, 6, -5, -7, -10, -20, 1, -4, 14, 8, -2, 3, -13, -3, 1, -4, 1, -3, 2, 8, -7, 16, -4 }, { 1, -2, -2, -3, -4, -7, 0, 3, 6, 7, 3, 2, 1, -2, -1, 0, -6, 4, 2, -4, -3, -4, 5, 9, 5, 0, -3, -3, -4, -7, -31, -50 }, { -1, -3, 7, 2, -1, 2, 4, 6, 0, 10, -2, 0, -20, -6, -3, 9, -20, -22, -1, -1, 15, 9, -12, 10, -13, -20, 12, 3, 5, 6, -7, -26 }, { 0, 4, -2, -14, -12, 6, -13, 11, -10, 3, 22, 6, 16, -2, -5, 1, -3, -11, 0, -7, 5, -5, 0, 1, -1, -6, 8, 8, 10, 9, -5, -27 }, { -5, 10, -2, 7, 9, -9, 5, -9, 5, 4, -15, 14, 1, 3, -10, 5, 0, -2, 7, 3, -13, 6, 9, -6, 5, -14, -17, -1, 11, 14, -2, -26 }, { 0, 6, -3, 0, -8, 6, 0, 1, 4, -8, 2, -5, 4, 7, 15, 11, 9, 19, -2, 14, -8, 7, -1, 3, -3, -3, -10, -2, 12, -2, -12, -29 }, { -12, -5, 0, -3, -2, 6, 3, -3, 2, -2, 1, 11, 2, -7, 5, 1, 2, -2, -14, 0, -1, -5, 3, 8, -28, -26, 6, -6, 3, 8, -10, -27 }, { -1, -3, 6, 2, 4, 15, 1, 0, 2, -2, -2, 13, 3, 6, 0, 6, -1, -4, -1, -5, 8, -1, 5, -5, -15, 11, -8, -5, 14, -6, -14, -29 }, { -5, -6, 0, 1, 0, 6, -3, 2, -5, -1, 5, -3, 2, -10, 3, 4, 3, 0, 13, -3, -1, 4, -4, -6, 2, 9, 8, 2, -3, 28, -11, -31 }, { 1, -4, -10, -9, -4, -3, -15, -6, 1, 5, -3, -6, 5, -6, -22, 27, -13, 5, 3, -7, -4, 20, -7, -12, -1, -24, -4, -13, -8, -11, -15, -21 }, { -6, -4, 19, -6, 2, 11, -6, 1, -3, -10, 9, -9, 12, -10, 2, 1, -9, 1, 15, 7, -5, 5, -29, -35, 4, -30, 9, 9, 19, 17, 2, -17 }, { -3, 3, -3, 1, 2, 5, -1, 5, -2, -3, 1, -3, -8, 3, -4, -2, -4, -1, 12, 0, 2, -8, -6, -4, 16, -1, -14, -2, 25, -6, -15, -36 }, { 0, -1, 3, -4, -4, -1, 7, -4, 8, 0, 10, 9, -4, 1, 10, -1, -3, -13, -5, -4, -1, -4, 8, 11, 14, -7, -5, 16, 12, 13, -1, -28 }, { 1, -2, 2, -3, -8, 10, 4, 9, 12, 3, 5, 0, 8, -3, -6, 2, 16, -11, 11, 0, 1, 6, 1, 18, -10, -16, -1, -4, 5, -14, -15, -20 }, { 1, -12, 5, 4, -7, 8, -1, -17, -2, -9, -14, -11, 6, -9, 5, -4, 3, -2, 7, 18, -5, 5, 6, -1, -11, -2, -10, -3, 8, -3, -2, -32 }, { -12, 5, 20, -5, -6, -11, -6, -6, -13, 4, -6, 19, -8, 2, 3, -9, -4, -4, -1, 9, -1, 21, -1, 7, 15, -10, -1, -3, 9, -3, 2, -24 }, { 0, -3, 2, -6, 4, -1, -9, -2, -1, -3, 6, -1, -5, -6, -5, -8, 0, -2, -6, 9, -4, 3, 2, -13, 1, -7, 23, -13, 4, -3, -15, -33 }, { -7, 2, -15, 11, -10, 14, 0, -11, 3, -1, 12, -4, -4, 9, 11, -13, -13, -3, -14, 1, 3, 6, -5, 8, 0, 5, 5, -10, 4, 5, -6, -30 }, { -6, 4, 0, -5, 4, 1, -1, -1, 3, 6, 5, -2, -5, 0, -2, 5, -4, -2, -4, -2, 4, 7, -7, -1, 1, -4, -3, -19, 37, 12, 10, -40 }, { -7, 2, -7, -12, 17, 11, -7, 2, 2, 3, 1, -1, 3, 4, -2, -5, 9, -9, 6, 4, 9, 12, 11, -5, 2, -1, 0, 9, 5, -7, -2, -24 }, { -7, 6, 1, 3, 1, 0, 6, 0, 4, -12, -2, -2, 1, -9, 10, -2, 11, -1, 21, -12, 15, -5, 10, -5, 5, -5, 14, -6, 5, -7, -3, -29 }, { -2, 0, -5, -2, -3, 1, -3, 0, 4, 2, 3, 0, 2, -2, 7, -2, 3, -5, 2, -1, 6, -4, 0, -3, 8, -11, 19, -8, 22, -34, 13, -35 }, { -1, -3, -1, 9, 11, -3, -3, -1, 7, 18, 11, -5, 2, -12, -11, 18, 9, -5, 1, -6, -9, 12, 1, -3, -3, -9, -14, 9, 9, 8, -6, -26 }, { 0, 5, -5, -1, -1, -2, 4, 6, 8, 2, -1, -2, 5, 1, -5, -4, 1, 1, 18, 1, 7, -10, 3, -2, 12, -1, -15, 9, 12, -14, 13, -38 }, { 3, 0, -8, -1, 0, 8, -9, -3, -8, 16, 3, 16, -5, -9, 0, -1, -7, -1, -4, 13, 7, 0, 1, 2, -1, -16, 0, -2, 1, 8, -8, -28 }, { 7, 9, -5, -3, -2, 2, 0, 3, 11, -6, -4, -2, -2, -5, 28, -18, -6, 2, 15, -10, -15, -10, -2, 0, -2, -2, 4, -3, 7, 11, 5, -30 }, { 9, 0, -7, -1, -4, -7, 2, 2, 9, -2, 2, 3, -8, -6, -6, 3, -10, 4, 10, 5, 21, -4, 14, -18, 1, 3, -10, -2, 6, 14, -8, -26 }, { -14, -1, 2, 3, -3, 7, 1, -22, -1, -1, 0, 1, 12, -14, 3, -5, 0, 10, -3, 1, -5, 12, -3, 10, -8, -22, -11, -13, -7, -10, -13, -25 }, { -2, -5, -4, -4, -9, -18, 9, -3, -5, 17, 13, 5, 6, 11, 3, 8, 20, 4, 2, 9, 8, 5, 6, 1, 7, -7, -6, -2, -7, 0, -17, -23 }, { -5, -5, 2, 0, 6, 2, -2, 2, -3, 4, 4, 0, -5, -2, -4, 6, 8, 10, -1, 1, -5, 5, -14, -2, -11, 8, 6, 25, 7, -1, 0, -43 }, { -4, 0, 4, -2, 7, 0, 3, 17, 5, 2, -5, 1, 21, 3, -2, -10, -16, -9, 7, -12, 9, -8, 2, 5, -5, -10, -2, -11, -5, -1, -9, -30 }, { -2, 3, 1, -4, -1, 0, 8, 1, 12, 4, -1, -1, 3, -17, 13, 9, 0, 7, -6, -5, 9, 1, 5, 4, -10, -18, 0, 14, 11, -4, -16, -28 }, { -1, 0, 2, -1, 4, 1, -1, 1, -1, -2, -1, -2, 3, 0, 0, -1, -1, 1, 2, -2, 3, 3, -2, 4, -2, -1, -6, 1, -1, -1, 6, -70 }, { 7, 3, -11, -1, 12, -4, -14, 4, 4, -4, 4, -2, 2, -12, -4, 15, -17, -4, -3, 6, 8, -5, 22, -22, 5, -11, 15, -4, 4, -1, -21, -1 }, { 10, -2, -13, 11, 4, 14, 4, 9, 8, 8, 19, 15, 14, 15, 5, 10, 8, 15, -5, 4, 14, -8, 1, 1, 2, 1, -1, -3, 21, 8, -29, 13 }, { -6, 0, -6, 6, -1, 2, 8, -4, -5, 4, -4, -5, 0, -2, -4, 0, 9, -2, 1, -2, 26, -19, 21, -10, 4, 1, -8, 5, 22, -10, -13, 15 }, { 11, -5, 1, 0, 6, 3, 7, -2, -2, -3, -5, -1, -2, -6, 1, 1, -8, -5, -13, 13, -2, -3, -1, -9, -28, 4, 2, -11, 18, -20, -24, 9 }, { 7, 4, -3, 6, 6, -6, -7, -5, -7, -4, -4, 0, -7, -5, -6, -5, 2, -13, -12, 2, 0, 5, 18, 15, -13, -7, 13, -20, 16, -10, -19, 6 }, { 5, -8, -1, 5, 10, 2, -1, -10, -11, 23, 8, -5, -8, 4, -5, -4, -5, -5, -11, -8, 5, 1, 7, -9, -9, -6, 12, 14, 17, -12, -22, 3 }, { -5, -8, -3, 3, 12, -1, 0, -4, -5, 1, 1, 6, 1, 5, -5, 7, -2, 7, 1, 6, 6, 2, 0, -5, 17, -4, -5, -24, 13, -20, -27, 14 }, { -1, 2, -3, 1, -3, 1, -3, 0, -2, 3, -2, 1, 2, -1, -2, -1, -2, -5, 5, -2, 0, -7, 1, -6, 8, 8, 11, -5, 24, -43, -13, 2 }, { -2, 4, 7, -3, -4, 4, 13, -4, 0, 0, -2, 9, 0, -3, -6, 1, -7, 1, -1, 10, 0, 5, -1, -24, 25, -15, 7, 2, 22, -10, -21, 0 }, { -5, 2, 6, -2, 13, 3, 5, -12, -11, 16, 6, 10, -5, 0, -3, 6, 5, -5, -5, 10, 12, 10, 11, -7, 8, -14, 2, -15, 13, -14, -8, -3 }, { 5, 6, -7, -5, 5, 2, 9, 5, 0, -1, -4, 2, 8, 0, 3, 5, -12, 3, -3, -6, 2, -1, -5, 14, 11, -20, -21, -25, 24, -1, -10, 6 }, { -5, 5, -2, 9, 4, -4, -1, -6, 11, -6, 5, 0, 2, -3, 6, -1, -17, -18, -4, -13, 9, -1, 9, -7, -4, -8, 2, -3, 12, -31, -18, 5 }, { -7, -11, 6, -8, 4, -3, -12, 0, -1, -6, -3, 0, 5, 9, 7, 2, 1, -8, -6, 8, 2, -5, 7, -1, 16, -10, 16, -12, 18, -1, -25, -12 }, { 3, -12, 1, 2, -2, -18, -8, -15, -10, -9, 2, -7, 11, -11, 2, -1, -1, -1, -9, -6, 3, -14, -2, -1, 2, -13, -7, -9, 19, -5, -17, 2 }, { 7, 1, -8, 7, 17, -13, -10, 5, 7, 1, -6, 4, 9, -4, 0, 3, 8, 1, -14, -9, 4, 7, -9, 0, 6, -5, -12, -2, 25, -2, -19, 1 }, { 7, -3, 6, -3, 1, 6, -7, 0, 10, 0, 4, -5, -17, -4, 4, -1, 0, -3, -7, 19, 24, -1, 21, 8, 10, 9, 8, -1, 23, -2, -18, -2 }, { 3, -3, 0, 5, 8, -2, -9, 2, 9, 6, 19, 8, 2, 6, -9, -2, -4, -3, -8, 7, -7, -8, 5, 4, 26, -6, 7, 18, 24, 0, -13, 4 }, { 0, -13, -11, -1, 3, -9, 5, 4, -7, 3, 0, 2, -1, 4, -5, 2, 9, -2, -11, 15, 1, -21, 1, -1, 0, 4, -14, -4, 24, -16, -13, 1 }, { 1, -9, -8, 0, 0, -4, 11, -1, 14, 16, 0, 17, -2, -9, -12, 0, -1, -14, -9, -14, 0, -2, 19, 4, 6, 4, 4, -11, 8, -17, -19, -5 }, { -3, 1, 2, 12, -4, -18, -1, -4, -7, 14, -3, 2, 0, -7, -8, 12, -5, -9, 14, 12, -9, -2, 4, -6, 4, 18, -1, -25, 22, 2, -23, -5 }, { -2, 0, 0, 0, 1, 3, 5, -1, 5, -2, -2, 2, -3, 0, 1, 2, 0, -1, 2, -1, -9, -6, -7, -4, -2, 4, -7, -5, 64, -3, -25, 4 }, { 12, -2, -3, 0, 8, -9, 13, -7, 6, -3, -12, 12, 15, -9, -4, 2, 9, -4, -12, 3, 14, 1, 7, -15, 15, 0, -6, -12, 0, -3, -20, 6 }, { 2, -1, -4, 5, 9, 6, -7, 2, -2, -7, -2, 0, -1, -18, -4, -6, -15, -5, 11, 5, -10, -1, 2, 7, 12, -19, -7, 8, 21, -4, -15, 4 }, { 4, 2, 5, 5, -5, 1, 3, 2, -8, 13, 0, -5, -2, -14, -11, 6, 2, 17, 8, -13, 26, -2, 5, -15, -4, -14, 12, -9, 13, -21, -23, -4 }, { 2, -3, -2, -3, 3, -2, 6, 9, -9, 13, 4, 2, 12, -3, -3, 1, -17, -22, -3, 4, 3, -2, 1, -9, 1, -6, 11, -13, 14, 0, -15, 6 }, { -16, -4, 17, -2, -20, -11, 11, 10, 5, -8, 16, 2, -17, -14, 11, 11, -6, -11, -7, 12, 12, -10, -6, 5, 8, -4, -2, -5, 28, 3, -13, 4 }, { 0, -3, 3, -7, 6, 8, -12, 20, -19, 18, -11, 10, -5, 0, -9, 11, 3, 0, -2, 9, -7, -5, 18, 3, -2, -16, 1, 6, 12, -7, -16, 1 }, { 4, 1, 5, -5, 15, 2, -8, 3, 5, -11, 15, -3, 8, -8, -1, 7, 4, 7, -2, 6, -9, 5, 12, 2, 33, -2, -6, -18, 4, 0, -18, 11 }, { 3, -1, 1, -1, 0, 1, 4, -1, -5, 0, 1, 0, 4, 2, -1, 4, -3, 2, 0, -2, 4, 6, -1, 6, 42, 19, -4, -37, 19, 1, -15, -4 }, { 2, 0, -5, 0, 10, 0, 0, -5, 3, 0, 0, -3, -3, 0, 2, -4, -10, 2, -6, 4, 4, 1, 27, -7, 17, -34, 5, -9, 15, -16, -7, -5 }, { -2, 7, 7, -2, 9, -2, -15, 11, 11, 7, 5, 1, 15, 1, -9, 31, 2, -15, 2, 4, 3, 4, -1, -8, 2, -7, 6, -17, 11, -14, -11, 2 }, { 1, 1, -11, 9, 9, -6, -14, -11, -10, 8, -3, 11, 16, -9, -8, -13, -8, 9, 0, 6, 6, -2, 13, -8, -2, 3, 13, -3, 10, -6, -17, 4 }, { 14, 5, 4, -6, -12, 10, -7, 8, 21, -8, -30, 15, -2, 1, 11, -9, -5, 1, 0, -1, -1, -6, -2, 3, -5, 7, 9, 5, -5, 2, 0, 1 }, { -1, 2, 20, -17, -15, 3, 3, 7, 11, -17, -13, -6, -3, 18, 17, -15, -4, -4, -5, 22, 14, -14, -2, -10, -7, 11, 8, -7, -3, 0, -7, 11 }, { 7, -11, -7, -8, -14, 22, 5, 2, 6, 13, -12, -2, 10, 3, 0, -21, -4, 20, 3, 10, 21, -10, -12, 8, 11, 2, -5, 2, 1, 3, -1, 15 }, { -1, -2, -1, -2, -13, 8, -4, 0, 7, -2, -17, 8, 18, 5, 3, 8, -8, -2, 3, -4, 14, -18, -13, 14, 15, -13, -1, -2, 4, 11, 1, 12 }, { 13, -6, -4, -16, -17, 16, 21, -2, 5, -11, -9, 19, 21, -17, -3, -17, 3, 12, 8, -12, -6, 1, -7, 9, 9, -7, -5, -1, -3, 5, -6, -4 }, { 11, 5, 12, -20, -6, 10, 4, 12, 8, -5, -10, 15, 13, 14, 10, -15, -13, 1, 6, 14, 15, -17, -13, 4, -5, 10, 7, -6, -8, -3, -4, 12 }, { 25, -1, 7, -5, -7, 11, 1, 17, 13, -15, -14, -4, 5, 3, 8, -3, -2, 2, 0, 6, 16, -12, -6, -4, 4, -3, 7, -10, -3, -7, -13, 7 }, { -8, 10, -3, -13, 5, 2, 4, 9, 9, -17, -13, 2, 11, 1, 6, -4, 8, -10, 4, 1, 19, -15, -4, 12, 31, 7, -5, -17, -4, 9, -2, 7 }, { 14, -6, -6, -6, -14, 13, 17, -5, 4, -14, -9, 7, 7, -9, 3, -16, -15, 11, 11, 6, 4, -11, -19, 3, 5, 8, 13, -14, -14, 3, -4, 12 }, { -2, -4, 10, -4, -7, -1, 27, 5, 2, -16, -18, 4, 12, -2, -3, -2, -1, 1, -8, -12, 3, -4, 8, 15, 2, 4, 9, -13, -14, 9, -7, 5 }, { 4, 2, -10, -5, -7, 2, 1, 4, -1, -6, -15, 6, 1, 10, 5, -10, -9, -1, 13, -3, 5, -21, -11, 8, 8, 5, 27, -21, -18, -5, -1, 15 }, { 11, 1, -16, -8, -11, 0, 5, -8, -12, -13, -17, 22, 4, -6, -1, -18, -10, 0, 19, 2, -2, -8, -7, -3, 2, -2, -9, -17, -5, 4, 4, 10 }, { 8, -6, -19, -5, -4, 12, 14, 15, 10, -9, -1, -9, 19, 12, 0, -1, 2, 4, 7, 9, 16, -16, -14, 9, -4, 3, 1, 0, -2, 10, -1, -1 }, { 12, -8, 12, -9, 0, 25, 7, 9, 2, -31, -9, -4, 15, 4, -5, 1, -10, 11, 8, 10, 0, -6, 5, 11, -1, -6, 4, -10, -9, 6, 4, 5 }, { 14, 6, -17, -2, 17, 12, -9, 2, 0, -25, -14, 5, 20, 14, 8, -20, 5, 2, -2, -3, 9, -13, -3, -1, -6, 3, 7, -6, 0, 2, 3, 1 }, { 8, 4, -15, -3, 10, 18, -4, 13, 8, -22, -10, 9, 19, -15, 7, -5, -13, 12, -4, 9, 2, -9, -6, 0, 2, 1, -9, -6, 6, 1, -1, 11 }, { 4, 1, 4, -5, -10, 18, 7, 2, -4, -9, -11, 0, 32, -7, 4, -16, -1, 0, 6, 3, 6, -3, -14, 16, 9, -2, 7, -1, 0, -5, 5, -3 }, { -3, 2, 3, -8, -6, 4, 6, 2, 4, -12, -15, 2, 8, 8, 9, -3, -18, 6, 34, 11, 12, -15, -1, 2, 9, 2, -4, -4, 2, 4, 2, -3 }, { 18, -6, -12, -8, -1, 15, 20, -4, -1, -11, -5, 6, 6, -11, -15, -7, 3, 7, 10, 2, 8, -10, -5, 8, 15, -5, 5, -17, -13, 13, 11, 7 }, { 8, -4, -6, -1, -14, -3, 6, -2, 1, -5, -1, 10, 10, -15, 5, 0, -10, -4, -3, 7, -4, -19, -15, 27, 11, 18, 3, -19, -2, 6, 0, 12 }, { 12, 0, -5, 0, 4, -5, 1, 5, 10, -7, -11, 21, 29, 1, -2, 1, -4, -11, -1, 13, 11, -20, -1, 4, 4, 4, -5, 6, -13, -2, 11, 9 }, { 2, -7, -7, -3, -10, -1, 20, 12, 1, -19, -19, -1, 5, 4, -7, -25, 14, 1, -3, 2, 12, -4, -3, -3, -2, 6, 1, 0, 3, 2, 5, -1 }, { 12, -8, 3, -12, -10, 10, 13, 0, 23, -14, -18, 10, 0, 15, 3, -12, -3, -5, 5, -4, 2, -14, -10, 8, 2, 9, -1, -11, -3, 5, 13, 2 }, { 9, -6, 7, -7, -30, 17, 6, 13, 1, -14, 0, -1, 6, -9, 8, 3, -4, 0, -1, -7, -5, -13, -19, -3, -4, 4, -6, -2, -13, 1, -2, 3 }, { 10, 1, 3, -18, -26, 17, 4, -16, 4, -3, -13, -4, -6, -11, -4, -21, 7, 8, 2, 5, 13, -6, 1, 5, 8, 7, 9, -6, -6, 1, -1, 2 }, { -3, -1, 0, -2, -2, 0, -1, 3, 4, -14, -8, -9, 13, 2, 50, -23, -8, 8, 7, 11, 16, 3, -7, 0, -2, 6, 5, -1, 1, -2, 4, 3 }, { 1, 3, 1, 1, -6, 3, 6, 6, 2, -2, -3, 10, 2, -8, -5, -5, 5, 4, 4, -2, 10, -8, -40, -1, 21, 8, 3, -4, -1, 13, 4, 7 }, { 2, 0, -4, -8, 5, 2, 7, -5, 5, -8, -4, -1, 12, 2, 12, -13, -9, 0, 1, -12, 9, -43, 1, -5, 12, 1, 3, 6, 1, -1, 3, -2 }, { 6, -2, -1, 1, 0, 4, 8, 14, 4, -7, -23, -5, 23, -17, -6, -15, -8, 7, 10, -1, 7, -16, 4, -6, 2, 3, -3, -3, -1, 8, -1, 4 }, { 10, 4, -4, 1, 7, -3, 2, 11, 4, -6, -3, 8, 5, 4, 1, -45, -6, -4, 4, 2, 1, -14, -10, 1, 1, 6, 2, -8, -1, -3, 3, 3 }, { 1, -1, 2, -3, -8, 9, 3, 3, -2, -5, -8, 8, 7, -7, -4, -6, 5, -9, 11, -2, 46, -5, -1, 9, -2, 0, 3, -5, -3, -5, 7, 0 }, { -4, 1, -2, -1, -11, 11, 8, -3, -2, -10, 0, 4, 9, 9, -17, -17, -34, -4, -5, -7, -3, -12, -3, 11, 18, 3, -2, -5, -18, -5, -3, 6 }, { 7, -5, -3, 1, -4, -3, -5, -1, 2, 5, -2, 3, -10, 12, -18, -5, -10, 12, -9, 4, -6, 2, 0, 16, -17, 15, 14, -12, -10, -2, -9, -1 }, { 4, -5, -3, -5, -3, -1, 7, 18, -7, 12, 3, 5, -8, -4, -20, 1, -25, 1, -8, 13, -10, 8, -19, -1, -8, 10, 6, -9, -1, 0, 12, 4 }, { -4, 5, 0, -1, 2, 5, -8, -2, -6, 4, -8, 9, 3, 2, -7, 4, -25, 13, -23, 10, 14, 15, -11, 3, -18, 4, 16, -4, 1, -10, -10, 3 }, { 5, -3, -1, -3, 4, 1, -3, -4, -5, 1, -12, 14, -7, 11, -15, 6, -6, 24, -4, 13, -1, 15, -13, 8, 3, 7, -5, 2, 2, 0, 3, -7 }, { -3, 1, 0, 8, 6, -1, 6, 5, -5, -2, -12, 4, 0, -2, -3, 5, -6, 0, -8, 9, -10, 4, -28, 12, -20, 11, -13, 7, -18, 1, -11, 1 }, { 1, -4, -15, 5, 0, -13, -5, 13, -11, 4, -4, -5, 5, -14, -16, 0, -14, 5, -20, 12, 10, -7, -5, 6, 6, 22, 6, -4, -2, 3, 8, 11 }, { 13, -11, -2, 16, 16, -7, 0, 20, -7, -1, 0, 5, -9, 12, -2, -5, -22, 5, -10, 12, -6, 11, 9, 21, -8, 15, 4, 0, -8, -4, -4, 10 }, { 18, -4, -13, 0, 1, -15, -1, -3, 2, 10, -1, 6, 1, -4, -20, -5, -8, 6, -8, 17, -5, 5, -10, 8, -22, 6, -5, -2, 8, -17, 8, 2 }, { 1, -2, -9, 6, -31, -8, -8, 8, 0, 5, -9, -4, 2, 3, -12, 11, -18, 10, -5, 3, -11, 13, -6, 11, -3, 12, -7, 3, -9, -1, 2, 11 }, { -9, -6, 21, -8, -15, 4, -11, 12, -11, 17, -1, 2, -6, 0, -15, 13, -12, 19, 0, 2, -6, -3, -9, 10, 3, 17, -2, 5, -10, -3, 0, 1 }, { 4, -6, 5, -10, 1, -5, 1, 0, 0, 0, 2, 7, -2, 2, -2, 0, -4, 3, -4, 1, -12, 6, -49, 16, -10, 13, 0, -2, 8, 6, 1, 8 }, { 5, -8, -7, 9, 13, -5, 7, 0, 10, 11, -4, -3, -1, 13, -14, 6, -15, -6, -14, 16, 15, 1, -18, -4, -20, 20, -7, -1, -9, -2, -10, 10 }, { -12, 4, 0, 10, 0, 3, 8, 4, -27, -1, -2, 19, -4, 2, -13, 3, 1, 9, -12, 1, -22, 19, -5, 4, -9, 12, 2, -9, -8, 11, -3, 7 }, { 4, -5, 11, -6, 17, -17, 5, -4, -2, -6, 1, -5, 2, 4, -14, 6, -20, 19, -20, 12, -21, 5, -14, 13, -2, 11, 4, -3, 0, -10, -4, -2 }, { -2, -1, -3, 8, -9, -7, -22, -3, -24, 13, -2, 10, -15, 5, -9, 4, -7, 0, -5, 15, -8, 11, -13, 6, -4, 19, -8, 12, -4, 6, 9, 7 }, { 2, -3, 2, -1, 0, 3, 1, 2, 1, -4, -2, -3, 1, 5, -12, 6, -16, 14, -23, 10, -14, 17, -15, 16, -2, 9, -25, 9, -10, 16, 4, 9 }, { -3, 7, -8, -3, 2, 2, -4, -8, -9, 10, 3, -11, 25, -10, -28, 27, -9, 7, -13, 9, -2, 4, -12, -8, -14, 6, 7, -10, 3, 3, -3, 5 }, { -8, -3, 1, -10, 8, -3, -9, -4, 13, 7, 2, 4, -10, 4, 3, 7, -18, 2, -22, 15, 4, 20, -7, 5, -6, 13, -1, 4, -7, -6, 6, 13 }, { -2, 3, 0, 2, -4, -2, 0, 0, 1, 2, -2, -5, 0, 1, -4, 0, -2, -3, 1, 2, -1, 2, -8, -1, -24, 68, -3, 8, 3, 3, -1, -1 }, { -15, -2, -9, -7, -1, 8, -14, 8, 3, 6, 0, -1, -8, 8, -23, 2, -14, 17, -15, 8, -4, 7, -18, 0, -8, -3, -1, -4, -10, 4, -1, 4 }, { 8, 0, 2, -7, 0, 5, 1, 3, -11, 4, -8, 14, 3, 20, 1, 26, -11, 13, -13, 20, -2, 0, -8, 2, -6, 6, -1, 9, 3, -6, -3, 10 }, { 5, 0, -1, -7, 10, 1, -3, 5, 4, 7, -5, -1, -3, -1, 12, -3, -15, 7, -9, 22, -19, 8, -9, 4, -23, 13, -14, 6, -6, -14, -4, 7 }, { 14, -5, -8, -10, 25, 3, -23, -7, -28, 0, -1, -9, 4, 1, -13, 20, -8, 10, -16, 8, 12, -13, -21, 5, -13, 11, -2, 1, 12, -7, 2, -10 }, { -5, -4, 9, 5, -6, 35, -7, 8, 15, 2, -1, -9, -6, 2, -18, 7, -15, 6, -3, 2, 8, 12, -30, 7, -4, 20, 2, 6, 13, -6, -4, 0 }, { 1, 8, -9, 9, -5, 12, -9, 16, -9, 16, -17, 14, -13, 15, -18, 14, -15, 17, -12, 14, -13, 7, -16, 13, -9, 5, -11, 10, -9, 6, -12, 13 }, { -10, -4, 5, 3, 1, 6, 8, -14, -5, 15, 7, 4, 8, 7, -22, 8, -7, -8, -15, 26, 1, 13, -3, 17, -5, 9, -2, 4, -6, 3, -8, 9 }, { 8, -3, 2, 3, 3, 1, -2, -1, -11, 8, -4, 0, -6, -5, -1, 13, -37, 9, 1, -6, -10, -2, -10, 11, 8, 13, -3, -2, -6, 8, -4, 13 }, { 3, 2, -3, -4, -4, 7, -8, 9, -8, 9, -20, 12, -19, 15, -18, 17, -15, 7, -1, 20, -11, 6, -6, 3, 1, 9, 2, -14, -2, -2, 2, 1 }, { -7, 1, -1, -3, -6, 4, 4, -3, 3, -1, 5, -4, 3, 2, -1, 9, -59, 5, -4, 30, 3, 3, -2, -3, -1, 2, 2, 1, -1, -1, -2, 1 }, { 0, -3, 2, 0, -1, -8, 0, 2, -3, 4, -4, 1, 10, 6, -6, 8, -7, 4, 10, 11, -41, 27, -20, 3, -3, 8, 1, 11, -5, -8, 0, 4 }, { 5, 1, 4, -2, 1, 2, -1, 6, -7, 2, 11, 4, 0, 0, -8, 7, -10, 0, 0, 8, 2, 10, -1, 1, -2, 44, -2, -21, -12, -3, -1, 2 }, { -4, 4, -2, -2, 6, -8, 2, 1, -10, 14, 8, 6, 5, 1, -2, 4, -13, 4, 2, 5, 10, -2, -21, 32, -3, 18, 9, -6, -9, -9, 10, 2 }, { 9, -16, -6, -2, 1, 4, 22, 2, -2, 1, -3, -2, -9, 3, 16, 19, -24, -6, -6, -5, -8, -7, 8, -7, -1, -12, 5, -3, 0, 4, 2, -3 }, { 10, 3, -16, -4, -1, 13, 4, 4, 1, -3, 1, -6, -14, 18, 3, 8, -8, -28, -16, 4, 4, 2, 12, 7, 9, -4, -4, 5, -1, -1, 2, 2 }, { -5, -13, -22, -3, -8, 21, -2, -9, 21, -4, -9, 5, -8, 15, 5, 1, -5, -9, -7, -2, -5, -5, -1, -5, -5, -5, 3, 10, -4, 0, -7, -2 }, { 5, -10, -18, 2, 20, 4, 13, -10, 8, -15, -11, -3, -1, 16, 10, 9, -8, 6, 7, -5, 6, 11, 5, 17, -4, 7, -11, 5, -3, -6, 2, 1 }, { 3, -5, -19, 1, 1, -3, -2, -25, -11, -17, 0, -13, -4, 10, 10, 2, -5, 4, 0, 3, -3, -5, -10, -2, 13, -22, 0, 3, -11, -5, 7, -1 }, { 12, -14, -29, 6, -1, 10, 7, -17, -12, 14, 3, 9, -9, 9, 7, 6, -3, -13, 0, 5, 3, -1, -6, -1, 0, 2, 4, -12, -5, -1, 2, 11 }, { 12, -15, -7, -2, -12, 17, 20, -16, -2, -12, -6, 15, -6, 12, 11, 9, 7, -6, 7, -4, -19, 6, 2, 2, 3, -11, -10, -4, -5, -3, 3, 2 }, { 11, -22, -6, 0, 8, 18, 3, -11, -4, -7, -15, -17, -12, 6, 16, 4, -9, 4, -5, 3, 6, -16, 10, -7, -7, -3, 5, 0, 1, -15, -4, 5 }, { 12, -22, -16, 5, -6, 8, 12, -4, -9, -17, -11, 3, 5, 8, -17, 0, 11, -4, -13, -6, 2, -1, -1, 3, 3, -11, -12, -1, 1, 1, 12, -2 }, { 8, -10, -33, -5, -3, -6, 1, -7, -8, -4, -6, -1, 5, -4, -6, -12, -16, -8, 11, 8, -14, 7, 12, 11, 4, -14, -3, 6, -7, -5, -3, 3 }, { 0, -8, -7, 2, -4, 24, 2, -9, -11, -3, -7, 11, -12, 17, 1, -1, 3, -5, -7, 12, 4, 11, 0, 3, 2, -18, -3, 4, 7, -6, 3, 15 }, { 10, -15, -16, -2, -4, -9, 7, -15, -6, 2, -16, 13, -8, 7, 19, -21, -4, -12, -9, -3, -3, 6, 11, -3, -1, -19, 3, -7, -9, -4, 3, -6 }, { -5, -10, -21, 0, -3, -7, 18, -21, 15, -5, -12, -4, -13, 2, 6, -9, -9, -11, -4, 13, -3, 6, 4, -1, 7, -9, -4, 9, 5, 2, 6, 3 }, { 15, -1, -27, -2, 10, 3, 7, -8, 9, -2, 7, 1, -2, -5, 18, 9, -11, -17, -2, 7, -9, 11, 10, 0, -8, 6, -16, -3, 2, -7, 3, 11 }, { 4, -9, -39, 19, 6, -13, 13, -5, -5, -15, -2, 9, 0, 4, 14, 6, -10, -4, -5, 2, -4, -2, 5, -11, 3, 3, -2, -2, -7, 9, 7, -10 }, { 5, -11, -8, 10, -2, 12, 16, 0, 12, -2, -6, 8, 14, 8, 7, 1, 18, -30, 4, 10, -4, -6, 2, -11, 9, -10, -8, 5, 0, 0, -7, 6 }, { -1, -16, -10, 11, 0, 13, 12, -4, -4, -5, -21, 12, 4, 13, 14, -7, 6, -16, -13, 8, 2, 9, 15, -12, 1, -9, -22, 10, -9, 9, 9, -7 }, { 4, -12, -27, 1, -2, 11, 15, 3, 14, -14, -9, 0, -9, 16, 22, 10, 16, -10, 5, -5, -9, 1, 1, 6, 6, -4, 2, -17, -5, -6, -15, -1 }, { 7, -12, -17, 1, -9, 5, 20, -7, 3, 23, -8, -8, -8, -1, 13, 17, -7, -13, 4, -4, 7, 14, 8, 11, -3, -3, 4, 0, 4, 6, -1, -9 }, { 7, -15, -15, -4, 10, 12, 3, -13, 6, 14, 9, -8, -15, 14, 23, -5, -10, -5, 1, 15, -10, -7, 1, 9, 4, -13, -10, 10, 7, -3, 2, 3 }, { 4, -10, -14, 0, 3, 4, 0, -9, -3, -4, -11, 2, -17, 8, 2, 15, 6, -12, -12, 15, -5, 17, 18, 3, -3, -3, -4, -6, -8, 13, 4, 10 }, { -2, -18, -26, 10, -4, 10, 13, 4, -4, -16, -7, -17, -3, 5, -4, 2, -15, -10, -1, -8, -7, -3, 2, 2, 8, -10, -7, 2, 2, -4, 4, -1 }, { 4, -19, -5, -1, -1, -6, 2, -8, 10, -16, -28, -6, 8, -1, 11, 28, 2, -10, -4, 6, -6, 6, 11, 15, -4, -2, 7, 3, 7, -7, 4, 1 }, { -3, -6, -10, -5, 13, 18, 10, -15, -5, -3, -13, 5, 1, 2, 18, -5, -10, -10, -7, 4, 2, 1, 5, 4, 2, 5, 4, 8, -9, -17, 7, 7 }, { 20, -12, -2, -4, 5, 14, 7, -11, -1, -16, -6, -4, -11, 17, 14, 0, -8, -10, -8, 10, 3, 5, 10, -16, 3, -8, -14, 10, 3, 9, 0, 3 }, { 12, -10, -36, 0, 7, 15, 2, -16, 2, -1, 0, -1, 5, 4, 5, -3, 1, -10, 5, -1, -15, -3, -12, 12, 2, 5, -1, 5, 6, -3, -2, 2 }, { 17, -15, -31, 23, -4, 15, -2, -3, 6, -7, -5, 1, -12, 4, 6, 8, -10, 8, 3, 5, -4, 1, 5, 3, -1, -4, -3, 1, 10, -4, -2, -2 }, { 6, -18, -5, 12, 10, 12, 14, -11, 15, 2, -9, -6, -5, -2, -9, 4, -5, -28, -4, 14, 0, -16, 9, 14, -1, 3, -4, -4, 2, 1, 0, 4 }, { -5, -14, -31, 8, 16, 7, 13, -13, 5, 6, -16, 10, -5, 2, -2, 2, 14, -5, 8, -5, 7, -16, 6, -13, -5, 0, -5, 8, -3, -1, 4, 3 }, { 1, -2, -1, 0, 6, 5, 2, -4, -3, -1, 0, 1, 4, 2, 43, 28, -12, -35, -2, -2, -7, -1, 0, 2, -1, -2, -2, 1, -4, 0, -2, 3 }, { 2, -9, -22, 12, 3, 3, -7, -4, -19, -22, -14, -4, -1, 21, 9, -3, -15, -16, -13, 1, -11, 4, -9, 1, -7, -1, -1, 0, -2, 9, -13, -3 }, { -1, -3, -23, 0, 2, 12, 3, -9, -4, 7, 3, 9, -10, 1, 27, 28, 0, 9, -15, -2, -2, 1, 6, 8, -8, 7, -3, 20, 0, 0, -1, -6 }, { -1, 11, 8, -2, 1, 5, -6, -1, 4, 2, -4, 0, -1, -5, 4, -6, -10, -12, 19, 1, -7, 9, -8, -9, -16, -11, -2, 12, 14, 4, 4, 34 }, { 17, 7, -6, 1, 4, -10, -5, 4, -11, 3, -18, 4, 14, -13, -3, 1, 0, 0, -11, 0, 7, -17, -4, 4, -11, -6, -8, 18, 0, 0, 0, 26 }, { -6, -7, -1, -1, 11, -8, 1, 3, 2, 11, -6, -6, 10, -3, 1, -3, 7, 4, -12, -8, 0, -9, 8, -22, -5, 0, -6, 22, -2, 11, -13, 24 }, { -3, 4, 0, 3, 9, 10, -1, 3, -9, -12, 1, -5, 18, 0, -3, 8, 25, 15, -8, 2, 2, -2, 4, 8, 9, -1, -5, 10, -3, 1, -1, 23 }, { -5, 2, -9, -1, -3, 0, 3, -1, -10, -4, 0, -13, 16, 9, -1, -14, 2, 6, -2, -6, -5, -2, -7, 7, 5, 3, 11, -2, -14, 0, -9, 30 }, { 4, 6, 6, 5, -3, -1, 4, 5, 10, 0, 5, -4, 7, -11, 14, 14, 7, 34, -9, 0, -10, 22, -7, -1, 7, -9, 2, -8, 0, -7, -5, 29 }, { -4, 3, -1, -4, -3, 5, 1, -4, 0, 2, 4, 2, 1, -1, -10, 1, 6, -6, -4, 1, 4, -3, -3, -5, 0, 3, 7, -12, 0, -2, -10, 55 }, { 5, 9, -1, 0, 4, 9, -21, -9, 4, 2, 6, -7, 11, -7, 1, -5, 0, -4, 2, -3, -13, -8, 0, -9, -4, 2, 16, -2, -15, -7, -11, 31 }, { 8, 2, -1, 0, 3, -5, -5, 5, 1, -1, -9, 1, 0, -6, -2, -1, 5, 2, 0, 0, 12, 20, -19, 1, 8, -12, -11, 0, 6, -5, 2, 31 }, { -1, -1, -2, 1, -1, 3, -9, -5, 8, -2, 5, -1, 0, -2, 4, -2, -3, -12, 0, -2, 3, 0, 9, 4, -1, 21, -8, 3, -4, 9, -6, 30 }, { -4, 0, -7, 17, 10, -12, -2, -10, -12, -3, 10, 0, 11, -4, -13, -3, 5, 6, 10, 7, -8, 0, -7, -13, 1, 0, -2, 7, -12, 4, -3, 24 }, { -13, 9, 4, -2, 2, -4, -14, -1, -3, -5, -10, 4, 13, -2, 5, 13, 8, 3, -2, 1, 5, -6, 7, -18, -10, 1, -1, 5, 4, 1, 0, 25 }, { -5, -1, 18, 12, 8, 8, -16, -1, 1, 1, 1, -4, -5, 3, 3, 4, 4, -11, -12, -16, -6, 2, 12, -13, 0, 9, 7, 9, -9, 0, -10, 24 }, { -4, 1, -3, 0, 2, -4, 4, 1, 5, 0, -3, 2, -3, -2, 2, -1, 1, 4, -1, -2, -2, 1, -1, -1, -4, -1, -4, -2, -6, 6, 12, 69 }, { 8, 5, 11, 0, -15, -4, 13, 6, 0, -4, 9, 1, -5, -3, 15, 0, 1, 6, -5, 0, 1, 6, 5, 8, 0, 7, 1, -1, -4, -11, -9, 41 }, { -4, -9, 32, -6, 0, 7, -4, 6, -6, 1, -6, -2, 4, -8, -5, -3, -16, -1, -2, -6, 1, 15, 0, 21, 3, -3, -4, 3, -12, 16, 2, 27 }, { -6, -5, 1, -9, -5, 3, 7, -3, 5, 5, 14, 13, 20, -7, -1, 12, -1, 10, -11, -11, -7, -4, -14, 7, -14, 13, 22, 18, -1, 0, 14, 28 }, { -8, 3, -2, 0, 5, 6, -1, -4, 1, 3, -7, 3, 1, -15, 4, -9, 22, -10, -9, -4, 1, 8, -4, 9, -15, 2, -6, -4, -16, 12, -10, 23 }, { 0, 0, 2, 0, -1, 3, -3, -1, 3, -5, 7, 1, 5, -5, -8, 1, 13, -15, -5, -7, 12, -6, -2, 3, 10, -5, -8, 17, -5, -11, -14, 23 }, { -7, -4, 6, -4, 5, -6, -5, 2, -4, 11, 9, -4, 2, -2, -4, 6, 15, 3, -3, 18, -15, -2, -6, 3, 3, -20, 17, 11, -4, 2, 3, 29 }, { 6, 1, -6, 2, 3, 0, 0, -3, 3, 3, -1, 3, -4, -6, -6, -7, -3, -2, -7, -2, -4, 5, 3, -5, -20, -13, -4, 10, -14, -29, 14, 37 }, { 3, 4, 3, -6, -4, 5, 0, 3, 2, 3, 0, -2, 4, 0, -3, -5, -4, 4, -4, 4, 4, 3, 1, -4, -4, -9, -14, 20, -30, 3, -18, 33 }, { 0, 2, 5, -2, -4, -2, -1, 2, -6, -3, -2, -2, 2, -5, -1, 4, 3, 2, -3, 0, -1, -1, -10, -7, 2, -4, -18, 2, -37, -1, 12, 40 }, { -7, 2, -1, 0, -2, 4, -8, 1, -4, 12, 7, 4, 15, -7, 1, -9, 18, 0, 12, -17, -3, -1, 0, 0, 0, 2, -6, 0, -4, -3, -1, 26 }, { -6, 4, 8, -5, -6, -2, 2, -1, 1, -1, -15, 8, 7, -1, -17, -4, 1, 5, 6, -11, -6, 14, 17, -5, -15, 11, 8, 0, -3, -15, -6, 28 }, { -1, 0, 0, 0, 1, 0, -1, 0, 1, 3, 2, -2, 3, -1, -1, 2, 2, -1, -1, -7, 1, 2, -9, 0, -1, -4, -18, 7, -10, 49, -13, 32 }, { -1, -3, 4, 1, 2, -5, 1, -7, -1, 5, -9, 4, 4, 25, 1, -1, 2, -5, 2, -7, 17, -2, 10, -5, 0, 2, -15, 3, -9, 7, -9, 30 }, { -5, -1, 0, 2, 1, -1, 2, 5, -33, 3, -5, 14, 11, 7, 5, -3, 2, -8, -4, -2, -7, -6, 4, -8, -1, -8, 2, -2, -8, -1, -4, 27 }, { -1, 0, -1, -2, 1, -1, -2, -1, 2, 0, 1, 2, 2, 4, 1, 3, 4, 2, 1, -7, -4, 1, -3, -4, -35, -25, 17, 10, -3, -26, -7, 32 }, { -5, 1, 6, -2, 6, 6, -9, 3, -1, -4, 5, -4, -2, -2, -9, 2, -5, 2, 2, 4, 3, 5, -5, -16, -31, -12, -11, 2, -19, 20, -2, 21 }, { -5, 2, 7, -7, -7, 5, -7, 2, 0, 0, -4, 3, -1, 0, -1, -2, 0, -3, 5, -11, -8, -3, -7, -7, 28, -11, -7, 0, -16, -11, -4, 29 }, { 2, 1, -3, -2, -1, 3, 4, 0, 1, 0, -1, -5, 4, -5, -12, 2, -2, -5, -22, -2, -1, 11, 8, -7, -12, 0, -34, 6, -5, 11, -8, 19 }, { -1, -3, 5, 11, 18, -2, -2, -5, -2, 4, -1, 8, 5, -6, 1, -1, 2, 8, 4, -5, -8, -2, 5, -18, 7, 12, 7, 19, -18, 2, -6, -13 }, { 9, 0, 0, 5, 4, 3, -6, 4, 1, -4, 5, -1, -4, 8, 8, 6, -8, -6, 0, 6, -3, 3, 5, -3, 17, 31, 16, 10, -13, 0, -9, -19 }, { 12, -10, 2, -2, -2, -1, -3, 6, -12, -5, -2, 14, -16, 4, 12, 12, 17, 4, 7, -16, 7, -6, 11, 7, 7, 2, -25, 23, -24, 5, -7, -9 }, { 10, 4, 13, 10, 10, 3, -6, 3, 3, 2, -1, -6, 8, 4, 10, 0, 1, 2, -4, 2, -3, -8, 0, -1, 9, 9, -10, -3, -29, 1, -1, -27 }, { 2, 2, 0, 7, 9, -2, -10, -1, -1, 1, -9, -5, 8, 4, 1, 2, -10, 1, 13, 12, -3, 15, -9, 2, -7, 1, -10, 23, -20, -18, -9, -15 }, { -3, -5, -1, 8, 0, -5, -1, 4, 7, -1, -7, 2, -8, -5, 11, 7, -6, 3, -3, -9, 7, 9, -22, 1, 6, -4, 14, 27, -25, -14, 3, -5 }, { 1, 3, 8, 4, 7, 6, 12, -17, -15, 1, -8, -10, 7, -14, -8, 6, -2, -2, -11, -11, -7, 13, -2, -2, 4, 5, -5, 13, -23, -6, -17, -8 }, { -5, 4, -14, -5, -4, -5, 6, 5, -8, -5, -2, -11, -7, -12, 3, -11, 2, -6, 4, -10, -5, -7, 14, 5, 23, 11, 7, 12, -16, -6, -4, -16 }, { 5, 6, 2, 5, -2, -5, -5, -6, -5, -19, -13, -1, -3, -13, 5, 0, 6, -2, -2, -6, -7, -7, -1, -9, 4, 14, 17, -12, -27, 3, 0, -1 }, { 7, -1, 9, -10, 8, 2, -7, -2, 5, 2, -3, -7, 3, 0, 6, 4, 12, 5, 11, 14, -13, -1, 8, 1, 13, 9, 12, 12, -18, -14, -11, -16 }, { -7, -5, -6, -5, 0, -1, -3, 2, 2, 1, 4, 9, 2, 3, 5, -2, 2, 1, 8, 0, 3, 0, -2, 2, 1, 7, 29, 0, -36, -5, -9, -21 }, { 14, -6, -9, 0, -1, -8, -8, -11, 2, 2, -9, -12, 12, -4, 5, 3, -5, -9, 11, -1, -3, 12, -21, -3, 12, 5, 3, 11, -18, -15, 1, -2 }, { -1, 3, -9, -3, 7, -7, -18, 2, 4, 12, -10, 2, 8, -3, -14, 13, 17, -5, 5, -9, 13, -3, -7, -18, 17, -2, 5, 7, -20, -3, -6, -11 }, { -3, 3, 3, -1, 1, -6, -5, 1, 5, -3, -14, -6, -5, -8, 14, -6, 7, -1, 5, 1, 15, -1, -7, -4, 6, -11, 9, -2, -37, 16, -7, -3 }, { -1, 0, 6, 1, -3, -9, 0, 11, -8, 2, -2, 0, 5, 2, 12, -10, 10, 13, 2, 7, -6, 2, -10, -10, 21, -5, 5, 5, -12, -23, 3, -14 }, { 6, 0, -2, 1, 0, 1, 0, -4, 1, 1, 8, -2, 2, -5, -2, 1, 8, -4, -1, -1, 4, -1, 2, 6, 32, 1, -5, -20, -40, -4, -18, -14 }, { 2, 2, -7, -2, 4, 4, -1, 2, 0, -2, -4, -7, 3, 5, 0, -5, 1, 2, -6, 4, -1, -2, -1, -15, 8, 3, 9, 46, -7, -18, 6, -11 }, { 5, 5, 16, 21, 3, -11, -4, 11, -12, 2, 4, -12, -1, 11, 8, 1, -4, 11, -11, -21, 1, 1, -11, 3, 13, 1, 5, 12, -25, 1, -3, -2 }, { 1, 6, -7, 4, 2, 3, 1, -5, 8, 9, -15, 3, -3, -14, 17, 4, -8, 14, -2, -8, -4, 5, 8, -7, 8, 9, 7, 6, -29, -17, 8, 4 }, { -7, -7, 4, 0, 13, 1, 0, 4, 4, -16, -10, -7, 5, 9, -15, -10, -10, 8, -4, -1, -11, -1, -10, -15, 3, 3, 14, 10, -19, 2, -18, -12 }, { -4, 0, 2, 0, 5, -2, -9, 0, 4, -4, 2, -1, -2, 2, -4, 9, 2, -6, -4, -2, -1, -3, -3, -1, 2, 5, -1, 11, -24, -44, -9, -15 }, { -1, -10, 6, 21, 11, 15, -7, 10, -14, -9, -8, -8, 4, 6, 19, 1, -6, 1, -5, -17, -8, -10, 9, 5, 11, 18, -1, 10, -16, -7, -9, -8 }, { 3, -5, 0, 0, -2, -2, -6, 4, -4, 1, -1, 0, 7, -3, 4, -4, -7, 7, 17, -20, 6, 4, 1, -6, -12, 31, 13, 19, -14, -10, -7, -2 }, { -2, 6, -10, 3, 9, 6, -14, 15, 2, -5, 2, -11, 9, -8, 4, 6, 20, -15, -3, -3, -1, 32, -21, 6, 1, 9, 11, 17, -19, 6, -1, -3 }, { 8, 10, -2, 0, -8, -16, 7, 7, 6, 10, 4, -14, 7, -6, 21, -7, 10, 5, 5, 0, -7, 2, -6, 0, -7, 11, -9, 15, -20, -7, -11, 2 }, { 0, -7, 5, 2, 0, -3, -6, -4, -2, -1, -4, -5, -13, -1, 27, -9, -6, -11, -7, 1, 11, -4, -4, -14, -2, 11, 6, 10, -19, -6, -15, 2 }, { 0, 7, -1, 2, -7, -15, -2, -3, 13, -5, -5, 12, 3, 0, 5, -5, -22, 2, 7, 22, 13, 0, -1, 2, 3, 2, -7, 7, -27, -4, -4, -12 }, { 11, 1, -16, 6, -15, 1, 3, 2, 0, 2, -3, 2, 5, -2, -5, 9, 5, -3, 3, -2, -11, 3, 9, 6, 9, 3, -1, 12, -41, 8, -6, 9 }, { 3, -7, 3, 2, 5, 5, 0, -1, 1, 3, -5, -2, -13, 7, -1, -2, -2, -6, 4, -6, 0, 2, -2, 2, 4, 1, -4, 1, -47, -21, 7, -6 }, { 3, 16, -7, 13, -4, -2, 10, -3, -1, 18, -13, 7, -13, -4, 8, 4, 8, 9, -5, 13, 8, -5, 3, -6, 7, 18, -8, 10, -25, -3, -12, -12 }, { 1, -1, -1, 0, 2, 5, -5, -3, 0, -5, -1, 0, -4, -8, -2, 3, 2, -2, -17, -6, -4, 1, 33, -6, -20, -6, 8, 31, -26, -8, -1, -4 }, { 3, -3, -3, 5, -3, -2, 1, 7, 0, 3, 6, 3, 6, -2, 9, 15, -10, -3, -15, -5, -3, -4, -6, -30, 17, -8, -2, 2, -20, 0, -8, -2 }, { -2, -1, -1, -1, 3, -5, -2, -3, 4, -2, 0, 5, 8, -3, 1, -4, 1, 1, -3, 4, 4, -14, 3, 11, -5, 3, -3, 7, -3, 13, 23, -16 }, { 2, -6, 1, -3, 5, 0, -6, -11, -7, -4, -1, 2, -7, -1, -1, 7, 1, -2, 6, 12, -6, 8, -13, 17, 25, -23, -19, -7, -12, 9, 16, -17 }, { 9, 4, 4, 4, -3, -1, 6, -2, -3, 0, 13, -4, -7, 14, 1, -7, 0, -5, 3, -19, -3, 5, 3, 9, -1, 9, -13, 13, -17, 4, 21, -26 }, { 0, -5, 0, 0, -4, -5, 2, -6, -4, 5, -7, 10, 0, 2, 0, -2, -2, 0, 4, -6, 7, -2, 6, 5, -5, 2, -12, 1, -29, 29, 27, 12 }, { 9, -10, -22, 6, -1, -1, 9, -14, -12, -2, 1, -1, 10, -11, -16, 0, 3, 11, 13, -14, -9, -2, -1, 6, 4, -14, 0, -10, -2, 16, 17, -11 }, { 2, 0, -1, -2, 4, 3, -6, -2, 1, -1, 1, 3, -4, 1, 3, -4, -1, -1, 4, -1, 1, 0, 1, 6, -5, -7, 2, 1, -47, -3, 50, -17 }, { 8, -4, -11, -7, 11, 11, 14, -7, 12, -7, 6, 2, 13, -6, -3, -2, -14, 6, 6, 6, 0, 2, -1, 5, -20, 2, -1, 4, -5, 6, 21, -11 }, { -2, -9, 3, 0, -6, 7, 8, -8, 1, -3, 4, 1, 5, -2, -3, -7, 4, 7, -12, -9, -2, 10, -6, 13, 6, 5, 20, 2, -15, 9, 28, -7 }, { 0, -5, -6, -6, -6, 1, -6, 6, -2, 4, 8, -3, 12, -1, -4, -2, 6, 16, -14, 9, -14, -2, -8, -27, -3, 18, -1, -7, -3, 8, 23, -23 }, { 1, 4, -9, -1, -5, 10, -2, 1, -11, 1, -9, 4, 7, 14, -9, -2, -3, 2, -5, -1, -6, -10, -7, 11, 20, 2, 3, -19, 3, 15, 30, -9 }, { 7, 2, -14, -4, 0, -2, 5, 2, 5, -2, 8, -3, -7, 6, 6, -11, -14, 1, 10, -1, -7, -8, 1, 10, 3, -6, -15, -12, -17, 4, 30, -6 }, { 4, 2, 1, -2, 3, 0, 1, 0, 2, 0, 1, 6, -7, 0, 3, 4, 4, -4, -2, -5, -2, 2, -1, -2, 0, -2, -11, -7, -3, 42, 24, -14 }, { 4, 1, 3, 2, 0, -2, -3, -2, 2, -1, 4, 11, -2, 2, 3, -4, -5, 9, 2, -4, -9, 5, 8, -1, -7, 1, 24, -13, -28, 20, 15, -22 }, { -3, 7, 6, 3, -2, -5, -10, -2, -2, -1, -6, -6, -2, -14, -16, -6, -5, 0, 18, 0, 9, 1, 7, -13, -5, -6, -9, 11, -15, 9, 22, -11 }, { 9, -2, 6, 5, 2, 9, -10, 1, 1, 5, -4, 12, 2, 2, -10, -7, -4, -6, 7, 9, 6, 15, 6, 6, -10, 10, 5, -13, -5, 6, 24, -12 }, { 1, 3, -3, -3, 8, 1, -6, 2, -5, -3, 7, 2, 14, 6, 9, -6, -5, -4, 27, 7, -3, 8, -6, 3, -8, 8, 22, -5, -6, -2, 22, -17 }, { -2, -2, 3, 10, 9, 9, 12, -15, -1, -11, -13, 3, -2, 1, -3, -11, 7, 9, 16, -3, -10, -5, -5, 1, 8, -3, 9, 9, -5, 3, 31, -12 }, { 7, -5, 10, -4, -8, 2, 16, -2, 10, 10, -3, -2, 3, -8, -3, 3, -13, -6, 15, 20, -9, -3, -12, 1, -2, -16, 8, 8, -1, 16, 22, -5 }, { 5, -3, -15, -2, 12, -8, 8, -5, 2, -8, 20, -18, 14, -4, 3, 3, 7, -13, -16, 1, -10, 7, 16, 7, 4, -14, -4, -5, -9, 8, 23, -6 }, { 5, -4, -5, -4, 1, 8, 4, -7, -5, 8, 10, 6, -6, -10, -2, 6, 9, -17, -14, 11, 12, -3, -13, -7, 2, 18, 3, -25, -16, 18, 22, -5 }, { 5, 6, -7, -20, -4, 2, 8, 4, -24, -4, 1, 4, -5, -2, 1, -10, -2, 9, 3, -4, -3, -4, -4, -4, 10, 10, 3, 0, -6, 25, 21, -11 }, { 0, 7, -1, 14, -6, -4, -10, 5, 4, 4, 4, -5, 3, 4, -1, -7, 8, -19, 0, 6, 2, 3, -18, -3, -6, 2, 8, 14, -26, 22, 27, -13 }, { -2, -6, 7, -5, 12, -7, 8, -1, 3, -2, 4, 1, 8, -2, 0, 14, 6, -5, 6, -4, -7, 7, -21, 8, 1, 8, -9, -4, -3, 11, 25, -13 }, { 4, 4, -1, -6, 4, 9, -8, 1, -3, -10, -2, 0, 15, -9, -16, 11, 1, 1, 6, 3, -9, -5, 16, 26, 1, -14, 1, -3, -14, 7, 15, -9 }, { -12, -2, -9, -13, 2, 6, 14, 0, 1, 0, -1, -13, 0, 10, -1, 6, 9, -7, 8, 8, 19, 6, -1, 9, 10, -4, 1, -7, -22, -2, 29, -7 }, { 2, 4, 13, -12, -8, -4, -5, 13, 12, -5, -3, -3, -4, 1, -1, 10, 15, -6, -1, -11, -30, 4, 15, -1, 9, -7, 0, -2, -7, 10, 25, -16 }, { 7, -15, -7, -7, -1, -5, -5, -11, -20, 10, 3, -10, -3, 5, 20, -4, 0, -2, -2, 17, 2, 0, -3, 3, 6, 5, -1, -12, -3, 15, 22, -16 }, { 4, -1, 3, 4, -5, 0, -1, -5, -24, -29, 4, -9, 1, -3, 0, 0, 0, -4, 7, -4, -4, -4, 3, 1, -6, 5, -3, -5, -10, 3, 25, -10 }, { -2, -1, -1, 4, 4, -1, 2, 0, -4, -4, 2, -1, -3, -1, -2, -2, 1, -3, -5, -1, 2, -3, -4, -4, -3, 5, -9, 1, -11, 7, 46, -46 }, { 0, -9, 3, 4, 4, 3, -5, -6, 5, -4, 4, -2, 1, 7, -4, -10, 13, 1, 3, -6, 4, -4, 7, 2, -19, -25, -3, -16, -12, 16, 20, -1 }, { 18, 6, 4, -12, 0, -14, 9, -6, -1, -4, -5, 2, 1, 12, 4, 2, 7, 0, 2, 5, -11, -5, -2, 2, -4, 10, 0, -9, -7, 9, 25, -8 }, { 5, 0, -6, 5, 6, 3, 3, -10, -5, 1, -1, 4, 3, -11, -8, 5, 4, -5, 5, -5, -7, -5, 11, 5, 20, -8, -16, 21, -4, 27, 23, -5 } }; /* FIR filter coefficients, they can be cut on half and maybe use float instead of double*/ DECLARE_ALIGNED(16, static const float, fir_32bands_perfect)[] = { +1.135985195E-010, +7.018770981E-011, -1.608403011E-008, -5.083275667E-008, -1.543309907E-007, -3.961981463E-007, -7.342250683E-007, -3.970030775E-007, -4.741137047E-007, -6.022448247E-007, -6.628192182E-007, -6.982898526E-007, -7.020648809E-007, -6.767839409E-007, -6.262345096E-007, -5.564140224E-007, +7.003467317E-007, +8.419976893E-007, +9.742954035E-007, +1.085227950E-006, +1.162929266E-006, +1.194632091E-006, +1.179182050E-006, +1.033426656E-006, +9.451737242E-007, +1.975324267E-006, +1.190443072E-006, +5.234479659E-007, +2.014677420E-007, +7.834767501E-008, -6.702406963E-010, -1.613285505E-009, -2.682709610E-009, -3.399493131E-009, +1.314406006E-008, +7.506701927E-009, +2.788728892E-008, +1.444918922E-007, +3.132386439E-007, +1.399798180E-006, +2.032118118E-006, +2.715013807E-006, +3.453840463E-006, +4.195037945E-006, +4.896494374E-006, +5.516381407E-006, +6.015239251E-006, +6.361419310E-006, +8.006985809E-006, +8.087732567E-006, +7.941360309E-006, +7.568834008E-006, +6.986399967E-006, +6.225028756E-006, +5.315936960E-006, +4.429412002E-006, +3.332600045E-006, +8.427224429E-007, +4.341498823E-007, +9.458596395E-008, +2.975164826E-008, +6.402664354E-008, -3.246264413E-008, -3.809887872E-008, +8.434094667E-008, +6.437721822E-008, +1.189317118E-006, +2.497214155E-006, +3.617151151E-006, +3.157242645E-006, +2.319611212E-006, +7.869333785E-006, +9.826449968E-006, +1.177108606E-005, +1.379448349E-005, +1.571428584E-005, +1.743183020E-005, +1.884208177E-005, +1.987093310E-005, +2.042970118E-005, -3.144468428E-005, -3.334947178E-005, -3.460439257E-005, -3.515914432E-005, -3.495384954E-005, -3.397853652E-005, -3.225446198E-005, -2.978993689E-005, -2.677291741E-005, -1.806914770E-005, -1.776598037E-005, -1.661818715E-005, -1.207003334E-005, -6.993315310E-006, -5.633860383E-007, -9.984935332E-007, -1.470520488E-006, -1.853591357E-006, +7.198007665E-007, +3.086857760E-006, +6.084746474E-006, +9.561075785E-006, +1.309637537E-005, +2.263354872E-005, +2.847247197E-005, +3.415624451E-005, +3.946387005E-005, +4.425736552E-005, +4.839275425E-005, +5.176846025E-005, +5.429694284E-005, +5.595519906E-005, +4.916387297E-006, +9.299508747E-006, +1.356193479E-005, +1.751866148E-005, +2.093936746E-005, +2.362549276E-005, +2.537086584E-005, +2.618136386E-005, +2.554462844E-005, +3.018750249E-005, +2.570833203E-005, +1.985177369E-005, +1.191342653E-005, +2.525620175E-006, -1.521241393E-005, -1.617751332E-005, +1.992636317E-005, +1.774702469E-005, +4.624524081E-005, +5.610509834E-005, +6.568001118E-005, +7.513730816E-005, +8.413690375E-005, +8.757545584E-005, +9.517164290E-005, +1.020687996E-004, +1.084438481E-004, +1.140582463E-004, +1.187910311E-004, +1.224978914E-004, +1.250260248E-004, +1.262027217E-004, +1.226499153E-004, +1.213575742E-004, +1.180980107E-004, +1.126275165E-004, +1.047207043E-004, +9.417100227E-005, +8.078388782E-005, +6.447290798E-005, +4.491530854E-005, +2.470704203E-005, -1.714242217E-006, -3.193307566E-005, -6.541742187E-005, -1.024175072E-004, -1.312203676E-004, -1.774113771E-004, -2.233728592E-004, -2.682086197E-004, -3.347633174E-004, -3.906481725E-004, -4.490280990E-004, -5.099929986E-004, -5.729619297E-004, -6.358824321E-004, -7.021900383E-004, -7.698345580E-004, -8.385353722E-004, -9.078957955E-004, -9.775133803E-004, -1.046945457E-003, -1.115717343E-003, -1.183370827E-003, -1.252829796E-003, -1.316190348E-003, -1.376571832E-003, -1.433344092E-003, -1.485876855E-003, -1.533520175E-003, -1.575609902E-003, -1.611457788E-003, -1.640390139E-003, -1.661288203E-003, -1.674512983E-003, -1.678415807E-003, -1.672798418E-003, -1.656501088E-003, -1.633993932E-003, -1.593449386E-003, +1.542080659E-003, +1.479332102E-003, +1.395521569E-003, +1.303116791E-003, +1.196175464E-003, +1.073757303E-003, +9.358961834E-004, +7.817269652E-004, +6.114174030E-004, +4.244441516E-004, +2.206075296E-004, -2.719412748E-007, -2.382978710E-004, -4.935106263E-004, -7.658848190E-004, -1.055365428E-003, -1.361547387E-003, -1.684492454E-003, -2.023874084E-003, -2.379294252E-003, -2.750317100E-003, -3.136433195E-003, -3.537061159E-003, -3.951539751E-003, -4.379155114E-003, -4.819062538E-003, -5.270531867E-003, -5.732392892E-003, -6.203945260E-003, -6.683901884E-003, -7.170005701E-003, -7.664063945E-003, -8.162760176E-003, -8.665001951E-003, -9.170533158E-003, -9.676489048E-003, -1.018219907E-002, -1.068630442E-002, -1.118756086E-002, -1.168460958E-002, -1.217562053E-002, -1.265939046E-002, -1.313448418E-002, -1.359948888E-002, -1.405300573E-002, -1.449365262E-002, -1.492007636E-002, -1.533095632E-002, -1.572482102E-002, -1.610082202E-002, -1.645756140E-002, -1.679391414E-002, -1.710879989E-002, -1.740120351E-002, -1.767017506E-002, -1.791484281E-002, -1.813439466E-002, -1.832821220E-002, -1.849545911E-002, -1.863567345E-002, -1.874836907E-002, -1.883326657E-002, -1.889026538E-002, -1.891860925E-002, +1.891860925E-002, +1.889026538E-002, +1.883326657E-002, +1.874836907E-002, +1.863567345E-002, +1.849545911E-002, +1.832821220E-002, +1.813439466E-002, +1.791484281E-002, +1.767017506E-002, +1.740120351E-002, +1.710879989E-002, +1.679391414E-002, +1.645756140E-002, +1.610082202E-002, +1.572482102E-002, +1.533095632E-002, +1.492007636E-002, +1.449365262E-002, +1.405300573E-002, +1.359948888E-002, +1.313448418E-002, +1.265939046E-002, +1.217562053E-002, +1.168460958E-002, +1.118756086E-002, +1.068630442E-002, +1.018219907E-002, +9.676489048E-003, +9.170533158E-003, +8.665001951E-003, +8.162760176E-003, +7.664063945E-003, +7.170005701E-003, +6.683901884E-003, +6.203945260E-003, +5.732392892E-003, +5.270531867E-003, +4.819062538E-003, +4.379155114E-003, +3.951539751E-003, +3.537061159E-003, +3.136433195E-003, +2.750317100E-003, +2.379294252E-003, +2.023874084E-003, +1.684492454E-003, +1.361547387E-003, +1.055365428E-003, +7.658848190E-004, +4.935106263E-004, +2.382978710E-004, +2.719412748E-007, -2.206075296E-004, -4.244441516E-004, -6.114174030E-004, -7.817269652E-004, -9.358961834E-004, -1.073757303E-003, -1.196175464E-003, -1.303116791E-003, -1.395521569E-003, -1.479332102E-003, -1.542080659E-003, +1.593449386E-003, +1.633993932E-003, +1.656501088E-003, +1.672798418E-003, +1.678415807E-003, +1.674512983E-003, +1.661288203E-003, +1.640390139E-003, +1.611457788E-003, +1.575609902E-003, +1.533520175E-003, +1.485876855E-003, +1.433344092E-003, +1.376571832E-003, +1.316190348E-003, +1.252829796E-003, +1.183370827E-003, +1.115717343E-003, +1.046945457E-003, +9.775133803E-004, +9.078957955E-004, +8.385353722E-004, +7.698345580E-004, +7.021900383E-004, +6.358824321E-004, +5.729619297E-004, +5.099929986E-004, +4.490280990E-004, +3.906481725E-004, +3.347633174E-004, +2.682086197E-004, +2.233728592E-004, +1.774113771E-004, +1.312203676E-004, +1.024175072E-004, +6.541742187E-005, +3.193307566E-005, +1.714242217E-006, -2.470704203E-005, -4.491530854E-005, -6.447290798E-005, -8.078388782E-005, -9.417100227E-005, -1.047207043E-004, -1.126275165E-004, -1.180980107E-004, -1.213575742E-004, -1.226499153E-004, -1.262027217E-004, -1.250260248E-004, -1.224978914E-004, -1.187910311E-004, -1.140582463E-004, -1.084438481E-004, -1.020687996E-004, -9.517164290E-005, -8.757545584E-005, -8.413690375E-005, -7.513730816E-005, -6.568001118E-005, -5.610509834E-005, -4.624524081E-005, -1.774702469E-005, -1.992636317E-005, +1.617751332E-005, +1.521241393E-005, -2.525620175E-006, -1.191342653E-005, -1.985177369E-005, -2.570833203E-005, -3.018750249E-005, -2.554462844E-005, -2.618136386E-005, -2.537086584E-005, -2.362549276E-005, -2.093936746E-005, -1.751866148E-005, -1.356193479E-005, -9.299508747E-006, -4.916387297E-006, -5.595519906E-005, -5.429694284E-005, -5.176846025E-005, -4.839275425E-005, -4.425736552E-005, -3.946387005E-005, -3.415624451E-005, -2.847247197E-005, -2.263354872E-005, -1.309637537E-005, -9.561075785E-006, -6.084746474E-006, -3.086857760E-006, -7.198007665E-007, +1.853591357E-006, +1.470520488E-006, +9.984935332E-007, +5.633860383E-007, +6.993315310E-006, +1.207003334E-005, +1.661818715E-005, +1.776598037E-005, +1.806914770E-005, +2.677291741E-005, +2.978993689E-005, +3.225446198E-005, +3.397853652E-005, +3.495384954E-005, +3.515914432E-005, +3.460439257E-005, +3.334947178E-005, +3.144468428E-005, -2.042970118E-005, -1.987093310E-005, -1.884208177E-005, -1.743183020E-005, -1.571428584E-005, -1.379448349E-005, -1.177108606E-005, -9.826449968E-006, -7.869333785E-006, -2.319611212E-006, -3.157242645E-006, -3.617151151E-006, -2.497214155E-006, -1.189317118E-006, -6.437721822E-008, -8.434094667E-008, +3.809887872E-008, +3.246264413E-008, -6.402664354E-008, -2.975164826E-008, -9.458596395E-008, -4.341498823E-007, -8.427224429E-007, -3.332600045E-006, -4.429412002E-006, -5.315936960E-006, -6.225028756E-006, -6.986399967E-006, -7.568834008E-006, -7.941360309E-006, -8.087732567E-006, -8.006985809E-006, -6.361419310E-006, -6.015239251E-006, -5.516381407E-006, -4.896494374E-006, -4.195037945E-006, -3.453840463E-006, -2.715013807E-006, -2.032118118E-006, -1.399798180E-006, -3.132386439E-007, -1.444918922E-007, -2.788728892E-008, -7.506701927E-009, -1.314406006E-008, +3.399493131E-009, +2.682709610E-009, +1.613285505E-009, +6.702406963E-010, -7.834767501E-008, -2.014677420E-007, -5.234479659E-007, -1.190443072E-006, -1.975324267E-006, -9.451737242E-007, -1.033426656E-006, -1.179182050E-006, -1.194632091E-006, -1.162929266E-006, -1.085227950E-006, -9.742954035E-007, -8.419976893E-007, -7.003467317E-007, +5.564140224E-007, +6.262345096E-007, +6.767839409E-007, +7.020648809E-007, +6.982898526E-007, +6.628192182E-007, +6.022448247E-007, +4.741137047E-007, +3.970030775E-007, +7.342250683E-007, +3.961981463E-007, +1.543309907E-007, +5.083275667E-008, +1.608403011E-008, -7.018770981E-011, -1.135985195E-010 }; DECLARE_ALIGNED(16, static const float, fir_32bands_nonperfect)[] = { -1.390191784E-007, -1.693738625E-007, -2.030677564E-007, -2.404238444E-007, -2.818143514E-007, -3.276689142E-007, -3.784752209E-007, -4.347855338E-007, -4.972276315E-007, -5.665120852E-007, -6.434325428E-007, -7.288739425E-007, -8.238164355E-007, -9.293416952E-007, -1.046637067E-006, -1.176999604E-006, -1.321840614E-006, -1.482681114E-006, -1.661159786E-006, -1.859034001E-006, -2.078171747E-006, -2.320550948E-006, -2.588257530E-006, -2.883470643E-006, -3.208459020E-006, -3.565570978E-006, -3.957220997E-006, -4.385879038E-006, -4.854050530E-006, -5.364252502E-006, -5.918994248E-006, -6.520755960E-006, -7.171964626E-006, -7.874960829E-006, -8.631964192E-006, -9.445050637E-006, -1.031611009E-005, -1.124680875E-005, -1.223855270E-005, -1.329243969E-005, -1.440921824E-005, -1.558924305E-005, -1.683242772E-005, -1.813820381E-005, -1.950545993E-005, -2.093250441E-005, -2.241701623E-005, -2.395598858E-005, -2.554569073E-005, -2.718161704E-005, -2.885844333E-005, -3.056998685E-005, -3.230916263E-005, -3.406793985E-005, -3.583733633E-005, -3.760734762E-005, -3.936696885E-005, -4.110412556E-005, -4.280570283E-005, -4.445751256E-005, -4.604430433E-005, -4.754976908E-005, -4.895655002E-005, -5.024627535E-005, +5.139957648E-005, +5.239612074E-005, +5.321469871E-005, +5.383323878E-005, +5.422891263E-005, +5.437819709E-005, +5.425697600E-005, +5.384063843E-005, +5.310418419E-005, +5.202236207E-005, +5.056979353E-005, +4.872112549E-005, +4.645117951E-005, +4.373511547E-005, +4.054862075E-005, +3.686808850E-005, +3.267079956E-005, +2.793515523E-005, +2.264085742E-005, +1.676913780E-005, +1.030297699E-005, +3.227306706E-006, -4.470633485E-006, -1.280130618E-005, -2.177240640E-005, -3.138873581E-005, -4.165195787E-005, -5.256036457E-005, -6.410864444E-005, -7.628766616E-005, -8.908427117E-005, -1.024810626E-004, -1.164562127E-004, -1.309833024E-004, -1.460311323E-004, -1.615635992E-004, -1.775395358E-004, -1.939126523E-004, -2.106313768E-004, -2.276388550E-004, -2.448728774E-004, -2.622658503E-004, -2.797449124E-004, -2.972317743E-004, -3.146430245E-004, -3.318900708E-004, -3.488793736E-004, -3.655125911E-004, -3.816867538E-004, -3.972945851E-004, -4.122247046E-004, -4.263620067E-004, -4.395879805E-004, -4.517810594E-004, -4.628172028E-004, -4.725702747E-004, -4.809123348E-004, -4.877146275E-004, -4.928477574E-004, -4.961824161E-004, -4.975944757E-004, -4.969481961E-004, -4.941228544E-004, -4.889960401E-004, +4.814492422E-004, +4.713678791E-004, +4.586426076E-004, +4.431701091E-004, +4.248536134E-004, +4.036037717E-004, +3.793396754E-004, +3.519894381E-004, +3.214911267E-004, +2.877934603E-004, +2.508567995E-004, +2.106537577E-004, +1.671699720E-004, +1.204049113E-004, +7.037253090E-005, +1.710198012E-005, -3.936182839E-005, -9.895755647E-005, -1.616069785E-004, -2.272142592E-004, -2.956659591E-004, -3.668301215E-004, -4.405563814E-004, -5.166754709E-004, -5.949990009E-004, -6.753197522E-004, -7.574109477E-004, -8.410271257E-004, -9.259034996E-004, -1.011756598E-003, -1.098284614E-003, -1.185167348E-003, -1.272067428E-003, -1.358630019E-003, -1.444484224E-003, -1.529243193E-003, -1.612505526E-003, -1.693855622E-003, -1.772865304E-003, -1.849094522E-003, -1.922092517E-003, -1.991399564E-003, -2.056547208E-003, -2.117061289E-003, -2.172462177E-003, -2.222266514E-003, -2.265989315E-003, -2.303145360E-003, -2.333251061E-003, -2.355825622E-003, -2.370394068E-003, -2.376487479E-003, -2.373647178E-003, -2.361423569E-003, -2.339380793E-003, -2.307097195E-003, -2.264167881E-003, -2.210205887E-003, -2.144844970E-003, -2.067740774E-003, -1.978572691E-003, -1.877046190E-003, -1.762894331E-003, -1.635878929E-003, +1.495792647E-003, +1.342460280E-003, +1.175740734E-003, +9.955273708E-004, +8.017504588E-004, +5.943773431E-004, +3.734139318E-004, +1.389056415E-004, -1.090620208E-004, -3.703625989E-004, -6.448282511E-004, -9.322494152E-004, -1.232374110E-003, -1.544908970E-003, -1.869517611E-003, -2.205822384E-003, -2.553403843E-003, -2.911801683E-003, -3.280514618E-003, -3.659002949E-003, -4.046686925E-003, -4.442950245E-003, -4.847140983E-003, -5.258570891E-003, -5.676518660E-003, -6.100233644E-003, -6.528933067E-003, -6.961807609E-003, -7.398022339E-003, -7.836719044E-003, -8.277016692E-003, -8.718019351E-003, -9.158811532E-003, -9.598465636E-003, -1.003604382E-002, -1.047059800E-002, -1.090117730E-002, -1.132682897E-002, -1.174659748E-002, -1.215953380E-002, -1.256469358E-002, -1.296114177E-002, -1.334795821E-002, -1.372423489E-002, -1.408908330E-002, -1.444163360E-002, -1.478104480E-002, -1.510649733E-002, -1.541720331E-002, -1.571240649E-002, -1.599138230E-002, -1.625344716E-002, -1.649795473E-002, -1.672429405E-002, -1.693190821E-002, -1.712027565E-002, -1.728892699E-002, -1.743743755E-002, -1.756543480E-002, -1.767260395E-002, -1.775865816E-002, -1.782339066E-002, -1.786663756E-002, -1.788828894E-002, +1.788828894E-002, +1.786663756E-002, +1.782339066E-002, +1.775865816E-002, +1.767260395E-002, +1.756543480E-002, +1.743743755E-002, +1.728892699E-002, +1.712027565E-002, +1.693190821E-002, +1.672429405E-002, +1.649795473E-002, +1.625344716E-002, +1.599138230E-002, +1.571240649E-002, +1.541720331E-002, +1.510649733E-002, +1.478104480E-002, +1.444163360E-002, +1.408908330E-002, +1.372423489E-002, +1.334795821E-002, +1.296114177E-002, +1.256469358E-002, +1.215953380E-002, +1.174659748E-002, +1.132682897E-002, +1.090117730E-002, +1.047059800E-002, +1.003604382E-002, +9.598465636E-003, +9.158811532E-003, +8.718019351E-003, +8.277016692E-003, +7.836719044E-003, +7.398022339E-003, +6.961807609E-003, +6.528933067E-003, +6.100233644E-003, +5.676518660E-003, +5.258570891E-003, +4.847140983E-003, +4.442950245E-003, +4.046686925E-003, +3.659002949E-003, +3.280514618E-003, +2.911801683E-003, +2.553403843E-003, +2.205822384E-003, +1.869517611E-003, +1.544908970E-003, +1.232374110E-003, +9.322494152E-004, +6.448282511E-004, +3.703625989E-004, +1.090620208E-004, -1.389056415E-004, -3.734139318E-004, -5.943773431E-004, -8.017504588E-004, -9.955273708E-004, -1.175740734E-003, -1.342460280E-003, -1.495792647E-003, +1.635878929E-003, +1.762894331E-003, +1.877046190E-003, +1.978572691E-003, +2.067740774E-003, +2.144844970E-003, +2.210205887E-003, +2.264167881E-003, +2.307097195E-003, +2.339380793E-003, +2.361423569E-003, +2.373647178E-003, +2.376487479E-003, +2.370394068E-003, +2.355825622E-003, +2.333251061E-003, +2.303145360E-003, +2.265989315E-003, +2.222266514E-003, +2.172462177E-003, +2.117061289E-003, +2.056547208E-003, +1.991399564E-003, +1.922092517E-003, +1.849094522E-003, +1.772865304E-003, +1.693855622E-003, +1.612505526E-003, +1.529243193E-003, +1.444484224E-003, +1.358630019E-003, +1.272067428E-003, +1.185167348E-003, +1.098284614E-003, +1.011756598E-003, +9.259034996E-004, +8.410271257E-004, +7.574109477E-004, +6.753197522E-004, +5.949990009E-004, +5.166754709E-004, +4.405563814E-004, +3.668301215E-004, +2.956659591E-004, +2.272142592E-004, +1.616069785E-004, +9.895755647E-005, +3.936182839E-005, -1.710198012E-005, -7.037253090E-005, -1.204049113E-004, -1.671699720E-004, -2.106537577E-004, -2.508567995E-004, -2.877934603E-004, -3.214911267E-004, -3.519894381E-004, -3.793396754E-004, -4.036037717E-004, -4.248536134E-004, -4.431701091E-004, -4.586426076E-004, -4.713678791E-004, -4.814492422E-004, +4.889960401E-004, +4.941228544E-004, +4.969481961E-004, +4.975944757E-004, +4.961824161E-004, +4.928477574E-004, +4.877146275E-004, +4.809123348E-004, +4.725702747E-004, +4.628172028E-004, +4.517810594E-004, +4.395879805E-004, +4.263620067E-004, +4.122247046E-004, +3.972945851E-004, +3.816867538E-004, +3.655125911E-004, +3.488793736E-004, +3.318900708E-004, +3.146430245E-004, +2.972317743E-004, +2.797449124E-004, +2.622658503E-004, +2.448728774E-004, +2.276388550E-004, +2.106313768E-004, +1.939126523E-004, +1.775395358E-004, +1.615635992E-004, +1.460311323E-004, +1.309833024E-004, +1.164562127E-004, +1.024810626E-004, +8.908427117E-005, +7.628766616E-005, +6.410864444E-005, +5.256036457E-005, +4.165195787E-005, +3.138873581E-005, +2.177240640E-005, +1.280130618E-005, +4.470633485E-006, -3.227306706E-006, -1.030297699E-005, -1.676913780E-005, -2.264085742E-005, -2.793515523E-005, -3.267079956E-005, -3.686808850E-005, -4.054862075E-005, -4.373511547E-005, -4.645117951E-005, -4.872112549E-005, -5.056979353E-005, -5.202236207E-005, -5.310418419E-005, -5.384063843E-005, -5.425697600E-005, -5.437819709E-005, -5.422891263E-005, -5.383323878E-005, -5.321469871E-005, -5.239612074E-005, -5.139957648E-005, +5.024627535E-005, +4.895655002E-005, +4.754976908E-005, +4.604430433E-005, +4.445751256E-005, +4.280570283E-005, +4.110412556E-005, +3.936696885E-005, +3.760734762E-005, +3.583733633E-005, +3.406793985E-005, +3.230916263E-005, +3.056998685E-005, +2.885844333E-005, +2.718161704E-005, +2.554569073E-005, +2.395598858E-005, +2.241701623E-005, +2.093250441E-005, +1.950545993E-005, +1.813820381E-005, +1.683242772E-005, +1.558924305E-005, +1.440921824E-005, +1.329243969E-005, +1.223855270E-005, +1.124680875E-005, +1.031611009E-005, +9.445050637E-006, +8.631964192E-006, +7.874960829E-006, +7.171964626E-006, +6.520755960E-006, +5.918994248E-006, +5.364252502E-006, +4.854050530E-006, +4.385879038E-006, +3.957220997E-006, +3.565570978E-006, +3.208459020E-006, +2.883470643E-006, +2.588257530E-006, +2.320550948E-006, +2.078171747E-006, +1.859034001E-006, +1.661159786E-006, +1.482681114E-006, +1.321840614E-006, +1.176999604E-006, +1.046637067E-006, +9.293416952E-007, +8.238164355E-007, +7.288739425E-007, +6.434325428E-007, +5.665120852E-007, +4.972276315E-007, +4.347855338E-007, +3.784752209E-007, +3.276689142E-007, +2.818143514E-007, +2.404238444E-007, +2.030677564E-007, +1.693738625E-007, +1.390191784E-007 }; DECLARE_ALIGNED(16, static const float, lfe_fir_64)[] = { 2.658434386830777e-4, 9.029330685734748e-3, 7.939263433218002e-2, 2.425158768892288e-1, 3.430179357528686e-1, 2.398228943347931e-1, 7.746443897485733e-2, 8.622321300208569e-3, 8.179365249816328e-5, 9.450953453779220e-3, 8.134882897138596e-2, 2.451938837766648e-1, 3.429597318172455e-1, 2.371159791946411e-1, 7.556436210870743e-2, 8.229630999267101e-3, 9.439323912374676e-5, 9.887560270726680e-3, 8.333285897970200e-2, 2.478559017181396e-1, 3.428434133529663e-1, 2.343961596488952e-1, 7.369252294301987e-2, 7.850865833461285e-3, 1.082170274457894e-4, 1.033949479460716e-2, 8.534456789493561e-2, 2.505008876323700e-1, 3.426689505577088e-1, 2.316644787788391e-1, 7.184901088476181e-2, 7.485736627131701e-3, 1.233371440321207e-4, 1.080708485096693e-2, 8.738376945257187e-2, 2.531278133392334e-1, 3.424364924430847e-1, 2.289219647645950e-1, 7.003392279148102e-2, 7.133882027119398e-3, 1.397485757479444e-4, 1.129068247973919e-2, 8.945026248693466e-2, 2.557355761528015e-1, 3.421461284160614e-1, 2.261696159839630e-1, 6.824731826782227e-2, 6.794991903007030e-3, 1.575958012836054e-4, 1.179065089672804e-2, 9.154383838176728e-2, 2.583232223987580e-1, 3.417979776859284e-1, 2.234084606170654e-1, 6.648923456668854e-2, 6.468691397458315e-3, 1.769922382663936e-4, 1.230732165277004e-2, 9.366425126791000e-2, 2.608896791934967e-1, 3.413922190666198e-1, 2.206395119428635e-1, 6.475970894098282e-2, 6.154712289571762e-3, 1.981738605536520e-4, 1.284105982631445e-2, 9.581124037504196e-2, 2.634339034557342e-1, 3.409290313720703e-1, 2.178637981414795e-1, 6.305878609418869e-2, 5.852684378623962e-3, 2.211847313446924e-4, 1.339218579232693e-2, 9.798453748226166e-2, 2.659549415111542e-1, 3.404086530208588e-1, 2.150822728872299e-1, 6.138643622398376e-2, 5.562345497310162e-3, 2.460231189616024e-4, 1.396108977496624e-2, 1.001838669180870e-1, 2.684516608715058e-1, 3.398312926292420e-1, 2.122959494590759e-1, 5.974265560507774e-2, 5.283284001052380e-3, 2.726115926634520e-4, 1.454808749258518e-2, 1.024089083075523e-1, 2.709231376647949e-1, 3.391972482204438e-1, 2.095058411359787e-1, 5.812742188572884e-2, 5.015311297029257e-3, 3.013863170053810e-4, 1.515355054289102e-2, 1.046593263745308e-1, 2.733682692050934e-1, 3.385068178176880e-1, 2.067128717899322e-1, 5.654069408774376e-2, 4.758012015372515e-3, 3.328395541757345e-4, 1.577781140804291e-2, 1.069347932934761e-1, 2.757860720157624e-1, 3.377602994441986e-1, 2.039180546998978e-1, 5.498242005705833e-2, 4.511159844696522e-3, 3.658991190604866e-4, 1.642123050987720e-2, 1.092349365353584e-1, 2.781755328178406e-1, 3.369580209255218e-1, 2.011223286390304e-1, 5.345252528786659e-2, 4.274417180567980e-3, 4.018281470052898e-4, 1.708412915468216e-2, 1.115593686699867e-1, 2.805356979370117e-1, 3.361004292964936e-1, 1.983266174793244e-1, 5.195093154907227e-2, 4.047499038279056e-3, 4.401875485200435e-4, 1.776690222322941e-2, 1.139076948165894e-1, 2.828655838966370e-1, 3.351879119873047e-1, 1.955319195985794e-1, 5.047753453254700e-2, 3.830091329291463e-3, 4.812776169274002e-4, 1.846982724964619e-2, 1.162794977426529e-1, 2.851640880107880e-1, 3.342207968235016e-1, 1.927391141653061e-1, 4.903224110603333e-2, 3.621967276558280e-3, 5.252459668554366e-4, 1.919330470263958e-2, 1.186743453145027e-1, 2.874303460121155e-1, 3.331996202468872e-1, 1.899491697549820e-1, 4.761491715908051e-2, 3.422776935622096e-3, 5.721592460758984e-4, 1.993762329220772e-2, 1.210917681455612e-1, 2.896633744239807e-1, 3.321248590946198e-1, 1.871629506349564e-1, 4.622544348239899e-2, 3.232272574678064e-3, 6.222130032256246e-4, 2.070316113531590e-2, 1.235313042998314e-1, 2.918621897697448e-1, 3.309969604015350e-1, 1.843813359737396e-1, 4.486365616321564e-2, 3.050152910873294e-3, 6.755515350960195e-4, 2.149021252989769e-2, 1.259924471378326e-1, 2.940258979797364e-1, 3.298164308071136e-1, 1.816052496433258e-1, 4.352942481637001e-2, 2.876190468668938e-3, 7.324148900806904e-4, 2.229913882911205e-2, 1.284746825695038e-1, 2.961534857749939e-1, 3.285838961601258e-1, 1.788355410099030e-1, 4.222255200147629e-2, 2.710093278437853e-3, 7.928516715764999e-4, 2.313023805618286e-2, 1.309774816036224e-1, 2.982441186904907e-1, 3.272998929023742e-1, 1.760730892419815e-1, 4.094288870692253e-2, 2.551567042246461e-3, 8.570110658183694e-4, 2.398385666310787e-2, 1.335003077983856e-1, 3.002967536449432e-1, 3.259649574756622e-1, 1.733186990022659e-1, 3.969023004174232e-2, 2.400433411821723e-3, 9.251192095689476e-4, 2.486028522253036e-2, 1.360425949096680e-1, 3.023106753826142e-1, 3.245797157287598e-1, 1.705732345581055e-1, 3.846437484025955e-2, 2.256359672173858e-3, 9.974770946428180e-4, 2.575986087322235e-2, 1.386037617921829e-1, 3.042849004268646e-1, 3.231448531150818e-1, 1.678375005722046e-1, 3.726511076092720e-2, 2.119151875376701e-3, 1.073930296115577e-3, 2.668286114931106e-2, 1.411831974983215e-1, 3.062185347080230e-1, 3.216609656810760e-1, 1.651122719049454e-1, 3.609224036335945e-2, 1.988604199141264e-3, 1.155023579485714e-3, 2.762960828840732e-2, 1.437802612781525e-1, 3.081108033657074e-1, 3.201287388801574e-1, 1.623983532190323e-1, 3.494550660252571e-2, 1.864377525635064e-3, 1.240676851011813e-3, 2.860039286315441e-2, 1.463943719863892e-1, 3.099608123302460e-1, 3.185488879680634e-1, 1.596965193748474e-1, 3.382468968629837e-2, 1.746327499859035e-3, 1.331258914433420e-3, 2.959549613296986e-2, 1.490248143672943e-1, 3.117676973342896e-1, 3.169221282005310e-1, 1.570075154304504e-1, 3.272953629493714e-2, 1.634211512282491e-3, 1.426893868483603e-3, 3.061520494520664e-2, 1.516709625720978e-1, 3.135308027267456e-1, 3.152491748332978e-1, 1.543320864439010e-1, 3.165979683399200e-2, 1.527829794213176e-3, }; DECLARE_ALIGNED(16, static const float, lfe_fir_128)[] = { 0.00053168571, 0.15878495574, 0.68603444099, 0.15492856503, 0.00016358691, 0.16269733012, 0.68591803312, 0.15112841129, 0.00018878609, 0.16666537523, 0.68568539619, 0.14738474786, 0.00021643363, 0.17068879306, 0.68533653021, 0.14369773865, 0.00024667382, 0.17476719618, 0.68487155437, 0.14006754756, 0.00027949660, 0.17890018225, 0.68429082632, 0.13649433851, 0.00031519096, 0.18308731914, 0.68359452486, 0.13297818601, 0.00035398375, 0.18732811511, 0.68278300762, 0.12951917946, 0.00039634691, 0.19162209332, 0.68185669184, 0.12611730397, 0.00044236859, 0.19596865773, 0.68081587553, 0.12277261168, 0.00049204525, 0.20036731660, 0.67966115475, 0.11948505789, 0.00054522208, 0.20481738448, 0.67839306593, 0.11625462025, 0.00060277141, 0.20931822062, 0.67701220512, 0.11308115721, 0.00066567765, 0.21386915445, 0.67551922798, 0.10996460915, 0.00073179678, 0.21846942604, 0.67391467094, 0.10690483451, 0.00080365466, 0.22311829031, 0.67219948769, 0.10390164703, 0.00088037323, 0.22781492770, 0.67037439346, 0.10095486045, 0.00096255314, 0.23255851865, 0.66844022274, 0.09806428105, 0.00105048984, 0.23734821379, 0.66639786959, 0.09522963315, 0.00114431616, 0.24218304455, 0.66424828768, 0.09245070815, 0.00124442333, 0.24706205726, 0.66199249029, 0.08972713351, 0.00135110028, 0.25198432803, 0.65963155031, 0.08705867827, 0.00146482687, 0.25694879889, 0.65716648102, 0.08444493264, 0.00158570008, 0.26195442677, 0.65459835529, 0.08188561350, 0.00171401864, 0.26700007915, 0.65192854404, 0.07938029617, 0.00185023469, 0.27208462358, 0.64915806055, 0.07692859322, 0.00199495023, 0.27720692754, 0.64628833532, 0.07453006506, 0.00214785640, 0.28236576915, 0.64332056046, 0.07218432426, 0.00231004250, 0.28755992651, 0.64025616646, 0.06989086419, 0.00248134881, 0.29278811812, 0.63709646463, 0.06764923781, 0.00266251224, 0.29804900289, 0.63384294510, 0.06545893103, 0.00285378192, 0.30334126949, 0.63049703836, 0.06331945211, 0.00305565330, 0.30866351724, 0.62706029415, 0.06123027951, 0.00326841651, 0.31401440501, 0.62353414297, 0.05919086933, 0.00349264755, 0.31939238310, 0.61992025375, 0.05720067024, 0.00372874714, 0.32479602098, 0.61622029543, 0.05525910854, 0.00397720048, 0.33022382855, 0.61243581772, 0.05336561054, 0.00423829490, 0.33567428589, 0.60856848955, 0.05151961371, 0.00451271003, 0.34114575386, 0.60462015867, 0.04972046614, 0.00480085658, 0.34663668275, 0.60059231520, 0.04796761274, 0.00510312291, 0.35214546323, 0.59648692608, 0.04626038298, 0.00542017492, 0.35767036676, 0.59230577946, 0.04459818453, 0.00575236930, 0.36320972443, 0.58805054426, 0.04298033938, 0.00610029325, 0.36876192689, 0.58372318745, 0.04140623659, 0.00646453211, 0.37432509661, 0.57932555676, 0.03987516090, 0.00684553990, 0.37989753485, 0.57485944033, 0.03838652745, 0.00724391919, 0.38547745347, 0.57032698393, 0.03693958372, 0.00766016589, 0.39106300473, 0.56572991610, 0.03553372994, 0.00809498038, 0.39665243030, 0.56107026339, 0.03416819125, 0.00854881573, 0.40224379301, 0.55634999275, 0.03284239396, 0.00902230106, 0.40783521533, 0.55157101154, 0.03155555204, 0.00951600447, 0.41342487931, 0.54673534632, 0.03030703776, 0.01003060210, 0.41901078820, 0.54184508324, 0.02909611352, 0.01056654565, 0.42459106445, 0.53690224886, 0.02792212367, 0.01112466771, 0.43016362190, 0.53190881014, 0.02678431384, 0.01170534454, 0.43572667241, 0.52686679363, 0.02568206564, 0.01230939943, 0.44127810001, 0.52177828550, 0.02461459488, 0.01293735672, 0.44681602716, 0.51664537191, 0.02358125709, 0.01358995494, 0.45233830810, 0.51147013903, 0.02258131653, 0.01426773332, 0.45784294605, 0.50625455379, 0.02161412500, 0.01497144438, 0.46332800388, 0.50100076199, 0.02067894675, 0.01570170000, 0.46879136562, 0.49571081996, 0.01977507770, 0.01645922661, 0.47423094511, 0.49038675427, 0.01890186779, 0.01724460535, 0.47964480519, 0.48503074050, 0.01805862412, }; /* 10^-(dB/20), with dB being a list of dB values ranging from 0 to -72 */ /* do a 20*log10(dca_downmix_coeffs) to reconvert the values */ static const float dca_downmix_coeffs[65] = { 1.000000000000000, 0.988553094656939, 0.971627951577106, 0.944060876285923, 0.917275935389780, 0.891250938133746, 0.865964323360065, 0.841395141645195, 0.817523037943650, 0.794328234724281, 0.771791515585012, 0.749894209332456, 0.728618174513228, 0.707945784384138, 0.687859912308808, 0.668343917568615, 0.649381631576211, 0.630957344480193, 0.613055792149821, 0.595662143529010, 0.578761988349121, 0.562341325190349, 0.546386549881854, 0.530884444230988, 0.515822165072306, 0.501187233627272, 0.446683592150963, 0.398107170553497, 0.354813389233575, 0.316227766016838, 0.281838293126445, 0.251188643150958, 0.223872113856834, 0.199526231496888, 0.177827941003892, 0.158489319246111, 0.141253754462275, 0.125892541179417, 0.112201845430196, 0.100000000000000, 0.089125093813374, 0.079432823472428, 0.070794578438414, 0.063095734448019, 0.053088444423099, 0.044668359215096, 0.037583740428844, 0.031622776601684, 0.026607250597988, 0.022387211385683, 0.018836490894898, 0.015848931924611, 0.013335214321633, 0.011220184543020, 0.009440608762859, 0.007943282347243, 0.005623413251903, 0.003981071705535, 0.002818382931264, 0.001995262314969, 0.001412537544623, 0.001000000000000, 0.000501187233627, 0.000251188643151, 0.000000000000000, }; static const uint8_t dca_default_coeffs[16][5][2] = { { { 13, 13 }, }, { { 0, 64 }, { 64, 0 }, }, { { 0, 64 }, { 64, 0 }, }, { { 0, 64 }, { 64, 0 }, }, { { 0, 64 }, { 64, 0 }, }, { { 6, 6 }, { 0, 25 }, { 25, 0 }, }, { { 0, 25 }, { 25, 0 }, { 13, 13 }, }, { { 6, 6 }, { 0, 25 }, { 25, 0 }, { 13, 13 }, }, { { 0, 25 }, { 25, 0 }, { 0, 13 }, { 13, 0 }, }, { { 6, 6 }, { 0, 25 }, { 25, 0 }, { 0, 13 }, { 13, 0 }, }, }; /* downmix coeffs TABLE 9 ______________________________________ Down-mix coefficients for 8-channel source audio (5 + 3 format) lt cen- rt lt ctr rt lt ter ctr center rt srd srd srd ______________________________________ 1 0.71 0.74 1.0 0.71 0.71 0.58 0.58 0.58 2 left 1.0 0.89 0.71 0.46 0.71 0.50 rt 0.45 0.71 0.89 1.0 0.50 0.71 3 lt 1.0 0.89 0.71 0.45 rt 0.45 0.71 0.89 1.0 srd 0.71 0.71 0.71 4 lt 1.0 0.89 0.71 0.45 rt 0.45 0.71 0.89 1.0 lt srd 1.0 0.71 rt srd 0.71 0.71 4 lt 1.0 0.5 ctr 0.87 1.0 0.87 rt 0.5 1.0 srd 0.71 0.71 0.71 5 lt 1.0 0.5 ctr 0.87 1.0 0.87 rt 0.5 1.0 lt srd 1.0 0.71 rt srd 0.71 1.0 6 lt 1.0 0.5 lt ctr 0.87 0.71 rt ctr 0.71 0.87 rt 0.5 1.0 lt srd 1.0 0.71 rt srd 0.71 1.0 6 lt 1.0 0.5 ctr 0.86 1.0 0.86 rt 0.5 1.0 lt srd 1.0 ctr srd 1.0 rt srd 1.0 7 lt 1.0 lt ctr 1.0 ctr 1.0 rt ctr 1.0 rt 1.0 lt srd 1.0 0.71 rt srd 0.71 1.0 7 lt 1.0 0.5 lt ctr 0.87 0.71 rt ctr 0.71 0.87 rt 0.5 1.0 lt srd 1.0 ctr srd 1.0 rt srd 1.0 8 lt 1.0 0.5 lt ctr 0.87 0.71 rt ctr 0.71 0.87 rt 0.5 1.0 lt 1 srd 0.87 0.35 lt 2 srd 0.5 0.61 rt 2 srd 0.61 0.50 rt 2 srd 0.35 0.87 Generation of Lt Rt In the case when the playback system has analog or digital surround multi-channel capability, a down matrix from 5, 4, or 3 channel to Lt Rt may be desirable. In the case when the number of decoded audio channels exceeds 5, 4 or 3 respectively a first stage down mix to 5, 4 or 3 chs should be used as described above. The down matrixing equations for 5-channel source audio to a two-channel Lt Rt playback system are given by: Left left+0.7*center-0.7*(lt surround+rt surround) Right=right+0.7*center+0.7*(lt surround+rt surround) Embedded mixing to 2-channel One concern arising from the proliferation of multi-channel audio systems is that most home systems presently have only two channel playback capability. To accommodate this a fixed 2-channel down matrix processes is commonly used following the multi-channel decoding stage. However, for music only applications the image quality etc. of the down matrixed signal may not match that of an equivalent stereo recording found on CD. The concept of embedded mixing is to allow the producer to dynamically specify the matrixing coefficients within the audio frame itself. In this way the stereo down mix at the decoder may be better matched to a 2-channel playback environment. CHS*2, 7-bit down mix indexes (MCOEFFS) are transmitted along with the multi-channel audio once in every frame. The indexes are converted to attenuation factors using a 7 bit LUT. The 2-ch down mix equations are as follows, Left Ch=sum (MCOEFF[n]*Ch[n]) for n=1, CHS Right Ch sum (MCOEFF[n+CHS]*Ch[n]) for n=1, CHS where Ch(n) represents the subband samples in the (n)th audio channel. */ #endif /* AVCODEC_DCADATA_H */
123linslouis-android-video-cutter
jni/libavcodec/dcadata.h
C
asf20
303,180
/* * VC-1 and WMV3 decoder * copyright (c) 2006 Konstantin Shishkov * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVCODEC_VC1ACDATA_H #define AVCODEC_VC1ACDATA_H #include <stdint.h> #define AC_MODES 8 static const int vc1_ac_sizes[AC_MODES] = { 186, 169, 133, 149, 103, 103, 163, 175 }; static const uint32_t vc1_ac_tables[AC_MODES][186][2] = { { { 0x0001, 2}, { 0x0005, 3}, { 0x000D, 4}, { 0x0012, 5}, { 0x000E, 6}, { 0x0015, 7}, { 0x0013, 8}, { 0x003F, 8}, { 0x004B, 9}, { 0x011F, 9}, { 0x00B8, 10}, { 0x03E3, 10}, { 0x0172, 11}, { 0x024D, 12}, { 0x03DA, 12}, { 0x02DD, 13}, { 0x1F55, 13}, { 0x05B9, 14}, { 0x3EAE, 14}, { 0x0000, 4}, { 0x0010, 5}, { 0x0008, 7}, { 0x0020, 8}, { 0x0029, 9}, { 0x01F4, 9}, { 0x0233, 10}, { 0x01E0, 11}, { 0x012A, 12}, { 0x03DD, 12}, { 0x050A, 13}, { 0x1F29, 13}, { 0x0A42, 14}, { 0x1272, 15}, { 0x1737, 15}, { 0x0003, 5}, { 0x0011, 7}, { 0x00C4, 8}, { 0x004B, 10}, { 0x00B4, 11}, { 0x07D4, 11}, { 0x0345, 12}, { 0x02D7, 13}, { 0x07BF, 13}, { 0x0938, 14}, { 0x0BBB, 14}, { 0x095E, 15}, { 0x0013, 5}, { 0x0078, 7}, { 0x0069, 9}, { 0x0232, 10}, { 0x0461, 11}, { 0x03EC, 12}, { 0x0520, 13}, { 0x1F2A, 13}, { 0x3E50, 14}, { 0x3E51, 14}, { 0x1486, 15}, { 0x000C, 6}, { 0x0024, 9}, { 0x0094, 11}, { 0x08C0, 12}, { 0x0F09, 14}, { 0x1EF0, 15}, { 0x003D, 6}, { 0x0053, 9}, { 0x01A0, 11}, { 0x02D6, 13}, { 0x0F08, 14}, { 0x0013, 7}, { 0x007C, 9}, { 0x07C1, 11}, { 0x04AC, 14}, { 0x001B, 7}, { 0x00A0, 10}, { 0x0344, 12}, { 0x0F79, 14}, { 0x0079, 7}, { 0x03E1, 10}, { 0x02D4, 13}, { 0x2306, 14}, { 0x0021, 8}, { 0x023C, 10}, { 0x0FAE, 12}, { 0x23DE, 14}, { 0x0035, 8}, { 0x0175, 11}, { 0x07B3, 13}, { 0x00C5, 8}, { 0x0174, 11}, { 0x0785, 13}, { 0x0048, 9}, { 0x01A3, 11}, { 0x049E, 13}, { 0x002C, 9}, { 0x00FA, 10}, { 0x07D6, 11}, { 0x0092, 10}, { 0x05CC, 13}, { 0x1EF1, 15}, { 0x00A3, 10}, { 0x03ED, 12}, { 0x093E, 14}, { 0x01E2, 11}, { 0x1273, 15}, { 0x07C4, 11}, { 0x1487, 15}, { 0x0291, 12}, { 0x0293, 12}, { 0x0F8A, 12}, { 0x0509, 13}, { 0x0508, 13}, { 0x078D, 13}, { 0x07BE, 13}, { 0x078C, 13}, { 0x04AE, 14}, { 0x0BBA, 14}, { 0x2307, 14}, { 0x0B9A, 14}, { 0x1736, 15}, { 0x000E, 4}, { 0x0045, 7}, { 0x01F3, 9}, { 0x047A, 11}, { 0x05DC, 13}, { 0x23DF, 14}, { 0x0019, 5}, { 0x0028, 9}, { 0x0176, 11}, { 0x049D, 13}, { 0x23DD, 14}, { 0x0030, 6}, { 0x00A2, 10}, { 0x02EF, 12}, { 0x05B8, 14}, { 0x003F, 6}, { 0x00A5, 10}, { 0x03DB, 12}, { 0x093F, 14}, { 0x0044, 7}, { 0x07CB, 11}, { 0x095F, 15}, { 0x0063, 7}, { 0x03C3, 12}, { 0x0015, 8}, { 0x08F6, 12}, { 0x0017, 8}, { 0x0498, 13}, { 0x002C, 8}, { 0x07B2, 13}, { 0x002F, 8}, { 0x1F54, 13}, { 0x008D, 8}, { 0x07BD, 13}, { 0x008E, 8}, { 0x1182, 13}, { 0x00FB, 8}, { 0x050B, 13}, { 0x002D, 8}, { 0x07C0, 11}, { 0x0079, 9}, { 0x1F5F, 13}, { 0x007A, 9}, { 0x1F56, 13}, { 0x0231, 10}, { 0x03E4, 10}, { 0x01A1, 11}, { 0x0143, 11}, { 0x01F7, 11}, { 0x016F, 12}, { 0x0292, 12}, { 0x02E7, 12}, { 0x016C, 12}, { 0x016D, 12}, { 0x03DC, 12}, { 0x0F8B, 12}, { 0x0499, 13}, { 0x03D8, 12}, { 0x078E, 13}, { 0x02D5, 13}, { 0x1F5E, 13}, { 0x1F2B, 13}, { 0x078F, 13}, { 0x04AD, 14}, { 0x3EAF, 14}, { 0x23DC, 14}, { 0x004A, 9} }, { { 0x0000, 3}, { 0x0003, 4}, { 0x000B, 5}, { 0x0014, 6}, { 0x003F, 6}, { 0x005D, 7}, { 0x00A2, 8}, { 0x00AC, 9}, { 0x016E, 9}, { 0x020A, 10}, { 0x02E2, 10}, { 0x0432, 11}, { 0x05C9, 11}, { 0x0827, 12}, { 0x0B54, 12}, { 0x04E6, 13}, { 0x105F, 13}, { 0x172A, 13}, { 0x20B2, 14}, { 0x2D4E, 14}, { 0x39F0, 14}, { 0x4175, 15}, { 0x5A9E, 15}, { 0x0004, 4}, { 0x001E, 5}, { 0x0042, 7}, { 0x00B6, 8}, { 0x0173, 9}, { 0x0395, 10}, { 0x072E, 11}, { 0x0B94, 12}, { 0x16A4, 13}, { 0x20B3, 14}, { 0x2E45, 14}, { 0x0005, 5}, { 0x0040, 7}, { 0x0049, 9}, { 0x028F, 10}, { 0x05CB, 11}, { 0x048A, 13}, { 0x09DD, 14}, { 0x73E2, 15}, { 0x0018, 5}, { 0x0025, 8}, { 0x008A, 10}, { 0x051B, 11}, { 0x0E5F, 12}, { 0x09C9, 14}, { 0x139C, 15}, { 0x0029, 6}, { 0x004F, 9}, { 0x0412, 11}, { 0x048D, 13}, { 0x2E41, 14}, { 0x0038, 6}, { 0x010E, 9}, { 0x05A8, 11}, { 0x105C, 13}, { 0x39F2, 14}, { 0x0058, 7}, { 0x021F, 10}, { 0x0E7E, 12}, { 0x39FF, 14}, { 0x0023, 8}, { 0x02E3, 10}, { 0x04E5, 13}, { 0x2E40, 14}, { 0x00A1, 8}, { 0x05BE, 11}, { 0x09C8, 14}, { 0x0083, 8}, { 0x013A, 11}, { 0x1721, 13}, { 0x0044, 9}, { 0x0276, 12}, { 0x39F6, 14}, { 0x008B, 10}, { 0x04EF, 13}, { 0x5A9B, 15}, { 0x0208, 10}, { 0x1CFE, 13}, { 0x0399, 10}, { 0x1CB4, 13}, { 0x039E, 10}, { 0x39F3, 14}, { 0x05AB, 11}, { 0x73E3, 15}, { 0x0737, 11}, { 0x5A9F, 15}, { 0x082D, 12}, { 0x0E69, 12}, { 0x0E68, 12}, { 0x0433, 11}, { 0x0B7B, 12}, { 0x2DF8, 14}, { 0x2E56, 14}, { 0x2E57, 14}, { 0x39F7, 14}, { 0x51A5, 15}, { 0x0003, 3}, { 0x002A, 6}, { 0x00E4, 8}, { 0x028E, 10}, { 0x0735, 11}, { 0x1058, 13}, { 0x1CFA, 13}, { 0x2DF9, 14}, { 0x4174, 15}, { 0x0009, 4}, { 0x0054, 8}, { 0x0398, 10}, { 0x048B, 13}, { 0x139D, 15}, { 0x000D, 4}, { 0x00AD, 9}, { 0x0826, 12}, { 0x2D4C, 14}, { 0x0011, 5}, { 0x016B, 9}, { 0x0B7F, 12}, { 0x51A4, 15}, { 0x0019, 5}, { 0x021B, 10}, { 0x16FD, 13}, { 0x001D, 5}, { 0x0394, 10}, { 0x28D3, 14}, { 0x002B, 6}, { 0x05BC, 11}, { 0x5A9A, 15}, { 0x002F, 6}, { 0x0247, 12}, { 0x0010, 7}, { 0x0A35, 12}, { 0x003E, 6}, { 0x0B7A, 12}, { 0x0059, 7}, { 0x105E, 13}, { 0x0026, 8}, { 0x09CF, 14}, { 0x0055, 8}, { 0x1CB5, 13}, { 0x0057, 8}, { 0x0E5B, 12}, { 0x00A0, 8}, { 0x1468, 13}, { 0x0170, 9}, { 0x0090, 10}, { 0x01CE, 9}, { 0x021A, 10}, { 0x0218, 10}, { 0x0168, 9}, { 0x021E, 10}, { 0x0244, 12}, { 0x0736, 11}, { 0x0138, 11}, { 0x0519, 11}, { 0x0E5E, 12}, { 0x072C, 11}, { 0x0B55, 12}, { 0x09DC, 14}, { 0x20BB, 14}, { 0x048C, 13}, { 0x1723, 13}, { 0x2E44, 14}, { 0x16A5, 13}, { 0x0518, 11}, { 0x39FE, 14}, { 0x0169, 9} }, { { 0x0001, 2}, { 0x0006, 3}, { 0x000F, 4}, { 0x0016, 5}, { 0x0020, 6}, { 0x0018, 7}, { 0x0008, 8}, { 0x009A, 8}, { 0x0056, 9}, { 0x013E, 9}, { 0x00F0, 10}, { 0x03A5, 10}, { 0x0077, 11}, { 0x01EF, 11}, { 0x009A, 12}, { 0x005D, 13}, { 0x0001, 4}, { 0x0011, 5}, { 0x0002, 7}, { 0x000B, 8}, { 0x0012, 9}, { 0x01D6, 9}, { 0x027E, 10}, { 0x0191, 11}, { 0x00EA, 12}, { 0x03DC, 12}, { 0x013B, 13}, { 0x0004, 5}, { 0x0014, 7}, { 0x009E, 8}, { 0x0009, 10}, { 0x01AC, 11}, { 0x01E2, 11}, { 0x03CA, 12}, { 0x005F, 13}, { 0x0017, 5}, { 0x004E, 7}, { 0x005E, 9}, { 0x00F3, 10}, { 0x01AD, 11}, { 0x00EC, 12}, { 0x05F0, 13}, { 0x000E, 6}, { 0x00E1, 8}, { 0x03A4, 10}, { 0x009C, 12}, { 0x013D, 13}, { 0x003B, 6}, { 0x001C, 9}, { 0x0014, 11}, { 0x09BE, 12}, { 0x0006, 7}, { 0x007A, 9}, { 0x0190, 11}, { 0x0137, 13}, { 0x001B, 7}, { 0x0008, 10}, { 0x075C, 11}, { 0x0071, 7}, { 0x00D7, 10}, { 0x09BF, 12}, { 0x0007, 8}, { 0x00AF, 10}, { 0x04CC, 11}, { 0x0034, 8}, { 0x0265, 10}, { 0x009F, 12}, { 0x00E0, 8}, { 0x0016, 11}, { 0x0327, 12}, { 0x0015, 9}, { 0x017D, 11}, { 0x0EBB, 12}, { 0x0014, 9}, { 0x00F6, 10}, { 0x01E4, 11}, { 0x00CB, 10}, { 0x099D, 12}, { 0x00CA, 10}, { 0x02FC, 12}, { 0x017F, 11}, { 0x04CD, 11}, { 0x02FD, 12}, { 0x04FE, 11}, { 0x013A, 13}, { 0x000A, 4}, { 0x0042, 7}, { 0x01D3, 9}, { 0x04DD, 11}, { 0x0012, 5}, { 0x00E8, 8}, { 0x004C, 11}, { 0x0136, 13}, { 0x0039, 6}, { 0x0264, 10}, { 0x0EBA, 12}, { 0x0000, 7}, { 0x00AE, 10}, { 0x099C, 12}, { 0x001F, 7}, { 0x04DE, 11}, { 0x0043, 7}, { 0x04DC, 11}, { 0x0003, 8}, { 0x03CB, 12}, { 0x0006, 8}, { 0x099E, 12}, { 0x002A, 8}, { 0x05F1, 13}, { 0x000F, 8}, { 0x09FE, 12}, { 0x0033, 8}, { 0x09FF, 12}, { 0x0098, 8}, { 0x099F, 12}, { 0x00EA, 8}, { 0x013C, 13}, { 0x002E, 8}, { 0x0192, 11}, { 0x0136, 9}, { 0x006A, 9}, { 0x0015, 11}, { 0x03AF, 10}, { 0x01E3, 11}, { 0x0074, 11}, { 0x00EB, 12}, { 0x02F9, 12}, { 0x005C, 13}, { 0x00ED, 12}, { 0x03DD, 12}, { 0x0326, 12}, { 0x005E, 13}, { 0x0016, 7} }, { { 0x0004, 3}, { 0x0014, 5}, { 0x0017, 7}, { 0x007F, 8}, { 0x0154, 9}, { 0x01F2, 10}, { 0x00BF, 11}, { 0x0065, 12}, { 0x0AAA, 12}, { 0x0630, 13}, { 0x1597, 13}, { 0x03B7, 14}, { 0x2B22, 14}, { 0x0BE6, 15}, { 0x000B, 4}, { 0x0037, 7}, { 0x0062, 9}, { 0x0007, 11}, { 0x0166, 12}, { 0x00CE, 13}, { 0x1590, 13}, { 0x05F6, 14}, { 0x0BE7, 15}, { 0x0007, 5}, { 0x006D, 8}, { 0x0003, 11}, { 0x031F, 12}, { 0x05F2, 14}, { 0x0002, 6}, { 0x0061, 9}, { 0x0055, 12}, { 0x01DF, 14}, { 0x001A, 6}, { 0x001E, 10}, { 0x0AC9, 12}, { 0x2B23, 14}, { 0x001E, 6}, { 0x001F, 10}, { 0x0AC3, 12}, { 0x2B2B, 14}, { 0x0006, 7}, { 0x0004, 11}, { 0x02F8, 13}, { 0x0019, 7}, { 0x0006, 11}, { 0x063D, 13}, { 0x0057, 7}, { 0x0182, 11}, { 0x2AA2, 14}, { 0x0004, 8}, { 0x0180, 11}, { 0x059C, 14}, { 0x007D, 8}, { 0x0164, 12}, { 0x076D, 15}, { 0x0002, 9}, { 0x018D, 11}, { 0x1581, 13}, { 0x00AD, 8}, { 0x0060, 12}, { 0x0C67, 14}, { 0x001C, 9}, { 0x00EE, 13}, { 0x0003, 9}, { 0x02CF, 13}, { 0x00D9, 9}, { 0x1580, 13}, { 0x0002, 11}, { 0x0183, 11}, { 0x0057, 12}, { 0x0061, 12}, { 0x0031, 11}, { 0x0066, 12}, { 0x0631, 13}, { 0x0632, 13}, { 0x00AC, 13}, { 0x031D, 12}, { 0x0076, 12}, { 0x003A, 11}, { 0x0165, 12}, { 0x0C66, 14}, { 0x0003, 2}, { 0x0054, 7}, { 0x02AB, 10}, { 0x0016, 13}, { 0x05F7, 14}, { 0x0005, 4}, { 0x00F8, 9}, { 0x0AA9, 12}, { 0x005F, 15}, { 0x0004, 4}, { 0x001C, 10}, { 0x1550, 13}, { 0x0004, 5}, { 0x0077, 11}, { 0x076C, 15}, { 0x000E, 5}, { 0x000A, 12}, { 0x000C, 5}, { 0x0562, 11}, { 0x0004, 6}, { 0x031C, 12}, { 0x0006, 6}, { 0x00C8, 13}, { 0x000D, 6}, { 0x01DA, 13}, { 0x0007, 6}, { 0x00C9, 13}, { 0x0001, 7}, { 0x002E, 14}, { 0x0014, 7}, { 0x1596, 13}, { 0x000A, 7}, { 0x0AC2, 12}, { 0x0016, 7}, { 0x015B, 14}, { 0x0015, 7}, { 0x015A, 14}, { 0x000F, 8}, { 0x005E, 15}, { 0x007E, 8}, { 0x00AB, 8}, { 0x002D, 9}, { 0x00D8, 9}, { 0x000B, 9}, { 0x0014, 10}, { 0x02B3, 10}, { 0x01F3, 10}, { 0x003A, 10}, { 0x0000, 10}, { 0x0058, 10}, { 0x002E, 9}, { 0x005E, 10}, { 0x0563, 11}, { 0x00EC, 12}, { 0x0054, 12}, { 0x0AC1, 12}, { 0x1556, 13}, { 0x02FA, 13}, { 0x0181, 11}, { 0x1557, 13}, { 0x059D, 14}, { 0x2AA3, 14}, { 0x2B2A, 14}, { 0x01DE, 14}, { 0x063C, 13}, { 0x00CF, 13}, { 0x1594, 13}, { 0x000D, 9} }, { { 0x0002, 2}, { 0x0006, 3}, { 0x000F, 4}, { 0x000D, 5}, { 0x000C, 5}, { 0x0015, 6}, { 0x0013, 6}, { 0x0012, 6}, { 0x0017, 7}, { 0x001F, 8}, { 0x001E, 8}, { 0x001D, 8}, { 0x0025, 9}, { 0x0024, 9}, { 0x0023, 9}, { 0x0021, 9}, { 0x0021, 10}, { 0x0020, 10}, { 0x000F, 10}, { 0x000E, 10}, { 0x0007, 11}, { 0x0006, 11}, { 0x0020, 11}, { 0x0021, 11}, { 0x0050, 12}, { 0x0051, 12}, { 0x0052, 12}, { 0x000E, 4}, { 0x0014, 6}, { 0x0016, 7}, { 0x001C, 8}, { 0x0020, 9}, { 0x001F, 9}, { 0x000D, 10}, { 0x0022, 11}, { 0x0053, 12}, { 0x0055, 12}, { 0x000B, 5}, { 0x0015, 7}, { 0x001E, 9}, { 0x000C, 10}, { 0x0056, 12}, { 0x0011, 6}, { 0x001B, 8}, { 0x001D, 9}, { 0x000B, 10}, { 0x0010, 6}, { 0x0022, 9}, { 0x000A, 10}, { 0x000D, 6}, { 0x001C, 9}, { 0x0008, 10}, { 0x0012, 7}, { 0x001B, 9}, { 0x0054, 12}, { 0x0014, 7}, { 0x001A, 9}, { 0x0057, 12}, { 0x0019, 8}, { 0x0009, 10}, { 0x0018, 8}, { 0x0023, 11}, { 0x0017, 8}, { 0x0019, 9}, { 0x0018, 9}, { 0x0007, 10}, { 0x0058, 12}, { 0x0007, 4}, { 0x000C, 6}, { 0x0016, 8}, { 0x0017, 9}, { 0x0006, 10}, { 0x0005, 11}, { 0x0004, 11}, { 0x0059, 12}, { 0x000F, 6}, { 0x0016, 9}, { 0x0005, 10}, { 0x000E, 6}, { 0x0004, 10}, { 0x0011, 7}, { 0x0024, 11}, { 0x0010, 7}, { 0x0025, 11}, { 0x0013, 7}, { 0x005A, 12}, { 0x0015, 8}, { 0x005B, 12}, { 0x0014, 8}, { 0x0013, 8}, { 0x001A, 8}, { 0x0015, 9}, { 0x0014, 9}, { 0x0013, 9}, { 0x0012, 9}, { 0x0011, 9}, { 0x0026, 11}, { 0x0027, 11}, { 0x005C, 12}, { 0x005D, 12}, { 0x005E, 12}, { 0x005F, 12}, { 0x0003, 7} }, { { 0x0002, 2}, { 0x000F, 4}, { 0x0015, 6}, { 0x0017, 7}, { 0x001F, 8}, { 0x0025, 9}, { 0x0024, 9}, { 0x0021, 10}, { 0x0020, 10}, { 0x0007, 11}, { 0x0006, 11}, { 0x0020, 11}, { 0x0006, 3}, { 0x0014, 6}, { 0x001E, 8}, { 0x000F, 10}, { 0x0021, 11}, { 0x0050, 12}, { 0x000E, 4}, { 0x001D, 8}, { 0x000E, 10}, { 0x0051, 12}, { 0x000D, 5}, { 0x0023, 9}, { 0x000D, 10}, { 0x000C, 5}, { 0x0022, 9}, { 0x0052, 12}, { 0x000B, 5}, { 0x000C, 10}, { 0x0053, 12}, { 0x0013, 6}, { 0x000B, 10}, { 0x0054, 12}, { 0x0012, 6}, { 0x000A, 10}, { 0x0011, 6}, { 0x0009, 10}, { 0x0010, 6}, { 0x0008, 10}, { 0x0016, 7}, { 0x0055, 12}, { 0x0015, 7}, { 0x0014, 7}, { 0x001C, 8}, { 0x001B, 8}, { 0x0021, 9}, { 0x0020, 9}, { 0x001F, 9}, { 0x001E, 9}, { 0x001D, 9}, { 0x001C, 9}, { 0x001B, 9}, { 0x001A, 9}, { 0x0022, 11}, { 0x0023, 11}, { 0x0056, 12}, { 0x0057, 12}, { 0x0007, 4}, { 0x0019, 9}, { 0x0005, 11}, { 0x000F, 6}, { 0x0004, 11}, { 0x000E, 6}, { 0x000D, 6}, { 0x000C, 6}, { 0x0013, 7}, { 0x0012, 7}, { 0x0011, 7}, { 0x0010, 7}, { 0x001A, 8}, { 0x0019, 8}, { 0x0018, 8}, { 0x0017, 8}, { 0x0016, 8}, { 0x0015, 8}, { 0x0014, 8}, { 0x0013, 8}, { 0x0018, 9}, { 0x0017, 9}, { 0x0016, 9}, { 0x0015, 9}, { 0x0014, 9}, { 0x0013, 9}, { 0x0012, 9}, { 0x0011, 9}, { 0x0007, 10}, { 0x0006, 10}, { 0x0005, 10}, { 0x0004, 10}, { 0x0024, 11}, { 0x0025, 11}, { 0x0026, 11}, { 0x0027, 11}, { 0x0058, 12}, { 0x0059, 12}, { 0x005A, 12}, { 0x005B, 12}, { 0x005C, 12}, { 0x005D, 12}, { 0x005E, 12}, { 0x005F, 12}, { 0x0003, 7} }, { { 0x0000, 2}, { 0x0003, 3}, { 0x000D, 4}, { 0x0005, 4}, { 0x001C, 5}, { 0x0016, 5}, { 0x003F, 6}, { 0x003A, 6}, { 0x002E, 6}, { 0x0022, 6}, { 0x007B, 7}, { 0x0067, 7}, { 0x005F, 7}, { 0x0047, 7}, { 0x0026, 7}, { 0x00EF, 8}, { 0x00CD, 8}, { 0x00C1, 8}, { 0x00A9, 8}, { 0x004F, 8}, { 0x01F2, 9}, { 0x01DD, 9}, { 0x0199, 9}, { 0x0185, 9}, { 0x015D, 9}, { 0x011B, 9}, { 0x03EF, 10}, { 0x03E1, 10}, { 0x03C8, 10}, { 0x0331, 10}, { 0x0303, 10}, { 0x02F1, 10}, { 0x02A0, 10}, { 0x0233, 10}, { 0x0126, 10}, { 0x07C0, 11}, { 0x076F, 11}, { 0x076C, 11}, { 0x0661, 11}, { 0x0604, 11}, { 0x0572, 11}, { 0x0551, 11}, { 0x046A, 11}, { 0x0274, 11}, { 0x0F27, 12}, { 0x0F24, 12}, { 0x0EDB, 12}, { 0x0C8E, 12}, { 0x0C0B, 12}, { 0x0C0A, 12}, { 0x0AE3, 12}, { 0x08D6, 12}, { 0x0490, 12}, { 0x0495, 12}, { 0x1F19, 13}, { 0x1DB5, 13}, { 0x0009, 4}, { 0x0010, 5}, { 0x0029, 6}, { 0x0062, 7}, { 0x00F3, 8}, { 0x00AD, 8}, { 0x01E5, 9}, { 0x0179, 9}, { 0x009C, 9}, { 0x03B1, 10}, { 0x02AE, 10}, { 0x0127, 10}, { 0x076E, 11}, { 0x0570, 11}, { 0x0275, 11}, { 0x0F25, 12}, { 0x0EC0, 12}, { 0x0AA0, 12}, { 0x08D7, 12}, { 0x1E4C, 13}, { 0x0008, 5}, { 0x0063, 7}, { 0x00AF, 8}, { 0x017B, 9}, { 0x03B3, 10}, { 0x07DD, 11}, { 0x0640, 11}, { 0x0F8D, 12}, { 0x0BC1, 12}, { 0x0491, 12}, { 0x0028, 6}, { 0x00C3, 8}, { 0x0151, 9}, { 0x02A1, 10}, { 0x0573, 11}, { 0x0EC3, 12}, { 0x1F35, 13}, { 0x0065, 7}, { 0x01DA, 9}, { 0x02AF, 10}, { 0x0277, 11}, { 0x08C9, 12}, { 0x1781, 13}, { 0x0025, 7}, { 0x0118, 9}, { 0x0646, 11}, { 0x0AA6, 12}, { 0x1780, 13}, { 0x00C9, 8}, { 0x0321, 10}, { 0x0F9B, 12}, { 0x191E, 13}, { 0x0048, 8}, { 0x07CC, 11}, { 0x0AA1, 12}, { 0x0180, 9}, { 0x0465, 11}, { 0x1905, 13}, { 0x03E2, 10}, { 0x0EC1, 12}, { 0x3C9B, 14}, { 0x02F4, 10}, { 0x08C8, 12}, { 0x07C1, 11}, { 0x0928, 13}, { 0x05E1, 11}, { 0x320D, 14}, { 0x0EC2, 12}, { 0x6418, 15}, { 0x1F34, 13}, { 0x0078, 7}, { 0x0155, 9}, { 0x0552, 11}, { 0x191F, 13}, { 0x00FA, 8}, { 0x07DC, 11}, { 0x1907, 13}, { 0x00AC, 8}, { 0x0249, 11}, { 0x13B1, 14}, { 0x01F6, 9}, { 0x0AE2, 12}, { 0x01DC, 9}, { 0x04ED, 12}, { 0x0184, 9}, { 0x1904, 13}, { 0x0156, 9}, { 0x09D9, 13}, { 0x03E7, 10}, { 0x0929, 13}, { 0x03B2, 10}, { 0x3B68, 14}, { 0x02F5, 10}, { 0x13B0, 14}, { 0x0322, 10}, { 0x3B69, 14}, { 0x0234, 10}, { 0x7935, 15}, { 0x07C7, 11}, { 0xC833, 16}, { 0x0660, 11}, { 0x7934, 15}, { 0x024B, 11}, { 0xC832, 16}, { 0x0AA7, 12}, { 0x1F18, 13}, { 0x007A, 7} }, { { 0x0002, 2}, { 0x0000, 3}, { 0x001E, 5}, { 0x0004, 5}, { 0x0012, 6}, { 0x0070, 7}, { 0x001A, 7}, { 0x005F, 8}, { 0x0047, 8}, { 0x01D3, 9}, { 0x00B5, 9}, { 0x0057, 9}, { 0x03B5, 10}, { 0x016D, 10}, { 0x0162, 10}, { 0x07CE, 11}, { 0x0719, 11}, { 0x0691, 11}, { 0x02C6, 11}, { 0x0156, 11}, { 0x0F92, 12}, { 0x0D2E, 12}, { 0x0D20, 12}, { 0x059E, 12}, { 0x0468, 12}, { 0x02A6, 12}, { 0x1DA2, 13}, { 0x1C60, 13}, { 0x1A43, 13}, { 0x0B1D, 13}, { 0x08C0, 13}, { 0x055D, 13}, { 0x0003, 3}, { 0x000A, 5}, { 0x0077, 7}, { 0x00E5, 8}, { 0x01D9, 9}, { 0x03E5, 10}, { 0x0166, 10}, { 0x0694, 11}, { 0x0152, 11}, { 0x059F, 12}, { 0x1F3C, 13}, { 0x1A4B, 13}, { 0x055E, 13}, { 0x000C, 4}, { 0x007D, 7}, { 0x0044, 8}, { 0x03E0, 10}, { 0x0769, 11}, { 0x0E31, 12}, { 0x1F26, 13}, { 0x055C, 13}, { 0x001B, 5}, { 0x00E2, 8}, { 0x03A5, 10}, { 0x02C9, 11}, { 0x1F23, 13}, { 0x3B47, 14}, { 0x0007, 5}, { 0x01D8, 9}, { 0x02D8, 11}, { 0x1F27, 13}, { 0x3494, 14}, { 0x0035, 6}, { 0x03E1, 10}, { 0x059C, 12}, { 0x38C3, 14}, { 0x000C, 6}, { 0x0165, 10}, { 0x1D23, 13}, { 0x1638, 14}, { 0x0068, 7}, { 0x0693, 11}, { 0x3A45, 14}, { 0x0020, 7}, { 0x0F90, 12}, { 0x7CF6, 15}, { 0x00E8, 8}, { 0x058F, 12}, { 0x2CEF, 15}, { 0x0045, 8}, { 0x0B3A, 13}, { 0x01F1, 9}, { 0x3B46, 14}, { 0x01A7, 9}, { 0x1676, 14}, { 0x0056, 9}, { 0x692A, 15}, { 0x038D, 10}, { 0xE309, 16}, { 0x00AA, 10}, { 0x1C611, 17}, { 0x02DF, 11}, { 0xB3B9, 17}, { 0x02C8, 11}, { 0x38C20, 18}, { 0x01B0, 11}, { 0x16390, 18}, { 0x0F9F, 12}, { 0x16771, 18}, { 0x0ED0, 12}, { 0x71843, 19}, { 0x0D2A, 12}, { 0xF9E8C, 20}, { 0x0461, 12}, { 0xF9E8E, 20}, { 0x0B67, 13}, { 0x055F, 13}, { 0x003F, 6}, { 0x006D, 9}, { 0x0E90, 12}, { 0x054E, 13}, { 0x0013, 6}, { 0x0119, 10}, { 0x0B66, 13}, { 0x000B, 6}, { 0x0235, 11}, { 0x7CF5, 15}, { 0x0075, 7}, { 0x0D24, 12}, { 0xF9E9, 16}, { 0x002E, 7}, { 0x1F22, 13}, { 0x0021, 7}, { 0x054F, 13}, { 0x0014, 7}, { 0x3A44, 14}, { 0x00E4, 8}, { 0x7CF7, 15}, { 0x005E, 8}, { 0x7185, 15}, { 0x0037, 8}, { 0x2C73, 15}, { 0x01DB, 9}, { 0x59DD, 16}, { 0x01C7, 9}, { 0x692B, 15}, { 0x01A6, 9}, { 0x58E5, 16}, { 0x00B4, 9}, { 0x1F3D0, 17}, { 0x00B0, 9}, { 0xB1C9, 17}, { 0x03E6, 10}, { 0x16770, 18}, { 0x016E, 10}, { 0x3E7A2, 18}, { 0x011B, 10}, { 0xF9E8D, 20}, { 0x00D9, 10}, { 0xF9E8F, 20}, { 0x00A8, 10}, { 0x2C723, 19}, { 0x0749, 11}, { 0xE3084, 20}, { 0x0696, 11}, { 0x58E45, 20}, { 0x02DE, 11}, { 0xB1C88, 21}, { 0x0231, 11}, { 0x1C610A, 21}, { 0x01B1, 11}, { 0x71842D, 23}, { 0x0D2B, 12}, { 0x38C217, 22}, { 0x0D2F, 12}, { 0x163913, 22}, { 0x05B2, 12}, { 0x163912, 22}, { 0x0469, 12}, { 0x71842C, 23}, { 0x1A42, 13}, { 0x08C1, 13}, { 0x0073, 7} } }; /* which indexes point to last=1 entries in tables */ static const int vc1_last_decode_table[AC_MODES] = { 119, 99, 85, 81, 67, 58, 126, 109 }; static const uint8_t vc1_index_decode_table[AC_MODES][185][2] = { { { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8}, { 0, 9}, { 0, 10}, { 0, 11}, { 0, 12}, { 0, 13}, { 0, 14}, { 0, 15}, { 0, 16}, { 0, 17}, { 0, 18}, { 0, 19}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 5}, { 1, 6}, { 1, 7}, { 1, 8}, { 1, 9}, { 1, 10}, { 1, 11}, { 1, 12}, { 1, 13}, { 1, 14}, { 1, 15}, { 2, 1}, { 2, 2}, { 2, 3}, { 2, 4}, { 2, 5}, { 2, 6}, { 2, 7}, { 2, 8}, { 2, 9}, { 2, 10}, { 2, 11}, { 2, 12}, { 3, 1}, { 3, 2}, { 3, 3}, { 3, 4}, { 3, 5}, { 3, 6}, { 3, 7}, { 3, 8}, { 3, 9}, { 3, 10}, { 3, 11}, { 4, 1}, { 4, 2}, { 4, 3}, { 4, 4}, { 4, 5}, { 4, 6}, { 5, 1}, { 5, 2}, { 5, 3}, { 5, 4}, { 5, 5}, { 6, 1}, { 6, 2}, { 6, 3}, { 6, 4}, { 7, 1}, { 7, 2}, { 7, 3}, { 7, 4}, { 8, 1}, { 8, 2}, { 8, 3}, { 8, 4}, { 9, 1}, { 9, 2}, { 9, 3}, { 9, 4}, { 10, 1}, { 10, 2}, { 10, 3}, { 11, 1}, { 11, 2}, { 11, 3}, { 12, 1}, { 12, 2}, { 12, 3}, { 13, 1}, { 13, 2}, { 13, 3}, { 14, 1}, { 14, 2}, { 14, 3}, { 15, 1}, { 15, 2}, { 15, 3}, { 16, 1}, { 16, 2}, { 17, 1}, { 17, 2}, { 18, 1}, { 19, 1}, { 20, 1}, { 21, 1}, { 22, 1}, { 23, 1}, { 24, 1}, { 25, 1}, { 26, 1}, { 27, 1}, { 28, 1}, { 29, 1}, { 30, 1}, { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 5}, { 2, 1}, { 2, 2}, { 2, 3}, { 2, 4}, { 3, 1}, { 3, 2}, { 3, 3}, { 3, 4}, { 4, 1}, { 4, 2}, { 4, 3}, { 5, 1}, { 5, 2}, { 6, 1}, { 6, 2}, { 7, 1}, { 7, 2}, { 8, 1}, { 8, 2}, { 9, 1}, { 9, 2}, { 10, 1}, { 10, 2}, { 11, 1}, { 11, 2}, { 12, 1}, { 12, 2}, { 13, 1}, { 13, 2}, { 14, 1}, { 14, 2}, { 15, 1}, { 15, 2}, { 16, 1}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1}, { 21, 1}, { 22, 1}, { 23, 1}, { 24, 1}, { 25, 1}, { 26, 1}, { 27, 1}, { 28, 1}, { 29, 1}, { 30, 1}, { 31, 1}, { 32, 1}, { 33, 1}, { 34, 1}, { 35, 1}, { 36, 1}, { 37, 1} }, { { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8}, { 0, 9}, { 0, 10}, { 0, 11}, { 0, 12}, { 0, 13}, { 0, 14}, { 0, 15}, { 0, 16}, { 0, 17}, { 0, 18}, { 0, 19}, { 0, 20}, { 0, 21}, { 0, 22}, { 0, 23}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 5}, { 1, 6}, { 1, 7}, { 1, 8}, { 1, 9}, { 1, 10}, { 1, 11}, { 2, 1}, { 2, 2}, { 2, 3}, { 2, 4}, { 2, 5}, { 2, 6}, { 2, 7}, { 2, 8}, { 3, 1}, { 3, 2}, { 3, 3}, { 3, 4}, { 3, 5}, { 3, 6}, { 3, 7}, { 4, 1}, { 4, 2}, { 4, 3}, { 4, 4}, { 4, 5}, { 5, 1}, { 5, 2}, { 5, 3}, { 5, 4}, { 5, 5}, { 6, 1}, { 6, 2}, { 6, 3}, { 6, 4}, { 7, 1}, { 7, 2}, { 7, 3}, { 7, 4}, { 8, 1}, { 8, 2}, { 8, 3}, { 9, 1}, { 9, 2}, { 9, 3}, { 10, 1}, { 10, 2}, { 10, 3}, { 11, 1}, { 11, 2}, { 11, 3}, { 12, 1}, { 12, 2}, { 13, 1}, { 13, 2}, { 14, 1}, { 14, 2}, { 15, 1}, { 15, 2}, { 16, 1}, { 16, 2}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1}, { 21, 1}, { 22, 1}, { 23, 1}, { 24, 1}, { 25, 1}, { 26, 1}, { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8}, { 0, 9}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 5}, { 2, 1}, { 2, 2}, { 2, 3}, { 2, 4}, { 3, 1}, { 3, 2}, { 3, 3}, { 3, 4}, { 4, 1}, { 4, 2}, { 4, 3}, { 5, 1}, { 5, 2}, { 5, 3}, { 6, 1}, { 6, 2}, { 6, 3}, { 7, 1}, { 7, 2}, { 8, 1}, { 8, 2}, { 9, 1}, { 9, 2}, { 10, 1}, { 10, 2}, { 11, 1}, { 11, 2}, { 12, 1}, { 12, 2}, { 13, 1}, { 13, 2}, { 14, 1}, { 14, 2}, { 15, 1}, { 16, 1}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1}, { 21, 1}, { 22, 1}, { 23, 1}, { 24, 1}, { 25, 1}, { 26, 1}, { 27, 1}, { 28, 1}, { 29, 1}, { 30, 1}, { 31, 1}, { 32, 1}, { 33, 1}, { 34, 1}, { 35, 1}, { 36, 1} }, { { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8}, { 0, 9}, { 0, 10}, { 0, 11}, { 0, 12}, { 0, 13}, { 0, 14}, { 0, 15}, { 0, 16}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 5}, { 1, 6}, { 1, 7}, { 1, 8}, { 1, 9}, { 1, 10}, { 1, 11}, { 2, 1}, { 2, 2}, { 2, 3}, { 2, 4}, { 2, 5}, { 2, 6}, { 2, 7}, { 2, 8}, { 3, 1}, { 3, 2}, { 3, 3}, { 3, 4}, { 3, 5}, { 3, 6}, { 3, 7}, { 4, 1}, { 4, 2}, { 4, 3}, { 4, 4}, { 4, 5}, { 5, 1}, { 5, 2}, { 5, 3}, { 5, 4}, { 6, 1}, { 6, 2}, { 6, 3}, { 6, 4}, { 7, 1}, { 7, 2}, { 7, 3}, { 8, 1}, { 8, 2}, { 8, 3}, { 9, 1}, { 9, 2}, { 9, 3}, { 10, 1}, { 10, 2}, { 10, 3}, { 11, 1}, { 11, 2}, { 11, 3}, { 12, 1}, { 12, 2}, { 12, 3}, { 13, 1}, { 13, 2}, { 13, 3}, { 14, 1}, { 14, 2}, { 15, 1}, { 15, 2}, { 16, 1}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1}, { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 2, 1}, { 2, 2}, { 2, 3}, { 3, 1}, { 3, 2}, { 3, 3}, { 4, 1}, { 4, 2}, { 5, 1}, { 5, 2}, { 6, 1}, { 6, 2}, { 7, 1}, { 7, 2}, { 8, 1}, { 8, 2}, { 9, 1}, { 9, 2}, { 10, 1}, { 10, 2}, { 11, 1}, { 11, 2}, { 12, 1}, { 12, 2}, { 13, 1}, { 13, 2}, { 14, 1}, { 15, 1}, { 16, 1}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1}, { 21, 1}, { 22, 1}, { 23, 1}, { 24, 1}, { 25, 1}, { 26, 1} }, { { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8}, { 0, 9}, { 0, 10}, { 0, 11}, { 0, 12}, { 0, 13}, { 0, 14}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 5}, { 1, 6}, { 1, 7}, { 1, 8}, { 1, 9}, { 2, 1}, { 2, 2}, { 2, 3}, { 2, 4}, { 2, 5}, { 3, 1}, { 3, 2}, { 3, 3}, { 3, 4}, { 4, 1}, { 4, 2}, { 4, 3}, { 4, 4}, { 5, 1}, { 5, 2}, { 5, 3}, { 5, 4}, { 6, 1}, { 6, 2}, { 6, 3}, { 7, 1}, { 7, 2}, { 7, 3}, { 8, 1}, { 8, 2}, { 8, 3}, { 9, 1}, { 9, 2}, { 9, 3}, { 10, 1}, { 10, 2}, { 10, 3}, { 11, 1}, { 11, 2}, { 11, 3}, { 12, 1}, { 12, 2}, { 12, 3}, { 13, 1}, { 13, 2}, { 14, 1}, { 14, 2}, { 15, 1}, { 15, 2}, { 16, 1}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1}, { 21, 1}, { 22, 1}, { 23, 1}, { 24, 1}, { 25, 1}, { 26, 1}, { 27, 1}, { 28, 1}, { 29, 1}, { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 2, 1}, { 2, 2}, { 2, 3}, { 3, 1}, { 3, 2}, { 3, 3}, { 4, 1}, { 4, 2}, { 5, 1}, { 5, 2}, { 6, 1}, { 6, 2}, { 7, 1}, { 7, 2}, { 8, 1}, { 8, 2}, { 9, 1}, { 9, 2}, { 10, 1}, { 10, 2}, { 11, 1}, { 11, 2}, { 12, 1}, { 12, 2}, { 13, 1}, { 13, 2}, { 14, 1}, { 14, 2}, { 15, 1}, { 15, 2}, { 16, 1}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1}, { 21, 1}, { 22, 1}, { 23, 1}, { 24, 1}, { 25, 1}, { 26, 1}, { 27, 1}, { 28, 1}, { 29, 1}, { 30, 1}, { 31, 1}, { 32, 1}, { 33, 1}, { 34, 1}, { 35, 1}, { 36, 1}, { 37, 1}, { 38, 1}, { 39, 1}, { 40, 1}, { 41, 1}, { 42, 1}, { 43, 1} }, { { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8}, { 0, 9}, { 0, 10}, { 0, 11}, { 0, 12}, { 0, 13}, { 0, 14}, { 0, 15}, { 0, 16}, { 0, 17}, { 0, 18}, { 0, 19}, { 0, 20}, { 0, 21}, { 0, 22}, { 0, 23}, { 0, 24}, { 0, 25}, { 0, 26}, { 0, 27}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 5}, { 1, 6}, { 1, 7}, { 1, 8}, { 1, 9}, { 1, 10}, { 2, 1}, { 2, 2}, { 2, 3}, { 2, 4}, { 2, 5}, { 3, 1}, { 3, 2}, { 3, 3}, { 3, 4}, { 4, 1}, { 4, 2}, { 4, 3}, { 5, 1}, { 5, 2}, { 5, 3}, { 6, 1}, { 6, 2}, { 6, 3}, { 7, 1}, { 7, 2}, { 7, 3}, { 8, 1}, { 8, 2}, { 9, 1}, { 9, 2}, { 10, 1}, { 11, 1}, { 12, 1}, { 13, 1}, { 14, 1}, { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8}, { 1, 1}, { 1, 2}, { 1, 3}, { 2, 1}, { 2, 2}, { 3, 1}, { 3, 2}, { 4, 1}, { 4, 2}, { 5, 1}, { 5, 2}, { 6, 1}, { 6, 2}, { 7, 1}, { 8, 1}, { 9, 1}, { 10, 1}, { 11, 1}, { 12, 1}, { 13, 1}, { 14, 1}, { 15, 1}, { 16, 1}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1} }, { { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8}, { 0, 9}, { 0, 10}, { 0, 11}, { 0, 12}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 5}, { 1, 6}, { 2, 1}, { 2, 2}, { 2, 3}, { 2, 4}, { 3, 1}, { 3, 2}, { 3, 3}, { 4, 1}, { 4, 2}, { 4, 3}, { 5, 1}, { 5, 2}, { 5, 3}, { 6, 1}, { 6, 2}, { 6, 3}, { 7, 1}, { 7, 2}, { 8, 1}, { 8, 2}, { 9, 1}, { 9, 2}, { 10, 1}, { 10, 2}, { 11, 1}, { 12, 1}, { 13, 1}, { 14, 1}, { 15, 1}, { 16, 1}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1}, { 21, 1}, { 22, 1}, { 23, 1}, { 24, 1}, { 25, 1}, { 26, 1}, { 0, 1}, { 0, 2}, { 0, 3}, { 1, 1}, { 1, 2}, { 2, 1}, { 3, 1}, { 4, 1}, { 5, 1}, { 6, 1}, { 7, 1}, { 8, 1}, { 9, 1}, { 10, 1}, { 11, 1}, { 12, 1}, { 13, 1}, { 14, 1}, { 15, 1}, { 16, 1}, { 17, 1}, { 18, 1}, { 19, 1}, { 20, 1}, { 21, 1}, { 22, 1}, { 23, 1}, { 24, 1}, { 25, 1}, { 26, 1}, { 27, 1}, { 28, 1}, { 29, 1}, { 30, 1}, { 31, 1}, { 32, 1}, { 33, 1}, { 34, 1}, { 35, 1}, { 36, 1}, { 37, 1}, { 38, 1}, { 39, 1}, { 40, 1} }, { { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8}, { 0, 9}, { 0, 10}, { 0, 11}, { 0, 12}, { 0, 13}, { 0, 14}, { 0, 15}, { 0, 16}, { 0, 17}, { 0, 18}, { 0, 19}, { 0, 20}, { 0, 21}, { 0, 22}, { 0, 23}, { 0, 24}, { 0, 25}, { 0, 26}, { 0, 27}, { 0, 28}, { 0, 29}, { 0, 30}, { 0, 31}, { 0, 32}, { 0, 33}, { 0, 34}, { 0, 35}, { 0, 36}, { 0, 37}, { 0, 38}, { 0, 39}, { 0, 40}, { 0, 41}, { 0, 42}, { 0, 43}, { 0, 44}, { 0, 45}, { 0, 46}, { 0, 47}, { 0, 48}, { 0, 49}, { 0, 50}, { 0, 51}, { 0, 52}, { 0, 53}, { 0, 54}, { 0, 55}, { 0, 56}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 5}, { 1, 6}, { 1, 7}, { 1, 8}, { 1, 9}, { 1, 10}, { 1, 11}, { 1, 12}, { 1, 13}, { 1, 14}, { 1, 15}, { 1, 16}, { 1, 17}, { 1, 18}, { 1, 19}, { 1, 20}, { 2, 1}, { 2, 2}, { 2, 3}, { 2, 4}, { 2, 5}, { 2, 6}, { 2, 7}, { 2, 8}, { 2, 9}, { 2, 10}, { 3, 1}, { 3, 2}, { 3, 3}, { 3, 4}, { 3, 5}, { 3, 6}, { 3, 7}, { 4, 1}, { 4, 2}, { 4, 3}, { 4, 4}, { 4, 5}, { 4, 6}, { 5, 1}, { 5, 2}, { 5, 3}, { 5, 4}, { 5, 5}, { 6, 1}, { 6, 2}, { 6, 3}, { 6, 4}, { 7, 1}, { 7, 2}, { 7, 3}, { 8, 1}, { 8, 2}, { 8, 3}, { 9, 1}, { 9, 2}, { 9, 3}, { 10, 1}, { 10, 2}, { 11, 1}, { 11, 2}, { 12, 1}, { 12, 2}, { 13, 1}, { 13, 2}, { 14, 1}, { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 1, 1}, { 1, 2}, { 1, 3}, { 2, 1}, { 2, 2}, { 2, 3}, { 3, 1}, { 3, 2}, { 4, 1}, { 4, 2}, { 5, 1}, { 5, 2}, { 6, 1}, { 6, 2}, { 7, 1}, { 7, 2}, { 8, 1}, { 8, 2}, { 9, 1}, { 9, 2}, { 10, 1}, { 10, 2}, { 11, 1}, { 11, 2}, { 12, 1}, { 12, 2}, { 13, 1}, { 13, 2}, { 14, 1}, { 14, 2}, { 15, 1}, { 16, 1} }, { { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 0, 5}, { 0, 6}, { 0, 7}, { 0, 8}, { 0, 9}, { 0, 10}, { 0, 11}, { 0, 12}, { 0, 13}, { 0, 14}, { 0, 15}, { 0, 16}, { 0, 17}, { 0, 18}, { 0, 19}, { 0, 20}, { 0, 21}, { 0, 22}, { 0, 23}, { 0, 24}, { 0, 25}, { 0, 26}, { 0, 27}, { 0, 28}, { 0, 29}, { 0, 30}, { 0, 31}, { 0, 32}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 5}, { 1, 6}, { 1, 7}, { 1, 8}, { 1, 9}, { 1, 10}, { 1, 11}, { 1, 12}, { 1, 13}, { 2, 1}, { 2, 2}, { 2, 3}, { 2, 4}, { 2, 5}, { 2, 6}, { 2, 7}, { 2, 8}, { 3, 1}, { 3, 2}, { 3, 3}, { 3, 4}, { 3, 5}, { 3, 6}, { 4, 1}, { 4, 2}, { 4, 3}, { 4, 4}, { 4, 5}, { 5, 1}, { 5, 2}, { 5, 3}, { 5, 4}, { 6, 1}, { 6, 2}, { 6, 3}, { 6, 4}, { 7, 1}, { 7, 2}, { 7, 3}, { 8, 1}, { 8, 2}, { 8, 3}, { 9, 1}, { 9, 2}, { 9, 3}, { 10, 1}, { 10, 2}, { 11, 1}, { 11, 2}, { 12, 1}, { 12, 2}, { 13, 1}, { 13, 2}, { 14, 1}, { 14, 2}, { 15, 1}, { 15, 2}, { 16, 1}, { 16, 2}, { 17, 1}, { 17, 2}, { 18, 1}, { 18, 2}, { 19, 1}, { 19, 2}, { 20, 1}, { 20, 2}, { 21, 1}, { 21, 2}, { 22, 1}, { 22, 2}, { 23, 1}, { 24, 1}, { 0, 1}, { 0, 2}, { 0, 3}, { 0, 4}, { 1, 1}, { 1, 2}, { 1, 3}, { 2, 1}, { 2, 2}, { 2, 3}, { 3, 1}, { 3, 2}, { 3, 3}, { 4, 1}, { 4, 2}, { 5, 1}, { 5, 2}, { 6, 1}, { 6, 2}, { 7, 1}, { 7, 2}, { 8, 1}, { 8, 2}, { 9, 1}, { 9, 2}, { 10, 1}, { 10, 2}, { 11, 1}, { 11, 2}, { 12, 1}, { 12, 2}, { 13, 1}, { 13, 2}, { 14, 1}, { 14, 2}, { 15, 1}, { 15, 2}, { 16, 1}, { 16, 2}, { 17, 1}, { 17, 2}, { 18, 1}, { 18, 2}, { 19, 1}, { 19, 2}, { 20, 1}, { 20, 2}, { 21, 1}, { 21, 2}, { 22, 1}, { 22, 2}, { 23, 1}, { 23, 2}, { 24, 1}, { 24, 2}, { 25, 1}, { 25, 2}, { 26, 1}, { 26, 2}, { 27, 1}, { 27, 2}, { 28, 1}, { 28, 2}, { 29, 1}, { 30, 1} } }; static const uint8_t vc1_delta_level_table[AC_MODES][31] = { { 19, 15, 12, 11, 6, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, { 23, 11, 8, 7, 5, 5, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, { 16, 11, 8, 7, 5, 4, 4, 3, 3, 3, 3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 1 }, { 14, 9, 5, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, { 27, 10, 5, 4, 3, 3, 3, 3, 2, 2, 1, 1, 1, 1, 1 }, { 12, 6, 4, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, { 56, 20, 10, 7, 6, 5, 4, 3, 3, 3, 2, 2, 2, 2, 1 }, { 32, 13, 8, 6, 5, 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1 } }; static const uint8_t vc1_last_delta_level_table[AC_MODES][44] = { { 6, 5, 4, 4, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, { 9, 5, 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, { 4, 4, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, { 5, 4, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, { 8, 3, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, { 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, { 4, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1 }, { 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1 } }; static const uint8_t vc1_delta_run_table[AC_MODES][57] = { { -1, 30, 17, 15, 9, 5, 4, 3, 3, 3, 3, 3, 2, 1, 1, 1, 0, 0, 0, 0 }, { -1, 26, 16, 11, 7, 5, 3, 3, 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { -1, 20, 15, 13, 6, 4, 3, 3, 2, 1, 1, 1, 0, 0, 0, 0, 0 }, { -1, 29, 15, 12, 5, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0 }, { -1, 14, 9, 7, 3, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { -1, 26, 10, 6, 2, 1, 1, 0, 0, 0, 0, 0, 0 }, { -1, 14, 13, 9, 6, 5, 4, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { -1, 24, 22, 9, 6, 4, 3, 2, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; static const uint8_t vc1_last_delta_run_table[AC_MODES][10] = { { -1, 37, 15, 4, 3, 1, 0 }, { -1, 36, 14, 6, 3, 1, 0, 0, 0, 0 }, { -1, 26, 13, 3, 1 }, { -1, 43, 15, 3, 1, 0 }, { -1, 20, 6, 1, 0, 0, 0, 0, 0 }, { -1, 40, 1, 0 }, { -1, 16, 14, 2, 0 }, { -1, 30, 28, 3, 0 } }; #endif /* AVCODEC_VC1ACDATA_H */
123linslouis-android-video-cutter
jni/libavcodec/vc1acdata.h
C
asf20
37,634
/* * MPEG4 Video frame extraction * Copyright (c) 2003 Fabrice Bellard * Copyright (c) 2003 Michael Niedermayer * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "parser.h" #include "mpegvideo.h" #include "mpeg4video.h" #include "mpeg4video_parser.h" int ff_mpeg4_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size){ int vop_found, i; uint32_t state; vop_found= pc->frame_start_found; state= pc->state; i=0; if(!vop_found){ for(i=0; i<buf_size; i++){ state= (state<<8) | buf[i]; if(state == 0x1B6){ i++; vop_found=1; break; } } } if(vop_found){ /* EOF considered as end of frame */ if (buf_size == 0) return 0; for(; i<buf_size; i++){ state= (state<<8) | buf[i]; if((state&0xFFFFFF00) == 0x100){ pc->frame_start_found=0; pc->state=-1; return i-3; } } } pc->frame_start_found= vop_found; pc->state= state; return END_NOT_FOUND; } /* XXX: make it use less memory */ static int av_mpeg4_decode_header(AVCodecParserContext *s1, AVCodecContext *avctx, const uint8_t *buf, int buf_size) { ParseContext1 *pc = s1->priv_data; MpegEncContext *s = pc->enc; GetBitContext gb1, *gb = &gb1; int ret; s->avctx = avctx; s->current_picture_ptr = &s->current_picture; if (avctx->extradata_size && pc->first_picture){ init_get_bits(gb, avctx->extradata, avctx->extradata_size*8); ret = ff_mpeg4_decode_picture_header(s, gb); } init_get_bits(gb, buf, 8 * buf_size); ret = ff_mpeg4_decode_picture_header(s, gb); if (s->width && (!avctx->width || !avctx->height || !avctx->coded_width || !avctx->coded_height)) { avcodec_set_dimensions(avctx, s->width, s->height); } s1->pict_type= s->pict_type; pc->first_picture = 0; return ret; } static av_cold int mpeg4video_parse_init(AVCodecParserContext *s) { ParseContext1 *pc = s->priv_data; pc->enc = av_mallocz(sizeof(MpegEncContext)); if (!pc->enc) return -1; pc->first_picture = 1; return 0; } static int mpeg4video_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size) { ParseContext *pc = s->priv_data; int next; if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){ next= buf_size; }else{ next= ff_mpeg4_find_frame_end(pc, buf, buf_size); if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { *poutbuf = NULL; *poutbuf_size = 0; return buf_size; } } av_mpeg4_decode_header(s, avctx, buf, buf_size); *poutbuf = buf; *poutbuf_size = buf_size; return next; } AVCodecParser mpeg4video_parser = { { CODEC_ID_MPEG4 }, sizeof(ParseContext1), mpeg4video_parse_init, mpeg4video_parse, ff_parse1_close, ff_mpeg4video_split, };
123linslouis-android-video-cutter
jni/libavcodec/mpeg4video_parser.c
C
asf20
3,938
/* * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * H.264 / AVC / MPEG4 part10 codec. * @author Michael Niedermayer <michaelni@gmx.at> */ #ifndef AVCODEC_H264_H #define AVCODEC_H264_H #include "libavutil/intreadwrite.h" #include "dsputil.h" #include "cabac.h" #include "mpegvideo.h" #include "h264dsp.h" #include "h264pred.h" #include "rectangle.h" #define interlaced_dct interlaced_dct_is_a_bad_name #define mb_intra mb_intra_is_not_initialized_see_mb_type #define LUMA_DC_BLOCK_INDEX 25 #define CHROMA_DC_BLOCK_INDEX 26 #define CHROMA_DC_COEFF_TOKEN_VLC_BITS 8 #define COEFF_TOKEN_VLC_BITS 8 #define TOTAL_ZEROS_VLC_BITS 9 #define CHROMA_DC_TOTAL_ZEROS_VLC_BITS 3 #define RUN_VLC_BITS 3 #define RUN7_VLC_BITS 6 #define MAX_SPS_COUNT 32 #define MAX_PPS_COUNT 256 #define MAX_MMCO_COUNT 66 #define MAX_DELAYED_PIC_COUNT 16 /* Compiling in interlaced support reduces the speed * of progressive decoding by about 2%. */ #define ALLOW_INTERLACE #define ALLOW_NOCHROMA #define FMO 0 /** * The maximum number of slices supported by the decoder. * must be a power of 2 */ #define MAX_SLICES 16 #ifdef ALLOW_INTERLACE #define MB_MBAFF h->mb_mbaff #define MB_FIELD h->mb_field_decoding_flag #define FRAME_MBAFF h->mb_aff_frame #define FIELD_PICTURE (s->picture_structure != PICT_FRAME) #else #define MB_MBAFF 0 #define MB_FIELD 0 #define FRAME_MBAFF 0 #define FIELD_PICTURE 0 #undef IS_INTERLACED #define IS_INTERLACED(mb_type) 0 #endif #define FIELD_OR_MBAFF_PICTURE (FRAME_MBAFF || FIELD_PICTURE) #ifdef ALLOW_NOCHROMA #define CHROMA h->sps.chroma_format_idc #else #define CHROMA 1 #endif #ifndef CABAC #define CABAC h->pps.cabac #endif #define EXTENDED_SAR 255 #define MB_TYPE_REF0 MB_TYPE_ACPRED //dirty but it fits in 16 bit #define MB_TYPE_8x8DCT 0x01000000 #define IS_REF0(a) ((a) & MB_TYPE_REF0) #define IS_8x8DCT(a) ((a) & MB_TYPE_8x8DCT) /** * Value of Picture.reference when Picture is not a reference picture, but * is held for delayed output. */ #define DELAYED_PIC_REF 4 /* NAL unit types */ enum { NAL_SLICE=1, NAL_DPA, NAL_DPB, NAL_DPC, NAL_IDR_SLICE, NAL_SEI, NAL_SPS, NAL_PPS, NAL_AUD, NAL_END_SEQUENCE, NAL_END_STREAM, NAL_FILLER_DATA, NAL_SPS_EXT, NAL_AUXILIARY_SLICE=19 }; /** * SEI message types */ typedef enum { SEI_BUFFERING_PERIOD = 0, ///< buffering period (H.264, D.1.1) SEI_TYPE_PIC_TIMING = 1, ///< picture timing SEI_TYPE_USER_DATA_UNREGISTERED = 5, ///< unregistered user data SEI_TYPE_RECOVERY_POINT = 6 ///< recovery point (frame # to decoder sync) } SEI_Type; /** * pic_struct in picture timing SEI message */ typedef enum { SEI_PIC_STRUCT_FRAME = 0, ///< 0: %frame SEI_PIC_STRUCT_TOP_FIELD = 1, ///< 1: top field SEI_PIC_STRUCT_BOTTOM_FIELD = 2, ///< 2: bottom field SEI_PIC_STRUCT_TOP_BOTTOM = 3, ///< 3: top field, bottom field, in that order SEI_PIC_STRUCT_BOTTOM_TOP = 4, ///< 4: bottom field, top field, in that order SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5, ///< 5: top field, bottom field, top field repeated, in that order SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6, ///< 6: bottom field, top field, bottom field repeated, in that order SEI_PIC_STRUCT_FRAME_DOUBLING = 7, ///< 7: %frame doubling SEI_PIC_STRUCT_FRAME_TRIPLING = 8 ///< 8: %frame tripling } SEI_PicStructType; /** * Sequence parameter set */ typedef struct SPS{ int profile_idc; int level_idc; int chroma_format_idc; int transform_bypass; ///< qpprime_y_zero_transform_bypass_flag int log2_max_frame_num; ///< log2_max_frame_num_minus4 + 4 int poc_type; ///< pic_order_cnt_type int log2_max_poc_lsb; ///< log2_max_pic_order_cnt_lsb_minus4 int delta_pic_order_always_zero_flag; int offset_for_non_ref_pic; int offset_for_top_to_bottom_field; int poc_cycle_length; ///< num_ref_frames_in_pic_order_cnt_cycle int ref_frame_count; ///< num_ref_frames int gaps_in_frame_num_allowed_flag; int mb_width; ///< pic_width_in_mbs_minus1 + 1 int mb_height; ///< pic_height_in_map_units_minus1 + 1 int frame_mbs_only_flag; int mb_aff; ///<mb_adaptive_frame_field_flag int direct_8x8_inference_flag; int crop; ///< frame_cropping_flag unsigned int crop_left; ///< frame_cropping_rect_left_offset unsigned int crop_right; ///< frame_cropping_rect_right_offset unsigned int crop_top; ///< frame_cropping_rect_top_offset unsigned int crop_bottom; ///< frame_cropping_rect_bottom_offset int vui_parameters_present_flag; AVRational sar; int video_signal_type_present_flag; int full_range; int colour_description_present_flag; enum AVColorPrimaries color_primaries; enum AVColorTransferCharacteristic color_trc; enum AVColorSpace colorspace; int timing_info_present_flag; uint32_t num_units_in_tick; uint32_t time_scale; int fixed_frame_rate_flag; short offset_for_ref_frame[256]; //FIXME dyn aloc? int bitstream_restriction_flag; int num_reorder_frames; int scaling_matrix_present; uint8_t scaling_matrix4[6][16]; uint8_t scaling_matrix8[2][64]; int nal_hrd_parameters_present_flag; int vcl_hrd_parameters_present_flag; int pic_struct_present_flag; int time_offset_length; int cpb_cnt; ///< See H.264 E.1.2 int initial_cpb_removal_delay_length; ///< initial_cpb_removal_delay_length_minus1 +1 int cpb_removal_delay_length; ///< cpb_removal_delay_length_minus1 + 1 int dpb_output_delay_length; ///< dpb_output_delay_length_minus1 + 1 int bit_depth_luma; ///< bit_depth_luma_minus8 + 8 int bit_depth_chroma; ///< bit_depth_chroma_minus8 + 8 int residual_color_transform_flag; ///< residual_colour_transform_flag }SPS; /** * Picture parameter set */ typedef struct PPS{ unsigned int sps_id; int cabac; ///< entropy_coding_mode_flag int pic_order_present; ///< pic_order_present_flag int slice_group_count; ///< num_slice_groups_minus1 + 1 int mb_slice_group_map_type; unsigned int ref_count[2]; ///< num_ref_idx_l0/1_active_minus1 + 1 int weighted_pred; ///< weighted_pred_flag int weighted_bipred_idc; int init_qp; ///< pic_init_qp_minus26 + 26 int init_qs; ///< pic_init_qs_minus26 + 26 int chroma_qp_index_offset[2]; int deblocking_filter_parameters_present; ///< deblocking_filter_parameters_present_flag int constrained_intra_pred; ///< constrained_intra_pred_flag int redundant_pic_cnt_present; ///< redundant_pic_cnt_present_flag int transform_8x8_mode; ///< transform_8x8_mode_flag uint8_t scaling_matrix4[6][16]; uint8_t scaling_matrix8[2][64]; uint8_t chroma_qp_table[2][64]; ///< pre-scaled (with chroma_qp_index_offset) version of qp_table int chroma_qp_diff; }PPS; /** * Memory management control operation opcode. */ typedef enum MMCOOpcode{ MMCO_END=0, MMCO_SHORT2UNUSED, MMCO_LONG2UNUSED, MMCO_SHORT2LONG, MMCO_SET_MAX_LONG, MMCO_RESET, MMCO_LONG, } MMCOOpcode; /** * Memory management control operation. */ typedef struct MMCO{ MMCOOpcode opcode; int short_pic_num; ///< pic_num without wrapping (pic_num & max_pic_num) int long_arg; ///< index, pic_num, or num long refs depending on opcode } MMCO; /** * H264Context */ typedef struct H264Context{ MpegEncContext s; H264DSPContext h264dsp; int chroma_qp[2]; //QPc int qp_thresh; ///< QP threshold to skip loopfilter int prev_mb_skipped; int next_mb_skipped; //prediction stuff int chroma_pred_mode; int intra16x16_pred_mode; int topleft_mb_xy; int top_mb_xy; int topright_mb_xy; int left_mb_xy[2]; int topleft_type; int top_type; int topright_type; int left_type[2]; const uint8_t * left_block; int topleft_partition; int8_t intra4x4_pred_mode_cache[5*8]; int8_t (*intra4x4_pred_mode); H264PredContext hpc; unsigned int topleft_samples_available; unsigned int top_samples_available; unsigned int topright_samples_available; unsigned int left_samples_available; uint8_t (*top_borders[2])[16+2*8]; /** * non zero coeff count cache. * is 64 if not available. */ DECLARE_ALIGNED(8, uint8_t, non_zero_count_cache)[6*8]; /* .UU.YYYY .UU.YYYY .vv.YYYY .VV.YYYY */ uint8_t (*non_zero_count)[32]; /** * Motion vector cache. */ DECLARE_ALIGNED(16, int16_t, mv_cache)[2][5*8][2]; DECLARE_ALIGNED(8, int8_t, ref_cache)[2][5*8]; #define LIST_NOT_USED -1 //FIXME rename? #define PART_NOT_AVAILABLE -2 /** * is 1 if the specific list MV&references are set to 0,0,-2. */ int mv_cache_clean[2]; /** * number of neighbors (top and/or left) that used 8x8 dct */ int neighbor_transform_size; /** * block_offset[ 0..23] for frame macroblocks * block_offset[24..47] for field macroblocks */ int block_offset[2*(16+8)]; uint32_t *mb2b_xy; //FIXME are these 4 a good idea? uint32_t *mb2br_xy; int b_stride; //FIXME use s->b4_stride int mb_linesize; ///< may be equal to s->linesize or s->linesize*2, for mbaff int mb_uvlinesize; int emu_edge_width; int emu_edge_height; SPS sps; ///< current sps /** * current pps */ PPS pps; //FIXME move to Picture perhaps? (->no) do we need that? uint32_t dequant4_buffer[6][52][16]; //FIXME should these be moved down? uint32_t dequant8_buffer[2][52][64]; uint32_t (*dequant4_coeff[6])[16]; uint32_t (*dequant8_coeff[2])[64]; int slice_num; uint16_t *slice_table; ///< slice_table_base + 2*mb_stride + 1 int slice_type; int slice_type_nos; ///< S free slice type (SI/SP are remapped to I/P) int slice_type_fixed; //interlacing specific flags int mb_aff_frame; int mb_field_decoding_flag; int mb_mbaff; ///< mb_aff_frame && mb_field_decoding_flag DECLARE_ALIGNED(8, uint16_t, sub_mb_type)[4]; //Weighted pred stuff int use_weight; int use_weight_chroma; int luma_log2_weight_denom; int chroma_log2_weight_denom; //The following 2 can be changed to int8_t but that causes 10cpu cycles speedloss int luma_weight[48][2][2]; int chroma_weight[48][2][2][2]; int implicit_weight[48][48][2]; int direct_spatial_mv_pred; int col_parity; int col_fieldoff; int dist_scale_factor[16]; int dist_scale_factor_field[2][32]; int map_col_to_list0[2][16+32]; int map_col_to_list0_field[2][2][16+32]; /** * num_ref_idx_l0/1_active_minus1 + 1 */ unsigned int ref_count[2]; ///< counts frames or fields, depending on current mb mode unsigned int list_count; uint8_t *list_counts; ///< Array of list_count per MB specifying the slice type Picture ref_list[2][48]; /**< 0..15: frame refs, 16..47: mbaff field refs. Reordered version of default_ref_list according to picture reordering in slice header */ int ref2frm[MAX_SLICES][2][64]; ///< reference to frame number lists, used in the loop filter, the first 2 are for -2,-1 //data partitioning GetBitContext intra_gb; GetBitContext inter_gb; GetBitContext *intra_gb_ptr; GetBitContext *inter_gb_ptr; DECLARE_ALIGNED(16, DCTELEM, mb)[16*24]; DCTELEM mb_padding[256]; ///< as mb is addressed by scantable[i] and scantable is uint8_t we can either check that i is not too large or ensure that there is some unused stuff after mb /** * Cabac */ CABACContext cabac; uint8_t cabac_state[460]; /* 0x100 -> non null luma_dc, 0x80/0x40 -> non null chroma_dc (cb/cr), 0x?0 -> chroma_cbp(0,1,2), 0x0? luma_cbp */ uint16_t *cbp_table; int cbp; int top_cbp; int left_cbp; /* chroma_pred_mode for i4x4 or i16x16, else 0 */ uint8_t *chroma_pred_mode_table; int last_qscale_diff; uint8_t (*mvd_table[2])[2]; DECLARE_ALIGNED(16, uint8_t, mvd_cache)[2][5*8][2]; uint8_t *direct_table; uint8_t direct_cache[5*8]; uint8_t zigzag_scan[16]; uint8_t zigzag_scan8x8[64]; uint8_t zigzag_scan8x8_cavlc[64]; uint8_t field_scan[16]; uint8_t field_scan8x8[64]; uint8_t field_scan8x8_cavlc[64]; const uint8_t *zigzag_scan_q0; const uint8_t *zigzag_scan8x8_q0; const uint8_t *zigzag_scan8x8_cavlc_q0; const uint8_t *field_scan_q0; const uint8_t *field_scan8x8_q0; const uint8_t *field_scan8x8_cavlc_q0; int x264_build; int mb_xy; int is_complex; //deblock int deblocking_filter; ///< disable_deblocking_filter_idc with 1<->0 int slice_alpha_c0_offset; int slice_beta_offset; //============================================================= //Things below are not used in the MB or more inner code int nal_ref_idc; int nal_unit_type; uint8_t *rbsp_buffer[2]; unsigned int rbsp_buffer_size[2]; /** * Used to parse AVC variant of h264 */ int is_avc; ///< this flag is != 0 if codec is avc1 int nal_length_size; ///< Number of bytes used for nal length (1, 2 or 4) SPS *sps_buffers[MAX_SPS_COUNT]; PPS *pps_buffers[MAX_PPS_COUNT]; int dequant_coeff_pps; ///< reinit tables when pps changes uint16_t *slice_table_base; //POC stuff int poc_lsb; int poc_msb; int delta_poc_bottom; int delta_poc[2]; int frame_num; int prev_poc_msb; ///< poc_msb of the last reference pic for POC type 0 int prev_poc_lsb; ///< poc_lsb of the last reference pic for POC type 0 int frame_num_offset; ///< for POC type 2 int prev_frame_num_offset; ///< for POC type 2 int prev_frame_num; ///< frame_num of the last pic for POC type 1/2 /** * frame_num for frames or 2*frame_num+1 for field pics. */ int curr_pic_num; /** * max_frame_num or 2*max_frame_num for field pics. */ int max_pic_num; int redundant_pic_count; Picture *short_ref[32]; Picture *long_ref[32]; Picture default_ref_list[2][32]; ///< base reference list for all slices of a coded picture Picture *delayed_pic[MAX_DELAYED_PIC_COUNT+2]; //FIXME size? int outputed_poc; /** * memory management control operations buffer. */ MMCO mmco[MAX_MMCO_COUNT]; int mmco_index; int long_ref_count; ///< number of actual long term references int short_ref_count; ///< number of actual short term references int cabac_init_idc; /** * @defgroup multithreading Members for slice based multithreading * @{ */ struct H264Context *thread_context[MAX_THREADS]; /** * current slice number, used to initalize slice_num of each thread/context */ int current_slice; /** * Max number of threads / contexts. * This is equal to AVCodecContext.thread_count unless * multithreaded decoding is impossible, in which case it is * reduced to 1. */ int max_contexts; /** * 1 if the single thread fallback warning has already been * displayed, 0 otherwise. */ int single_decode_warning; int last_slice_type; /** @} */ /** * pic_struct in picture timing SEI message */ SEI_PicStructType sei_pic_struct; /** * Complement sei_pic_struct * SEI_PIC_STRUCT_TOP_BOTTOM and SEI_PIC_STRUCT_BOTTOM_TOP indicate interlaced frames. * However, soft telecined frames may have these values. * This is used in an attempt to flag soft telecine progressive. */ int prev_interlaced_frame; /** * Bit set of clock types for fields/frames in picture timing SEI message. * For each found ct_type, appropriate bit is set (e.g., bit 1 for * interlaced). */ int sei_ct_type; /** * dpb_output_delay in picture timing SEI message, see H.264 C.2.2 */ int sei_dpb_output_delay; /** * cpb_removal_delay in picture timing SEI message, see H.264 C.1.2 */ int sei_cpb_removal_delay; /** * recovery_frame_cnt from SEI message * * Set to -1 if no recovery point SEI message found or to number of frames * before playback synchronizes. Frames having recovery point are key * frames. */ int sei_recovery_frame_cnt; int luma_weight_flag[2]; ///< 7.4.3.2 luma_weight_lX_flag int chroma_weight_flag[2]; ///< 7.4.3.2 chroma_weight_lX_flag // Timestamp stuff int sei_buffering_period_present; ///< Buffering period SEI flag int initial_cpb_removal_delay[32]; ///< Initial timestamps for CPBs //SVQ3 specific fields int halfpel_flag; int thirdpel_flag; int unknown_svq3_flag; int next_slice_index; uint32_t svq3_watermark_key; }H264Context; extern const uint8_t ff_h264_chroma_qp[52]; void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *block, int qp); void ff_svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc); /** * Decode SEI */ int ff_h264_decode_sei(H264Context *h); /** * Decode SPS */ int ff_h264_decode_seq_parameter_set(H264Context *h); /** * Decode PPS */ int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length); /** * Decodes a network abstraction layer unit. * @param consumed is the number of bytes used as input * @param length is the length of the array * @param dst_length is the number of decoded bytes FIXME here or a decode rbsp tailing? * @return decoded bytes, might be src+1 if no escapes */ const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, int *dst_length, int *consumed, int length); /** * identifies the exact end of the bitstream * @return the length of the trailing, or 0 if damaged */ int ff_h264_decode_rbsp_trailing(H264Context *h, const uint8_t *src); /** * frees any data that may have been allocated in the H264 context like SPS, PPS etc. */ av_cold void ff_h264_free_context(H264Context *h); /** * reconstructs bitstream slice_type. */ int ff_h264_get_slice_type(const H264Context *h); /** * allocates tables. * needs width/height */ int ff_h264_alloc_tables(H264Context *h); /** * fills the default_ref_list. */ int ff_h264_fill_default_ref_list(H264Context *h); int ff_h264_decode_ref_pic_list_reordering(H264Context *h); void ff_h264_fill_mbaff_ref_list(H264Context *h); void ff_h264_remove_all_refs(H264Context *h); /** * Executes the reference picture marking (memory management control operations). */ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count); int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb); /** * checks if the top & left blocks are available if needed & changes the dc mode so it only uses the available blocks. */ int ff_h264_check_intra4x4_pred_mode(H264Context *h); /** * checks if the top & left blocks are available if needed & changes the dc mode so it only uses the available blocks. */ int ff_h264_check_intra_pred_mode(H264Context *h, int mode); void ff_h264_write_back_intra_pred_mode(H264Context *h); void ff_h264_hl_decode_mb(H264Context *h); int ff_h264_frame_start(H264Context *h); av_cold int ff_h264_decode_init(AVCodecContext *avctx); av_cold int ff_h264_decode_end(AVCodecContext *avctx); av_cold void ff_h264_decode_init_vlc(void); /** * decodes a macroblock * @return 0 if OK, AC_ERROR / DC_ERROR / MV_ERROR if an error is noticed */ int ff_h264_decode_mb_cavlc(H264Context *h); /** * decodes a CABAC coded macroblock * @return 0 if OK, AC_ERROR / DC_ERROR / MV_ERROR if an error is noticed */ int ff_h264_decode_mb_cabac(H264Context *h); void ff_h264_init_cabac_states(H264Context *h); void ff_h264_direct_dist_scale_factor(H264Context * const h); void ff_h264_direct_ref_list_init(H264Context * const h); void ff_h264_pred_direct_motion(H264Context * const h, int *mb_type); void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize); void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize); /** * Reset SEI values at the beginning of the frame. * * @param h H.264 context. */ void ff_h264_reset_sei(H264Context *h); /* o-o o-o / / / o-o o-o ,---' o-o o-o / / / o-o o-o */ //This table must be here because scan8[constant] must be known at compiletime static const uint8_t scan8[16 + 2*4]={ 4+1*8, 5+1*8, 4+2*8, 5+2*8, 6+1*8, 7+1*8, 6+2*8, 7+2*8, 4+3*8, 5+3*8, 4+4*8, 5+4*8, 6+3*8, 7+3*8, 6+4*8, 7+4*8, 1+1*8, 2+1*8, 1+2*8, 2+2*8, 1+4*8, 2+4*8, 1+5*8, 2+5*8, }; static av_always_inline uint32_t pack16to32(int a, int b){ #if HAVE_BIGENDIAN return (b&0xFFFF) + (a<<16); #else return (a&0xFFFF) + (b<<16); #endif } static av_always_inline uint16_t pack8to16(int a, int b){ #if HAVE_BIGENDIAN return (b&0xFF) + (a<<8); #else return (a&0xFF) + (b<<8); #endif } /** * gets the chroma qp. */ static inline int get_chroma_qp(H264Context *h, int t, int qscale){ return h->pps.chroma_qp_table[t][qscale]; } static inline void pred_pskip_motion(H264Context * const h, int * const mx, int * const my); static void fill_decode_neighbors(H264Context *h, int mb_type){ MpegEncContext * const s = &h->s; const int mb_xy= h->mb_xy; int topleft_xy, top_xy, topright_xy, left_xy[2]; static const uint8_t left_block_options[4][16]={ {0,1,2,3,7,10,8,11,7+0*8, 7+1*8, 7+2*8, 7+3*8, 2+0*8, 2+3*8, 2+1*8, 2+2*8}, {2,2,3,3,8,11,8,11,7+2*8, 7+2*8, 7+3*8, 7+3*8, 2+1*8, 2+2*8, 2+1*8, 2+2*8}, {0,0,1,1,7,10,7,10,7+0*8, 7+0*8, 7+1*8, 7+1*8, 2+0*8, 2+3*8, 2+0*8, 2+3*8}, {0,2,0,2,7,10,7,10,7+0*8, 7+2*8, 7+0*8, 7+2*8, 2+0*8, 2+3*8, 2+0*8, 2+3*8} }; h->topleft_partition= -1; top_xy = mb_xy - (s->mb_stride << MB_FIELD); /* Wow, what a mess, why didn't they simplify the interlacing & intra * stuff, I can't imagine that these complex rules are worth it. */ topleft_xy = top_xy - 1; topright_xy= top_xy + 1; left_xy[1] = left_xy[0] = mb_xy-1; h->left_block = left_block_options[0]; if(FRAME_MBAFF){ const int left_mb_field_flag = IS_INTERLACED(s->current_picture.mb_type[mb_xy-1]); const int curr_mb_field_flag = IS_INTERLACED(mb_type); if(s->mb_y&1){ if (left_mb_field_flag != curr_mb_field_flag) { left_xy[1] = left_xy[0] = mb_xy - s->mb_stride - 1; if (curr_mb_field_flag) { left_xy[1] += s->mb_stride; h->left_block = left_block_options[3]; } else { topleft_xy += s->mb_stride; // take top left mv from the middle of the mb, as opposed to all other modes which use the bottom right partition h->topleft_partition = 0; h->left_block = left_block_options[1]; } } }else{ if(curr_mb_field_flag){ topleft_xy += s->mb_stride & (((s->current_picture.mb_type[top_xy - 1]>>7)&1)-1); topright_xy += s->mb_stride & (((s->current_picture.mb_type[top_xy + 1]>>7)&1)-1); top_xy += s->mb_stride & (((s->current_picture.mb_type[top_xy ]>>7)&1)-1); } if (left_mb_field_flag != curr_mb_field_flag) { if (curr_mb_field_flag) { left_xy[1] += s->mb_stride; h->left_block = left_block_options[3]; } else { h->left_block = left_block_options[2]; } } } } h->topleft_mb_xy = topleft_xy; h->top_mb_xy = top_xy; h->topright_mb_xy= topright_xy; h->left_mb_xy[0] = left_xy[0]; h->left_mb_xy[1] = left_xy[1]; //FIXME do we need all in the context? h->topleft_type = s->current_picture.mb_type[topleft_xy] ; h->top_type = s->current_picture.mb_type[top_xy] ; h->topright_type= s->current_picture.mb_type[topright_xy]; h->left_type[0] = s->current_picture.mb_type[left_xy[0]] ; h->left_type[1] = s->current_picture.mb_type[left_xy[1]] ; if(FMO){ if(h->slice_table[topleft_xy ] != h->slice_num) h->topleft_type = 0; if(h->slice_table[top_xy ] != h->slice_num) h->top_type = 0; if(h->slice_table[left_xy[0] ] != h->slice_num) h->left_type[0] = h->left_type[1] = 0; }else{ if(h->slice_table[topleft_xy ] != h->slice_num){ h->topleft_type = 0; if(h->slice_table[top_xy ] != h->slice_num) h->top_type = 0; if(h->slice_table[left_xy[0] ] != h->slice_num) h->left_type[0] = h->left_type[1] = 0; } } if(h->slice_table[topright_xy] != h->slice_num) h->topright_type= 0; } static void fill_decode_caches(H264Context *h, int mb_type){ MpegEncContext * const s = &h->s; int topleft_xy, top_xy, topright_xy, left_xy[2]; int topleft_type, top_type, topright_type, left_type[2]; const uint8_t * left_block= h->left_block; int i; topleft_xy = h->topleft_mb_xy ; top_xy = h->top_mb_xy ; topright_xy = h->topright_mb_xy; left_xy[0] = h->left_mb_xy[0] ; left_xy[1] = h->left_mb_xy[1] ; topleft_type = h->topleft_type ; top_type = h->top_type ; topright_type= h->topright_type ; left_type[0] = h->left_type[0] ; left_type[1] = h->left_type[1] ; if(!IS_SKIP(mb_type)){ if(IS_INTRA(mb_type)){ int type_mask= h->pps.constrained_intra_pred ? IS_INTRA(-1) : -1; h->topleft_samples_available= h->top_samples_available= h->left_samples_available= 0xFFFF; h->topright_samples_available= 0xEEEA; if(!(top_type & type_mask)){ h->topleft_samples_available= 0xB3FF; h->top_samples_available= 0x33FF; h->topright_samples_available= 0x26EA; } if(IS_INTERLACED(mb_type) != IS_INTERLACED(left_type[0])){ if(IS_INTERLACED(mb_type)){ if(!(left_type[0] & type_mask)){ h->topleft_samples_available&= 0xDFFF; h->left_samples_available&= 0x5FFF; } if(!(left_type[1] & type_mask)){ h->topleft_samples_available&= 0xFF5F; h->left_samples_available&= 0xFF5F; } }else{ int left_typei = s->current_picture.mb_type[left_xy[0] + s->mb_stride]; assert(left_xy[0] == left_xy[1]); if(!((left_typei & type_mask) && (left_type[0] & type_mask))){ h->topleft_samples_available&= 0xDF5F; h->left_samples_available&= 0x5F5F; } } }else{ if(!(left_type[0] & type_mask)){ h->topleft_samples_available&= 0xDF5F; h->left_samples_available&= 0x5F5F; } } if(!(topleft_type & type_mask)) h->topleft_samples_available&= 0x7FFF; if(!(topright_type & type_mask)) h->topright_samples_available&= 0xFBFF; if(IS_INTRA4x4(mb_type)){ if(IS_INTRA4x4(top_type)){ AV_COPY32(h->intra4x4_pred_mode_cache+4+8*0, h->intra4x4_pred_mode + h->mb2br_xy[top_xy]); }else{ h->intra4x4_pred_mode_cache[4+8*0]= h->intra4x4_pred_mode_cache[5+8*0]= h->intra4x4_pred_mode_cache[6+8*0]= h->intra4x4_pred_mode_cache[7+8*0]= 2 - 3*!(top_type & type_mask); } for(i=0; i<2; i++){ if(IS_INTRA4x4(left_type[i])){ int8_t *mode= h->intra4x4_pred_mode + h->mb2br_xy[left_xy[i]]; h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= mode[6-left_block[0+2*i]]; h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= mode[6-left_block[1+2*i]]; }else{ h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= 2 - 3*!(left_type[i] & type_mask); } } } } /* 0 . T T. T T T T 1 L . .L . . . . 2 L . .L . . . . 3 . T TL . . . . 4 L . .L . . . . 5 L . .. . . . . */ //FIXME constraint_intra_pred & partitioning & nnz (let us hope this is just a typo in the spec) if(top_type){ AV_COPY32(&h->non_zero_count_cache[4+8*0], &h->non_zero_count[top_xy][4+3*8]); h->non_zero_count_cache[1+8*0]= h->non_zero_count[top_xy][1+1*8]; h->non_zero_count_cache[2+8*0]= h->non_zero_count[top_xy][2+1*8]; h->non_zero_count_cache[1+8*3]= h->non_zero_count[top_xy][1+2*8]; h->non_zero_count_cache[2+8*3]= h->non_zero_count[top_xy][2+2*8]; }else { h->non_zero_count_cache[1+8*0]= h->non_zero_count_cache[2+8*0]= h->non_zero_count_cache[1+8*3]= h->non_zero_count_cache[2+8*3]= AV_WN32A(&h->non_zero_count_cache[4+8*0], CABAC && !IS_INTRA(mb_type) ? 0 : 0x40404040); } for (i=0; i<2; i++) { if(left_type[i]){ h->non_zero_count_cache[3+8*1 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[8+0+2*i]]; h->non_zero_count_cache[3+8*2 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[8+1+2*i]]; h->non_zero_count_cache[0+8*1 + 8*i]= h->non_zero_count[left_xy[i]][left_block[8+4+2*i]]; h->non_zero_count_cache[0+8*4 + 8*i]= h->non_zero_count[left_xy[i]][left_block[8+5+2*i]]; }else{ h->non_zero_count_cache[3+8*1 + 2*8*i]= h->non_zero_count_cache[3+8*2 + 2*8*i]= h->non_zero_count_cache[0+8*1 + 8*i]= h->non_zero_count_cache[0+8*4 + 8*i]= CABAC && !IS_INTRA(mb_type) ? 0 : 64; } } if( CABAC ) { // top_cbp if(top_type) { h->top_cbp = h->cbp_table[top_xy]; } else { h->top_cbp = IS_INTRA(mb_type) ? 0x1CF : 0x00F; } // left_cbp if (left_type[0]) { h->left_cbp = (h->cbp_table[left_xy[0]] & 0x1f0) | ((h->cbp_table[left_xy[0]]>>(left_block[0]&(~1)))&2) | (((h->cbp_table[left_xy[1]]>>(left_block[2]&(~1)))&2) << 2); } else { h->left_cbp = IS_INTRA(mb_type) ? 0x1CF : 0x00F; } } } #if 1 if(IS_INTER(mb_type) || (IS_DIRECT(mb_type) && h->direct_spatial_mv_pred)){ int list; for(list=0; list<h->list_count; list++){ if(!USES_LIST(mb_type, list)){ /*if(!h->mv_cache_clean[list]){ memset(h->mv_cache [list], 0, 8*5*2*sizeof(int16_t)); //FIXME clean only input? clean at all? memset(h->ref_cache[list], PART_NOT_AVAILABLE, 8*5*sizeof(int8_t)); h->mv_cache_clean[list]= 1; }*/ continue; } assert(!(IS_DIRECT(mb_type) && !h->direct_spatial_mv_pred)); h->mv_cache_clean[list]= 0; if(USES_LIST(top_type, list)){ const int b_xy= h->mb2b_xy[top_xy] + 3*h->b_stride; AV_COPY128(h->mv_cache[list][scan8[0] + 0 - 1*8], s->current_picture.motion_val[list][b_xy + 0]); h->ref_cache[list][scan8[0] + 0 - 1*8]= h->ref_cache[list][scan8[0] + 1 - 1*8]= s->current_picture.ref_index[list][4*top_xy + 2]; h->ref_cache[list][scan8[0] + 2 - 1*8]= h->ref_cache[list][scan8[0] + 3 - 1*8]= s->current_picture.ref_index[list][4*top_xy + 3]; }else{ AV_ZERO128(h->mv_cache[list][scan8[0] + 0 - 1*8]); AV_WN32A(&h->ref_cache[list][scan8[0] + 0 - 1*8], ((top_type ? LIST_NOT_USED : PART_NOT_AVAILABLE)&0xFF)*0x01010101); } if(mb_type & (MB_TYPE_16x8|MB_TYPE_8x8)){ for(i=0; i<2; i++){ int cache_idx = scan8[0] - 1 + i*2*8; if(USES_LIST(left_type[i], list)){ const int b_xy= h->mb2b_xy[left_xy[i]] + 3; const int b8_xy= 4*left_xy[i] + 1; AV_COPY32(h->mv_cache[list][cache_idx ], s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[0+i*2]]); AV_COPY32(h->mv_cache[list][cache_idx+8], s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[1+i*2]]); h->ref_cache[list][cache_idx ]= s->current_picture.ref_index[list][b8_xy + (left_block[0+i*2]&~1)]; h->ref_cache[list][cache_idx+8]= s->current_picture.ref_index[list][b8_xy + (left_block[1+i*2]&~1)]; }else{ AV_ZERO32(h->mv_cache [list][cache_idx ]); AV_ZERO32(h->mv_cache [list][cache_idx+8]); h->ref_cache[list][cache_idx ]= h->ref_cache[list][cache_idx+8]= (left_type[i]) ? LIST_NOT_USED : PART_NOT_AVAILABLE; } } }else{ if(USES_LIST(left_type[0], list)){ const int b_xy= h->mb2b_xy[left_xy[0]] + 3; const int b8_xy= 4*left_xy[0] + 1; AV_COPY32(h->mv_cache[list][scan8[0] - 1], s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[0]]); h->ref_cache[list][scan8[0] - 1]= s->current_picture.ref_index[list][b8_xy + (left_block[0]&~1)]; }else{ AV_ZERO32(h->mv_cache [list][scan8[0] - 1]); h->ref_cache[list][scan8[0] - 1]= left_type[0] ? LIST_NOT_USED : PART_NOT_AVAILABLE; } } if(USES_LIST(topright_type, list)){ const int b_xy= h->mb2b_xy[topright_xy] + 3*h->b_stride; AV_COPY32(h->mv_cache[list][scan8[0] + 4 - 1*8], s->current_picture.motion_val[list][b_xy]); h->ref_cache[list][scan8[0] + 4 - 1*8]= s->current_picture.ref_index[list][4*topright_xy + 2]; }else{ AV_ZERO32(h->mv_cache [list][scan8[0] + 4 - 1*8]); h->ref_cache[list][scan8[0] + 4 - 1*8]= topright_type ? LIST_NOT_USED : PART_NOT_AVAILABLE; } if(h->ref_cache[list][scan8[0] + 4 - 1*8] < 0){ if(USES_LIST(topleft_type, list)){ const int b_xy = h->mb2b_xy [topleft_xy] + 3 + h->b_stride + (h->topleft_partition & 2*h->b_stride); const int b8_xy= 4*topleft_xy + 1 + (h->topleft_partition & 2); AV_COPY32(h->mv_cache[list][scan8[0] - 1 - 1*8], s->current_picture.motion_val[list][b_xy]); h->ref_cache[list][scan8[0] - 1 - 1*8]= s->current_picture.ref_index[list][b8_xy]; }else{ AV_ZERO32(h->mv_cache[list][scan8[0] - 1 - 1*8]); h->ref_cache[list][scan8[0] - 1 - 1*8]= topleft_type ? LIST_NOT_USED : PART_NOT_AVAILABLE; } } if((mb_type&(MB_TYPE_SKIP|MB_TYPE_DIRECT2)) && !FRAME_MBAFF) continue; if(!(mb_type&(MB_TYPE_SKIP|MB_TYPE_DIRECT2))) { h->ref_cache[list][scan8[4 ]] = h->ref_cache[list][scan8[12]] = PART_NOT_AVAILABLE; AV_ZERO32(h->mv_cache [list][scan8[4 ]]); AV_ZERO32(h->mv_cache [list][scan8[12]]); if( CABAC ) { /* XXX beurk, Load mvd */ if(USES_LIST(top_type, list)){ const int b_xy= h->mb2br_xy[top_xy]; AV_COPY64(h->mvd_cache[list][scan8[0] + 0 - 1*8], h->mvd_table[list][b_xy + 0]); }else{ AV_ZERO64(h->mvd_cache[list][scan8[0] + 0 - 1*8]); } if(USES_LIST(left_type[0], list)){ const int b_xy= h->mb2br_xy[left_xy[0]] + 6; AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 0*8], h->mvd_table[list][b_xy - left_block[0]]); AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 1*8], h->mvd_table[list][b_xy - left_block[1]]); }else{ AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 0*8]); AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 1*8]); } if(USES_LIST(left_type[1], list)){ const int b_xy= h->mb2br_xy[left_xy[1]] + 6; AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 2*8], h->mvd_table[list][b_xy - left_block[2]]); AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 3*8], h->mvd_table[list][b_xy - left_block[3]]); }else{ AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 2*8]); AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 3*8]); } AV_ZERO16(h->mvd_cache [list][scan8[4 ]]); AV_ZERO16(h->mvd_cache [list][scan8[12]]); if(h->slice_type_nos == FF_B_TYPE){ fill_rectangle(&h->direct_cache[scan8[0]], 4, 4, 8, MB_TYPE_16x16>>1, 1); if(IS_DIRECT(top_type)){ AV_WN32A(&h->direct_cache[scan8[0] - 1*8], 0x01010101u*(MB_TYPE_DIRECT2>>1)); }else if(IS_8X8(top_type)){ int b8_xy = 4*top_xy; h->direct_cache[scan8[0] + 0 - 1*8]= h->direct_table[b8_xy + 2]; h->direct_cache[scan8[0] + 2 - 1*8]= h->direct_table[b8_xy + 3]; }else{ AV_WN32A(&h->direct_cache[scan8[0] - 1*8], 0x01010101*(MB_TYPE_16x16>>1)); } if(IS_DIRECT(left_type[0])) h->direct_cache[scan8[0] - 1 + 0*8]= MB_TYPE_DIRECT2>>1; else if(IS_8X8(left_type[0])) h->direct_cache[scan8[0] - 1 + 0*8]= h->direct_table[4*left_xy[0] + 1 + (left_block[0]&~1)]; else h->direct_cache[scan8[0] - 1 + 0*8]= MB_TYPE_16x16>>1; if(IS_DIRECT(left_type[1])) h->direct_cache[scan8[0] - 1 + 2*8]= MB_TYPE_DIRECT2>>1; else if(IS_8X8(left_type[1])) h->direct_cache[scan8[0] - 1 + 2*8]= h->direct_table[4*left_xy[1] + 1 + (left_block[2]&~1)]; else h->direct_cache[scan8[0] - 1 + 2*8]= MB_TYPE_16x16>>1; } } } if(FRAME_MBAFF){ #define MAP_MVS\ MAP_F2F(scan8[0] - 1 - 1*8, topleft_type)\ MAP_F2F(scan8[0] + 0 - 1*8, top_type)\ MAP_F2F(scan8[0] + 1 - 1*8, top_type)\ MAP_F2F(scan8[0] + 2 - 1*8, top_type)\ MAP_F2F(scan8[0] + 3 - 1*8, top_type)\ MAP_F2F(scan8[0] + 4 - 1*8, topright_type)\ MAP_F2F(scan8[0] - 1 + 0*8, left_type[0])\ MAP_F2F(scan8[0] - 1 + 1*8, left_type[0])\ MAP_F2F(scan8[0] - 1 + 2*8, left_type[1])\ MAP_F2F(scan8[0] - 1 + 3*8, left_type[1]) if(MB_FIELD){ #define MAP_F2F(idx, mb_type)\ if(!IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0){\ h->ref_cache[list][idx] <<= 1;\ h->mv_cache[list][idx][1] /= 2;\ h->mvd_cache[list][idx][1] >>=1;\ } MAP_MVS #undef MAP_F2F }else{ #define MAP_F2F(idx, mb_type)\ if(IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0){\ h->ref_cache[list][idx] >>= 1;\ h->mv_cache[list][idx][1] <<= 1;\ h->mvd_cache[list][idx][1] <<= 1;\ } MAP_MVS #undef MAP_F2F } } } } #endif h->neighbor_transform_size= !!IS_8x8DCT(top_type) + !!IS_8x8DCT(left_type[0]); } /** * gets the predicted intra4x4 prediction mode. */ static inline int pred_intra_mode(H264Context *h, int n){ const int index8= scan8[n]; const int left= h->intra4x4_pred_mode_cache[index8 - 1]; const int top = h->intra4x4_pred_mode_cache[index8 - 8]; const int min= FFMIN(left, top); tprintf(h->s.avctx, "mode:%d %d min:%d\n", left ,top, min); if(min<0) return DC_PRED; else return min; } static inline void write_back_non_zero_count(H264Context *h){ const int mb_xy= h->mb_xy; AV_COPY64(&h->non_zero_count[mb_xy][ 0], &h->non_zero_count_cache[0+8*1]); AV_COPY64(&h->non_zero_count[mb_xy][ 8], &h->non_zero_count_cache[0+8*2]); AV_COPY32(&h->non_zero_count[mb_xy][16], &h->non_zero_count_cache[0+8*5]); AV_COPY32(&h->non_zero_count[mb_xy][20], &h->non_zero_count_cache[4+8*3]); AV_COPY64(&h->non_zero_count[mb_xy][24], &h->non_zero_count_cache[0+8*4]); } static inline void write_back_motion(H264Context *h, int mb_type){ MpegEncContext * const s = &h->s; const int b_xy = 4*s->mb_x + 4*s->mb_y*h->b_stride; //try mb2b(8)_xy const int b8_xy= 4*h->mb_xy; int list; if(!USES_LIST(mb_type, 0)) fill_rectangle(&s->current_picture.ref_index[0][b8_xy], 2, 2, 2, (uint8_t)LIST_NOT_USED, 1); for(list=0; list<h->list_count; list++){ int y, b_stride; int16_t (*mv_dst)[2]; int16_t (*mv_src)[2]; if(!USES_LIST(mb_type, list)) continue; b_stride = h->b_stride; mv_dst = &s->current_picture.motion_val[list][b_xy]; mv_src = &h->mv_cache[list][scan8[0]]; for(y=0; y<4; y++){ AV_COPY128(mv_dst + y*b_stride, mv_src + 8*y); } if( CABAC ) { uint8_t (*mvd_dst)[2] = &h->mvd_table[list][FMO ? 8*h->mb_xy : h->mb2br_xy[h->mb_xy]]; uint8_t (*mvd_src)[2] = &h->mvd_cache[list][scan8[0]]; if(IS_SKIP(mb_type)) AV_ZERO128(mvd_dst); else{ AV_COPY64(mvd_dst, mvd_src + 8*3); AV_COPY16(mvd_dst + 3 + 3, mvd_src + 3 + 8*0); AV_COPY16(mvd_dst + 3 + 2, mvd_src + 3 + 8*1); AV_COPY16(mvd_dst + 3 + 1, mvd_src + 3 + 8*2); } } { int8_t *ref_index = &s->current_picture.ref_index[list][b8_xy]; ref_index[0+0*2]= h->ref_cache[list][scan8[0]]; ref_index[1+0*2]= h->ref_cache[list][scan8[4]]; ref_index[0+1*2]= h->ref_cache[list][scan8[8]]; ref_index[1+1*2]= h->ref_cache[list][scan8[12]]; } } if(h->slice_type_nos == FF_B_TYPE && CABAC){ if(IS_8X8(mb_type)){ uint8_t *direct_table = &h->direct_table[4*h->mb_xy]; direct_table[1] = h->sub_mb_type[1]>>1; direct_table[2] = h->sub_mb_type[2]>>1; direct_table[3] = h->sub_mb_type[3]>>1; } } } static inline int get_dct8x8_allowed(H264Context *h){ if(h->sps.direct_8x8_inference_flag) return !(AV_RN64A(h->sub_mb_type) & ((MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8 )*0x0001000100010001ULL)); else return !(AV_RN64A(h->sub_mb_type) & ((MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8|MB_TYPE_DIRECT2)*0x0001000100010001ULL)); } /** * decodes a P_SKIP or B_SKIP macroblock */ static void decode_mb_skip(H264Context *h){ MpegEncContext * const s = &h->s; const int mb_xy= h->mb_xy; int mb_type=0; memset(h->non_zero_count[mb_xy], 0, 32); memset(h->non_zero_count_cache + 8, 0, 8*5); //FIXME ugly, remove pfui if(MB_FIELD) mb_type|= MB_TYPE_INTERLACED; if( h->slice_type_nos == FF_B_TYPE ) { // just for fill_caches. pred_direct_motion will set the real mb_type mb_type|= MB_TYPE_L0L1|MB_TYPE_DIRECT2|MB_TYPE_SKIP; if(h->direct_spatial_mv_pred){ fill_decode_neighbors(h, mb_type); fill_decode_caches(h, mb_type); //FIXME check what is needed and what not ... } ff_h264_pred_direct_motion(h, &mb_type); mb_type|= MB_TYPE_SKIP; } else { int mx, my; mb_type|= MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P1L0|MB_TYPE_SKIP; fill_decode_neighbors(h, mb_type); fill_decode_caches(h, mb_type); //FIXME check what is needed and what not ... pred_pskip_motion(h, &mx, &my); fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, 0, 1); fill_rectangle( h->mv_cache[0][scan8[0]], 4, 4, 8, pack16to32(mx,my), 4); } write_back_motion(h, mb_type); s->current_picture.mb_type[mb_xy]= mb_type; s->current_picture.qscale_table[mb_xy]= s->qscale; h->slice_table[ mb_xy ]= h->slice_num; h->prev_mb_skipped= 1; } #include "h264_mvpred.h" //For pred_pskip_motion() #endif /* AVCODEC_H264_H */
123linslouis-android-video-cutter
jni/libavcodec/h264.h
C
asf20
46,821
/* * RV10/RV20 decoder * Copyright (c) 2000,2001 Fabrice Bellard * Copyright (c) 2002-2004 Michael Niedermayer * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * RV10/RV20 decoder */ #include "avcodec.h" #include "dsputil.h" #include "mpegvideo.h" #include "mpeg4video.h" #include "h263.h" //#define DEBUG #define DC_VLC_BITS 14 //FIXME find a better solution static const uint16_t rv_lum_code[256] = { 0x3e7f, 0x0f00, 0x0f01, 0x0f02, 0x0f03, 0x0f04, 0x0f05, 0x0f06, 0x0f07, 0x0f08, 0x0f09, 0x0f0a, 0x0f0b, 0x0f0c, 0x0f0d, 0x0f0e, 0x0f0f, 0x0f10, 0x0f11, 0x0f12, 0x0f13, 0x0f14, 0x0f15, 0x0f16, 0x0f17, 0x0f18, 0x0f19, 0x0f1a, 0x0f1b, 0x0f1c, 0x0f1d, 0x0f1e, 0x0f1f, 0x0f20, 0x0f21, 0x0f22, 0x0f23, 0x0f24, 0x0f25, 0x0f26, 0x0f27, 0x0f28, 0x0f29, 0x0f2a, 0x0f2b, 0x0f2c, 0x0f2d, 0x0f2e, 0x0f2f, 0x0f30, 0x0f31, 0x0f32, 0x0f33, 0x0f34, 0x0f35, 0x0f36, 0x0f37, 0x0f38, 0x0f39, 0x0f3a, 0x0f3b, 0x0f3c, 0x0f3d, 0x0f3e, 0x0f3f, 0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0386, 0x0387, 0x0388, 0x0389, 0x038a, 0x038b, 0x038c, 0x038d, 0x038e, 0x038f, 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0020, 0x0021, 0x0022, 0x0023, 0x000c, 0x000d, 0x0004, 0x0000, 0x0005, 0x000e, 0x000f, 0x0024, 0x0025, 0x0026, 0x0027, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, 0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, 0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03b0, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x0f40, 0x0f41, 0x0f42, 0x0f43, 0x0f44, 0x0f45, 0x0f46, 0x0f47, 0x0f48, 0x0f49, 0x0f4a, 0x0f4b, 0x0f4c, 0x0f4d, 0x0f4e, 0x0f4f, 0x0f50, 0x0f51, 0x0f52, 0x0f53, 0x0f54, 0x0f55, 0x0f56, 0x0f57, 0x0f58, 0x0f59, 0x0f5a, 0x0f5b, 0x0f5c, 0x0f5d, 0x0f5e, 0x0f5f, 0x0f60, 0x0f61, 0x0f62, 0x0f63, 0x0f64, 0x0f65, 0x0f66, 0x0f67, 0x0f68, 0x0f69, 0x0f6a, 0x0f6b, 0x0f6c, 0x0f6d, 0x0f6e, 0x0f6f, 0x0f70, 0x0f71, 0x0f72, 0x0f73, 0x0f74, 0x0f75, 0x0f76, 0x0f77, 0x0f78, 0x0f79, 0x0f7a, 0x0f7b, 0x0f7c, 0x0f7d, 0x0f7e, 0x0f7f, }; static const uint8_t rv_lum_bits[256] = { 14, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 4, 2, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, }; static const uint16_t rv_chrom_code[256] = { 0xfe7f, 0x3f00, 0x3f01, 0x3f02, 0x3f03, 0x3f04, 0x3f05, 0x3f06, 0x3f07, 0x3f08, 0x3f09, 0x3f0a, 0x3f0b, 0x3f0c, 0x3f0d, 0x3f0e, 0x3f0f, 0x3f10, 0x3f11, 0x3f12, 0x3f13, 0x3f14, 0x3f15, 0x3f16, 0x3f17, 0x3f18, 0x3f19, 0x3f1a, 0x3f1b, 0x3f1c, 0x3f1d, 0x3f1e, 0x3f1f, 0x3f20, 0x3f21, 0x3f22, 0x3f23, 0x3f24, 0x3f25, 0x3f26, 0x3f27, 0x3f28, 0x3f29, 0x3f2a, 0x3f2b, 0x3f2c, 0x3f2d, 0x3f2e, 0x3f2f, 0x3f30, 0x3f31, 0x3f32, 0x3f33, 0x3f34, 0x3f35, 0x3f36, 0x3f37, 0x3f38, 0x3f39, 0x3f3a, 0x3f3b, 0x3f3c, 0x3f3d, 0x3f3e, 0x3f3f, 0x0f80, 0x0f81, 0x0f82, 0x0f83, 0x0f84, 0x0f85, 0x0f86, 0x0f87, 0x0f88, 0x0f89, 0x0f8a, 0x0f8b, 0x0f8c, 0x0f8d, 0x0f8e, 0x0f8f, 0x0f90, 0x0f91, 0x0f92, 0x0f93, 0x0f94, 0x0f95, 0x0f96, 0x0f97, 0x0f98, 0x0f99, 0x0f9a, 0x0f9b, 0x0f9c, 0x0f9d, 0x0f9e, 0x0f9f, 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce, 0x03cf, 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, 0x0030, 0x0031, 0x0032, 0x0033, 0x0008, 0x0009, 0x0002, 0x0000, 0x0003, 0x000a, 0x000b, 0x0034, 0x0035, 0x0036, 0x0037, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, 0x03d0, 0x03d1, 0x03d2, 0x03d3, 0x03d4, 0x03d5, 0x03d6, 0x03d7, 0x03d8, 0x03d9, 0x03da, 0x03db, 0x03dc, 0x03dd, 0x03de, 0x03df, 0x0fa0, 0x0fa1, 0x0fa2, 0x0fa3, 0x0fa4, 0x0fa5, 0x0fa6, 0x0fa7, 0x0fa8, 0x0fa9, 0x0faa, 0x0fab, 0x0fac, 0x0fad, 0x0fae, 0x0faf, 0x0fb0, 0x0fb1, 0x0fb2, 0x0fb3, 0x0fb4, 0x0fb5, 0x0fb6, 0x0fb7, 0x0fb8, 0x0fb9, 0x0fba, 0x0fbb, 0x0fbc, 0x0fbd, 0x0fbe, 0x0fbf, 0x3f40, 0x3f41, 0x3f42, 0x3f43, 0x3f44, 0x3f45, 0x3f46, 0x3f47, 0x3f48, 0x3f49, 0x3f4a, 0x3f4b, 0x3f4c, 0x3f4d, 0x3f4e, 0x3f4f, 0x3f50, 0x3f51, 0x3f52, 0x3f53, 0x3f54, 0x3f55, 0x3f56, 0x3f57, 0x3f58, 0x3f59, 0x3f5a, 0x3f5b, 0x3f5c, 0x3f5d, 0x3f5e, 0x3f5f, 0x3f60, 0x3f61, 0x3f62, 0x3f63, 0x3f64, 0x3f65, 0x3f66, 0x3f67, 0x3f68, 0x3f69, 0x3f6a, 0x3f6b, 0x3f6c, 0x3f6d, 0x3f6e, 0x3f6f, 0x3f70, 0x3f71, 0x3f72, 0x3f73, 0x3f74, 0x3f75, 0x3f76, 0x3f77, 0x3f78, 0x3f79, 0x3f7a, 0x3f7b, 0x3f7c, 0x3f7d, 0x3f7e, 0x3f7f, }; static const uint8_t rv_chrom_bits[256] = { 16, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 8, 8, 8, 8, 8, 8, 8, 8, 6, 6, 6, 6, 4, 4, 3, 2, 3, 4, 4, 6, 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, }; static VLC rv_dc_lum, rv_dc_chrom; int rv_decode_dc(MpegEncContext *s, int n) { int code; if (n < 4) { code = get_vlc2(&s->gb, rv_dc_lum.table, DC_VLC_BITS, 2); if (code < 0) { /* XXX: I don't understand why they use LONGER codes than necessary. The following code would be completely useless if they had thought about it !!! */ code = get_bits(&s->gb, 7); if (code == 0x7c) { code = (int8_t)(get_bits(&s->gb, 7) + 1); } else if (code == 0x7d) { code = -128 + get_bits(&s->gb, 7); } else if (code == 0x7e) { if (get_bits1(&s->gb) == 0) code = (int8_t)(get_bits(&s->gb, 8) + 1); else code = (int8_t)(get_bits(&s->gb, 8)); } else if (code == 0x7f) { skip_bits(&s->gb, 11); code = 1; } } else { code -= 128; } } else { code = get_vlc2(&s->gb, rv_dc_chrom.table, DC_VLC_BITS, 2); /* same remark */ if (code < 0) { code = get_bits(&s->gb, 9); if (code == 0x1fc) { code = (int8_t)(get_bits(&s->gb, 7) + 1); } else if (code == 0x1fd) { code = -128 + get_bits(&s->gb, 7); } else if (code == 0x1fe) { skip_bits(&s->gb, 9); code = 1; } else { av_log(s->avctx, AV_LOG_ERROR, "chroma dc error\n"); return 0xffff; } } else { code -= 128; } } return -code; } /* read RV 1.0 compatible frame header */ static int rv10_decode_picture_header(MpegEncContext *s) { int mb_count, pb_frame, marker, unk, mb_xy; marker = get_bits1(&s->gb); if (get_bits1(&s->gb)) s->pict_type = FF_P_TYPE; else s->pict_type = FF_I_TYPE; if(!marker) av_log(s->avctx, AV_LOG_ERROR, "marker missing\n"); pb_frame = get_bits1(&s->gb); dprintf(s->avctx, "pict_type=%d pb_frame=%d\n", s->pict_type, pb_frame); if (pb_frame){ av_log(s->avctx, AV_LOG_ERROR, "pb frame not supported\n"); return -1; } s->qscale = get_bits(&s->gb, 5); if(s->qscale==0){ av_log(s->avctx, AV_LOG_ERROR, "error, qscale:0\n"); return -1; } if (s->pict_type == FF_I_TYPE) { if (s->rv10_version == 3) { /* specific MPEG like DC coding not used */ s->last_dc[0] = get_bits(&s->gb, 8); s->last_dc[1] = get_bits(&s->gb, 8); s->last_dc[2] = get_bits(&s->gb, 8); dprintf(s->avctx, "DC:%d %d %d\n", s->last_dc[0], s->last_dc[1], s->last_dc[2]); } } /* if multiple packets per frame are sent, the position at which to display the macroblocks is coded here */ mb_xy= s->mb_x + s->mb_y*s->mb_width; if(show_bits(&s->gb, 12)==0 || (mb_xy && mb_xy < s->mb_num)){ s->mb_x = get_bits(&s->gb, 6); /* mb_x */ s->mb_y = get_bits(&s->gb, 6); /* mb_y */ mb_count = get_bits(&s->gb, 12); } else { s->mb_x = 0; s->mb_y = 0; mb_count = s->mb_width * s->mb_height; } unk= get_bits(&s->gb, 3); /* ignored */ s->f_code = 1; s->unrestricted_mv = 1; return mb_count; } static int rv20_decode_picture_header(MpegEncContext *s) { int seq, mb_pos, i; #if 0 GetBitContext gb= s->gb; for(i=0; i<64; i++){ av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&gb)); if(i%4==3) av_log(s->avctx, AV_LOG_DEBUG, " "); } av_log(s->avctx, AV_LOG_DEBUG, "\n"); #endif #if 0 av_log(s->avctx, AV_LOG_DEBUG, "%3dx%03d/%02Xx%02X ", s->width, s->height, s->width/4, s->height/4); for(i=0; i<s->avctx->extradata_size; i++){ av_log(s->avctx, AV_LOG_DEBUG, "%02X ", ((uint8_t*)s->avctx->extradata)[i]); if(i%4==3) av_log(s->avctx, AV_LOG_DEBUG, " "); } av_log(s->avctx, AV_LOG_DEBUG, "\n"); #endif if(s->avctx->sub_id == 0x30202002 || s->avctx->sub_id == 0x30203002){ if (get_bits(&s->gb, 3)){ av_log(s->avctx, AV_LOG_ERROR, "unknown triplet set\n"); return -1; } } i= get_bits(&s->gb, 2); switch(i){ case 0: s->pict_type= FF_I_TYPE; break; case 1: s->pict_type= FF_I_TYPE; break; //hmm ... case 2: s->pict_type= FF_P_TYPE; break; case 3: s->pict_type= FF_B_TYPE; break; default: av_log(s->avctx, AV_LOG_ERROR, "unknown frame type\n"); return -1; } if(s->last_picture_ptr==NULL && s->pict_type==FF_B_TYPE){ av_log(s->avctx, AV_LOG_ERROR, "early B pix\n"); return -1; } if (get_bits1(&s->gb)){ av_log(s->avctx, AV_LOG_ERROR, "unknown bit set\n"); return -1; } s->qscale = get_bits(&s->gb, 5); if(s->qscale==0){ av_log(s->avctx, AV_LOG_ERROR, "error, qscale:0\n"); return -1; } if(s->avctx->sub_id == 0x30203002){ if (get_bits1(&s->gb)){ av_log(s->avctx, AV_LOG_ERROR, "unknown bit2 set\n"); return -1; } } if(s->avctx->has_b_frames){ int f, new_w, new_h; int v= s->avctx->extradata_size >= 4 ? 7&((uint8_t*)s->avctx->extradata)[1] : 0; if (get_bits1(&s->gb)){ av_log(s->avctx, AV_LOG_ERROR, "unknown bit3 set\n"); } seq= get_bits(&s->gb, 13)<<2; f= get_bits(&s->gb, av_log2(v)+1); if(f){ new_w= 4*((uint8_t*)s->avctx->extradata)[6+2*f]; new_h= 4*((uint8_t*)s->avctx->extradata)[7+2*f]; }else{ new_w= s->orig_width ; new_h= s->orig_height; } if(new_w != s->width || new_h != s->height){ av_log(s->avctx, AV_LOG_DEBUG, "attempting to change resolution to %dx%d\n", new_w, new_h); if (avcodec_check_dimensions(s->avctx, new_w, new_h) < 0) return -1; MPV_common_end(s); avcodec_set_dimensions(s->avctx, new_w, new_h); s->width = new_w; s->height = new_h; if (MPV_common_init(s) < 0) return -1; } if(s->avctx->debug & FF_DEBUG_PICT_INFO){ av_log(s->avctx, AV_LOG_DEBUG, "F %d/%d\n", f, v); } }else{ seq= get_bits(&s->gb, 8)*128; } // if(s->avctx->sub_id <= 0x20201002){ //0x20201002 definitely needs this mb_pos= ff_h263_decode_mba(s); /* }else{ mb_pos= get_bits(&s->gb, av_log2(s->mb_num-1)+1); s->mb_x= mb_pos % s->mb_width; s->mb_y= mb_pos / s->mb_width; }*/ //av_log(s->avctx, AV_LOG_DEBUG, "%d\n", seq); seq |= s->time &~0x7FFF; if(seq - s->time > 0x4000) seq -= 0x8000; if(seq - s->time < -0x4000) seq += 0x8000; if(seq != s->time){ if(s->pict_type!=FF_B_TYPE){ s->time= seq; s->pp_time= s->time - s->last_non_b_time; s->last_non_b_time= s->time; }else{ s->time= seq; s->pb_time= s->pp_time - (s->last_non_b_time - s->time); if(s->pp_time <=s->pb_time || s->pp_time <= s->pp_time - s->pb_time || s->pp_time<=0){ av_log(s->avctx, AV_LOG_DEBUG, "messed up order, possible from seeking? skipping current b frame\n"); return FRAME_SKIPPED; } ff_mpeg4_init_direct_mv(s); } } // printf("%d %d %d %d %d\n", seq, (int)s->time, (int)s->last_non_b_time, s->pp_time, s->pb_time); /*for(i=0; i<32; i++){ av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb)); } av_log(s->avctx, AV_LOG_DEBUG, "\n");*/ s->no_rounding= get_bits1(&s->gb); s->f_code = 1; s->unrestricted_mv = 1; s->h263_aic= s->pict_type == FF_I_TYPE; // s->alt_inter_vlc=1; // s->obmc=1; // s->umvplus=1; s->modified_quant=1; if(!s->avctx->lowres) s->loop_filter=1; if(s->avctx->debug & FF_DEBUG_PICT_INFO){ av_log(s->avctx, AV_LOG_INFO, "num:%5d x:%2d y:%2d type:%d qscale:%2d rnd:%d\n", seq, s->mb_x, s->mb_y, s->pict_type, s->qscale, s->no_rounding); } assert(s->pict_type != FF_B_TYPE || !s->low_delay); return s->mb_width*s->mb_height - mb_pos; } static av_cold int rv10_decode_init(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; static int done=0; if (avctx->extradata_size < 8) { av_log(avctx, AV_LOG_ERROR, "Extradata is too small.\n"); return -1; } MPV_decode_defaults(s); s->avctx= avctx; s->out_format = FMT_H263; s->codec_id= avctx->codec_id; s->orig_width = s->width = avctx->coded_width; s->orig_height= s->height = avctx->coded_height; s->h263_long_vectors= ((uint8_t*)avctx->extradata)[3] & 1; avctx->sub_id= AV_RB32((uint8_t*)avctx->extradata + 4); if (avctx->sub_id == 0x10000000) { s->rv10_version= 0; s->low_delay=1; } else if (avctx->sub_id == 0x10001000) { s->rv10_version= 3; s->low_delay=1; } else if (avctx->sub_id == 0x10002000) { s->rv10_version= 3; s->low_delay=1; s->obmc=1; } else if (avctx->sub_id == 0x10003000) { s->rv10_version= 3; s->low_delay=1; } else if (avctx->sub_id == 0x10003001) { s->rv10_version= 3; s->low_delay=1; } else if ( avctx->sub_id == 0x20001000 || (avctx->sub_id >= 0x20100000 && avctx->sub_id < 0x201a0000)) { s->low_delay=1; } else if ( avctx->sub_id == 0x30202002 || avctx->sub_id == 0x30203002 || (avctx->sub_id >= 0x20200002 && avctx->sub_id < 0x20300000)) { s->low_delay=0; s->avctx->has_b_frames=1; } else av_log(s->avctx, AV_LOG_ERROR, "unknown header %X\n", avctx->sub_id); if(avctx->debug & FF_DEBUG_PICT_INFO){ av_log(avctx, AV_LOG_DEBUG, "ver:%X ver0:%X\n", avctx->sub_id, avctx->extradata_size >= 4 ? ((uint32_t*)avctx->extradata)[0] : -1); } avctx->pix_fmt = PIX_FMT_YUV420P; if (MPV_common_init(s) < 0) return -1; h263_decode_init_vlc(s); /* init rv vlc */ if (!done) { INIT_VLC_STATIC(&rv_dc_lum, DC_VLC_BITS, 256, rv_lum_bits, 1, 1, rv_lum_code, 2, 2, 16384); INIT_VLC_STATIC(&rv_dc_chrom, DC_VLC_BITS, 256, rv_chrom_bits, 1, 1, rv_chrom_code, 2, 2, 16388); done = 1; } return 0; } static av_cold int rv10_decode_end(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; MPV_common_end(s); return 0; } static int rv10_decode_packet(AVCodecContext *avctx, const uint8_t *buf, int buf_size, int buf_size2) { MpegEncContext *s = avctx->priv_data; int mb_count, mb_pos, left, start_mb_x; init_get_bits(&s->gb, buf, buf_size*8); if(s->codec_id ==CODEC_ID_RV10) mb_count = rv10_decode_picture_header(s); else mb_count = rv20_decode_picture_header(s); if (mb_count < 0) { av_log(s->avctx, AV_LOG_ERROR, "HEADER ERROR\n"); return -1; } if (s->mb_x >= s->mb_width || s->mb_y >= s->mb_height) { av_log(s->avctx, AV_LOG_ERROR, "POS ERROR %d %d\n", s->mb_x, s->mb_y); return -1; } mb_pos = s->mb_y * s->mb_width + s->mb_x; left = s->mb_width * s->mb_height - mb_pos; if (mb_count > left) { av_log(s->avctx, AV_LOG_ERROR, "COUNT ERROR\n"); return -1; } if ((s->mb_x == 0 && s->mb_y == 0) || s->current_picture_ptr==NULL) { if(s->current_picture_ptr){ //FIXME write parser so we always have complete frames? ff_er_frame_end(s); MPV_frame_end(s); s->mb_x= s->mb_y = s->resync_mb_x = s->resync_mb_y= 0; } if(MPV_frame_start(s, avctx) < 0) return -1; ff_er_frame_start(s); } dprintf(avctx, "qscale=%d\n", s->qscale); /* default quantization values */ if(s->codec_id== CODEC_ID_RV10){ if(s->mb_y==0) s->first_slice_line=1; }else{ s->first_slice_line=1; s->resync_mb_x= s->mb_x; } start_mb_x= s->mb_x; s->resync_mb_y= s->mb_y; if(s->h263_aic){ s->y_dc_scale_table= s->c_dc_scale_table= ff_aic_dc_scale_table; }else{ s->y_dc_scale_table= s->c_dc_scale_table= ff_mpeg1_dc_scale_table; } if(s->modified_quant) s->chroma_qscale_table= ff_h263_chroma_qscale_table; ff_set_qscale(s, s->qscale); s->rv10_first_dc_coded[0] = 0; s->rv10_first_dc_coded[1] = 0; s->rv10_first_dc_coded[2] = 0; s->block_wrap[0]= s->block_wrap[1]= s->block_wrap[2]= s->block_wrap[3]= s->b8_stride; s->block_wrap[4]= s->block_wrap[5]= s->mb_stride; ff_init_block_index(s); /* decode each macroblock */ for(s->mb_num_left= mb_count; s->mb_num_left>0; s->mb_num_left--) { int ret; ff_update_block_index(s); dprintf(avctx, "**mb x=%d y=%d\n", s->mb_x, s->mb_y); s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; ret=ff_h263_decode_mb(s, s->block); if (ret != SLICE_ERROR && s->gb.size_in_bits < get_bits_count(&s->gb) && 8*buf_size2 >= get_bits_count(&s->gb)){ av_log(avctx, AV_LOG_DEBUG, "update size from %d to %d\n", s->gb.size_in_bits, 8*buf_size2); s->gb.size_in_bits= 8*buf_size2; ret= SLICE_OK; } if (ret == SLICE_ERROR || s->gb.size_in_bits < get_bits_count(&s->gb)) { av_log(s->avctx, AV_LOG_ERROR, "ERROR at MB %d %d\n", s->mb_x, s->mb_y); return -1; } if(s->pict_type != FF_B_TYPE) ff_h263_update_motion_val(s); MPV_decode_mb(s, s->block); if(s->loop_filter) ff_h263_loop_filter(s); if (++s->mb_x == s->mb_width) { s->mb_x = 0; s->mb_y++; ff_init_block_index(s); } if(s->mb_x == s->resync_mb_x) s->first_slice_line=0; if(ret == SLICE_END) break; } ff_er_add_slice(s, start_mb_x, s->resync_mb_y, s->mb_x-1, s->mb_y, AC_END|DC_END|MV_END); return s->gb.size_in_bits; } static int get_slice_offset(AVCodecContext *avctx, const uint8_t *buf, int n) { if(avctx->slice_count) return avctx->slice_offset[n]; else return AV_RL32(buf + n*8); } static int rv10_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; MpegEncContext *s = avctx->priv_data; int i; AVFrame *pict = data; int slice_count; const uint8_t *slices_hdr = NULL; dprintf(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size); /* no supplementary picture */ if (buf_size == 0) { return 0; } if(!avctx->slice_count){ slice_count = (*buf++) + 1; slices_hdr = buf + 4; buf += 8 * slice_count; }else slice_count = avctx->slice_count; for(i=0; i<slice_count; i++){ int offset= get_slice_offset(avctx, slices_hdr, i); int size, size2; if(i+1 == slice_count) size= buf_size - offset; else size= get_slice_offset(avctx, slices_hdr, i+1) - offset; if(i+2 >= slice_count) size2= buf_size - offset; else size2= get_slice_offset(avctx, slices_hdr, i+2) - offset; if(rv10_decode_packet(avctx, buf+offset, size, size2) > 8*size) i++; } if(s->current_picture_ptr != NULL && s->mb_y>=s->mb_height){ ff_er_frame_end(s); MPV_frame_end(s); if (s->pict_type == FF_B_TYPE || s->low_delay) { *pict= *(AVFrame*)s->current_picture_ptr; } else if (s->last_picture_ptr != NULL) { *pict= *(AVFrame*)s->last_picture_ptr; } if(s->last_picture_ptr || s->low_delay){ *data_size = sizeof(AVFrame); ff_print_debug_info(s, pict); } s->current_picture_ptr= NULL; //so we can detect if frame_end wasnt called (find some nicer solution...) } return buf_size; } AVCodec rv10_decoder = { "rv10", AVMEDIA_TYPE_VIDEO, CODEC_ID_RV10, sizeof(MpegEncContext), rv10_decode_init, NULL, rv10_decode_end, rv10_decode_frame, CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("RealVideo 1.0"), .pix_fmts= ff_pixfmt_list_420, }; AVCodec rv20_decoder = { "rv20", AVMEDIA_TYPE_VIDEO, CODEC_ID_RV20, sizeof(MpegEncContext), rv10_decode_init, NULL, rv10_decode_end, rv10_decode_frame, CODEC_CAP_DR1 | CODEC_CAP_DELAY, .flush= ff_mpeg_flush, .long_name = NULL_IF_CONFIG_SMALL("RealVideo 2.0"), .pix_fmts= ff_pixfmt_list_420, };
123linslouis-android-video-cutter
jni/libavcodec/rv10.c
C
asf20
24,612
/** * ALAC audio encoder * Copyright (c) 2008 Jaikrishnan Menon <realityman@gmx.net> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avcodec.h" #include "put_bits.h" #include "dsputil.h" #include "lpc.h" #include "mathops.h" #define DEFAULT_FRAME_SIZE 4096 #define DEFAULT_SAMPLE_SIZE 16 #define MAX_CHANNELS 8 #define ALAC_EXTRADATA_SIZE 36 #define ALAC_FRAME_HEADER_SIZE 55 #define ALAC_FRAME_FOOTER_SIZE 3 #define ALAC_ESCAPE_CODE 0x1FF #define ALAC_MAX_LPC_ORDER 30 #define DEFAULT_MAX_PRED_ORDER 6 #define DEFAULT_MIN_PRED_ORDER 4 #define ALAC_MAX_LPC_PRECISION 9 #define ALAC_MAX_LPC_SHIFT 9 #define ALAC_CHMODE_LEFT_RIGHT 0 #define ALAC_CHMODE_LEFT_SIDE 1 #define ALAC_CHMODE_RIGHT_SIDE 2 #define ALAC_CHMODE_MID_SIDE 3 typedef struct RiceContext { int history_mult; int initial_history; int k_modifier; int rice_modifier; } RiceContext; typedef struct LPCContext { int lpc_order; int lpc_coeff[ALAC_MAX_LPC_ORDER+1]; int lpc_quant; } LPCContext; typedef struct AlacEncodeContext { int compression_level; int min_prediction_order; int max_prediction_order; int max_coded_frame_size; int write_sample_size; int32_t sample_buf[MAX_CHANNELS][DEFAULT_FRAME_SIZE]; int32_t predictor_buf[DEFAULT_FRAME_SIZE]; int interlacing_shift; int interlacing_leftweight; PutBitContext pbctx; RiceContext rc; LPCContext lpc[MAX_CHANNELS]; DSPContext dspctx; AVCodecContext *avctx; } AlacEncodeContext; static void init_sample_buffers(AlacEncodeContext *s, int16_t *input_samples) { int ch, i; for(ch=0;ch<s->avctx->channels;ch++) { int16_t *sptr = input_samples + ch; for(i=0;i<s->avctx->frame_size;i++) { s->sample_buf[ch][i] = *sptr; sptr += s->avctx->channels; } } } static void encode_scalar(AlacEncodeContext *s, int x, int k, int write_sample_size) { int divisor, q, r; k = FFMIN(k, s->rc.k_modifier); divisor = (1<<k) - 1; q = x / divisor; r = x % divisor; if(q > 8) { // write escape code and sample value directly put_bits(&s->pbctx, 9, ALAC_ESCAPE_CODE); put_bits(&s->pbctx, write_sample_size, x); } else { if(q) put_bits(&s->pbctx, q, (1<<q) - 1); put_bits(&s->pbctx, 1, 0); if(k != 1) { if(r > 0) put_bits(&s->pbctx, k, r+1); else put_bits(&s->pbctx, k-1, 0); } } } static void write_frame_header(AlacEncodeContext *s, int is_verbatim) { put_bits(&s->pbctx, 3, s->avctx->channels-1); // No. of channels -1 put_bits(&s->pbctx, 16, 0); // Seems to be zero put_bits(&s->pbctx, 1, 1); // Sample count is in the header put_bits(&s->pbctx, 2, 0); // FIXME: Wasted bytes field put_bits(&s->pbctx, 1, is_verbatim); // Audio block is verbatim put_bits32(&s->pbctx, s->avctx->frame_size); // No. of samples in the frame } static void calc_predictor_params(AlacEncodeContext *s, int ch) { int32_t coefs[MAX_LPC_ORDER][MAX_LPC_ORDER]; int shift[MAX_LPC_ORDER]; int opt_order; if (s->compression_level == 1) { s->lpc[ch].lpc_order = 6; s->lpc[ch].lpc_quant = 6; s->lpc[ch].lpc_coeff[0] = 160; s->lpc[ch].lpc_coeff[1] = -190; s->lpc[ch].lpc_coeff[2] = 170; s->lpc[ch].lpc_coeff[3] = -130; s->lpc[ch].lpc_coeff[4] = 80; s->lpc[ch].lpc_coeff[5] = -25; } else { opt_order = ff_lpc_calc_coefs(&s->dspctx, s->sample_buf[ch], s->avctx->frame_size, s->min_prediction_order, s->max_prediction_order, ALAC_MAX_LPC_PRECISION, coefs, shift, 1, ORDER_METHOD_EST, ALAC_MAX_LPC_SHIFT, 1); s->lpc[ch].lpc_order = opt_order; s->lpc[ch].lpc_quant = shift[opt_order-1]; memcpy(s->lpc[ch].lpc_coeff, coefs[opt_order-1], opt_order*sizeof(int)); } } static int estimate_stereo_mode(int32_t *left_ch, int32_t *right_ch, int n) { int i, best; int32_t lt, rt; uint64_t sum[4]; uint64_t score[4]; /* calculate sum of 2nd order residual for each channel */ sum[0] = sum[1] = sum[2] = sum[3] = 0; for(i=2; i<n; i++) { lt = left_ch[i] - 2*left_ch[i-1] + left_ch[i-2]; rt = right_ch[i] - 2*right_ch[i-1] + right_ch[i-2]; sum[2] += FFABS((lt + rt) >> 1); sum[3] += FFABS(lt - rt); sum[0] += FFABS(lt); sum[1] += FFABS(rt); } /* calculate score for each mode */ score[0] = sum[0] + sum[1]; score[1] = sum[0] + sum[3]; score[2] = sum[1] + sum[3]; score[3] = sum[2] + sum[3]; /* return mode with lowest score */ best = 0; for(i=1; i<4; i++) { if(score[i] < score[best]) { best = i; } } return best; } static void alac_stereo_decorrelation(AlacEncodeContext *s) { int32_t *left = s->sample_buf[0], *right = s->sample_buf[1]; int i, mode, n = s->avctx->frame_size; int32_t tmp; mode = estimate_stereo_mode(left, right, n); switch(mode) { case ALAC_CHMODE_LEFT_RIGHT: s->interlacing_leftweight = 0; s->interlacing_shift = 0; break; case ALAC_CHMODE_LEFT_SIDE: for(i=0; i<n; i++) { right[i] = left[i] - right[i]; } s->interlacing_leftweight = 1; s->interlacing_shift = 0; break; case ALAC_CHMODE_RIGHT_SIDE: for(i=0; i<n; i++) { tmp = right[i]; right[i] = left[i] - right[i]; left[i] = tmp + (right[i] >> 31); } s->interlacing_leftweight = 1; s->interlacing_shift = 31; break; default: for(i=0; i<n; i++) { tmp = left[i]; left[i] = (tmp + right[i]) >> 1; right[i] = tmp - right[i]; } s->interlacing_leftweight = 1; s->interlacing_shift = 1; break; } } static void alac_linear_predictor(AlacEncodeContext *s, int ch) { int i; LPCContext lpc = s->lpc[ch]; if(lpc.lpc_order == 31) { s->predictor_buf[0] = s->sample_buf[ch][0]; for(i=1; i<s->avctx->frame_size; i++) s->predictor_buf[i] = s->sample_buf[ch][i] - s->sample_buf[ch][i-1]; return; } // generalised linear predictor if(lpc.lpc_order > 0) { int32_t *samples = s->sample_buf[ch]; int32_t *residual = s->predictor_buf; // generate warm-up samples residual[0] = samples[0]; for(i=1;i<=lpc.lpc_order;i++) residual[i] = samples[i] - samples[i-1]; // perform lpc on remaining samples for(i = lpc.lpc_order + 1; i < s->avctx->frame_size; i++) { int sum = 1 << (lpc.lpc_quant - 1), res_val, j; for (j = 0; j < lpc.lpc_order; j++) { sum += (samples[lpc.lpc_order-j] - samples[0]) * lpc.lpc_coeff[j]; } sum >>= lpc.lpc_quant; sum += samples[0]; residual[i] = sign_extend(samples[lpc.lpc_order+1] - sum, s->write_sample_size); res_val = residual[i]; if(res_val) { int index = lpc.lpc_order - 1; int neg = (res_val < 0); while(index >= 0 && (neg ? (res_val < 0):(res_val > 0))) { int val = samples[0] - samples[lpc.lpc_order - index]; int sign = (val ? FFSIGN(val) : 0); if(neg) sign*=-1; lpc.lpc_coeff[index] -= sign; val *= sign; res_val -= ((val >> lpc.lpc_quant) * (lpc.lpc_order - index)); index--; } } samples++; } } } static void alac_entropy_coder(AlacEncodeContext *s) { unsigned int history = s->rc.initial_history; int sign_modifier = 0, i, k; int32_t *samples = s->predictor_buf; for(i=0;i < s->avctx->frame_size;) { int x; k = av_log2((history >> 9) + 3); x = -2*(*samples)-1; x ^= (x>>31); samples++; i++; encode_scalar(s, x - sign_modifier, k, s->write_sample_size); history += x * s->rc.history_mult - ((history * s->rc.history_mult) >> 9); sign_modifier = 0; if(x > 0xFFFF) history = 0xFFFF; if((history < 128) && (i < s->avctx->frame_size)) { unsigned int block_size = 0; k = 7 - av_log2(history) + ((history + 16) >> 6); while((*samples == 0) && (i < s->avctx->frame_size)) { samples++; i++; block_size++; } encode_scalar(s, block_size, k, 16); sign_modifier = (block_size <= 0xFFFF); history = 0; } } } static void write_compressed_frame(AlacEncodeContext *s) { int i, j; if(s->avctx->channels == 2) alac_stereo_decorrelation(s); put_bits(&s->pbctx, 8, s->interlacing_shift); put_bits(&s->pbctx, 8, s->interlacing_leftweight); for(i=0;i<s->avctx->channels;i++) { calc_predictor_params(s, i); put_bits(&s->pbctx, 4, 0); // prediction type : currently only type 0 has been RE'd put_bits(&s->pbctx, 4, s->lpc[i].lpc_quant); put_bits(&s->pbctx, 3, s->rc.rice_modifier); put_bits(&s->pbctx, 5, s->lpc[i].lpc_order); // predictor coeff. table for(j=0;j<s->lpc[i].lpc_order;j++) { put_sbits(&s->pbctx, 16, s->lpc[i].lpc_coeff[j]); } } // apply lpc and entropy coding to audio samples for(i=0;i<s->avctx->channels;i++) { alac_linear_predictor(s, i); alac_entropy_coder(s); } } static av_cold int alac_encode_init(AVCodecContext *avctx) { AlacEncodeContext *s = avctx->priv_data; uint8_t *alac_extradata = av_mallocz(ALAC_EXTRADATA_SIZE+1); avctx->frame_size = DEFAULT_FRAME_SIZE; avctx->bits_per_coded_sample = DEFAULT_SAMPLE_SIZE; if(avctx->sample_fmt != SAMPLE_FMT_S16) { av_log(avctx, AV_LOG_ERROR, "only pcm_s16 input samples are supported\n"); return -1; } // Set default compression level if(avctx->compression_level == FF_COMPRESSION_DEFAULT) s->compression_level = 2; else s->compression_level = av_clip(avctx->compression_level, 0, 2); // Initialize default Rice parameters s->rc.history_mult = 40; s->rc.initial_history = 10; s->rc.k_modifier = 14; s->rc.rice_modifier = 4; s->max_coded_frame_size = 8 + (avctx->frame_size*avctx->channels*avctx->bits_per_coded_sample>>3); s->write_sample_size = avctx->bits_per_coded_sample + avctx->channels - 1; // FIXME: consider wasted_bytes AV_WB32(alac_extradata, ALAC_EXTRADATA_SIZE); AV_WB32(alac_extradata+4, MKBETAG('a','l','a','c')); AV_WB32(alac_extradata+12, avctx->frame_size); AV_WB8 (alac_extradata+17, avctx->bits_per_coded_sample); AV_WB8 (alac_extradata+21, avctx->channels); AV_WB32(alac_extradata+24, s->max_coded_frame_size); AV_WB32(alac_extradata+28, avctx->sample_rate*avctx->channels*avctx->bits_per_coded_sample); // average bitrate AV_WB32(alac_extradata+32, avctx->sample_rate); // Set relevant extradata fields if(s->compression_level > 0) { AV_WB8(alac_extradata+18, s->rc.history_mult); AV_WB8(alac_extradata+19, s->rc.initial_history); AV_WB8(alac_extradata+20, s->rc.k_modifier); } s->min_prediction_order = DEFAULT_MIN_PRED_ORDER; if(avctx->min_prediction_order >= 0) { if(avctx->min_prediction_order < MIN_LPC_ORDER || avctx->min_prediction_order > ALAC_MAX_LPC_ORDER) { av_log(avctx, AV_LOG_ERROR, "invalid min prediction order: %d\n", avctx->min_prediction_order); return -1; } s->min_prediction_order = avctx->min_prediction_order; } s->max_prediction_order = DEFAULT_MAX_PRED_ORDER; if(avctx->max_prediction_order >= 0) { if(avctx->max_prediction_order < MIN_LPC_ORDER || avctx->max_prediction_order > ALAC_MAX_LPC_ORDER) { av_log(avctx, AV_LOG_ERROR, "invalid max prediction order: %d\n", avctx->max_prediction_order); return -1; } s->max_prediction_order = avctx->max_prediction_order; } if(s->max_prediction_order < s->min_prediction_order) { av_log(avctx, AV_LOG_ERROR, "invalid prediction orders: min=%d max=%d\n", s->min_prediction_order, s->max_prediction_order); return -1; } avctx->extradata = alac_extradata; avctx->extradata_size = ALAC_EXTRADATA_SIZE; avctx->coded_frame = avcodec_alloc_frame(); avctx->coded_frame->key_frame = 1; s->avctx = avctx; dsputil_init(&s->dspctx, avctx); return 0; } static int alac_encode_frame(AVCodecContext *avctx, uint8_t *frame, int buf_size, void *data) { AlacEncodeContext *s = avctx->priv_data; PutBitContext *pb = &s->pbctx; int i, out_bytes, verbatim_flag = 0; if(avctx->frame_size > DEFAULT_FRAME_SIZE) { av_log(avctx, AV_LOG_ERROR, "input frame size exceeded\n"); return -1; } if(buf_size < 2*s->max_coded_frame_size) { av_log(avctx, AV_LOG_ERROR, "buffer size is too small\n"); return -1; } verbatim: init_put_bits(pb, frame, buf_size); if((s->compression_level == 0) || verbatim_flag) { // Verbatim mode int16_t *samples = data; write_frame_header(s, 1); for(i=0; i<avctx->frame_size*avctx->channels; i++) { put_sbits(pb, 16, *samples++); } } else { init_sample_buffers(s, data); write_frame_header(s, 0); write_compressed_frame(s); } put_bits(pb, 3, 7); flush_put_bits(pb); out_bytes = put_bits_count(pb) >> 3; if(out_bytes > s->max_coded_frame_size) { /* frame too large. use verbatim mode */ if(verbatim_flag || (s->compression_level == 0)) { /* still too large. must be an error. */ av_log(avctx, AV_LOG_ERROR, "error encoding frame\n"); return -1; } verbatim_flag = 1; goto verbatim; } return out_bytes; } static av_cold int alac_encode_close(AVCodecContext *avctx) { av_freep(&avctx->extradata); avctx->extradata_size = 0; av_freep(&avctx->coded_frame); return 0; } AVCodec alac_encoder = { "alac", AVMEDIA_TYPE_AUDIO, CODEC_ID_ALAC, sizeof(AlacEncodeContext), alac_encode_init, alac_encode_frame, alac_encode_close, .capabilities = CODEC_CAP_SMALL_LAST_FRAME, .sample_fmts = (const enum SampleFormat[]){ SAMPLE_FMT_S16, SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("ALAC (Apple Lossless Audio Codec)"), };
123linslouis-android-video-cutter
jni/libavcodec/alacenc.c
C
asf20
16,222
/* * Indeo Video Interactive 5 compatible decoder * Copyright (c) 2009 Maxim Poliakovski * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * This file contains data needed for the Indeo5 decoder. */ #ifndef AVCODEC_INDEO5DATA_H #define AVCODEC_INDEO5DATA_H #include <stdint.h> /** * standard picture dimensions (width, height divided by 4) */ static const uint8_t ivi5_common_pic_sizes[30] = { 160, 120, 80, 60, 40, 30, 176, 120, 88, 60, 88, 72, 44, 36, 60, 45, 160, 60, 176, 60, 20, 15, 22, 18, 0, 0, 0, 0, 0, 0 }; /** * Indeo5 8x8 scan (zigzag) patterns */ static const uint8_t ivi5_scans8x8[2][64] = { {0, 8, 16, 24, 32, 40, 48, 56, 1, 9, 17, 25, 33, 41, 49, 57, 2, 10, 18, 26, 34, 42, 50, 58, 3, 11, 19, 27, 35, 43, 51, 59, 4, 12, 20, 28, 36, 44, 52, 60, 5, 13, 21, 29, 37, 45, 53, 61, 6, 14, 22, 30, 38, 46, 54, 62, 7, 15, 23, 31, 39, 47, 55, 63 }, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63 } }; /** * Indeo5 4x4 scan (zigzag) pattern */ static const uint8_t ivi5_scan4x4[16] = { 0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15 }; /** * Indeo5 dequantization matrixes consist of two tables: base table * and scale table. The base table defines the dequantization matrix * itself and the scale table tells how this matrix should be scaled * for a particular quant level (0...24). * * ivi5_base_quant_bbb_ttt - base tables for block size 'bbb' of type 'ttt' * ivi5_scale_quant_bbb_ttt - scale tables for block size 'bbb' of type 'ttt' */ static const uint8_t ivi5_base_quant_8x8_inter[5][64] = { {0x13, 0x1d, 0x1f, 0x23, 0x25, 0x27, 0x29, 0x2d, 0x1d, 0x1f, 0x21, 0x23, 0x25, 0x27, 0x2b, 0x2f, 0x1f, 0x21, 0x23, 0x24, 0x26, 0x29, 0x2d, 0x31, 0x23, 0x23, 0x24, 0x25, 0x27, 0x2b, 0x2f, 0x33, 0x25, 0x25, 0x26, 0x27, 0x29, 0x2d, 0x31, 0x35, 0x27, 0x27, 0x29, 0x2b, 0x2d, 0x2f, 0x33, 0x37, 0x29, 0x2b, 0x2d, 0x2f, 0x31, 0x33, 0x35, 0x39, 0x2d, 0x2f, 0x31, 0x33, 0x35, 0x37, 0x39, 0x3b }, {0x13, 0x1d, 0x1f, 0x23, 0x25, 0x27, 0x29, 0x2d, 0x1d, 0x1f, 0x21, 0x23, 0x25, 0x27, 0x2b, 0x2f, 0x1f, 0x21, 0x23, 0x24, 0x26, 0x29, 0x2d, 0x31, 0x23, 0x23, 0x24, 0x25, 0x27, 0x2b, 0x2f, 0x33, 0x25, 0x25, 0x26, 0x27, 0x29, 0x2d, 0x31, 0x35, 0x27, 0x27, 0x29, 0x2b, 0x2d, 0x2f, 0x33, 0x37, 0x29, 0x2b, 0x2d, 0x2f, 0x31, 0x33, 0x35, 0x39, 0x2d, 0x2f, 0x31, 0x33, 0x35, 0x37, 0x39, 0x3b }, {0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61, 0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61, 0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61, 0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61, 0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61, 0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61, 0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61, 0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61 }, {0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x6a, 0x6a, 0x6a, 0x6a, 0x6a, 0x6a, 0x6a, 0x6a, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x6b, 0x6b, 0x6b, 0x6b, 0x6b, 0x6b, 0x6b, 0x6b, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61 }, {0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f } }; static const uint8_t ivi5_base_quant_8x8_intra[5][64] = { {0x0d, 0x17, 0x1b, 0x21, 0x23, 0x25, 0x27, 0x2d, 0x17, 0x19, 0x1f, 0x21, 0x23, 0x27, 0x2b, 0x35, 0x1b, 0x1f, 0x1f, 0x22, 0x25, 0x2a, 0x33, 0x39, 0x21, 0x21, 0x22, 0x25, 0x29, 0x31, 0x36, 0x3d, 0x23, 0x23, 0x25, 0x29, 0x2f, 0x33, 0x39, 0x47, 0x25, 0x27, 0x2a, 0x31, 0x33, 0x37, 0x43, 0x53, 0x27, 0x2b, 0x33, 0x36, 0x39, 0x43, 0x4d, 0x65, 0x2d, 0x35, 0x39, 0x3d, 0x47, 0x53, 0x65, 0x7f }, {0x13, 0x1d, 0x1f, 0x23, 0x25, 0x27, 0x29, 0x2d, 0x1d, 0x1f, 0x21, 0x23, 0x25, 0x27, 0x2b, 0x2f, 0x1f, 0x21, 0x23, 0x24, 0x26, 0x29, 0x2d, 0x31, 0x23, 0x23, 0x24, 0x25, 0x27, 0x2b, 0x2f, 0x33, 0x25, 0x25, 0x26, 0x27, 0x29, 0x2d, 0x31, 0x35, 0x27, 0x27, 0x29, 0x2b, 0x2d, 0x2f, 0x33, 0x37, 0x29, 0x2b, 0x2d, 0x2f, 0x31, 0x33, 0x35, 0x39, 0x2d, 0x2f, 0x31, 0x33, 0x35, 0x37, 0x39, 0x3b }, {0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61, 0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61, 0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61, 0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61, 0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61, 0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61, 0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61, 0x27, 0x55, 0x79, 0x6a, 0x6f, 0x61, 0x6b, 0x61 }, {0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x79, 0x6a, 0x6a, 0x6a, 0x6a, 0x6a, 0x6a, 0x6a, 0x6a, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x6b, 0x6b, 0x6b, 0x6b, 0x6b, 0x6b, 0x6b, 0x6b, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61 }, {0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f } }; static const uint8_t ivi5_base_quant_4x4_inter[16] = { 0x0f, 0x1f, 0x25, 0x29, 0x1f, 0x25, 0x29, 0x2b, 0x25, 0x29, 0x2b, 0x2f, 0x29, 0x2b, 0x2f, 0x33 }; static const uint8_t ivi5_base_quant_4x4_intra[16] = { 0x0f, 0x1f, 0x25, 0x29, 0x1f, 0x25, 0x29, 0x2f, 0x25, 0x29, 0x2f, 0x3d, 0x29, 0x2f, 0x3d, 0x49 }; static const uint8_t ivi5_scale_quant_8x8_inter[5][24] = { {0x0b, 0x11, 0x13, 0x14, 0x15, 0x16, 0x18, 0x1a, 0x1b, 0x1d, 0x20, 0x22, 0x23, 0x25, 0x28, 0x2a, 0x2e, 0x32, 0x35, 0x39, 0x3d, 0x41, 0x44, 0x4a, }, {0x07, 0x14, 0x16, 0x18, 0x1b, 0x1e, 0x22, 0x25, 0x29, 0x2d, 0x31, 0x35, 0x3a, 0x3f, 0x44, 0x4a, 0x50, 0x56, 0x5c, 0x63, 0x6a, 0x71, 0x78, 0x7e, }, {0x15, 0x25, 0x28, 0x2d, 0x30, 0x34, 0x3a, 0x3d, 0x42, 0x48, 0x4c, 0x51, 0x56, 0x5b, 0x60, 0x65, 0x6b, 0x70, 0x76, 0x7c, 0x82, 0x88, 0x8f, 0x97, }, {0x13, 0x1f, 0x20, 0x22, 0x25, 0x28, 0x2b, 0x2d, 0x30, 0x33, 0x36, 0x39, 0x3c, 0x3f, 0x42, 0x45, 0x48, 0x4b, 0x4e, 0x52, 0x56, 0x5a, 0x5e, 0x62, }, {0x3c, 0x52, 0x58, 0x5d, 0x63, 0x68, 0x68, 0x6d, 0x73, 0x78, 0x7c, 0x80, 0x84, 0x89, 0x8e, 0x93, 0x98, 0x9d, 0xa3, 0xa9, 0xad, 0xb1, 0xb5, 0xba, }, }; static const uint8_t ivi5_scale_quant_8x8_intra[5][24] = { {0x0b, 0x0e, 0x10, 0x12, 0x14, 0x16, 0x17, 0x18, 0x1a, 0x1c, 0x1e, 0x20, 0x22, 0x24, 0x27, 0x28, 0x2a, 0x2d, 0x2f, 0x31, 0x34, 0x37, 0x39, 0x3c, }, {0x01, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1b, 0x1e, 0x22, 0x25, 0x28, 0x2c, 0x30, 0x34, 0x38, 0x3d, 0x42, 0x47, 0x4c, 0x52, 0x58, 0x5e, 0x65, 0x6c, }, {0x13, 0x22, 0x27, 0x2a, 0x2d, 0x33, 0x36, 0x3c, 0x41, 0x45, 0x49, 0x4e, 0x53, 0x58, 0x5d, 0x63, 0x69, 0x6f, 0x75, 0x7c, 0x82, 0x88, 0x8e, 0x95, }, {0x13, 0x1f, 0x21, 0x24, 0x27, 0x29, 0x2d, 0x2f, 0x34, 0x37, 0x3a, 0x3d, 0x40, 0x44, 0x48, 0x4c, 0x4f, 0x52, 0x56, 0x5a, 0x5e, 0x62, 0x66, 0x6b, }, {0x31, 0x42, 0x47, 0x47, 0x4d, 0x52, 0x58, 0x58, 0x5d, 0x63, 0x67, 0x6b, 0x6f, 0x73, 0x78, 0x7c, 0x80, 0x84, 0x89, 0x8e, 0x93, 0x98, 0x9d, 0xa4, } }; static const uint8_t ivi5_scale_quant_4x4_inter[24] = { 0x0b, 0x0d, 0x0d, 0x0e, 0x11, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, }; static const uint8_t ivi5_scale_quant_4x4_intra[24] = { 0x01, 0x0b, 0x0b, 0x0d, 0x0d, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20 }; #endif /* AVCODEC_INDEO5DATA_H */
123linslouis-android-video-cutter
jni/libavcodec/indeo5data.h
C
asf20
9,224
/* * The simplest mpeg encoder (well, it was the simplest!) * Copyright (c) 2000,2001 Fabrice Bellard * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> * * 4MV & hq & B-frame encoding stuff by Michael Niedermayer <michaelni@gmx.at> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * The simplest mpeg encoder (well, it was the simplest!). */ #include "libavutil/intmath.h" #include "avcodec.h" #include "dsputil.h" #include "mpegvideo.h" #include "mpegvideo_common.h" #include "h263.h" #include "mjpegenc.h" #include "msmpeg4.h" #include "faandct.h" #include "aandcttab.h" #include "flv.h" #include "mpeg4video.h" #include "internal.h" #include <limits.h> //#undef NDEBUG //#include <assert.h> static int encode_picture(MpegEncContext *s, int picture_number); static int dct_quantize_refine(MpegEncContext *s, DCTELEM *block, int16_t *weight, DCTELEM *orig, int n, int qscale); static int sse_mb(MpegEncContext *s); /* enable all paranoid tests for rounding, overflows, etc... */ //#define PARANOID //#define DEBUG static uint8_t default_mv_penalty[MAX_FCODE+1][MAX_MV*2+1]; static uint8_t default_fcode_tab[MAX_MV*2+1]; void ff_convert_matrix(DSPContext *dsp, int (*qmat)[64], uint16_t (*qmat16)[2][64], const uint16_t *quant_matrix, int bias, int qmin, int qmax, int intra) { int qscale; int shift=0; for(qscale=qmin; qscale<=qmax; qscale++){ int i; if (dsp->fdct == ff_jpeg_fdct_islow #ifdef FAAN_POSTSCALE || dsp->fdct == ff_faandct #endif ) { for(i=0;i<64;i++) { const int j= dsp->idct_permutation[i]; /* 16 <= qscale * quant_matrix[i] <= 7905 */ /* 19952 <= ff_aanscales[i] * qscale * quant_matrix[i] <= 249205026 */ /* (1 << 36) / 19952 >= (1 << 36) / (ff_aanscales[i] * qscale * quant_matrix[i]) >= (1 << 36) / 249205026 */ /* 3444240 >= (1 << 36) / (ff_aanscales[i] * qscale * quant_matrix[i]) >= 275 */ qmat[qscale][i] = (int)((UINT64_C(1) << QMAT_SHIFT) / (qscale * quant_matrix[j])); } } else if (dsp->fdct == fdct_ifast #ifndef FAAN_POSTSCALE || dsp->fdct == ff_faandct #endif ) { for(i=0;i<64;i++) { const int j= dsp->idct_permutation[i]; /* 16 <= qscale * quant_matrix[i] <= 7905 */ /* 19952 <= ff_aanscales[i] * qscale * quant_matrix[i] <= 249205026 */ /* (1 << 36) / 19952 >= (1 << 36) / (ff_aanscales[i] * qscale * quant_matrix[i]) >= (1<<36)/249205026 */ /* 3444240 >= (1 << 36) / (ff_aanscales[i] * qscale * quant_matrix[i]) >= 275 */ qmat[qscale][i] = (int)((UINT64_C(1) << (QMAT_SHIFT + 14)) / (ff_aanscales[i] * qscale * quant_matrix[j])); } } else { for(i=0;i<64;i++) { const int j= dsp->idct_permutation[i]; /* We can safely suppose that 16 <= quant_matrix[i] <= 255 So 16 <= qscale * quant_matrix[i] <= 7905 so (1<<19) / 16 >= (1<<19) / (qscale * quant_matrix[i]) >= (1<<19) / 7905 so 32768 >= (1<<19) / (qscale * quant_matrix[i]) >= 67 */ qmat[qscale][i] = (int)((UINT64_C(1) << QMAT_SHIFT) / (qscale * quant_matrix[j])); // qmat [qscale][i] = (1 << QMAT_SHIFT_MMX) / (qscale * quant_matrix[i]); qmat16[qscale][0][i] = (1 << QMAT_SHIFT_MMX) / (qscale * quant_matrix[j]); if(qmat16[qscale][0][i]==0 || qmat16[qscale][0][i]==128*256) qmat16[qscale][0][i]=128*256-1; qmat16[qscale][1][i]= ROUNDED_DIV(bias<<(16-QUANT_BIAS_SHIFT), qmat16[qscale][0][i]); } } for(i=intra; i<64; i++){ int64_t max= 8191; if (dsp->fdct == fdct_ifast #ifndef FAAN_POSTSCALE || dsp->fdct == ff_faandct #endif ) { max = (8191LL*ff_aanscales[i]) >> 14; } while(((max * qmat[qscale][i]) >> shift) > INT_MAX){ shift++; } } } if(shift){ av_log(NULL, AV_LOG_INFO, "Warning, QMAT_SHIFT is larger than %d, overflows possible\n", QMAT_SHIFT - shift); } } static inline void update_qscale(MpegEncContext *s){ s->qscale= (s->lambda*139 + FF_LAMBDA_SCALE*64) >> (FF_LAMBDA_SHIFT + 7); s->qscale= av_clip(s->qscale, s->avctx->qmin, s->avctx->qmax); s->lambda2= (s->lambda*s->lambda + FF_LAMBDA_SCALE/2) >> FF_LAMBDA_SHIFT; } void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix){ int i; if(matrix){ put_bits(pb, 1, 1); for(i=0;i<64;i++) { put_bits(pb, 8, matrix[ ff_zigzag_direct[i] ]); } }else put_bits(pb, 1, 0); } /** * init s->current_picture.qscale_table from s->lambda_table */ void ff_init_qscale_tab(MpegEncContext *s){ int8_t * const qscale_table= s->current_picture.qscale_table; int i; for(i=0; i<s->mb_num; i++){ unsigned int lam= s->lambda_table[ s->mb_index2xy[i] ]; int qp= (lam*139 + FF_LAMBDA_SCALE*64) >> (FF_LAMBDA_SHIFT + 7); qscale_table[ s->mb_index2xy[i] ]= av_clip(qp, s->avctx->qmin, s->avctx->qmax); } } static void copy_picture_attributes(MpegEncContext *s, AVFrame *dst, AVFrame *src){ int i; dst->pict_type = src->pict_type; dst->quality = src->quality; dst->coded_picture_number = src->coded_picture_number; dst->display_picture_number = src->display_picture_number; // dst->reference = src->reference; dst->pts = src->pts; dst->interlaced_frame = src->interlaced_frame; dst->top_field_first = src->top_field_first; if(s->avctx->me_threshold){ if(!src->motion_val[0]) av_log(s->avctx, AV_LOG_ERROR, "AVFrame.motion_val not set!\n"); if(!src->mb_type) av_log(s->avctx, AV_LOG_ERROR, "AVFrame.mb_type not set!\n"); if(!src->ref_index[0]) av_log(s->avctx, AV_LOG_ERROR, "AVFrame.ref_index not set!\n"); if(src->motion_subsample_log2 != dst->motion_subsample_log2) av_log(s->avctx, AV_LOG_ERROR, "AVFrame.motion_subsample_log2 doesn't match! (%d!=%d)\n", src->motion_subsample_log2, dst->motion_subsample_log2); memcpy(dst->mb_type, src->mb_type, s->mb_stride * s->mb_height * sizeof(dst->mb_type[0])); for(i=0; i<2; i++){ int stride= ((16*s->mb_width )>>src->motion_subsample_log2) + 1; int height= ((16*s->mb_height)>>src->motion_subsample_log2); if(src->motion_val[i] && src->motion_val[i] != dst->motion_val[i]){ memcpy(dst->motion_val[i], src->motion_val[i], 2*stride*height*sizeof(int16_t)); } if(src->ref_index[i] && src->ref_index[i] != dst->ref_index[i]){ memcpy(dst->ref_index[i], src->ref_index[i], s->mb_stride*4*s->mb_height*sizeof(int8_t)); } } } } static void update_duplicate_context_after_me(MpegEncContext *dst, MpegEncContext *src){ #define COPY(a) dst->a= src->a COPY(pict_type); COPY(current_picture); COPY(f_code); COPY(b_code); COPY(qscale); COPY(lambda); COPY(lambda2); COPY(picture_in_gop_number); COPY(gop_picture_number); COPY(frame_pred_frame_dct); //FIXME don't set in encode_header COPY(progressive_frame); //FIXME don't set in encode_header COPY(partitioned_frame); //FIXME don't set in encode_header #undef COPY } /** * sets the given MpegEncContext to defaults for encoding. * the changed fields will not depend upon the prior state of the MpegEncContext. */ static void MPV_encode_defaults(MpegEncContext *s){ int i; MPV_common_defaults(s); for(i=-16; i<16; i++){ default_fcode_tab[i + MAX_MV]= 1; } s->me.mv_penalty= default_mv_penalty; s->fcode_tab= default_fcode_tab; } /* init video encoder */ av_cold int MPV_encode_init(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; int i; int chroma_h_shift, chroma_v_shift; MPV_encode_defaults(s); switch (avctx->codec_id) { case CODEC_ID_MPEG2VIDEO: if(avctx->pix_fmt != PIX_FMT_YUV420P && avctx->pix_fmt != PIX_FMT_YUV422P){ av_log(avctx, AV_LOG_ERROR, "only YUV420 and YUV422 are supported\n"); return -1; } break; case CODEC_ID_LJPEG: case CODEC_ID_MJPEG: if(avctx->pix_fmt != PIX_FMT_YUVJ420P && avctx->pix_fmt != PIX_FMT_YUVJ422P && avctx->pix_fmt != PIX_FMT_RGB32 && ((avctx->pix_fmt != PIX_FMT_YUV420P && avctx->pix_fmt != PIX_FMT_YUV422P) || avctx->strict_std_compliance>FF_COMPLIANCE_INOFFICIAL)){ av_log(avctx, AV_LOG_ERROR, "colorspace not supported in jpeg\n"); return -1; } break; default: if(avctx->pix_fmt != PIX_FMT_YUV420P){ av_log(avctx, AV_LOG_ERROR, "only YUV420 is supported\n"); return -1; } } switch (avctx->pix_fmt) { case PIX_FMT_YUVJ422P: case PIX_FMT_YUV422P: s->chroma_format = CHROMA_422; break; case PIX_FMT_YUVJ420P: case PIX_FMT_YUV420P: default: s->chroma_format = CHROMA_420; break; } s->bit_rate = avctx->bit_rate; s->width = avctx->width; s->height = avctx->height; if(avctx->gop_size > 600 && avctx->strict_std_compliance>FF_COMPLIANCE_EXPERIMENTAL){ av_log(avctx, AV_LOG_ERROR, "Warning keyframe interval too large! reducing it ...\n"); avctx->gop_size=600; } s->gop_size = avctx->gop_size; s->avctx = avctx; s->flags= avctx->flags; s->flags2= avctx->flags2; s->max_b_frames= avctx->max_b_frames; s->codec_id= avctx->codec->id; s->luma_elim_threshold = avctx->luma_elim_threshold; s->chroma_elim_threshold= avctx->chroma_elim_threshold; s->strict_std_compliance= avctx->strict_std_compliance; s->data_partitioning= avctx->flags & CODEC_FLAG_PART; s->quarter_sample= (avctx->flags & CODEC_FLAG_QPEL)!=0; s->mpeg_quant= avctx->mpeg_quant; s->rtp_mode= !!avctx->rtp_payload_size; s->intra_dc_precision= avctx->intra_dc_precision; s->user_specified_pts = AV_NOPTS_VALUE; if (s->gop_size <= 1) { s->intra_only = 1; s->gop_size = 12; } else { s->intra_only = 0; } s->me_method = avctx->me_method; /* Fixed QSCALE */ s->fixed_qscale = !!(avctx->flags & CODEC_FLAG_QSCALE); s->adaptive_quant= ( s->avctx->lumi_masking || s->avctx->dark_masking || s->avctx->temporal_cplx_masking || s->avctx->spatial_cplx_masking || s->avctx->p_masking || s->avctx->border_masking || (s->flags&CODEC_FLAG_QP_RD)) && !s->fixed_qscale; s->obmc= !!(s->flags & CODEC_FLAG_OBMC); s->loop_filter= !!(s->flags & CODEC_FLAG_LOOP_FILTER); s->alternate_scan= !!(s->flags & CODEC_FLAG_ALT_SCAN); s->intra_vlc_format= !!(s->flags2 & CODEC_FLAG2_INTRA_VLC); s->q_scale_type= !!(s->flags2 & CODEC_FLAG2_NON_LINEAR_QUANT); if(avctx->rc_max_rate && !avctx->rc_buffer_size){ av_log(avctx, AV_LOG_ERROR, "a vbv buffer size is needed, for encoding with a maximum bitrate\n"); return -1; } if(avctx->rc_min_rate && avctx->rc_max_rate != avctx->rc_min_rate){ av_log(avctx, AV_LOG_INFO, "Warning min_rate > 0 but min_rate != max_rate isn't recommended!\n"); } if(avctx->rc_min_rate && avctx->rc_min_rate > avctx->bit_rate){ av_log(avctx, AV_LOG_ERROR, "bitrate below min bitrate\n"); return -1; } if(avctx->rc_max_rate && avctx->rc_max_rate < avctx->bit_rate){ av_log(avctx, AV_LOG_INFO, "bitrate above max bitrate\n"); return -1; } if(avctx->rc_max_rate && avctx->rc_max_rate == avctx->bit_rate && avctx->rc_max_rate != avctx->rc_min_rate){ av_log(avctx, AV_LOG_INFO, "impossible bitrate constraints, this will fail\n"); } if(avctx->rc_buffer_size && avctx->bit_rate*av_q2d(avctx->time_base) > avctx->rc_buffer_size){ av_log(avctx, AV_LOG_ERROR, "VBV buffer too small for bitrate\n"); return -1; } if(avctx->bit_rate*av_q2d(avctx->time_base) > avctx->bit_rate_tolerance){ av_log(avctx, AV_LOG_ERROR, "bitrate tolerance too small for bitrate\n"); return -1; } if( s->avctx->rc_max_rate && s->avctx->rc_min_rate == s->avctx->rc_max_rate && (s->codec_id == CODEC_ID_MPEG1VIDEO || s->codec_id == CODEC_ID_MPEG2VIDEO) && 90000LL * (avctx->rc_buffer_size-1) > s->avctx->rc_max_rate*0xFFFFLL){ av_log(avctx, AV_LOG_INFO, "Warning vbv_delay will be set to 0xFFFF (=VBR) as the specified vbv buffer is too large for the given bitrate!\n"); } if((s->flags & CODEC_FLAG_4MV) && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_H263 && s->codec_id != CODEC_ID_H263P && s->codec_id != CODEC_ID_FLV1){ av_log(avctx, AV_LOG_ERROR, "4MV not supported by codec\n"); return -1; } if(s->obmc && s->avctx->mb_decision != FF_MB_DECISION_SIMPLE){ av_log(avctx, AV_LOG_ERROR, "OBMC is only supported with simple mb decision\n"); return -1; } if(s->obmc && s->codec_id != CODEC_ID_H263 && s->codec_id != CODEC_ID_H263P){ av_log(avctx, AV_LOG_ERROR, "OBMC is only supported with H263(+)\n"); return -1; } if(s->quarter_sample && s->codec_id != CODEC_ID_MPEG4){ av_log(avctx, AV_LOG_ERROR, "qpel not supported by codec\n"); return -1; } if(s->data_partitioning && s->codec_id != CODEC_ID_MPEG4){ av_log(avctx, AV_LOG_ERROR, "data partitioning not supported by codec\n"); return -1; } if(s->max_b_frames && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG1VIDEO && s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "b frames not supported by codec\n"); return -1; } if ((s->codec_id == CODEC_ID_MPEG4 || s->codec_id == CODEC_ID_H263 || s->codec_id == CODEC_ID_H263P) && (avctx->sample_aspect_ratio.num > 255 || avctx->sample_aspect_ratio.den > 255)) { av_log(avctx, AV_LOG_ERROR, "Invalid pixel aspect ratio %i/%i, limit is 255/255\n", avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den); return -1; } if((s->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME|CODEC_FLAG_ALT_SCAN)) && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "interlacing not supported by codec\n"); return -1; } if(s->mpeg_quant && s->codec_id != CODEC_ID_MPEG4){ //FIXME mpeg2 uses that too av_log(avctx, AV_LOG_ERROR, "mpeg2 style quantization not supported by codec\n"); return -1; } if((s->flags & CODEC_FLAG_CBP_RD) && !avctx->trellis){ av_log(avctx, AV_LOG_ERROR, "CBP RD needs trellis quant\n"); return -1; } if((s->flags & CODEC_FLAG_QP_RD) && s->avctx->mb_decision != FF_MB_DECISION_RD){ av_log(avctx, AV_LOG_ERROR, "QP RD needs mbd=2\n"); return -1; } if(s->avctx->scenechange_threshold < 1000000000 && (s->flags & CODEC_FLAG_CLOSED_GOP)){ av_log(avctx, AV_LOG_ERROR, "closed gop with scene change detection are not supported yet, set threshold to 1000000000\n"); return -1; } if((s->flags2 & CODEC_FLAG2_INTRA_VLC) && s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "intra vlc table not supported by codec\n"); return -1; } if(s->flags & CODEC_FLAG_LOW_DELAY){ if (s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "low delay forcing is only available for mpeg2\n"); return -1; } if (s->max_b_frames != 0){ av_log(avctx, AV_LOG_ERROR, "b frames cannot be used with low delay\n"); return -1; } } if(s->q_scale_type == 1){ if(s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "non linear quant is only available for mpeg2\n"); return -1; } if(avctx->qmax > 12){ av_log(avctx, AV_LOG_ERROR, "non linear quant only supports qmax <= 12 currently\n"); return -1; } } if(s->avctx->thread_count > 1 && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG1VIDEO && s->codec_id != CODEC_ID_MPEG2VIDEO && (s->codec_id != CODEC_ID_H263P || !(s->flags & CODEC_FLAG_H263P_SLICE_STRUCT))){ av_log(avctx, AV_LOG_ERROR, "multi threaded encoding not supported by codec\n"); return -1; } if(s->avctx->thread_count < 1){ av_log(avctx, AV_LOG_ERROR, "automatic thread number detection not supported by codec, patch welcome\n"); return -1; } if(s->avctx->thread_count > 1) s->rtp_mode= 1; if(!avctx->time_base.den || !avctx->time_base.num){ av_log(avctx, AV_LOG_ERROR, "framerate not set\n"); return -1; } i= (INT_MAX/2+128)>>8; if(avctx->me_threshold >= i){ av_log(avctx, AV_LOG_ERROR, "me_threshold too large, max is %d\n", i - 1); return -1; } if(avctx->mb_threshold >= i){ av_log(avctx, AV_LOG_ERROR, "mb_threshold too large, max is %d\n", i - 1); return -1; } if(avctx->b_frame_strategy && (avctx->flags&CODEC_FLAG_PASS2)){ av_log(avctx, AV_LOG_INFO, "notice: b_frame_strategy only affects the first pass\n"); avctx->b_frame_strategy = 0; } i= av_gcd(avctx->time_base.den, avctx->time_base.num); if(i > 1){ av_log(avctx, AV_LOG_INFO, "removing common factors from framerate\n"); avctx->time_base.den /= i; avctx->time_base.num /= i; // return -1; } if(s->mpeg_quant || s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO || s->codec_id==CODEC_ID_MJPEG){ s->intra_quant_bias= 3<<(QUANT_BIAS_SHIFT-3); //(a + x*3/8)/x s->inter_quant_bias= 0; }else{ s->intra_quant_bias=0; s->inter_quant_bias=-(1<<(QUANT_BIAS_SHIFT-2)); //(a - x/4)/x } if(avctx->intra_quant_bias != FF_DEFAULT_QUANT_BIAS) s->intra_quant_bias= avctx->intra_quant_bias; if(avctx->inter_quant_bias != FF_DEFAULT_QUANT_BIAS) s->inter_quant_bias= avctx->inter_quant_bias; avcodec_get_chroma_sub_sample(avctx->pix_fmt, &chroma_h_shift, &chroma_v_shift); if(avctx->codec_id == CODEC_ID_MPEG4 && s->avctx->time_base.den > (1<<16)-1){ av_log(avctx, AV_LOG_ERROR, "timebase not supported by mpeg 4 standard\n"); return -1; } s->time_increment_bits = av_log2(s->avctx->time_base.den - 1) + 1; switch(avctx->codec->id) { case CODEC_ID_MPEG1VIDEO: s->out_format = FMT_MPEG1; s->low_delay= !!(s->flags & CODEC_FLAG_LOW_DELAY); avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1); break; case CODEC_ID_MPEG2VIDEO: s->out_format = FMT_MPEG1; s->low_delay= !!(s->flags & CODEC_FLAG_LOW_DELAY); avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1); s->rtp_mode= 1; break; case CODEC_ID_LJPEG: case CODEC_ID_MJPEG: s->out_format = FMT_MJPEG; s->intra_only = 1; /* force intra only for jpeg */ if(avctx->codec->id == CODEC_ID_LJPEG && avctx->pix_fmt == PIX_FMT_BGRA){ s->mjpeg_vsample[0] = s->mjpeg_hsample[0] = s->mjpeg_vsample[1] = s->mjpeg_hsample[1] = s->mjpeg_vsample[2] = s->mjpeg_hsample[2] = 1; }else{ s->mjpeg_vsample[0] = 2; s->mjpeg_vsample[1] = 2>>chroma_v_shift; s->mjpeg_vsample[2] = 2>>chroma_v_shift; s->mjpeg_hsample[0] = 2; s->mjpeg_hsample[1] = 2>>chroma_h_shift; s->mjpeg_hsample[2] = 2>>chroma_h_shift; } if (!(CONFIG_MJPEG_ENCODER || CONFIG_LJPEG_ENCODER) || ff_mjpeg_encode_init(s) < 0) return -1; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_H261: if (!CONFIG_H261_ENCODER) return -1; if (ff_h261_get_picture_format(s->width, s->height) < 0) { av_log(avctx, AV_LOG_ERROR, "The specified picture size of %dx%d is not valid for the H.261 codec.\nValid sizes are 176x144, 352x288\n", s->width, s->height); return -1; } s->out_format = FMT_H261; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_H263: if (!CONFIG_H263_ENCODER) return -1; if (ff_match_2uint16(h263_format, FF_ARRAY_ELEMS(h263_format), s->width, s->height) == 7) { av_log(avctx, AV_LOG_INFO, "The specified picture size of %dx%d is not valid for the H.263 codec.\nValid sizes are 128x96, 176x144, 352x288, 704x576, and 1408x1152. Try H.263+.\n", s->width, s->height); return -1; } s->out_format = FMT_H263; s->obmc= (avctx->flags & CODEC_FLAG_OBMC) ? 1:0; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_H263P: s->out_format = FMT_H263; s->h263_plus = 1; /* Fx */ s->umvplus = (avctx->flags & CODEC_FLAG_H263P_UMV) ? 1:0; s->h263_aic= (avctx->flags & CODEC_FLAG_AC_PRED) ? 1:0; s->modified_quant= s->h263_aic; s->alt_inter_vlc= (avctx->flags & CODEC_FLAG_H263P_AIV) ? 1:0; s->obmc= (avctx->flags & CODEC_FLAG_OBMC) ? 1:0; s->loop_filter= (avctx->flags & CODEC_FLAG_LOOP_FILTER) ? 1:0; s->unrestricted_mv= s->obmc || s->loop_filter || s->umvplus; s->h263_slice_structured= (s->flags & CODEC_FLAG_H263P_SLICE_STRUCT) ? 1:0; /* /Fx */ /* These are just to be sure */ avctx->delay=0; s->low_delay=1; break; case CODEC_ID_FLV1: s->out_format = FMT_H263; s->h263_flv = 2; /* format = 1; 11-bit codes */ s->unrestricted_mv = 1; s->rtp_mode=0; /* don't allow GOB */ avctx->delay=0; s->low_delay=1; break; case CODEC_ID_RV10: s->out_format = FMT_H263; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_RV20: s->out_format = FMT_H263; avctx->delay=0; s->low_delay=1; s->modified_quant=1; s->h263_aic=1; s->h263_plus=1; s->loop_filter=1; s->unrestricted_mv= s->obmc || s->loop_filter || s->umvplus; break; case CODEC_ID_MPEG4: s->out_format = FMT_H263; s->h263_pred = 1; s->unrestricted_mv = 1; s->low_delay= s->max_b_frames ? 0 : 1; avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1); break; case CODEC_ID_MSMPEG4V1: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 1; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_MSMPEG4V2: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 2; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_MSMPEG4V3: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 3; s->flipflop_rounding=1; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_WMV1: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 4; s->flipflop_rounding=1; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_WMV2: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 5; s->flipflop_rounding=1; avctx->delay=0; s->low_delay=1; break; default: return -1; } avctx->has_b_frames= !s->low_delay; s->encoding = 1; s->progressive_frame= s->progressive_sequence= !(avctx->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME|CODEC_FLAG_ALT_SCAN)); /* init */ if (MPV_common_init(s) < 0) return -1; if(!s->dct_quantize) s->dct_quantize = dct_quantize_c; if(!s->denoise_dct) s->denoise_dct = denoise_dct_c; s->fast_dct_quantize = s->dct_quantize; if(avctx->trellis) s->dct_quantize = dct_quantize_trellis_c; if((CONFIG_H263P_ENCODER || CONFIG_RV20_ENCODER) && s->modified_quant) s->chroma_qscale_table= ff_h263_chroma_qscale_table; s->quant_precision=5; ff_set_cmp(&s->dsp, s->dsp.ildct_cmp, s->avctx->ildct_cmp); ff_set_cmp(&s->dsp, s->dsp.frame_skip_cmp, s->avctx->frame_skip_cmp); if (CONFIG_H261_ENCODER && s->out_format == FMT_H261) ff_h261_encode_init(s); if (CONFIG_H263_ENCODER && s->out_format == FMT_H263) h263_encode_init(s); if (CONFIG_MSMPEG4_ENCODER && s->msmpeg4_version) ff_msmpeg4_encode_init(s); if ((CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER) && s->out_format == FMT_MPEG1) ff_mpeg1_encode_init(s); /* init q matrix */ for(i=0;i<64;i++) { int j= s->dsp.idct_permutation[i]; if(CONFIG_MPEG4_ENCODER && s->codec_id==CODEC_ID_MPEG4 && s->mpeg_quant){ s->intra_matrix[j] = ff_mpeg4_default_intra_matrix[i]; s->inter_matrix[j] = ff_mpeg4_default_non_intra_matrix[i]; }else if(s->out_format == FMT_H263 || s->out_format == FMT_H261){ s->intra_matrix[j] = s->inter_matrix[j] = ff_mpeg1_default_non_intra_matrix[i]; }else { /* mpeg1/2 */ s->intra_matrix[j] = ff_mpeg1_default_intra_matrix[i]; s->inter_matrix[j] = ff_mpeg1_default_non_intra_matrix[i]; } if(s->avctx->intra_matrix) s->intra_matrix[j] = s->avctx->intra_matrix[i]; if(s->avctx->inter_matrix) s->inter_matrix[j] = s->avctx->inter_matrix[i]; } /* precompute matrix */ /* for mjpeg, we do include qscale in the matrix */ if (s->out_format != FMT_MJPEG) { ff_convert_matrix(&s->dsp, s->q_intra_matrix, s->q_intra_matrix16, s->intra_matrix, s->intra_quant_bias, avctx->qmin, 31, 1); ff_convert_matrix(&s->dsp, s->q_inter_matrix, s->q_inter_matrix16, s->inter_matrix, s->inter_quant_bias, avctx->qmin, 31, 0); } if(ff_rate_control_init(s) < 0) return -1; return 0; } av_cold int MPV_encode_end(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; ff_rate_control_uninit(s); MPV_common_end(s); if ((CONFIG_MJPEG_ENCODER || CONFIG_LJPEG_ENCODER) && s->out_format == FMT_MJPEG) ff_mjpeg_encode_close(s); av_freep(&avctx->extradata); return 0; } static int get_sae(uint8_t *src, int ref, int stride){ int x,y; int acc=0; for(y=0; y<16; y++){ for(x=0; x<16; x++){ acc+= FFABS(src[x+y*stride] - ref); } } return acc; } static int get_intra_count(MpegEncContext *s, uint8_t *src, uint8_t *ref, int stride){ int x, y, w, h; int acc=0; w= s->width &~15; h= s->height&~15; for(y=0; y<h; y+=16){ for(x=0; x<w; x+=16){ int offset= x + y*stride; int sad = s->dsp.sad[0](NULL, src + offset, ref + offset, stride, 16); int mean= (s->dsp.pix_sum(src + offset, stride) + 128)>>8; int sae = get_sae(src + offset, mean, stride); acc+= sae + 500 < sad; } } return acc; } static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg){ AVFrame *pic=NULL; int64_t pts; int i; const int encoding_delay= s->max_b_frames; int direct=1; if(pic_arg){ pts= pic_arg->pts; pic_arg->display_picture_number= s->input_picture_number++; if(pts != AV_NOPTS_VALUE){ if(s->user_specified_pts != AV_NOPTS_VALUE){ int64_t time= pts; int64_t last= s->user_specified_pts; if(time <= last){ av_log(s->avctx, AV_LOG_ERROR, "Error, Invalid timestamp=%"PRId64", last=%"PRId64"\n", pts, s->user_specified_pts); return -1; } } s->user_specified_pts= pts; }else{ if(s->user_specified_pts != AV_NOPTS_VALUE){ s->user_specified_pts= pts= s->user_specified_pts + 1; av_log(s->avctx, AV_LOG_INFO, "Warning: AVFrame.pts=? trying to guess (%"PRId64")\n", pts); }else{ pts= pic_arg->display_picture_number; } } } if(pic_arg){ if(encoding_delay && !(s->flags&CODEC_FLAG_INPUT_PRESERVED)) direct=0; if(pic_arg->linesize[0] != s->linesize) direct=0; if(pic_arg->linesize[1] != s->uvlinesize) direct=0; if(pic_arg->linesize[2] != s->uvlinesize) direct=0; // av_log(AV_LOG_DEBUG, "%d %d %d %d\n",pic_arg->linesize[0], pic_arg->linesize[1], s->linesize, s->uvlinesize); if(direct){ i= ff_find_unused_picture(s, 1); pic= (AVFrame*)&s->picture[i]; pic->reference= 3; for(i=0; i<4; i++){ pic->data[i]= pic_arg->data[i]; pic->linesize[i]= pic_arg->linesize[i]; } if(ff_alloc_picture(s, (Picture*)pic, 1) < 0){ return -1; } }else{ i= ff_find_unused_picture(s, 0); pic= (AVFrame*)&s->picture[i]; pic->reference= 3; if(ff_alloc_picture(s, (Picture*)pic, 0) < 0){ return -1; } if( pic->data[0] + INPLACE_OFFSET == pic_arg->data[0] && pic->data[1] + INPLACE_OFFSET == pic_arg->data[1] && pic->data[2] + INPLACE_OFFSET == pic_arg->data[2]){ // empty }else{ int h_chroma_shift, v_chroma_shift; avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift); for(i=0; i<3; i++){ int src_stride= pic_arg->linesize[i]; int dst_stride= i ? s->uvlinesize : s->linesize; int h_shift= i ? h_chroma_shift : 0; int v_shift= i ? v_chroma_shift : 0; int w= s->width >>h_shift; int h= s->height>>v_shift; uint8_t *src= pic_arg->data[i]; uint8_t *dst= pic->data[i]; if(!s->avctx->rc_buffer_size) dst +=INPLACE_OFFSET; if(src_stride==dst_stride) memcpy(dst, src, src_stride*h); else{ while(h--){ memcpy(dst, src, w); dst += dst_stride; src += src_stride; } } } } } copy_picture_attributes(s, pic, pic_arg); pic->pts= pts; //we set this here to avoid modifiying pic_arg } /* shift buffer entries */ for(i=1; i<MAX_PICTURE_COUNT /*s->encoding_delay+1*/; i++) s->input_picture[i-1]= s->input_picture[i]; s->input_picture[encoding_delay]= (Picture*)pic; return 0; } static int skip_check(MpegEncContext *s, Picture *p, Picture *ref){ int x, y, plane; int score=0; int64_t score64=0; for(plane=0; plane<3; plane++){ const int stride= p->linesize[plane]; const int bw= plane ? 1 : 2; for(y=0; y<s->mb_height*bw; y++){ for(x=0; x<s->mb_width*bw; x++){ int off= p->type == FF_BUFFER_TYPE_SHARED ? 0: 16; int v= s->dsp.frame_skip_cmp[1](s, p->data[plane] + 8*(x + y*stride)+off, ref->data[plane] + 8*(x + y*stride), stride, 8); switch(s->avctx->frame_skip_exp){ case 0: score= FFMAX(score, v); break; case 1: score+= FFABS(v);break; case 2: score+= v*v;break; case 3: score64+= FFABS(v*v*(int64_t)v);break; case 4: score64+= v*v*(int64_t)(v*v);break; } } } } if(score) score64= score; if(score64 < s->avctx->frame_skip_threshold) return 1; if(score64 < ((s->avctx->frame_skip_factor * (int64_t)s->lambda)>>8)) return 1; return 0; } static int estimate_best_b_count(MpegEncContext *s){ AVCodec *codec= avcodec_find_encoder(s->avctx->codec_id); AVCodecContext *c= avcodec_alloc_context(); AVFrame input[FF_MAX_B_FRAMES+2]; const int scale= s->avctx->brd_scale; int i, j, out_size, p_lambda, b_lambda, lambda2; int outbuf_size= s->width * s->height; //FIXME uint8_t *outbuf= av_malloc(outbuf_size); int64_t best_rd= INT64_MAX; int best_b_count= -1; assert(scale>=0 && scale <=3); // emms_c(); p_lambda= s->last_lambda_for[FF_P_TYPE]; //s->next_picture_ptr->quality; b_lambda= s->last_lambda_for[FF_B_TYPE]; //p_lambda *FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; if(!b_lambda) b_lambda= p_lambda; //FIXME we should do this somewhere else lambda2= (b_lambda*b_lambda + (1<<FF_LAMBDA_SHIFT)/2 ) >> FF_LAMBDA_SHIFT; c->width = s->width >> scale; c->height= s->height>> scale; c->flags= CODEC_FLAG_QSCALE | CODEC_FLAG_PSNR | CODEC_FLAG_INPUT_PRESERVED /*| CODEC_FLAG_EMU_EDGE*/; c->flags|= s->avctx->flags & CODEC_FLAG_QPEL; c->mb_decision= s->avctx->mb_decision; c->me_cmp= s->avctx->me_cmp; c->mb_cmp= s->avctx->mb_cmp; c->me_sub_cmp= s->avctx->me_sub_cmp; c->pix_fmt = PIX_FMT_YUV420P; c->time_base= s->avctx->time_base; c->max_b_frames= s->max_b_frames; if (avcodec_open(c, codec) < 0) return -1; for(i=0; i<s->max_b_frames+2; i++){ int ysize= c->width*c->height; int csize= (c->width/2)*(c->height/2); Picture pre_input, *pre_input_ptr= i ? s->input_picture[i-1] : s->next_picture_ptr; avcodec_get_frame_defaults(&input[i]); input[i].data[0]= av_malloc(ysize + 2*csize); input[i].data[1]= input[i].data[0] + ysize; input[i].data[2]= input[i].data[1] + csize; input[i].linesize[0]= c->width; input[i].linesize[1]= input[i].linesize[2]= c->width/2; if(pre_input_ptr && (!i || s->input_picture[i-1])) { pre_input= *pre_input_ptr; if(pre_input.type != FF_BUFFER_TYPE_SHARED && i) { pre_input.data[0]+=INPLACE_OFFSET; pre_input.data[1]+=INPLACE_OFFSET; pre_input.data[2]+=INPLACE_OFFSET; } s->dsp.shrink[scale](input[i].data[0], input[i].linesize[0], pre_input.data[0], pre_input.linesize[0], c->width, c->height); s->dsp.shrink[scale](input[i].data[1], input[i].linesize[1], pre_input.data[1], pre_input.linesize[1], c->width>>1, c->height>>1); s->dsp.shrink[scale](input[i].data[2], input[i].linesize[2], pre_input.data[2], pre_input.linesize[2], c->width>>1, c->height>>1); } } for(j=0; j<s->max_b_frames+1; j++){ int64_t rd=0; if(!s->input_picture[j]) break; c->error[0]= c->error[1]= c->error[2]= 0; input[0].pict_type= FF_I_TYPE; input[0].quality= 1 * FF_QP2LAMBDA; out_size = avcodec_encode_video(c, outbuf, outbuf_size, &input[0]); // rd += (out_size * lambda2) >> FF_LAMBDA_SHIFT; for(i=0; i<s->max_b_frames+1; i++){ int is_p= i % (j+1) == j || i==s->max_b_frames; input[i+1].pict_type= is_p ? FF_P_TYPE : FF_B_TYPE; input[i+1].quality= is_p ? p_lambda : b_lambda; out_size = avcodec_encode_video(c, outbuf, outbuf_size, &input[i+1]); rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3); } /* get the delayed frames */ while(out_size){ out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL); rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3); } rd += c->error[0] + c->error[1] + c->error[2]; if(rd < best_rd){ best_rd= rd; best_b_count= j; } } av_freep(&outbuf); avcodec_close(c); av_freep(&c); for(i=0; i<s->max_b_frames+2; i++){ av_freep(&input[i].data[0]); } return best_b_count; } static int select_input_picture(MpegEncContext *s){ int i; for(i=1; i<MAX_PICTURE_COUNT; i++) s->reordered_input_picture[i-1]= s->reordered_input_picture[i]; s->reordered_input_picture[MAX_PICTURE_COUNT-1]= NULL; /* set next picture type & ordering */ if(s->reordered_input_picture[0]==NULL && s->input_picture[0]){ if(/*s->picture_in_gop_number >= s->gop_size ||*/ s->next_picture_ptr==NULL || s->intra_only){ s->reordered_input_picture[0]= s->input_picture[0]; s->reordered_input_picture[0]->pict_type= FF_I_TYPE; s->reordered_input_picture[0]->coded_picture_number= s->coded_picture_number++; }else{ int b_frames; if(s->avctx->frame_skip_threshold || s->avctx->frame_skip_factor){ if(s->picture_in_gop_number < s->gop_size && skip_check(s, s->input_picture[0], s->next_picture_ptr)){ //FIXME check that te gop check above is +-1 correct //av_log(NULL, AV_LOG_DEBUG, "skip %p %"PRId64"\n", s->input_picture[0]->data[0], s->input_picture[0]->pts); if(s->input_picture[0]->type == FF_BUFFER_TYPE_SHARED){ for(i=0; i<4; i++) s->input_picture[0]->data[i]= NULL; s->input_picture[0]->type= 0; }else{ assert( s->input_picture[0]->type==FF_BUFFER_TYPE_USER || s->input_picture[0]->type==FF_BUFFER_TYPE_INTERNAL); s->avctx->release_buffer(s->avctx, (AVFrame*)s->input_picture[0]); } emms_c(); ff_vbv_update(s, 0); goto no_output_pic; } } if(s->flags&CODEC_FLAG_PASS2){ for(i=0; i<s->max_b_frames+1; i++){ int pict_num= s->input_picture[0]->display_picture_number + i; if(pict_num >= s->rc_context.num_entries) break; if(!s->input_picture[i]){ s->rc_context.entry[pict_num-1].new_pict_type = FF_P_TYPE; break; } s->input_picture[i]->pict_type= s->rc_context.entry[pict_num].new_pict_type; } } if(s->avctx->b_frame_strategy==0){ b_frames= s->max_b_frames; while(b_frames && !s->input_picture[b_frames]) b_frames--; }else if(s->avctx->b_frame_strategy==1){ for(i=1; i<s->max_b_frames+1; i++){ if(s->input_picture[i] && s->input_picture[i]->b_frame_score==0){ s->input_picture[i]->b_frame_score= get_intra_count(s, s->input_picture[i ]->data[0], s->input_picture[i-1]->data[0], s->linesize) + 1; } } for(i=0; i<s->max_b_frames+1; i++){ if(s->input_picture[i]==NULL || s->input_picture[i]->b_frame_score - 1 > s->mb_num/s->avctx->b_sensitivity) break; } b_frames= FFMAX(0, i-1); /* reset scores */ for(i=0; i<b_frames+1; i++){ s->input_picture[i]->b_frame_score=0; } }else if(s->avctx->b_frame_strategy==2){ b_frames= estimate_best_b_count(s); }else{ av_log(s->avctx, AV_LOG_ERROR, "illegal b frame strategy\n"); b_frames=0; } emms_c(); //static int b_count=0; //b_count+= b_frames; //av_log(s->avctx, AV_LOG_DEBUG, "b_frames: %d\n", b_count); for(i= b_frames - 1; i>=0; i--){ int type= s->input_picture[i]->pict_type; if(type && type != FF_B_TYPE) b_frames= i; } if(s->input_picture[b_frames]->pict_type == FF_B_TYPE && b_frames == s->max_b_frames){ av_log(s->avctx, AV_LOG_ERROR, "warning, too many b frames in a row\n"); } if(s->picture_in_gop_number + b_frames >= s->gop_size){ if((s->flags2 & CODEC_FLAG2_STRICT_GOP) && s->gop_size > s->picture_in_gop_number){ b_frames= s->gop_size - s->picture_in_gop_number - 1; }else{ if(s->flags & CODEC_FLAG_CLOSED_GOP) b_frames=0; s->input_picture[b_frames]->pict_type= FF_I_TYPE; } } if( (s->flags & CODEC_FLAG_CLOSED_GOP) && b_frames && s->input_picture[b_frames]->pict_type== FF_I_TYPE) b_frames--; s->reordered_input_picture[0]= s->input_picture[b_frames]; if(s->reordered_input_picture[0]->pict_type != FF_I_TYPE) s->reordered_input_picture[0]->pict_type= FF_P_TYPE; s->reordered_input_picture[0]->coded_picture_number= s->coded_picture_number++; for(i=0; i<b_frames; i++){ s->reordered_input_picture[i+1]= s->input_picture[i]; s->reordered_input_picture[i+1]->pict_type= FF_B_TYPE; s->reordered_input_picture[i+1]->coded_picture_number= s->coded_picture_number++; } } } no_output_pic: if(s->reordered_input_picture[0]){ s->reordered_input_picture[0]->reference= s->reordered_input_picture[0]->pict_type!=FF_B_TYPE ? 3 : 0; ff_copy_picture(&s->new_picture, s->reordered_input_picture[0]); if(s->reordered_input_picture[0]->type == FF_BUFFER_TYPE_SHARED || s->avctx->rc_buffer_size){ // input is a shared pix, so we can't modifiy it -> alloc a new one & ensure that the shared one is reuseable int i= ff_find_unused_picture(s, 0); Picture *pic= &s->picture[i]; pic->reference = s->reordered_input_picture[0]->reference; if(ff_alloc_picture(s, pic, 0) < 0){ return -1; } /* mark us unused / free shared pic */ if(s->reordered_input_picture[0]->type == FF_BUFFER_TYPE_INTERNAL) s->avctx->release_buffer(s->avctx, (AVFrame*)s->reordered_input_picture[0]); for(i=0; i<4; i++) s->reordered_input_picture[0]->data[i]= NULL; s->reordered_input_picture[0]->type= 0; copy_picture_attributes(s, (AVFrame*)pic, (AVFrame*)s->reordered_input_picture[0]); s->current_picture_ptr= pic; }else{ // input is not a shared pix -> reuse buffer for current_pix assert( s->reordered_input_picture[0]->type==FF_BUFFER_TYPE_USER || s->reordered_input_picture[0]->type==FF_BUFFER_TYPE_INTERNAL); s->current_picture_ptr= s->reordered_input_picture[0]; for(i=0; i<4; i++){ s->new_picture.data[i]+= INPLACE_OFFSET; } } ff_copy_picture(&s->current_picture, s->current_picture_ptr); s->picture_number= s->new_picture.display_picture_number; //printf("dpn:%d\n", s->picture_number); }else{ memset(&s->new_picture, 0, sizeof(Picture)); } return 0; } int MPV_encode_picture(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data) { MpegEncContext *s = avctx->priv_data; AVFrame *pic_arg = data; int i, stuffing_count; for(i=0; i<avctx->thread_count; i++){ int start_y= s->thread_context[i]->start_mb_y; int end_y= s->thread_context[i]-> end_mb_y; int h= s->mb_height; uint8_t *start= buf + (size_t)(((int64_t) buf_size)*start_y/h); uint8_t *end = buf + (size_t)(((int64_t) buf_size)* end_y/h); init_put_bits(&s->thread_context[i]->pb, start, end - start); } s->picture_in_gop_number++; if(load_input_picture(s, pic_arg) < 0) return -1; if(select_input_picture(s) < 0){ return -1; } /* output? */ if(s->new_picture.data[0]){ s->pict_type= s->new_picture.pict_type; //emms_c(); //printf("qs:%f %f %d\n", s->new_picture.quality, s->current_picture.quality, s->qscale); MPV_frame_start(s, avctx); vbv_retry: if (encode_picture(s, s->picture_number) < 0) return -1; avctx->header_bits = s->header_bits; avctx->mv_bits = s->mv_bits; avctx->misc_bits = s->misc_bits; avctx->i_tex_bits = s->i_tex_bits; avctx->p_tex_bits = s->p_tex_bits; avctx->i_count = s->i_count; avctx->p_count = s->mb_num - s->i_count - s->skip_count; //FIXME f/b_count in avctx avctx->skip_count = s->skip_count; MPV_frame_end(s); if (CONFIG_MJPEG_ENCODER && s->out_format == FMT_MJPEG) ff_mjpeg_encode_picture_trailer(s); if(avctx->rc_buffer_size){ RateControlContext *rcc= &s->rc_context; int max_size= rcc->buffer_index * avctx->rc_max_available_vbv_use; if(put_bits_count(&s->pb) > max_size && s->lambda < s->avctx->lmax){ s->next_lambda= FFMAX(s->lambda+1, s->lambda*(s->qscale+1) / s->qscale); if(s->adaptive_quant){ int i; for(i=0; i<s->mb_height*s->mb_stride; i++) s->lambda_table[i]= FFMAX(s->lambda_table[i]+1, s->lambda_table[i]*(s->qscale+1) / s->qscale); } s->mb_skipped = 0; //done in MPV_frame_start() if(s->pict_type==FF_P_TYPE){ //done in encode_picture() so we must undo it if(s->flipflop_rounding || s->codec_id == CODEC_ID_H263P || s->codec_id == CODEC_ID_MPEG4) s->no_rounding ^= 1; } if(s->pict_type!=FF_B_TYPE){ s->time_base= s->last_time_base; s->last_non_b_time= s->time - s->pp_time; } // av_log(NULL, AV_LOG_ERROR, "R:%d ", s->next_lambda); for(i=0; i<avctx->thread_count; i++){ PutBitContext *pb= &s->thread_context[i]->pb; init_put_bits(pb, pb->buf, pb->buf_end - pb->buf); } goto vbv_retry; } assert(s->avctx->rc_max_rate); } if(s->flags&CODEC_FLAG_PASS1) ff_write_pass1_stats(s); for(i=0; i<4; i++){ s->current_picture_ptr->error[i]= s->current_picture.error[i]; avctx->error[i] += s->current_picture_ptr->error[i]; } if(s->flags&CODEC_FLAG_PASS1) assert(avctx->header_bits + avctx->mv_bits + avctx->misc_bits + avctx->i_tex_bits + avctx->p_tex_bits == put_bits_count(&s->pb)); flush_put_bits(&s->pb); s->frame_bits = put_bits_count(&s->pb); stuffing_count= ff_vbv_update(s, s->frame_bits); if(stuffing_count){ if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < stuffing_count + 50){ av_log(s->avctx, AV_LOG_ERROR, "stuffing too large\n"); return -1; } switch(s->codec_id){ case CODEC_ID_MPEG1VIDEO: case CODEC_ID_MPEG2VIDEO: while(stuffing_count--){ put_bits(&s->pb, 8, 0); } break; case CODEC_ID_MPEG4: put_bits(&s->pb, 16, 0); put_bits(&s->pb, 16, 0x1C3); stuffing_count -= 4; while(stuffing_count--){ put_bits(&s->pb, 8, 0xFF); } break; default: av_log(s->avctx, AV_LOG_ERROR, "vbv buffer overflow\n"); } flush_put_bits(&s->pb); s->frame_bits = put_bits_count(&s->pb); } /* update mpeg1/2 vbv_delay for CBR */ if(s->avctx->rc_max_rate && s->avctx->rc_min_rate == s->avctx->rc_max_rate && s->out_format == FMT_MPEG1 && 90000LL * (avctx->rc_buffer_size-1) <= s->avctx->rc_max_rate*0xFFFFLL){ int vbv_delay, min_delay; double inbits = s->avctx->rc_max_rate*av_q2d(s->avctx->time_base); int minbits= s->frame_bits - 8*(s->vbv_delay_ptr - s->pb.buf - 1); double bits = s->rc_context.buffer_index + minbits - inbits; if(bits<0) av_log(s->avctx, AV_LOG_ERROR, "Internal error, negative bits\n"); assert(s->repeat_first_field==0); vbv_delay= bits * 90000 / s->avctx->rc_max_rate; min_delay= (minbits * 90000LL + s->avctx->rc_max_rate - 1)/ s->avctx->rc_max_rate; vbv_delay= FFMAX(vbv_delay, min_delay); assert(vbv_delay < 0xFFFF); s->vbv_delay_ptr[0] &= 0xF8; s->vbv_delay_ptr[0] |= vbv_delay>>13; s->vbv_delay_ptr[1] = vbv_delay>>5; s->vbv_delay_ptr[2] &= 0x07; s->vbv_delay_ptr[2] |= vbv_delay<<3; } s->total_bits += s->frame_bits; avctx->frame_bits = s->frame_bits; }else{ assert((put_bits_ptr(&s->pb) == s->pb.buf)); s->frame_bits=0; } assert((s->frame_bits&7)==0); return s->frame_bits/8; } static inline void dct_single_coeff_elimination(MpegEncContext *s, int n, int threshold) { static const char tab[64]= {3,2,2,1,1,1,1,1, 1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0}; int score=0; int run=0; int i; DCTELEM *block= s->block[n]; const int last_index= s->block_last_index[n]; int skip_dc; if(threshold<0){ skip_dc=0; threshold= -threshold; }else skip_dc=1; /* Are all we could set to zero already zero? */ if(last_index<=skip_dc - 1) return; for(i=0; i<=last_index; i++){ const int j = s->intra_scantable.permutated[i]; const int level = FFABS(block[j]); if(level==1){ if(skip_dc && i==0) continue; score+= tab[run]; run=0; }else if(level>1){ return; }else{ run++; } } if(score >= threshold) return; for(i=skip_dc; i<=last_index; i++){ const int j = s->intra_scantable.permutated[i]; block[j]=0; } if(block[0]) s->block_last_index[n]= 0; else s->block_last_index[n]= -1; } static inline void clip_coeffs(MpegEncContext *s, DCTELEM *block, int last_index) { int i; const int maxlevel= s->max_qcoeff; const int minlevel= s->min_qcoeff; int overflow=0; if(s->mb_intra){ i=1; //skip clipping of intra dc }else i=0; for(;i<=last_index; i++){ const int j= s->intra_scantable.permutated[i]; int level = block[j]; if (level>maxlevel){ level=maxlevel; overflow++; }else if(level<minlevel){ level=minlevel; overflow++; } block[j]= level; } if(overflow && s->avctx->mb_decision == FF_MB_DECISION_SIMPLE) av_log(s->avctx, AV_LOG_INFO, "warning, clipping %d dct coefficients to %d..%d\n", overflow, minlevel, maxlevel); } static void get_visual_weight(int16_t *weight, uint8_t *ptr, int stride){ int x, y; //FIXME optimize for(y=0; y<8; y++){ for(x=0; x<8; x++){ int x2, y2; int sum=0; int sqr=0; int count=0; for(y2= FFMAX(y-1, 0); y2 < FFMIN(8, y+2); y2++){ for(x2= FFMAX(x-1, 0); x2 < FFMIN(8, x+2); x2++){ int v= ptr[x2 + y2*stride]; sum += v; sqr += v*v; count++; } } weight[x + 8*y]= (36*ff_sqrt(count*sqr - sum*sum)) / count; } } } static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, int motion_y, int mb_block_height, int mb_block_count) { int16_t weight[8][64]; DCTELEM orig[8][64]; const int mb_x= s->mb_x; const int mb_y= s->mb_y; int i; int skip_dct[8]; int dct_offset = s->linesize*8; //default for progressive frames uint8_t *ptr_y, *ptr_cb, *ptr_cr; int wrap_y, wrap_c; for(i=0; i<mb_block_count; i++) skip_dct[i]=s->skipdct; if(s->adaptive_quant){ const int last_qp= s->qscale; const int mb_xy= mb_x + mb_y*s->mb_stride; s->lambda= s->lambda_table[mb_xy]; update_qscale(s); if(!(s->flags&CODEC_FLAG_QP_RD)){ s->qscale= s->current_picture_ptr->qscale_table[mb_xy]; s->dquant= s->qscale - last_qp; if(s->out_format==FMT_H263){ s->dquant= av_clip(s->dquant, -2, 2); if(s->codec_id==CODEC_ID_MPEG4){ if(!s->mb_intra){ if(s->pict_type == FF_B_TYPE){ if(s->dquant&1 || s->mv_dir&MV_DIRECT) s->dquant= 0; } if(s->mv_type==MV_TYPE_8X8) s->dquant=0; } } } } ff_set_qscale(s, last_qp + s->dquant); }else if(s->flags&CODEC_FLAG_QP_RD) ff_set_qscale(s, s->qscale + s->dquant); wrap_y = s->linesize; wrap_c = s->uvlinesize; ptr_y = s->new_picture.data[0] + (mb_y * 16 * wrap_y) + mb_x * 16; ptr_cb = s->new_picture.data[1] + (mb_y * mb_block_height * wrap_c) + mb_x * 8; ptr_cr = s->new_picture.data[2] + (mb_y * mb_block_height * wrap_c) + mb_x * 8; if(mb_x*16+16 > s->width || mb_y*16+16 > s->height){ uint8_t *ebuf= s->edge_emu_buffer + 32; ff_emulated_edge_mc(ebuf , ptr_y , wrap_y,16,16,mb_x*16,mb_y*16, s->width , s->height); ptr_y= ebuf; ff_emulated_edge_mc(ebuf+18*wrap_y , ptr_cb, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1); ptr_cb= ebuf+18*wrap_y; ff_emulated_edge_mc(ebuf+18*wrap_y+8, ptr_cr, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1); ptr_cr= ebuf+18*wrap_y+8; } if (s->mb_intra) { if(s->flags&CODEC_FLAG_INTERLACED_DCT){ int progressive_score, interlaced_score; s->interlaced_dct=0; progressive_score= s->dsp.ildct_cmp[4](s, ptr_y , NULL, wrap_y, 8) +s->dsp.ildct_cmp[4](s, ptr_y + wrap_y*8, NULL, wrap_y, 8) - 400; if(progressive_score > 0){ interlaced_score = s->dsp.ildct_cmp[4](s, ptr_y , NULL, wrap_y*2, 8) +s->dsp.ildct_cmp[4](s, ptr_y + wrap_y , NULL, wrap_y*2, 8); if(progressive_score > interlaced_score){ s->interlaced_dct=1; dct_offset= wrap_y; wrap_y<<=1; if (s->chroma_format == CHROMA_422) wrap_c<<=1; } } } s->dsp.get_pixels(s->block[0], ptr_y , wrap_y); s->dsp.get_pixels(s->block[1], ptr_y + 8, wrap_y); s->dsp.get_pixels(s->block[2], ptr_y + dct_offset , wrap_y); s->dsp.get_pixels(s->block[3], ptr_y + dct_offset + 8, wrap_y); if(s->flags&CODEC_FLAG_GRAY){ skip_dct[4]= 1; skip_dct[5]= 1; }else{ s->dsp.get_pixels(s->block[4], ptr_cb, wrap_c); s->dsp.get_pixels(s->block[5], ptr_cr, wrap_c); if(!s->chroma_y_shift){ /* 422 */ s->dsp.get_pixels(s->block[6], ptr_cb + (dct_offset>>1), wrap_c); s->dsp.get_pixels(s->block[7], ptr_cr + (dct_offset>>1), wrap_c); } } }else{ op_pixels_func (*op_pix)[4]; qpel_mc_func (*op_qpix)[16]; uint8_t *dest_y, *dest_cb, *dest_cr; dest_y = s->dest[0]; dest_cb = s->dest[1]; dest_cr = s->dest[2]; if ((!s->no_rounding) || s->pict_type==FF_B_TYPE){ op_pix = s->dsp.put_pixels_tab; op_qpix= s->dsp.put_qpel_pixels_tab; }else{ op_pix = s->dsp.put_no_rnd_pixels_tab; op_qpix= s->dsp.put_no_rnd_qpel_pixels_tab; } if (s->mv_dir & MV_DIR_FORWARD) { MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.data, op_pix, op_qpix); op_pix = s->dsp.avg_pixels_tab; op_qpix= s->dsp.avg_qpel_pixels_tab; } if (s->mv_dir & MV_DIR_BACKWARD) { MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.data, op_pix, op_qpix); } if(s->flags&CODEC_FLAG_INTERLACED_DCT){ int progressive_score, interlaced_score; s->interlaced_dct=0; progressive_score= s->dsp.ildct_cmp[0](s, dest_y , ptr_y , wrap_y, 8) +s->dsp.ildct_cmp[0](s, dest_y + wrap_y*8, ptr_y + wrap_y*8, wrap_y, 8) - 400; if(s->avctx->ildct_cmp == FF_CMP_VSSE) progressive_score -= 400; if(progressive_score>0){ interlaced_score = s->dsp.ildct_cmp[0](s, dest_y , ptr_y , wrap_y*2, 8) +s->dsp.ildct_cmp[0](s, dest_y + wrap_y , ptr_y + wrap_y , wrap_y*2, 8); if(progressive_score > interlaced_score){ s->interlaced_dct=1; dct_offset= wrap_y; wrap_y<<=1; if (s->chroma_format == CHROMA_422) wrap_c<<=1; } } } s->dsp.diff_pixels(s->block[0], ptr_y , dest_y , wrap_y); s->dsp.diff_pixels(s->block[1], ptr_y + 8, dest_y + 8, wrap_y); s->dsp.diff_pixels(s->block[2], ptr_y + dct_offset , dest_y + dct_offset , wrap_y); s->dsp.diff_pixels(s->block[3], ptr_y + dct_offset + 8, dest_y + dct_offset + 8, wrap_y); if(s->flags&CODEC_FLAG_GRAY){ skip_dct[4]= 1; skip_dct[5]= 1; }else{ s->dsp.diff_pixels(s->block[4], ptr_cb, dest_cb, wrap_c); s->dsp.diff_pixels(s->block[5], ptr_cr, dest_cr, wrap_c); if(!s->chroma_y_shift){ /* 422 */ s->dsp.diff_pixels(s->block[6], ptr_cb + (dct_offset>>1), dest_cb + (dct_offset>>1), wrap_c); s->dsp.diff_pixels(s->block[7], ptr_cr + (dct_offset>>1), dest_cr + (dct_offset>>1), wrap_c); } } /* pre quantization */ if(s->current_picture.mc_mb_var[s->mb_stride*mb_y+ mb_x]<2*s->qscale*s->qscale){ //FIXME optimize if(s->dsp.sad[1](NULL, ptr_y , dest_y , wrap_y, 8) < 20*s->qscale) skip_dct[0]= 1; if(s->dsp.sad[1](NULL, ptr_y + 8, dest_y + 8, wrap_y, 8) < 20*s->qscale) skip_dct[1]= 1; if(s->dsp.sad[1](NULL, ptr_y +dct_offset , dest_y +dct_offset , wrap_y, 8) < 20*s->qscale) skip_dct[2]= 1; if(s->dsp.sad[1](NULL, ptr_y +dct_offset+ 8, dest_y +dct_offset+ 8, wrap_y, 8) < 20*s->qscale) skip_dct[3]= 1; if(s->dsp.sad[1](NULL, ptr_cb , dest_cb , wrap_c, 8) < 20*s->qscale) skip_dct[4]= 1; if(s->dsp.sad[1](NULL, ptr_cr , dest_cr , wrap_c, 8) < 20*s->qscale) skip_dct[5]= 1; if(!s->chroma_y_shift){ /* 422 */ if(s->dsp.sad[1](NULL, ptr_cb +(dct_offset>>1), dest_cb +(dct_offset>>1), wrap_c, 8) < 20*s->qscale) skip_dct[6]= 1; if(s->dsp.sad[1](NULL, ptr_cr +(dct_offset>>1), dest_cr +(dct_offset>>1), wrap_c, 8) < 20*s->qscale) skip_dct[7]= 1; } } } if(s->avctx->quantizer_noise_shaping){ if(!skip_dct[0]) get_visual_weight(weight[0], ptr_y , wrap_y); if(!skip_dct[1]) get_visual_weight(weight[1], ptr_y + 8, wrap_y); if(!skip_dct[2]) get_visual_weight(weight[2], ptr_y + dct_offset , wrap_y); if(!skip_dct[3]) get_visual_weight(weight[3], ptr_y + dct_offset + 8, wrap_y); if(!skip_dct[4]) get_visual_weight(weight[4], ptr_cb , wrap_c); if(!skip_dct[5]) get_visual_weight(weight[5], ptr_cr , wrap_c); if(!s->chroma_y_shift){ /* 422 */ if(!skip_dct[6]) get_visual_weight(weight[6], ptr_cb + (dct_offset>>1), wrap_c); if(!skip_dct[7]) get_visual_weight(weight[7], ptr_cr + (dct_offset>>1), wrap_c); } memcpy(orig[0], s->block[0], sizeof(DCTELEM)*64*mb_block_count); } /* DCT & quantize */ assert(s->out_format!=FMT_MJPEG || s->qscale==8); { for(i=0;i<mb_block_count;i++) { if(!skip_dct[i]){ int overflow; s->block_last_index[i] = s->dct_quantize(s, s->block[i], i, s->qscale, &overflow); // FIXME we could decide to change to quantizer instead of clipping // JS: I don't think that would be a good idea it could lower quality instead // of improve it. Just INTRADC clipping deserves changes in quantizer if (overflow) clip_coeffs(s, s->block[i], s->block_last_index[i]); }else s->block_last_index[i]= -1; } if(s->avctx->quantizer_noise_shaping){ for(i=0;i<mb_block_count;i++) { if(!skip_dct[i]){ s->block_last_index[i] = dct_quantize_refine(s, s->block[i], weight[i], orig[i], i, s->qscale); } } } if(s->luma_elim_threshold && !s->mb_intra) for(i=0; i<4; i++) dct_single_coeff_elimination(s, i, s->luma_elim_threshold); if(s->chroma_elim_threshold && !s->mb_intra) for(i=4; i<mb_block_count; i++) dct_single_coeff_elimination(s, i, s->chroma_elim_threshold); if(s->flags & CODEC_FLAG_CBP_RD){ for(i=0;i<mb_block_count;i++) { if(s->block_last_index[i] == -1) s->coded_score[i]= INT_MAX/256; } } } if((s->flags&CODEC_FLAG_GRAY) && s->mb_intra){ s->block_last_index[4]= s->block_last_index[5]= 0; s->block[4][0]= s->block[5][0]= (1024 + s->c_dc_scale/2)/ s->c_dc_scale; } //non c quantize code returns incorrect block_last_index FIXME if(s->alternate_scan && s->dct_quantize != dct_quantize_c){ for(i=0; i<mb_block_count; i++){ int j; if(s->block_last_index[i]>0){ for(j=63; j>0; j--){ if(s->block[i][ s->intra_scantable.permutated[j] ]) break; } s->block_last_index[i]= j; } } } /* huffman encode */ switch(s->codec_id){ //FIXME funct ptr could be slightly faster case CODEC_ID_MPEG1VIDEO: case CODEC_ID_MPEG2VIDEO: if (CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER) mpeg1_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_MPEG4: if (CONFIG_MPEG4_ENCODER) mpeg4_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_MSMPEG4V2: case CODEC_ID_MSMPEG4V3: case CODEC_ID_WMV1: if (CONFIG_MSMPEG4_ENCODER) msmpeg4_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_WMV2: if (CONFIG_WMV2_ENCODER) ff_wmv2_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_H261: if (CONFIG_H261_ENCODER) ff_h261_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_H263: case CODEC_ID_H263P: case CODEC_ID_FLV1: case CODEC_ID_RV10: case CODEC_ID_RV20: if (CONFIG_H263_ENCODER) h263_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_MJPEG: if (CONFIG_MJPEG_ENCODER) ff_mjpeg_encode_mb(s, s->block); break; default: assert(0); } } static av_always_inline void encode_mb(MpegEncContext *s, int motion_x, int motion_y) { if (s->chroma_format == CHROMA_420) encode_mb_internal(s, motion_x, motion_y, 8, 6); else encode_mb_internal(s, motion_x, motion_y, 16, 8); } static inline void copy_context_before_encode(MpegEncContext *d, MpegEncContext *s, int type){ int i; memcpy(d->last_mv, s->last_mv, 2*2*2*sizeof(int)); //FIXME is memcpy faster then a loop? /* mpeg1 */ d->mb_skip_run= s->mb_skip_run; for(i=0; i<3; i++) d->last_dc[i]= s->last_dc[i]; /* statistics */ d->mv_bits= s->mv_bits; d->i_tex_bits= s->i_tex_bits; d->p_tex_bits= s->p_tex_bits; d->i_count= s->i_count; d->f_count= s->f_count; d->b_count= s->b_count; d->skip_count= s->skip_count; d->misc_bits= s->misc_bits; d->last_bits= 0; d->mb_skipped= 0; d->qscale= s->qscale; d->dquant= s->dquant; d->esc3_level_length= s->esc3_level_length; } static inline void copy_context_after_encode(MpegEncContext *d, MpegEncContext *s, int type){ int i; memcpy(d->mv, s->mv, 2*4*2*sizeof(int)); memcpy(d->last_mv, s->last_mv, 2*2*2*sizeof(int)); //FIXME is memcpy faster then a loop? /* mpeg1 */ d->mb_skip_run= s->mb_skip_run; for(i=0; i<3; i++) d->last_dc[i]= s->last_dc[i]; /* statistics */ d->mv_bits= s->mv_bits; d->i_tex_bits= s->i_tex_bits; d->p_tex_bits= s->p_tex_bits; d->i_count= s->i_count; d->f_count= s->f_count; d->b_count= s->b_count; d->skip_count= s->skip_count; d->misc_bits= s->misc_bits; d->mb_intra= s->mb_intra; d->mb_skipped= s->mb_skipped; d->mv_type= s->mv_type; d->mv_dir= s->mv_dir; d->pb= s->pb; if(s->data_partitioning){ d->pb2= s->pb2; d->tex_pb= s->tex_pb; } d->block= s->block; for(i=0; i<8; i++) d->block_last_index[i]= s->block_last_index[i]; d->interlaced_dct= s->interlaced_dct; d->qscale= s->qscale; d->esc3_level_length= s->esc3_level_length; } static inline void encode_mb_hq(MpegEncContext *s, MpegEncContext *backup, MpegEncContext *best, int type, PutBitContext pb[2], PutBitContext pb2[2], PutBitContext tex_pb[2], int *dmin, int *next_block, int motion_x, int motion_y) { int score; uint8_t *dest_backup[3]; copy_context_before_encode(s, backup, type); s->block= s->blocks[*next_block]; s->pb= pb[*next_block]; if(s->data_partitioning){ s->pb2 = pb2 [*next_block]; s->tex_pb= tex_pb[*next_block]; } if(*next_block){ memcpy(dest_backup, s->dest, sizeof(s->dest)); s->dest[0] = s->rd_scratchpad; s->dest[1] = s->rd_scratchpad + 16*s->linesize; s->dest[2] = s->rd_scratchpad + 16*s->linesize + 8; assert(s->linesize >= 32); //FIXME } encode_mb(s, motion_x, motion_y); score= put_bits_count(&s->pb); if(s->data_partitioning){ score+= put_bits_count(&s->pb2); score+= put_bits_count(&s->tex_pb); } if(s->avctx->mb_decision == FF_MB_DECISION_RD){ MPV_decode_mb(s, s->block); score *= s->lambda2; score += sse_mb(s) << FF_LAMBDA_SHIFT; } if(*next_block){ memcpy(s->dest, dest_backup, sizeof(s->dest)); } if(score<*dmin){ *dmin= score; *next_block^=1; copy_context_after_encode(best, s, type); } } static int sse(MpegEncContext *s, uint8_t *src1, uint8_t *src2, int w, int h, int stride){ uint32_t *sq = ff_squareTbl + 256; int acc=0; int x,y; if(w==16 && h==16) return s->dsp.sse[0](NULL, src1, src2, stride, 16); else if(w==8 && h==8) return s->dsp.sse[1](NULL, src1, src2, stride, 8); for(y=0; y<h; y++){ for(x=0; x<w; x++){ acc+= sq[src1[x + y*stride] - src2[x + y*stride]]; } } assert(acc>=0); return acc; } static int sse_mb(MpegEncContext *s){ int w= 16; int h= 16; if(s->mb_x*16 + 16 > s->width ) w= s->width - s->mb_x*16; if(s->mb_y*16 + 16 > s->height) h= s->height- s->mb_y*16; if(w==16 && h==16) if(s->avctx->mb_cmp == FF_CMP_NSSE){ return s->dsp.nsse[0](s, s->new_picture.data[0] + s->mb_x*16 + s->mb_y*s->linesize*16, s->dest[0], s->linesize, 16) +s->dsp.nsse[1](s, s->new_picture.data[1] + s->mb_x*8 + s->mb_y*s->uvlinesize*8,s->dest[1], s->uvlinesize, 8) +s->dsp.nsse[1](s, s->new_picture.data[2] + s->mb_x*8 + s->mb_y*s->uvlinesize*8,s->dest[2], s->uvlinesize, 8); }else{ return s->dsp.sse[0](NULL, s->new_picture.data[0] + s->mb_x*16 + s->mb_y*s->linesize*16, s->dest[0], s->linesize, 16) +s->dsp.sse[1](NULL, s->new_picture.data[1] + s->mb_x*8 + s->mb_y*s->uvlinesize*8,s->dest[1], s->uvlinesize, 8) +s->dsp.sse[1](NULL, s->new_picture.data[2] + s->mb_x*8 + s->mb_y*s->uvlinesize*8,s->dest[2], s->uvlinesize, 8); } else return sse(s, s->new_picture.data[0] + s->mb_x*16 + s->mb_y*s->linesize*16, s->dest[0], w, h, s->linesize) +sse(s, s->new_picture.data[1] + s->mb_x*8 + s->mb_y*s->uvlinesize*8,s->dest[1], w>>1, h>>1, s->uvlinesize) +sse(s, s->new_picture.data[2] + s->mb_x*8 + s->mb_y*s->uvlinesize*8,s->dest[2], w>>1, h>>1, s->uvlinesize); } static int pre_estimate_motion_thread(AVCodecContext *c, void *arg){ MpegEncContext *s= *(void**)arg; s->me.pre_pass=1; s->me.dia_size= s->avctx->pre_dia_size; s->first_slice_line=1; for(s->mb_y= s->end_mb_y-1; s->mb_y >= s->start_mb_y; s->mb_y--) { for(s->mb_x=s->mb_width-1; s->mb_x >=0 ;s->mb_x--) { ff_pre_estimate_p_frame_motion(s, s->mb_x, s->mb_y); } s->first_slice_line=0; } s->me.pre_pass=0; return 0; } static int estimate_motion_thread(AVCodecContext *c, void *arg){ MpegEncContext *s= *(void**)arg; ff_check_alignment(); s->me.dia_size= s->avctx->dia_size; s->first_slice_line=1; for(s->mb_y= s->start_mb_y; s->mb_y < s->end_mb_y; s->mb_y++) { s->mb_x=0; //for block init below ff_init_block_index(s); for(s->mb_x=0; s->mb_x < s->mb_width; s->mb_x++) { s->block_index[0]+=2; s->block_index[1]+=2; s->block_index[2]+=2; s->block_index[3]+=2; /* compute motion vector & mb_type and store in context */ if(s->pict_type==FF_B_TYPE) ff_estimate_b_frame_motion(s, s->mb_x, s->mb_y); else ff_estimate_p_frame_motion(s, s->mb_x, s->mb_y); } s->first_slice_line=0; } return 0; } static int mb_var_thread(AVCodecContext *c, void *arg){ MpegEncContext *s= *(void**)arg; int mb_x, mb_y; ff_check_alignment(); for(mb_y=s->start_mb_y; mb_y < s->end_mb_y; mb_y++) { for(mb_x=0; mb_x < s->mb_width; mb_x++) { int xx = mb_x * 16; int yy = mb_y * 16; uint8_t *pix = s->new_picture.data[0] + (yy * s->linesize) + xx; int varc; int sum = s->dsp.pix_sum(pix, s->linesize); varc = (s->dsp.pix_norm1(pix, s->linesize) - (((unsigned)(sum*sum))>>8) + 500 + 128)>>8; s->current_picture.mb_var [s->mb_stride * mb_y + mb_x] = varc; s->current_picture.mb_mean[s->mb_stride * mb_y + mb_x] = (sum+128)>>8; s->me.mb_var_sum_temp += varc; } } return 0; } static void write_slice_end(MpegEncContext *s){ if(CONFIG_MPEG4_ENCODER && s->codec_id==CODEC_ID_MPEG4){ if(s->partitioned_frame){ ff_mpeg4_merge_partitions(s); } ff_mpeg4_stuffing(&s->pb); }else if(CONFIG_MJPEG_ENCODER && s->out_format == FMT_MJPEG){ ff_mjpeg_encode_stuffing(&s->pb); } align_put_bits(&s->pb); flush_put_bits(&s->pb); if((s->flags&CODEC_FLAG_PASS1) && !s->partitioned_frame) s->misc_bits+= get_bits_diff(s); } static int encode_thread(AVCodecContext *c, void *arg){ MpegEncContext *s= *(void**)arg; int mb_x, mb_y, pdif = 0; int chr_h= 16>>s->chroma_y_shift; int i, j; MpegEncContext best_s, backup_s; uint8_t bit_buf[2][MAX_MB_BYTES]; uint8_t bit_buf2[2][MAX_MB_BYTES]; uint8_t bit_buf_tex[2][MAX_MB_BYTES]; PutBitContext pb[2], pb2[2], tex_pb[2]; //printf("%d->%d\n", s->resync_mb_y, s->end_mb_y); ff_check_alignment(); for(i=0; i<2; i++){ init_put_bits(&pb [i], bit_buf [i], MAX_MB_BYTES); init_put_bits(&pb2 [i], bit_buf2 [i], MAX_MB_BYTES); init_put_bits(&tex_pb[i], bit_buf_tex[i], MAX_MB_BYTES); } s->last_bits= put_bits_count(&s->pb); s->mv_bits=0; s->misc_bits=0; s->i_tex_bits=0; s->p_tex_bits=0; s->i_count=0; s->f_count=0; s->b_count=0; s->skip_count=0; for(i=0; i<3; i++){ /* init last dc values */ /* note: quant matrix value (8) is implied here */ s->last_dc[i] = 128 << s->intra_dc_precision; s->current_picture.error[i] = 0; } s->mb_skip_run = 0; memset(s->last_mv, 0, sizeof(s->last_mv)); s->last_mv_dir = 0; switch(s->codec_id){ case CODEC_ID_H263: case CODEC_ID_H263P: case CODEC_ID_FLV1: if (CONFIG_H263_ENCODER) s->gob_index = ff_h263_get_gob_height(s); break; case CODEC_ID_MPEG4: if(CONFIG_MPEG4_ENCODER && s->partitioned_frame) ff_mpeg4_init_partitions(s); break; } s->resync_mb_x=0; s->resync_mb_y=0; s->first_slice_line = 1; s->ptr_lastgob = s->pb.buf; for(mb_y= s->start_mb_y; mb_y < s->end_mb_y; mb_y++) { // printf("row %d at %X\n", s->mb_y, (int)s); s->mb_x=0; s->mb_y= mb_y; ff_set_qscale(s, s->qscale); ff_init_block_index(s); for(mb_x=0; mb_x < s->mb_width; mb_x++) { int xy= mb_y*s->mb_stride + mb_x; // removed const, H261 needs to adjust this int mb_type= s->mb_type[xy]; // int d; int dmin= INT_MAX; int dir; if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < MAX_MB_BYTES){ av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); return -1; } if(s->data_partitioning){ if( s->pb2 .buf_end - s->pb2 .buf - (put_bits_count(&s-> pb2)>>3) < MAX_MB_BYTES || s->tex_pb.buf_end - s->tex_pb.buf - (put_bits_count(&s->tex_pb )>>3) < MAX_MB_BYTES){ av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); return -1; } } s->mb_x = mb_x; s->mb_y = mb_y; // moved into loop, can get changed by H.261 ff_update_block_index(s); if(CONFIG_H261_ENCODER && s->codec_id == CODEC_ID_H261){ ff_h261_reorder_mb_index(s); xy= s->mb_y*s->mb_stride + s->mb_x; mb_type= s->mb_type[xy]; } /* write gob / video packet header */ if(s->rtp_mode){ int current_packet_size, is_gob_start; current_packet_size= ((put_bits_count(&s->pb)+7)>>3) - (s->ptr_lastgob - s->pb.buf); is_gob_start= s->avctx->rtp_payload_size && current_packet_size >= s->avctx->rtp_payload_size && mb_y + mb_x>0; if(s->start_mb_y == mb_y && mb_y > 0 && mb_x==0) is_gob_start=1; switch(s->codec_id){ case CODEC_ID_H263: case CODEC_ID_H263P: if(!s->h263_slice_structured) if(s->mb_x || s->mb_y%s->gob_index) is_gob_start=0; break; case CODEC_ID_MPEG2VIDEO: if(s->mb_x==0 && s->mb_y!=0) is_gob_start=1; case CODEC_ID_MPEG1VIDEO: if(s->mb_skip_run) is_gob_start=0; break; } if(is_gob_start){ if(s->start_mb_y != mb_y || mb_x!=0){ write_slice_end(s); if(CONFIG_MPEG4_ENCODER && s->codec_id==CODEC_ID_MPEG4 && s->partitioned_frame){ ff_mpeg4_init_partitions(s); } } assert((put_bits_count(&s->pb)&7) == 0); current_packet_size= put_bits_ptr(&s->pb) - s->ptr_lastgob; if(s->avctx->error_rate && s->resync_mb_x + s->resync_mb_y > 0){ int r= put_bits_count(&s->pb)/8 + s->picture_number + 16 + s->mb_x + s->mb_y; int d= 100 / s->avctx->error_rate; if(r % d == 0){ current_packet_size=0; #ifndef ALT_BITSTREAM_WRITER s->pb.buf_ptr= s->ptr_lastgob; #endif assert(put_bits_ptr(&s->pb) == s->ptr_lastgob); } } if (s->avctx->rtp_callback){ int number_mb = (mb_y - s->resync_mb_y)*s->mb_width + mb_x - s->resync_mb_x; s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, current_packet_size, number_mb); } switch(s->codec_id){ case CODEC_ID_MPEG4: if (CONFIG_MPEG4_ENCODER) { ff_mpeg4_encode_video_packet_header(s); ff_mpeg4_clean_buffers(s); } break; case CODEC_ID_MPEG1VIDEO: case CODEC_ID_MPEG2VIDEO: if (CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER) { ff_mpeg1_encode_slice_header(s); ff_mpeg1_clean_buffers(s); } break; case CODEC_ID_H263: case CODEC_ID_H263P: if (CONFIG_H263_ENCODER) h263_encode_gob_header(s, mb_y); break; } if(s->flags&CODEC_FLAG_PASS1){ int bits= put_bits_count(&s->pb); s->misc_bits+= bits - s->last_bits; s->last_bits= bits; } s->ptr_lastgob += current_packet_size; s->first_slice_line=1; s->resync_mb_x=mb_x; s->resync_mb_y=mb_y; } } if( (s->resync_mb_x == s->mb_x) && s->resync_mb_y+1 == s->mb_y){ s->first_slice_line=0; } s->mb_skipped=0; s->dquant=0; //only for QP_RD if(mb_type & (mb_type-1) || (s->flags & CODEC_FLAG_QP_RD)){ // more than 1 MB type possible or CODEC_FLAG_QP_RD int next_block=0; int pb_bits_count, pb2_bits_count, tex_pb_bits_count; copy_context_before_encode(&backup_s, s, -1); backup_s.pb= s->pb; best_s.data_partitioning= s->data_partitioning; best_s.partitioned_frame= s->partitioned_frame; if(s->data_partitioning){ backup_s.pb2= s->pb2; backup_s.tex_pb= s->tex_pb; } if(mb_type&CANDIDATE_MB_TYPE_INTER){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = s->p_mv_table[xy][0]; s->mv[0][0][1] = s->p_mv_table[xy][1]; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER, pb, pb2, tex_pb, &dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]); } if(mb_type&CANDIDATE_MB_TYPE_INTER_I){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(i=0; i<2; i++){ j= s->field_select[0][i] = s->p_field_select_table[i][xy]; s->mv[0][i][0] = s->p_field_mv_table[i][j][xy][0]; s->mv[0][i][1] = s->p_field_mv_table[i][j][xy][1]; } encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER_I, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(mb_type&CANDIDATE_MB_TYPE_SKIPPED){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = 0; s->mv[0][0][1] = 0; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_SKIPPED, pb, pb2, tex_pb, &dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]); } if(mb_type&CANDIDATE_MB_TYPE_INTER4V){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_8X8; s->mb_intra= 0; for(i=0; i<4; i++){ s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0]; s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1]; } encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER4V, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(mb_type&CANDIDATE_MB_TYPE_FORWARD){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = s->b_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_forw_mv_table[xy][1]; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_FORWARD, pb, pb2, tex_pb, &dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]); } if(mb_type&CANDIDATE_MB_TYPE_BACKWARD){ s->mv_dir = MV_DIR_BACKWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[1][0][0] = s->b_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_back_mv_table[xy][1]; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BACKWARD, pb, pb2, tex_pb, &dmin, &next_block, s->mv[1][0][0], s->mv[1][0][1]); } if(mb_type&CANDIDATE_MB_TYPE_BIDIR){ s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = s->b_bidir_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_bidir_forw_mv_table[xy][1]; s->mv[1][0][0] = s->b_bidir_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_bidir_back_mv_table[xy][1]; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BIDIR, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(mb_type&CANDIDATE_MB_TYPE_FORWARD_I){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(i=0; i<2; i++){ j= s->field_select[0][i] = s->b_field_select_table[0][i][xy]; s->mv[0][i][0] = s->b_field_mv_table[0][i][j][xy][0]; s->mv[0][i][1] = s->b_field_mv_table[0][i][j][xy][1]; } encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_FORWARD_I, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(mb_type&CANDIDATE_MB_TYPE_BACKWARD_I){ s->mv_dir = MV_DIR_BACKWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(i=0; i<2; i++){ j= s->field_select[1][i] = s->b_field_select_table[1][i][xy]; s->mv[1][i][0] = s->b_field_mv_table[1][i][j][xy][0]; s->mv[1][i][1] = s->b_field_mv_table[1][i][j][xy][1]; } encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BACKWARD_I, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(mb_type&CANDIDATE_MB_TYPE_BIDIR_I){ s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(dir=0; dir<2; dir++){ for(i=0; i<2; i++){ j= s->field_select[dir][i] = s->b_field_select_table[dir][i][xy]; s->mv[dir][i][0] = s->b_field_mv_table[dir][i][j][xy][0]; s->mv[dir][i][1] = s->b_field_mv_table[dir][i][j][xy][1]; } } encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BIDIR_I, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(mb_type&CANDIDATE_MB_TYPE_INTRA){ s->mv_dir = 0; s->mv_type = MV_TYPE_16X16; s->mb_intra= 1; s->mv[0][0][0] = 0; s->mv[0][0][1] = 0; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTRA, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); if(s->h263_pred || s->h263_aic){ if(best_s.mb_intra) s->mbintra_table[mb_x + mb_y*s->mb_stride]=1; else ff_clean_intra_table_entries(s); //old mode? } } if((s->flags & CODEC_FLAG_QP_RD) && dmin < INT_MAX){ if(best_s.mv_type==MV_TYPE_16X16){ //FIXME move 4mv after QPRD const int last_qp= backup_s.qscale; int qpi, qp, dc[6]; DCTELEM ac[6][16]; const int mvdir= (best_s.mv_dir&MV_DIR_BACKWARD) ? 1 : 0; static const int dquant_tab[4]={-1,1,-2,2}; assert(backup_s.dquant == 0); //FIXME intra s->mv_dir= best_s.mv_dir; s->mv_type = MV_TYPE_16X16; s->mb_intra= best_s.mb_intra; s->mv[0][0][0] = best_s.mv[0][0][0]; s->mv[0][0][1] = best_s.mv[0][0][1]; s->mv[1][0][0] = best_s.mv[1][0][0]; s->mv[1][0][1] = best_s.mv[1][0][1]; qpi = s->pict_type == FF_B_TYPE ? 2 : 0; for(; qpi<4; qpi++){ int dquant= dquant_tab[qpi]; qp= last_qp + dquant; if(qp < s->avctx->qmin || qp > s->avctx->qmax) continue; backup_s.dquant= dquant; if(s->mb_intra && s->dc_val[0]){ for(i=0; i<6; i++){ dc[i]= s->dc_val[0][ s->block_index[i] ]; memcpy(ac[i], s->ac_val[0][s->block_index[i]], sizeof(DCTELEM)*16); } } encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER /* wrong but unused */, pb, pb2, tex_pb, &dmin, &next_block, s->mv[mvdir][0][0], s->mv[mvdir][0][1]); if(best_s.qscale != qp){ if(s->mb_intra && s->dc_val[0]){ for(i=0; i<6; i++){ s->dc_val[0][ s->block_index[i] ]= dc[i]; memcpy(s->ac_val[0][s->block_index[i]], ac[i], sizeof(DCTELEM)*16); } } } } } } if(CONFIG_MPEG4_ENCODER && mb_type&CANDIDATE_MB_TYPE_DIRECT){ int mx= s->b_direct_mv_table[xy][0]; int my= s->b_direct_mv_table[xy][1]; backup_s.dquant = 0; s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; s->mb_intra= 0; ff_mpeg4_set_direct_mv(s, mx, my); encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_DIRECT, pb, pb2, tex_pb, &dmin, &next_block, mx, my); } if(CONFIG_MPEG4_ENCODER && mb_type&CANDIDATE_MB_TYPE_DIRECT0){ backup_s.dquant = 0; s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; s->mb_intra= 0; ff_mpeg4_set_direct_mv(s, 0, 0); encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_DIRECT, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(!best_s.mb_intra && s->flags2&CODEC_FLAG2_SKIP_RD){ int coded=0; for(i=0; i<6; i++) coded |= s->block_last_index[i]; if(coded){ int mx,my; memcpy(s->mv, best_s.mv, sizeof(s->mv)); if(CONFIG_MPEG4_ENCODER && best_s.mv_dir & MV_DIRECT){ mx=my=0; //FIXME find the one we actually used ff_mpeg4_set_direct_mv(s, mx, my); }else if(best_s.mv_dir&MV_DIR_BACKWARD){ mx= s->mv[1][0][0]; my= s->mv[1][0][1]; }else{ mx= s->mv[0][0][0]; my= s->mv[0][0][1]; } s->mv_dir= best_s.mv_dir; s->mv_type = best_s.mv_type; s->mb_intra= 0; /* s->mv[0][0][0] = best_s.mv[0][0][0]; s->mv[0][0][1] = best_s.mv[0][0][1]; s->mv[1][0][0] = best_s.mv[1][0][0]; s->mv[1][0][1] = best_s.mv[1][0][1];*/ backup_s.dquant= 0; s->skipdct=1; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER /* wrong but unused */, pb, pb2, tex_pb, &dmin, &next_block, mx, my); s->skipdct=0; } } s->current_picture.qscale_table[xy]= best_s.qscale; copy_context_after_encode(s, &best_s, -1); pb_bits_count= put_bits_count(&s->pb); flush_put_bits(&s->pb); ff_copy_bits(&backup_s.pb, bit_buf[next_block^1], pb_bits_count); s->pb= backup_s.pb; if(s->data_partitioning){ pb2_bits_count= put_bits_count(&s->pb2); flush_put_bits(&s->pb2); ff_copy_bits(&backup_s.pb2, bit_buf2[next_block^1], pb2_bits_count); s->pb2= backup_s.pb2; tex_pb_bits_count= put_bits_count(&s->tex_pb); flush_put_bits(&s->tex_pb); ff_copy_bits(&backup_s.tex_pb, bit_buf_tex[next_block^1], tex_pb_bits_count); s->tex_pb= backup_s.tex_pb; } s->last_bits= put_bits_count(&s->pb); if (CONFIG_H263_ENCODER && s->out_format == FMT_H263 && s->pict_type!=FF_B_TYPE) ff_h263_update_motion_val(s); if(next_block==0){ //FIXME 16 vs linesize16 s->dsp.put_pixels_tab[0][0](s->dest[0], s->rd_scratchpad , s->linesize ,16); s->dsp.put_pixels_tab[1][0](s->dest[1], s->rd_scratchpad + 16*s->linesize , s->uvlinesize, 8); s->dsp.put_pixels_tab[1][0](s->dest[2], s->rd_scratchpad + 16*s->linesize + 8, s->uvlinesize, 8); } if(s->avctx->mb_decision == FF_MB_DECISION_BITS) MPV_decode_mb(s, s->block); } else { int motion_x = 0, motion_y = 0; s->mv_type=MV_TYPE_16X16; // only one MB-Type possible switch(mb_type){ case CANDIDATE_MB_TYPE_INTRA: s->mv_dir = 0; s->mb_intra= 1; motion_x= s->mv[0][0][0] = 0; motion_y= s->mv[0][0][1] = 0; break; case CANDIDATE_MB_TYPE_INTER: s->mv_dir = MV_DIR_FORWARD; s->mb_intra= 0; motion_x= s->mv[0][0][0] = s->p_mv_table[xy][0]; motion_y= s->mv[0][0][1] = s->p_mv_table[xy][1]; break; case CANDIDATE_MB_TYPE_INTER_I: s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(i=0; i<2; i++){ j= s->field_select[0][i] = s->p_field_select_table[i][xy]; s->mv[0][i][0] = s->p_field_mv_table[i][j][xy][0]; s->mv[0][i][1] = s->p_field_mv_table[i][j][xy][1]; } break; case CANDIDATE_MB_TYPE_INTER4V: s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_8X8; s->mb_intra= 0; for(i=0; i<4; i++){ s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0]; s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1]; } break; case CANDIDATE_MB_TYPE_DIRECT: if (CONFIG_MPEG4_ENCODER) { s->mv_dir = MV_DIR_FORWARD|MV_DIR_BACKWARD|MV_DIRECT; s->mb_intra= 0; motion_x=s->b_direct_mv_table[xy][0]; motion_y=s->b_direct_mv_table[xy][1]; ff_mpeg4_set_direct_mv(s, motion_x, motion_y); } break; case CANDIDATE_MB_TYPE_DIRECT0: if (CONFIG_MPEG4_ENCODER) { s->mv_dir = MV_DIR_FORWARD|MV_DIR_BACKWARD|MV_DIRECT; s->mb_intra= 0; ff_mpeg4_set_direct_mv(s, 0, 0); } break; case CANDIDATE_MB_TYPE_BIDIR: s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mb_intra= 0; s->mv[0][0][0] = s->b_bidir_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_bidir_forw_mv_table[xy][1]; s->mv[1][0][0] = s->b_bidir_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_bidir_back_mv_table[xy][1]; break; case CANDIDATE_MB_TYPE_BACKWARD: s->mv_dir = MV_DIR_BACKWARD; s->mb_intra= 0; motion_x= s->mv[1][0][0] = s->b_back_mv_table[xy][0]; motion_y= s->mv[1][0][1] = s->b_back_mv_table[xy][1]; break; case CANDIDATE_MB_TYPE_FORWARD: s->mv_dir = MV_DIR_FORWARD; s->mb_intra= 0; motion_x= s->mv[0][0][0] = s->b_forw_mv_table[xy][0]; motion_y= s->mv[0][0][1] = s->b_forw_mv_table[xy][1]; // printf(" %d %d ", motion_x, motion_y); break; case CANDIDATE_MB_TYPE_FORWARD_I: s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(i=0; i<2; i++){ j= s->field_select[0][i] = s->b_field_select_table[0][i][xy]; s->mv[0][i][0] = s->b_field_mv_table[0][i][j][xy][0]; s->mv[0][i][1] = s->b_field_mv_table[0][i][j][xy][1]; } break; case CANDIDATE_MB_TYPE_BACKWARD_I: s->mv_dir = MV_DIR_BACKWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(i=0; i<2; i++){ j= s->field_select[1][i] = s->b_field_select_table[1][i][xy]; s->mv[1][i][0] = s->b_field_mv_table[1][i][j][xy][0]; s->mv[1][i][1] = s->b_field_mv_table[1][i][j][xy][1]; } break; case CANDIDATE_MB_TYPE_BIDIR_I: s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(dir=0; dir<2; dir++){ for(i=0; i<2; i++){ j= s->field_select[dir][i] = s->b_field_select_table[dir][i][xy]; s->mv[dir][i][0] = s->b_field_mv_table[dir][i][j][xy][0]; s->mv[dir][i][1] = s->b_field_mv_table[dir][i][j][xy][1]; } } break; default: av_log(s->avctx, AV_LOG_ERROR, "illegal MB type\n"); } encode_mb(s, motion_x, motion_y); // RAL: Update last macroblock type s->last_mv_dir = s->mv_dir; if (CONFIG_H263_ENCODER && s->out_format == FMT_H263 && s->pict_type!=FF_B_TYPE) ff_h263_update_motion_val(s); MPV_decode_mb(s, s->block); } /* clean the MV table in IPS frames for direct mode in B frames */ if(s->mb_intra /* && I,P,S_TYPE */){ s->p_mv_table[xy][0]=0; s->p_mv_table[xy][1]=0; } if(s->flags&CODEC_FLAG_PSNR){ int w= 16; int h= 16; if(s->mb_x*16 + 16 > s->width ) w= s->width - s->mb_x*16; if(s->mb_y*16 + 16 > s->height) h= s->height- s->mb_y*16; s->current_picture.error[0] += sse( s, s->new_picture.data[0] + s->mb_x*16 + s->mb_y*s->linesize*16, s->dest[0], w, h, s->linesize); s->current_picture.error[1] += sse( s, s->new_picture.data[1] + s->mb_x*8 + s->mb_y*s->uvlinesize*chr_h, s->dest[1], w>>1, h>>s->chroma_y_shift, s->uvlinesize); s->current_picture.error[2] += sse( s, s->new_picture.data[2] + s->mb_x*8 + s->mb_y*s->uvlinesize*chr_h, s->dest[2], w>>1, h>>s->chroma_y_shift, s->uvlinesize); } if(s->loop_filter){ if(CONFIG_H263_ENCODER && s->out_format == FMT_H263) ff_h263_loop_filter(s); } //printf("MB %d %d bits\n", s->mb_x+s->mb_y*s->mb_stride, put_bits_count(&s->pb)); } } //not beautiful here but we must write it before flushing so it has to be here if (CONFIG_MSMPEG4_ENCODER && s->msmpeg4_version && s->msmpeg4_version<4 && s->pict_type == FF_I_TYPE) msmpeg4_encode_ext_header(s); write_slice_end(s); /* Send the last GOB if RTP */ if (s->avctx->rtp_callback) { int number_mb = (mb_y - s->resync_mb_y)*s->mb_width - s->resync_mb_x; pdif = put_bits_ptr(&s->pb) - s->ptr_lastgob; /* Call the RTP callback to send the last GOB */ emms_c(); s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, pdif, number_mb); } return 0; } #define MERGE(field) dst->field += src->field; src->field=0 static void merge_context_after_me(MpegEncContext *dst, MpegEncContext *src){ MERGE(me.scene_change_score); MERGE(me.mc_mb_var_sum_temp); MERGE(me.mb_var_sum_temp); } static void merge_context_after_encode(MpegEncContext *dst, MpegEncContext *src){ int i; MERGE(dct_count[0]); //note, the other dct vars are not part of the context MERGE(dct_count[1]); MERGE(mv_bits); MERGE(i_tex_bits); MERGE(p_tex_bits); MERGE(i_count); MERGE(f_count); MERGE(b_count); MERGE(skip_count); MERGE(misc_bits); MERGE(error_count); MERGE(padding_bug_score); MERGE(current_picture.error[0]); MERGE(current_picture.error[1]); MERGE(current_picture.error[2]); if(dst->avctx->noise_reduction){ for(i=0; i<64; i++){ MERGE(dct_error_sum[0][i]); MERGE(dct_error_sum[1][i]); } } assert(put_bits_count(&src->pb) % 8 ==0); assert(put_bits_count(&dst->pb) % 8 ==0); ff_copy_bits(&dst->pb, src->pb.buf, put_bits_count(&src->pb)); flush_put_bits(&dst->pb); } static int estimate_qp(MpegEncContext *s, int dry_run){ if (s->next_lambda){ s->current_picture_ptr->quality= s->current_picture.quality = s->next_lambda; if(!dry_run) s->next_lambda= 0; } else if (!s->fixed_qscale) { s->current_picture_ptr->quality= s->current_picture.quality = ff_rate_estimate_qscale(s, dry_run); if (s->current_picture.quality < 0) return -1; } if(s->adaptive_quant){ switch(s->codec_id){ case CODEC_ID_MPEG4: if (CONFIG_MPEG4_ENCODER) ff_clean_mpeg4_qscales(s); break; case CODEC_ID_H263: case CODEC_ID_H263P: case CODEC_ID_FLV1: if (CONFIG_H263_ENCODER) ff_clean_h263_qscales(s); break; default: ff_init_qscale_tab(s); } s->lambda= s->lambda_table[0]; //FIXME broken }else s->lambda= s->current_picture.quality; //printf("%d %d\n", s->avctx->global_quality, s->current_picture.quality); update_qscale(s); return 0; } /* must be called before writing the header */ static void set_frame_distances(MpegEncContext * s){ assert(s->current_picture_ptr->pts != AV_NOPTS_VALUE); s->time= s->current_picture_ptr->pts*s->avctx->time_base.num; if(s->pict_type==FF_B_TYPE){ s->pb_time= s->pp_time - (s->last_non_b_time - s->time); assert(s->pb_time > 0 && s->pb_time < s->pp_time); }else{ s->pp_time= s->time - s->last_non_b_time; s->last_non_b_time= s->time; assert(s->picture_number==0 || s->pp_time > 0); } } static int encode_picture(MpegEncContext *s, int picture_number) { int i; int bits; s->picture_number = picture_number; /* Reset the average MB variance */ s->me.mb_var_sum_temp = s->me.mc_mb_var_sum_temp = 0; /* we need to initialize some time vars before we can encode b-frames */ // RAL: Condition added for MPEG1VIDEO if (s->codec_id == CODEC_ID_MPEG1VIDEO || s->codec_id == CODEC_ID_MPEG2VIDEO || (s->h263_pred && !s->h263_msmpeg4)) set_frame_distances(s); if(CONFIG_MPEG4_ENCODER && s->codec_id == CODEC_ID_MPEG4) ff_set_mpeg4_time(s); s->me.scene_change_score=0; // s->lambda= s->current_picture_ptr->quality; //FIXME qscale / ... stuff for ME rate distortion if(s->pict_type==FF_I_TYPE){ if(s->msmpeg4_version >= 3) s->no_rounding=1; else s->no_rounding=0; }else if(s->pict_type!=FF_B_TYPE){ if(s->flipflop_rounding || s->codec_id == CODEC_ID_H263P || s->codec_id == CODEC_ID_MPEG4) s->no_rounding ^= 1; } if(s->flags & CODEC_FLAG_PASS2){ if (estimate_qp(s,1) < 0) return -1; ff_get_2pass_fcode(s); }else if(!(s->flags & CODEC_FLAG_QSCALE)){ if(s->pict_type==FF_B_TYPE) s->lambda= s->last_lambda_for[s->pict_type]; else s->lambda= s->last_lambda_for[s->last_non_b_pict_type]; update_qscale(s); } s->mb_intra=0; //for the rate distortion & bit compare functions for(i=1; i<s->avctx->thread_count; i++){ ff_update_duplicate_context(s->thread_context[i], s); } if(ff_init_me(s)<0) return -1; /* Estimate motion for every MB */ if(s->pict_type != FF_I_TYPE){ s->lambda = (s->lambda * s->avctx->me_penalty_compensation + 128)>>8; s->lambda2= (s->lambda2* (int64_t)s->avctx->me_penalty_compensation + 128)>>8; if(s->pict_type != FF_B_TYPE && s->avctx->me_threshold==0){ if((s->avctx->pre_me && s->last_non_b_pict_type==FF_I_TYPE) || s->avctx->pre_me==2){ s->avctx->execute(s->avctx, pre_estimate_motion_thread, &s->thread_context[0], NULL, s->avctx->thread_count, sizeof(void*)); } } s->avctx->execute(s->avctx, estimate_motion_thread, &s->thread_context[0], NULL, s->avctx->thread_count, sizeof(void*)); }else /* if(s->pict_type == FF_I_TYPE) */{ /* I-Frame */ for(i=0; i<s->mb_stride*s->mb_height; i++) s->mb_type[i]= CANDIDATE_MB_TYPE_INTRA; if(!s->fixed_qscale){ /* finding spatial complexity for I-frame rate control */ s->avctx->execute(s->avctx, mb_var_thread, &s->thread_context[0], NULL, s->avctx->thread_count, sizeof(void*)); } } for(i=1; i<s->avctx->thread_count; i++){ merge_context_after_me(s, s->thread_context[i]); } s->current_picture.mc_mb_var_sum= s->current_picture_ptr->mc_mb_var_sum= s->me.mc_mb_var_sum_temp; s->current_picture. mb_var_sum= s->current_picture_ptr-> mb_var_sum= s->me. mb_var_sum_temp; emms_c(); if(s->me.scene_change_score > s->avctx->scenechange_threshold && s->pict_type == FF_P_TYPE){ s->pict_type= FF_I_TYPE; for(i=0; i<s->mb_stride*s->mb_height; i++) s->mb_type[i]= CANDIDATE_MB_TYPE_INTRA; //printf("Scene change detected, encoding as I Frame %d %d\n", s->current_picture.mb_var_sum, s->current_picture.mc_mb_var_sum); } if(!s->umvplus){ if(s->pict_type==FF_P_TYPE || s->pict_type==FF_S_TYPE) { s->f_code= ff_get_best_fcode(s, s->p_mv_table, CANDIDATE_MB_TYPE_INTER); if(s->flags & CODEC_FLAG_INTERLACED_ME){ int a,b; a= ff_get_best_fcode(s, s->p_field_mv_table[0][0], CANDIDATE_MB_TYPE_INTER_I); //FIXME field_select b= ff_get_best_fcode(s, s->p_field_mv_table[1][1], CANDIDATE_MB_TYPE_INTER_I); s->f_code= FFMAX3(s->f_code, a, b); } ff_fix_long_p_mvs(s); ff_fix_long_mvs(s, NULL, 0, s->p_mv_table, s->f_code, CANDIDATE_MB_TYPE_INTER, 0); if(s->flags & CODEC_FLAG_INTERLACED_ME){ int j; for(i=0; i<2; i++){ for(j=0; j<2; j++) ff_fix_long_mvs(s, s->p_field_select_table[i], j, s->p_field_mv_table[i][j], s->f_code, CANDIDATE_MB_TYPE_INTER_I, 0); } } } if(s->pict_type==FF_B_TYPE){ int a, b; a = ff_get_best_fcode(s, s->b_forw_mv_table, CANDIDATE_MB_TYPE_FORWARD); b = ff_get_best_fcode(s, s->b_bidir_forw_mv_table, CANDIDATE_MB_TYPE_BIDIR); s->f_code = FFMAX(a, b); a = ff_get_best_fcode(s, s->b_back_mv_table, CANDIDATE_MB_TYPE_BACKWARD); b = ff_get_best_fcode(s, s->b_bidir_back_mv_table, CANDIDATE_MB_TYPE_BIDIR); s->b_code = FFMAX(a, b); ff_fix_long_mvs(s, NULL, 0, s->b_forw_mv_table, s->f_code, CANDIDATE_MB_TYPE_FORWARD, 1); ff_fix_long_mvs(s, NULL, 0, s->b_back_mv_table, s->b_code, CANDIDATE_MB_TYPE_BACKWARD, 1); ff_fix_long_mvs(s, NULL, 0, s->b_bidir_forw_mv_table, s->f_code, CANDIDATE_MB_TYPE_BIDIR, 1); ff_fix_long_mvs(s, NULL, 0, s->b_bidir_back_mv_table, s->b_code, CANDIDATE_MB_TYPE_BIDIR, 1); if(s->flags & CODEC_FLAG_INTERLACED_ME){ int dir, j; for(dir=0; dir<2; dir++){ for(i=0; i<2; i++){ for(j=0; j<2; j++){ int type= dir ? (CANDIDATE_MB_TYPE_BACKWARD_I|CANDIDATE_MB_TYPE_BIDIR_I) : (CANDIDATE_MB_TYPE_FORWARD_I |CANDIDATE_MB_TYPE_BIDIR_I); ff_fix_long_mvs(s, s->b_field_select_table[dir][i], j, s->b_field_mv_table[dir][i][j], dir ? s->b_code : s->f_code, type, 1); } } } } } } if (estimate_qp(s, 0) < 0) return -1; if(s->qscale < 3 && s->max_qcoeff<=128 && s->pict_type==FF_I_TYPE && !(s->flags & CODEC_FLAG_QSCALE)) s->qscale= 3; //reduce clipping problems if (s->out_format == FMT_MJPEG) { /* for mjpeg, we do include qscale in the matrix */ for(i=1;i<64;i++){ int j= s->dsp.idct_permutation[i]; s->intra_matrix[j] = av_clip_uint8((ff_mpeg1_default_intra_matrix[i] * s->qscale) >> 3); } s->y_dc_scale_table= s->c_dc_scale_table= ff_mpeg2_dc_scale_table[s->intra_dc_precision]; s->intra_matrix[0] = ff_mpeg2_dc_scale_table[s->intra_dc_precision][8]; ff_convert_matrix(&s->dsp, s->q_intra_matrix, s->q_intra_matrix16, s->intra_matrix, s->intra_quant_bias, 8, 8, 1); s->qscale= 8; } //FIXME var duplication s->current_picture_ptr->key_frame= s->current_picture.key_frame= s->pict_type == FF_I_TYPE; //FIXME pic_ptr s->current_picture_ptr->pict_type= s->current_picture.pict_type= s->pict_type; if(s->current_picture.key_frame) s->picture_in_gop_number=0; s->last_bits= put_bits_count(&s->pb); switch(s->out_format) { case FMT_MJPEG: if (CONFIG_MJPEG_ENCODER) ff_mjpeg_encode_picture_header(s); break; case FMT_H261: if (CONFIG_H261_ENCODER) ff_h261_encode_picture_header(s, picture_number); break; case FMT_H263: if (CONFIG_WMV2_ENCODER && s->codec_id == CODEC_ID_WMV2) ff_wmv2_encode_picture_header(s, picture_number); else if (CONFIG_MSMPEG4_ENCODER && s->h263_msmpeg4) msmpeg4_encode_picture_header(s, picture_number); else if (CONFIG_MPEG4_ENCODER && s->h263_pred) mpeg4_encode_picture_header(s, picture_number); else if (CONFIG_RV10_ENCODER && s->codec_id == CODEC_ID_RV10) rv10_encode_picture_header(s, picture_number); else if (CONFIG_RV20_ENCODER && s->codec_id == CODEC_ID_RV20) rv20_encode_picture_header(s, picture_number); else if (CONFIG_FLV_ENCODER && s->codec_id == CODEC_ID_FLV1) ff_flv_encode_picture_header(s, picture_number); else if (CONFIG_H263_ENCODER) h263_encode_picture_header(s, picture_number); break; case FMT_MPEG1: if (CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER) mpeg1_encode_picture_header(s, picture_number); break; case FMT_H264: break; default: assert(0); } bits= put_bits_count(&s->pb); s->header_bits= bits - s->last_bits; for(i=1; i<s->avctx->thread_count; i++){ update_duplicate_context_after_me(s->thread_context[i], s); } s->avctx->execute(s->avctx, encode_thread, &s->thread_context[0], NULL, s->avctx->thread_count, sizeof(void*)); for(i=1; i<s->avctx->thread_count; i++){ merge_context_after_encode(s, s->thread_context[i]); } emms_c(); return 0; } void denoise_dct_c(MpegEncContext *s, DCTELEM *block){ const int intra= s->mb_intra; int i; s->dct_count[intra]++; for(i=0; i<64; i++){ int level= block[i]; if(level){ if(level>0){ s->dct_error_sum[intra][i] += level; level -= s->dct_offset[intra][i]; if(level<0) level=0; }else{ s->dct_error_sum[intra][i] -= level; level += s->dct_offset[intra][i]; if(level>0) level=0; } block[i]= level; } } } int dct_quantize_trellis_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow){ const int *qmat; const uint8_t *scantable= s->intra_scantable.scantable; const uint8_t *perm_scantable= s->intra_scantable.permutated; int max=0; unsigned int threshold1, threshold2; int bias=0; int run_tab[65]; int level_tab[65]; int score_tab[65]; int survivor[65]; int survivor_count; int last_run=0; int last_level=0; int last_score= 0; int last_i; int coeff[2][64]; int coeff_count[64]; int qmul, qadd, start_i, last_non_zero, i, dc; const int esc_length= s->ac_esc_length; uint8_t * length; uint8_t * last_length; const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6); s->dsp.fdct (block); if(s->dct_error_sum) s->denoise_dct(s, block); qmul= qscale*16; qadd= ((qscale-1)|1)*8; if (s->mb_intra) { int q; if (!s->h263_aic) { if (n < 4) q = s->y_dc_scale; else q = s->c_dc_scale; q = q << 3; } else{ /* For AIC we skip quant/dequant of INTRADC */ q = 1 << 3; qadd=0; } /* note: block[0] is assumed to be positive */ block[0] = (block[0] + (q >> 1)) / q; start_i = 1; last_non_zero = 0; qmat = s->q_intra_matrix[qscale]; if(s->mpeg_quant || s->out_format == FMT_MPEG1) bias= 1<<(QMAT_SHIFT-1); length = s->intra_ac_vlc_length; last_length= s->intra_ac_vlc_last_length; } else { start_i = 0; last_non_zero = -1; qmat = s->q_inter_matrix[qscale]; length = s->inter_ac_vlc_length; last_length= s->inter_ac_vlc_last_length; } last_i= start_i; threshold1= (1<<QMAT_SHIFT) - bias - 1; threshold2= (threshold1<<1); for(i=63; i>=start_i; i--) { const int j = scantable[i]; int level = block[j] * qmat[j]; if(((unsigned)(level+threshold1))>threshold2){ last_non_zero = i; break; } } for(i=start_i; i<=last_non_zero; i++) { const int j = scantable[i]; int level = block[j] * qmat[j]; // if( bias+level >= (1<<(QMAT_SHIFT - 3)) // || bias-level >= (1<<(QMAT_SHIFT - 3))){ if(((unsigned)(level+threshold1))>threshold2){ if(level>0){ level= (bias + level)>>QMAT_SHIFT; coeff[0][i]= level; coeff[1][i]= level-1; // coeff[2][k]= level-2; }else{ level= (bias - level)>>QMAT_SHIFT; coeff[0][i]= -level; coeff[1][i]= -level+1; // coeff[2][k]= -level+2; } coeff_count[i]= FFMIN(level, 2); assert(coeff_count[i]); max |=level; }else{ coeff[0][i]= (level>>31)|1; coeff_count[i]= 1; } } *overflow= s->max_qcoeff < max; //overflow might have happened if(last_non_zero < start_i){ memset(block + start_i, 0, (64-start_i)*sizeof(DCTELEM)); return last_non_zero; } score_tab[start_i]= 0; survivor[0]= start_i; survivor_count= 1; for(i=start_i; i<=last_non_zero; i++){ int level_index, j, zero_distortion; int dct_coeff= FFABS(block[ scantable[i] ]); int best_score=256*256*256*120; if ( s->dsp.fdct == fdct_ifast #ifndef FAAN_POSTSCALE || s->dsp.fdct == ff_faandct #endif ) dct_coeff= (dct_coeff*ff_inv_aanscales[ scantable[i] ]) >> 12; zero_distortion= dct_coeff*dct_coeff; for(level_index=0; level_index < coeff_count[i]; level_index++){ int distortion; int level= coeff[level_index][i]; const int alevel= FFABS(level); int unquant_coeff; assert(level); if(s->out_format == FMT_H263){ unquant_coeff= alevel*qmul + qadd; }else{ //MPEG1 j= s->dsp.idct_permutation[ scantable[i] ]; //FIXME optimize if(s->mb_intra){ unquant_coeff = (int)( alevel * qscale * s->intra_matrix[j]) >> 3; unquant_coeff = (unquant_coeff - 1) | 1; }else{ unquant_coeff = ((( alevel << 1) + 1) * qscale * ((int) s->inter_matrix[j])) >> 4; unquant_coeff = (unquant_coeff - 1) | 1; } unquant_coeff<<= 3; } distortion= (unquant_coeff - dct_coeff) * (unquant_coeff - dct_coeff) - zero_distortion; level+=64; if((level&(~127)) == 0){ for(j=survivor_count-1; j>=0; j--){ int run= i - survivor[j]; int score= distortion + length[UNI_AC_ENC_INDEX(run, level)]*lambda; score += score_tab[i-run]; if(score < best_score){ best_score= score; run_tab[i+1]= run; level_tab[i+1]= level-64; } } if(s->out_format == FMT_H263){ for(j=survivor_count-1; j>=0; j--){ int run= i - survivor[j]; int score= distortion + last_length[UNI_AC_ENC_INDEX(run, level)]*lambda; score += score_tab[i-run]; if(score < last_score){ last_score= score; last_run= run; last_level= level-64; last_i= i+1; } } } }else{ distortion += esc_length*lambda; for(j=survivor_count-1; j>=0; j--){ int run= i - survivor[j]; int score= distortion + score_tab[i-run]; if(score < best_score){ best_score= score; run_tab[i+1]= run; level_tab[i+1]= level-64; } } if(s->out_format == FMT_H263){ for(j=survivor_count-1; j>=0; j--){ int run= i - survivor[j]; int score= distortion + score_tab[i-run]; if(score < last_score){ last_score= score; last_run= run; last_level= level-64; last_i= i+1; } } } } } score_tab[i+1]= best_score; //Note: there is a vlc code in mpeg4 which is 1 bit shorter then another one with a shorter run and the same level if(last_non_zero <= 27){ for(; survivor_count; survivor_count--){ if(score_tab[ survivor[survivor_count-1] ] <= best_score) break; } }else{ for(; survivor_count; survivor_count--){ if(score_tab[ survivor[survivor_count-1] ] <= best_score + lambda) break; } } survivor[ survivor_count++ ]= i+1; } if(s->out_format != FMT_H263){ last_score= 256*256*256*120; for(i= survivor[0]; i<=last_non_zero + 1; i++){ int score= score_tab[i]; if(i) score += lambda*2; //FIXME exacter? if(score < last_score){ last_score= score; last_i= i; last_level= level_tab[i]; last_run= run_tab[i]; } } } s->coded_score[n] = last_score; dc= FFABS(block[0]); last_non_zero= last_i - 1; memset(block + start_i, 0, (64-start_i)*sizeof(DCTELEM)); if(last_non_zero < start_i) return last_non_zero; if(last_non_zero == 0 && start_i == 0){ int best_level= 0; int best_score= dc * dc; for(i=0; i<coeff_count[0]; i++){ int level= coeff[i][0]; int alevel= FFABS(level); int unquant_coeff, score, distortion; if(s->out_format == FMT_H263){ unquant_coeff= (alevel*qmul + qadd)>>3; }else{ //MPEG1 unquant_coeff = ((( alevel << 1) + 1) * qscale * ((int) s->inter_matrix[0])) >> 4; unquant_coeff = (unquant_coeff - 1) | 1; } unquant_coeff = (unquant_coeff + 4) >> 3; unquant_coeff<<= 3 + 3; distortion= (unquant_coeff - dc) * (unquant_coeff - dc); level+=64; if((level&(~127)) == 0) score= distortion + last_length[UNI_AC_ENC_INDEX(0, level)]*lambda; else score= distortion + esc_length*lambda; if(score < best_score){ best_score= score; best_level= level - 64; } } block[0]= best_level; s->coded_score[n] = best_score - dc*dc; if(best_level == 0) return -1; else return last_non_zero; } i= last_i; assert(last_level); block[ perm_scantable[last_non_zero] ]= last_level; i -= last_run + 1; for(; i>start_i; i -= run_tab[i] + 1){ block[ perm_scantable[i-1] ]= level_tab[i]; } return last_non_zero; } //#define REFINE_STATS 1 static int16_t basis[64][64]; static void build_basis(uint8_t *perm){ int i, j, x, y; emms_c(); for(i=0; i<8; i++){ for(j=0; j<8; j++){ for(y=0; y<8; y++){ for(x=0; x<8; x++){ double s= 0.25*(1<<BASIS_SHIFT); int index= 8*i + j; int perm_index= perm[index]; if(i==0) s*= sqrt(0.5); if(j==0) s*= sqrt(0.5); basis[perm_index][8*x + y]= lrintf(s * cos((M_PI/8.0)*i*(x+0.5)) * cos((M_PI/8.0)*j*(y+0.5))); } } } } } static int dct_quantize_refine(MpegEncContext *s, //FIXME breaks denoise? DCTELEM *block, int16_t *weight, DCTELEM *orig, int n, int qscale){ int16_t rem[64]; LOCAL_ALIGNED_16(DCTELEM, d1, [64]); const uint8_t *scantable= s->intra_scantable.scantable; const uint8_t *perm_scantable= s->intra_scantable.permutated; // unsigned int threshold1, threshold2; // int bias=0; int run_tab[65]; int prev_run=0; int prev_level=0; int qmul, qadd, start_i, last_non_zero, i, dc; uint8_t * length; uint8_t * last_length; int lambda; int rle_index, run, q = 1, sum; //q is only used when s->mb_intra is true #ifdef REFINE_STATS static int count=0; static int after_last=0; static int to_zero=0; static int from_zero=0; static int raise=0; static int lower=0; static int messed_sign=0; #endif if(basis[0][0] == 0) build_basis(s->dsp.idct_permutation); qmul= qscale*2; qadd= (qscale-1)|1; if (s->mb_intra) { if (!s->h263_aic) { if (n < 4) q = s->y_dc_scale; else q = s->c_dc_scale; } else{ /* For AIC we skip quant/dequant of INTRADC */ q = 1; qadd=0; } q <<= RECON_SHIFT-3; /* note: block[0] is assumed to be positive */ dc= block[0]*q; // block[0] = (block[0] + (q >> 1)) / q; start_i = 1; // if(s->mpeg_quant || s->out_format == FMT_MPEG1) // bias= 1<<(QMAT_SHIFT-1); length = s->intra_ac_vlc_length; last_length= s->intra_ac_vlc_last_length; } else { dc= 0; start_i = 0; length = s->inter_ac_vlc_length; last_length= s->inter_ac_vlc_last_length; } last_non_zero = s->block_last_index[n]; #ifdef REFINE_STATS {START_TIMER #endif dc += (1<<(RECON_SHIFT-1)); for(i=0; i<64; i++){ rem[i]= dc - (orig[i]<<RECON_SHIFT); //FIXME use orig dirrectly instead of copying to rem[] } #ifdef REFINE_STATS STOP_TIMER("memset rem[]")} #endif sum=0; for(i=0; i<64; i++){ int one= 36; int qns=4; int w; w= FFABS(weight[i]) + qns*one; w= 15 + (48*qns*one + w/2)/w; // 16 .. 63 weight[i] = w; // w=weight[i] = (63*qns + (w/2)) / w; assert(w>0); assert(w<(1<<6)); sum += w*w; } lambda= sum*(uint64_t)s->lambda2 >> (FF_LAMBDA_SHIFT - 6 + 6 + 6 + 6); #ifdef REFINE_STATS {START_TIMER #endif run=0; rle_index=0; for(i=start_i; i<=last_non_zero; i++){ int j= perm_scantable[i]; const int level= block[j]; int coeff; if(level){ if(level<0) coeff= qmul*level - qadd; else coeff= qmul*level + qadd; run_tab[rle_index++]=run; run=0; s->dsp.add_8x8basis(rem, basis[j], coeff); }else{ run++; } } #ifdef REFINE_STATS if(last_non_zero>0){ STOP_TIMER("init rem[]") } } {START_TIMER #endif for(;;){ int best_score=s->dsp.try_8x8basis(rem, weight, basis[0], 0); int best_coeff=0; int best_change=0; int run2, best_unquant_change=0, analyze_gradient; #ifdef REFINE_STATS {START_TIMER #endif analyze_gradient = last_non_zero > 2 || s->avctx->quantizer_noise_shaping >= 3; if(analyze_gradient){ #ifdef REFINE_STATS {START_TIMER #endif for(i=0; i<64; i++){ int w= weight[i]; d1[i] = (rem[i]*w*w + (1<<(RECON_SHIFT+12-1)))>>(RECON_SHIFT+12); } #ifdef REFINE_STATS STOP_TIMER("rem*w*w")} {START_TIMER #endif s->dsp.fdct(d1); #ifdef REFINE_STATS STOP_TIMER("dct")} #endif } if(start_i){ const int level= block[0]; int change, old_coeff; assert(s->mb_intra); old_coeff= q*level; for(change=-1; change<=1; change+=2){ int new_level= level + change; int score, new_coeff; new_coeff= q*new_level; if(new_coeff >= 2048 || new_coeff < 0) continue; score= s->dsp.try_8x8basis(rem, weight, basis[0], new_coeff - old_coeff); if(score<best_score){ best_score= score; best_coeff= 0; best_change= change; best_unquant_change= new_coeff - old_coeff; } } } run=0; rle_index=0; run2= run_tab[rle_index++]; prev_level=0; prev_run=0; for(i=start_i; i<64; i++){ int j= perm_scantable[i]; const int level= block[j]; int change, old_coeff; if(s->avctx->quantizer_noise_shaping < 3 && i > last_non_zero + 1) break; if(level){ if(level<0) old_coeff= qmul*level - qadd; else old_coeff= qmul*level + qadd; run2= run_tab[rle_index++]; //FIXME ! maybe after last }else{ old_coeff=0; run2--; assert(run2>=0 || i >= last_non_zero ); } for(change=-1; change<=1; change+=2){ int new_level= level + change; int score, new_coeff, unquant_change; score=0; if(s->avctx->quantizer_noise_shaping < 2 && FFABS(new_level) > FFABS(level)) continue; if(new_level){ if(new_level<0) new_coeff= qmul*new_level - qadd; else new_coeff= qmul*new_level + qadd; if(new_coeff >= 2048 || new_coeff <= -2048) continue; //FIXME check for overflow if(level){ if(level < 63 && level > -63){ if(i < last_non_zero) score += length[UNI_AC_ENC_INDEX(run, new_level+64)] - length[UNI_AC_ENC_INDEX(run, level+64)]; else score += last_length[UNI_AC_ENC_INDEX(run, new_level+64)] - last_length[UNI_AC_ENC_INDEX(run, level+64)]; } }else{ assert(FFABS(new_level)==1); if(analyze_gradient){ int g= d1[ scantable[i] ]; if(g && (g^new_level) >= 0) continue; } if(i < last_non_zero){ int next_i= i + run2 + 1; int next_level= block[ perm_scantable[next_i] ] + 64; if(next_level&(~127)) next_level= 0; if(next_i < last_non_zero) score += length[UNI_AC_ENC_INDEX(run, 65)] + length[UNI_AC_ENC_INDEX(run2, next_level)] - length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)]; else score += length[UNI_AC_ENC_INDEX(run, 65)] + last_length[UNI_AC_ENC_INDEX(run2, next_level)] - last_length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)]; }else{ score += last_length[UNI_AC_ENC_INDEX(run, 65)]; if(prev_level){ score += length[UNI_AC_ENC_INDEX(prev_run, prev_level)] - last_length[UNI_AC_ENC_INDEX(prev_run, prev_level)]; } } } }else{ new_coeff=0; assert(FFABS(level)==1); if(i < last_non_zero){ int next_i= i + run2 + 1; int next_level= block[ perm_scantable[next_i] ] + 64; if(next_level&(~127)) next_level= 0; if(next_i < last_non_zero) score += length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)] - length[UNI_AC_ENC_INDEX(run2, next_level)] - length[UNI_AC_ENC_INDEX(run, 65)]; else score += last_length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)] - last_length[UNI_AC_ENC_INDEX(run2, next_level)] - length[UNI_AC_ENC_INDEX(run, 65)]; }else{ score += -last_length[UNI_AC_ENC_INDEX(run, 65)]; if(prev_level){ score += last_length[UNI_AC_ENC_INDEX(prev_run, prev_level)] - length[UNI_AC_ENC_INDEX(prev_run, prev_level)]; } } } score *= lambda; unquant_change= new_coeff - old_coeff; assert((score < 100*lambda && score > -100*lambda) || lambda==0); score+= s->dsp.try_8x8basis(rem, weight, basis[j], unquant_change); if(score<best_score){ best_score= score; best_coeff= i; best_change= change; best_unquant_change= unquant_change; } } if(level){ prev_level= level + 64; if(prev_level&(~127)) prev_level= 0; prev_run= run; run=0; }else{ run++; } } #ifdef REFINE_STATS STOP_TIMER("iterative step")} #endif if(best_change){ int j= perm_scantable[ best_coeff ]; block[j] += best_change; if(best_coeff > last_non_zero){ last_non_zero= best_coeff; assert(block[j]); #ifdef REFINE_STATS after_last++; #endif }else{ #ifdef REFINE_STATS if(block[j]){ if(block[j] - best_change){ if(FFABS(block[j]) > FFABS(block[j] - best_change)){ raise++; }else{ lower++; } }else{ from_zero++; } }else{ to_zero++; } #endif for(; last_non_zero>=start_i; last_non_zero--){ if(block[perm_scantable[last_non_zero]]) break; } } #ifdef REFINE_STATS count++; if(256*256*256*64 % count == 0){ printf("after_last:%d to_zero:%d from_zero:%d raise:%d lower:%d sign:%d xyp:%d/%d/%d\n", after_last, to_zero, from_zero, raise, lower, messed_sign, s->mb_x, s->mb_y, s->picture_number); } #endif run=0; rle_index=0; for(i=start_i; i<=last_non_zero; i++){ int j= perm_scantable[i]; const int level= block[j]; if(level){ run_tab[rle_index++]=run; run=0; }else{ run++; } } s->dsp.add_8x8basis(rem, basis[j], best_unquant_change); }else{ break; } } #ifdef REFINE_STATS if(last_non_zero>0){ STOP_TIMER("iterative search") } } #endif return last_non_zero; } int dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow) { int i, j, level, last_non_zero, q, start_i; const int *qmat; const uint8_t *scantable= s->intra_scantable.scantable; int bias; int max=0; unsigned int threshold1, threshold2; s->dsp.fdct (block); if(s->dct_error_sum) s->denoise_dct(s, block); if (s->mb_intra) { if (!s->h263_aic) { if (n < 4) q = s->y_dc_scale; else q = s->c_dc_scale; q = q << 3; } else /* For AIC we skip quant/dequant of INTRADC */ q = 1 << 3; /* note: block[0] is assumed to be positive */ block[0] = (block[0] + (q >> 1)) / q; start_i = 1; last_non_zero = 0; qmat = s->q_intra_matrix[qscale]; bias= s->intra_quant_bias<<(QMAT_SHIFT - QUANT_BIAS_SHIFT); } else { start_i = 0; last_non_zero = -1; qmat = s->q_inter_matrix[qscale]; bias= s->inter_quant_bias<<(QMAT_SHIFT - QUANT_BIAS_SHIFT); } threshold1= (1<<QMAT_SHIFT) - bias - 1; threshold2= (threshold1<<1); for(i=63;i>=start_i;i--) { j = scantable[i]; level = block[j] * qmat[j]; if(((unsigned)(level+threshold1))>threshold2){ last_non_zero = i; break; }else{ block[j]=0; } } for(i=start_i; i<=last_non_zero; i++) { j = scantable[i]; level = block[j] * qmat[j]; // if( bias+level >= (1<<QMAT_SHIFT) // || bias-level >= (1<<QMAT_SHIFT)){ if(((unsigned)(level+threshold1))>threshold2){ if(level>0){ level= (bias + level)>>QMAT_SHIFT; block[j]= level; }else{ level= (bias - level)>>QMAT_SHIFT; block[j]= -level; } max |=level; }else{ block[j]=0; } } *overflow= s->max_qcoeff < max; //overflow might have happened /* we need this permutation so that we correct the IDCT, we only permute the !=0 elements */ if (s->dsp.idct_permutation_type != FF_NO_IDCT_PERM) ff_block_permute(block, s->dsp.idct_permutation, scantable, last_non_zero); return last_non_zero; } AVCodec h263_encoder = { "h263", AVMEDIA_TYPE_VIDEO, CODEC_ID_H263, sizeof(MpegEncContext), MPV_encode_init, MPV_encode_picture, MPV_encode_end, .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, .long_name= NULL_IF_CONFIG_SMALL("H.263 / H.263-1996"), }; AVCodec h263p_encoder = { "h263p", AVMEDIA_TYPE_VIDEO, CODEC_ID_H263P, sizeof(MpegEncContext), MPV_encode_init, MPV_encode_picture, MPV_encode_end, .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, .long_name= NULL_IF_CONFIG_SMALL("H.263+ / H.263-1998 / H.263 version 2"), }; AVCodec msmpeg4v1_encoder = { "msmpeg4v1", AVMEDIA_TYPE_VIDEO, CODEC_ID_MSMPEG4V1, sizeof(MpegEncContext), MPV_encode_init, MPV_encode_picture, MPV_encode_end, .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 1"), }; AVCodec msmpeg4v2_encoder = { "msmpeg4v2", AVMEDIA_TYPE_VIDEO, CODEC_ID_MSMPEG4V2, sizeof(MpegEncContext), MPV_encode_init, MPV_encode_picture, MPV_encode_end, .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"), }; AVCodec msmpeg4v3_encoder = { "msmpeg4", AVMEDIA_TYPE_VIDEO, CODEC_ID_MSMPEG4V3, sizeof(MpegEncContext), MPV_encode_init, MPV_encode_picture, MPV_encode_end, .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, .long_name= NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"), }; AVCodec wmv1_encoder = { "wmv1", AVMEDIA_TYPE_VIDEO, CODEC_ID_WMV1, sizeof(MpegEncContext), MPV_encode_init, MPV_encode_picture, MPV_encode_end, .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, .long_name= NULL_IF_CONFIG_SMALL("Windows Media Video 7"), };
123linslouis-android-video-cutter
jni/libavcodec/mpegvideo_enc.c
C
asf20
142,421
/* * RTJpeg decoding functions * Copyright (c) 2006 Reimar Doeffinger * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "libavutil/common.h" #include "get_bits.h" #include "dsputil.h" #include "rtjpeg.h" #define PUT_COEFF(c) \ i = scan[coeff--]; \ block[i] = (c) * quant[i]; //! aligns the bitstream to the give power of two #define ALIGN(a) \ n = (-get_bits_count(gb)) & (a - 1); \ if (n) {skip_bits(gb, n);} /** * \brief read one block from stream * \param gb contains stream data * \param block where data is written to * \param scan array containing the mapping stream address -> block position * \param quant quantization factors * \return 0 means the block is not coded, < 0 means an error occurred. * * Note: GetBitContext is used to make the code simpler, since all data is * aligned this could be done faster in a different way, e.g. as it is done * in MPlayer libmpcodecs/native/rtjpegn.c. */ static inline int get_block(GetBitContext *gb, DCTELEM *block, const uint8_t *scan, const uint32_t *quant) { int coeff, i, n; int8_t ac; uint8_t dc = get_bits(gb, 8); // block not coded if (dc == 255) return 0; // number of non-zero coefficients coeff = get_bits(gb, 6); if (get_bits_count(gb) + (coeff << 1) >= gb->size_in_bits) return -1; // normally we would only need to clear the (63 - coeff) last values, // but since we do not know where they are we just clear the whole block memset(block, 0, 64 * sizeof(DCTELEM)); // 2 bits per coefficient while (coeff) { ac = get_sbits(gb, 2); if (ac == -2) break; // continue with more bits PUT_COEFF(ac); } // 4 bits per coefficient ALIGN(4); if (get_bits_count(gb) + (coeff << 2) >= gb->size_in_bits) return -1; while (coeff) { ac = get_sbits(gb, 4); if (ac == -8) break; // continue with more bits PUT_COEFF(ac); } // 8 bits per coefficient ALIGN(8); if (get_bits_count(gb) + (coeff << 3) >= gb->size_in_bits) return -1; while (coeff) { ac = get_sbits(gb, 8); PUT_COEFF(ac); } PUT_COEFF(dc); return 1; } /** * \brief decode one rtjpeg YUV420 frame * \param c context, must be initialized via rtjpeg_decode_init * \param f AVFrame to place decoded frame into. If parts of the frame * are not coded they are left unchanged, so consider initializing it * \param buf buffer containing input data * \param buf_size length of input data in bytes * \return number of bytes consumed from the input buffer */ int rtjpeg_decode_frame_yuv420(RTJpegContext *c, AVFrame *f, const uint8_t *buf, int buf_size) { GetBitContext gb; int w = c->w / 16, h = c->h / 16; int x, y; uint8_t *y1 = f->data[0], *y2 = f->data[0] + 8 * f->linesize[0]; uint8_t *u = f->data[1], *v = f->data[2]; init_get_bits(&gb, buf, buf_size * 8); for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { DCTELEM *block = c->block; if (get_block(&gb, block, c->scan, c->lquant) > 0) c->dsp->idct_put(y1, f->linesize[0], block); y1 += 8; if (get_block(&gb, block, c->scan, c->lquant) > 0) c->dsp->idct_put(y1, f->linesize[0], block); y1 += 8; if (get_block(&gb, block, c->scan, c->lquant) > 0) c->dsp->idct_put(y2, f->linesize[0], block); y2 += 8; if (get_block(&gb, block, c->scan, c->lquant) > 0) c->dsp->idct_put(y2, f->linesize[0], block); y2 += 8; if (get_block(&gb, block, c->scan, c->cquant) > 0) c->dsp->idct_put(u, f->linesize[1], block); u += 8; if (get_block(&gb, block, c->scan, c->cquant) > 0) c->dsp->idct_put(v, f->linesize[2], block); v += 8; } y1 += 2 * 8 * (f->linesize[0] - w); y2 += 2 * 8 * (f->linesize[0] - w); u += 8 * (f->linesize[1] - w); v += 8 * (f->linesize[2] - w); } return get_bits_count(&gb) / 8; } /** * \brief initialize an RTJpegContext, may be called multiple times * \param c context to initialize * \param dsp specifies the idct to use for decoding * \param width width of image, will be rounded down to the nearest multiple * of 16 for decoding * \param height height of image, will be rounded down to the nearest multiple * of 16 for decoding * \param lquant luma quantization table to use * \param cquant chroma quantization table to use */ void rtjpeg_decode_init(RTJpegContext *c, DSPContext *dsp, int width, int height, const uint32_t *lquant, const uint32_t *cquant) { int i; c->dsp = dsp; for (i = 0; i < 64; i++) { int z = ff_zigzag_direct[i]; int p = c->dsp->idct_permutation[i]; z = ((z << 3) | (z >> 3)) & 63; // rtjpeg uses a transposed variant // permute the scan and quantization tables for the chosen idct c->scan[i] = c->dsp->idct_permutation[z]; c->lquant[p] = lquant[i]; c->cquant[p] = cquant[i]; } c->w = width; c->h = height; }
123linslouis-android-video-cutter
jni/libavcodec/rtjpeg.c
C
asf20
6,053
/* * ASUS V1/V2 codec * Copyright (c) 2003 Michael Niedermayer * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * ASUS V1/V2 codec. */ #include "avcodec.h" #include "libavutil/common.h" #include "put_bits.h" #include "dsputil.h" #include "mpeg12data.h" //#undef NDEBUG //#include <assert.h> #define VLC_BITS 6 #define ASV2_LEVEL_VLC_BITS 10 typedef struct ASV1Context{ AVCodecContext *avctx; DSPContext dsp; AVFrame picture; PutBitContext pb; GetBitContext gb; ScanTable scantable; int inv_qscale; int mb_width; int mb_height; int mb_width2; int mb_height2; DECLARE_ALIGNED(16, DCTELEM, block)[6][64]; uint16_t intra_matrix[64]; int q_intra_matrix[64]; uint8_t *bitstream_buffer; unsigned int bitstream_buffer_size; } ASV1Context; static const uint8_t scantab[64]={ 0x00,0x08,0x01,0x09,0x10,0x18,0x11,0x19, 0x02,0x0A,0x03,0x0B,0x12,0x1A,0x13,0x1B, 0x04,0x0C,0x05,0x0D,0x20,0x28,0x21,0x29, 0x06,0x0E,0x07,0x0F,0x14,0x1C,0x15,0x1D, 0x22,0x2A,0x23,0x2B,0x30,0x38,0x31,0x39, 0x16,0x1E,0x17,0x1F,0x24,0x2C,0x25,0x2D, 0x32,0x3A,0x33,0x3B,0x26,0x2E,0x27,0x2F, 0x34,0x3C,0x35,0x3D,0x36,0x3E,0x37,0x3F, }; static const uint8_t ccp_tab[17][2]={ {0x2,2}, {0x7,5}, {0xB,5}, {0x3,5}, {0xD,5}, {0x5,5}, {0x9,5}, {0x1,5}, {0xE,5}, {0x6,5}, {0xA,5}, {0x2,5}, {0xC,5}, {0x4,5}, {0x8,5}, {0x3,2}, {0xF,5}, //EOB }; static const uint8_t level_tab[7][2]={ {3,4}, {3,3}, {3,2}, {0,3}, {2,2}, {2,3}, {2,4} }; static const uint8_t dc_ccp_tab[8][2]={ {0x1,2}, {0xD,4}, {0xF,4}, {0xC,4}, {0x5,3}, {0xE,4}, {0x4,3}, {0x0,2}, }; static const uint8_t ac_ccp_tab[16][2]={ {0x00,2}, {0x3B,6}, {0x0A,4}, {0x3A,6}, {0x02,3}, {0x39,6}, {0x3C,6}, {0x38,6}, {0x03,3}, {0x3D,6}, {0x08,4}, {0x1F,5}, {0x09,4}, {0x0B,4}, {0x0D,4}, {0x0C,4}, }; static const uint8_t asv2_level_tab[63][2]={ {0x3F,10},{0x2F,10},{0x37,10},{0x27,10},{0x3B,10},{0x2B,10},{0x33,10},{0x23,10}, {0x3D,10},{0x2D,10},{0x35,10},{0x25,10},{0x39,10},{0x29,10},{0x31,10},{0x21,10}, {0x1F, 8},{0x17, 8},{0x1B, 8},{0x13, 8},{0x1D, 8},{0x15, 8},{0x19, 8},{0x11, 8}, {0x0F, 6},{0x0B, 6},{0x0D, 6},{0x09, 6}, {0x07, 4},{0x05, 4}, {0x03, 2}, {0x00, 5}, {0x02, 2}, {0x04, 4},{0x06, 4}, {0x08, 6},{0x0C, 6},{0x0A, 6},{0x0E, 6}, {0x10, 8},{0x18, 8},{0x14, 8},{0x1C, 8},{0x12, 8},{0x1A, 8},{0x16, 8},{0x1E, 8}, {0x20,10},{0x30,10},{0x28,10},{0x38,10},{0x24,10},{0x34,10},{0x2C,10},{0x3C,10}, {0x22,10},{0x32,10},{0x2A,10},{0x3A,10},{0x26,10},{0x36,10},{0x2E,10},{0x3E,10}, }; static VLC ccp_vlc; static VLC level_vlc; static VLC dc_ccp_vlc; static VLC ac_ccp_vlc; static VLC asv2_level_vlc; static av_cold void init_vlcs(ASV1Context *a){ static int done = 0; if (!done) { done = 1; INIT_VLC_STATIC(&ccp_vlc, VLC_BITS, 17, &ccp_tab[0][1], 2, 1, &ccp_tab[0][0], 2, 1, 64); INIT_VLC_STATIC(&dc_ccp_vlc, VLC_BITS, 8, &dc_ccp_tab[0][1], 2, 1, &dc_ccp_tab[0][0], 2, 1, 64); INIT_VLC_STATIC(&ac_ccp_vlc, VLC_BITS, 16, &ac_ccp_tab[0][1], 2, 1, &ac_ccp_tab[0][0], 2, 1, 64); INIT_VLC_STATIC(&level_vlc, VLC_BITS, 7, &level_tab[0][1], 2, 1, &level_tab[0][0], 2, 1, 64); INIT_VLC_STATIC(&asv2_level_vlc, ASV2_LEVEL_VLC_BITS, 63, &asv2_level_tab[0][1], 2, 1, &asv2_level_tab[0][0], 2, 1, 1024); } } //FIXME write a reversed bitstream reader to avoid the double reverse static inline int asv2_get_bits(GetBitContext *gb, int n){ return av_reverse[ get_bits(gb, n) << (8-n) ]; } static inline void asv2_put_bits(PutBitContext *pb, int n, int v){ put_bits(pb, n, av_reverse[ v << (8-n) ]); } static inline int asv1_get_level(GetBitContext *gb){ int code= get_vlc2(gb, level_vlc.table, VLC_BITS, 1); if(code==3) return get_sbits(gb, 8); else return code - 3; } static inline int asv2_get_level(GetBitContext *gb){ int code= get_vlc2(gb, asv2_level_vlc.table, ASV2_LEVEL_VLC_BITS, 1); if(code==31) return (int8_t)asv2_get_bits(gb, 8); else return code - 31; } static inline void asv1_put_level(PutBitContext *pb, int level){ unsigned int index= level + 3; if(index <= 6) put_bits(pb, level_tab[index][1], level_tab[index][0]); else{ put_bits(pb, level_tab[3][1], level_tab[3][0]); put_sbits(pb, 8, level); } } static inline void asv2_put_level(PutBitContext *pb, int level){ unsigned int index= level + 31; if(index <= 62) put_bits(pb, asv2_level_tab[index][1], asv2_level_tab[index][0]); else{ put_bits(pb, asv2_level_tab[31][1], asv2_level_tab[31][0]); asv2_put_bits(pb, 8, level&0xFF); } } static inline int asv1_decode_block(ASV1Context *a, DCTELEM block[64]){ int i; block[0]= 8*get_bits(&a->gb, 8); for(i=0; i<11; i++){ const int ccp= get_vlc2(&a->gb, ccp_vlc.table, VLC_BITS, 1); if(ccp){ if(ccp == 16) break; if(ccp < 0 || i>=10){ av_log(a->avctx, AV_LOG_ERROR, "coded coeff pattern damaged\n"); return -1; } if(ccp&8) block[a->scantable.permutated[4*i+0]]= (asv1_get_level(&a->gb) * a->intra_matrix[4*i+0])>>4; if(ccp&4) block[a->scantable.permutated[4*i+1]]= (asv1_get_level(&a->gb) * a->intra_matrix[4*i+1])>>4; if(ccp&2) block[a->scantable.permutated[4*i+2]]= (asv1_get_level(&a->gb) * a->intra_matrix[4*i+2])>>4; if(ccp&1) block[a->scantable.permutated[4*i+3]]= (asv1_get_level(&a->gb) * a->intra_matrix[4*i+3])>>4; } } return 0; } static inline int asv2_decode_block(ASV1Context *a, DCTELEM block[64]){ int i, count, ccp; count= asv2_get_bits(&a->gb, 4); block[0]= 8*asv2_get_bits(&a->gb, 8); ccp= get_vlc2(&a->gb, dc_ccp_vlc.table, VLC_BITS, 1); if(ccp){ if(ccp&4) block[a->scantable.permutated[1]]= (asv2_get_level(&a->gb) * a->intra_matrix[1])>>4; if(ccp&2) block[a->scantable.permutated[2]]= (asv2_get_level(&a->gb) * a->intra_matrix[2])>>4; if(ccp&1) block[a->scantable.permutated[3]]= (asv2_get_level(&a->gb) * a->intra_matrix[3])>>4; } for(i=1; i<count+1; i++){ const int ccp= get_vlc2(&a->gb, ac_ccp_vlc.table, VLC_BITS, 1); if(ccp){ if(ccp&8) block[a->scantable.permutated[4*i+0]]= (asv2_get_level(&a->gb) * a->intra_matrix[4*i+0])>>4; if(ccp&4) block[a->scantable.permutated[4*i+1]]= (asv2_get_level(&a->gb) * a->intra_matrix[4*i+1])>>4; if(ccp&2) block[a->scantable.permutated[4*i+2]]= (asv2_get_level(&a->gb) * a->intra_matrix[4*i+2])>>4; if(ccp&1) block[a->scantable.permutated[4*i+3]]= (asv2_get_level(&a->gb) * a->intra_matrix[4*i+3])>>4; } } return 0; } static inline void asv1_encode_block(ASV1Context *a, DCTELEM block[64]){ int i; int nc_count=0; put_bits(&a->pb, 8, (block[0] + 32)>>6); block[0]= 0; for(i=0; i<10; i++){ const int index= scantab[4*i]; int ccp=0; if( (block[index + 0] = (block[index + 0]*a->q_intra_matrix[index + 0] + (1<<15))>>16) ) ccp |= 8; if( (block[index + 8] = (block[index + 8]*a->q_intra_matrix[index + 8] + (1<<15))>>16) ) ccp |= 4; if( (block[index + 1] = (block[index + 1]*a->q_intra_matrix[index + 1] + (1<<15))>>16) ) ccp |= 2; if( (block[index + 9] = (block[index + 9]*a->q_intra_matrix[index + 9] + (1<<15))>>16) ) ccp |= 1; if(ccp){ for(;nc_count; nc_count--) put_bits(&a->pb, ccp_tab[0][1], ccp_tab[0][0]); put_bits(&a->pb, ccp_tab[ccp][1], ccp_tab[ccp][0]); if(ccp&8) asv1_put_level(&a->pb, block[index + 0]); if(ccp&4) asv1_put_level(&a->pb, block[index + 8]); if(ccp&2) asv1_put_level(&a->pb, block[index + 1]); if(ccp&1) asv1_put_level(&a->pb, block[index + 9]); }else{ nc_count++; } } put_bits(&a->pb, ccp_tab[16][1], ccp_tab[16][0]); } static inline void asv2_encode_block(ASV1Context *a, DCTELEM block[64]){ int i; int count=0; for(count=63; count>3; count--){ const int index= scantab[count]; if( (block[index]*a->q_intra_matrix[index] + (1<<15))>>16 ) break; } count >>= 2; asv2_put_bits(&a->pb, 4, count); asv2_put_bits(&a->pb, 8, (block[0] + 32)>>6); block[0]= 0; for(i=0; i<=count; i++){ const int index= scantab[4*i]; int ccp=0; if( (block[index + 0] = (block[index + 0]*a->q_intra_matrix[index + 0] + (1<<15))>>16) ) ccp |= 8; if( (block[index + 8] = (block[index + 8]*a->q_intra_matrix[index + 8] + (1<<15))>>16) ) ccp |= 4; if( (block[index + 1] = (block[index + 1]*a->q_intra_matrix[index + 1] + (1<<15))>>16) ) ccp |= 2; if( (block[index + 9] = (block[index + 9]*a->q_intra_matrix[index + 9] + (1<<15))>>16) ) ccp |= 1; assert(i || ccp<8); if(i) put_bits(&a->pb, ac_ccp_tab[ccp][1], ac_ccp_tab[ccp][0]); else put_bits(&a->pb, dc_ccp_tab[ccp][1], dc_ccp_tab[ccp][0]); if(ccp){ if(ccp&8) asv2_put_level(&a->pb, block[index + 0]); if(ccp&4) asv2_put_level(&a->pb, block[index + 8]); if(ccp&2) asv2_put_level(&a->pb, block[index + 1]); if(ccp&1) asv2_put_level(&a->pb, block[index + 9]); } } } static inline int decode_mb(ASV1Context *a, DCTELEM block[6][64]){ int i; a->dsp.clear_blocks(block[0]); if(a->avctx->codec_id == CODEC_ID_ASV1){ for(i=0; i<6; i++){ if( asv1_decode_block(a, block[i]) < 0) return -1; } }else{ for(i=0; i<6; i++){ if( asv2_decode_block(a, block[i]) < 0) return -1; } } return 0; } static inline int encode_mb(ASV1Context *a, DCTELEM block[6][64]){ int i; if(a->pb.buf_end - a->pb.buf - (put_bits_count(&a->pb)>>3) < 30*16*16*3/2/8){ av_log(a->avctx, AV_LOG_ERROR, "encoded frame too large\n"); return -1; } if(a->avctx->codec_id == CODEC_ID_ASV1){ for(i=0; i<6; i++) asv1_encode_block(a, block[i]); }else{ for(i=0; i<6; i++) asv2_encode_block(a, block[i]); } return 0; } static inline void idct_put(ASV1Context *a, int mb_x, int mb_y){ DCTELEM (*block)[64]= a->block; int linesize= a->picture.linesize[0]; uint8_t *dest_y = a->picture.data[0] + (mb_y * 16* linesize ) + mb_x * 16; uint8_t *dest_cb = a->picture.data[1] + (mb_y * 8 * a->picture.linesize[1]) + mb_x * 8; uint8_t *dest_cr = a->picture.data[2] + (mb_y * 8 * a->picture.linesize[2]) + mb_x * 8; a->dsp.idct_put(dest_y , linesize, block[0]); a->dsp.idct_put(dest_y + 8, linesize, block[1]); a->dsp.idct_put(dest_y + 8*linesize , linesize, block[2]); a->dsp.idct_put(dest_y + 8*linesize + 8, linesize, block[3]); if(!(a->avctx->flags&CODEC_FLAG_GRAY)){ a->dsp.idct_put(dest_cb, a->picture.linesize[1], block[4]); a->dsp.idct_put(dest_cr, a->picture.linesize[2], block[5]); } } static inline void dct_get(ASV1Context *a, int mb_x, int mb_y){ DCTELEM (*block)[64]= a->block; int linesize= a->picture.linesize[0]; int i; uint8_t *ptr_y = a->picture.data[0] + (mb_y * 16* linesize ) + mb_x * 16; uint8_t *ptr_cb = a->picture.data[1] + (mb_y * 8 * a->picture.linesize[1]) + mb_x * 8; uint8_t *ptr_cr = a->picture.data[2] + (mb_y * 8 * a->picture.linesize[2]) + mb_x * 8; a->dsp.get_pixels(block[0], ptr_y , linesize); a->dsp.get_pixels(block[1], ptr_y + 8, linesize); a->dsp.get_pixels(block[2], ptr_y + 8*linesize , linesize); a->dsp.get_pixels(block[3], ptr_y + 8*linesize + 8, linesize); for(i=0; i<4; i++) a->dsp.fdct(block[i]); if(!(a->avctx->flags&CODEC_FLAG_GRAY)){ a->dsp.get_pixels(block[4], ptr_cb, a->picture.linesize[1]); a->dsp.get_pixels(block[5], ptr_cr, a->picture.linesize[2]); for(i=4; i<6; i++) a->dsp.fdct(block[i]); } } static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; ASV1Context * const a = avctx->priv_data; AVFrame *picture = data; AVFrame * const p= &a->picture; int mb_x, mb_y; if(p->data[0]) avctx->release_buffer(avctx, p); p->reference= 0; if(avctx->get_buffer(avctx, p) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } p->pict_type= FF_I_TYPE; p->key_frame= 1; av_fast_malloc(&a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!a->bitstream_buffer) return AVERROR(ENOMEM); if(avctx->codec_id == CODEC_ID_ASV1) a->dsp.bswap_buf((uint32_t*)a->bitstream_buffer, (const uint32_t*)buf, buf_size/4); else{ int i; for(i=0; i<buf_size; i++) a->bitstream_buffer[i]= av_reverse[ buf[i] ]; } init_get_bits(&a->gb, a->bitstream_buffer, buf_size*8); for(mb_y=0; mb_y<a->mb_height2; mb_y++){ for(mb_x=0; mb_x<a->mb_width2; mb_x++){ if( decode_mb(a, a->block) <0) return -1; idct_put(a, mb_x, mb_y); } } if(a->mb_width2 != a->mb_width){ mb_x= a->mb_width2; for(mb_y=0; mb_y<a->mb_height2; mb_y++){ if( decode_mb(a, a->block) <0) return -1; idct_put(a, mb_x, mb_y); } } if(a->mb_height2 != a->mb_height){ mb_y= a->mb_height2; for(mb_x=0; mb_x<a->mb_width; mb_x++){ if( decode_mb(a, a->block) <0) return -1; idct_put(a, mb_x, mb_y); } } #if 0 int i; printf("%d %d\n", 8*buf_size, get_bits_count(&a->gb)); for(i=get_bits_count(&a->gb); i<8*buf_size; i++){ printf("%d", get_bits1(&a->gb)); } for(i=0; i<s->avctx->extradata_size; i++){ printf("%c\n", ((uint8_t*)s->avctx->extradata)[i]); } #endif *picture= *(AVFrame*)&a->picture; *data_size = sizeof(AVPicture); emms_c(); return (get_bits_count(&a->gb)+31)/32*4; } #if CONFIG_ASV1_ENCODER || CONFIG_ASV2_ENCODER static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){ ASV1Context * const a = avctx->priv_data; AVFrame *pict = data; AVFrame * const p= &a->picture; int size; int mb_x, mb_y; init_put_bits(&a->pb, buf, buf_size); *p = *pict; p->pict_type= FF_I_TYPE; p->key_frame= 1; for(mb_y=0; mb_y<a->mb_height2; mb_y++){ for(mb_x=0; mb_x<a->mb_width2; mb_x++){ dct_get(a, mb_x, mb_y); encode_mb(a, a->block); } } if(a->mb_width2 != a->mb_width){ mb_x= a->mb_width2; for(mb_y=0; mb_y<a->mb_height2; mb_y++){ dct_get(a, mb_x, mb_y); encode_mb(a, a->block); } } if(a->mb_height2 != a->mb_height){ mb_y= a->mb_height2; for(mb_x=0; mb_x<a->mb_width; mb_x++){ dct_get(a, mb_x, mb_y); encode_mb(a, a->block); } } emms_c(); align_put_bits(&a->pb); while(put_bits_count(&a->pb)&31) put_bits(&a->pb, 8, 0); size= put_bits_count(&a->pb)/32; if(avctx->codec_id == CODEC_ID_ASV1) a->dsp.bswap_buf((uint32_t*)buf, (uint32_t*)buf, size); else{ int i; for(i=0; i<4*size; i++) buf[i]= av_reverse[ buf[i] ]; } return size*4; } #endif /* CONFIG_ASV1_ENCODER || CONFIG_ASV2_ENCODER */ static av_cold void common_init(AVCodecContext *avctx){ ASV1Context * const a = avctx->priv_data; dsputil_init(&a->dsp, avctx); a->mb_width = (avctx->width + 15) / 16; a->mb_height = (avctx->height + 15) / 16; a->mb_width2 = (avctx->width + 0) / 16; a->mb_height2 = (avctx->height + 0) / 16; avctx->coded_frame= &a->picture; a->avctx= avctx; } static av_cold int decode_init(AVCodecContext *avctx){ ASV1Context * const a = avctx->priv_data; AVFrame *p= &a->picture; int i; const int scale= avctx->codec_id == CODEC_ID_ASV1 ? 1 : 2; common_init(avctx); init_vlcs(a); ff_init_scantable(a->dsp.idct_permutation, &a->scantable, scantab); avctx->pix_fmt= PIX_FMT_YUV420P; a->inv_qscale= avctx->extradata[0]; if(a->inv_qscale == 0){ av_log(avctx, AV_LOG_ERROR, "illegal qscale 0\n"); if(avctx->codec_id == CODEC_ID_ASV1) a->inv_qscale= 6; else a->inv_qscale= 10; } for(i=0; i<64; i++){ int index= scantab[i]; a->intra_matrix[i]= 64*scale*ff_mpeg1_default_intra_matrix[index] / a->inv_qscale; } p->qstride= a->mb_width; p->qscale_table= av_malloc( p->qstride * a->mb_height); p->quality= (32*scale + a->inv_qscale/2)/a->inv_qscale; memset(p->qscale_table, p->quality, p->qstride*a->mb_height); return 0; } #if CONFIG_ASV1_ENCODER || CONFIG_ASV2_ENCODER static av_cold int encode_init(AVCodecContext *avctx){ ASV1Context * const a = avctx->priv_data; int i; const int scale= avctx->codec_id == CODEC_ID_ASV1 ? 1 : 2; common_init(avctx); if(avctx->global_quality == 0) avctx->global_quality= 4*FF_QUALITY_SCALE; a->inv_qscale= (32*scale*FF_QUALITY_SCALE + avctx->global_quality/2) / avctx->global_quality; avctx->extradata= av_mallocz(8); avctx->extradata_size=8; ((uint32_t*)avctx->extradata)[0]= le2me_32(a->inv_qscale); ((uint32_t*)avctx->extradata)[1]= le2me_32(AV_RL32("ASUS")); for(i=0; i<64; i++){ int q= 32*scale*ff_mpeg1_default_intra_matrix[i]; a->q_intra_matrix[i]= ((a->inv_qscale<<16) + q/2) / q; } return 0; } #endif /* CONFIG_ASV1_ENCODER || CONFIG_ASV2_ENCODER */ static av_cold int decode_end(AVCodecContext *avctx){ ASV1Context * const a = avctx->priv_data; av_freep(&a->bitstream_buffer); av_freep(&a->picture.qscale_table); a->bitstream_buffer_size=0; if(a->picture.data[0]) avctx->release_buffer(avctx, &a->picture); return 0; } AVCodec asv1_decoder = { "asv1", AVMEDIA_TYPE_VIDEO, CODEC_ID_ASV1, sizeof(ASV1Context), decode_init, NULL, decode_end, decode_frame, CODEC_CAP_DR1, .long_name= NULL_IF_CONFIG_SMALL("ASUS V1"), }; AVCodec asv2_decoder = { "asv2", AVMEDIA_TYPE_VIDEO, CODEC_ID_ASV2, sizeof(ASV1Context), decode_init, NULL, decode_end, decode_frame, CODEC_CAP_DR1, .long_name= NULL_IF_CONFIG_SMALL("ASUS V2"), }; #if CONFIG_ASV1_ENCODER AVCodec asv1_encoder = { "asv1", AVMEDIA_TYPE_VIDEO, CODEC_ID_ASV1, sizeof(ASV1Context), encode_init, encode_frame, //encode_end, .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, .long_name= NULL_IF_CONFIG_SMALL("ASUS V1"), }; #endif #if CONFIG_ASV2_ENCODER AVCodec asv2_encoder = { "asv2", AVMEDIA_TYPE_VIDEO, CODEC_ID_ASV2, sizeof(ASV1Context), encode_init, encode_frame, //encode_end, .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, .long_name= NULL_IF_CONFIG_SMALL("ASUS V2"), }; #endif
123linslouis-android-video-cutter
jni/libavcodec/asv1.c
C
asf20
20,355
/* * Microsoft Video-1 Decoder * Copyright (C) 2003 the ffmpeg project * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * Microsoft Video-1 Decoder by Mike Melanson (melanson@pcisys.net) * For more information about the MS Video-1 format, visit: * http://www.pcisys.net/~melanson/codecs/ * * This decoder outputs either PAL8 or RGB555 data, depending on the * whether a RGB palette was passed through palctrl; * if it's present, then the data is PAL8; RGB555 otherwise. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "libavutil/intreadwrite.h" #include "avcodec.h" #define PALETTE_COUNT 256 #define CHECK_STREAM_PTR(n) \ if ((stream_ptr + n) > s->size ) { \ av_log(s->avctx, AV_LOG_ERROR, " MS Video-1 warning: stream_ptr out of bounds (%d >= %d)\n", \ stream_ptr + n, s->size); \ return; \ } typedef struct Msvideo1Context { AVCodecContext *avctx; AVFrame frame; const unsigned char *buf; int size; int mode_8bit; /* if it's not 8-bit, it's 16-bit */ } Msvideo1Context; static av_cold int msvideo1_decode_init(AVCodecContext *avctx) { Msvideo1Context *s = avctx->priv_data; s->avctx = avctx; /* figure out the colorspace based on the presence of a palette */ if (s->avctx->palctrl) { s->mode_8bit = 1; avctx->pix_fmt = PIX_FMT_PAL8; } else { s->mode_8bit = 0; avctx->pix_fmt = PIX_FMT_RGB555; } s->frame.data[0] = NULL; return 0; } static void msvideo1_decode_8bit(Msvideo1Context *s) { int block_ptr, pixel_ptr; int total_blocks; int pixel_x, pixel_y; /* pixel width and height iterators */ int block_x, block_y; /* block width and height iterators */ int blocks_wide, blocks_high; /* width and height in 4x4 blocks */ int block_inc; int row_dec; /* decoding parameters */ int stream_ptr; unsigned char byte_a, byte_b; unsigned short flags; int skip_blocks; unsigned char colors[8]; unsigned char *pixels = s->frame.data[0]; int stride = s->frame.linesize[0]; stream_ptr = 0; skip_blocks = 0; blocks_wide = s->avctx->width / 4; blocks_high = s->avctx->height / 4; total_blocks = blocks_wide * blocks_high; block_inc = 4; row_dec = stride + 4; for (block_y = blocks_high; block_y > 0; block_y--) { block_ptr = ((block_y * 4) - 1) * stride; for (block_x = blocks_wide; block_x > 0; block_x--) { /* check if this block should be skipped */ if (skip_blocks) { block_ptr += block_inc; skip_blocks--; total_blocks--; continue; } pixel_ptr = block_ptr; /* get the next two bytes in the encoded data stream */ CHECK_STREAM_PTR(2); byte_a = s->buf[stream_ptr++]; byte_b = s->buf[stream_ptr++]; /* check if the decode is finished */ if ((byte_a == 0) && (byte_b == 0) && (total_blocks == 0)) return; else if ((byte_b & 0xFC) == 0x84) { /* skip code, but don't count the current block */ skip_blocks = ((byte_b - 0x84) << 8) + byte_a - 1; } else if (byte_b < 0x80) { /* 2-color encoding */ flags = (byte_b << 8) | byte_a; CHECK_STREAM_PTR(2); colors[0] = s->buf[stream_ptr++]; colors[1] = s->buf[stream_ptr++]; for (pixel_y = 0; pixel_y < 4; pixel_y++) { for (pixel_x = 0; pixel_x < 4; pixel_x++, flags >>= 1) pixels[pixel_ptr++] = colors[(flags & 0x1) ^ 1]; pixel_ptr -= row_dec; } } else if (byte_b >= 0x90) { /* 8-color encoding */ flags = (byte_b << 8) | byte_a; CHECK_STREAM_PTR(8); memcpy(colors, &s->buf[stream_ptr], 8); stream_ptr += 8; for (pixel_y = 0; pixel_y < 4; pixel_y++) { for (pixel_x = 0; pixel_x < 4; pixel_x++, flags >>= 1) pixels[pixel_ptr++] = colors[((pixel_y & 0x2) << 1) + (pixel_x & 0x2) + ((flags & 0x1) ^ 1)]; pixel_ptr -= row_dec; } } else { /* 1-color encoding */ colors[0] = byte_a; for (pixel_y = 0; pixel_y < 4; pixel_y++) { for (pixel_x = 0; pixel_x < 4; pixel_x++) pixels[pixel_ptr++] = colors[0]; pixel_ptr -= row_dec; } } block_ptr += block_inc; total_blocks--; } } /* make the palette available on the way out */ if (s->avctx->pix_fmt == PIX_FMT_PAL8) { memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE); if (s->avctx->palctrl->palette_changed) { s->frame.palette_has_changed = 1; s->avctx->palctrl->palette_changed = 0; } } } static void msvideo1_decode_16bit(Msvideo1Context *s) { int block_ptr, pixel_ptr; int total_blocks; int pixel_x, pixel_y; /* pixel width and height iterators */ int block_x, block_y; /* block width and height iterators */ int blocks_wide, blocks_high; /* width and height in 4x4 blocks */ int block_inc; int row_dec; /* decoding parameters */ int stream_ptr; unsigned char byte_a, byte_b; unsigned short flags; int skip_blocks; unsigned short colors[8]; unsigned short *pixels = (unsigned short *)s->frame.data[0]; int stride = s->frame.linesize[0] / 2; stream_ptr = 0; skip_blocks = 0; blocks_wide = s->avctx->width / 4; blocks_high = s->avctx->height / 4; total_blocks = blocks_wide * blocks_high; block_inc = 4; row_dec = stride + 4; for (block_y = blocks_high; block_y > 0; block_y--) { block_ptr = ((block_y * 4) - 1) * stride; for (block_x = blocks_wide; block_x > 0; block_x--) { /* check if this block should be skipped */ if (skip_blocks) { block_ptr += block_inc; skip_blocks--; total_blocks--; continue; } pixel_ptr = block_ptr; /* get the next two bytes in the encoded data stream */ CHECK_STREAM_PTR(2); byte_a = s->buf[stream_ptr++]; byte_b = s->buf[stream_ptr++]; /* check if the decode is finished */ if ((byte_a == 0) && (byte_b == 0) && (total_blocks == 0)) { return; } else if ((byte_b & 0xFC) == 0x84) { /* skip code, but don't count the current block */ skip_blocks = ((byte_b - 0x84) << 8) + byte_a - 1; } else if (byte_b < 0x80) { /* 2- or 8-color encoding modes */ flags = (byte_b << 8) | byte_a; CHECK_STREAM_PTR(4); colors[0] = AV_RL16(&s->buf[stream_ptr]); stream_ptr += 2; colors[1] = AV_RL16(&s->buf[stream_ptr]); stream_ptr += 2; if (colors[0] & 0x8000) { /* 8-color encoding */ CHECK_STREAM_PTR(12); colors[2] = AV_RL16(&s->buf[stream_ptr]); stream_ptr += 2; colors[3] = AV_RL16(&s->buf[stream_ptr]); stream_ptr += 2; colors[4] = AV_RL16(&s->buf[stream_ptr]); stream_ptr += 2; colors[5] = AV_RL16(&s->buf[stream_ptr]); stream_ptr += 2; colors[6] = AV_RL16(&s->buf[stream_ptr]); stream_ptr += 2; colors[7] = AV_RL16(&s->buf[stream_ptr]); stream_ptr += 2; for (pixel_y = 0; pixel_y < 4; pixel_y++) { for (pixel_x = 0; pixel_x < 4; pixel_x++, flags >>= 1) pixels[pixel_ptr++] = colors[((pixel_y & 0x2) << 1) + (pixel_x & 0x2) + ((flags & 0x1) ^ 1)]; pixel_ptr -= row_dec; } } else { /* 2-color encoding */ for (pixel_y = 0; pixel_y < 4; pixel_y++) { for (pixel_x = 0; pixel_x < 4; pixel_x++, flags >>= 1) pixels[pixel_ptr++] = colors[(flags & 0x1) ^ 1]; pixel_ptr -= row_dec; } } } else { /* otherwise, it's a 1-color block */ colors[0] = (byte_b << 8) | byte_a; for (pixel_y = 0; pixel_y < 4; pixel_y++) { for (pixel_x = 0; pixel_x < 4; pixel_x++) pixels[pixel_ptr++] = colors[0]; pixel_ptr -= row_dec; } } block_ptr += block_inc; total_blocks--; } } } static int msvideo1_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; Msvideo1Context *s = avctx->priv_data; s->buf = buf; s->size = buf_size; s->frame.reference = 1; s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; if (avctx->reget_buffer(avctx, &s->frame)) { av_log(s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return -1; } if (s->mode_8bit) msvideo1_decode_8bit(s); else msvideo1_decode_16bit(s); *data_size = sizeof(AVFrame); *(AVFrame*)data = s->frame; /* report that the buffer was completely consumed */ return buf_size; } static av_cold int msvideo1_decode_end(AVCodecContext *avctx) { Msvideo1Context *s = avctx->priv_data; if (s->frame.data[0]) avctx->release_buffer(avctx, &s->frame); return 0; } AVCodec msvideo1_decoder = { "msvideo1", AVMEDIA_TYPE_VIDEO, CODEC_ID_MSVIDEO1, sizeof(Msvideo1Context), msvideo1_decode_init, NULL, msvideo1_decode_end, msvideo1_decode_frame, CODEC_CAP_DR1, .long_name= NULL_IF_CONFIG_SMALL("Microsoft Video 1"), };
123linslouis-android-video-cutter
jni/libavcodec/msvideo1.c
C
asf20
11,355
/* * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avcodec.h" static int noise(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args, uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int keyframe){ unsigned int *state= bsfc->priv_data; int amount= args ? atoi(args) : (*state % 10001+1); int i; *poutbuf= av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); memcpy(*poutbuf, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); for(i=0; i<buf_size; i++){ (*state) += (*poutbuf)[i] + 1; if(*state % amount == 0) (*poutbuf)[i] = *state; } return 1; } AVBitStreamFilter noise_bsf={ "noise", sizeof(int), noise, };
123linslouis-android-video-cutter
jni/libavcodec/noise_bsf.c
C
asf20
1,551
/* * DXVA2 WMV3/VC-1 HW acceleration. * * copyright (c) 2010 Laurent Aimar * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "dxva2_internal.h" #include "vc1.h" #include "vc1data.h" struct dxva2_picture_context { DXVA_PictureParameters pp; DXVA_SliceInfo si; const uint8_t *bitstream; unsigned bitstream_size; }; static void fill_picture_parameters(AVCodecContext *avctx, struct dxva_context *ctx, const VC1Context *v, DXVA_PictureParameters *pp) { const MpegEncContext *s = &v->s; const Picture *current_picture = s->current_picture_ptr; memset(pp, 0, sizeof(*pp)); pp->wDecodedPictureIndex = pp->wDeblockedPictureIndex = ff_dxva2_get_surface_index(ctx, current_picture); if (s->pict_type != FF_I_TYPE) pp->wForwardRefPictureIndex = ff_dxva2_get_surface_index(ctx, &s->last_picture); else pp->wForwardRefPictureIndex = 0xffff; if (s->pict_type == FF_B_TYPE) pp->wBackwardRefPictureIndex = ff_dxva2_get_surface_index(ctx, &s->next_picture); else pp->wBackwardRefPictureIndex = 0xffff; if (v->profile == PROFILE_ADVANCED) { /* It is the cropped width/height -1 of the frame */ pp->wPicWidthInMBminus1 = avctx->width - 1; pp->wPicHeightInMBminus1= avctx->height - 1; } else { /* It is the coded width/height in macroblock -1 of the frame */ pp->wPicWidthInMBminus1 = s->mb_width - 1; pp->wPicHeightInMBminus1= s->mb_height - 1; } pp->bMacroblockWidthMinus1 = 15; pp->bMacroblockHeightMinus1 = 15; pp->bBlockWidthMinus1 = 7; pp->bBlockHeightMinus1 = 7; pp->bBPPminus1 = 7; if (s->picture_structure & PICT_TOP_FIELD) pp->bPicStructure |= 0x01; if (s->picture_structure & PICT_BOTTOM_FIELD) pp->bPicStructure |= 0x02; pp->bSecondField = v->interlace && v->fcm != 0x03 && !s->first_field; pp->bPicIntra = s->pict_type == FF_I_TYPE; pp->bPicBackwardPrediction = s->pict_type == FF_B_TYPE; pp->bBidirectionalAveragingMode = (1 << 7) | ((ctx->cfg->ConfigIntraResidUnsigned != 0) << 6) | ((ctx->cfg->ConfigResidDiffAccelerator != 0) << 5) | ((v->lumscale != 32 || v->lumshift != 0) << 4) | ((v->profile == PROFILE_ADVANCED) << 3); pp->bMVprecisionAndChromaRelation = ((v->mv_mode == MV_PMODE_1MV_HPEL_BILIN) << 3) | (1 << 2) | (0 << 1) | (!s->quarter_sample ); pp->bChromaFormat = v->chromaformat; ctx->report_id++; if (ctx->report_id >= (1 << 16)) ctx->report_id = 1; pp->bPicScanFixed = ctx->report_id >> 8; pp->bPicScanMethod = ctx->report_id & 0xff; pp->bPicReadbackRequests = 0; pp->bRcontrol = v->rnd; pp->bPicSpatialResid8 = (v->panscanflag << 7) | (v->refdist_flag << 6) | (s->loop_filter << 5) | (v->fastuvmc << 4) | (v->extended_mv << 3) | (v->dquant << 1) | (v->vstransform ); pp->bPicOverflowBlocks = (v->quantizer_mode << 6) | (v->multires << 5) | (s->resync_marker << 4) | (v->rangered << 3) | (s->max_b_frames ); pp->bPicExtrapolation = (!v->interlace || v->fcm == 0x00) ? 1 : 2; pp->bPicDeblocked = ((v->profile != PROFILE_ADVANCED && v->rangeredfrm) << 5) | (s->loop_filter << 1); pp->bPicDeblockConfined = (v->postprocflag << 7) | (v->broadcast << 6) | (v->interlace << 5) | (v->tfcntrflag << 4) | (v->finterpflag << 3) | ((s->pict_type != FF_B_TYPE) << 2) | (v->psf << 1) | (v->extended_dmv ); if (s->pict_type != FF_I_TYPE) pp->bPic4MVallowed = v->mv_mode == MV_PMODE_MIXED_MV || (v->mv_mode == MV_PMODE_INTENSITY_COMP && v->mv_mode2 == MV_PMODE_MIXED_MV); if (v->profile == PROFILE_ADVANCED) pp->bPicOBMC = (v->range_mapy_flag << 7) | (v->range_mapy << 4) | (v->range_mapuv_flag << 3) | (v->range_mapuv ); pp->bPicBinPB = 0; pp->bMV_RPS = 0; pp->bReservedBits = 0; if (s->picture_structure == PICT_FRAME) { pp->wBitstreamFcodes = v->lumscale; pp->wBitstreamPCEelements = v->lumshift; } else { /* Syntax: (top_field_param << 8) | bottom_field_param */ pp->wBitstreamFcodes = (v->lumscale << 8) | v->lumscale; pp->wBitstreamPCEelements = (v->lumshift << 8) | v->lumshift; } pp->bBitstreamConcealmentNeed = 0; pp->bBitstreamConcealmentMethod = 0; } static void fill_slice(AVCodecContext *avctx, DXVA_SliceInfo *slice, unsigned position, unsigned size) { const VC1Context *v = avctx->priv_data; const MpegEncContext *s = &v->s; memset(slice, 0, sizeof(*slice)); slice->wHorizontalPosition = 0; slice->wVerticalPosition = s->mb_y; slice->dwSliceBitsInBuffer = 8 * size; slice->dwSliceDataLocation = position; slice->bStartCodeBitOffset = 0; slice->bReservedBits = 0; slice->wMBbitOffset = get_bits_count(&s->gb); slice->wNumberMBsInSlice = s->mb_width * s->mb_height; /* XXX We assume 1 slice */ slice->wQuantizerScaleCode = v->pq; slice->wBadSliceChopping = 0; } static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx, DXVA2_DecodeBufferDesc *bs, DXVA2_DecodeBufferDesc *sc) { const VC1Context *v = avctx->priv_data; struct dxva_context *ctx = avctx->hwaccel_context; const MpegEncContext *s = &v->s; struct dxva2_picture_context *ctx_pic = s->current_picture_ptr->hwaccel_picture_private; DXVA_SliceInfo *slice = &ctx_pic->si; static const uint8_t start_code[] = { 0, 0, 1, 0x0d }; const unsigned start_code_size = avctx->codec_id == CODEC_ID_VC1 ? sizeof(start_code) : 0; const unsigned slice_size = slice->dwSliceBitsInBuffer / 8; const unsigned padding = 128 - ((start_code_size + slice_size) & 127); const unsigned data_size = start_code_size + slice_size + padding; uint8_t *dxva_data; unsigned dxva_size; int result; if (FAILED(IDirectXVideoDecoder_GetBuffer(ctx->decoder, DXVA2_BitStreamDateBufferType, &dxva_data, &dxva_size))) return -1; result = data_size <= dxva_size ? 0 : -1; if (!result) { if (start_code_size > 0) memcpy(dxva_data, start_code, start_code_size); memcpy(dxva_data + start_code_size, ctx_pic->bitstream + slice->dwSliceDataLocation, slice_size); if (padding > 0) memset(dxva_data + start_code_size + slice_size, 0, padding); slice->dwSliceBitsInBuffer = 8 * data_size; } if (FAILED(IDirectXVideoDecoder_ReleaseBuffer(ctx->decoder, DXVA2_BitStreamDateBufferType))) return -1; if (result) return result; memset(bs, 0, sizeof(*bs)); bs->CompressedBufferType = DXVA2_BitStreamDateBufferType; bs->DataSize = data_size; bs->NumMBsInBuffer = s->mb_width * s->mb_height; assert((bs->DataSize & 127) == 0); return ff_dxva2_commit_buffer(avctx, ctx, sc, DXVA2_SliceControlBufferType, slice, sizeof(*slice), bs->NumMBsInBuffer); } static int start_frame(AVCodecContext *avctx, av_unused const uint8_t *buffer, av_unused uint32_t size) { const VC1Context *v = avctx->priv_data; struct dxva_context *ctx = avctx->hwaccel_context; struct dxva2_picture_context *ctx_pic = v->s.current_picture_ptr->hwaccel_picture_private; if (!ctx->decoder || !ctx->cfg || ctx->surface_count <= 0) return -1; assert(ctx_pic); fill_picture_parameters(avctx, ctx, v, &ctx_pic->pp); ctx_pic->bitstream_size = 0; ctx_pic->bitstream = NULL; return 0; } static int decode_slice(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { const VC1Context *v = avctx->priv_data; const Picture *current_picture = v->s.current_picture_ptr; struct dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private; if (ctx_pic->bitstream_size > 0) return -1; if (avctx->codec_id == CODEC_ID_VC1 && size >= 4 && IS_MARKER(AV_RB32(buffer))) { buffer += 4; size -= 4; } ctx_pic->bitstream_size = size; ctx_pic->bitstream = buffer; fill_slice(avctx, &ctx_pic->si, 0, size); return 0; } static int end_frame(AVCodecContext *avctx) { VC1Context *v = avctx->priv_data; struct dxva2_picture_context *ctx_pic = v->s.current_picture_ptr->hwaccel_picture_private; if (ctx_pic->bitstream_size <= 0) return -1; return ff_dxva2_common_end_frame(avctx, &v->s, &ctx_pic->pp, sizeof(ctx_pic->pp), NULL, 0, commit_bitstream_and_slice_buffer); } #if CONFIG_WMV3_DXVA2_HWACCEL AVHWAccel wmv3_dxva2_hwaccel = { .name = "wmv3_dxva2", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_WMV3, .pix_fmt = PIX_FMT_DXVA2_VLD, .capabilities = 0, .start_frame = start_frame, .decode_slice = decode_slice, .end_frame = end_frame, .priv_data_size = sizeof(struct dxva2_picture_context), }; #endif AVHWAccel vc1_dxva2_hwaccel = { .name = "vc1_dxva2", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_VC1, .pix_fmt = PIX_FMT_DXVA2_VLD, .capabilities = 0, .start_frame = start_frame, .decode_slice = decode_slice, .end_frame = end_frame, .priv_data_size = sizeof(struct dxva2_picture_context), };
123linslouis-android-video-cutter
jni/libavcodec/dxva2_vc1.c
C
asf20
12,131
/* * Block Gilbert-Moore decoder * Copyright (c) 2010 Thilo Borgmann <thilo.borgmann _at_ googlemail.com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * Block Gilbert-Moore decoder as used by MPEG-4 ALS * @author Thilo Borgmann <thilo.borgmann _at_ googlemail.com> */ #include "bgmc.h" #define FREQ_BITS 14 // bits used by frequency counters #define VALUE_BITS 18 // bits used to represent the values #define TOP_VALUE ((1 << VALUE_BITS) - 1) // maximum value #define FIRST_QTR (TOP_VALUE / 4 + 1) // first quarter of values maximum value #define HALF (2 * FIRST_QTR) // first half of values maximum value #define THIRD_QTR (3 * FIRST_QTR) // third quarter of values maximum value #define LUT_BITS (FREQ_BITS - 8) // number of bits used to index lookup tables #define LUT_SIZE (1 << LUT_BITS) // size of the lookup tables #define LUT_BUFF 4 // number of buffered lookup tables /** Cumulative frequency tables for block Gilbert-Moore coding. */ static const uint16_t cf_tables_1[3][129] = { { 16384, 16066, 15748, 15431, 15114, 14799, 14485, 14173, 13861, 13552, 13243, 12939, 12635, 12336, 12038, 11745, 11452, 11161, 10870, 10586, 10303, 10027, 9751, 9483, 9215, 8953, 8692, 8440, 8189, 7946, 7704, 7472, 7240, 7008, 6776, 6554, 6333, 6122, 5912, 5711, 5512, 5320, 5128, 4947, 4766, 4595, 4425, 4264, 4104, 3946, 3788, 3640, 3493, 3355, 3218, 3090, 2963, 2842, 2721, 2609, 2498, 2395, 2292, 2196, 2100, 2004, 1908, 1820, 1732, 1651, 1570, 1497, 1424, 1355, 1287, 1223, 1161, 1100, 1044, 988, 938, 888, 839, 790, 746, 702, 662, 623, 588, 553, 520, 488, 459, 431, 405, 380, 357, 334, 311, 288, 268, 248, 230, 213, 197, 182, 168, 154, 142, 130, 119, 108, 99, 90, 81, 72, 64, 56, 49, 42, 36, 30, 25, 20, 15, 11, 7, 3, 0 }, { 16384, 16080, 15776, 15473, 15170, 14868, 14567, 14268, 13970, 13674, 13378, 13086, 12794, 12505, 12218, 11936, 11654, 11373, 11092, 10818, 10544, 10276, 10008, 9749, 9490, 9236, 8982, 8737, 8492, 8256, 8020, 7792, 7564, 7336, 7108, 6888, 6669, 6459, 6249, 6050, 5852, 5660, 5468, 5286, 5104, 4931, 4760, 4598, 4436, 4275, 4115, 3965, 3816, 3674, 3534, 3403, 3272, 3147, 3023, 2907, 2792, 2684, 2577, 2476, 2375, 2274, 2173, 2079, 1986, 1897, 1810, 1724, 1645, 1567, 1493, 1419, 1351, 1284, 1222, 1161, 1105, 1050, 995, 941, 891, 842, 797, 753, 713, 673, 636, 599, 566, 533, 503, 473, 446, 419, 392, 365, 340, 316, 294, 272, 253, 234, 216, 199, 184, 169, 155, 142, 130, 118, 106, 95, 85, 75, 66, 57, 49, 41, 34, 27, 21, 15, 10, 5, 0 }, { 16384, 16092, 15801, 15510, 15219, 14930, 14641, 14355, 14069, 13785, 13501, 13219, 12938, 12661, 12384, 12112, 11841, 11571, 11301, 11037, 10773, 10514, 10256, 10005, 9754, 9508, 9263, 9025, 8787, 8557, 8327, 8103, 7879, 7655, 7431, 7215, 7000, 6792, 6585, 6387, 6190, 5998, 5807, 5625, 5445, 5272, 5100, 4937, 4774, 4613, 4452, 4301, 4150, 4007, 3865, 3731, 3597, 3469, 3341, 3218, 3099, 2981, 2869, 2758, 2652, 2546, 2440, 2334, 2234, 2134, 2041, 1949, 1864, 1779, 1699, 1620, 1547, 1474, 1407, 1340, 1278, 1217, 1157, 1097, 1043, 989, 940, 891, 846, 801, 759, 718, 680, 643, 609, 575, 543, 511, 479, 447, 418, 389, 363, 337, 314, 291, 270, 249, 230, 212, 195, 179, 164, 149, 135, 121, 108, 96, 85, 74, 64, 54, 45, 36, 28, 20, 13, 6, 0 } }; static const uint16_t cf_tables_2[8][193] = { { 16384, 16104, 15825, 15546, 15268, 14991, 14714, 14439, 14164, 13891, 13620, 13350, 13081, 12815, 12549, 12287, 12025, 11765, 11505, 11250, 10996, 10746, 10497, 10254, 10011, 9772, 9534, 9303, 9072, 8848, 8624, 8406, 8188, 7970, 7752, 7539, 7327, 7123, 6919, 6724, 6529, 6339, 6150, 5970, 5790, 5618, 5446, 5282, 5119, 4957, 4795, 4642, 4490, 4345, 4201, 4065, 3929, 3798, 3669, 3547, 3425, 3310, 3196, 3086, 2976, 2866, 2756, 2650, 2545, 2447, 2350, 2260, 2170, 2085, 2000, 1921, 1843, 1770, 1698, 1632, 1566, 1501, 1436, 1376, 1316, 1261, 1207, 1157, 1108, 1061, 1015, 973, 931, 893, 855, 819, 783, 747, 711, 677, 644, 614, 584, 557, 530, 505, 480, 458, 436, 416, 396, 378, 360, 343, 326, 310, 295, 281, 267, 255, 243, 232, 221, 211, 201, 192, 183, 174, 166, 158, 150, 142, 134, 126, 119, 112, 106, 100, 95, 90, 85, 80, 76, 72, 69, 66, 63, 60, 57, 54, 51, 48, 46, 44, 42, 40, 38, 36, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }, { 16384, 16116, 15849, 15582, 15316, 15050, 14785, 14521, 14257, 13995, 13734, 13476, 13218, 12963, 12708, 12457, 12206, 11956, 11706, 11460, 11215, 10975, 10735, 10500, 10265, 10034, 9803, 9579, 9355, 9136, 8917, 8703, 8489, 8275, 8061, 7853, 7645, 7444, 7244, 7051, 6858, 6671, 6484, 6305, 6127, 5956, 5785, 5622, 5459, 5298, 5137, 4983, 4830, 4684, 4539, 4401, 4263, 4131, 3999, 3874, 3750, 3632, 3515, 3401, 3287, 3173, 3059, 2949, 2840, 2737, 2635, 2539, 2444, 2354, 2264, 2181, 2098, 2020, 1943, 1872, 1801, 1731, 1661, 1596, 1532, 1472, 1412, 1357, 1303, 1251, 1200, 1153, 1106, 1063, 1020, 979, 938, 897, 856, 818, 780, 746, 712, 681, 650, 621, 592, 566, 540, 517, 494, 473, 452, 431, 410, 391, 373, 356, 340, 325, 310, 296, 282, 270, 258, 247, 236, 225, 214, 203, 192, 182, 172, 162, 153, 144, 136, 128, 121, 114, 108, 102, 97, 92, 87, 82, 77, 73, 69, 65, 62, 59, 56, 53, 50, 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }, { 16384, 16128, 15872, 15617, 15362, 15107, 14853, 14600, 14347, 14096, 13846, 13597, 13350, 13105, 12860, 12618, 12376, 12135, 11894, 11657, 11421, 11189, 10957, 10730, 10503, 10279, 10056, 9838, 9620, 9407, 9195, 8987, 8779, 8571, 8363, 8159, 7955, 7758, 7561, 7371, 7182, 6997, 6812, 6635, 6459, 6289, 6120, 5957, 5795, 5634, 5473, 5319, 5165, 5018, 4871, 4732, 4593, 4458, 4324, 4197, 4071, 3951, 3831, 3714, 3597, 3480, 3363, 3250, 3138, 3032, 2927, 2828, 2729, 2635, 2541, 2453, 2366, 2284, 2202, 2126, 2050, 1975, 1900, 1830, 1761, 1697, 1633, 1574, 1515, 1459, 1403, 1351, 1300, 1252, 1205, 1160, 1115, 1070, 1025, 982, 939, 899, 860, 824, 789, 756, 723, 693, 663, 636, 609, 584, 559, 535, 511, 489, 467, 447, 427, 409, 391, 374, 358, 343, 328, 313, 300, 287, 274, 261, 248, 235, 223, 211, 200, 189, 179, 169, 160, 151, 143, 135, 128, 121, 115, 109, 103, 97, 92, 87, 82, 77, 73, 69, 65, 61, 58, 55, 52, 49, 46, 43, 40, 37, 35, 33, 31, 29, 27, 25, 23, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }, { 16384, 16139, 15894, 15649, 15405, 15162, 14919, 14677, 14435, 14195, 13955, 13717, 13479, 13243, 13008, 12775, 12542, 12310, 12079, 11851, 11623, 11399, 11176, 10956, 10737, 10521, 10305, 10094, 9883, 9677, 9471, 9268, 9065, 8862, 8659, 8459, 8260, 8067, 7874, 7688, 7502, 7321, 7140, 6965, 6790, 6621, 6452, 6290, 6128, 5968, 5808, 5655, 5503, 5356, 5209, 5069, 4929, 4794, 4660, 4532, 4404, 4282, 4160, 4041, 3922, 3803, 3684, 3568, 3452, 3343, 3234, 3131, 3029, 2931, 2833, 2741, 2649, 2563, 2477, 2396, 2316, 2236, 2157, 2083, 2009, 1940, 1871, 1807, 1743, 1683, 1623, 1567, 1511, 1459, 1407, 1357, 1307, 1257, 1207, 1159, 1111, 1067, 1023, 983, 943, 905, 868, 834, 800, 769, 738, 709, 681, 653, 625, 600, 575, 552, 529, 508, 487, 466, 447, 428, 410, 392, 376, 360, 344, 328, 313, 298, 283, 268, 255, 242, 230, 218, 207, 196, 186, 176, 167, 158, 150, 142, 135, 128, 121, 114, 108, 102, 97, 92, 87, 82, 78, 74, 70, 66, 62, 58, 54, 50, 47, 44, 41, 38, 35, 32, 30, 28, 26, 24, 22, 20, 18, 16, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }, { 16384, 16149, 15915, 15681, 15447, 15214, 14981, 14749, 14517, 14286, 14055, 13827, 13599, 13373, 13147, 12923, 12699, 12476, 12253, 12034, 11815, 11599, 11383, 11171, 10959, 10750, 10541, 10337, 10133, 9933, 9733, 9536, 9339, 9142, 8945, 8751, 8557, 8369, 8181, 7998, 7816, 7638, 7460, 7288, 7116, 6950, 6785, 6625, 6465, 6306, 6147, 5995, 5843, 5697, 5551, 5411, 5271, 5135, 5000, 4871, 4742, 4618, 4495, 4374, 4253, 4132, 4011, 3893, 3775, 3663, 3552, 3446, 3340, 3239, 3138, 3043, 2948, 2858, 2768, 2684, 2600, 2516, 2433, 2355, 2278, 2205, 2133, 2065, 1997, 1932, 1867, 1807, 1747, 1690, 1634, 1580, 1526, 1472, 1418, 1366, 1314, 1266, 1218, 1174, 1130, 1088, 1047, 1009, 971, 936, 901, 868, 836, 804, 772, 743, 714, 685, 658, 631, 606, 582, 559, 536, 515, 494, 475, 456, 437, 418, 399, 380, 362, 344, 328, 312, 297, 283, 270, 257, 245, 233, 222, 211, 201, 191, 181, 172, 163, 155, 147, 139, 132, 125, 119, 113, 107, 101, 96, 91, 86, 81, 76, 71, 66, 62, 58, 54, 50, 46, 43, 40, 37, 34, 31, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 5, 4, 3, 2, 1, 0 }, { 16384, 16159, 15934, 15709, 15485, 15261, 15038, 14816, 14594, 14373, 14152, 13933, 13714, 13497, 13280, 13065, 12850, 12636, 12422, 12211, 12000, 11791, 11583, 11378, 11173, 10971, 10769, 10571, 10373, 10179, 9985, 9793, 9601, 9409, 9217, 9029, 8842, 8658, 8475, 8297, 8120, 7946, 7773, 7604, 7435, 7271, 7108, 6950, 6792, 6634, 6477, 6326, 6175, 6029, 5883, 5742, 5602, 5466, 5330, 5199, 5068, 4943, 4818, 4696, 4574, 4452, 4330, 4211, 4093, 3979, 3866, 3759, 3652, 3549, 3446, 3348, 3250, 3157, 3065, 2977, 2889, 2802, 2716, 2634, 2553, 2476, 2399, 2326, 2254, 2185, 2117, 2052, 1987, 1926, 1866, 1808, 1750, 1692, 1634, 1578, 1522, 1470, 1418, 1369, 1321, 1275, 1229, 1187, 1145, 1105, 1066, 1027, 991, 955, 919, 883, 850, 817, 786, 756, 728, 700, 674, 648, 624, 600, 578, 556, 534, 512, 490, 468, 447, 426, 407, 388, 371, 354, 338, 322, 307, 293, 280, 267, 255, 243, 231, 219, 209, 199, 189, 179, 170, 161, 153, 145, 138, 131, 124, 117, 111, 105, 99, 93, 87, 81, 76, 71, 66, 61, 57, 53, 49, 45, 42, 39, 36, 33, 30, 27, 24, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0 }, { 16384, 16169, 15954, 15739, 15524, 15310, 15096, 14883, 14670, 14458, 14246, 14035, 13824, 13614, 13405, 13198, 12991, 12785, 12579, 12376, 12173, 11972, 11772, 11574, 11377, 11182, 10987, 10795, 10603, 10414, 10226, 10040, 9854, 9668, 9482, 9299, 9116, 8937, 8759, 8585, 8411, 8241, 8071, 7906, 7741, 7580, 7419, 7263, 7107, 6952, 6797, 6647, 6497, 6353, 6209, 6070, 5931, 5796, 5661, 5531, 5401, 5275, 5150, 5027, 4904, 4781, 4658, 4538, 4419, 4304, 4190, 4081, 3972, 3867, 3762, 3662, 3562, 3467, 3372, 3281, 3191, 3101, 3012, 2928, 2844, 2764, 2684, 2608, 2533, 2460, 2387, 2318, 2250, 2185, 2121, 2059, 1997, 1935, 1873, 1813, 1754, 1698, 1642, 1588, 1535, 1483, 1433, 1384, 1338, 1292, 1249, 1206, 1165, 1125, 1085, 1045, 1008, 971, 937, 903, 871, 840, 810, 780, 752, 724, 698, 672, 647, 622, 597, 572, 548, 524, 502, 480, 460, 440, 421, 403, 386, 369, 353, 337, 323, 309, 295, 281, 268, 255, 243, 231, 220, 209, 199, 189, 180, 171, 163, 155, 147, 139, 131, 123, 116, 109, 102, 95, 89, 83, 77, 72, 67, 62, 57, 52, 48, 44, 40, 36, 32, 28, 25, 22, 19, 16, 13, 10, 8, 6, 4, 2, 0 }, { 16384, 16177, 15970, 15764, 15558, 15353, 15148, 14944, 14740, 14537, 14334, 14132, 13930, 13729, 13529, 13330, 13131, 12933, 12735, 12539, 12343, 12150, 11957, 11766, 11576, 11388, 11200, 11015, 10830, 10647, 10465, 10285, 10105, 9925, 9745, 9568, 9391, 9218, 9045, 8876, 8707, 8541, 8375, 8213, 8051, 7894, 7737, 7583, 7429, 7277, 7125, 6977, 6830, 6687, 6544, 6406, 6268, 6133, 5998, 5868, 5738, 5612, 5487, 5364, 5241, 5118, 4995, 4875, 4755, 4640, 4525, 4414, 4304, 4198, 4092, 3990, 3888, 3790, 3693, 3600, 3507, 3415, 3323, 3235, 3147, 3064, 2981, 2902, 2823, 2746, 2670, 2594, 2522, 2450, 2382, 2314, 2248, 2182, 2116, 2050, 1987, 1924, 1864, 1804, 1748, 1692, 1638, 1585, 1534, 1484, 1437, 1390, 1346, 1302, 1258, 1215, 1174, 1133, 1095, 1057, 1021, 986, 952, 918, 887, 856, 827, 798, 770, 742, 714, 686, 659, 632, 607, 582, 559, 536, 514, 492, 472, 452, 433, 415, 398, 381, 364, 348, 333, 318, 304, 290, 277, 264, 252, 240, 229, 218, 208, 198, 188, 178, 168, 158, 149, 140, 132, 124, 116, 108, 101, 94, 87, 81, 75, 69, 64, 59, 54, 49, 44, 39, 35, 31, 27, 23, 19, 15, 12, 9, 6, 3, 0 } }; static const uint16_t cf_tables_3[5][257] = { { 16384, 16187, 15990, 15793, 15597, 15401, 15205, 15009, 14813, 14618, 14423, 14230, 14037, 13845, 13653, 13463, 13273, 13083, 12894, 12706, 12518, 12332, 12146, 11962, 11778, 11597, 11416, 11237, 11059, 10882, 10706, 10532, 10358, 10184, 10010, 9838, 9666, 9497, 9328, 9163, 8999, 8837, 8675, 8517, 8359, 8205, 8051, 7901, 7751, 7602, 7453, 7308, 7163, 7022, 6882, 6745, 6609, 6476, 6343, 6214, 6085, 5960, 5835, 5712, 5589, 5466, 5343, 5223, 5103, 4987, 4872, 4761, 4650, 4542, 4435, 4332, 4229, 4130, 4031, 3936, 3841, 3747, 3653, 3563, 3473, 3387, 3302, 3220, 3138, 3059, 2980, 2905, 2830, 2759, 2688, 2619, 2550, 2481, 2412, 2345, 2278, 2215, 2152, 2092, 2032, 1974, 1917, 1863, 1809, 1758, 1707, 1659, 1611, 1564, 1517, 1473, 1429, 1387, 1346, 1307, 1268, 1230, 1193, 1158, 1123, 1090, 1058, 1026, 994, 962, 930, 899, 869, 841, 813, 786, 760, 735, 710, 687, 664, 643, 622, 602, 582, 562, 543, 525, 507, 490, 473, 457, 442, 427, 412, 398, 385, 373, 361, 349, 337, 325, 313, 301, 290, 279, 269, 259, 249, 240, 231, 222, 214, 206, 199, 192, 185, 178, 171, 165, 159, 153, 148, 143, 138, 133, 128, 123, 119, 115, 111, 107, 103, 99, 95, 91, 87, 83, 80, 77, 74, 71, 68, 65, 63, 61, 59, 57, 55, 53, 51, 49, 47, 45, 43, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }, { 16384, 16195, 16006, 15817, 15629, 15441, 15253, 15065, 14878, 14692, 14506, 14321, 14136, 13952, 13768, 13585, 13402, 13219, 13037, 12857, 12677, 12499, 12321, 12144, 11967, 11792, 11617, 11444, 11271, 11100, 10930, 10762, 10594, 10426, 10258, 10091, 9925, 9761, 9598, 9438, 9278, 9120, 8963, 8809, 8655, 8504, 8354, 8207, 8060, 7914, 7769, 7627, 7485, 7347, 7209, 7074, 6939, 6807, 6676, 6548, 6420, 6296, 6172, 6050, 5928, 5806, 5684, 5564, 5444, 5328, 5212, 5100, 4988, 4879, 4771, 4667, 4563, 4462, 4362, 4265, 4169, 4073, 3978, 3886, 3795, 3707, 3619, 3535, 3451, 3369, 3288, 3210, 3133, 3059, 2985, 2913, 2841, 2769, 2697, 2627, 2557, 2490, 2424, 2360, 2297, 2237, 2177, 2119, 2062, 2007, 1953, 1901, 1849, 1798, 1748, 1700, 1652, 1607, 1562, 1519, 1476, 1435, 1394, 1355, 1317, 1281, 1245, 1210, 1175, 1140, 1105, 1071, 1037, 1005, 973, 943, 913, 885, 857, 830, 804, 779, 754, 731, 708, 685, 663, 642, 621, 601, 581, 563, 545, 528, 511, 495, 479, 463, 448, 433, 419, 405, 391, 377, 364, 351, 338, 326, 314, 302, 291, 280, 270, 260, 251, 242, 234, 226, 218, 210, 202, 195, 188, 181, 174, 168, 162, 156, 150, 144, 139, 134, 129, 124, 119, 114, 109, 104, 100, 96, 92, 88, 84, 80, 77, 74, 71, 68, 65, 62, 59, 56, 54, 52, 50, 48, 46, 44, 42, 40, 38, 36, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }, { 16384, 16203, 16022, 15842, 15662, 15482, 15302, 15122, 14942, 14763, 14584, 14406, 14228, 14051, 13874, 13698, 13522, 13347, 13172, 12998, 12824, 12652, 12480, 12310, 12140, 11971, 11803, 11637, 11471, 11307, 11143, 10980, 10817, 10654, 10491, 10330, 10169, 10011, 9853, 9697, 9542, 9389, 9236, 9086, 8936, 8789, 8642, 8498, 8355, 8212, 8070, 7931, 7792, 7656, 7520, 7388, 7256, 7126, 6996, 6870, 6744, 6621, 6498, 6377, 6256, 6135, 6014, 5895, 5776, 5660, 5545, 5433, 5321, 5212, 5104, 4999, 4895, 4793, 4692, 4594, 4496, 4400, 4304, 4211, 4118, 4028, 3939, 3853, 3767, 3684, 3601, 3521, 3441, 3364, 3287, 3212, 3137, 3062, 2987, 2915, 2843, 2773, 2704, 2638, 2572, 2508, 2445, 2384, 2324, 2266, 2208, 2153, 2098, 2044, 1990, 1939, 1888, 1839, 1791, 1745, 1699, 1655, 1611, 1569, 1527, 1487, 1448, 1409, 1370, 1331, 1292, 1255, 1218, 1183, 1148, 1115, 1082, 1051, 1020, 990, 960, 932, 904, 878, 852, 826, 801, 777, 753, 731, 709, 687, 666, 645, 625, 605, 586, 567, 550, 533, 516, 499, 482, 465, 449, 433, 418, 403, 389, 375, 362, 349, 337, 325, 314, 303, 293, 283, 273, 263, 254, 245, 236, 227, 219, 211, 204, 197, 190, 183, 177, 171, 165, 159, 153, 147, 141, 135, 130, 125, 120, 115, 110, 105, 101, 97, 93, 89, 85, 81, 77, 74, 71, 68, 65, 62, 59, 56, 53, 51, 49, 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 25, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }, { 16384, 16210, 16036, 15863, 15690, 15517, 15344, 15172, 15000, 14828, 14656, 14485, 14314, 14145, 13976, 13808, 13640, 13472, 13304, 13137, 12970, 12804, 12639, 12475, 12312, 12149, 11987, 11827, 11667, 11508, 11349, 11192, 11035, 10878, 10721, 10565, 10410, 10257, 10104, 9953, 9802, 9654, 9506, 9359, 9213, 9070, 8927, 8787, 8647, 8508, 8369, 8233, 8097, 7964, 7831, 7700, 7570, 7442, 7315, 7190, 7065, 6943, 6821, 6701, 6581, 6461, 6341, 6223, 6105, 5990, 5876, 5764, 5653, 5545, 5437, 5331, 5226, 5124, 5022, 4924, 4826, 4729, 4632, 4538, 4444, 4353, 4262, 4174, 4087, 4002, 3917, 3835, 3753, 3674, 3595, 3518, 3441, 3364, 3287, 3212, 3138, 3066, 2995, 2926, 2858, 2792, 2726, 2662, 2599, 2538, 2478, 2420, 2362, 2305, 2249, 2195, 2141, 2089, 2037, 1988, 1939, 1891, 1844, 1799, 1754, 1711, 1668, 1626, 1584, 1542, 1500, 1459, 1418, 1380, 1342, 1305, 1269, 1234, 1199, 1166, 1133, 1102, 1071, 1041, 1012, 983, 954, 926, 899, 872, 847, 822, 798, 774, 751, 728, 707, 686, 666, 646, 627, 608, 589, 570, 552, 534, 517, 500, 484, 468, 453, 438, 424, 410, 397, 384, 372, 360, 348, 336, 325, 314, 303, 293, 283, 273, 264, 255, 246, 237, 229, 221, 213, 205, 197, 189, 181, 174, 167, 160, 154, 148, 142, 136, 131, 126, 121, 116, 111, 106, 101, 97, 93, 89, 85, 81, 77, 73, 70, 67, 64, 61, 58, 55, 52, 49, 46, 43, 40, 37, 35, 33, 31, 29, 27, 25, 23, 21, 19, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }, { 16384, 16218, 16052, 15886, 15720, 15554, 15389, 15224, 15059, 14895, 14731, 14567, 14403, 14240, 14077, 13915, 13753, 13591, 13429, 13269, 13109, 12950, 12791, 12633, 12476, 12320, 12164, 12009, 11854, 11701, 11548, 11396, 11244, 11092, 10940, 10790, 10640, 10492, 10344, 10198, 10052, 9908, 9764, 9622, 9481, 9342, 9203, 9066, 8929, 8793, 8657, 8524, 8391, 8261, 8131, 8003, 7875, 7749, 7624, 7502, 7380, 7260, 7140, 7022, 6904, 6786, 6668, 6551, 6435, 6322, 6209, 6099, 5989, 5881, 5773, 5668, 5563, 5461, 5359, 5260, 5161, 5063, 4965, 4871, 4777, 4686, 4595, 4506, 4417, 4331, 4245, 4162, 4079, 3999, 3919, 3841, 3763, 3685, 3607, 3530, 3454, 3380, 3307, 3236, 3166, 3097, 3029, 2963, 2897, 2834, 2771, 2710, 2650, 2591, 2532, 2475, 2418, 2363, 2309, 2257, 2205, 2155, 2105, 2057, 2009, 1963, 1918, 1873, 1828, 1783, 1738, 1694, 1650, 1607, 1565, 1524, 1484, 1445, 1407, 1369, 1333, 1297, 1263, 1229, 1197, 1165, 1134, 1103, 1073, 1043, 1015, 987, 960, 933, 907, 882, 858, 834, 811, 788, 766, 744, 722, 700, 679, 658, 638, 618, 599, 581, 563, 545, 528, 511, 495, 480, 465, 451, 437, 423, 410, 397, 384, 372, 360, 348, 337, 326, 315, 305, 295, 285, 275, 265, 255, 245, 236, 227, 219, 211, 203, 195, 188, 181, 174, 167, 161, 155, 149, 143, 137, 131, 126, 121, 116, 111, 106, 101, 97, 93, 89, 85, 81, 77, 73, 69, 65, 61, 58, 55, 52, 49, 46, 43, 40, 37, 34, 32, 30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 5, 4, 3, 2, 1, 0 } }; static const uint16_t * const cf_table[16] = { cf_tables_1[0], cf_tables_1[1], cf_tables_1[2], cf_tables_2[0], cf_tables_2[1], cf_tables_2[2], cf_tables_2[3], cf_tables_2[4], cf_tables_2[5], cf_tables_2[6], cf_tables_2[7], cf_tables_3[0], cf_tables_3[1], cf_tables_3[2], cf_tables_3[3], cf_tables_3[4] }; /** Initializes a given lookup table using a given delta */ static void bgmc_lut_fillp(uint8_t *lut, unsigned int *lut_status, unsigned int delta) { unsigned int sx, i; for (sx = 0; sx < 16; sx++) for (i = 0; i < LUT_SIZE; i++) { unsigned int target = (i + 1) << (FREQ_BITS - LUT_BITS); unsigned int symbol = 1 << delta; while (cf_table[sx][symbol] > target) symbol += 1 << delta; *lut++ = symbol >> delta; } *lut_status = delta; } /** Retunes the index of a suitable lookup table for a given delta */ static uint8_t* bgmc_lut_getp(uint8_t *lut, unsigned int *lut_status, unsigned int delta) { unsigned int i = av_clip(delta, 0, LUT_BUFF - 1); lut += (i * LUT_SIZE) << 4; if (lut_status[i] != delta) bgmc_lut_fillp(lut, &lut_status[i], delta); return lut; } /** Initializes the lookup table arrays */ int ff_bgmc_init(AVCodecContext *avctx, uint8_t **cf_lut, unsigned int **cf_lut_status) { *cf_lut = av_malloc(sizeof(*cf_lut ) * LUT_BUFF * 16 * LUT_SIZE); *cf_lut_status = av_malloc(sizeof(*cf_lut_status) * LUT_BUFF); if (!cf_lut || !cf_lut_status) { ff_bgmc_end(cf_lut, cf_lut_status); av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n"); return AVERROR(ENOMEM); } return 0; } /** Releases the lookup table arrays */ void ff_bgmc_end(uint8_t **cf_lut, unsigned int **cf_lut_status) { av_freep(cf_lut); av_freep(cf_lut_status); } /** Initializes decoding and reads the first value */ void ff_bgmc_decode_init(GetBitContext *gb, unsigned int *h, unsigned int *l, unsigned int *v) { *h = TOP_VALUE; *l = 0; *v = get_bits_long(gb, VALUE_BITS); } /** Finish decoding */ void ff_bgmc_decode_end(GetBitContext *gb) { skip_bits_long(gb, -(VALUE_BITS - 2)); } /** Reads and decodes a block Gilbert-Moore coded symbol */ void ff_bgmc_decode(GetBitContext *gb, unsigned int num, int32_t *dst, unsigned int delta, unsigned int sx, unsigned int *h, unsigned int *l, unsigned int *v, uint8_t *cf_lut, unsigned int *cf_lut_status) { unsigned int i; uint8_t *lut = bgmc_lut_getp(cf_lut, cf_lut_status, delta); // read current state unsigned int high = *h; unsigned int low = *l; unsigned int value = *v; lut += sx * LUT_SIZE; // decode num samples for (i = 0; i < num; i++) { unsigned int range = high - low + 1; unsigned int target = (((value - low + 1) << FREQ_BITS) - 1) / range; unsigned int symbol = lut[target >> (FREQ_BITS - LUT_BITS)] << delta; while (cf_table[sx][symbol] > target) symbol += 1 << delta; symbol = (symbol >> delta) - 1; high = low + ((range * cf_table[sx][(symbol ) << delta] - (1 << FREQ_BITS)) >> FREQ_BITS); low = low + ((range * cf_table[sx][(symbol + 1) << delta] ) >> FREQ_BITS); while (1) { if (high >= HALF) { if (low >= HALF) { value -= HALF; low -= HALF; high -= HALF; } else if (low >= FIRST_QTR && high < THIRD_QTR) { value -= FIRST_QTR; low -= FIRST_QTR; high -= FIRST_QTR; } else break; } low *= 2; high = 2 * high + 1; value = 2 * value + get_bits1(gb); } *dst++ = symbol; } // save current state *h = high; *l = low; *v = value; }
123linslouis-android-video-cutter
jni/libavcodec/bgmc.c
C
asf20
30,056
/* * MSMPEG4 backend for ffmpeg encoder and decoder * copyright (c) 2001 Fabrice Bellard * copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> * * msmpeg4v1 & v2 stuff by Michael Niedermayer <michaelni@gmx.at> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * MSMPEG4 data tables. */ #include "msmpeg4data.h" VLC ff_msmp4_mb_i_vlc; VLC ff_msmp4_dc_luma_vlc[2]; VLC ff_msmp4_dc_chroma_vlc[2]; /* intra picture macroblock coded block pattern */ const uint16_t ff_msmp4_mb_i_table[64][2] = { { 0x1, 1 },{ 0x17, 6 },{ 0x9, 5 },{ 0x5, 5 }, { 0x6, 5 },{ 0x47, 9 },{ 0x20, 7 },{ 0x10, 7 }, { 0x2, 5 },{ 0x7c, 9 },{ 0x3a, 7 },{ 0x1d, 7 }, { 0x2, 6 },{ 0xec, 9 },{ 0x77, 8 },{ 0x0, 8 }, { 0x3, 5 },{ 0xb7, 9 },{ 0x2c, 7 },{ 0x13, 7 }, { 0x1, 6 },{ 0x168, 10 },{ 0x46, 8 },{ 0x3f, 8 }, { 0x1e, 6 },{ 0x712, 13 },{ 0xb5, 9 },{ 0x42, 8 }, { 0x22, 7 },{ 0x1c5, 11 },{ 0x11e, 10 },{ 0x87, 9 }, { 0x6, 4 },{ 0x3, 9 },{ 0x1e, 7 },{ 0x1c, 6 }, { 0x12, 7 },{ 0x388, 12 },{ 0x44, 9 },{ 0x70, 9 }, { 0x1f, 6 },{ 0x23e, 11 },{ 0x39, 8 },{ 0x8e, 9 }, { 0x1, 7 },{ 0x1c6, 11 },{ 0xb6, 9 },{ 0x45, 9 }, { 0x14, 6 },{ 0x23f, 11 },{ 0x7d, 9 },{ 0x18, 9 }, { 0x7, 7 },{ 0x1c7, 11 },{ 0x86, 9 },{ 0x19, 9 }, { 0x15, 6 },{ 0x1db, 10 },{ 0x2, 9 },{ 0x46, 9 }, { 0xd, 8 },{ 0x713, 13 },{ 0x1da, 10 },{ 0x169, 10 }, }; /* non intra picture macroblock coded block pattern + mb type */ const uint32_t table_mb_non_intra[128][2] = { { 0x40, 7 },{ 0x13c9, 13 },{ 0x9fd, 12 },{ 0x1fc, 15 }, { 0x9fc, 12 },{ 0xa83, 18 },{ 0x12d34, 17 },{ 0x83bc, 16 }, { 0x83a, 12 },{ 0x7f8, 17 },{ 0x3fd, 16 },{ 0x3ff, 16 }, { 0x79, 13 },{ 0xa82, 18 },{ 0x969d, 16 },{ 0x2a4, 16 }, { 0x978, 12 },{ 0x543, 17 },{ 0x41df, 15 },{ 0x7f9, 17 }, { 0x12f3, 13 },{ 0x25a6b, 18 },{ 0x25ef9, 18 },{ 0x3fa, 16 }, { 0x20ee, 14 },{ 0x969ab, 20 },{ 0x969c, 16 },{ 0x25ef8, 18 }, { 0x12d2, 13 },{ 0xa85, 18 },{ 0x969e, 16 },{ 0x4bc8, 15 }, { 0x3d, 12 },{ 0x12f7f, 17 },{ 0x2a2, 16 },{ 0x969f, 16 }, { 0x25ee, 14 },{ 0x12d355, 21 },{ 0x12f7d, 17 },{ 0x12f7e, 17 }, { 0x9e5, 12 },{ 0xa81, 18 },{ 0x4b4d4, 19 },{ 0x83bd, 16 }, { 0x78, 13 },{ 0x969b, 16 },{ 0x3fe, 16 },{ 0x2a5, 16 }, { 0x7e, 13 },{ 0xa80, 18 },{ 0x2a3, 16 },{ 0x3fb, 16 }, { 0x1076, 13 },{ 0xa84, 18 },{ 0x153, 15 },{ 0x4bc9, 15 }, { 0x55, 13 },{ 0x12d354, 21 },{ 0x4bde, 15 },{ 0x25e5, 14 }, { 0x25b, 10 },{ 0x4b4c, 15 },{ 0x96b, 12 },{ 0x96a, 12 }, { 0x1, 2 },{ 0x0, 7 },{ 0x26, 6 },{ 0x12b, 9 }, { 0x7, 3 },{ 0x20f, 10 },{ 0x4, 9 },{ 0x28, 12 }, { 0x6, 3 },{ 0x20a, 10 },{ 0x128, 9 },{ 0x2b, 12 }, { 0x11, 5 },{ 0x1b, 11 },{ 0x13a, 9 },{ 0x4ff, 11 }, { 0x3, 4 },{ 0x277, 10 },{ 0x106, 9 },{ 0x839, 12 }, { 0xb, 4 },{ 0x27b, 10 },{ 0x12c, 9 },{ 0x4bf, 11 }, { 0x9, 6 },{ 0x35, 12 },{ 0x27e, 10 },{ 0x13c8, 13 }, { 0x1, 6 },{ 0x4aa, 11 },{ 0x208, 10 },{ 0x29, 12 }, { 0x1, 4 },{ 0x254, 10 },{ 0x12e, 9 },{ 0x838, 12 }, { 0x24, 6 },{ 0x4f3, 11 },{ 0x276, 10 },{ 0x12f6, 13 }, { 0x1, 5 },{ 0x27a, 10 },{ 0x13e, 9 },{ 0x3e, 12 }, { 0x8, 6 },{ 0x413, 11 },{ 0xc, 10 },{ 0x4be, 11 }, { 0x14, 5 },{ 0x412, 11 },{ 0x253, 10 },{ 0x97a, 12 }, { 0x21, 6 },{ 0x4ab, 11 },{ 0x20b, 10 },{ 0x34, 12 }, { 0x15, 5 },{ 0x278, 10 },{ 0x252, 10 },{ 0x968, 12 }, { 0x5, 5 },{ 0xb, 10 },{ 0x9c, 8 },{ 0xe, 10 }, }; /* dc table 0 */ const uint32_t ff_table0_dc_lum[120][2] = { { 0x1, 1 },{ 0x1, 2 },{ 0x1, 4 },{ 0x1, 5 }, { 0x5, 5 },{ 0x7, 5 },{ 0x8, 6 },{ 0xc, 6 }, { 0x0, 7 },{ 0x2, 7 },{ 0x12, 7 },{ 0x1a, 7 }, { 0x3, 8 },{ 0x7, 8 },{ 0x27, 8 },{ 0x37, 8 }, { 0x5, 9 },{ 0x4c, 9 },{ 0x6c, 9 },{ 0x6d, 9 }, { 0x8, 10 },{ 0x19, 10 },{ 0x9b, 10 },{ 0x1b, 10 }, { 0x9a, 10 },{ 0x13, 11 },{ 0x34, 11 },{ 0x35, 11 }, { 0x61, 12 },{ 0x48, 13 },{ 0xc4, 13 },{ 0x4a, 13 }, { 0xc6, 13 },{ 0xc7, 13 },{ 0x92, 14 },{ 0x18b, 14 }, { 0x93, 14 },{ 0x183, 14 },{ 0x182, 14 },{ 0x96, 14 }, { 0x97, 14 },{ 0x180, 14 },{ 0x314, 15 },{ 0x315, 15 }, { 0x605, 16 },{ 0x604, 16 },{ 0x606, 16 },{ 0xc0e, 17 }, { 0x303cd, 23 },{ 0x303c9, 23 },{ 0x303c8, 23 },{ 0x303ca, 23 }, { 0x303cb, 23 },{ 0x303cc, 23 },{ 0x303ce, 23 },{ 0x303cf, 23 }, { 0x303d0, 23 },{ 0x303d1, 23 },{ 0x303d2, 23 },{ 0x303d3, 23 }, { 0x303d4, 23 },{ 0x303d5, 23 },{ 0x303d6, 23 },{ 0x303d7, 23 }, { 0x303d8, 23 },{ 0x303d9, 23 },{ 0x303da, 23 },{ 0x303db, 23 }, { 0x303dc, 23 },{ 0x303dd, 23 },{ 0x303de, 23 },{ 0x303df, 23 }, { 0x303e0, 23 },{ 0x303e1, 23 },{ 0x303e2, 23 },{ 0x303e3, 23 }, { 0x303e4, 23 },{ 0x303e5, 23 },{ 0x303e6, 23 },{ 0x303e7, 23 }, { 0x303e8, 23 },{ 0x303e9, 23 },{ 0x303ea, 23 },{ 0x303eb, 23 }, { 0x303ec, 23 },{ 0x303ed, 23 },{ 0x303ee, 23 },{ 0x303ef, 23 }, { 0x303f0, 23 },{ 0x303f1, 23 },{ 0x303f2, 23 },{ 0x303f3, 23 }, { 0x303f4, 23 },{ 0x303f5, 23 },{ 0x303f6, 23 },{ 0x303f7, 23 }, { 0x303f8, 23 },{ 0x303f9, 23 },{ 0x303fa, 23 },{ 0x303fb, 23 }, { 0x303fc, 23 },{ 0x303fd, 23 },{ 0x303fe, 23 },{ 0x303ff, 23 }, { 0x60780, 24 },{ 0x60781, 24 },{ 0x60782, 24 },{ 0x60783, 24 }, { 0x60784, 24 },{ 0x60785, 24 },{ 0x60786, 24 },{ 0x60787, 24 }, { 0x60788, 24 },{ 0x60789, 24 },{ 0x6078a, 24 },{ 0x6078b, 24 }, { 0x6078c, 24 },{ 0x6078d, 24 },{ 0x6078e, 24 },{ 0x6078f, 24 }, }; const uint32_t ff_table0_dc_chroma[120][2] = { { 0x0, 2 },{ 0x1, 2 },{ 0x5, 3 },{ 0x9, 4 }, { 0xd, 4 },{ 0x11, 5 },{ 0x1d, 5 },{ 0x1f, 5 }, { 0x21, 6 },{ 0x31, 6 },{ 0x38, 6 },{ 0x33, 6 }, { 0x39, 6 },{ 0x3d, 6 },{ 0x61, 7 },{ 0x79, 7 }, { 0x80, 8 },{ 0xc8, 8 },{ 0xca, 8 },{ 0xf0, 8 }, { 0x81, 8 },{ 0xc0, 8 },{ 0xc9, 8 },{ 0x107, 9 }, { 0x106, 9 },{ 0x196, 9 },{ 0x183, 9 },{ 0x1e3, 9 }, { 0x1e2, 9 },{ 0x20a, 10 },{ 0x20b, 10 },{ 0x609, 11 }, { 0x412, 11 },{ 0x413, 11 },{ 0x60b, 11 },{ 0x411, 11 }, { 0x60a, 11 },{ 0x65f, 11 },{ 0x410, 11 },{ 0x65d, 11 }, { 0x65e, 11 },{ 0xcb8, 12 },{ 0xc10, 12 },{ 0xcb9, 12 }, { 0x1823, 13 },{ 0x3045, 14 },{ 0x6089, 15 },{ 0xc110, 16 }, { 0x304448, 22 },{ 0x304449, 22 },{ 0x30444a, 22 },{ 0x30444b, 22 }, { 0x30444c, 22 },{ 0x30444d, 22 },{ 0x30444e, 22 },{ 0x30444f, 22 }, { 0x304450, 22 },{ 0x304451, 22 },{ 0x304452, 22 },{ 0x304453, 22 }, { 0x304454, 22 },{ 0x304455, 22 },{ 0x304456, 22 },{ 0x304457, 22 }, { 0x304458, 22 },{ 0x304459, 22 },{ 0x30445a, 22 },{ 0x30445b, 22 }, { 0x30445c, 22 },{ 0x30445d, 22 },{ 0x30445e, 22 },{ 0x30445f, 22 }, { 0x304460, 22 },{ 0x304461, 22 },{ 0x304462, 22 },{ 0x304463, 22 }, { 0x304464, 22 },{ 0x304465, 22 },{ 0x304466, 22 },{ 0x304467, 22 }, { 0x304468, 22 },{ 0x304469, 22 },{ 0x30446a, 22 },{ 0x30446b, 22 }, { 0x30446c, 22 },{ 0x30446d, 22 },{ 0x30446e, 22 },{ 0x30446f, 22 }, { 0x304470, 22 },{ 0x304471, 22 },{ 0x304472, 22 },{ 0x304473, 22 }, { 0x304474, 22 },{ 0x304475, 22 },{ 0x304476, 22 },{ 0x304477, 22 }, { 0x304478, 22 },{ 0x304479, 22 },{ 0x30447a, 22 },{ 0x30447b, 22 }, { 0x30447c, 22 },{ 0x30447d, 22 },{ 0x30447e, 22 },{ 0x30447f, 22 }, { 0x608880, 23 },{ 0x608881, 23 },{ 0x608882, 23 },{ 0x608883, 23 }, { 0x608884, 23 },{ 0x608885, 23 },{ 0x608886, 23 },{ 0x608887, 23 }, { 0x608888, 23 },{ 0x608889, 23 },{ 0x60888a, 23 },{ 0x60888b, 23 }, { 0x60888c, 23 },{ 0x60888d, 23 },{ 0x60888e, 23 },{ 0x60888f, 23 }, }; /* dc table 1 */ const uint32_t ff_table1_dc_lum[120][2] = { { 0x2, 2 },{ 0x3, 2 },{ 0x3, 3 },{ 0x2, 4 }, { 0x5, 4 },{ 0x1, 5 },{ 0x3, 5 },{ 0x8, 5 }, { 0x0, 6 },{ 0x5, 6 },{ 0xd, 6 },{ 0xf, 6 }, { 0x13, 6 },{ 0x8, 7 },{ 0x18, 7 },{ 0x1c, 7 }, { 0x24, 7 },{ 0x4, 8 },{ 0x6, 8 },{ 0x12, 8 }, { 0x32, 8 },{ 0x3b, 8 },{ 0x4a, 8 },{ 0x4b, 8 }, { 0xb, 9 },{ 0x26, 9 },{ 0x27, 9 },{ 0x66, 9 }, { 0x74, 9 },{ 0x75, 9 },{ 0x14, 10 },{ 0x1c, 10 }, { 0x1f, 10 },{ 0x1d, 10 },{ 0x2b, 11 },{ 0x3d, 11 }, { 0x19d, 11 },{ 0x19f, 11 },{ 0x54, 12 },{ 0x339, 12 }, { 0x338, 12 },{ 0x33d, 12 },{ 0xab, 13 },{ 0xf1, 13 }, { 0x678, 13 },{ 0xf2, 13 },{ 0x1e0, 14 },{ 0x1e1, 14 }, { 0x154, 14 },{ 0xcf2, 14 },{ 0x3cc, 15 },{ 0x2ab, 15 }, { 0x19e7, 15 },{ 0x3ce, 15 },{ 0x19e6, 15 },{ 0x554, 16 }, { 0x79f, 16 },{ 0x555, 16 },{ 0xf3d, 17 },{ 0xf37, 17 }, { 0xf3c, 17 },{ 0xf35, 17 },{ 0x1e6d, 18 },{ 0x1e68, 18 }, { 0x3cd8, 19 },{ 0x3cd3, 19 },{ 0x3cd9, 19 },{ 0x79a4, 20 }, { 0xf34ba, 25 },{ 0xf34b4, 25 },{ 0xf34b5, 25 },{ 0xf34b6, 25 }, { 0xf34b7, 25 },{ 0xf34b8, 25 },{ 0xf34b9, 25 },{ 0xf34bb, 25 }, { 0xf34bc, 25 },{ 0xf34bd, 25 },{ 0xf34be, 25 },{ 0xf34bf, 25 }, { 0x1e6940, 26 },{ 0x1e6941, 26 },{ 0x1e6942, 26 },{ 0x1e6943, 26 }, { 0x1e6944, 26 },{ 0x1e6945, 26 },{ 0x1e6946, 26 },{ 0x1e6947, 26 }, { 0x1e6948, 26 },{ 0x1e6949, 26 },{ 0x1e694a, 26 },{ 0x1e694b, 26 }, { 0x1e694c, 26 },{ 0x1e694d, 26 },{ 0x1e694e, 26 },{ 0x1e694f, 26 }, { 0x1e6950, 26 },{ 0x1e6951, 26 },{ 0x1e6952, 26 },{ 0x1e6953, 26 }, { 0x1e6954, 26 },{ 0x1e6955, 26 },{ 0x1e6956, 26 },{ 0x1e6957, 26 }, { 0x1e6958, 26 },{ 0x1e6959, 26 },{ 0x1e695a, 26 },{ 0x1e695b, 26 }, { 0x1e695c, 26 },{ 0x1e695d, 26 },{ 0x1e695e, 26 },{ 0x1e695f, 26 }, { 0x1e6960, 26 },{ 0x1e6961, 26 },{ 0x1e6962, 26 },{ 0x1e6963, 26 }, { 0x1e6964, 26 },{ 0x1e6965, 26 },{ 0x1e6966, 26 },{ 0x1e6967, 26 }, }; const uint32_t ff_table1_dc_chroma[120][2] = { { 0x0, 2 },{ 0x1, 2 },{ 0x4, 3 },{ 0x7, 3 }, { 0xb, 4 },{ 0xd, 4 },{ 0x15, 5 },{ 0x28, 6 }, { 0x30, 6 },{ 0x32, 6 },{ 0x52, 7 },{ 0x62, 7 }, { 0x66, 7 },{ 0xa6, 8 },{ 0xc6, 8 },{ 0xcf, 8 }, { 0x14f, 9 },{ 0x18e, 9 },{ 0x19c, 9 },{ 0x29d, 10 }, { 0x33a, 10 },{ 0x538, 11 },{ 0x63c, 11 },{ 0x63e, 11 }, { 0x63f, 11 },{ 0x676, 11 },{ 0xa73, 12 },{ 0xc7a, 12 }, { 0xcef, 12 },{ 0x14e5, 13 },{ 0x19dd, 13 },{ 0x29c8, 14 }, { 0x29c9, 14 },{ 0x63dd, 15 },{ 0x33b8, 14 },{ 0x33b9, 14 }, { 0xc7b6, 16 },{ 0x63d8, 15 },{ 0x63df, 15 },{ 0xc7b3, 16 }, { 0xc7b4, 16 },{ 0xc7b5, 16 },{ 0x63de, 15 },{ 0xc7b7, 16 }, { 0xc7b8, 16 },{ 0xc7b9, 16 },{ 0x18f65, 17 },{ 0x31ec8, 18 }, { 0xc7b248, 24 },{ 0xc7b249, 24 },{ 0xc7b24a, 24 },{ 0xc7b24b, 24 }, { 0xc7b24c, 24 },{ 0xc7b24d, 24 },{ 0xc7b24e, 24 },{ 0xc7b24f, 24 }, { 0xc7b250, 24 },{ 0xc7b251, 24 },{ 0xc7b252, 24 },{ 0xc7b253, 24 }, { 0xc7b254, 24 },{ 0xc7b255, 24 },{ 0xc7b256, 24 },{ 0xc7b257, 24 }, { 0xc7b258, 24 },{ 0xc7b259, 24 },{ 0xc7b25a, 24 },{ 0xc7b25b, 24 }, { 0xc7b25c, 24 },{ 0xc7b25d, 24 },{ 0xc7b25e, 24 },{ 0xc7b25f, 24 }, { 0xc7b260, 24 },{ 0xc7b261, 24 },{ 0xc7b262, 24 },{ 0xc7b263, 24 }, { 0xc7b264, 24 },{ 0xc7b265, 24 },{ 0xc7b266, 24 },{ 0xc7b267, 24 }, { 0xc7b268, 24 },{ 0xc7b269, 24 },{ 0xc7b26a, 24 },{ 0xc7b26b, 24 }, { 0xc7b26c, 24 },{ 0xc7b26d, 24 },{ 0xc7b26e, 24 },{ 0xc7b26f, 24 }, { 0xc7b270, 24 },{ 0xc7b271, 24 },{ 0xc7b272, 24 },{ 0xc7b273, 24 }, { 0xc7b274, 24 },{ 0xc7b275, 24 },{ 0xc7b276, 24 },{ 0xc7b277, 24 }, { 0xc7b278, 24 },{ 0xc7b279, 24 },{ 0xc7b27a, 24 },{ 0xc7b27b, 24 }, { 0xc7b27c, 24 },{ 0xc7b27d, 24 },{ 0xc7b27e, 24 },{ 0xc7b27f, 24 }, { 0x18f6480, 25 },{ 0x18f6481, 25 },{ 0x18f6482, 25 },{ 0x18f6483, 25 }, { 0x18f6484, 25 },{ 0x18f6485, 25 },{ 0x18f6486, 25 },{ 0x18f6487, 25 }, { 0x18f6488, 25 },{ 0x18f6489, 25 },{ 0x18f648a, 25 },{ 0x18f648b, 25 }, { 0x18f648c, 25 },{ 0x18f648d, 25 },{ 0x18f648e, 25 },{ 0x18f648f, 25 }, }; /* vlc table 0, for intra luma */ static const uint16_t table0_vlc[133][2] = { { 0x1, 2 },{ 0x6, 3 },{ 0xf, 4 },{ 0x16, 5 }, { 0x20, 6 },{ 0x18, 7 },{ 0x8, 8 },{ 0x9a, 8 }, { 0x56, 9 },{ 0x13e, 9 },{ 0xf0, 10 },{ 0x3a5, 10 }, { 0x77, 11 },{ 0x1ef, 11 },{ 0x9a, 12 },{ 0x5d, 13 }, { 0x1, 4 },{ 0x11, 5 },{ 0x2, 7 },{ 0xb, 8 }, { 0x12, 9 },{ 0x1d6, 9 },{ 0x27e, 10 },{ 0x191, 11 }, { 0xea, 12 },{ 0x3dc, 12 },{ 0x13b, 13 },{ 0x4, 5 }, { 0x14, 7 },{ 0x9e, 8 },{ 0x9, 10 },{ 0x1ac, 11 }, { 0x1e2, 11 },{ 0x3ca, 12 },{ 0x5f, 13 },{ 0x17, 5 }, { 0x4e, 7 },{ 0x5e, 9 },{ 0xf3, 10 },{ 0x1ad, 11 }, { 0xec, 12 },{ 0x5f0, 13 },{ 0xe, 6 },{ 0xe1, 8 }, { 0x3a4, 10 },{ 0x9c, 12 },{ 0x13d, 13 },{ 0x3b, 6 }, { 0x1c, 9 },{ 0x14, 11 },{ 0x9be, 12 },{ 0x6, 7 }, { 0x7a, 9 },{ 0x190, 11 },{ 0x137, 13 },{ 0x1b, 7 }, { 0x8, 10 },{ 0x75c, 11 },{ 0x71, 7 },{ 0xd7, 10 }, { 0x9bf, 12 },{ 0x7, 8 },{ 0xaf, 10 },{ 0x4cc, 11 }, { 0x34, 8 },{ 0x265, 10 },{ 0x9f, 12 },{ 0xe0, 8 }, { 0x16, 11 },{ 0x327, 12 },{ 0x15, 9 },{ 0x17d, 11 }, { 0xebb, 12 },{ 0x14, 9 },{ 0xf6, 10 },{ 0x1e4, 11 }, { 0xcb, 10 },{ 0x99d, 12 },{ 0xca, 10 },{ 0x2fc, 12 }, { 0x17f, 11 },{ 0x4cd, 11 },{ 0x2fd, 12 },{ 0x4fe, 11 }, { 0x13a, 13 },{ 0xa, 4 },{ 0x42, 7 },{ 0x1d3, 9 }, { 0x4dd, 11 },{ 0x12, 5 },{ 0xe8, 8 },{ 0x4c, 11 }, { 0x136, 13 },{ 0x39, 6 },{ 0x264, 10 },{ 0xeba, 12 }, { 0x0, 7 },{ 0xae, 10 },{ 0x99c, 12 },{ 0x1f, 7 }, { 0x4de, 11 },{ 0x43, 7 },{ 0x4dc, 11 },{ 0x3, 8 }, { 0x3cb, 12 },{ 0x6, 8 },{ 0x99e, 12 },{ 0x2a, 8 }, { 0x5f1, 13 },{ 0xf, 8 },{ 0x9fe, 12 },{ 0x33, 8 }, { 0x9ff, 12 },{ 0x98, 8 },{ 0x99f, 12 },{ 0xea, 8 }, { 0x13c, 13 },{ 0x2e, 8 },{ 0x192, 11 },{ 0x136, 9 }, { 0x6a, 9 },{ 0x15, 11 },{ 0x3af, 10 },{ 0x1e3, 11 }, { 0x74, 11 },{ 0xeb, 12 },{ 0x2f9, 12 },{ 0x5c, 13 }, { 0xed, 12 },{ 0x3dd, 12 },{ 0x326, 12 },{ 0x5e, 13 }, { 0x16, 7 }, }; static const int8_t table0_level[132] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 1, 2, 3, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; static const int8_t table0_run[132] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 17, 18, 19, 20, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, }; /* vlc table 1, for intra chroma and P macroblocks */ static const uint16_t table1_vlc[149][2] = { { 0x4, 3 },{ 0x14, 5 },{ 0x17, 7 },{ 0x7f, 8 }, { 0x154, 9 },{ 0x1f2, 10 },{ 0xbf, 11 },{ 0x65, 12 }, { 0xaaa, 12 },{ 0x630, 13 },{ 0x1597, 13 },{ 0x3b7, 14 }, { 0x2b22, 14 },{ 0xbe6, 15 },{ 0xb, 4 },{ 0x37, 7 }, { 0x62, 9 },{ 0x7, 11 },{ 0x166, 12 },{ 0xce, 13 }, { 0x1590, 13 },{ 0x5f6, 14 },{ 0xbe7, 15 },{ 0x7, 5 }, { 0x6d, 8 },{ 0x3, 11 },{ 0x31f, 12 },{ 0x5f2, 14 }, { 0x2, 6 },{ 0x61, 9 },{ 0x55, 12 },{ 0x1df, 14 }, { 0x1a, 6 },{ 0x1e, 10 },{ 0xac9, 12 },{ 0x2b23, 14 }, { 0x1e, 6 },{ 0x1f, 10 },{ 0xac3, 12 },{ 0x2b2b, 14 }, { 0x6, 7 },{ 0x4, 11 },{ 0x2f8, 13 },{ 0x19, 7 }, { 0x6, 11 },{ 0x63d, 13 },{ 0x57, 7 },{ 0x182, 11 }, { 0x2aa2, 14 },{ 0x4, 8 },{ 0x180, 11 },{ 0x59c, 14 }, { 0x7d, 8 },{ 0x164, 12 },{ 0x76d, 15 },{ 0x2, 9 }, { 0x18d, 11 },{ 0x1581, 13 },{ 0xad, 8 },{ 0x60, 12 }, { 0xc67, 14 },{ 0x1c, 9 },{ 0xee, 13 },{ 0x3, 9 }, { 0x2cf, 13 },{ 0xd9, 9 },{ 0x1580, 13 },{ 0x2, 11 }, { 0x183, 11 },{ 0x57, 12 },{ 0x61, 12 },{ 0x31, 11 }, { 0x66, 12 },{ 0x631, 13 },{ 0x632, 13 },{ 0xac, 13 }, { 0x31d, 12 },{ 0x76, 12 },{ 0x3a, 11 },{ 0x165, 12 }, { 0xc66, 14 },{ 0x3, 2 },{ 0x54, 7 },{ 0x2ab, 10 }, { 0x16, 13 },{ 0x5f7, 14 },{ 0x5, 4 },{ 0xf8, 9 }, { 0xaa9, 12 },{ 0x5f, 15 },{ 0x4, 4 },{ 0x1c, 10 }, { 0x1550, 13 },{ 0x4, 5 },{ 0x77, 11 },{ 0x76c, 15 }, { 0xe, 5 },{ 0xa, 12 },{ 0xc, 5 },{ 0x562, 11 }, { 0x4, 6 },{ 0x31c, 12 },{ 0x6, 6 },{ 0xc8, 13 }, { 0xd, 6 },{ 0x1da, 13 },{ 0x7, 6 },{ 0xc9, 13 }, { 0x1, 7 },{ 0x2e, 14 },{ 0x14, 7 },{ 0x1596, 13 }, { 0xa, 7 },{ 0xac2, 12 },{ 0x16, 7 },{ 0x15b, 14 }, { 0x15, 7 },{ 0x15a, 14 },{ 0xf, 8 },{ 0x5e, 15 }, { 0x7e, 8 },{ 0xab, 8 },{ 0x2d, 9 },{ 0xd8, 9 }, { 0xb, 9 },{ 0x14, 10 },{ 0x2b3, 10 },{ 0x1f3, 10 }, { 0x3a, 10 },{ 0x0, 10 },{ 0x58, 10 },{ 0x2e, 9 }, { 0x5e, 10 },{ 0x563, 11 },{ 0xec, 12 },{ 0x54, 12 }, { 0xac1, 12 },{ 0x1556, 13 },{ 0x2fa, 13 },{ 0x181, 11 }, { 0x1557, 13 },{ 0x59d, 14 },{ 0x2aa3, 14 },{ 0x2b2a, 14 }, { 0x1de, 14 },{ 0x63c, 13 },{ 0xcf, 13 },{ 0x1594, 13 }, { 0xd, 9 }, }; static const int8_t table1_level[148] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 1, 2, 3, 4, 1, 2, 3, 1, 2, 3, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; static const int8_t table1_run[148] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 14, 14, 15, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, }; /* third vlc table */ static const uint16_t table2_vlc[186][2] = { { 0x1, 2 },{ 0x5, 3 },{ 0xd, 4 },{ 0x12, 5 }, { 0xe, 6 },{ 0x15, 7 },{ 0x13, 8 },{ 0x3f, 8 }, { 0x4b, 9 },{ 0x11f, 9 },{ 0xb8, 10 },{ 0x3e3, 10 }, { 0x172, 11 },{ 0x24d, 12 },{ 0x3da, 12 },{ 0x2dd, 13 }, { 0x1f55, 13 },{ 0x5b9, 14 },{ 0x3eae, 14 },{ 0x0, 4 }, { 0x10, 5 },{ 0x8, 7 },{ 0x20, 8 },{ 0x29, 9 }, { 0x1f4, 9 },{ 0x233, 10 },{ 0x1e0, 11 },{ 0x12a, 12 }, { 0x3dd, 12 },{ 0x50a, 13 },{ 0x1f29, 13 },{ 0xa42, 14 }, { 0x1272, 15 },{ 0x1737, 15 },{ 0x3, 5 },{ 0x11, 7 }, { 0xc4, 8 },{ 0x4b, 10 },{ 0xb4, 11 },{ 0x7d4, 11 }, { 0x345, 12 },{ 0x2d7, 13 },{ 0x7bf, 13 },{ 0x938, 14 }, { 0xbbb, 14 },{ 0x95e, 15 },{ 0x13, 5 },{ 0x78, 7 }, { 0x69, 9 },{ 0x232, 10 },{ 0x461, 11 },{ 0x3ec, 12 }, { 0x520, 13 },{ 0x1f2a, 13 },{ 0x3e50, 14 },{ 0x3e51, 14 }, { 0x1486, 15 },{ 0xc, 6 },{ 0x24, 9 },{ 0x94, 11 }, { 0x8c0, 12 },{ 0xf09, 14 },{ 0x1ef0, 15 },{ 0x3d, 6 }, { 0x53, 9 },{ 0x1a0, 11 },{ 0x2d6, 13 },{ 0xf08, 14 }, { 0x13, 7 },{ 0x7c, 9 },{ 0x7c1, 11 },{ 0x4ac, 14 }, { 0x1b, 7 },{ 0xa0, 10 },{ 0x344, 12 },{ 0xf79, 14 }, { 0x79, 7 },{ 0x3e1, 10 },{ 0x2d4, 13 },{ 0x2306, 14 }, { 0x21, 8 },{ 0x23c, 10 },{ 0xfae, 12 },{ 0x23de, 14 }, { 0x35, 8 },{ 0x175, 11 },{ 0x7b3, 13 },{ 0xc5, 8 }, { 0x174, 11 },{ 0x785, 13 },{ 0x48, 9 },{ 0x1a3, 11 }, { 0x49e, 13 },{ 0x2c, 9 },{ 0xfa, 10 },{ 0x7d6, 11 }, { 0x92, 10 },{ 0x5cc, 13 },{ 0x1ef1, 15 },{ 0xa3, 10 }, { 0x3ed, 12 },{ 0x93e, 14 },{ 0x1e2, 11 },{ 0x1273, 15 }, { 0x7c4, 11 },{ 0x1487, 15 },{ 0x291, 12 },{ 0x293, 12 }, { 0xf8a, 12 },{ 0x509, 13 },{ 0x508, 13 },{ 0x78d, 13 }, { 0x7be, 13 },{ 0x78c, 13 },{ 0x4ae, 14 },{ 0xbba, 14 }, { 0x2307, 14 },{ 0xb9a, 14 },{ 0x1736, 15 },{ 0xe, 4 }, { 0x45, 7 },{ 0x1f3, 9 },{ 0x47a, 11 },{ 0x5dc, 13 }, { 0x23df, 14 },{ 0x19, 5 },{ 0x28, 9 },{ 0x176, 11 }, { 0x49d, 13 },{ 0x23dd, 14 },{ 0x30, 6 },{ 0xa2, 10 }, { 0x2ef, 12 },{ 0x5b8, 14 },{ 0x3f, 6 },{ 0xa5, 10 }, { 0x3db, 12 },{ 0x93f, 14 },{ 0x44, 7 },{ 0x7cb, 11 }, { 0x95f, 15 },{ 0x63, 7 },{ 0x3c3, 12 },{ 0x15, 8 }, { 0x8f6, 12 },{ 0x17, 8 },{ 0x498, 13 },{ 0x2c, 8 }, { 0x7b2, 13 },{ 0x2f, 8 },{ 0x1f54, 13 },{ 0x8d, 8 }, { 0x7bd, 13 },{ 0x8e, 8 },{ 0x1182, 13 },{ 0xfb, 8 }, { 0x50b, 13 },{ 0x2d, 8 },{ 0x7c0, 11 },{ 0x79, 9 }, { 0x1f5f, 13 },{ 0x7a, 9 },{ 0x1f56, 13 },{ 0x231, 10 }, { 0x3e4, 10 },{ 0x1a1, 11 },{ 0x143, 11 },{ 0x1f7, 11 }, { 0x16f, 12 },{ 0x292, 12 },{ 0x2e7, 12 },{ 0x16c, 12 }, { 0x16d, 12 },{ 0x3dc, 12 },{ 0xf8b, 12 },{ 0x499, 13 }, { 0x3d8, 12 },{ 0x78e, 13 },{ 0x2d5, 13 },{ 0x1f5e, 13 }, { 0x1f2b, 13 },{ 0x78f, 13 },{ 0x4ad, 14 },{ 0x3eaf, 14 }, { 0x23dc, 14 },{ 0x4a, 9 }, }; static const int8_t table2_level[185] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; static const int8_t table2_run[185] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 17, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, }; /* second non intra vlc table */ static const uint16_t table4_vlc[169][2] = { { 0x0, 3 },{ 0x3, 4 },{ 0xb, 5 },{ 0x14, 6 }, { 0x3f, 6 },{ 0x5d, 7 },{ 0xa2, 8 },{ 0xac, 9 }, { 0x16e, 9 },{ 0x20a, 10 },{ 0x2e2, 10 },{ 0x432, 11 }, { 0x5c9, 11 },{ 0x827, 12 },{ 0xb54, 12 },{ 0x4e6, 13 }, { 0x105f, 13 },{ 0x172a, 13 },{ 0x20b2, 14 },{ 0x2d4e, 14 }, { 0x39f0, 14 },{ 0x4175, 15 },{ 0x5a9e, 15 },{ 0x4, 4 }, { 0x1e, 5 },{ 0x42, 7 },{ 0xb6, 8 },{ 0x173, 9 }, { 0x395, 10 },{ 0x72e, 11 },{ 0xb94, 12 },{ 0x16a4, 13 }, { 0x20b3, 14 },{ 0x2e45, 14 },{ 0x5, 5 },{ 0x40, 7 }, { 0x49, 9 },{ 0x28f, 10 },{ 0x5cb, 11 },{ 0x48a, 13 }, { 0x9dd, 14 },{ 0x73e2, 15 },{ 0x18, 5 },{ 0x25, 8 }, { 0x8a, 10 },{ 0x51b, 11 },{ 0xe5f, 12 },{ 0x9c9, 14 }, { 0x139c, 15 },{ 0x29, 6 },{ 0x4f, 9 },{ 0x412, 11 }, { 0x48d, 13 },{ 0x2e41, 14 },{ 0x38, 6 },{ 0x10e, 9 }, { 0x5a8, 11 },{ 0x105c, 13 },{ 0x39f2, 14 },{ 0x58, 7 }, { 0x21f, 10 },{ 0xe7e, 12 },{ 0x39ff, 14 },{ 0x23, 8 }, { 0x2e3, 10 },{ 0x4e5, 13 },{ 0x2e40, 14 },{ 0xa1, 8 }, { 0x5be, 11 },{ 0x9c8, 14 },{ 0x83, 8 },{ 0x13a, 11 }, { 0x1721, 13 },{ 0x44, 9 },{ 0x276, 12 },{ 0x39f6, 14 }, { 0x8b, 10 },{ 0x4ef, 13 },{ 0x5a9b, 15 },{ 0x208, 10 }, { 0x1cfe, 13 },{ 0x399, 10 },{ 0x1cb4, 13 },{ 0x39e, 10 }, { 0x39f3, 14 },{ 0x5ab, 11 },{ 0x73e3, 15 },{ 0x737, 11 }, { 0x5a9f, 15 },{ 0x82d, 12 },{ 0xe69, 12 },{ 0xe68, 12 }, { 0x433, 11 },{ 0xb7b, 12 },{ 0x2df8, 14 },{ 0x2e56, 14 }, { 0x2e57, 14 },{ 0x39f7, 14 },{ 0x51a5, 15 },{ 0x3, 3 }, { 0x2a, 6 },{ 0xe4, 8 },{ 0x28e, 10 },{ 0x735, 11 }, { 0x1058, 13 },{ 0x1cfa, 13 },{ 0x2df9, 14 },{ 0x4174, 15 }, { 0x9, 4 },{ 0x54, 8 },{ 0x398, 10 },{ 0x48b, 13 }, { 0x139d, 15 },{ 0xd, 4 },{ 0xad, 9 },{ 0x826, 12 }, { 0x2d4c, 14 },{ 0x11, 5 },{ 0x16b, 9 },{ 0xb7f, 12 }, { 0x51a4, 15 },{ 0x19, 5 },{ 0x21b, 10 },{ 0x16fd, 13 }, { 0x1d, 5 },{ 0x394, 10 },{ 0x28d3, 14 },{ 0x2b, 6 }, { 0x5bc, 11 },{ 0x5a9a, 15 },{ 0x2f, 6 },{ 0x247, 12 }, { 0x10, 7 },{ 0xa35, 12 },{ 0x3e, 6 },{ 0xb7a, 12 }, { 0x59, 7 },{ 0x105e, 13 },{ 0x26, 8 },{ 0x9cf, 14 }, { 0x55, 8 },{ 0x1cb5, 13 },{ 0x57, 8 },{ 0xe5b, 12 }, { 0xa0, 8 },{ 0x1468, 13 },{ 0x170, 9 },{ 0x90, 10 }, { 0x1ce, 9 },{ 0x21a, 10 },{ 0x218, 10 },{ 0x168, 9 }, { 0x21e, 10 },{ 0x244, 12 },{ 0x736, 11 },{ 0x138, 11 }, { 0x519, 11 },{ 0xe5e, 12 },{ 0x72c, 11 },{ 0xb55, 12 }, { 0x9dc, 14 },{ 0x20bb, 14 },{ 0x48c, 13 },{ 0x1723, 13 }, { 0x2e44, 14 },{ 0x16a5, 13 },{ 0x518, 11 },{ 0x39fe, 14 }, { 0x169, 9 }, }; static const int8_t table4_level[168] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; static const int8_t table4_run[168] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, }; extern const uint16_t inter_vlc[103][2]; extern const int8_t inter_level[102]; extern const int8_t inter_run[102]; extern const uint16_t ff_mpeg4_intra_vlc[103][2]; extern const int8_t ff_mpeg4_intra_level[102]; extern const int8_t ff_mpeg4_intra_run[102]; RLTable rl_table[NB_RL_TABLES] = { /* intra luminance tables */ /* low motion */ { 132, 85, table0_vlc, table0_run, table0_level, }, /* high motion */ { 185, 119, table2_vlc, table2_run, table2_level, }, /* mid-rate */ { 102, 67, ff_mpeg4_intra_vlc, ff_mpeg4_intra_run, ff_mpeg4_intra_level, }, /* intra chrominance / non intra tables */ /* low motion inter */ { 148, 81, table1_vlc, table1_run, table1_level, }, /* high motion inter */ { 168, 99, table4_vlc, table4_run, table4_level, }, /* mid rate inter */ { 102, 58, inter_vlc, inter_run, inter_level, }, }; /* motion vector table 0 */ static const uint16_t table0_mv_code[1100] = { 0x0001, 0x0003, 0x0005, 0x0007, 0x0003, 0x0008, 0x000c, 0x0001, 0x0002, 0x001b, 0x0006, 0x000b, 0x0015, 0x0002, 0x000e, 0x000f, 0x0014, 0x0020, 0x0022, 0x0025, 0x0027, 0x0029, 0x002d, 0x004b, 0x004d, 0x0003, 0x0022, 0x0023, 0x0025, 0x0027, 0x0042, 0x0048, 0x0049, 0x0050, 0x005c, 0x0091, 0x009f, 0x000e, 0x0043, 0x004c, 0x0054, 0x0056, 0x008c, 0x0098, 0x009a, 0x009b, 0x00b1, 0x00b2, 0x0120, 0x0121, 0x0126, 0x0133, 0x0139, 0x01a1, 0x01a4, 0x01a5, 0x01a6, 0x01a7, 0x01ae, 0x01af, 0x000b, 0x0019, 0x0085, 0x0090, 0x009b, 0x00aa, 0x00af, 0x010c, 0x010e, 0x011c, 0x011e, 0x0133, 0x0144, 0x0160, 0x0174, 0x0175, 0x0177, 0x0178, 0x0249, 0x024b, 0x0252, 0x0261, 0x0265, 0x0270, 0x0352, 0x0353, 0x0355, 0x0359, 0x0010, 0x0011, 0x0013, 0x0034, 0x0035, 0x0036, 0x0037, 0x003d, 0x003e, 0x0109, 0x0126, 0x0156, 0x021a, 0x021e, 0x023a, 0x023e, 0x028e, 0x028f, 0x02cf, 0x0491, 0x0494, 0x049f, 0x04a0, 0x04a3, 0x04a6, 0x04a7, 0x04ad, 0x04ae, 0x04c0, 0x04c4, 0x04c6, 0x04c8, 0x04c9, 0x04f5, 0x04f6, 0x04f7, 0x0680, 0x0682, 0x0683, 0x0688, 0x0689, 0x068d, 0x068e, 0x068f, 0x06a2, 0x06a3, 0x06a9, 0x06b0, 0x06b1, 0x06b4, 0x06b5, 0x0024, 0x0060, 0x0063, 0x0078, 0x0079, 0x0211, 0x0244, 0x0245, 0x0247, 0x0248, 0x0249, 0x024a, 0x024b, 0x026b, 0x02af, 0x02b8, 0x02bb, 0x0436, 0x0476, 0x0477, 0x047e, 0x04c8, 0x04c9, 0x04ca, 0x0514, 0x0586, 0x0587, 0x0598, 0x059d, 0x05d9, 0x05da, 0x0920, 0x0921, 0x093b, 0x093c, 0x093d, 0x0942, 0x0943, 0x0944, 0x0945, 0x0959, 0x095e, 0x095f, 0x0982, 0x0983, 0x098e, 0x098f, 0x09c4, 0x09e7, 0x09e8, 0x09e9, 0x0d02, 0x0d17, 0x0d18, 0x0d19, 0x0d41, 0x0d42, 0x0d43, 0x0d50, 0x0d5f, 0x0d6d, 0x0d6e, 0x0d6f, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x041e, 0x041f, 0x0420, 0x0421, 0x048c, 0x048d, 0x04d3, 0x04d4, 0x04d5, 0x055c, 0x055d, 0x0572, 0x0573, 0x0574, 0x0575, 0x08de, 0x08df, 0x08fe, 0x08ff, 0x0996, 0x0a36, 0x0a37, 0x0b08, 0x0b09, 0x0b0a, 0x0b0b, 0x0b32, 0x0b33, 0x0b34, 0x0b35, 0x0b36, 0x0b37, 0x0b38, 0x0b39, 0x0bb0, 0x0bf7, 0x0bf8, 0x0bf9, 0x0bfa, 0x0bfb, 0x0bfc, 0x0bfd, 0x0bfe, 0x0bff, 0x1254, 0x1255, 0x1256, 0x1257, 0x1270, 0x1271, 0x1272, 0x1273, 0x1274, 0x1275, 0x12ab, 0x12ac, 0x12ad, 0x12ae, 0x12af, 0x12b0, 0x12b1, 0x1315, 0x1316, 0x1317, 0x13bf, 0x13c0, 0x13c1, 0x13c2, 0x13c3, 0x13c4, 0x13c5, 0x13c6, 0x13c7, 0x13c8, 0x13c9, 0x13ca, 0x13cb, 0x13cc, 0x13cd, 0x1a06, 0x1a07, 0x1a28, 0x1a29, 0x1a2a, 0x1a2b, 0x1a2c, 0x1a2d, 0x1a80, 0x1abb, 0x1abc, 0x1abd, 0x1ad8, 0x1ad9, 0x0094, 0x0095, 0x0096, 0x0097, 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x0831, 0x0832, 0x0833, 0x0834, 0x0835, 0x0836, 0x0837, 0x0838, 0x0839, 0x083a, 0x083b, 0x0939, 0x093a, 0x093b, 0x093c, 0x093d, 0x093e, 0x093f, 0x09a0, 0x09a1, 0x09a2, 0x09a3, 0x09a4, 0x09a5, 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2, 0x11b3, 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba, 0x11bb, 0x132f, 0x1454, 0x1455, 0x1456, 0x1457, 0x1458, 0x1459, 0x145a, 0x145b, 0x145c, 0x145d, 0x145e, 0x145f, 0x1460, 0x1461, 0x1462, 0x1463, 0x1464, 0x1465, 0x1466, 0x1467, 0x1468, 0x1469, 0x146a, 0x146b, 0x17de, 0x17df, 0x17e0, 0x17e1, 0x17e2, 0x17e3, 0x17e4, 0x17e5, 0x17e6, 0x17e7, 0x17e8, 0x17e9, 0x17ea, 0x17eb, 0x17ec, 0x17ed, 0x2540, 0x2541, 0x2542, 0x2543, 0x2544, 0x2545, 0x2546, 0x2547, 0x2548, 0x2549, 0x254a, 0x254b, 0x254c, 0x254d, 0x254e, 0x254f, 0x2550, 0x2551, 0x2552, 0x2553, 0x2554, 0x2555, 0x2628, 0x2766, 0x2767, 0x2768, 0x2769, 0x276a, 0x276b, 0x276c, 0x276d, 0x276e, 0x276f, 0x2770, 0x2771, 0x2772, 0x2773, 0x2774, 0x2775, 0x2776, 0x2777, 0x2778, 0x2779, 0x277a, 0x277b, 0x277c, 0x277d, 0x3503, 0x3544, 0x3545, 0x3546, 0x3547, 0x3560, 0x3561, 0x3562, 0x3563, 0x3564, 0x3565, 0x3566, 0x3567, 0x3568, 0x3569, 0x356a, 0x356b, 0x356c, 0x356d, 0x356e, 0x356f, 0x3570, 0x3571, 0x3572, 0x3573, 0x3574, 0x3575, 0x03f0, 0x103d, 0x103e, 0x103f, 0x1040, 0x1041, 0x1042, 0x1043, 0x1044, 0x1045, 0x1046, 0x1047, 0x1048, 0x1049, 0x104a, 0x104b, 0x104c, 0x104d, 0x104e, 0x104f, 0x1050, 0x1051, 0x1052, 0x1053, 0x1054, 0x1055, 0x1056, 0x1057, 0x1058, 0x1059, 0x105a, 0x105b, 0x105c, 0x105d, 0x105e, 0x105f, 0x1060, 0x1061, 0x1270, 0x1271, 0x21b8, 0x21b9, 0x21ba, 0x21bb, 0x21bc, 0x21bd, 0x21be, 0x21bf, 0x21f0, 0x21f1, 0x21f2, 0x21f3, 0x21f4, 0x21f5, 0x21f6, 0x21f7, 0x21f8, 0x21f9, 0x21fa, 0x21fb, 0x21fc, 0x21fd, 0x21fe, 0x21ff, 0x2340, 0x2341, 0x2342, 0x2343, 0x2344, 0x2345, 0x2346, 0x2347, 0x2348, 0x2349, 0x234a, 0x234b, 0x234c, 0x234d, 0x234e, 0x234f, 0x2350, 0x2351, 0x2352, 0x2353, 0x2354, 0x2355, 0x2356, 0x2357, 0x265c, 0x2f88, 0x2f89, 0x2f8a, 0x2f8b, 0x2f8c, 0x2f8d, 0x2f8e, 0x2f8f, 0x2f90, 0x2f91, 0x2f92, 0x2f93, 0x2f94, 0x2f95, 0x2f96, 0x2f97, 0x2f98, 0x2f99, 0x2f9a, 0x2f9b, 0x2f9c, 0x2f9d, 0x2f9e, 0x2f9f, 0x2fa0, 0x2fa1, 0x2fa2, 0x2fa3, 0x2fa4, 0x2fa5, 0x2fa6, 0x2fa7, 0x2fa8, 0x2fa9, 0x2faa, 0x2fab, 0x2fac, 0x2fad, 0x2fae, 0x2faf, 0x2fb0, 0x2fb1, 0x2fb2, 0x2fb3, 0x2fb4, 0x2fb5, 0x2fb6, 0x2fb7, 0x2fb8, 0x2fb9, 0x2fba, 0x2fbb, 0x4c52, 0x4c53, 0x4e28, 0x4e29, 0x4e2a, 0x4e2b, 0x4e2c, 0x4e2d, 0x4e2e, 0x4e2f, 0x4e30, 0x4e31, 0x4e32, 0x4e33, 0x4e34, 0x4e35, 0x4e36, 0x4e37, 0x4e38, 0x4e39, 0x4e3a, 0x4e3b, 0x4e3c, 0x4e3d, 0x4e3e, 0x4e3f, 0x4e80, 0x4e81, 0x4e82, 0x4e83, 0x4e84, 0x4e85, 0x4e86, 0x4e87, 0x4e88, 0x4e89, 0x4e8a, 0x4e8b, 0x4e8c, 0x4e8d, 0x4e8e, 0x4e8f, 0x4e90, 0x4e91, 0x4e92, 0x4e93, 0x4e94, 0x4e95, 0x4e96, 0x4e97, 0x4e98, 0x4e99, 0x4e9a, 0x4e9b, 0x4e9c, 0x4e9d, 0x4e9e, 0x4e9f, 0x4ea0, 0x4ea1, 0x4ea2, 0x4ea3, 0x4ea4, 0x4ea5, 0x4ea6, 0x4ea7, 0x4ea8, 0x4ea9, 0x4eaa, 0x4eab, 0x4eac, 0x4ead, 0x4eae, 0x4eaf, 0x4eb0, 0x4eb1, 0x4eb2, 0x4eb3, 0x4eb4, 0x4eb5, 0x4eb6, 0x4eb7, 0x4eb8, 0x4eb9, 0x4eba, 0x4ebb, 0x4ebc, 0x4ebd, 0x4ebe, 0x4ebf, 0x4ec0, 0x4ec1, 0x4ec2, 0x4ec3, 0x4ec4, 0x4ec5, 0x4ec6, 0x4ec7, 0x4ec8, 0x4ec9, 0x4eca, 0x4ecb, 0x6a04, 0x6a05, 0x07e2, 0x07e3, 0x07e4, 0x07e5, 0x07e6, 0x07e7, 0x07e8, 0x07e9, 0x07ea, 0x07eb, 0x07ec, 0x07ed, 0x07ee, 0x07ef, 0x07f0, 0x07f1, 0x07f2, 0x07f3, 0x07f4, 0x07f5, 0x07f6, 0x07f7, 0x07f8, 0x07f9, 0x07fa, 0x07fb, 0x07fc, 0x07fd, 0x07fe, 0x07ff, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200a, 0x200b, 0x200c, 0x200d, 0x200e, 0x200f, 0x2010, 0x2011, 0x2012, 0x2013, 0x2014, 0x2015, 0x2016, 0x2017, 0x2018, 0x2019, 0x201a, 0x201b, 0x201c, 0x201d, 0x201e, 0x201f, 0x2020, 0x2021, 0x2022, 0x2023, 0x2024, 0x2025, 0x2026, 0x2027, 0x2028, 0x2029, 0x202a, 0x202b, 0x202c, 0x202d, 0x202e, 0x202f, 0x2030, 0x2031, 0x2032, 0x2033, 0x2034, 0x2035, 0x2036, 0x2037, 0x2038, 0x2039, 0x203a, 0x203b, 0x203c, 0x203d, 0x203e, 0x203f, 0x2040, 0x2041, 0x2042, 0x2043, 0x2044, 0x2045, 0x2046, 0x2047, 0x2048, 0x2049, 0x204a, 0x204b, 0x204c, 0x204d, 0x204e, 0x204f, 0x2050, 0x2051, 0x2052, 0x2053, 0x2054, 0x2055, 0x2056, 0x2057, 0x2058, 0x2059, 0x205a, 0x205b, 0x205c, 0x205d, 0x205e, 0x205f, 0x2060, 0x2061, 0x2062, 0x2063, 0x2064, 0x2065, 0x2066, 0x2067, 0x2068, 0x2069, 0x206a, 0x206b, 0x206c, 0x206d, 0x206e, 0x206f, 0x2070, 0x2071, 0x2072, 0x2073, 0x2074, 0x2075, 0x2076, 0x2077, 0x2078, 0x2079, 0x4cba, 0x4cbb, 0x5d88, 0x5d89, 0x5d8a, 0x5d8b, 0x5d8c, 0x5d8d, 0x5d8e, 0x5d8f, 0x5db0, 0x5db1, 0x5db2, 0x5db3, 0x5db4, 0x5db5, 0x5db6, 0x5db7, 0x5db8, 0x5db9, 0x5dba, 0x5dbb, 0x5dbc, 0x5dbd, 0x5dbe, 0x5dbf, 0x5e40, 0x5e41, 0x5e42, 0x5e43, 0x5e44, 0x5e45, 0x5e46, 0x5e47, 0x5e48, 0x5e49, 0x5e4a, 0x5e4b, 0x5e4c, 0x5e4d, 0x5e4e, 0x5e4f, 0x5e50, 0x5e51, 0x5e52, 0x5e53, 0x5e54, 0x5e55, 0x5e56, 0x5e57, 0x5e58, 0x5e59, 0x5e5a, 0x5e5b, 0x5e5c, 0x5e5d, 0x5e5e, 0x5e5f, 0x5e60, 0x5e61, 0x5e62, 0x5e63, 0x5e64, 0x5e65, 0x5e66, 0x5e67, 0x5e68, 0x5e69, 0x5e6a, 0x5e6b, 0x5e6c, 0x5e6d, 0x5e6e, 0x5e6f, 0x5e70, 0x5e71, 0x5e72, 0x5e73, 0x5e74, 0x5e75, 0x5e76, 0x5e77, 0x5e78, 0x5e79, 0x5e7a, 0x5e7b, 0x5e7c, 0x5e7d, 0x5e7e, 0x5e7f, 0x5e80, 0x5e81, 0x5e82, 0x5e83, 0x5e84, 0x5e85, 0x5e86, 0x5e87, 0x5e88, 0x5e89, 0x5e8a, 0x5e8b, 0x5e8c, 0x5e8d, 0x5e8e, 0x5e8f, 0x5e90, 0x5e91, 0x5e92, 0x5e93, 0x5e94, 0x5e95, 0x5e96, 0x5e97, 0x5e98, 0x5e99, 0x5e9a, 0x5e9b, 0x5e9c, 0x5e9d, 0x5e9e, 0x5e9f, 0x5ea0, 0x5ea1, 0x5ea2, 0x5ea3, 0x5ea4, 0x5ea5, 0x5ea6, 0x5ea7, 0x5ea8, 0x5ea9, 0x5eaa, 0x5eab, 0x5eac, 0x5ead, 0x5eae, 0x5eaf, 0x5eb0, 0x5eb1, 0x5eb2, 0x5eb3, 0x5eb4, 0x5eb5, 0x5eb6, 0x5eb7, 0x5eb8, 0x5eb9, 0x5eba, 0x5ebb, 0x5ebc, 0x5ebd, 0x5ebe, 0x5ebf, 0x5ec0, 0x5ec1, 0x5ec2, 0x5ec3, 0x5ec4, 0x5ec5, 0x5ec6, 0x5ec7, 0x5ec8, 0x5ec9, 0x5eca, 0x5ecb, 0x5ecc, 0x5ecd, 0x5ece, 0x5ecf, 0x5ed0, 0x5ed1, 0x5ed2, 0x5ed3, 0x5ed4, 0x5ed5, 0x5ed6, 0x5ed7, 0x5ed8, 0x5ed9, 0x5eda, 0x5edb, 0x5edc, 0x5edd, 0x5ede, 0x5edf, 0x5ee0, 0x5ee1, 0x5ee2, 0x5ee3, 0x5ee4, 0x5ee5, 0x5ee6, 0x5ee7, 0x5ee8, 0x5ee9, 0x5eea, 0x5eeb, 0x5eec, 0x5eed, 0x5eee, 0x5eef, 0x5ef0, 0x5ef1, 0x5ef2, 0x5ef3, 0x5ef4, 0x5ef5, 0x5ef6, 0x5ef7, 0x5ef8, 0x5ef9, 0x5efa, 0x5efb, 0x5efc, 0x5efd, 0x5efe, 0x5eff, 0x5f00, 0x5f01, 0x5f02, 0x5f03, 0x5f04, 0x5f05, 0x5f06, 0x5f07, 0x5f08, 0x5f09, 0x5f0a, 0x5f0b, 0x5f0c, 0x5f0d, 0x5f0e, 0x5f0f, 0x0000, }; static const uint8_t table0_mv_bits[1100] = { 1, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 8, }; static const uint8_t table0_mvx[1099] = { 32, 32, 31, 32, 33, 31, 33, 31, 33, 32, 34, 32, 30, 32, 31, 34, 35, 32, 34, 33, 29, 33, 30, 30, 31, 31, 35, 29, 33, 35, 33, 34, 31, 29, 30, 34, 30, 36, 28, 32, 34, 37, 30, 27, 32, 25, 39, 32, 34, 32, 35, 35, 35, 31, 35, 29, 32, 29, 30, 29, 37, 27, 36, 38, 37, 33, 32, 31, 29, 31, 28, 36, 33, 30, 34, 33, 33, 28, 27, 25, 31, 26, 39, 32, 32, 31, 33, 39, 31, 38, 28, 36, 21, 23, 43, 36, 34, 41, 30, 25, 28, 31, 30, 34, 38, 35, 61, 34, 28, 30, 37, 37, 35, 27, 36, 3, 59, 38, 37, 32, 31, 29, 26, 33, 37, 33, 27, 27, 35, 34, 34, 40, 42, 33, 32, 29, 4, 5, 28, 24, 25, 35, 39, 38, 32, 23, 27, 32, 30, 35, 26, 34, 60, 36, 29, 22, 26, 41, 7, 30, 38, 30, 36, 29, 30, 41, 26, 25, 32, 34, 24, 39, 1, 25, 39, 32, 28, 29, 32, 38, 26, 36, 28, 63, 28, 39, 23, 21, 26, 35, 31, 35, 57, 31, 29, 29, 28, 30, 27, 35, 2, 38, 40, 34, 37, 29, 38, 43, 26, 32, 33, 42, 24, 40, 28, 32, 32, 32, 36, 32, 43, 25, 21, 31, 30, 31, 41, 29, 33, 37, 26, 37, 27, 59, 23, 33, 35, 31, 31, 37, 38, 39, 32, 23, 32, 27, 37, 36, 31, 40, 25, 27, 38, 31, 36, 28, 31, 36, 25, 45, 3, 34, 38, 39, 40, 38, 30, 32, 19, 24, 25, 26, 45, 20, 24, 33, 33, 31, 41, 34, 39, 47, 40, 58, 59, 41, 33, 3, 17, 61, 42, 30, 26, 29, 36, 61, 33, 37, 62, 28, 25, 38, 25, 38, 17, 23, 34, 33, 21, 33, 49, 27, 32, 23, 27, 22, 24, 22, 39, 43, 27, 37, 6, 42, 47, 26, 30, 31, 41, 39, 33, 22, 45, 36, 32, 45, 19, 22, 30, 5, 5, 17, 29, 22, 31, 31, 43, 37, 27, 32, 32, 32, 33, 34, 43, 35, 29, 26, 22, 32, 19, 32, 25, 31, 41, 49, 28, 34, 28, 39, 34, 19, 37, 38, 29, 21, 36, 42, 24, 48, 16, 28, 49, 22, 34, 31, 38, 39, 44, 11, 35, 30, 33, 33, 23, 28, 33, 46, 15, 13, 24, 41, 24, 34, 34, 30, 26, 24, 14, 60, 21, 29, 39, 23, 35, 37, 63, 45, 33, 34, 47, 41, 22, 42, 35, 35, 23, 32, 35, 43, 32, 7, 31, 41, 20, 31, 16, 13, 63, 25, 30, 32, 35, 30, 30, 31, 42, 47, 39, 38, 40, 40, 51, 55, 56, 18, 21, 39, 39, 33, 17, 41, 23, 24, 43, 25, 31, 20, 19, 45, 1, 34, 31, 22, 35, 15, 46, 46, 35, 31, 28, 29, 29, 23, 41, 27, 14, 53, 53, 27, 24, 32, 57, 32, 17, 42, 37, 29, 33, 1, 25, 32, 32, 63, 26, 40, 44, 36, 31, 39, 20, 20, 44, 23, 33, 34, 35, 33, 33, 28, 41, 23, 41, 41, 29, 25, 26, 49, 29, 24, 37, 49, 50, 51, 51, 26, 39, 25, 26, 15, 39, 18, 42, 17, 4, 31, 32, 32, 60, 1, 42, 32, 0, 12, 19, 35, 21, 41, 17, 26, 20, 45, 46, 32, 37, 22, 47, 29, 31, 27, 29, 30, 21, 33, 35, 18, 25, 33, 50, 51, 42, 2, 15, 51, 53, 33, 25, 29, 55, 37, 38, 33, 38, 59, 38, 33, 39, 13, 32, 40, 61, 61, 32, 9, 44, 3, 31, 29, 25, 31, 27, 23, 9, 25, 9, 29, 20, 30, 30, 42, 18, 28, 25, 28, 28, 21, 29, 43, 29, 43, 26, 44, 44, 21, 38, 21, 24, 45, 45, 35, 39, 22, 35, 36, 34, 34, 45, 34, 29, 31, 46, 25, 46, 16, 17, 31, 20, 32, 47, 47, 47, 32, 49, 49, 49, 31, 1, 27, 28, 39, 39, 21, 36, 23, 51, 2, 40, 51, 32, 53, 24, 30, 24, 30, 21, 40, 57, 57, 31, 41, 58, 32, 12, 4, 32, 34, 59, 31, 32, 13, 9, 35, 26, 35, 37, 61, 37, 63, 26, 29, 41, 38, 23, 20, 41, 26, 41, 42, 42, 42, 26, 26, 26, 26, 1, 26, 37, 37, 37, 23, 34, 42, 27, 43, 34, 27, 31, 24, 33, 16, 3, 31, 24, 33, 24, 4, 44, 44, 11, 44, 31, 13, 13, 44, 45, 13, 25, 22, 38, 26, 38, 38, 39, 32, 30, 39, 30, 22, 32, 26, 30, 47, 47, 47, 19, 47, 30, 31, 35, 8, 23, 47, 47, 27, 35, 47, 31, 48, 35, 19, 36, 49, 49, 33, 31, 39, 27, 39, 49, 49, 50, 50, 50, 39, 31, 51, 51, 39, 28, 33, 33, 21, 40, 31, 52, 53, 40, 53, 9, 33, 31, 53, 54, 54, 54, 55, 55, 34, 15, 56, 25, 56, 21, 21, 40, 40, 25, 40, 58, 36, 5, 41, 41, 12, 60, 41, 41, 37, 22, 61, 18, 29, 29, 30, 61, 30, 61, 62, 62, 30, 30, 63, 18, 13, 30, 23, 19, 20, 20, 41, 13, 2, 5, 5, 1, 5, 32, 6, 32, 35, 20, 35, 27, 35, 35, 36, 36, 13, 36, 41, 41, 41, 3, 30, 42, 27, 20, 30, 27, 28, 30, 21, 33, 33, 14, 24, 30, 42, 24, 33, 25, 42, 43, 14, 43, 43, 14, 43, 7, 36, 37, 37, 37, 37, 7, 14, 25, 43, 43, 44, 15, 37, 7, 7, 3, 1, 8, 15, 15, 8, 44, 44, 44, 45, 45, 45, 45, 8, 8, 45, 21, 45, 28, 28, 28, 21, 28, 28, 22, 37, 46, 46, 37, 8, 29, 37, 29, 22, 46, 37, 22, 29, 47, 47, 38, 38, 16, 38, 38, 33, 38, 22, 47, 47, 29, 25, 16, 0, 48, 1, 34, 48, 48, 34, 25, 26, 26, 49, 49, 26, 1, 49, 4, 26, 4, 49, 1, 9, 49, 49, 49, 10, 49, 17, 38, 17, 17, 50, 38, 50, 50, 22, 38, 51, 38, 38, 51, 39, 39, 18, 22, 39, 51, 22, 52, 52, 52, 39, 53, 53, 10, 23, 18, 29, 10, 53, 29, 54, 11, 54, 11, 11, 55, 1, 18, 55, 55, 55, 55, 55, 55, 29, 34, 18, 29, 56, 56, 34, 57, 34, 34, 29, 29, 57, 57, 35, 35, 35, 35, 35, 39, 35, 59, 59, 18, 59, 39, 30, 18, 40, 60, 60, 61, 30, 18, 61, 61, 19, 19, }; static const uint8_t table0_mvy[1099] = { 32, 31, 32, 33, 32, 31, 31, 33, 33, 34, 32, 30, 32, 35, 34, 31, 32, 29, 33, 30, 32, 34, 33, 31, 30, 35, 31, 31, 29, 33, 35, 30, 29, 33, 34, 34, 30, 32, 32, 36, 29, 32, 35, 32, 28, 32, 32, 27, 35, 37, 34, 29, 30, 36, 35, 34, 25, 30, 29, 35, 33, 31, 31, 32, 31, 28, 39, 28, 29, 37, 31, 33, 27, 36, 28, 36, 37, 33, 33, 31, 27, 32, 31, 38, 26, 25, 25, 33, 39, 31, 34, 30, 32, 32, 32, 34, 36, 32, 28, 33, 30, 38, 37, 27, 33, 28, 32, 37, 35, 38, 29, 34, 27, 29, 29, 32, 32, 34, 35, 3, 26, 36, 31, 38, 30, 26, 35, 34, 37, 26, 25, 32, 32, 39, 23, 37, 32, 32, 29, 32, 29, 36, 29, 30, 41, 31, 30, 21, 39, 25, 34, 38, 32, 35, 39, 32, 33, 33, 32, 27, 29, 25, 28, 27, 26, 31, 30, 35, 24, 24, 31, 34, 32, 30, 35, 40, 28, 38, 5, 35, 29, 36, 36, 32, 38, 30, 33, 31, 35, 26, 23, 38, 32, 41, 28, 25, 37, 40, 37, 39, 32, 36, 33, 39, 25, 26, 28, 31, 28, 42, 23, 31, 33, 31, 39, 1, 59, 22, 27, 4, 33, 34, 33, 24, 41, 3, 35, 41, 41, 28, 36, 36, 28, 33, 35, 21, 23, 21, 22, 37, 27, 27, 43, 29, 60, 39, 27, 25, 59, 34, 27, 27, 26, 40, 37, 27, 61, 26, 39, 33, 31, 22, 37, 25, 30, 25, 24, 61, 31, 34, 25, 38, 32, 32, 30, 3, 61, 43, 29, 23, 28, 32, 28, 32, 31, 34, 5, 33, 32, 33, 33, 42, 37, 23, 38, 31, 40, 26, 32, 26, 37, 38, 36, 24, 29, 30, 20, 22, 29, 24, 32, 41, 2, 34, 25, 33, 29, 31, 39, 35, 36, 24, 32, 30, 33, 27, 44, 60, 30, 36, 19, 34, 31, 24, 16, 35, 32, 38, 21, 33, 31, 31, 21, 35, 5, 17, 29, 38, 38, 18, 58, 19, 43, 41, 30, 41, 43, 39, 29, 7, 29, 17, 28, 19, 28, 31, 25, 19, 40, 26, 21, 33, 39, 23, 40, 30, 39, 34, 35, 32, 32, 24, 33, 30, 40, 47, 39, 37, 32, 33, 24, 23, 45, 47, 27, 23, 42, 32, 32, 33, 36, 37, 37, 17, 18, 22, 40, 38, 32, 31, 35, 24, 17, 25, 17, 23, 33, 34, 51, 42, 31, 36, 36, 29, 21, 22, 37, 44, 43, 25, 47, 33, 45, 27, 31, 58, 31, 32, 31, 38, 43, 20, 47, 45, 54, 1, 26, 34, 38, 14, 22, 24, 33, 34, 32, 32, 37, 21, 23, 49, 35, 23, 28, 39, 39, 23, 55, 33, 30, 30, 63, 16, 42, 28, 13, 33, 33, 35, 19, 46, 43, 17, 19, 36, 39, 24, 31, 32, 33, 26, 28, 62, 33, 63, 33, 39, 19, 49, 17, 31, 43, 13, 15, 29, 25, 35, 33, 23, 49, 41, 28, 29, 34, 38, 7, 61, 11, 50, 13, 41, 19, 47, 25, 26, 15, 42, 41, 29, 45, 27, 17, 35, 32, 29, 32, 24, 13, 26, 26, 31, 24, 33, 28, 30, 31, 11, 45, 46, 33, 33, 35, 57, 32, 32, 35, 45, 34, 11, 37, 42, 39, 37, 31, 49, 21, 27, 29, 47, 53, 40, 51, 16, 26, 1, 40, 30, 41, 44, 34, 25, 27, 31, 35, 35, 31, 15, 49, 1, 35, 40, 5, 58, 21, 29, 22, 59, 45, 31, 9, 26, 9, 29, 11, 32, 30, 3, 13, 20, 18, 20, 11, 3, 29, 40, 31, 53, 30, 17, 20, 37, 31, 42, 47, 47, 54, 38, 9, 34, 13, 37, 21, 25, 27, 43, 42, 45, 40, 25, 27, 46, 22, 25, 53, 20, 2, 14, 39, 15, 22, 44, 34, 21, 38, 33, 27, 48, 34, 52, 35, 47, 49, 54, 2, 13, 23, 52, 29, 45, 22, 49, 54, 21, 40, 42, 31, 30, 29, 34, 0, 25, 23, 51, 24, 59, 28, 38, 29, 31, 2, 13, 31, 8, 31, 33, 12, 45, 41, 7, 14, 30, 25, 18, 43, 20, 43, 35, 44, 1, 49, 42, 42, 18, 41, 38, 41, 44, 53, 11, 20, 25, 45, 46, 47, 48, 39, 52, 46, 49, 63, 55, 44, 38, 13, 13, 57, 22, 51, 16, 12, 28, 35, 57, 25, 20, 26, 28, 28, 29, 32, 31, 62, 34, 35, 35, 19, 49, 48, 39, 40, 18, 43, 46, 11, 6, 48, 19, 49, 41, 10, 23, 58, 17, 21, 23, 34, 30, 60, 0, 44, 34, 26, 37, 46, 43, 49, 59, 4, 34, 59, 37, 22, 25, 28, 46, 6, 40, 59, 42, 36, 61, 28, 30, 31, 43, 10, 22, 23, 47, 20, 52, 55, 36, 25, 16, 1, 11, 27, 29, 5, 63, 18, 41, 31, 34, 38, 1, 5, 13, 28, 31, 17, 38, 39, 41, 36, 37, 22, 39, 33, 43, 43, 15, 17, 49, 30, 21, 22, 20, 10, 17, 25, 54, 57, 3, 34, 8, 36, 25, 31, 14, 15, 19, 29, 25, 18, 39, 53, 22, 27, 20, 29, 33, 41, 42, 35, 62, 50, 29, 53, 50, 35, 55, 42, 61, 63, 4, 7, 42, 21, 46, 47, 49, 27, 46, 17, 55, 41, 50, 63, 4, 56, 18, 8, 10, 18, 51, 63, 36, 55, 18, 5, 55, 9, 29, 17, 21, 30, 27, 1, 59, 7, 11, 12, 15, 5, 42, 24, 41, 43, 7, 27, 22, 25, 31, 30, 37, 22, 39, 53, 29, 36, 37, 48, 0, 5, 13, 17, 31, 32, 26, 46, 28, 44, 45, 46, 53, 49, 51, 3, 41, 3, 22, 42, 33, 5, 45, 7, 22, 40, 53, 24, 14, 25, 27, 10, 12, 34, 16, 17, 53, 20, 26, 39, 45, 18, 45, 35, 33, 31, 49, 4, 39, 42, 11, 51, 5, 13, 26, 27, 17, 52, 30, 0, 22, 12, 34, 62, 36, 38, 41, 47, 30, 63, 38, 41, 43, 59, 33, 45, 37, 38, 40, 47, 24, 48, 49, 30, 1, 10, 22, 49, 15, 39, 59, 31, 32, 33, 18, 13, 15, 31, 21, 27, 44, 42, 39, 46, 17, 26, 32, 30, 31, 0, 30, 34, 9, 12, 13, 25, 31, 32, 55, 43, 35, 61, 33, 35, 46, 25, 47, 48, 62, 63, 38, 61, 1, 2, 5, 7, 9, 46, 10, 34, 35, 36, 55, 51, 7, 40, 23, 34, 37, 5, 13, 42, 18, 25, 27, 28, }; /* motion vector table 1 */ static const uint16_t table1_mv_code[1100] = { 0x0000, 0x0007, 0x0009, 0x000f, 0x000a, 0x0011, 0x001a, 0x001c, 0x0011, 0x0031, 0x0025, 0x002d, 0x002f, 0x006f, 0x0075, 0x0041, 0x004c, 0x004e, 0x005c, 0x0060, 0x0062, 0x0066, 0x0068, 0x0069, 0x006b, 0x00a6, 0x00c1, 0x00cb, 0x00cc, 0x00ce, 0x00da, 0x00e8, 0x00ee, 0x0087, 0x0090, 0x009e, 0x009f, 0x00ba, 0x00ca, 0x00d8, 0x00db, 0x00df, 0x0104, 0x0109, 0x010c, 0x0143, 0x0145, 0x014a, 0x0156, 0x015c, 0x01b3, 0x01d3, 0x01da, 0x0103, 0x0109, 0x010b, 0x0122, 0x0127, 0x0134, 0x0161, 0x0164, 0x0176, 0x0184, 0x018d, 0x018e, 0x018f, 0x0190, 0x0193, 0x0196, 0x019d, 0x019e, 0x019f, 0x01a9, 0x01b2, 0x01b4, 0x01ba, 0x01bb, 0x01bc, 0x0201, 0x0202, 0x0205, 0x0207, 0x020d, 0x0210, 0x0211, 0x0215, 0x021b, 0x021f, 0x0281, 0x0285, 0x0290, 0x029c, 0x029d, 0x02a2, 0x02a7, 0x02a8, 0x02aa, 0x02b0, 0x02b1, 0x02b4, 0x02bc, 0x02bf, 0x0320, 0x0326, 0x0327, 0x0329, 0x032a, 0x0336, 0x0360, 0x0362, 0x0363, 0x0372, 0x03b2, 0x03bc, 0x03bd, 0x0203, 0x0205, 0x021a, 0x0249, 0x024a, 0x024c, 0x02c7, 0x02ca, 0x02ce, 0x02ef, 0x030d, 0x0322, 0x0325, 0x0338, 0x0373, 0x037a, 0x0409, 0x0415, 0x0416, 0x0418, 0x0428, 0x042d, 0x042f, 0x0434, 0x0508, 0x0509, 0x0510, 0x0511, 0x051c, 0x051e, 0x0524, 0x0541, 0x0543, 0x0546, 0x0547, 0x054d, 0x0557, 0x055f, 0x056a, 0x056c, 0x056d, 0x056f, 0x0576, 0x0577, 0x057a, 0x057b, 0x057c, 0x057d, 0x0600, 0x0601, 0x0603, 0x0614, 0x0616, 0x0617, 0x061c, 0x061f, 0x0642, 0x0648, 0x0649, 0x064a, 0x064b, 0x0657, 0x0668, 0x0669, 0x066b, 0x066e, 0x067f, 0x06c2, 0x06c8, 0x06cb, 0x06de, 0x06df, 0x06e2, 0x06e3, 0x06ef, 0x0748, 0x074b, 0x076e, 0x076f, 0x077c, 0x0409, 0x0423, 0x0428, 0x0429, 0x042a, 0x042b, 0x0432, 0x0433, 0x0496, 0x049a, 0x04d5, 0x04db, 0x0581, 0x0582, 0x058b, 0x058c, 0x058d, 0x0598, 0x0599, 0x059a, 0x059e, 0x05dd, 0x0619, 0x0632, 0x0633, 0x0648, 0x0672, 0x06a1, 0x06a2, 0x06a3, 0x06af, 0x06e2, 0x06e3, 0x06e4, 0x0800, 0x0801, 0x0802, 0x0803, 0x081a, 0x081b, 0x0829, 0x082f, 0x0832, 0x083e, 0x083f, 0x0852, 0x0853, 0x0858, 0x086b, 0x0877, 0x0878, 0x0879, 0x087a, 0x087b, 0x0a00, 0x0a01, 0x0a0d, 0x0a0e, 0x0a0f, 0x0a24, 0x0a37, 0x0a3a, 0x0a3b, 0x0a3e, 0x0a46, 0x0a47, 0x0a4a, 0x0a4b, 0x0a5f, 0x0a79, 0x0a7a, 0x0a7b, 0x0a80, 0x0a81, 0x0a84, 0x0a85, 0x0a99, 0x0aa5, 0x0aa6, 0x0ab8, 0x0aba, 0x0abb, 0x0abc, 0x0abd, 0x0ac8, 0x0ace, 0x0acf, 0x0ad7, 0x0adc, 0x0aeb, 0x0c04, 0x0c25, 0x0c26, 0x0c27, 0x0c2a, 0x0c2b, 0x0c3a, 0x0c3b, 0x0c3c, 0x0c3d, 0x0ca0, 0x0cad, 0x0cd4, 0x0cd5, 0x0cfc, 0x0cfd, 0x0d86, 0x0d92, 0x0d93, 0x0d94, 0x0d95, 0x0db0, 0x0db8, 0x0db9, 0x0dba, 0x0dbb, 0x0dc0, 0x0dc2, 0x0dc3, 0x0dda, 0x0ddb, 0x0ddc, 0x0ddd, 0x0e92, 0x0e93, 0x0e94, 0x0e95, 0x0ec7, 0x0ecc, 0x0ece, 0x0ecf, 0x0ed8, 0x0ed9, 0x0eda, 0x0edb, 0x0808, 0x0809, 0x080a, 0x0810, 0x0811, 0x0844, 0x0845, 0x0861, 0x0862, 0x0863, 0x086c, 0x0922, 0x0923, 0x092e, 0x092f, 0x0936, 0x0937, 0x09b1, 0x09b2, 0x09b3, 0x09b4, 0x09b5, 0x09b8, 0x09b9, 0x09ba, 0x09bb, 0x09bc, 0x09bd, 0x09be, 0x09bf, 0x0b00, 0x0b15, 0x0b2c, 0x0b2d, 0x0b2e, 0x0b2f, 0x0b36, 0x0bb9, 0x0c28, 0x0c2a, 0x0c2b, 0x0c2c, 0x0c2d, 0x0c2e, 0x0c2f, 0x0c30, 0x0c31, 0x0c38, 0x0c60, 0x0c61, 0x0c62, 0x0c63, 0x0c8d, 0x0c8e, 0x0c8f, 0x0c92, 0x0cbe, 0x0cbf, 0x0ce6, 0x0ce7, 0x0d40, 0x0d41, 0x0d57, 0x0d58, 0x0d59, 0x0d5a, 0x0d5b, 0x0d5c, 0x0d5d, 0x0d98, 0x0d99, 0x0d9a, 0x0d9b, 0x0d9c, 0x0d9d, 0x0dad, 0x0dae, 0x0daf, 0x0dc0, 0x0dc1, 0x0dc2, 0x0dc3, 0x0dca, 0x0dcb, 0x0dec, 0x0ded, 0x0dee, 0x0def, 0x1018, 0x1022, 0x1023, 0x1030, 0x1031, 0x1032, 0x1033, 0x1050, 0x1051, 0x105c, 0x1074, 0x1075, 0x1076, 0x1077, 0x1078, 0x1079, 0x107a, 0x107b, 0x10b2, 0x10b3, 0x10b8, 0x10b9, 0x10ba, 0x10bb, 0x10d4, 0x10ea, 0x10eb, 0x10ec, 0x10ed, 0x1404, 0x1405, 0x1406, 0x1407, 0x1410, 0x1411, 0x1412, 0x1413, 0x1414, 0x1415, 0x1416, 0x1417, 0x1418, 0x1419, 0x1466, 0x1467, 0x1468, 0x1469, 0x146a, 0x146b, 0x146c, 0x146d, 0x147e, 0x147f, 0x1488, 0x1489, 0x148a, 0x148b, 0x14b6, 0x14b7, 0x14b8, 0x14b9, 0x14ba, 0x14bb, 0x14bc, 0x14bd, 0x14f0, 0x14f1, 0x14f8, 0x14f9, 0x14fa, 0x14fb, 0x14fc, 0x14fd, 0x14fe, 0x14ff, 0x152a, 0x152b, 0x152c, 0x152d, 0x152e, 0x152f, 0x1530, 0x1531, 0x1548, 0x1549, 0x154e, 0x154f, 0x1558, 0x1559, 0x155a, 0x155b, 0x1572, 0x159a, 0x159b, 0x15ac, 0x15ba, 0x15bb, 0x15d0, 0x15d1, 0x15d2, 0x15d3, 0x15d4, 0x15d5, 0x181d, 0x181e, 0x181f, 0x1840, 0x1841, 0x1842, 0x1843, 0x1844, 0x1845, 0x1846, 0x1847, 0x1848, 0x1849, 0x1861, 0x1862, 0x1863, 0x1864, 0x1865, 0x1866, 0x1867, 0x1868, 0x1869, 0x186a, 0x186b, 0x186c, 0x186d, 0x186e, 0x191b, 0x191c, 0x191d, 0x191e, 0x191f, 0x1942, 0x1943, 0x1944, 0x1945, 0x1946, 0x1947, 0x1958, 0x1959, 0x19ed, 0x19ee, 0x19ef, 0x19f0, 0x19f1, 0x19f2, 0x19f3, 0x19f4, 0x19f5, 0x19f6, 0x19f7, 0x1b0e, 0x1b0f, 0x1b62, 0x1b63, 0x1b64, 0x1b65, 0x1b66, 0x1b67, 0x1b68, 0x1b69, 0x1b6a, 0x1b6b, 0x1b6c, 0x1b6d, 0x1b6e, 0x1b6f, 0x1b82, 0x1ba8, 0x1ba9, 0x1baa, 0x1bab, 0x1bac, 0x1bad, 0x1bae, 0x1baf, 0x1bb0, 0x1bb1, 0x1bb2, 0x1bb3, 0x1d80, 0x1d81, 0x1d82, 0x1d83, 0x1d84, 0x1d85, 0x1d86, 0x1d87, 0x1d88, 0x1d89, 0x1d8a, 0x1d8b, 0x1d8c, 0x1d8d, 0x1007, 0x1008, 0x1009, 0x100a, 0x100b, 0x100c, 0x100d, 0x100e, 0x100f, 0x1016, 0x1080, 0x1081, 0x1082, 0x1083, 0x1084, 0x1085, 0x1086, 0x1087, 0x10c0, 0x123a, 0x123b, 0x123c, 0x123d, 0x123e, 0x123f, 0x1240, 0x1241, 0x1242, 0x1243, 0x1350, 0x1352, 0x1353, 0x1358, 0x1359, 0x135a, 0x135b, 0x135c, 0x135d, 0x135e, 0x135f, 0x1360, 0x1361, 0x1602, 0x1603, 0x160c, 0x160d, 0x160e, 0x160f, 0x1620, 0x1621, 0x1622, 0x1623, 0x1624, 0x1625, 0x1626, 0x1627, 0x1628, 0x1629, 0x166e, 0x166f, 0x167c, 0x167d, 0x167e, 0x167f, 0x1770, 0x1771, 0x1852, 0x1853, 0x1872, 0x1873, 0x1874, 0x1875, 0x1876, 0x1877, 0x1878, 0x1879, 0x187a, 0x187b, 0x187c, 0x187d, 0x187e, 0x187f, 0x1918, 0x1919, 0x1926, 0x1927, 0x1970, 0x1971, 0x1972, 0x1973, 0x1974, 0x1975, 0x1976, 0x1977, 0x1978, 0x1979, 0x197a, 0x197b, 0x1aa0, 0x1aa1, 0x1aa2, 0x1aa3, 0x1aa4, 0x1aa5, 0x1aa6, 0x1aa7, 0x1aa8, 0x1aa9, 0x1aaa, 0x1aab, 0x1aac, 0x1aad, 0x1b3c, 0x1b3d, 0x1b3e, 0x1b3f, 0x1b50, 0x1b51, 0x1b52, 0x1b53, 0x1b54, 0x1b55, 0x1b56, 0x1b57, 0x1b58, 0x1b59, 0x2032, 0x2033, 0x2034, 0x2035, 0x2036, 0x2037, 0x2038, 0x2039, 0x203a, 0x203b, 0x203c, 0x203d, 0x203e, 0x203f, 0x2040, 0x2041, 0x2042, 0x2043, 0x20ba, 0x20bb, 0x20cc, 0x20cd, 0x20ce, 0x20cf, 0x20e0, 0x20e1, 0x20e2, 0x20e3, 0x20e4, 0x20e5, 0x20e6, 0x20e7, 0x21aa, 0x21ab, 0x21c0, 0x21c1, 0x21c2, 0x21c3, 0x21c4, 0x21c5, 0x21c6, 0x21c7, 0x21c8, 0x21c9, 0x21ca, 0x21cb, 0x21cc, 0x21cd, 0x21ce, 0x21cf, 0x21d0, 0x21d1, 0x21d2, 0x21d3, 0x2894, 0x2895, 0x2896, 0x2897, 0x2898, 0x2899, 0x289a, 0x289b, 0x289c, 0x289d, 0x289e, 0x289f, 0x28c0, 0x28c1, 0x28c2, 0x28c3, 0x28c4, 0x28c5, 0x28c6, 0x28c7, 0x28c8, 0x28c9, 0x28ca, 0x28cb, 0x2930, 0x2931, 0x2932, 0x2933, 0x2934, 0x2935, 0x2936, 0x2937, 0x2938, 0x2939, 0x293a, 0x293b, 0x293c, 0x293d, 0x293e, 0x293f, 0x2960, 0x2961, 0x2962, 0x2963, 0x2964, 0x2965, 0x2966, 0x2967, 0x2968, 0x2969, 0x296a, 0x296b, 0x2a40, 0x2a41, 0x2a42, 0x2a43, 0x2a44, 0x2a45, 0x2a46, 0x2a47, 0x2a48, 0x2a49, 0x2a4a, 0x2a4b, 0x2a4c, 0x2a4d, 0x2a4e, 0x2a4f, 0x2a50, 0x2a51, 0x2a52, 0x2a53, 0x2ae6, 0x2ae7, 0x2b24, 0x2b25, 0x2b26, 0x2b27, 0x2b28, 0x2b29, 0x2b2a, 0x2b2b, 0x2b2c, 0x2b2d, 0x2b2e, 0x2b2f, 0x2b30, 0x2b31, 0x2b32, 0x2b33, 0x2b5a, 0x2b5b, 0x3014, 0x3015, 0x3016, 0x3017, 0x3020, 0x3021, 0x3022, 0x3023, 0x3024, 0x3025, 0x3026, 0x3027, 0x3028, 0x3029, 0x302a, 0x302b, 0x302c, 0x302d, 0x302e, 0x302f, 0x3030, 0x3031, 0x3032, 0x3033, 0x3034, 0x3035, 0x3036, 0x3037, 0x3038, 0x3039, 0x30c0, 0x30c1, 0x30de, 0x30df, 0x3218, 0x3219, 0x321a, 0x321b, 0x321c, 0x321d, 0x321e, 0x321f, 0x3220, 0x3221, 0x3222, 0x3223, 0x3224, 0x3225, 0x3226, 0x3227, 0x3228, 0x3229, 0x322a, 0x322b, 0x322c, 0x322d, 0x322e, 0x322f, 0x3230, 0x3231, 0x3232, 0x3233, 0x3234, 0x3235, 0x3378, 0x3379, 0x337a, 0x337b, 0x337c, 0x337d, 0x337e, 0x337f, 0x33c0, 0x33c1, 0x33c2, 0x33c3, 0x33c4, 0x33c5, 0x33c6, 0x33c7, 0x33c8, 0x33c9, 0x33ca, 0x33cb, 0x33cc, 0x33cd, 0x33ce, 0x33cf, 0x33d0, 0x33d1, 0x33d2, 0x33d3, 0x33d4, 0x33d5, 0x33d6, 0x33d7, 0x33d8, 0x33d9, 0x3706, 0x3707, 0x3730, 0x3731, 0x3732, 0x3733, 0x3734, 0x3735, 0x3736, 0x3737, 0x3738, 0x3739, 0x373a, 0x373b, 0x373c, 0x373d, 0x373e, 0x373f, 0x3740, 0x3741, 0x3742, 0x3743, 0x3744, 0x3745, 0x3746, 0x3747, 0x3748, 0x3749, 0x374a, 0x374b, 0x374c, 0x374d, 0x374e, 0x374f, 0x3b34, 0x3b35, 0x3b36, 0x3b37, 0x3be8, 0x3be9, 0x3bea, 0x3beb, 0x3bec, 0x3bed, 0x3bee, 0x3bef, 0x3bf0, 0x3bf1, 0x3bf2, 0x3bf3, 0x3bf4, 0x3bf5, 0x3bf6, 0x3bf7, 0x3bf8, 0x3bf9, 0x3bfa, 0x3bfb, 0x3bfc, 0x3bfd, 0x3bfe, 0x3bff, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200a, 0x200b, 0x200c, 0x200d, 0x202e, 0x202f, 0x2182, 0x2183, 0x21b4, 0x21b5, 0x21b6, 0x21b7, 0x21b8, 0x21b9, 0x21ba, 0x21bb, 0x21bc, 0x21bd, 0x21be, 0x21bf, 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, 0x246a, 0x246b, 0x246c, 0x246d, 0x246e, 0x246f, 0x2470, 0x2471, 0x2472, 0x2473, 0x26a2, 0x26a3, 0x000b, }; static const uint8_t table1_mv_bits[1100] = { 2, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 4, }; static const uint8_t table1_mvx[1099] = { 32, 31, 32, 31, 33, 32, 33, 33, 31, 34, 30, 32, 32, 34, 35, 32, 34, 33, 29, 30, 30, 32, 31, 31, 33, 35, 35, 33, 31, 29, 29, 33, 34, 30, 31, 28, 36, 30, 34, 32, 32, 37, 32, 32, 25, 27, 39, 32, 32, 32, 38, 35, 36, 32, 37, 61, 26, 32, 34, 35, 3, 35, 27, 28, 29, 34, 28, 37, 31, 36, 32, 27, 31, 30, 29, 39, 33, 29, 33, 35, 25, 25, 29, 33, 31, 31, 31, 33, 32, 30, 32, 32, 41, 39, 33, 36, 32, 28, 34, 36, 38, 24, 60, 31, 23, 28, 32, 33, 59, 32, 40, 30, 5, 34, 32, 38, 32, 30, 43, 4, 32, 32, 42, 31, 31, 32, 26, 38, 26, 22, 21, 37, 61, 63, 37, 31, 32, 33, 2, 1, 23, 33, 41, 27, 35, 30, 38, 23, 33, 3, 28, 34, 34, 27, 41, 29, 39, 35, 36, 29, 32, 27, 30, 32, 24, 61, 37, 26, 59, 25, 35, 27, 36, 37, 30, 31, 34, 40, 3, 28, 34, 39, 32, 31, 32, 30, 24, 28, 35, 36, 26, 32, 31, 33, 29, 33, 39, 25, 30, 24, 35, 59, 29, 34, 25, 30, 21, 35, 43, 40, 32, 29, 5, 28, 31, 62, 33, 33, 25, 31, 21, 31, 43, 31, 34, 33, 20, 40, 39, 31, 31, 57, 38, 32, 42, 33, 32, 31, 32, 29, 30, 44, 5, 31, 22, 34, 36, 17, 38, 58, 38, 35, 32, 60, 35, 24, 32, 38, 16, 45, 42, 32, 31, 29, 4, 30, 17, 40, 46, 48, 63, 32, 42, 19, 41, 22, 28, 36, 45, 33, 33, 32, 29, 7, 41, 42, 18, 33, 33, 32, 22, 37, 1, 26, 22, 23, 49, 28, 26, 27, 32, 33, 27, 23, 28, 36, 15, 6, 34, 27, 31, 26, 23, 2, 33, 32, 34, 41, 28, 32, 41, 0, 36, 38, 34, 31, 47, 32, 17, 31, 39, 33, 37, 51, 30, 47, 32, 50, 32, 19, 63, 30, 25, 27, 33, 62, 24, 31, 27, 30, 37, 31, 45, 32, 39, 20, 46, 47, 35, 19, 34, 1, 49, 21, 21, 14, 51, 26, 23, 31, 36, 35, 58, 29, 29, 21, 20, 42, 13, 28, 12, 40, 31, 33, 39, 60, 32, 44, 33, 31, 28, 37, 29, 32, 30, 49, 43, 28, 39, 25, 32, 48, 2, 15, 20, 25, 31, 28, 21, 24, 25, 15, 31, 17, 37, 43, 18, 32, 33, 24, 33, 36, 13, 33, 31, 39, 11, 31, 33, 32, 39, 37, 32, 32, 29, 17, 44, 46, 36, 35, 26, 37, 58, 32, 34, 38, 8, 38, 38, 22, 29, 25, 16, 35, 32, 35, 33, 43, 18, 46, 38, 50, 33, 18, 53, 60, 13, 32, 36, 33, 51, 36, 43, 45, 27, 42, 29, 24, 30, 25, 31, 52, 31, 35, 38, 9, 22, 34, 4, 17, 28, 55, 42, 25, 17, 20, 47, 34, 33, 16, 40, 25, 16, 30, 53, 29, 10, 11, 14, 26, 33, 4, 35, 44, 26, 16, 31, 26, 34, 38, 29, 31, 30, 24, 22, 61, 32, 9, 45, 34, 31, 19, 9, 31, 46, 31, 35, 54, 29, 57, 30, 50, 3, 31, 63, 34, 47, 41, 51, 18, 31, 14, 37, 38, 31, 24, 32, 31, 50, 33, 31, 54, 27, 9, 33, 23, 19, 32, 29, 29, 33, 28, 47, 49, 30, 47, 33, 27, 25, 54, 44, 45, 50, 58, 51, 48, 33, 59, 33, 34, 57, 13, 26, 33, 13, 48, 30, 11, 7, 56, 34, 55, 26, 0, 26, 35, 1, 51, 33, 53, 31, 45, 12, 29, 29, 51, 31, 48, 2, 6, 34, 30, 28, 33, 60, 40, 27, 46, 31, 9, 35, 29, 31, 39, 55, 46, 19, 37, 62, 34, 30, 16, 19, 49, 41, 41, 39, 37, 14, 5, 13, 35, 55, 30, 40, 40, 42, 8, 20, 25, 45, 35, 33, 36, 54, 38, 27, 37, 62, 40, 15, 59, 49, 31, 29, 34, 34, 39, 24, 29, 25, 29, 21, 29, 10, 61, 33, 49, 35, 34, 3, 38, 39, 29, 7, 41, 1, 35, 4, 23, 15, 23, 11, 37, 28, 35, 30, 30, 24, 1, 43, 56, 8, 34, 42, 24, 45, 30, 20, 23, 8, 38, 22, 33, 17, 52, 34, 22, 53, 43, 44, 1, 27, 31, 41, 43, 41, 30, 31, 36, 30, 5, 55, 31, 33, 30, 40, 23, 15, 29, 34, 34, 59, 34, 30, 11, 13, 38, 5, 0, 30, 42, 5, 30, 29, 34, 10, 44, 30, 63, 35, 12, 3, 26, 15, 17, 25, 34, 43, 39, 34, 56, 29, 23, 30, 12, 30, 10, 35, 9, 24, 58, 10, 12, 54, 33, 37, 20, 41, 35, 29, 18, 61, 30, 40, 24, 39, 53, 62, 26, 29, 33, 34, 53, 49, 21, 27, 11, 63, 20, 26, 23, 7, 13, 6, 47, 29, 30, 9, 51, 22, 34, 21, 25, 33, 56, 57, 30, 38, 51, 51, 38, 63, 28, 40, 35, 33, 18, 33, 33, 24, 58, 58, 34, 49, 29, 43, 4, 1, 4, 42, 35, 35, 30, 17, 5, 56, 61, 25, 37, 36, 55, 28, 35, 29, 50, 48, 52, 2, 42, 34, 40, 46, 46, 43, 35, 29, 48, 20, 29, 31, 41, 7, 30, 35, 19, 14, 21, 8, 39, 39, 40, 46, 55, 34, 6, 30, 34, 37, 25, 37, 33, 22, 44, 52, 17, 35, 29, 36, 35, 40, 37, 28, 30, 50, 14, 28, 55, 6, 23, 19, 14, 30, 3, 30, 28, 28, 61, 61, 47, 45, 48, 40, 40, 34, 34, 25, 30, 29, 35, 4, 26, 53, 50, 26, 41, 27, 59, 27, 38, 39, 3, 50, 43, 47, 23, 33, 55, 35, 21, 23, 35, 61, 33, 46, 52, 35, 34, 24, 30, 43, 16, 37, 21, 2, 24, 45, 34, 30, 55, 55, 1, 29, 29, 26, 28, 25, 31, 36, 22, 17, 30, 52, 2, 44, 44, 57, 26, 62, 41, 39, 57, 26, 46, 49, 11, 16, 19, 5, 59, 38, 39, 58, 38, 25, 49, 50, 22, 28, 59, 9, 59, 7, 28, 55, 17, 4, 35, 50, 21, 29, 44, 47, 18, 24, 19, 25, 42, 35, 3, 51, 35, 16, 35, 30, 63, 57, 39, 39, 25, 35, 38, 9, 16, 36, 45, 31, 60, 14, 34, 42, 24, 0, 37, 18, 61, 57, 37, 28, 53, 20, 46, 14, 47, 38, 38, 38, 9, 34, 39, 43, 17, 39, 59, 5, 27, 0, 12, 27, }; static const uint8_t table1_mvy[1099] = { 32, 32, 31, 31, 32, 33, 31, 33, 33, 32, 32, 30, 34, 31, 32, 29, 33, 30, 32, 33, 31, 35, 34, 30, 34, 31, 33, 29, 29, 31, 33, 35, 30, 30, 35, 32, 32, 34, 34, 28, 25, 32, 36, 27, 32, 32, 32, 37, 39, 3, 32, 30, 31, 26, 31, 32, 32, 38, 29, 29, 32, 34, 31, 31, 34, 35, 33, 33, 28, 33, 1, 33, 27, 29, 30, 31, 28, 29, 37, 35, 31, 33, 35, 27, 36, 37, 25, 25, 61, 35, 4, 5, 32, 33, 36, 30, 23, 30, 28, 34, 31, 32, 32, 39, 32, 34, 21, 39, 32, 59, 32, 28, 32, 36, 60, 33, 24, 36, 32, 32, 41, 2, 32, 38, 26, 22, 33, 30, 31, 32, 32, 30, 31, 32, 29, 3, 40, 38, 32, 32, 33, 26, 31, 34, 28, 38, 34, 31, 3, 31, 35, 38, 27, 35, 33, 28, 29, 27, 29, 27, 43, 29, 37, 63, 31, 33, 34, 30, 31, 30, 37, 30, 35, 35, 26, 41, 37, 31, 33, 28, 26, 30, 42, 24, 7, 27, 33, 29, 36, 28, 34, 57, 23, 41, 36, 23, 35, 34, 25, 30, 25, 33, 25, 25, 29, 24, 33, 39, 33, 33, 0, 37, 31, 36, 21, 32, 61, 24, 35, 61, 31, 5, 31, 59, 39, 21, 32, 30, 34, 22, 40, 32, 29, 16, 31, 5, 62, 2, 20, 39, 39, 32, 33, 1, 31, 24, 36, 32, 36, 32, 28, 26, 6, 31, 38, 34, 58, 35, 32, 33, 33, 17, 43, 26, 31, 40, 31, 34, 32, 32, 31, 19, 30, 32, 29, 33, 38, 38, 32, 59, 40, 18, 38, 32, 35, 34, 32, 17, 1, 15, 30, 28, 31, 28, 34, 29, 32, 27, 35, 27, 49, 22, 37, 34, 37, 26, 32, 32, 22, 28, 45, 29, 30, 31, 43, 46, 41, 30, 26, 13, 34, 32, 27, 38, 42, 42, 33, 47, 33, 60, 27, 42, 25, 32, 22, 32, 48, 32, 45, 33, 33, 41, 27, 25, 19, 31, 35, 19, 36, 42, 27, 17, 31, 44, 28, 33, 33, 31, 23, 31, 40, 33, 31, 34, 30, 32, 33, 36, 35, 47, 37, 41, 31, 23, 41, 29, 30, 35, 32, 25, 32, 28, 58, 2, 37, 33, 14, 33, 49, 20, 39, 36, 21, 9, 23, 33, 35, 24, 39, 37, 11, 33, 30, 31, 31, 28, 51, 40, 35, 29, 25, 33, 46, 35, 37, 30, 30, 8, 63, 28, 15, 40, 33, 45, 49, 25, 32, 4, 47, 51, 36, 39, 53, 10, 24, 29, 30, 31, 25, 40, 38, 38, 33, 56, 23, 27, 32, 37, 26, 29, 43, 36, 33, 24, 55, 43, 9, 29, 34, 34, 24, 33, 18, 33, 33, 30, 31, 50, 24, 60, 30, 39, 34, 30, 39, 28, 22, 38, 2, 26, 63, 32, 57, 21, 39, 33, 28, 18, 30, 34, 22, 33, 29, 41, 30, 34, 35, 21, 13, 34, 35, 39, 30, 46, 32, 42, 32, 31, 33, 26, 11, 33, 22, 31, 25, 31, 53, 27, 43, 25, 40, 50, 21, 36, 38, 30, 12, 31, 34, 20, 15, 29, 32, 62, 30, 13, 17, 32, 19, 31, 20, 31, 30, 7, 1, 17, 34, 37, 31, 31, 44, 34, 26, 40, 16, 37, 52, 48, 30, 20, 18, 33, 38, 29, 7, 25, 30, 54, 45, 47, 46, 41, 29, 29, 16, 30, 14, 26, 38, 34, 34, 29, 34, 30, 29, 30, 57, 30, 4, 46, 33, 29, 39, 44, 30, 31, 50, 33, 31, 32, 19, 32, 40, 31, 37, 47, 1, 35, 16, 31, 0, 35, 33, 1, 17, 34, 9, 34, 33, 31, 49, 43, 42, 51, 34, 29, 23, 29, 14, 30, 45, 49, 11, 24, 31, 28, 35, 41, 30, 44, 18, 29, 34, 35, 36, 25, 26, 21, 31, 30, 34, 19, 34, 44, 36, 38, 25, 31, 28, 23, 37, 3, 55, 41, 30, 22, 41, 24, 33, 26, 35, 35, 30, 55, 51, 47, 48, 38, 24, 15, 21, 50, 25, 46, 30, 29, 10, 34, 42, 45, 29, 42, 22, 3, 33, 27, 34, 1, 34, 28, 34, 36, 35, 23, 23, 13, 58, 3, 26, 63, 25, 31, 34, 61, 38, 39, 25, 61, 29, 37, 30, 41, 26, 48, 28, 33, 50, 35, 30, 37, 29, 29, 40, 6, 39, 28, 28, 19, 8, 22, 45, 34, 35, 10, 58, 17, 37, 39, 30, 18, 54, 14, 29, 16, 59, 30, 35, 23, 35, 30, 47, 36, 29, 55, 20, 12, 31, 35, 14, 29, 18, 34, 34, 24, 29, 26, 22, 2, 27, 23, 8, 30, 55, 38, 60, 31, 4, 34, 49, 34, 27, 34, 33, 30, 31, 54, 42, 35, 38, 46, 44, 26, 27, 9, 39, 25, 21, 29, 28, 42, 13, 0, 5, 34, 37, 28, 24, 29, 63, 26, 22, 27, 29, 25, 33, 25, 61, 0, 35, 25, 36, 15, 27, 40, 53, 33, 3, 10, 16, 37, 38, 18, 30, 46, 27, 9, 6, 29, 62, 8, 42, 28, 29, 3, 25, 16, 26, 29, 35, 28, 27, 51, 61, 48, 37, 9, 34, 7, 49, 45, 20, 29, 21, 5, 5, 29, 28, 34, 29, 24, 10, 24, 35, 36, 38, 55, 11, 36, 38, 53, 54, 26, 30, 49, 20, 27, 30, 39, 33, 41, 49, 22, 38, 38, 4, 30, 8, 9, 3, 24, 22, 50, 37, 36, 31, 27, 2, 9, 42, 63, 25, 19, 44, 1, 28, 28, 48, 30, 34, 41, 41, 38, 12, 27, 15, 0, 16, 34, 35, 38, 28, 29, 40, 42, 51, 52, 45, 54, 59, 59, 42, 44, 37, 26, 46, 24, 15, 39, 22, 46, 19, 35, 38, 17, 37, 23, 52, 55, 50, 37, 26, 11, 37, 12, 24, 30, 16, 13, 22, 13, 36, 35, 40, 41, 34, 41, 26, 53, 51, 5, 21, 30, 2, 63, 41, 20, 1, 56, 21, 24, 25, 5, 28, 35, 26, 28, 30, 18, 29, 23, 40, 34, 20, 42, 39, 34, 28, 61, 38, 27, 62, 9, 36, 17, 9, 49, 24, 25, 54, 34, 39, 37, 3, 1, 25, 38, 38, 44, 35, 36, 12, 60, 36, 38, 40, 25, 43, 39, 53, 28, 39, 57, 46, 10, 52, 27, 35, 42, 45, 59, 15, 60, 38, 24, 23, 39, 12, 29, 24, 0, 20, 16, 28, 43, 35, 28, 1, 49, 4, 21, 42, 39, 29, 3, 44, 21, 53, 55, 11, 5, 3, 39, 53, 28, 25, 19, 34, 28, 21, }; MVTable mv_tables[2] = { { 1099, table0_mv_code, table0_mv_bits, table0_mvx, table0_mvy, }, { 1099, table1_mv_code, table1_mv_bits, table1_mvx, table1_mvy, } }; const uint8_t v2_mb_type[8][2] = { {1, 1}, {0 , 2}, {3 , 3}, {9 , 5}, {5, 4}, {0x21, 7}, {0x20, 7}, {0x11, 6}, }; const uint8_t v2_intra_cbpc[4][2] = { {1, 1}, {0, 3}, {1, 3}, {1, 2}, }; const uint8_t wmv1_y_dc_scale_table[32]={ // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 0, 8, 8, 8, 8, 8, 9, 9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21 }; const uint8_t wmv1_c_dc_scale_table[32]={ // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 0, 8, 8, 8, 8, 9, 9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20,21,21,22 }; const uint8_t old_ff_y_dc_scale_table[32]={ // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 0, 8, 8, 8, 8,10,12,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39 }; const uint8_t wmv1_scantable[WMV1_SCANTABLE_COUNT][64]={ { 0x00, 0x08, 0x01, 0x02, 0x09, 0x10, 0x18, 0x11, 0x0A, 0x03, 0x04, 0x0B, 0x12, 0x19, 0x20, 0x28, 0x30, 0x38, 0x29, 0x21, 0x1A, 0x13, 0x0C, 0x05, 0x06, 0x0D, 0x14, 0x1B, 0x22, 0x31, 0x39, 0x3A, 0x32, 0x2A, 0x23, 0x1C, 0x15, 0x0E, 0x07, 0x0F, 0x16, 0x1D, 0x24, 0x2B, 0x33, 0x3B, 0x3C, 0x34, 0x2C, 0x25, 0x1E, 0x17, 0x1F, 0x26, 0x2D, 0x35, 0x3D, 0x3E, 0x36, 0x2E, 0x27, 0x2F, 0x37, 0x3F, }, { 0x00, 0x08, 0x01, 0x02, 0x09, 0x10, 0x18, 0x11, 0x0A, 0x03, 0x04, 0x0B, 0x12, 0x19, 0x20, 0x28, 0x21, 0x30, 0x1A, 0x13, 0x0C, 0x05, 0x06, 0x0D, 0x14, 0x1B, 0x22, 0x29, 0x38, 0x31, 0x39, 0x2A, 0x23, 0x1C, 0x15, 0x0E, 0x07, 0x0F, 0x16, 0x1D, 0x24, 0x2B, 0x32, 0x3A, 0x33, 0x3B, 0x2C, 0x25, 0x1E, 0x17, 0x1F, 0x26, 0x2D, 0x34, 0x3C, 0x35, 0x3D, 0x2E, 0x27, 0x2F, 0x36, 0x3E, 0x37, 0x3F, }, { 0x00, 0x01, 0x08, 0x02, 0x03, 0x09, 0x10, 0x18, 0x11, 0x0A, 0x04, 0x05, 0x0B, 0x12, 0x19, 0x20, 0x28, 0x30, 0x21, 0x1A, 0x13, 0x0C, 0x06, 0x07, 0x0D, 0x14, 0x1B, 0x22, 0x29, 0x38, 0x31, 0x39, 0x2A, 0x23, 0x1C, 0x15, 0x0E, 0x0F, 0x16, 0x1D, 0x24, 0x2B, 0x32, 0x3A, 0x33, 0x2C, 0x25, 0x1E, 0x17, 0x1F, 0x26, 0x2D, 0x34, 0x3B, 0x3C, 0x35, 0x2E, 0x27, 0x2F, 0x36, 0x3D, 0x3E, 0x37, 0x3F, }, { 0x00, 0x08, 0x10, 0x01, 0x18, 0x20, 0x28, 0x09, 0x02, 0x03, 0x0A, 0x11, 0x19, 0x30, 0x38, 0x29, 0x21, 0x1A, 0x12, 0x0B, 0x04, 0x05, 0x0C, 0x13, 0x1B, 0x22, 0x31, 0x39, 0x32, 0x2A, 0x23, 0x1C, 0x14, 0x0D, 0x06, 0x07, 0x0E, 0x15, 0x1D, 0x24, 0x2B, 0x33, 0x3A, 0x3B, 0x34, 0x2C, 0x25, 0x1E, 0x16, 0x0F, 0x17, 0x1F, 0x26, 0x2D, 0x3C, 0x35, 0x2E, 0x27, 0x2F, 0x36, 0x3D, 0x3E, 0x37, 0x3F, } }; const uint8_t table_inter_intra[4][2]={ {0,1} /*Luma-Left Chroma-Left*/, {2,2} /*Luma-Top Chroma-Left*/, {6,3} /*luma-Left Chroma-Top */, {7,3} /*luma-Top Chroma-Top */ }; static const uint32_t table_mb_non_intra2[128][2] = { {0x0000A7, 14}, {0x01B2B8, 18}, {0x01B28E, 18}, {0x036575, 19}, {0x006CAC, 16}, {0x000A69, 18}, {0x002934, 20}, {0x00526B, 21}, {0x006CA1, 16}, {0x01B2B9, 18}, {0x0029AD, 20}, {0x029353, 24}, {0x006CA7, 16}, {0x006CAB, 16}, {0x01B2BB, 18}, {0x00029B, 16}, {0x00D944, 17}, {0x000A6A, 18}, {0x0149A8, 23}, {0x03651F, 19}, {0x006CAF, 16}, {0x000A4C, 18}, {0x03651E, 19}, {0x000A48, 18}, {0x00299C, 20}, {0x00299F, 20}, {0x029352, 24}, {0x0029AC, 20}, {0x000296, 16}, {0x00D946, 17}, {0x000A68, 18}, {0x000298, 16}, {0x000527, 17}, {0x00D94D, 17}, {0x0014D7, 19}, {0x036574, 19}, {0x000A5C, 18}, {0x01B299, 18}, {0x00299D, 20}, {0x00299E, 20}, {0x000525, 17}, {0x000A66, 18}, {0x00A4D5, 22}, {0x00149B, 19}, {0x000295, 16}, {0x006CAD, 16}, {0x000A49, 18}, {0x000521, 17}, {0x006CAA, 16}, {0x00D945, 17}, {0x01B298, 18}, {0x00052F, 17}, {0x003654, 15}, {0x006CA0, 16}, {0x000532, 17}, {0x000291, 16}, {0x003652, 15}, {0x000520, 17}, {0x000A5D, 18}, {0x000294, 16}, {0x00009B, 11}, {0x0006E2, 12}, {0x000028, 12}, {0x0001B0, 10}, {0x000001, 3}, {0x000010, 8}, {0x00002F, 6}, {0x00004C, 10}, {0x00000D, 4}, {0x000000, 10}, {0x000006, 9}, {0x000134, 12}, {0x00000C, 4}, {0x000007, 10}, {0x000007, 9}, {0x0006E1, 12}, {0x00000E, 5}, {0x0000DA, 9}, {0x000022, 9}, {0x000364, 11}, {0x00000F, 4}, {0x000006, 10}, {0x00000F, 9}, {0x000135, 12}, {0x000014, 5}, {0x0000DD, 9}, {0x000004, 9}, {0x000015, 11}, {0x00001A, 6}, {0x0001B3, 10}, {0x000005, 10}, {0x0006E3, 12}, {0x00000C, 5}, {0x0000B9, 8}, {0x000004, 8}, {0x0000DB, 9}, {0x00000E, 4}, {0x00000B, 10}, {0x000023, 9}, {0x0006CB, 12}, {0x000005, 6}, {0x0001B1, 10}, {0x000001, 10}, {0x0006E0, 12}, {0x000011, 5}, {0x0000DF, 9}, {0x00000E, 9}, {0x000373, 11}, {0x000003, 5}, {0x0000B8, 8}, {0x000006, 8}, {0x000175, 9}, {0x000015, 5}, {0x000174, 9}, {0x000027, 9}, {0x000372, 11}, {0x000010, 5}, {0x0000BB, 8}, {0x000005, 8}, {0x0000DE, 9}, {0x00000F, 5}, {0x000001, 9}, {0x000012, 8}, {0x000004, 10}, {0x000002, 3}, {0x000016, 5}, {0x000009, 4}, {0x000001, 5}, }; static const uint32_t table_mb_non_intra3[128][2] = { {0x0002A1, 10}, {0x005740, 15}, {0x01A0BF, 18}, {0x015D19, 17}, {0x001514, 13}, {0x00461E, 15}, {0x015176, 17}, {0x015177, 17}, {0x0011AD, 13}, {0x00682E, 16}, {0x0682F9, 20}, {0x03417D, 19}, {0x001A36, 14}, {0x002A2D, 14}, {0x00D05E, 17}, {0x006824, 16}, {0x001515, 13}, {0x00545C, 15}, {0x0230E9, 18}, {0x011AFA, 17}, {0x0015D7, 13}, {0x005747, 15}, {0x008D79, 16}, {0x006825, 16}, {0x002BA2, 14}, {0x00A8BA, 16}, {0x0235F6, 18}, {0x015D18, 17}, {0x0011AE, 13}, {0x00346F, 15}, {0x008C3B, 16}, {0x00346E, 15}, {0x000D1A, 13}, {0x00461F, 15}, {0x0682F8, 20}, {0x011875, 17}, {0x002BA1, 14}, {0x008D61, 16}, {0x0235F7, 18}, {0x0230E8, 18}, {0x001513, 13}, {0x008D7B, 16}, {0x011AF4, 17}, {0x011AF5, 17}, {0x001185, 13}, {0x0046BF, 15}, {0x008D60, 16}, {0x008D7C, 16}, {0x001512, 13}, {0x00461C, 15}, {0x00AE8D, 16}, {0x008D78, 16}, {0x000D0E, 13}, {0x003413, 15}, {0x0046B1, 15}, {0x003416, 15}, {0x000AEA, 12}, {0x002A2C, 14}, {0x005741, 15}, {0x002A2F, 14}, {0x000158, 9}, {0x0008D2, 12}, {0x00054C, 11}, {0x000686, 12}, {0x000000, 2}, {0x000069, 8}, {0x00006B, 8}, {0x00068C, 12}, {0x000007, 3}, {0x00015E, 9}, {0x0002A3, 10}, {0x000AE9, 12}, {0x000006, 3}, {0x000231, 10}, {0x0002B8, 10}, {0x001A08, 14}, {0x000010, 5}, {0x0001A9, 10}, {0x000342, 11}, {0x000A88, 12}, {0x000004, 4}, {0x0001A2, 10}, {0x0002A4, 10}, {0x001184, 13}, {0x000012, 5}, {0x000232, 10}, {0x0002B2, 10}, {0x000680, 12}, {0x00001B, 6}, {0x00046A, 11}, {0x00068E, 12}, {0x002359, 14}, {0x000016, 5}, {0x00015F, 9}, {0x0002A0, 10}, {0x00054D, 11}, {0x000005, 4}, {0x000233, 10}, {0x0002B9, 10}, {0x0015D6, 13}, {0x000022, 6}, {0x000468, 11}, {0x000683, 12}, {0x001A0A, 14}, {0x000013, 5}, {0x000236, 10}, {0x0002BB, 10}, {0x001186, 13}, {0x000017, 5}, {0x0001AB, 10}, {0x0002A7, 10}, {0x0008D3, 12}, {0x000014, 5}, {0x000237, 10}, {0x000460, 11}, {0x000D0F, 13}, {0x000019, 6}, {0x0001AA, 10}, {0x0002B3, 10}, {0x000681, 12}, {0x000018, 6}, {0x0001A8, 10}, {0x0002A5, 10}, {0x00068F, 12}, {0x000007, 4}, {0x000055, 7}, {0x000047, 7}, {0x0000AD, 8}, }; static const uint32_t table_mb_non_intra4[128][2] = { {0x0000D4, 8}, {0x0021C5, 14}, {0x00F18A, 16}, {0x00D5BC, 16}, {0x000879, 12}, {0x00354D, 14}, {0x010E3F, 17}, {0x010F54, 17}, {0x000866, 12}, {0x00356E, 14}, {0x010F55, 17}, {0x010E3E, 17}, {0x0010CE, 13}, {0x003C84, 14}, {0x00D5BD, 16}, {0x00F18B, 16}, {0x000868, 12}, {0x00438C, 15}, {0x0087AB, 16}, {0x00790B, 15}, {0x000F10, 12}, {0x00433D, 15}, {0x006AD3, 15}, {0x00790A, 15}, {0x001AA7, 13}, {0x0043D4, 15}, {0x00871E, 16}, {0x006ADF, 15}, {0x000D7C, 12}, {0x003C94, 14}, {0x00438D, 15}, {0x006AD2, 15}, {0x0006BC, 11}, {0x0021E9, 14}, {0x006ADA, 15}, {0x006A99, 15}, {0x0010F7, 13}, {0x004389, 15}, {0x006ADB, 15}, {0x0078C4, 15}, {0x000D56, 12}, {0x0035F7, 14}, {0x00438E, 15}, {0x006A98, 15}, {0x000D52, 12}, {0x003C95, 14}, {0x004388, 15}, {0x00433C, 15}, {0x000D54, 12}, {0x001E4B, 13}, {0x003C63, 14}, {0x003C83, 14}, {0x000861, 12}, {0x0021EB, 14}, {0x00356C, 14}, {0x0035F6, 14}, {0x000863, 12}, {0x00219F, 14}, {0x003568, 14}, {0x003C82, 14}, {0x0001AE, 9}, {0x0010C0, 13}, {0x000F11, 12}, {0x001AFA, 13}, {0x000000, 1}, {0x0000F0, 8}, {0x0001AD, 9}, {0x0010C1, 13}, {0x00000A, 4}, {0x0003C5, 10}, {0x000789, 11}, {0x001AB5, 13}, {0x000009, 4}, {0x000435, 11}, {0x000793, 11}, {0x001E40, 13}, {0x00001D, 5}, {0x0003CB, 10}, {0x000878, 12}, {0x001AAF, 13}, {0x00000B, 4}, {0x0003C7, 10}, {0x000791, 11}, {0x001AAB, 13}, {0x00001F, 5}, {0x000436, 11}, {0x0006BF, 11}, {0x000F19, 12}, {0x00003D, 6}, {0x000D51, 12}, {0x0010C4, 13}, {0x0021E8, 14}, {0x000036, 6}, {0x000437, 11}, {0x0006AF, 11}, {0x0010C5, 13}, {0x00000C, 4}, {0x000432, 11}, {0x000794, 11}, {0x001E30, 13}, {0x000042, 7}, {0x000870, 12}, {0x000F24, 12}, {0x001E43, 13}, {0x000020, 6}, {0x00043E, 11}, {0x000795, 11}, {0x001AAA, 13}, {0x000037, 6}, {0x0006AC, 11}, {0x0006AE, 11}, {0x0010F6, 13}, {0x000034, 6}, {0x00043A, 11}, {0x000D50, 12}, {0x001AAE, 13}, {0x000039, 6}, {0x00043F, 11}, {0x00078D, 11}, {0x0010D2, 13}, {0x000038, 6}, {0x00043B, 11}, {0x0006BD, 11}, {0x0010D3, 13}, {0x000011, 5}, {0x0001AC, 9}, {0x0000F3, 8}, {0x000439, 11}, }; const uint32_t (* const wmv2_inter_table[WMV2_INTER_CBP_TABLE_COUNT])[2]={ table_mb_non_intra2, table_mb_non_intra3, table_mb_non_intra4, table_mb_non_intra, }; const uint8_t wmv2_scantableA[64]={ 0x00, 0x01, 0x02, 0x08, 0x03, 0x09, 0x0A, 0x10, 0x04, 0x0B, 0x11, 0x18, 0x12, 0x0C, 0x05, 0x13, 0x19, 0x0D, 0x14, 0x1A, 0x1B, 0x06, 0x15, 0x1C, 0x0E, 0x16, 0x1D, 0x07, 0x1E, 0x0F, 0x17, 0x1F, }; const uint8_t wmv2_scantableB[64]={ 0x00, 0x08, 0x01, 0x10, 0x09, 0x18, 0x11, 0x02, 0x20, 0x0A, 0x19, 0x28, 0x12, 0x30, 0x21, 0x1A, 0x38, 0x29, 0x22, 0x03, 0x31, 0x39, 0x0B, 0x2A, 0x13, 0x32, 0x1B, 0x3A, 0x23, 0x2B, 0x33, 0x3B, };
123linslouis-android-video-cutter
jni/libavcodec/msmpeg4data.c
C
asf20
85,117
/* * Chinese AVS video (AVS1-P2, JiZhun profile) decoder. * Copyright (c) 2006 Stefan Gehrer <stefan.gehrer@gmx.de> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * Chinese AVS video (AVS1-P2, JiZhun profile) decoder * @author Stefan Gehrer <stefan.gehrer@gmx.de> */ #include "avcodec.h" #include "get_bits.h" #include "golomb.h" #include "mathops.h" #include "cavs.h" #include "cavsdata.h" /***************************************************************************** * * in-loop deblocking filter * ****************************************************************************/ static inline int get_bs(cavs_vector *mvP, cavs_vector *mvQ, int b) { if((mvP->ref == REF_INTRA) || (mvQ->ref == REF_INTRA)) return 2; if( (abs(mvP->x - mvQ->x) >= 4) || (abs(mvP->y - mvQ->y) >= 4) ) return 1; if(b){ mvP += MV_BWD_OFFS; mvQ += MV_BWD_OFFS; if( (abs(mvP->x - mvQ->x) >= 4) || (abs(mvP->y - mvQ->y) >= 4) ) return 1; }else{ if(mvP->ref != mvQ->ref) return 1; } return 0; } #define SET_PARAMS \ alpha = alpha_tab[av_clip(qp_avg + h->alpha_offset,0,63)]; \ beta = beta_tab[av_clip(qp_avg + h->beta_offset, 0,63)]; \ tc = tc_tab[av_clip(qp_avg + h->alpha_offset,0,63)]; /** * in-loop deblocking filter for a single macroblock * * boundary strength (bs) mapping: * * --4---5-- * 0 2 | * | 6 | 7 | * 1 3 | * --------- * */ void ff_cavs_filter(AVSContext *h, enum cavs_mb mb_type) { uint8_t bs[8]; int qp_avg, alpha, beta, tc; int i; /* save un-deblocked lines */ h->topleft_border_y = h->top_border_y[h->mbx*16+15]; h->topleft_border_u = h->top_border_u[h->mbx*10+8]; h->topleft_border_v = h->top_border_v[h->mbx*10+8]; memcpy(&h->top_border_y[h->mbx*16], h->cy + 15* h->l_stride,16); memcpy(&h->top_border_u[h->mbx*10+1], h->cu + 7* h->c_stride,8); memcpy(&h->top_border_v[h->mbx*10+1], h->cv + 7* h->c_stride,8); for(i=0;i<8;i++) { h->left_border_y[i*2+1] = *(h->cy + 15 + (i*2+0)*h->l_stride); h->left_border_y[i*2+2] = *(h->cy + 15 + (i*2+1)*h->l_stride); h->left_border_u[i+1] = *(h->cu + 7 + i*h->c_stride); h->left_border_v[i+1] = *(h->cv + 7 + i*h->c_stride); } if(!h->loop_filter_disable) { /* determine bs */ if(mb_type == I_8X8) memset(bs,2,8); else{ memset(bs,0,8); if(ff_cavs_partition_flags[mb_type] & SPLITV){ bs[2] = get_bs(&h->mv[MV_FWD_X0], &h->mv[MV_FWD_X1], mb_type > P_8X8); bs[3] = get_bs(&h->mv[MV_FWD_X2], &h->mv[MV_FWD_X3], mb_type > P_8X8); } if(ff_cavs_partition_flags[mb_type] & SPLITH){ bs[6] = get_bs(&h->mv[MV_FWD_X0], &h->mv[MV_FWD_X2], mb_type > P_8X8); bs[7] = get_bs(&h->mv[MV_FWD_X1], &h->mv[MV_FWD_X3], mb_type > P_8X8); } bs[0] = get_bs(&h->mv[MV_FWD_A1], &h->mv[MV_FWD_X0], mb_type > P_8X8); bs[1] = get_bs(&h->mv[MV_FWD_A3], &h->mv[MV_FWD_X2], mb_type > P_8X8); bs[4] = get_bs(&h->mv[MV_FWD_B2], &h->mv[MV_FWD_X0], mb_type > P_8X8); bs[5] = get_bs(&h->mv[MV_FWD_B3], &h->mv[MV_FWD_X1], mb_type > P_8X8); } if(AV_RN64(bs)) { if(h->flags & A_AVAIL) { qp_avg = (h->qp + h->left_qp + 1) >> 1; SET_PARAMS; h->s.dsp.cavs_filter_lv(h->cy,h->l_stride,alpha,beta,tc,bs[0],bs[1]); h->s.dsp.cavs_filter_cv(h->cu,h->c_stride,alpha,beta,tc,bs[0],bs[1]); h->s.dsp.cavs_filter_cv(h->cv,h->c_stride,alpha,beta,tc,bs[0],bs[1]); } qp_avg = h->qp; SET_PARAMS; h->s.dsp.cavs_filter_lv(h->cy + 8,h->l_stride,alpha,beta,tc,bs[2],bs[3]); h->s.dsp.cavs_filter_lh(h->cy + 8*h->l_stride,h->l_stride,alpha,beta,tc, bs[6],bs[7]); if(h->flags & B_AVAIL) { qp_avg = (h->qp + h->top_qp[h->mbx] + 1) >> 1; SET_PARAMS; h->s.dsp.cavs_filter_lh(h->cy,h->l_stride,alpha,beta,tc,bs[4],bs[5]); h->s.dsp.cavs_filter_ch(h->cu,h->c_stride,alpha,beta,tc,bs[4],bs[5]); h->s.dsp.cavs_filter_ch(h->cv,h->c_stride,alpha,beta,tc,bs[4],bs[5]); } } } h->left_qp = h->qp; h->top_qp[h->mbx] = h->qp; } #undef SET_PARAMS /***************************************************************************** * * spatial intra prediction * ****************************************************************************/ void ff_cavs_load_intra_pred_luma(AVSContext *h, uint8_t *top, uint8_t **left, int block) { int i; switch(block) { case 0: *left = h->left_border_y; h->left_border_y[0] = h->left_border_y[1]; memset(&h->left_border_y[17],h->left_border_y[16],9); memcpy(&top[1],&h->top_border_y[h->mbx*16],16); top[17] = top[16]; top[0] = top[1]; if((h->flags & A_AVAIL) && (h->flags & B_AVAIL)) h->left_border_y[0] = top[0] = h->topleft_border_y; break; case 1: *left = h->intern_border_y; for(i=0;i<8;i++) h->intern_border_y[i+1] = *(h->cy + 7 + i*h->l_stride); memset(&h->intern_border_y[9],h->intern_border_y[8],9); h->intern_border_y[0] = h->intern_border_y[1]; memcpy(&top[1],&h->top_border_y[h->mbx*16+8],8); if(h->flags & C_AVAIL) memcpy(&top[9],&h->top_border_y[(h->mbx + 1)*16],8); else memset(&top[9],top[8],9); top[17] = top[16]; top[0] = top[1]; if(h->flags & B_AVAIL) h->intern_border_y[0] = top[0] = h->top_border_y[h->mbx*16+7]; break; case 2: *left = &h->left_border_y[8]; memcpy(&top[1],h->cy + 7*h->l_stride,16); top[17] = top[16]; top[0] = top[1]; if(h->flags & A_AVAIL) top[0] = h->left_border_y[8]; break; case 3: *left = &h->intern_border_y[8]; for(i=0;i<8;i++) h->intern_border_y[i+9] = *(h->cy + 7 + (i+8)*h->l_stride); memset(&h->intern_border_y[17],h->intern_border_y[16],9); memcpy(&top[0],h->cy + 7 + 7*h->l_stride,9); memset(&top[9],top[8],9); break; } } void ff_cavs_load_intra_pred_chroma(AVSContext *h) { /* extend borders by one pixel */ h->left_border_u[9] = h->left_border_u[8]; h->left_border_v[9] = h->left_border_v[8]; h->top_border_u[h->mbx*10+9] = h->top_border_u[h->mbx*10+8]; h->top_border_v[h->mbx*10+9] = h->top_border_v[h->mbx*10+8]; if(h->mbx && h->mby) { h->top_border_u[h->mbx*10] = h->left_border_u[0] = h->topleft_border_u; h->top_border_v[h->mbx*10] = h->left_border_v[0] = h->topleft_border_v; } else { h->left_border_u[0] = h->left_border_u[1]; h->left_border_v[0] = h->left_border_v[1]; h->top_border_u[h->mbx*10] = h->top_border_u[h->mbx*10+1]; h->top_border_v[h->mbx*10] = h->top_border_v[h->mbx*10+1]; } } static void intra_pred_vert(uint8_t *d,uint8_t *top,uint8_t *left,int stride) { int y; uint64_t a = AV_RN64(&top[1]); for(y=0;y<8;y++) { *((uint64_t *)(d+y*stride)) = a; } } static void intra_pred_horiz(uint8_t *d,uint8_t *top,uint8_t *left,int stride) { int y; uint64_t a; for(y=0;y<8;y++) { a = left[y+1] * 0x0101010101010101ULL; *((uint64_t *)(d+y*stride)) = a; } } static void intra_pred_dc_128(uint8_t *d,uint8_t *top,uint8_t *left,int stride) { int y; uint64_t a = 0x8080808080808080ULL; for(y=0;y<8;y++) *((uint64_t *)(d+y*stride)) = a; } static void intra_pred_plane(uint8_t *d,uint8_t *top,uint8_t *left,int stride) { int x,y,ia; int ih = 0; int iv = 0; uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; for(x=0; x<4; x++) { ih += (x+1)*(top[5+x]-top[3-x]); iv += (x+1)*(left[5+x]-left[3-x]); } ia = (top[8]+left[8])<<4; ih = (17*ih+16)>>5; iv = (17*iv+16)>>5; for(y=0; y<8; y++) for(x=0; x<8; x++) d[y*stride+x] = cm[(ia+(x-3)*ih+(y-3)*iv+16)>>5]; } #define LOWPASS(ARRAY,INDEX) \ (( ARRAY[(INDEX)-1] + 2*ARRAY[(INDEX)] + ARRAY[(INDEX)+1] + 2) >> 2) static void intra_pred_lp(uint8_t *d,uint8_t *top,uint8_t *left,int stride) { int x,y; for(y=0; y<8; y++) for(x=0; x<8; x++) d[y*stride+x] = (LOWPASS(top,x+1) + LOWPASS(left,y+1)) >> 1; } static void intra_pred_down_left(uint8_t *d,uint8_t *top,uint8_t *left,int stride) { int x,y; for(y=0; y<8; y++) for(x=0; x<8; x++) d[y*stride+x] = (LOWPASS(top,x+y+2) + LOWPASS(left,x+y+2)) >> 1; } static void intra_pred_down_right(uint8_t *d,uint8_t *top,uint8_t *left,int stride) { int x,y; for(y=0; y<8; y++) for(x=0; x<8; x++) if(x==y) d[y*stride+x] = (left[1]+2*top[0]+top[1]+2)>>2; else if(x>y) d[y*stride+x] = LOWPASS(top,x-y); else d[y*stride+x] = LOWPASS(left,y-x); } static void intra_pred_lp_left(uint8_t *d,uint8_t *top,uint8_t *left,int stride) { int x,y; for(y=0; y<8; y++) for(x=0; x<8; x++) d[y*stride+x] = LOWPASS(left,y+1); } static void intra_pred_lp_top(uint8_t *d,uint8_t *top,uint8_t *left,int stride) { int x,y; for(y=0; y<8; y++) for(x=0; x<8; x++) d[y*stride+x] = LOWPASS(top,x+1); } #undef LOWPASS void ff_cavs_modify_mb_i(AVSContext *h, int *pred_mode_uv) { /* save pred modes before they get modified */ h->pred_mode_Y[3] = h->pred_mode_Y[5]; h->pred_mode_Y[6] = h->pred_mode_Y[8]; h->top_pred_Y[h->mbx*2+0] = h->pred_mode_Y[7]; h->top_pred_Y[h->mbx*2+1] = h->pred_mode_Y[8]; /* modify pred modes according to availability of neighbour samples */ if(!(h->flags & A_AVAIL)) { modify_pred(ff_left_modifier_l, &h->pred_mode_Y[4] ); modify_pred(ff_left_modifier_l, &h->pred_mode_Y[7] ); modify_pred(ff_left_modifier_c, pred_mode_uv ); } if(!(h->flags & B_AVAIL)) { modify_pred(ff_top_modifier_l, &h->pred_mode_Y[4] ); modify_pred(ff_top_modifier_l, &h->pred_mode_Y[5] ); modify_pred(ff_top_modifier_c, pred_mode_uv ); } } /***************************************************************************** * * motion compensation * ****************************************************************************/ static inline void mc_dir_part(AVSContext *h,Picture *pic,int square, int chroma_height,int delta,int list,uint8_t *dest_y, uint8_t *dest_cb,uint8_t *dest_cr,int src_x_offset, int src_y_offset,qpel_mc_func *qpix_op, h264_chroma_mc_func chroma_op,cavs_vector *mv){ MpegEncContext * const s = &h->s; const int mx= mv->x + src_x_offset*8; const int my= mv->y + src_y_offset*8; const int luma_xy= (mx&3) + ((my&3)<<2); uint8_t * src_y = pic->data[0] + (mx>>2) + (my>>2)*h->l_stride; uint8_t * src_cb= pic->data[1] + (mx>>3) + (my>>3)*h->c_stride; uint8_t * src_cr= pic->data[2] + (mx>>3) + (my>>3)*h->c_stride; int extra_width= 0; //(s->flags&CODEC_FLAG_EMU_EDGE) ? 0 : 16; int extra_height= extra_width; int emu=0; const int full_mx= mx>>2; const int full_my= my>>2; const int pic_width = 16*h->mb_width; const int pic_height = 16*h->mb_height; if(!pic->data[0]) return; if(mx&7) extra_width -= 3; if(my&7) extra_height -= 3; if( full_mx < 0-extra_width || full_my < 0-extra_height || full_mx + 16/*FIXME*/ > pic_width + extra_width || full_my + 16/*FIXME*/ > pic_height + extra_height){ ff_emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 2*h->l_stride, h->l_stride, 16+5, 16+5/*FIXME*/, full_mx-2, full_my-2, pic_width, pic_height); src_y= s->edge_emu_buffer + 2 + 2*h->l_stride; emu=1; } qpix_op[luma_xy](dest_y, src_y, h->l_stride); //FIXME try variable height perhaps? if(!square){ qpix_op[luma_xy](dest_y + delta, src_y + delta, h->l_stride); } if(emu){ ff_emulated_edge_mc(s->edge_emu_buffer, src_cb, h->c_stride, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1); src_cb= s->edge_emu_buffer; } chroma_op(dest_cb, src_cb, h->c_stride, chroma_height, mx&7, my&7); if(emu){ ff_emulated_edge_mc(s->edge_emu_buffer, src_cr, h->c_stride, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1); src_cr= s->edge_emu_buffer; } chroma_op(dest_cr, src_cr, h->c_stride, chroma_height, mx&7, my&7); } static inline void mc_part_std(AVSContext *h,int square,int chroma_height,int delta, uint8_t *dest_y,uint8_t *dest_cb,uint8_t *dest_cr, int x_offset, int y_offset,qpel_mc_func *qpix_put, h264_chroma_mc_func chroma_put,qpel_mc_func *qpix_avg, h264_chroma_mc_func chroma_avg, cavs_vector *mv){ qpel_mc_func *qpix_op= qpix_put; h264_chroma_mc_func chroma_op= chroma_put; dest_y += 2*x_offset + 2*y_offset*h->l_stride; dest_cb += x_offset + y_offset*h->c_stride; dest_cr += x_offset + y_offset*h->c_stride; x_offset += 8*h->mbx; y_offset += 8*h->mby; if(mv->ref >= 0){ Picture *ref= &h->DPB[mv->ref]; mc_dir_part(h, ref, square, chroma_height, delta, 0, dest_y, dest_cb, dest_cr, x_offset, y_offset, qpix_op, chroma_op, mv); qpix_op= qpix_avg; chroma_op= chroma_avg; } if((mv+MV_BWD_OFFS)->ref >= 0){ Picture *ref= &h->DPB[0]; mc_dir_part(h, ref, square, chroma_height, delta, 1, dest_y, dest_cb, dest_cr, x_offset, y_offset, qpix_op, chroma_op, mv+MV_BWD_OFFS); } } void ff_cavs_inter(AVSContext *h, enum cavs_mb mb_type) { if(ff_cavs_partition_flags[mb_type] == 0){ // 16x16 mc_part_std(h, 1, 8, 0, h->cy, h->cu, h->cv, 0, 0, h->s.dsp.put_cavs_qpel_pixels_tab[0], h->s.dsp.put_h264_chroma_pixels_tab[0], h->s.dsp.avg_cavs_qpel_pixels_tab[0], h->s.dsp.avg_h264_chroma_pixels_tab[0],&h->mv[MV_FWD_X0]); }else{ mc_part_std(h, 1, 4, 0, h->cy, h->cu, h->cv, 0, 0, h->s.dsp.put_cavs_qpel_pixels_tab[1], h->s.dsp.put_h264_chroma_pixels_tab[1], h->s.dsp.avg_cavs_qpel_pixels_tab[1], h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X0]); mc_part_std(h, 1, 4, 0, h->cy, h->cu, h->cv, 4, 0, h->s.dsp.put_cavs_qpel_pixels_tab[1], h->s.dsp.put_h264_chroma_pixels_tab[1], h->s.dsp.avg_cavs_qpel_pixels_tab[1], h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X1]); mc_part_std(h, 1, 4, 0, h->cy, h->cu, h->cv, 0, 4, h->s.dsp.put_cavs_qpel_pixels_tab[1], h->s.dsp.put_h264_chroma_pixels_tab[1], h->s.dsp.avg_cavs_qpel_pixels_tab[1], h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X2]); mc_part_std(h, 1, 4, 0, h->cy, h->cu, h->cv, 4, 4, h->s.dsp.put_cavs_qpel_pixels_tab[1], h->s.dsp.put_h264_chroma_pixels_tab[1], h->s.dsp.avg_cavs_qpel_pixels_tab[1], h->s.dsp.avg_h264_chroma_pixels_tab[1],&h->mv[MV_FWD_X3]); } } /***************************************************************************** * * motion vector prediction * ****************************************************************************/ static inline void scale_mv(AVSContext *h, int *d_x, int *d_y, cavs_vector *src, int distp) { int den = h->scale_den[src->ref]; *d_x = (src->x*distp*den + 256 + (src->x>>31)) >> 9; *d_y = (src->y*distp*den + 256 + (src->y>>31)) >> 9; } static inline void mv_pred_median(AVSContext *h, cavs_vector *mvP, cavs_vector *mvA, cavs_vector *mvB, cavs_vector *mvC) { int ax, ay, bx, by, cx, cy; int len_ab, len_bc, len_ca, len_mid; /* scale candidates according to their temporal span */ scale_mv(h, &ax, &ay, mvA, mvP->dist); scale_mv(h, &bx, &by, mvB, mvP->dist); scale_mv(h, &cx, &cy, mvC, mvP->dist); /* find the geometrical median of the three candidates */ len_ab = abs(ax - bx) + abs(ay - by); len_bc = abs(bx - cx) + abs(by - cy); len_ca = abs(cx - ax) + abs(cy - ay); len_mid = mid_pred(len_ab, len_bc, len_ca); if(len_mid == len_ab) { mvP->x = cx; mvP->y = cy; } else if(len_mid == len_bc) { mvP->x = ax; mvP->y = ay; } else { mvP->x = bx; mvP->y = by; } } void ff_cavs_mv(AVSContext *h, enum cavs_mv_loc nP, enum cavs_mv_loc nC, enum cavs_mv_pred mode, enum cavs_block size, int ref) { cavs_vector *mvP = &h->mv[nP]; cavs_vector *mvA = &h->mv[nP-1]; cavs_vector *mvB = &h->mv[nP-4]; cavs_vector *mvC = &h->mv[nC]; const cavs_vector *mvP2 = NULL; mvP->ref = ref; mvP->dist = h->dist[mvP->ref]; if(mvC->ref == NOT_AVAIL) mvC = &h->mv[nP-5]; // set to top-left (mvD) if((mode == MV_PRED_PSKIP) && ((mvA->ref == NOT_AVAIL) || (mvB->ref == NOT_AVAIL) || ((mvA->x | mvA->y | mvA->ref) == 0) || ((mvB->x | mvB->y | mvB->ref) == 0) )) { mvP2 = &ff_cavs_un_mv; /* if there is only one suitable candidate, take it */ } else if((mvA->ref >= 0) && (mvB->ref < 0) && (mvC->ref < 0)) { mvP2= mvA; } else if((mvA->ref < 0) && (mvB->ref >= 0) && (mvC->ref < 0)) { mvP2= mvB; } else if((mvA->ref < 0) && (mvB->ref < 0) && (mvC->ref >= 0)) { mvP2= mvC; } else if(mode == MV_PRED_LEFT && mvA->ref == ref){ mvP2= mvA; } else if(mode == MV_PRED_TOP && mvB->ref == ref){ mvP2= mvB; } else if(mode == MV_PRED_TOPRIGHT && mvC->ref == ref){ mvP2= mvC; } if(mvP2){ mvP->x = mvP2->x; mvP->y = mvP2->y; }else mv_pred_median(h, mvP, mvA, mvB, mvC); if(mode < MV_PRED_PSKIP) { mvP->x += get_se_golomb(&h->s.gb); mvP->y += get_se_golomb(&h->s.gb); } set_mvs(mvP,size); } /***************************************************************************** * * macroblock level * ****************************************************************************/ /** * initialise predictors for motion vectors and intra prediction */ void ff_cavs_init_mb(AVSContext *h) { int i; /* copy predictors from top line (MB B and C) into cache */ for(i=0;i<3;i++) { h->mv[MV_FWD_B2+i] = h->top_mv[0][h->mbx*2+i]; h->mv[MV_BWD_B2+i] = h->top_mv[1][h->mbx*2+i]; } h->pred_mode_Y[1] = h->top_pred_Y[h->mbx*2+0]; h->pred_mode_Y[2] = h->top_pred_Y[h->mbx*2+1]; /* clear top predictors if MB B is not available */ if(!(h->flags & B_AVAIL)) { h->mv[MV_FWD_B2] = ff_cavs_un_mv; h->mv[MV_FWD_B3] = ff_cavs_un_mv; h->mv[MV_BWD_B2] = ff_cavs_un_mv; h->mv[MV_BWD_B3] = ff_cavs_un_mv; h->pred_mode_Y[1] = h->pred_mode_Y[2] = NOT_AVAIL; h->flags &= ~(C_AVAIL|D_AVAIL); } else if(h->mbx) { h->flags |= D_AVAIL; } if(h->mbx == h->mb_width-1) //MB C not available h->flags &= ~C_AVAIL; /* clear top-right predictors if MB C is not available */ if(!(h->flags & C_AVAIL)) { h->mv[MV_FWD_C2] = ff_cavs_un_mv; h->mv[MV_BWD_C2] = ff_cavs_un_mv; } /* clear top-left predictors if MB D is not available */ if(!(h->flags & D_AVAIL)) { h->mv[MV_FWD_D3] = ff_cavs_un_mv; h->mv[MV_BWD_D3] = ff_cavs_un_mv; } } /** * save predictors for later macroblocks and increase * macroblock address * @return 0 if end of frame is reached, 1 otherwise */ int ff_cavs_next_mb(AVSContext *h) { int i; h->flags |= A_AVAIL; h->cy += 16; h->cu += 8; h->cv += 8; /* copy mvs as predictors to the left */ for(i=0;i<=20;i+=4) h->mv[i] = h->mv[i+2]; /* copy bottom mvs from cache to top line */ h->top_mv[0][h->mbx*2+0] = h->mv[MV_FWD_X2]; h->top_mv[0][h->mbx*2+1] = h->mv[MV_FWD_X3]; h->top_mv[1][h->mbx*2+0] = h->mv[MV_BWD_X2]; h->top_mv[1][h->mbx*2+1] = h->mv[MV_BWD_X3]; /* next MB address */ h->mbidx++; h->mbx++; if(h->mbx == h->mb_width) { //new mb line h->flags = B_AVAIL|C_AVAIL; /* clear left pred_modes */ h->pred_mode_Y[3] = h->pred_mode_Y[6] = NOT_AVAIL; /* clear left mv predictors */ for(i=0;i<=20;i+=4) h->mv[i] = ff_cavs_un_mv; h->mbx = 0; h->mby++; /* re-calculate sample pointers */ h->cy = h->picture.data[0] + h->mby*16*h->l_stride; h->cu = h->picture.data[1] + h->mby*8*h->c_stride; h->cv = h->picture.data[2] + h->mby*8*h->c_stride; if(h->mby == h->mb_height) { //frame end return 0; } } return 1; } /***************************************************************************** * * frame level * ****************************************************************************/ void ff_cavs_init_pic(AVSContext *h) { int i; /* clear some predictors */ for(i=0;i<=20;i+=4) h->mv[i] = ff_cavs_un_mv; h->mv[MV_BWD_X0] = ff_cavs_dir_mv; set_mvs(&h->mv[MV_BWD_X0], BLK_16X16); h->mv[MV_FWD_X0] = ff_cavs_dir_mv; set_mvs(&h->mv[MV_FWD_X0], BLK_16X16); h->pred_mode_Y[3] = h->pred_mode_Y[6] = NOT_AVAIL; h->cy = h->picture.data[0]; h->cu = h->picture.data[1]; h->cv = h->picture.data[2]; h->l_stride = h->picture.linesize[0]; h->c_stride = h->picture.linesize[1]; h->luma_scan[2] = 8*h->l_stride; h->luma_scan[3] = 8*h->l_stride+8; h->mbx = h->mby = h->mbidx = 0; h->flags = 0; } /***************************************************************************** * * headers and interface * ****************************************************************************/ /** * some predictions require data from the top-neighbouring macroblock. * this data has to be stored for one complete row of macroblocks * and this storage space is allocated here */ void ff_cavs_init_top_lines(AVSContext *h) { /* alloc top line of predictors */ h->top_qp = av_malloc( h->mb_width); h->top_mv[0] = av_malloc((h->mb_width*2+1)*sizeof(cavs_vector)); h->top_mv[1] = av_malloc((h->mb_width*2+1)*sizeof(cavs_vector)); h->top_pred_Y = av_malloc( h->mb_width*2*sizeof(*h->top_pred_Y)); h->top_border_y = av_malloc((h->mb_width+1)*16); h->top_border_u = av_malloc((h->mb_width)*10); h->top_border_v = av_malloc((h->mb_width)*10); /* alloc space for co-located MVs and types */ h->col_mv = av_malloc( h->mb_width*h->mb_height*4*sizeof(cavs_vector)); h->col_type_base = av_malloc(h->mb_width*h->mb_height); h->block = av_mallocz(64*sizeof(DCTELEM)); } av_cold int ff_cavs_init(AVCodecContext *avctx) { AVSContext *h = avctx->priv_data; MpegEncContext * const s = &h->s; MPV_decode_defaults(s); s->avctx = avctx; avctx->pix_fmt= PIX_FMT_YUV420P; h->luma_scan[0] = 0; h->luma_scan[1] = 8; h->intra_pred_l[ INTRA_L_VERT] = intra_pred_vert; h->intra_pred_l[ INTRA_L_HORIZ] = intra_pred_horiz; h->intra_pred_l[ INTRA_L_LP] = intra_pred_lp; h->intra_pred_l[ INTRA_L_DOWN_LEFT] = intra_pred_down_left; h->intra_pred_l[INTRA_L_DOWN_RIGHT] = intra_pred_down_right; h->intra_pred_l[ INTRA_L_LP_LEFT] = intra_pred_lp_left; h->intra_pred_l[ INTRA_L_LP_TOP] = intra_pred_lp_top; h->intra_pred_l[ INTRA_L_DC_128] = intra_pred_dc_128; h->intra_pred_c[ INTRA_C_LP] = intra_pred_lp; h->intra_pred_c[ INTRA_C_HORIZ] = intra_pred_horiz; h->intra_pred_c[ INTRA_C_VERT] = intra_pred_vert; h->intra_pred_c[ INTRA_C_PLANE] = intra_pred_plane; h->intra_pred_c[ INTRA_C_LP_LEFT] = intra_pred_lp_left; h->intra_pred_c[ INTRA_C_LP_TOP] = intra_pred_lp_top; h->intra_pred_c[ INTRA_C_DC_128] = intra_pred_dc_128; h->mv[ 7] = ff_cavs_un_mv; h->mv[19] = ff_cavs_un_mv; return 0; } av_cold int ff_cavs_end(AVCodecContext *avctx) { AVSContext *h = avctx->priv_data; av_free(h->top_qp); av_free(h->top_mv[0]); av_free(h->top_mv[1]); av_free(h->top_pred_Y); av_free(h->top_border_y); av_free(h->top_border_u); av_free(h->top_border_v); av_free(h->col_mv); av_free(h->col_type_base); av_free(h->block); return 0; }
123linslouis-android-video-cutter
jni/libavcodec/cavs.c
C
asf20
25,880
/* * AC-3 and E-AC-3 decoder tables * Copyright (c) 2007 Bartlomiej Wolowiec <bartek.wolowiec@gmail.com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * Tables taken directly from the AC-3 spec. */ #include "ac3dec_data.h" #include "ac3.h" /** * Table used to ungroup 3 values stored in 5 bits. * Used by bap=1 mantissas and GAQ. * ff_ac3_ungroup_3_in_5_bits_tab[i] = { i/9, (i%9)/3, (i%9)%3 } */ const uint8_t ff_ac3_ungroup_3_in_5_bits_tab[32][3] = { { 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 2 }, { 0, 1, 0 }, { 0, 1, 1 }, { 0, 1, 2 }, { 0, 2, 0 }, { 0, 2, 1 }, { 0, 2, 2 }, { 1, 0, 0 }, { 1, 0, 1 }, { 1, 0, 2 }, { 1, 1, 0 }, { 1, 1, 1 }, { 1, 1, 2 }, { 1, 2, 0 }, { 1, 2, 1 }, { 1, 2, 2 }, { 2, 0, 0 }, { 2, 0, 1 }, { 2, 0, 2 }, { 2, 1, 0 }, { 2, 1, 1 }, { 2, 1, 2 }, { 2, 2, 0 }, { 2, 2, 1 }, { 2, 2, 2 }, { 3, 0, 0 }, { 3, 0, 1 }, { 3, 0, 2 }, { 3, 1, 0 }, { 3, 1, 1 } }; /** * Table of bin locations for rematrixing bands * reference: Section 7.5.2 Rematrixing : Frequency Band Definitions */ const uint8_t ff_ac3_rematrix_band_tab[5] = { 13, 25, 37, 61, 253 }; const uint8_t ff_eac3_hebap_tab[64] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, }; /** * Table E2.16 Default Coupling Banding Structure */ const uint8_t ff_eac3_default_cpl_band_struct[18] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1 }; /** * Table E2.15 Default Spectral Extension Banding Structure */ const uint8_t ff_eac3_default_spx_band_struct[17] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 };
123linslouis-android-video-cutter
jni/libavcodec/ac3dec_data.c
C
asf20
2,497
/* * Smacker decoder * Copyright (c) 2006 Konstantin Shishkov * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * Smacker decoder */ /* * Based on http://wiki.multimedia.cx/index.php?title=Smacker */ #include <stdio.h> #include <stdlib.h> #include "avcodec.h" #define ALT_BITSTREAM_READER_LE #include "get_bits.h" #include "bytestream.h" #define SMKTREE_BITS 9 #define SMK_NODE 0x80000000 /* * Decoder context */ typedef struct SmackVContext { AVCodecContext *avctx; AVFrame pic; int *mmap_tbl, *mclr_tbl, *full_tbl, *type_tbl; int mmap_last[3], mclr_last[3], full_last[3], type_last[3]; } SmackVContext; /** * Context used for code reconstructing */ typedef struct HuffContext { int length; int maxlength; int current; uint32_t *bits; int *lengths; int *values; } HuffContext; /* common parameters used for decode_bigtree */ typedef struct DBCtx { VLC *v1, *v2; int *recode1, *recode2; int escapes[3]; int *last; int lcur; } DBCtx; /* possible runs of blocks */ static const int block_runs[64] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 128, 256, 512, 1024, 2048 }; enum SmkBlockTypes { SMK_BLK_MONO = 0, SMK_BLK_FULL = 1, SMK_BLK_SKIP = 2, SMK_BLK_FILL = 3 }; /** * Decode local frame tree */ static int smacker_decode_tree(GetBitContext *gb, HuffContext *hc, uint32_t prefix, int length) { if(!get_bits1(gb)){ //Leaf if(hc->current >= 256){ av_log(NULL, AV_LOG_ERROR, "Tree size exceeded!\n"); return -1; } if(length){ hc->bits[hc->current] = prefix; hc->lengths[hc->current] = length; } else { hc->bits[hc->current] = 0; hc->lengths[hc->current] = 0; } hc->values[hc->current] = get_bits(gb, 8); hc->current++; if(hc->maxlength < length) hc->maxlength = length; return 0; } else { //Node int r; length++; r = smacker_decode_tree(gb, hc, prefix, length); if(r) return r; return smacker_decode_tree(gb, hc, prefix | (1 << (length - 1)), length); } } /** * Decode header tree */ static int smacker_decode_bigtree(GetBitContext *gb, HuffContext *hc, DBCtx *ctx) { if(!get_bits1(gb)){ //Leaf int val, i1, i2, b1, b2; if(hc->current >= hc->length){ av_log(NULL, AV_LOG_ERROR, "Tree size exceeded!\n"); return -1; } b1 = get_bits_count(gb); i1 = get_vlc2(gb, ctx->v1->table, SMKTREE_BITS, 3); b1 = get_bits_count(gb) - b1; b2 = get_bits_count(gb); i2 = get_vlc2(gb, ctx->v2->table, SMKTREE_BITS, 3); b2 = get_bits_count(gb) - b2; val = ctx->recode1[i1] | (ctx->recode2[i2] << 8); if(val == ctx->escapes[0]) { ctx->last[0] = hc->current; val = 0; } else if(val == ctx->escapes[1]) { ctx->last[1] = hc->current; val = 0; } else if(val == ctx->escapes[2]) { ctx->last[2] = hc->current; val = 0; } hc->values[hc->current++] = val; return 1; } else { //Node int r = 0, t; t = hc->current++; r = smacker_decode_bigtree(gb, hc, ctx); if(r < 0) return r; hc->values[t] = SMK_NODE | r; r++; r += smacker_decode_bigtree(gb, hc, ctx); return r; } } /** * Store large tree as FFmpeg's vlc codes */ static int smacker_decode_header_tree(SmackVContext *smk, GetBitContext *gb, int **recodes, int *last, int size) { int res; HuffContext huff; HuffContext tmp1, tmp2; VLC vlc[2]; int escapes[3]; DBCtx ctx; if(size >= UINT_MAX>>4){ // (((size + 3) >> 2) + 3) << 2 must not overflow av_log(smk->avctx, AV_LOG_ERROR, "size too large\n"); return -1; } tmp1.length = 256; tmp1.maxlength = 0; tmp1.current = 0; tmp1.bits = av_mallocz(256 * 4); tmp1.lengths = av_mallocz(256 * sizeof(int)); tmp1.values = av_mallocz(256 * sizeof(int)); tmp2.length = 256; tmp2.maxlength = 0; tmp2.current = 0; tmp2.bits = av_mallocz(256 * 4); tmp2.lengths = av_mallocz(256 * sizeof(int)); tmp2.values = av_mallocz(256 * sizeof(int)); memset(&vlc[0], 0, sizeof(VLC)); memset(&vlc[1], 0, sizeof(VLC)); if(get_bits1(gb)) { smacker_decode_tree(gb, &tmp1, 0, 0); skip_bits1(gb); res = init_vlc(&vlc[0], SMKTREE_BITS, tmp1.length, tmp1.lengths, sizeof(int), sizeof(int), tmp1.bits, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE); if(res < 0) { av_log(smk->avctx, AV_LOG_ERROR, "Cannot build VLC table\n"); return -1; } } else { av_log(smk->avctx, AV_LOG_ERROR, "Skipping low bytes tree\n"); } if(get_bits1(gb)){ smacker_decode_tree(gb, &tmp2, 0, 0); skip_bits1(gb); res = init_vlc(&vlc[1], SMKTREE_BITS, tmp2.length, tmp2.lengths, sizeof(int), sizeof(int), tmp2.bits, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE); if(res < 0) { av_log(smk->avctx, AV_LOG_ERROR, "Cannot build VLC table\n"); return -1; } } else { av_log(smk->avctx, AV_LOG_ERROR, "Skipping high bytes tree\n"); } escapes[0] = get_bits(gb, 8); escapes[0] |= get_bits(gb, 8) << 8; escapes[1] = get_bits(gb, 8); escapes[1] |= get_bits(gb, 8) << 8; escapes[2] = get_bits(gb, 8); escapes[2] |= get_bits(gb, 8) << 8; last[0] = last[1] = last[2] = -1; ctx.escapes[0] = escapes[0]; ctx.escapes[1] = escapes[1]; ctx.escapes[2] = escapes[2]; ctx.v1 = &vlc[0]; ctx.v2 = &vlc[1]; ctx.recode1 = tmp1.values; ctx.recode2 = tmp2.values; ctx.last = last; huff.length = ((size + 3) >> 2) + 3; huff.maxlength = 0; huff.current = 0; huff.values = av_mallocz(huff.length * sizeof(int)); smacker_decode_bigtree(gb, &huff, &ctx); skip_bits1(gb); if(ctx.last[0] == -1) ctx.last[0] = huff.current++; if(ctx.last[1] == -1) ctx.last[1] = huff.current++; if(ctx.last[2] == -1) ctx.last[2] = huff.current++; *recodes = huff.values; if(vlc[0].table) free_vlc(&vlc[0]); if(vlc[1].table) free_vlc(&vlc[1]); av_free(tmp1.bits); av_free(tmp1.lengths); av_free(tmp1.values); av_free(tmp2.bits); av_free(tmp2.lengths); av_free(tmp2.values); return 0; } static int decode_header_trees(SmackVContext *smk) { GetBitContext gb; int mmap_size, mclr_size, full_size, type_size; mmap_size = AV_RL32(smk->avctx->extradata); mclr_size = AV_RL32(smk->avctx->extradata + 4); full_size = AV_RL32(smk->avctx->extradata + 8); type_size = AV_RL32(smk->avctx->extradata + 12); init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8); if(!get_bits1(&gb)) { av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n"); smk->mmap_tbl = av_malloc(sizeof(int) * 2); smk->mmap_tbl[0] = 0; smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1; } else { smacker_decode_header_tree(smk, &gb, &smk->mmap_tbl, smk->mmap_last, mmap_size); } if(!get_bits1(&gb)) { av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n"); smk->mclr_tbl = av_malloc(sizeof(int) * 2); smk->mclr_tbl[0] = 0; smk->mclr_last[0] = smk->mclr_last[1] = smk->mclr_last[2] = 1; } else { smacker_decode_header_tree(smk, &gb, &smk->mclr_tbl, smk->mclr_last, mclr_size); } if(!get_bits1(&gb)) { av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n"); smk->full_tbl = av_malloc(sizeof(int) * 2); smk->full_tbl[0] = 0; smk->full_last[0] = smk->full_last[1] = smk->full_last[2] = 1; } else { smacker_decode_header_tree(smk, &gb, &smk->full_tbl, smk->full_last, full_size); } if(!get_bits1(&gb)) { av_log(smk->avctx, AV_LOG_INFO, "Skipping TYPE tree\n"); smk->type_tbl = av_malloc(sizeof(int) * 2); smk->type_tbl[0] = 0; smk->type_last[0] = smk->type_last[1] = smk->type_last[2] = 1; } else { smacker_decode_header_tree(smk, &gb, &smk->type_tbl, smk->type_last, type_size); } return 0; } static av_always_inline void last_reset(int *recode, int *last) { recode[last[0]] = recode[last[1]] = recode[last[2]] = 0; } /* get code and update history */ static av_always_inline int smk_get_code(GetBitContext *gb, int *recode, int *last) { register int *table = recode; int v, b; b = get_bits_count(gb); while(*table & SMK_NODE) { if(get_bits1(gb)) table += (*table) & (~SMK_NODE); table++; } v = *table; b = get_bits_count(gb) - b; if(v != recode[last[0]]) { recode[last[2]] = recode[last[1]]; recode[last[1]] = recode[last[0]]; recode[last[0]] = v; } return v; } static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; SmackVContext * const smk = avctx->priv_data; uint8_t *out; uint32_t *pal; GetBitContext gb; int blocks, blk, bw, bh; int i; int stride; if(buf_size <= 769) return 0; if(smk->pic.data[0]) avctx->release_buffer(avctx, &smk->pic); smk->pic.reference = 1; smk->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; if(avctx->reget_buffer(avctx, &smk->pic) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } /* make the palette available on the way out */ pal = (uint32_t*)smk->pic.data[1]; smk->pic.palette_has_changed = buf[0] & 1; smk->pic.key_frame = !!(buf[0] & 2); if(smk->pic.key_frame) smk->pic.pict_type = FF_I_TYPE; else smk->pic.pict_type = FF_P_TYPE; buf++; for(i = 0; i < 256; i++) *pal++ = bytestream_get_be24(&buf); buf_size -= 769; last_reset(smk->mmap_tbl, smk->mmap_last); last_reset(smk->mclr_tbl, smk->mclr_last); last_reset(smk->full_tbl, smk->full_last); last_reset(smk->type_tbl, smk->type_last); init_get_bits(&gb, buf, buf_size * 8); blk = 0; bw = avctx->width >> 2; bh = avctx->height >> 2; blocks = bw * bh; out = smk->pic.data[0]; stride = smk->pic.linesize[0]; while(blk < blocks) { int type, run, mode; uint16_t pix; type = smk_get_code(&gb, smk->type_tbl, smk->type_last); run = block_runs[(type >> 2) & 0x3F]; switch(type & 3){ case SMK_BLK_MONO: while(run-- && blk < blocks){ int clr, map; int hi, lo; clr = smk_get_code(&gb, smk->mclr_tbl, smk->mclr_last); map = smk_get_code(&gb, smk->mmap_tbl, smk->mmap_last); out = smk->pic.data[0] + (blk / bw) * (stride * 4) + (blk % bw) * 4; hi = clr >> 8; lo = clr & 0xFF; for(i = 0; i < 4; i++) { if(map & 1) out[0] = hi; else out[0] = lo; if(map & 2) out[1] = hi; else out[1] = lo; if(map & 4) out[2] = hi; else out[2] = lo; if(map & 8) out[3] = hi; else out[3] = lo; map >>= 4; out += stride; } blk++; } break; case SMK_BLK_FULL: mode = 0; if(avctx->codec_tag == MKTAG('S', 'M', 'K', '4')) { // In case of Smacker v4 we have three modes if(get_bits1(&gb)) mode = 1; else if(get_bits1(&gb)) mode = 2; } while(run-- && blk < blocks){ out = smk->pic.data[0] + (blk / bw) * (stride * 4) + (blk % bw) * 4; switch(mode){ case 0: for(i = 0; i < 4; i++) { pix = smk_get_code(&gb, smk->full_tbl, smk->full_last); AV_WL16(out+2,pix); pix = smk_get_code(&gb, smk->full_tbl, smk->full_last); AV_WL16(out,pix); out += stride; } break; case 1: pix = smk_get_code(&gb, smk->full_tbl, smk->full_last); out[0] = out[1] = pix & 0xFF; out[2] = out[3] = pix >> 8; out += stride; out[0] = out[1] = pix & 0xFF; out[2] = out[3] = pix >> 8; out += stride; pix = smk_get_code(&gb, smk->full_tbl, smk->full_last); out[0] = out[1] = pix & 0xFF; out[2] = out[3] = pix >> 8; out += stride; out[0] = out[1] = pix & 0xFF; out[2] = out[3] = pix >> 8; out += stride; break; case 2: for(i = 0; i < 2; i++) { uint16_t pix1, pix2; pix2 = smk_get_code(&gb, smk->full_tbl, smk->full_last); pix1 = smk_get_code(&gb, smk->full_tbl, smk->full_last); AV_WL16(out,pix1); AV_WL16(out+2,pix2); out += stride; AV_WL16(out,pix1); AV_WL16(out+2,pix2); out += stride; } break; } blk++; } break; case SMK_BLK_SKIP: while(run-- && blk < blocks) blk++; break; case SMK_BLK_FILL: mode = type >> 8; while(run-- && blk < blocks){ uint32_t col; out = smk->pic.data[0] + (blk / bw) * (stride * 4) + (blk % bw) * 4; col = mode * 0x01010101; for(i = 0; i < 4; i++) { *((uint32_t*)out) = col; out += stride; } blk++; } break; } } *data_size = sizeof(AVFrame); *(AVFrame*)data = smk->pic; /* always report that the buffer was completely consumed */ return buf_size; } /* * * Init smacker decoder * */ static av_cold int decode_init(AVCodecContext *avctx) { SmackVContext * const c = avctx->priv_data; c->avctx = avctx; avctx->pix_fmt = PIX_FMT_PAL8; /* decode huffman trees from extradata */ if(avctx->extradata_size < 16){ av_log(avctx, AV_LOG_ERROR, "Extradata missing!\n"); return -1; } decode_header_trees(c); return 0; } /* * * Uninit smacker decoder * */ static av_cold int decode_end(AVCodecContext *avctx) { SmackVContext * const smk = avctx->priv_data; av_freep(&smk->mmap_tbl); av_freep(&smk->mclr_tbl); av_freep(&smk->full_tbl); av_freep(&smk->type_tbl); if (smk->pic.data[0]) avctx->release_buffer(avctx, &smk->pic); return 0; } static av_cold int smka_decode_init(AVCodecContext *avctx) { avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO; avctx->sample_fmt = avctx->bits_per_coded_sample == 8 ? SAMPLE_FMT_U8 : SAMPLE_FMT_S16; return 0; } /** * Decode Smacker audio data */ static int smka_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; GetBitContext gb; HuffContext h[4]; VLC vlc[4]; int16_t *samples = data; int8_t *samples8 = data; int val; int i, res; int unp_size; int bits, stereo; int pred[2] = {0, 0}; unp_size = AV_RL32(buf); init_get_bits(&gb, buf + 4, (buf_size - 4) * 8); if(!get_bits1(&gb)){ av_log(avctx, AV_LOG_INFO, "Sound: no data\n"); *data_size = 0; return 1; } stereo = get_bits1(&gb); bits = get_bits1(&gb); if (unp_size & 0xC0000000 || unp_size > *data_size) { av_log(avctx, AV_LOG_ERROR, "Frame is too large to fit in buffer\n"); return -1; } memset(vlc, 0, sizeof(VLC) * 4); memset(h, 0, sizeof(HuffContext) * 4); // Initialize for(i = 0; i < (1 << (bits + stereo)); i++) { h[i].length = 256; h[i].maxlength = 0; h[i].current = 0; h[i].bits = av_mallocz(256 * 4); h[i].lengths = av_mallocz(256 * sizeof(int)); h[i].values = av_mallocz(256 * sizeof(int)); skip_bits1(&gb); smacker_decode_tree(&gb, &h[i], 0, 0); skip_bits1(&gb); if(h[i].current > 1) { res = init_vlc(&vlc[i], SMKTREE_BITS, h[i].length, h[i].lengths, sizeof(int), sizeof(int), h[i].bits, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE); if(res < 0) { av_log(avctx, AV_LOG_ERROR, "Cannot build VLC table\n"); return -1; } } } if(bits) { //decode 16-bit data for(i = stereo; i >= 0; i--) pred[i] = bswap_16(get_bits(&gb, 16)); for(i = 0; i < stereo; i++) *samples++ = pred[i]; for(i = 0; i < unp_size / 2; i++) { if(i & stereo) { if(vlc[2].table) res = get_vlc2(&gb, vlc[2].table, SMKTREE_BITS, 3); else res = 0; val = h[2].values[res]; if(vlc[3].table) res = get_vlc2(&gb, vlc[3].table, SMKTREE_BITS, 3); else res = 0; val |= h[3].values[res] << 8; pred[1] += (int16_t)val; *samples++ = pred[1]; } else { if(vlc[0].table) res = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3); else res = 0; val = h[0].values[res]; if(vlc[1].table) res = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3); else res = 0; val |= h[1].values[res] << 8; pred[0] += val; *samples++ = pred[0]; } } } else { //8-bit data for(i = stereo; i >= 0; i--) pred[i] = get_bits(&gb, 8); for(i = 0; i < stereo; i++) *samples8++ = pred[i]; for(i = 0; i < unp_size; i++) { if(i & stereo){ if(vlc[1].table) res = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3); else res = 0; pred[1] += (int8_t)h[1].values[res]; *samples8++ = pred[1]; } else { if(vlc[0].table) res = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3); else res = 0; pred[0] += (int8_t)h[0].values[res]; *samples8++ = pred[0]; } } } for(i = 0; i < 4; i++) { if(vlc[i].table) free_vlc(&vlc[i]); if(h[i].bits) av_free(h[i].bits); if(h[i].lengths) av_free(h[i].lengths); if(h[i].values) av_free(h[i].values); } *data_size = unp_size; return buf_size; } AVCodec smacker_decoder = { "smackvid", AVMEDIA_TYPE_VIDEO, CODEC_ID_SMACKVIDEO, sizeof(SmackVContext), decode_init, NULL, decode_end, decode_frame, CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("Smacker video"), }; AVCodec smackaud_decoder = { "smackaud", AVMEDIA_TYPE_AUDIO, CODEC_ID_SMACKAUDIO, 0, smka_decode_init, NULL, NULL, smka_decode_frame, .long_name = NULL_IF_CONFIG_SMALL("Smacker audio"), };
123linslouis-android-video-cutter
jni/libavcodec/smacker.c
C
asf20
21,319
/* * H26L/H264/AVC/JVT/14496-10/... encoder/decoder * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * @brief * H264 / AVC / MPEG4 part10 codec data table * @author Michael Niedermayer <michaelni@gmx.at> */ #ifndef AVCODEC_H264DATA_H #define AVCODEC_H264DATA_H #include <stdint.h> #include "libavutil/rational.h" #include "mpegvideo.h" #include "h264.h" static const uint8_t golomb_to_pict_type[5]= {FF_P_TYPE, FF_B_TYPE, FF_I_TYPE, FF_SP_TYPE, FF_SI_TYPE}; static const uint8_t golomb_to_intra4x4_cbp[48]={ 47, 31, 15, 0, 23, 27, 29, 30, 7, 11, 13, 14, 39, 43, 45, 46, 16, 3, 5, 10, 12, 19, 21, 26, 28, 35, 37, 42, 44, 1, 2, 4, 8, 17, 18, 20, 24, 6, 9, 22, 25, 32, 33, 34, 36, 40, 38, 41 }; static const uint8_t golomb_to_inter_cbp[48]={ 0, 16, 1, 2, 4, 8, 32, 3, 5, 10, 12, 15, 47, 7, 11, 13, 14, 6, 9, 31, 35, 37, 42, 44, 33, 34, 36, 40, 39, 43, 45, 46, 17, 18, 20, 24, 19, 21, 26, 28, 23, 27, 29, 30, 22, 25, 38, 41 }; static const uint8_t zigzag_scan[16]={ 0+0*4, 1+0*4, 0+1*4, 0+2*4, 1+1*4, 2+0*4, 3+0*4, 2+1*4, 1+2*4, 0+3*4, 1+3*4, 2+2*4, 3+1*4, 3+2*4, 2+3*4, 3+3*4, }; static const uint8_t field_scan[16]={ 0+0*4, 0+1*4, 1+0*4, 0+2*4, 0+3*4, 1+1*4, 1+2*4, 1+3*4, 2+0*4, 2+1*4, 2+2*4, 2+3*4, 3+0*4, 3+1*4, 3+2*4, 3+3*4, }; static const uint8_t luma_dc_zigzag_scan[16]={ 0*16 + 0*64, 1*16 + 0*64, 2*16 + 0*64, 0*16 + 2*64, 3*16 + 0*64, 0*16 + 1*64, 1*16 + 1*64, 2*16 + 1*64, 1*16 + 2*64, 2*16 + 2*64, 3*16 + 2*64, 0*16 + 3*64, 3*16 + 1*64, 1*16 + 3*64, 2*16 + 3*64, 3*16 + 3*64, }; static const uint8_t luma_dc_field_scan[16]={ 0*16 + 0*64, 2*16 + 0*64, 1*16 + 0*64, 0*16 + 2*64, 2*16 + 2*64, 3*16 + 0*64, 1*16 + 2*64, 3*16 + 2*64, 0*16 + 1*64, 2*16 + 1*64, 0*16 + 3*64, 2*16 + 3*64, 1*16 + 1*64, 3*16 + 1*64, 1*16 + 3*64, 3*16 + 3*64, }; static const uint8_t chroma_dc_scan[4]={ (0+0*2)*16, (1+0*2)*16, (0+1*2)*16, (1+1*2)*16, //FIXME }; // zigzag_scan8x8_cavlc[i] = zigzag_scan8x8[(i/4) + 16*(i%4)] static const uint8_t zigzag_scan8x8_cavlc[64]={ 0+0*8, 1+1*8, 1+2*8, 2+2*8, 4+1*8, 0+5*8, 3+3*8, 7+0*8, 3+4*8, 1+7*8, 5+3*8, 6+3*8, 2+7*8, 6+4*8, 5+6*8, 7+5*8, 1+0*8, 2+0*8, 0+3*8, 3+1*8, 3+2*8, 0+6*8, 4+2*8, 6+1*8, 2+5*8, 2+6*8, 6+2*8, 5+4*8, 3+7*8, 7+3*8, 4+7*8, 7+6*8, 0+1*8, 3+0*8, 0+4*8, 4+0*8, 2+3*8, 1+5*8, 5+1*8, 5+2*8, 1+6*8, 3+5*8, 7+1*8, 4+5*8, 4+6*8, 7+4*8, 5+7*8, 6+7*8, 0+2*8, 2+1*8, 1+3*8, 5+0*8, 1+4*8, 2+4*8, 6+0*8, 4+3*8, 0+7*8, 4+4*8, 7+2*8, 3+6*8, 5+5*8, 6+5*8, 6+6*8, 7+7*8, }; static const uint8_t field_scan8x8[64]={ 0+0*8, 0+1*8, 0+2*8, 1+0*8, 1+1*8, 0+3*8, 0+4*8, 1+2*8, 2+0*8, 1+3*8, 0+5*8, 0+6*8, 0+7*8, 1+4*8, 2+1*8, 3+0*8, 2+2*8, 1+5*8, 1+6*8, 1+7*8, 2+3*8, 3+1*8, 4+0*8, 3+2*8, 2+4*8, 2+5*8, 2+6*8, 2+7*8, 3+3*8, 4+1*8, 5+0*8, 4+2*8, 3+4*8, 3+5*8, 3+6*8, 3+7*8, 4+3*8, 5+1*8, 6+0*8, 5+2*8, 4+4*8, 4+5*8, 4+6*8, 4+7*8, 5+3*8, 6+1*8, 6+2*8, 5+4*8, 5+5*8, 5+6*8, 5+7*8, 6+3*8, 7+0*8, 7+1*8, 6+4*8, 6+5*8, 6+6*8, 6+7*8, 7+2*8, 7+3*8, 7+4*8, 7+5*8, 7+6*8, 7+7*8, }; static const uint8_t field_scan8x8_cavlc[64]={ 0+0*8, 1+1*8, 2+0*8, 0+7*8, 2+2*8, 2+3*8, 2+4*8, 3+3*8, 3+4*8, 4+3*8, 4+4*8, 5+3*8, 5+5*8, 7+0*8, 6+6*8, 7+4*8, 0+1*8, 0+3*8, 1+3*8, 1+4*8, 1+5*8, 3+1*8, 2+5*8, 4+1*8, 3+5*8, 5+1*8, 4+5*8, 6+1*8, 5+6*8, 7+1*8, 6+7*8, 7+5*8, 0+2*8, 0+4*8, 0+5*8, 2+1*8, 1+6*8, 4+0*8, 2+6*8, 5+0*8, 3+6*8, 6+0*8, 4+6*8, 6+2*8, 5+7*8, 6+4*8, 7+2*8, 7+6*8, 1+0*8, 1+2*8, 0+6*8, 3+0*8, 1+7*8, 3+2*8, 2+7*8, 4+2*8, 3+7*8, 5+2*8, 4+7*8, 5+4*8, 6+3*8, 6+5*8, 7+3*8, 7+7*8, }; typedef struct IMbInfo{ uint16_t type; uint8_t pred_mode; uint8_t cbp; } IMbInfo; static const IMbInfo i_mb_type_info[26]={ {MB_TYPE_INTRA4x4 , -1, -1}, {MB_TYPE_INTRA16x16, 2, 0}, {MB_TYPE_INTRA16x16, 1, 0}, {MB_TYPE_INTRA16x16, 0, 0}, {MB_TYPE_INTRA16x16, 3, 0}, {MB_TYPE_INTRA16x16, 2, 16}, {MB_TYPE_INTRA16x16, 1, 16}, {MB_TYPE_INTRA16x16, 0, 16}, {MB_TYPE_INTRA16x16, 3, 16}, {MB_TYPE_INTRA16x16, 2, 32}, {MB_TYPE_INTRA16x16, 1, 32}, {MB_TYPE_INTRA16x16, 0, 32}, {MB_TYPE_INTRA16x16, 3, 32}, {MB_TYPE_INTRA16x16, 2, 15+0}, {MB_TYPE_INTRA16x16, 1, 15+0}, {MB_TYPE_INTRA16x16, 0, 15+0}, {MB_TYPE_INTRA16x16, 3, 15+0}, {MB_TYPE_INTRA16x16, 2, 15+16}, {MB_TYPE_INTRA16x16, 1, 15+16}, {MB_TYPE_INTRA16x16, 0, 15+16}, {MB_TYPE_INTRA16x16, 3, 15+16}, {MB_TYPE_INTRA16x16, 2, 15+32}, {MB_TYPE_INTRA16x16, 1, 15+32}, {MB_TYPE_INTRA16x16, 0, 15+32}, {MB_TYPE_INTRA16x16, 3, 15+32}, {MB_TYPE_INTRA_PCM , -1, -1}, }; typedef struct PMbInfo{ uint16_t type; uint8_t partition_count; } PMbInfo; static const PMbInfo p_mb_type_info[5]={ {MB_TYPE_16x16|MB_TYPE_P0L0 , 1}, {MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P1L0, 2}, {MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P1L0, 2}, {MB_TYPE_8x8 |MB_TYPE_P0L0|MB_TYPE_P1L0, 4}, {MB_TYPE_8x8 |MB_TYPE_P0L0|MB_TYPE_P1L0|MB_TYPE_REF0, 4}, }; static const PMbInfo p_sub_mb_type_info[4]={ {MB_TYPE_16x16|MB_TYPE_P0L0 , 1}, {MB_TYPE_16x8 |MB_TYPE_P0L0 , 2}, {MB_TYPE_8x16 |MB_TYPE_P0L0 , 2}, {MB_TYPE_8x8 |MB_TYPE_P0L0 , 4}, }; static const PMbInfo b_mb_type_info[23]={ {MB_TYPE_DIRECT2|MB_TYPE_L0L1 , 1, }, {MB_TYPE_16x16|MB_TYPE_P0L0 , 1, }, {MB_TYPE_16x16 |MB_TYPE_P0L1 , 1, }, {MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1 , 1, }, {MB_TYPE_16x8 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 2, }, {MB_TYPE_8x16 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 2, }, {MB_TYPE_16x8 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, }, {MB_TYPE_8x16 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, }, {MB_TYPE_16x8 |MB_TYPE_P0L0 |MB_TYPE_P1L1, 2, }, {MB_TYPE_8x16 |MB_TYPE_P0L0 |MB_TYPE_P1L1, 2, }, {MB_TYPE_16x8 |MB_TYPE_P0L1|MB_TYPE_P1L0 , 2, }, {MB_TYPE_8x16 |MB_TYPE_P0L1|MB_TYPE_P1L0 , 2, }, {MB_TYPE_16x8 |MB_TYPE_P0L0 |MB_TYPE_P1L0|MB_TYPE_P1L1, 2, }, {MB_TYPE_8x16 |MB_TYPE_P0L0 |MB_TYPE_P1L0|MB_TYPE_P1L1, 2, }, {MB_TYPE_16x8 |MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, }, {MB_TYPE_8x16 |MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, }, {MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0 , 2, }, {MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0 , 2, }, {MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, }, {MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, }, {MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, }, {MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, }, {MB_TYPE_8x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 4, }, }; static const PMbInfo b_sub_mb_type_info[13]={ {MB_TYPE_DIRECT2 , 1, }, {MB_TYPE_16x16|MB_TYPE_P0L0 , 1, }, {MB_TYPE_16x16 |MB_TYPE_P0L1 , 1, }, {MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1 , 1, }, {MB_TYPE_16x8 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 2, }, {MB_TYPE_8x16 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 2, }, {MB_TYPE_16x8 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, }, {MB_TYPE_8x16 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 2, }, {MB_TYPE_16x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, }, {MB_TYPE_8x16 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 2, }, {MB_TYPE_8x8 |MB_TYPE_P0L0 |MB_TYPE_P1L0 , 4, }, {MB_TYPE_8x8 |MB_TYPE_P0L1 |MB_TYPE_P1L1, 4, }, {MB_TYPE_8x8 |MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_P1L0|MB_TYPE_P1L1, 4, }, }; static const uint8_t dequant4_coeff_init[6][3]={ {10,13,16}, {11,14,18}, {13,16,20}, {14,18,23}, {16,20,25}, {18,23,29}, }; static const uint8_t dequant8_coeff_init_scan[16] = { 0,3,4,3, 3,1,5,1, 4,5,2,5, 3,1,5,1 }; static const uint8_t dequant8_coeff_init[6][6]={ {20,18,32,19,25,24}, {22,19,35,21,28,26}, {26,23,42,24,33,31}, {28,25,45,26,35,33}, {32,28,51,30,40,38}, {36,32,58,34,46,43}, }; #endif /* AVCODEC_H264DATA_H */
123linslouis-android-video-cutter
jni/libavcodec/h264data.h
C
asf20
9,096
/* * LOCO codec * Copyright (c) 2005 Konstantin Shishkov * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * LOCO codec. */ #include "avcodec.h" #include "get_bits.h" #include "golomb.h" #include "mathops.h" enum LOCO_MODE {LOCO_UNKN=0, LOCO_CYUY2=-1, LOCO_CRGB=-2, LOCO_CRGBA=-3, LOCO_CYV12=-4, LOCO_YUY2=1, LOCO_UYVY=2, LOCO_RGB=3, LOCO_RGBA=4, LOCO_YV12=5}; typedef struct LOCOContext{ AVCodecContext *avctx; AVFrame pic; int lossy; int mode; } LOCOContext; typedef struct RICEContext{ GetBitContext gb; int save, run, run2; /* internal rice decoder state */ int sum, count; /* sum and count for getting rice parameter */ int lossy; }RICEContext; static int loco_get_rice_param(RICEContext *r) { int cnt = 0; int val = r->count; while(r->sum > val && cnt < 9) { val <<= 1; cnt++; } return cnt; } static inline void loco_update_rice_param(RICEContext *r, int val) { r->sum += val; r->count++; if(r->count == 16) { r->sum >>= 1; r->count >>= 1; } } static inline int loco_get_rice(RICEContext *r) { int v; if (r->run > 0) { /* we have zero run */ r->run--; loco_update_rice_param(r, 0); return 0; } v = get_ur_golomb_jpegls(&r->gb, loco_get_rice_param(r), INT_MAX, 0); loco_update_rice_param(r, (v+1)>>1); if (!v) { if (r->save >= 0) { r->run = get_ur_golomb_jpegls(&r->gb, 2, INT_MAX, 0); if(r->run > 1) r->save += r->run + 1; else r->save -= 3; } else r->run2++; } else { v = ((v>>1) + r->lossy) ^ -(v&1); if (r->run2 > 0) { if (r->run2 > 2) r->save += r->run2; else r->save -= 3; r->run2 = 0; } } return v; } /* LOCO main predictor - LOCO-I/JPEG-LS predictor */ static inline int loco_predict(uint8_t* data, int stride, int step) { int a, b, c; a = data[-stride]; b = data[-step]; c = data[-stride - step]; return mid_pred(a, a + b - c, b); } static int loco_decode_plane(LOCOContext *l, uint8_t *data, int width, int height, int stride, const uint8_t *buf, int buf_size, int step) { RICEContext rc; int val; int i, j; init_get_bits(&rc.gb, buf, buf_size*8); rc.save = 0; rc.run = 0; rc.run2 = 0; rc.lossy = l->lossy; rc.sum = 8; rc.count = 1; /* restore top left pixel */ val = loco_get_rice(&rc); data[0] = 128 + val; /* restore top line */ for (i = 1; i < width; i++) { val = loco_get_rice(&rc); data[i * step] = data[i * step - step] + val; } data += stride; for (j = 1; j < height; j++) { /* restore left column */ val = loco_get_rice(&rc); data[0] = data[-stride] + val; /* restore all other pixels */ for (i = 1; i < width; i++) { val = loco_get_rice(&rc); data[i * step] = loco_predict(&data[i * step], stride, step) + val; } data += stride; } return (get_bits_count(&rc.gb) + 7) >> 3; } static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; LOCOContext * const l = avctx->priv_data; AVFrame * const p= (AVFrame*)&l->pic; int decoded; if(p->data[0]) avctx->release_buffer(avctx, p); p->reference = 0; if(avctx->get_buffer(avctx, p) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } p->key_frame = 1; switch(l->mode) { case LOCO_CYUY2: case LOCO_YUY2: case LOCO_UYVY: decoded = loco_decode_plane(l, p->data[0], avctx->width, avctx->height, p->linesize[0], buf, buf_size, 1); buf += decoded; buf_size -= decoded; decoded = loco_decode_plane(l, p->data[1], avctx->width / 2, avctx->height, p->linesize[1], buf, buf_size, 1); buf += decoded; buf_size -= decoded; decoded = loco_decode_plane(l, p->data[2], avctx->width / 2, avctx->height, p->linesize[2], buf, buf_size, 1); break; case LOCO_CYV12: case LOCO_YV12: decoded = loco_decode_plane(l, p->data[0], avctx->width, avctx->height, p->linesize[0], buf, buf_size, 1); buf += decoded; buf_size -= decoded; decoded = loco_decode_plane(l, p->data[2], avctx->width / 2, avctx->height / 2, p->linesize[2], buf, buf_size, 1); buf += decoded; buf_size -= decoded; decoded = loco_decode_plane(l, p->data[1], avctx->width / 2, avctx->height / 2, p->linesize[1], buf, buf_size, 1); break; case LOCO_CRGB: case LOCO_RGB: decoded = loco_decode_plane(l, p->data[0] + p->linesize[0]*(avctx->height-1), avctx->width, avctx->height, -p->linesize[0], buf, buf_size, 3); buf += decoded; buf_size -= decoded; decoded = loco_decode_plane(l, p->data[0] + p->linesize[0]*(avctx->height-1) + 1, avctx->width, avctx->height, -p->linesize[0], buf, buf_size, 3); buf += decoded; buf_size -= decoded; decoded = loco_decode_plane(l, p->data[0] + p->linesize[0]*(avctx->height-1) + 2, avctx->width, avctx->height, -p->linesize[0], buf, buf_size, 3); break; case LOCO_RGBA: decoded = loco_decode_plane(l, p->data[0], avctx->width, avctx->height, p->linesize[0], buf, buf_size, 4); buf += decoded; buf_size -= decoded; decoded = loco_decode_plane(l, p->data[0] + 1, avctx->width, avctx->height, p->linesize[0], buf, buf_size, 4); buf += decoded; buf_size -= decoded; decoded = loco_decode_plane(l, p->data[0] + 2, avctx->width, avctx->height, p->linesize[0], buf, buf_size, 4); buf += decoded; buf_size -= decoded; decoded = loco_decode_plane(l, p->data[0] + 3, avctx->width, avctx->height, p->linesize[0], buf, buf_size, 4); break; } *data_size = sizeof(AVFrame); *(AVFrame*)data = l->pic; return buf_size; } static av_cold int decode_init(AVCodecContext *avctx){ LOCOContext * const l = avctx->priv_data; int version; l->avctx = avctx; if (avctx->extradata_size < 12) { av_log(avctx, AV_LOG_ERROR, "Extradata size must be >= 12 instead of %i\n", avctx->extradata_size); return -1; } version = AV_RL32(avctx->extradata); switch(version) { case 1: l->lossy = 0; break; case 2: l->lossy = AV_RL32(avctx->extradata + 8); break; default: l->lossy = AV_RL32(avctx->extradata + 8); av_log(avctx, AV_LOG_INFO, "This is LOCO codec version %i, please upload file for study\n", version); } l->mode = AV_RL32(avctx->extradata + 4); switch(l->mode) { case LOCO_CYUY2: case LOCO_YUY2: case LOCO_UYVY: avctx->pix_fmt = PIX_FMT_YUV422P; break; case LOCO_CRGB: case LOCO_RGB: avctx->pix_fmt = PIX_FMT_BGR24; break; case LOCO_CYV12: case LOCO_YV12: avctx->pix_fmt = PIX_FMT_YUV420P; break; case LOCO_CRGBA: case LOCO_RGBA: avctx->pix_fmt = PIX_FMT_RGB32; break; default: av_log(avctx, AV_LOG_INFO, "Unknown colorspace, index = %i\n", l->mode); return -1; } if(avctx->debug & FF_DEBUG_PICT_INFO) av_log(avctx, AV_LOG_INFO, "lossy:%i, version:%i, mode: %i\n", l->lossy, version, l->mode); return 0; } static av_cold int decode_end(AVCodecContext *avctx){ LOCOContext * const l = avctx->priv_data; AVFrame *pic = &l->pic; if (pic->data[0]) avctx->release_buffer(avctx, pic); return 0; } AVCodec loco_decoder = { "loco", AVMEDIA_TYPE_VIDEO, CODEC_ID_LOCO, sizeof(LOCOContext), decode_init, NULL, decode_end, decode_frame, CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("LOCO"), };
123linslouis-android-video-cutter
jni/libavcodec/loco.c
C
asf20
9,203
/* * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVCODEC_INTRAX8HUF_H #define AVCODEC_INTRAX8HUF_H #include <inttypes.h> static const uint16_t x8_orient_lowquant_table[4][12][2]={ {//0 {0x0000, 1}, {0x0004, 3}, {0x0005, 3}, {0x000C, 4}, {0x000D, 4}, {0x0038, 6}, {0x001D, 5}, {0x0039, 6}, {0x003C, 6}, {0x003D, 6}, {0x003E, 6}, {0x003F, 6}, },{//1 {0x0000, 5}, {0x0001, 5}, {0x0002, 5}, {0x0001, 2}, {0x0002, 2}, {0x0002, 4}, {0x0003, 5}, {0x0006, 3}, {0x0003, 4}, {0x000E, 4}, {0x001E, 5}, {0x001F, 5}, },{//2 {0x0000, 2}, {0x0001, 2}, {0x0004, 3}, {0x0005, 3}, {0x0006, 3}, {0x0038, 6}, {0x0039, 6}, {0x001D, 5}, {0x003C, 6}, {0x003D, 6}, {0x003E, 6}, {0x003F, 6}, },{//3 {0x0000, 3}, {0x0002, 4}, {0x0003, 4}, {0x0001, 2}, {0x0002, 2}, {0x0018, 5}, {0x0019, 5}, {0x000D, 4}, {0x001C, 5}, {0x001D, 5}, {0x001E, 5}, {0x001F, 5}, } }; static const uint16_t x8_orient_highquant_table[2][12][2]={ {//0 {0x0000, 2}, {0x0001, 2}, {0x0004, 3}, {0x0005, 3}, {0x0006, 3}, {0x0038, 6}, {0x001D, 5}, {0x0039, 6}, {0x003C, 6}, {0x003D, 6}, {0x003E, 6}, {0x003F, 6}, },{//1 {0x0000, 1}, {0x0002, 2}, {0x0006, 3}, {0x001C, 5}, {0x001D, 5}, {0x0078, 7}, {0x003D, 6}, {0x0079, 7}, {0x007C, 7}, {0x007D, 7}, {0x007E, 7}, {0x007F, 7}, } }; #define MAX_OR_VLC_BITS 7 static const uint16_t x8_dc_lowquant_table[8][34][2]={ {//0 {0x0000, 5}, {0x0001, 4}, {0x0001, 5}, {0x0004, 5}, {0x0005, 5}, {0x0006, 5}, {0x000E, 6}, {0x000F, 6}, {0x0040, 8}, {0x0041, 8}, {0x0840, 13}, {0x0841, 13}, {0x0842, 13}, {0x0843, 13}, {0x0844, 13}, {0x0845, 13}, {0x0846, 13}, {0x0002, 2}, {0x0003, 2}, {0x0003, 3}, {0x0005, 4}, {0x0009, 5}, {0x0011, 6}, {0x0043, 8}, {0x0085, 9}, {0x0847, 13}, {0x0848, 13}, {0x0849, 13}, {0x084A, 13}, {0x084B, 13}, {0x084C, 13}, {0x084D, 13}, {0x084E, 13}, {0x084F, 13}, },{//1 {0x0000, 4}, {0x0001, 3}, {0x0002, 3}, {0x0001, 4}, {0x0006, 4}, {0x0004, 3}, {0x0007, 4}, {0x0005, 3}, {0x000C, 4}, {0x000D, 4}, {0x001C, 5}, {0x003A, 6}, {0x01D8, 9}, {0x01D9, 9}, {0x1DA0, 13}, {0x1DA1, 13}, {0x1DA2, 13}, {0x003C, 6}, {0x003D, 6}, {0x003E, 6}, {0x0077, 7}, {0x01DB, 9}, {0x007E, 7}, {0x00FE, 8}, {0x01FE, 9}, {0x1DA3, 13}, {0x1DA4, 13}, {0x1DA5, 13}, {0x0ED3, 12}, {0x0ED4, 12}, {0x01FF, 9}, {0x0ED5, 12}, {0x0ED6, 12}, {0x0ED7, 12}, },{//2 {0x0000, 4}, {0x0001, 3}, {0x0002, 3}, {0x0001, 4}, {0x0006, 4}, {0x0007, 4}, {0x0008, 4}, {0x0009, 4}, {0x0028, 6}, {0x0029, 6}, {0x0054, 7}, {0x0055, 7}, {0x0AC0, 12}, {0x0AC1, 12}, {0x0AC2, 12}, {0x0AC3, 12}, {0x0AC4, 12}, {0x000B, 4}, {0x0006, 3}, {0x000E, 4}, {0x001E, 5}, {0x003E, 6}, {0x003F, 6}, {0x0057, 7}, {0x00AD, 8}, {0x0AC5, 12}, {0x0AC6, 12}, {0x0AC7, 12}, {0x0AC8, 12}, {0x0AC9, 12}, {0x0ACA, 12}, {0x0ACB, 12}, {0x0566, 11}, {0x0567, 11}, },{//3 {0x0000, 4}, {0x0001, 2}, {0x0001, 3}, {0x0004, 3}, {0x0005, 3}, {0x0006, 3}, {0x0001, 4}, {0x000E, 4}, {0x003C, 6}, {0x003D, 6}, {0x007C, 7}, {0x00FA, 8}, {0x3EC0, 14}, {0x3EC1, 14}, {0x3EC2, 14}, {0x3EC3, 14}, {0x1F62, 13}, {0x01F7, 9}, {0x007E, 7}, {0x00FE, 8}, {0x00FF, 8}, {0x1F63, 13}, {0x1F64, 13}, {0x1F65, 13}, {0x1F66, 13}, {0x1F67, 13}, {0x1F68, 13}, {0x1F69, 13}, {0x1F6A, 13}, {0x1F6B, 13}, {0x1F6C, 13}, {0x1F6D, 13}, {0x1F6E, 13}, {0x1F6F, 13}, },{//4 {0x0000, 7}, {0x0001, 7}, {0x0002, 7}, {0x0003, 7}, {0x0004, 7}, {0x0005, 7}, {0x0006, 7}, {0x0007, 7}, {0x0008, 7}, {0x0009, 7}, {0x000A, 7}, {0x000B, 7}, {0x000C, 7}, {0x000D, 7}, {0x000E, 7}, {0x000F, 7}, {0x0010, 7}, {0x0001, 1}, {0x0001, 2}, {0x0011, 7}, {0x0012, 7}, {0x0013, 7}, {0x0014, 7}, {0x0015, 7}, {0x0016, 7}, {0x0017, 7}, {0x0018, 7}, {0x0019, 7}, {0x001A, 7}, {0x001B, 7}, {0x001C, 7}, {0x001D, 7}, {0x001E, 7}, {0x001F, 7}, },{//5 {0x0000, 5}, {0x0001, 4}, {0x0001, 5}, {0x0008, 6}, {0x0009, 6}, {0x000A, 6}, {0x0016, 7}, {0x000C, 6}, {0x0017, 7}, {0x000D, 6}, {0x0038, 8}, {0x001D, 7}, {0x0039, 8}, {0x0780, 13}, {0x0781, 13}, {0x0782, 13}, {0x0783, 13}, {0x0002, 3}, {0x0001, 1}, {0x0003, 3}, {0x001F, 7}, {0x003D, 8}, {0x0079, 9}, {0x0784, 13}, {0x0785, 13}, {0x0786, 13}, {0x0787, 13}, {0x0788, 13}, {0x0789, 13}, {0x078A, 13}, {0x078B, 13}, {0x078C, 13}, {0x078D, 13}, {0x03C7, 12}, },{//6 {0x0000, 4}, {0x0001, 2}, {0x0001, 3}, {0x0004, 3}, {0x0001, 4}, {0x000A, 4}, {0x0016, 5}, {0x002E, 6}, {0x005E, 7}, {0x005F, 7}, {0x00C0, 8}, {0x3040, 14}, {0x3041, 14}, {0x0305, 10}, {0x0183, 9}, {0x3042, 14}, {0x3043, 14}, {0x000D, 4}, {0x0007, 3}, {0x0019, 5}, {0x0031, 6}, {0x00C2, 8}, {0x00C3, 8}, {0x3044, 14}, {0x3045, 14}, {0x3046, 14}, {0x3047, 14}, {0x3048, 14}, {0x3049, 14}, {0x304A, 14}, {0x304B, 14}, {0x304C, 14}, {0x304D, 14}, {0x1827, 13}, },{//7 {0x0000, 6}, {0x0001, 6}, {0x0002, 6}, {0x0006, 7}, {0x0007, 7}, {0x0004, 6}, {0x0005, 6}, {0x0006, 6}, {0x000E, 7}, {0x001E, 8}, {0x001F, 8}, {0x0040, 9}, {0x0082, 10}, {0x0830, 14}, {0x0831, 14}, {0x0832, 14}, {0x0833, 14}, {0x0001, 1}, {0x0001, 2}, {0x0003, 4}, {0x0005, 5}, {0x0009, 6}, {0x0011, 7}, {0x0021, 8}, {0x0834, 14}, {0x0835, 14}, {0x0836, 14}, {0x0837, 14}, {0x0838, 14}, {0x0839, 14}, {0x083A, 14}, {0x083B, 14}, {0x041E, 13}, {0x041F, 13}, } }; static const uint16_t x8_dc_highquant_table[8][34][2]={ {//0 {0x0000, 5}, {0x0001, 4}, {0x0002, 4}, {0x0001, 5}, {0x0006, 5}, {0x0004, 4}, {0x0007, 5}, {0x000A, 5}, {0x002C, 7}, {0x002D, 7}, {0x05C0, 12}, {0x05C1, 12}, {0x05C2, 12}, {0x05C3, 12}, {0x05C4, 12}, {0x05C5, 12}, {0x05C6, 12}, {0x0003, 3}, {0x0002, 2}, {0x0006, 3}, {0x000E, 4}, {0x001E, 5}, {0x001F, 5}, {0x002F, 7}, {0x005D, 8}, {0x05C7, 12}, {0x05C8, 12}, {0x05C9, 12}, {0x05CA, 12}, {0x05CB, 12}, {0x05CC, 12}, {0x05CD, 12}, {0x05CE, 12}, {0x05CF, 12}, },{//1 {0x0000, 3}, {0x0001, 3}, {0x0002, 3}, {0x0006, 4}, {0x0007, 4}, {0x0004, 3}, {0x000A, 4}, {0x000B, 4}, {0x0030, 6}, {0x0062, 7}, {0x0063, 7}, {0x0640, 11}, {0x0641, 11}, {0x0642, 11}, {0x0643, 11}, {0x0644, 11}, {0x0645, 11}, {0x0033, 6}, {0x000D, 4}, {0x001C, 5}, {0x001D, 5}, {0x003C, 6}, {0x001F, 5}, {0x0065, 7}, {0x007A, 7}, {0x0646, 11}, {0x007B, 7}, {0x0647, 11}, {0x0648, 11}, {0x0649, 11}, {0x064A, 11}, {0x064B, 11}, {0x0326, 10}, {0x0327, 10}, },{//2 {0x0000, 7}, {0x0001, 7}, {0x0001, 6}, {0x0004, 7}, {0x0003, 6}, {0x0005, 7}, {0x0010, 8}, {0x0011, 8}, {0x0240, 13}, {0x0241, 13}, {0x0242, 13}, {0x0243, 13}, {0x0244, 13}, {0x0245, 13}, {0x0246, 13}, {0x0247, 13}, {0x0124, 12}, {0x0001, 1}, {0x0001, 2}, {0x0001, 3}, {0x0003, 5}, {0x0005, 6}, {0x0013, 8}, {0x0125, 12}, {0x0126, 12}, {0x0127, 12}, {0x0128, 12}, {0x0129, 12}, {0x012A, 12}, {0x012B, 12}, {0x012C, 12}, {0x012D, 12}, {0x012E, 12}, {0x012F, 12}, },{//3 {0x0000, 4}, {0x0001, 3}, {0x0002, 3}, {0x0001, 4}, {0x0006, 4}, {0x0004, 3}, {0x0005, 3}, {0x0006, 3}, {0x000E, 5}, {0x000F, 5}, {0x0070, 7}, {0x0710, 11}, {0x0711, 11}, {0x0712, 11}, {0x0713, 11}, {0x0714, 11}, {0x0715, 11}, {0x001D, 5}, {0x0072, 7}, {0x003C, 6}, {0x003D, 6}, {0x0073, 7}, {0x007C, 7}, {0x007D, 7}, {0x007E, 7}, {0x0716, 11}, {0x0717, 11}, {0x0718, 11}, {0x007F, 7}, {0x0719, 11}, {0x071A, 11}, {0x071B, 11}, {0x038E, 10}, {0x038F, 10}, },{//4 {0x0000, 8}, {0x0001, 7}, {0x0002, 7}, {0x0003, 7}, {0x0002, 9}, {0x0008, 8}, {0x0003, 9}, {0x0240, 14}, {0x0241, 14}, {0x0242, 14}, {0x0243, 14}, {0x0244, 14}, {0x0245, 14}, {0x0246, 14}, {0x0247, 14}, {0x0124, 13}, {0x0125, 13}, {0x0001, 2}, {0x0001, 1}, {0x0001, 3}, {0x0001, 4}, {0x0003, 6}, {0x0005, 7}, {0x0013, 9}, {0x0126, 13}, {0x0127, 13}, {0x0128, 13}, {0x0129, 13}, {0x012A, 13}, {0x012B, 13}, {0x012C, 13}, {0x012D, 13}, {0x012E, 13}, {0x012F, 13}, },{//5 {0x0000, 7}, {0x0001, 7}, {0x0001, 6}, {0x0002, 6}, {0x0003, 6}, {0x0004, 6}, {0x0005, 6}, {0x0006, 6}, {0x0007, 6}, {0x0008, 6}, {0x0009, 6}, {0x000A, 6}, {0x000B, 6}, {0x000C, 6}, {0x000D, 6}, {0x000E, 6}, {0x000F, 6}, {0x0010, 6}, {0x0011, 6}, {0x0012, 6}, {0x0013, 6}, {0x0014, 6}, {0x0015, 6}, {0x0016, 6}, {0x0017, 6}, {0x0018, 6}, {0x0019, 6}, {0x0001, 1}, {0x001A, 6}, {0x001B, 6}, {0x001C, 6}, {0x001D, 6}, {0x001E, 6}, {0x001F, 6}, },{//6 {0x0000, 5}, {0x0001, 4}, {0x0001, 5}, {0x0004, 5}, {0x000A, 6}, {0x0006, 5}, {0x000B, 6}, {0x000E, 6}, {0x003C, 8}, {0x003D, 8}, {0x07C0, 13}, {0x07C1, 13}, {0x07C2, 13}, {0x07C3, 13}, {0x07C4, 13}, {0x07C5, 13}, {0x07C6, 13}, {0x0001, 2}, {0x0002, 2}, {0x0006, 3}, {0x000E, 4}, {0x001E, 5}, {0x001F, 5}, {0x003F, 8}, {0x007D, 9}, {0x07C7, 13}, {0x07C8, 13}, {0x07C9, 13}, {0x07CA, 13}, {0x07CB, 13}, {0x07CC, 13}, {0x07CD, 13}, {0x07CE, 13}, {0x07CF, 13}, },{//7 {0x0000, 7}, {0x0001, 7}, {0x0002, 7}, {0x0003, 7}, {0x0004, 7}, {0x0005, 7}, {0x0006, 7}, {0x0007, 7}, {0x0008, 7}, {0x0009, 7}, {0x000A, 7}, {0x000B, 7}, {0x000C, 7}, {0x000D, 7}, {0x000E, 7}, {0x000F, 7}, {0x0010, 7}, {0x0001, 1}, {0x0001, 2}, {0x0011, 7}, {0x0012, 7}, {0x0013, 7}, {0x0014, 7}, {0x0015, 7}, {0x0016, 7}, {0x0017, 7}, {0x0018, 7}, {0x0019, 7}, {0x001A, 7}, {0x001B, 7}, {0x001C, 7}, {0x001D, 7}, {0x001E, 7}, {0x001F, 7}, } }; #define MAX_DC_VLC_BITS 14 static const uint16_t x8_ac0_lowquant_table[8][77][2]={ {//0 {0x0000, 2}, {0x0002, 3}, {0x0006, 4}, {0x000E, 5}, {0x001E, 6}, {0x003E, 7}, {0x003F, 7}, {0x0040, 7}, {0x0104, 9}, {0x0083, 8}, {0x0084, 8}, {0x0085, 8}, {0x020A, 10}, {0x020B, 10}, {0x0218, 10}, {0x0219, 10}, {0x0009, 4}, {0x0044, 7}, {0x010D, 9}, {0x021C, 10}, {0x0023, 6}, {0x0045, 7}, {0x0050, 7}, {0x000B, 4}, {0x000C, 4}, {0x0015, 5}, {0x001A, 5}, {0x001B, 5}, {0x0029, 6}, {0x0038, 6}, {0x0039, 6}, {0x003A, 6}, {0x0051, 7}, {0x0076, 7}, {0x0077, 7}, {0x0078, 7}, {0x0079, 7}, {0x007A, 7}, {0x007B, 7}, {0x00F8, 8}, {0x010F, 9}, {0x021D, 10}, {0x3E40, 14}, {0x3E41, 14}, {0x3E42, 14}, {0x3E43, 14}, {0x03E5, 10}, {0x3E44, 14}, {0x01F3, 9}, {0x3E45, 14}, {0x3E46, 14}, {0x3E47, 14}, {0x00FA, 8}, {0x3E48, 14}, {0x3E49, 14}, {0x3E4A, 14}, {0x3E4B, 14}, {0x03EC, 10}, {0x3E4C, 14}, {0x007E, 7}, {0x00FE, 8}, {0x00FF, 8}, {0x01F7, 9}, {0x3E4D, 14}, {0x3E4E, 14}, {0x3E4F, 14}, {0x3ED0, 14}, {0x3ED1, 14}, {0x3ED2, 14}, {0x3ED3, 14}, {0x3ED4, 14}, {0x3ED5, 14}, {0x1F6B, 13}, {0x1F6C, 13}, {0x1F6D, 13}, {0x1F6E, 13}, {0x1F6F, 13}, },{//1 {0x0000, 3}, {0x0004, 5}, {0x0014, 7}, {0x000B, 6}, {0x000C, 6}, {0x002A, 8}, {0x002B, 8}, {0x0034, 8}, {0x0D40, 14}, {0x0D41, 14}, {0x001B, 7}, {0x0D42, 14}, {0x0D43, 14}, {0x0D44, 14}, {0x0D45, 14}, {0x0D46, 14}, {0x000E, 6}, {0x003C, 8}, {0x0D47, 14}, {0x003D, 8}, {0x0D48, 14}, {0x0D49, 14}, {0x0D4A, 14}, {0x0001, 2}, {0x0004, 3}, {0x0014, 5}, {0x000B, 4}, {0x000C, 4}, {0x000D, 4}, {0x002A, 6}, {0x001F, 7}, {0x0056, 7}, {0x0057, 7}, {0x0070, 7}, {0x00E2, 8}, {0x0072, 7}, {0x003A, 6}, {0x003B, 6}, {0x003C, 6}, {0x003D, 6}, {0x00E3, 8}, {0x0D4B, 14}, {0x00E6, 8}, {0x00E7, 8}, {0x00F8, 8}, {0x0D4C, 14}, {0x0D4D, 14}, {0x0D4E, 14}, {0x00F9, 8}, {0x0D4F, 14}, {0x0D50, 14}, {0x0D51, 14}, {0x06A9, 13}, {0x06AA, 13}, {0x06AB, 13}, {0x06AC, 13}, {0x06AD, 13}, {0x06AE, 13}, {0x06AF, 13}, {0x003F, 6}, {0x06B0, 13}, {0x06B1, 13}, {0x06B2, 13}, {0x06B3, 13}, {0x06B4, 13}, {0x007D, 7}, {0x06B5, 13}, {0x06B6, 13}, {0x06B7, 13}, {0x06B8, 13}, {0x06B9, 13}, {0x06BA, 13}, {0x06BB, 13}, {0x06BC, 13}, {0x06BD, 13}, {0x06BE, 13}, {0x06BF, 13}, },{//2 {0x0000, 2}, {0x0002, 3}, {0x0003, 3}, {0x0008, 4}, {0x0012, 5}, {0x0013, 5}, {0x0028, 6}, {0x0029, 6}, {0x0054, 7}, {0x0055, 7}, {0x0056, 7}, {0x00AE, 8}, {0x00AF, 8}, {0x00B0, 8}, {0x0162, 9}, {0x02C6, 10}, {0x000C, 4}, {0x002D, 6}, {0x00B2, 8}, {0x0166, 9}, {0x002E, 6}, {0x0167, 9}, {0x00BC, 8}, {0x001A, 5}, {0x0036, 6}, {0x0037, 6}, {0x0038, 6}, {0x005F, 7}, {0x0072, 7}, {0x0073, 7}, {0x0074, 7}, {0x0075, 7}, {0x0076, 7}, {0x0077, 7}, {0x0078, 7}, {0x0079, 7}, {0x007A, 7}, {0x007B, 7}, {0x00BD, 8}, {0xB1C0, 16}, {0xB1C1, 16}, {0x58E1, 15}, {0x0B1D, 12}, {0x58E2, 15}, {0x58E3, 15}, {0x58E4, 15}, {0x00F8, 8}, {0x03E4, 10}, {0x01F3, 9}, {0x0B1E, 12}, {0x58E5, 15}, {0x58E6, 15}, {0x00FA, 8}, {0x58E7, 15}, {0x58F8, 15}, {0x58F9, 15}, {0x58FA, 15}, {0x01F6, 9}, {0x58FB, 15}, {0x007E, 7}, {0x00FE, 8}, {0x00FF, 8}, {0x07CA, 11}, {0x0F96, 12}, {0x58FC, 15}, {0x58FD, 15}, {0x58FE, 15}, {0x58FF, 15}, {0x7CB8, 15}, {0x7CB9, 15}, {0x7CBA, 15}, {0x7CBB, 15}, {0x7CBC, 15}, {0x01F7, 9}, {0x7CBD, 15}, {0x7CBE, 15}, {0x7CBF, 15}, },{//3 {0x0000, 2}, {0x0002, 3}, {0x0006, 4}, {0x000E, 5}, {0x000F, 5}, {0x0020, 6}, {0x0021, 6}, {0x0044, 7}, {0x0045, 7}, {0x008C, 8}, {0x008D, 8}, {0x011C, 9}, {0x011D, 9}, {0x011E, 9}, {0x023E, 10}, {0x023F, 10}, {0x0005, 3}, {0x0012, 5}, {0x004C, 7}, {0x004D, 7}, {0x000C, 4}, {0x004E, 7}, {0x001A, 5}, {0x0036, 6}, {0x004F, 7}, {0x006E, 7}, {0x006F, 7}, {0x00E0, 8}, {0x00E1, 8}, {0x00E2, 8}, {0x00E3, 8}, {0x00E4, 8}, {0x00E5, 8}, {0x01CC, 9}, {0x00E7, 8}, {0x00E8, 8}, {0x00E9, 8}, {0x01CD, 9}, {0x0750, 11}, {0x03A9, 10}, {0x0751, 11}, {0x7540, 15}, {0x03AB, 10}, {0x7541, 15}, {0x7542, 15}, {0x7543, 15}, {0x01D6, 9}, {0x0755, 11}, {0x0076, 7}, {0x0EA9, 12}, {0x7544, 15}, {0x7545, 15}, {0x001E, 5}, {0x0077, 7}, {0x00F8, 8}, {0x03AE, 10}, {0x075E, 11}, {0x007D, 7}, {0x03E4, 10}, {0x00FC, 8}, {0x00FD, 8}, {0x03E5, 10}, {0x03E6, 10}, {0x0EBE, 12}, {0x7546, 15}, {0x07CE, 11}, {0x7547, 15}, {0x75F8, 15}, {0x75F9, 15}, {0x75FA, 15}, {0x75FB, 15}, {0x75FC, 15}, {0x75FD, 15}, {0x007F, 7}, {0x3AFF, 14}, {0x0F9E, 12}, {0x0F9F, 12}, },{//4 {0x0000, 3}, {0x0002, 4}, {0x0003, 4}, {0x0008, 5}, {0x0012, 6}, {0x0013, 6}, {0x0014, 6}, {0x002A, 7}, {0x0016, 6}, {0x002B, 7}, {0x005C, 8}, {0x005D, 8}, {0x005E, 8}, {0x00BE, 9}, {0x00BF, 9}, {0x0060, 8}, {0x0007, 4}, {0x000D, 5}, {0x0019, 6}, {0x0020, 6}, {0x0009, 4}, {0x0021, 6}, {0x0011, 5}, {0x0014, 5}, {0x002A, 6}, {0x002B, 6}, {0x002C, 6}, {0x002D, 6}, {0x002E, 6}, {0x002F, 6}, {0x0030, 6}, {0x0031, 7}, {0x0062, 7}, {0x0063, 7}, {0x0064, 7}, {0x0065, 7}, {0x0066, 7}, {0x0061, 8}, {0x0670, 11}, {0x0068, 7}, {0x0069, 7}, {0x00CF, 8}, {0x019D, 9}, {0x01A8, 9}, {0x01A9, 9}, {0x0339, 10}, {0x01AA, 9}, {0x0356, 10}, {0x0036, 6}, {0x00D6, 8}, {0x6710, 15}, {0x6711, 15}, {0x000E, 4}, {0x006E, 7}, {0x01AE, 9}, {0x6712, 15}, {0x6713, 15}, {0x003C, 6}, {0x0357, 10}, {0x006F, 7}, {0x00F4, 8}, {0x00F5, 8}, {0x035E, 10}, {0x01EC, 9}, {0x6714, 15}, {0x01ED, 9}, {0x035F, 10}, {0x03DC, 10}, {0x03DD, 10}, {0x6715, 15}, {0x338B, 14}, {0x338C, 14}, {0x338D, 14}, {0x001F, 5}, {0x01EF, 9}, {0x338E, 14}, {0x338F, 14}, },{//5 {0x0000, 2}, {0x0004, 4}, {0x000A, 5}, {0x000B, 5}, {0x0018, 6}, {0x0019, 6}, {0x0034, 7}, {0x006A, 8}, {0x006B, 8}, {0x006C, 8}, {0x00DA, 9}, {0x036C, 11}, {0x006E, 8}, {0x01B7, 10}, {0x036D, 11}, {0x3780, 15}, {0x0004, 3}, {0x000E, 5}, {0x001E, 6}, {0x003E, 7}, {0x000A, 4}, {0x002C, 6}, {0x0017, 5}, {0x002D, 6}, {0x003F, 7}, {0x00C0, 8}, {0x0061, 7}, {0x00C1, 8}, {0x0062, 7}, {0x00C6, 8}, {0x0064, 7}, {0x00C7, 8}, {0x00CA, 8}, {0x00DF, 9}, {0x0196, 9}, {0x0197, 9}, {0x0198, 9}, {0x0199, 9}, {0x0379, 11}, {0x019A, 9}, {0x01BD, 10}, {0x066C, 11}, {0x3781, 15}, {0x0337, 10}, {0x066D, 11}, {0x0670, 11}, {0x0339, 10}, {0x0671, 11}, {0x0034, 6}, {0x00CF, 8}, {0x3782, 15}, {0x3783, 15}, {0x000E, 4}, {0x001B, 5}, {0x006A, 7}, {0x006B, 7}, {0x019D, 9}, {0x003C, 6}, {0x00F4, 8}, {0x00F5, 8}, {0x03D8, 10}, {0x07B2, 11}, {0x3784, 15}, {0x03DA, 10}, {0x3785, 15}, {0x03DB, 10}, {0x03DC, 10}, {0x3786, 15}, {0x3787, 15}, {0x1BC4, 14}, {0x1BC5, 14}, {0x1BC6, 14}, {0x1BC7, 14}, {0x001F, 5}, {0x03DD, 10}, {0x07B3, 11}, {0x01EF, 9}, },{//6 {0x0000, 2}, {0x0004, 4}, {0x000A, 5}, {0x0016, 6}, {0x0017, 6}, {0x0060, 8}, {0x00C2, 9}, {0x0186, 10}, {0x0187, 10}, {0x00C4, 9}, {0x3140, 15}, {0x3141, 15}, {0x018B, 10}, {0x3142, 15}, {0x018C, 10}, {0x3143, 15}, {0x0007, 4}, {0x000D, 5}, {0x0064, 8}, {0x0065, 8}, {0x0010, 5}, {0x00C7, 9}, {0x0066, 8}, {0x0005, 3}, {0x0006, 3}, {0x0009, 4}, {0x0011, 5}, {0x0038, 6}, {0x0039, 6}, {0x0074, 7}, {0x0075, 7}, {0x0076, 7}, {0x0067, 8}, {0x00EE, 8}, {0x01DE, 9}, {0x00F0, 8}, {0x018D, 10}, {0x3144, 15}, {0x01DF, 9}, {0x003D, 6}, {0x003E, 6}, {0x01E2, 9}, {0x03C6, 10}, {0x00F2, 8}, {0x00F3, 8}, {0x03C7, 10}, {0x3145, 15}, {0x3146, 15}, {0x01F8, 9}, {0x3147, 15}, {0x3148, 15}, {0x3149, 15}, {0x00FD, 8}, {0x314A, 15}, {0x314B, 15}, {0x314C, 15}, {0x314D, 15}, {0x01F9, 9}, {0x314E, 15}, {0x01FC, 9}, {0x314F, 15}, {0x3150, 15}, {0x3151, 15}, {0x3152, 15}, {0x3153, 15}, {0x03FA, 10}, {0x03FB, 10}, {0x3154, 15}, {0x3155, 15}, {0x3156, 15}, {0x3157, 15}, {0x3158, 15}, {0x3159, 15}, {0x00FF, 8}, {0x18AD, 14}, {0x18AE, 14}, {0x18AF, 14}, },{//7 {0x0000, 4}, {0x0080, 11}, {0x0081, 11}, {0x0082, 11}, {0x0083, 11}, {0x0084, 11}, {0x0085, 11}, {0x0086, 11}, {0x0087, 11}, {0x0088, 11}, {0x0089, 11}, {0x008A, 11}, {0x008B, 11}, {0x008C, 11}, {0x008D, 11}, {0x008E, 11}, {0x008F, 11}, {0x0048, 10}, {0x0049, 10}, {0x004A, 10}, {0x004B, 10}, {0x004C, 10}, {0x004D, 10}, {0x0001, 1}, {0x0001, 2}, {0x004E, 10}, {0x0002, 4}, {0x0003, 4}, {0x004F, 10}, {0x0050, 10}, {0x0051, 10}, {0x0052, 10}, {0x0053, 10}, {0x0054, 10}, {0x0055, 10}, {0x0056, 10}, {0x0057, 10}, {0x0058, 10}, {0x0059, 10}, {0x005A, 10}, {0x005B, 10}, {0x005C, 10}, {0x005D, 10}, {0x005E, 10}, {0x005F, 10}, {0x0060, 10}, {0x0061, 10}, {0x0062, 10}, {0x0063, 10}, {0x0064, 10}, {0x0065, 10}, {0x0066, 10}, {0x0067, 10}, {0x0068, 10}, {0x0069, 10}, {0x006A, 10}, {0x006B, 10}, {0x006C, 10}, {0x006D, 10}, {0x006E, 10}, {0x006F, 10}, {0x0070, 10}, {0x0071, 10}, {0x0072, 10}, {0x0073, 10}, {0x0074, 10}, {0x0075, 10}, {0x0076, 10}, {0x0077, 10}, {0x0078, 10}, {0x0079, 10}, {0x007A, 10}, {0x007B, 10}, {0x007C, 10}, {0x007D, 10}, {0x007E, 10}, {0x007F, 10}, } }; static const uint16_t x8_ac0_highquant_table[8][77][2]={ {//0 {0x0000, 3}, {0x0002, 4}, {0x000C, 6}, {0x000D, 6}, {0x001C, 7}, {0x000F, 6}, {0x1D00, 15}, {0x003B, 8}, {0x1D01, 15}, {0x0075, 9}, {0x1D02, 15}, {0x0080, 9}, {0x1D03, 15}, {0x1D04, 15}, {0x1D05, 15}, {0x0E83, 14}, {0x0009, 5}, {0x0011, 6}, {0x0081, 9}, {0x0082, 9}, {0x0021, 7}, {0x0028, 7}, {0x0083, 9}, {0x0002, 2}, {0x0003, 3}, {0x000C, 4}, {0x000D, 4}, {0x000B, 5}, {0x0015, 6}, {0x0052, 8}, {0x0070, 7}, {0x0039, 6}, {0x0071, 7}, {0x0053, 8}, {0x0E84, 14}, {0x0074, 7}, {0x0075, 7}, {0x0076, 7}, {0x01DC, 9}, {0x001E, 5}, {0x003E, 6}, {0x01DD, 9}, {0x00EF, 8}, {0x01F8, 9}, {0x01F9, 9}, {0x0E85, 14}, {0x0E86, 14}, {0x0E87, 14}, {0x00FD, 8}, {0x0E88, 14}, {0x0E89, 14}, {0x0E8A, 14}, {0x0E8B, 14}, {0x0E8C, 14}, {0x0E8D, 14}, {0x0E8E, 14}, {0x0E8F, 14}, {0x0E90, 14}, {0x0E91, 14}, {0x01FC, 9}, {0x0E92, 14}, {0x0E93, 14}, {0x0E94, 14}, {0x0E95, 14}, {0x0E96, 14}, {0x0E97, 14}, {0x01FD, 9}, {0x0E98, 14}, {0x01FE, 9}, {0x0E99, 14}, {0x0E9A, 14}, {0x0E9B, 14}, {0x0E9C, 14}, {0x01FF, 9}, {0x0E9D, 14}, {0x0E9E, 14}, {0x0E9F, 14}, },{//1 {0x0000, 3}, {0x0002, 4}, {0x0003, 4}, {0x0008, 5}, {0x0012, 6}, {0x0013, 6}, {0x0014, 6}, {0x0015, 6}, {0x002C, 7}, {0x005A, 8}, {0x005B, 8}, {0x005C, 8}, {0x005D, 8}, {0x1780, 14}, {0x0179, 10}, {0x017A, 10}, {0x0006, 4}, {0x000E, 5}, {0x001E, 6}, {0x003E, 7}, {0x0010, 5}, {0x0022, 6}, {0x0012, 5}, {0x000A, 4}, {0x0013, 5}, {0x0016, 5}, {0x0023, 6}, {0x002E, 6}, {0x002F, 6}, {0x0030, 6}, {0x0031, 6}, {0x003F, 7}, {0x005F, 8}, {0x00C8, 8}, {0x0065, 7}, {0x0066, 7}, {0x0067, 7}, {0x0068, 7}, {0x00C9, 8}, {0x0069, 7}, {0x006A, 7}, {0x00D6, 8}, {0x00D7, 8}, {0x00D8, 8}, {0x1781, 14}, {0x017B, 10}, {0x01B2, 9}, {0x1782, 14}, {0x001C, 5}, {0x01B3, 9}, {0x1783, 14}, {0x1784, 14}, {0x001D, 5}, {0x00DA, 8}, {0x1785, 14}, {0x1786, 14}, {0x1787, 14}, {0x0037, 6}, {0x00DB, 8}, {0x0078, 7}, {0x00F2, 8}, {0x01E6, 9}, {0x00F4, 8}, {0x1788, 14}, {0x1789, 14}, {0x00F5, 8}, {0x01E7, 9}, {0x178A, 14}, {0x178B, 14}, {0x178C, 14}, {0x178D, 14}, {0x01EC, 9}, {0x178E, 14}, {0x001F, 5}, {0x00F7, 8}, {0x01ED, 9}, {0x178F, 14}, },{//2 {0x0000, 4}, {0x0002, 5}, {0x0180, 12}, {0x0181, 12}, {0x0182, 12}, {0x0183, 12}, {0x0184, 12}, {0x0185, 12}, {0x0186, 12}, {0x0187, 12}, {0x0188, 12}, {0x0189, 12}, {0x00C5, 11}, {0x00C6, 11}, {0x00C7, 11}, {0x00C8, 11}, {0x00C9, 11}, {0x00CA, 11}, {0x00CB, 11}, {0x00CC, 11}, {0x00CD, 11}, {0x00CE, 11}, {0x00CF, 11}, {0x0001, 1}, {0x0001, 2}, {0x0004, 5}, {0x0005, 5}, {0x0006, 5}, {0x00D0, 11}, {0x00D1, 11}, {0x00D2, 11}, {0x00D3, 11}, {0x00D4, 11}, {0x00D5, 11}, {0x00D6, 11}, {0x00D7, 11}, {0x00D8, 11}, {0x00D9, 11}, {0x00DA, 11}, {0x0007, 5}, {0x00DB, 11}, {0x00DC, 11}, {0x00DD, 11}, {0x00DE, 11}, {0x00DF, 11}, {0x00E0, 11}, {0x00E1, 11}, {0x00E2, 11}, {0x00E3, 11}, {0x00E4, 11}, {0x00E5, 11}, {0x00E6, 11}, {0x00E7, 11}, {0x00E8, 11}, {0x00E9, 11}, {0x00EA, 11}, {0x00EB, 11}, {0x00EC, 11}, {0x00ED, 11}, {0x00EE, 11}, {0x00EF, 11}, {0x00F0, 11}, {0x00F1, 11}, {0x00F2, 11}, {0x00F3, 11}, {0x00F4, 11}, {0x00F5, 11}, {0x00F6, 11}, {0x00F7, 11}, {0x00F8, 11}, {0x00F9, 11}, {0x00FA, 11}, {0x00FB, 11}, {0x00FC, 11}, {0x00FD, 11}, {0x00FE, 11}, {0x00FF, 11}, },{//3 {0x0000, 8}, {0x0001, 8}, {0x0002, 8}, {0x0003, 8}, {0x0004, 8}, {0x0005, 8}, {0x0006, 8}, {0x0007, 8}, {0x0008, 8}, {0x0009, 8}, {0x000A, 8}, {0x000B, 8}, {0x000C, 8}, {0x000D, 8}, {0x000E, 8}, {0x000F, 8}, {0x0010, 8}, {0x0011, 8}, {0x0012, 8}, {0x0013, 8}, {0x0014, 8}, {0x0015, 8}, {0x0016, 8}, {0x0001, 1}, {0x0017, 8}, {0x000C, 7}, {0x000D, 7}, {0x000E, 7}, {0x000F, 7}, {0x0010, 7}, {0x0011, 7}, {0x0012, 7}, {0x0013, 7}, {0x0014, 7}, {0x0015, 7}, {0x0016, 7}, {0x0017, 7}, {0x0018, 7}, {0x0019, 7}, {0x001A, 7}, {0x001B, 7}, {0x001C, 7}, {0x001D, 7}, {0x001E, 7}, {0x001F, 7}, {0x0020, 7}, {0x0021, 7}, {0x0022, 7}, {0x0023, 7}, {0x0024, 7}, {0x0025, 7}, {0x0026, 7}, {0x0027, 7}, {0x0028, 7}, {0x0029, 7}, {0x002A, 7}, {0x002B, 7}, {0x002C, 7}, {0x002D, 7}, {0x002E, 7}, {0x002F, 7}, {0x0030, 7}, {0x0031, 7}, {0x0032, 7}, {0x0033, 7}, {0x0034, 7}, {0x0035, 7}, {0x0036, 7}, {0x0037, 7}, {0x0038, 7}, {0x0039, 7}, {0x003A, 7}, {0x003B, 7}, {0x003C, 7}, {0x003D, 7}, {0x003E, 7}, {0x003F, 7}, },{//4 {0x0000, 9}, {0x0001, 9}, {0x0002, 9}, {0x0003, 9}, {0x0004, 9}, {0x0005, 9}, {0x0006, 9}, {0x0007, 9}, {0x0008, 9}, {0x0009, 9}, {0x000A, 9}, {0x000B, 9}, {0x000C, 9}, {0x000D, 9}, {0x000E, 9}, {0x000F, 9}, {0x0010, 9}, {0x0011, 9}, {0x0012, 9}, {0x0013, 9}, {0x0014, 9}, {0x0015, 9}, {0x000B, 8}, {0x0001, 2}, {0x0001, 1}, {0x000C, 8}, {0x000D, 8}, {0x000E, 8}, {0x000F, 8}, {0x0010, 8}, {0x0011, 8}, {0x0012, 8}, {0x0013, 8}, {0x0014, 8}, {0x0015, 8}, {0x0016, 8}, {0x0017, 8}, {0x0018, 8}, {0x0019, 8}, {0x001A, 8}, {0x001B, 8}, {0x001C, 8}, {0x001D, 8}, {0x001E, 8}, {0x001F, 8}, {0x0020, 8}, {0x0021, 8}, {0x0022, 8}, {0x0023, 8}, {0x0024, 8}, {0x0025, 8}, {0x0026, 8}, {0x0027, 8}, {0x0028, 8}, {0x0029, 8}, {0x002A, 8}, {0x002B, 8}, {0x002C, 8}, {0x002D, 8}, {0x002E, 8}, {0x002F, 8}, {0x0030, 8}, {0x0031, 8}, {0x0032, 8}, {0x0033, 8}, {0x0034, 8}, {0x0035, 8}, {0x0036, 8}, {0x0037, 8}, {0x0038, 8}, {0x0039, 8}, {0x003A, 8}, {0x003B, 8}, {0x003C, 8}, {0x003D, 8}, {0x003E, 8}, {0x003F, 8}, },{//5 {0x0000, 10}, {0x0001, 10}, {0x0002, 10}, {0x0003, 10}, {0x0004, 10}, {0x0005, 10}, {0x0006, 10}, {0x0007, 10}, {0x0008, 10}, {0x0009, 10}, {0x000A, 10}, {0x000B, 10}, {0x000C, 10}, {0x000D, 10}, {0x000E, 10}, {0x000F, 10}, {0x0010, 10}, {0x0011, 10}, {0x0012, 10}, {0x0013, 10}, {0x000A, 9}, {0x000B, 9}, {0x000C, 9}, {0x0001, 1}, {0x0001, 3}, {0x000D, 9}, {0x000E, 9}, {0x0001, 2}, {0x000F, 9}, {0x0010, 9}, {0x0011, 9}, {0x0012, 9}, {0x0013, 9}, {0x0014, 9}, {0x0015, 9}, {0x0016, 9}, {0x0017, 9}, {0x0018, 9}, {0x0019, 9}, {0x001A, 9}, {0x001B, 9}, {0x001C, 9}, {0x001D, 9}, {0x001E, 9}, {0x001F, 9}, {0x0020, 9}, {0x0021, 9}, {0x0022, 9}, {0x0023, 9}, {0x0024, 9}, {0x0025, 9}, {0x0026, 9}, {0x0027, 9}, {0x0028, 9}, {0x0029, 9}, {0x002A, 9}, {0x002B, 9}, {0x002C, 9}, {0x002D, 9}, {0x002E, 9}, {0x002F, 9}, {0x0030, 9}, {0x0031, 9}, {0x0032, 9}, {0x0033, 9}, {0x0034, 9}, {0x0035, 9}, {0x0036, 9}, {0x0037, 9}, {0x0038, 9}, {0x0039, 9}, {0x003A, 9}, {0x003B, 9}, {0x003C, 9}, {0x003D, 9}, {0x003E, 9}, {0x003F, 9}, },{//6 {0x0000, 2}, {0x0004, 4}, {0x000A, 5}, {0x000B, 5}, {0x0018, 6}, {0x0019, 6}, {0x0034, 7}, {0x006A, 8}, {0x006B, 8}, {0x006C, 8}, {0x00DA, 9}, {0x00DB, 9}, {0x01B8, 10}, {0x00DD, 9}, {0x01B9, 10}, {0x3780, 15}, {0x0004, 3}, {0x000E, 5}, {0x001E, 6}, {0x001F, 6}, {0x000A, 4}, {0x0058, 7}, {0x0017, 5}, {0x0018, 5}, {0x0059, 7}, {0x005A, 7}, {0x005B, 7}, {0x00C8, 8}, {0x0065, 7}, {0x0066, 7}, {0x00C9, 8}, {0x00CE, 8}, {0x00CF, 8}, {0x00D0, 8}, {0x00D1, 8}, {0x00D2, 8}, {0x00D3, 8}, {0x00DF, 9}, {0x00D4, 8}, {0x00D5, 8}, {0x00D6, 8}, {0x01AE, 9}, {0x3781, 15}, {0x01BD, 10}, {0x035E, 10}, {0x035F, 10}, {0x3782, 15}, {0x0360, 10}, {0x0037, 6}, {0x01B1, 9}, {0x3783, 15}, {0x3784, 15}, {0x000E, 4}, {0x003C, 6}, {0x0361, 10}, {0x3785, 15}, {0x1BC3, 14}, {0x003D, 6}, {0x00D9, 8}, {0x1BC4, 14}, {0x0368, 10}, {0x1BC5, 14}, {0x1BC6, 14}, {0x1BC7, 14}, {0x1BC8, 14}, {0x00DB, 8}, {0x0369, 10}, {0x036A, 10}, {0x1BC9, 14}, {0x1BCA, 14}, {0x1BCB, 14}, {0x1BCC, 14}, {0x1BCD, 14}, {0x001F, 5}, {0x036B, 10}, {0x1BCE, 14}, {0x1BCF, 14}, },{//7 {0x0000, 3}, {0x0002, 4}, {0x0006, 5}, {0x0007, 5}, {0x0010, 6}, {0x0044, 8}, {0x0023, 7}, {0x0012, 6}, {0x0026, 7}, {0x08A0, 13}, {0x004E, 8}, {0x004F, 8}, {0x08A1, 13}, {0x08A2, 13}, {0x08A3, 13}, {0x0050, 8}, {0x0006, 4}, {0x000B, 5}, {0x0029, 7}, {0x0015, 6}, {0x001C, 6}, {0x003A, 7}, {0x001E, 6}, {0x0004, 3}, {0x0014, 5}, {0x0015, 5}, {0x000B, 4}, {0x001F, 6}, {0x0030, 6}, {0x0031, 6}, {0x0019, 5}, {0x0051, 8}, {0x0034, 6}, {0x0035, 6}, {0x0036, 6}, {0x0037, 6}, {0x0076, 8}, {0x0077, 8}, {0x0070, 7}, {0x001D, 5}, {0x0071, 7}, {0x0072, 7}, {0x08A4, 13}, {0x0073, 7}, {0x00F0, 8}, {0x08A5, 13}, {0x08A6, 13}, {0x08A7, 13}, {0x0079, 7}, {0x007A, 7}, {0x08A8, 13}, {0x08A9, 13}, {0x00F1, 8}, {0x08AA, 13}, {0x08AB, 13}, {0x08AC, 13}, {0x08AD, 13}, {0x00F6, 8}, {0x08AE, 13}, {0x007C, 7}, {0x00F7, 8}, {0x08AF, 13}, {0x08B0, 13}, {0x08B1, 13}, {0x08B2, 13}, {0x00FA, 8}, {0x08B3, 13}, {0x08B4, 13}, {0x08B5, 13}, {0x08B6, 13}, {0x08B7, 13}, {0x00FB, 8}, {0x045C, 12}, {0x003F, 6}, {0x045D, 12}, {0x045E, 12}, {0x045F, 12}, } }; static const uint16_t x8_ac1_lowquant_table[8][77][2]={ {//0 {0x0000, 3}, {0x0002, 4}, {0x0003, 4}, {0x0008, 5}, {0x0012, 6}, {0x0026, 7}, {0x0014, 6}, {0x004E, 8}, {0x004F, 8}, {0x00A8, 9}, {0x0152, 10}, {0x00AA, 9}, {0x00AB, 9}, {0x00AC, 9}, {0x2A60, 15}, {0x02A7, 11}, {0x0006, 4}, {0x000B, 5}, {0x001C, 6}, {0x003A, 7}, {0x000F, 5}, {0x003B, 7}, {0x0010, 5}, {0x0005, 3}, {0x0009, 4}, {0x0011, 5}, {0x0018, 5}, {0x0019, 5}, {0x001A, 5}, {0x0036, 6}, {0x0037, 6}, {0x0070, 7}, {0x0057, 8}, {0x00E2, 8}, {0x00E3, 8}, {0x00E4, 8}, {0x00E5, 8}, {0x00AD, 9}, {0x0398, 10}, {0x003A, 6}, {0x0076, 7}, {0x00E7, 8}, {0x00EE, 8}, {0x00EF, 8}, {0x0732, 11}, {0x039A, 10}, {0x0733, 11}, {0x2A61, 15}, {0x0078, 7}, {0x1531, 14}, {0x1532, 14}, {0x1533, 14}, {0x003D, 6}, {0x039B, 10}, {0x1534, 14}, {0x1535, 14}, {0x1536, 14}, {0x0079, 7}, {0x1537, 14}, {0x00F8, 8}, {0x01F2, 9}, {0x07CC, 11}, {0x03E7, 10}, {0x07CD, 11}, {0x3E80, 14}, {0x00FB, 8}, {0x03E9, 10}, {0x3E81, 14}, {0x3E82, 14}, {0x3E83, 14}, {0x3E84, 14}, {0x3E85, 14}, {0x3E86, 14}, {0x003F, 6}, {0x01F5, 9}, {0x07D1, 11}, {0x3E87, 14}, },{//1 {0x0000, 2}, {0x0002, 3}, {0x0006, 4}, {0x000E, 5}, {0x001E, 6}, {0x001F, 6}, {0x0040, 7}, {0x0082, 8}, {0x0083, 8}, {0x0084, 8}, {0x010A, 9}, {0x010B, 9}, {0x0430, 11}, {0x0431, 11}, {0x0432, 11}, {0x0433, 11}, {0x0005, 3}, {0x0011, 5}, {0x0024, 6}, {0x004A, 7}, {0x000C, 4}, {0x0026, 6}, {0x000D, 4}, {0x0087, 8}, {0x010D, 9}, {0x0258, 10}, {0x012D, 9}, {0x0259, 10}, {0x025C, 10}, {0x0974, 12}, {0x025E, 10}, {0x025F, 10}, {0x0270, 10}, {0x0271, 10}, {0x04BB, 11}, {0x0975, 12}, {0x0272, 10}, {0x09CC, 12}, {0x09CD, 12}, {0x4E70, 15}, {0x4E71, 15}, {0x4E72, 15}, {0x4E73, 15}, {0x273A, 14}, {0x273B, 14}, {0x273C, 14}, {0x04E8, 11}, {0x04E9, 11}, {0x009E, 8}, {0x0275, 10}, {0x09D8, 12}, {0x273D, 14}, {0x000E, 4}, {0x003C, 6}, {0x007A, 7}, {0x009F, 8}, {0x0277, 10}, {0x003E, 6}, {0x00F6, 8}, {0x04ED, 11}, {0x03DC, 10}, {0x273E, 14}, {0x07BA, 11}, {0x09D9, 12}, {0x273F, 14}, {0x3DD8, 14}, {0x3DD9, 14}, {0x3DDA, 14}, {0x3DDB, 14}, {0x3DDC, 14}, {0x3DDD, 14}, {0x3DDE, 14}, {0x3DDF, 14}, {0x003F, 6}, {0x07BC, 11}, {0x07BD, 11}, {0x03DF, 10}, },{//2 {0x0000, 3}, {0x0002, 4}, {0x0006, 5}, {0x000E, 6}, {0x001E, 7}, {0x003E, 8}, {0x003F, 8}, {0x0040, 8}, {0x0104, 10}, {0x0083, 9}, {0x0105, 10}, {0x0108, 10}, {0x4240, 16}, {0x010A, 10}, {0x010B, 10}, {0x4241, 16}, {0x0003, 3}, {0x0009, 5}, {0x0011, 6}, {0x0043, 8}, {0x0004, 3}, {0x000A, 5}, {0x000A, 4}, {0x002C, 7}, {0x00B4, 9}, {0x00B5, 9}, {0x00B6, 9}, {0x00B7, 9}, {0x00B8, 9}, {0x0172, 10}, {0x0173, 10}, {0x0174, 10}, {0x0175, 10}, {0x0176, 10}, {0x0177, 10}, {0x00BC, 9}, {0x017A, 10}, {0x0213, 11}, {0x4242, 16}, {0x017B, 10}, {0x02F8, 11}, {0x017D, 10}, {0x02F9, 11}, {0x017E, 10}, {0x4243, 16}, {0x02FE, 11}, {0x2122, 15}, {0x2123, 15}, {0x0058, 7}, {0x0164, 9}, {0x2124, 15}, {0x2125, 15}, {0x0006, 3}, {0x000E, 4}, {0x002D, 6}, {0x002E, 6}, {0x00B3, 8}, {0x001E, 5}, {0x005E, 7}, {0x2126, 15}, {0x2127, 15}, {0x2128, 15}, {0x2129, 15}, {0x02FF, 11}, {0x212A, 15}, {0x0594, 11}, {0x0595, 11}, {0x0596, 11}, {0x212B, 15}, {0x212C, 15}, {0x212D, 15}, {0x212E, 15}, {0x212F, 15}, {0x001F, 5}, {0x0597, 11}, {0x00BE, 8}, {0x00BF, 8}, },{//3 {0x0000, 2}, {0x0002, 3}, {0x0006, 4}, {0x0007, 4}, {0x0010, 5}, {0x0011, 5}, {0x0024, 6}, {0x0025, 6}, {0x0026, 6}, {0x0027, 6}, {0x0050, 7}, {0x0051, 7}, {0x00A4, 8}, {0x00A5, 8}, {0x00A6, 8}, {0x014E, 9}, {0x000B, 4}, {0x002A, 6}, {0x0056, 7}, {0x014F, 9}, {0x0030, 6}, {0x00AE, 8}, {0x0062, 7}, {0x0032, 6}, {0x0033, 6}, {0x0034, 6}, {0x0035, 6}, {0x0036, 6}, {0x0063, 7}, {0x006E, 7}, {0x006F, 7}, {0x0070, 7}, {0x0071, 7}, {0x0072, 7}, {0x0073, 7}, {0x0074, 7}, {0x00AF, 8}, {0x00EA, 8}, {0x01D6, 9}, {0x075C, 11}, {0x03AF, 10}, {0x75D0, 15}, {0x75D1, 15}, {0x75D2, 15}, {0x75D3, 15}, {0x75D4, 15}, {0x0076, 7}, {0x00EE, 8}, {0x00EF, 8}, {0x0EBB, 12}, {0x01E0, 9}, {0x75D5, 15}, {0x0079, 7}, {0x01E1, 9}, {0x75D6, 15}, {0x75D7, 15}, {0x7880, 15}, {0x00F4, 8}, {0x0789, 11}, {0x003E, 6}, {0x007B, 7}, {0x00F5, 8}, {0x00FC, 8}, {0x007F, 7}, {0x01E3, 9}, {0x078A, 11}, {0x078B, 11}, {0x7881, 15}, {0x7882, 15}, {0x7883, 15}, {0x3C42, 14}, {0x3C43, 14}, {0x3C44, 14}, {0x00FD, 8}, {0x3C45, 14}, {0x3C46, 14}, {0x3C47, 14}, },{//4 {0x0000, 2}, {0x0004, 4}, {0x000A, 5}, {0x0016, 6}, {0x0017, 6}, {0x0030, 7}, {0x0031, 7}, {0x0064, 8}, {0x0065, 8}, {0x0066, 8}, {0x00CE, 9}, {0x00CF, 9}, {0x01A0, 10}, {0x01A1, 10}, {0x1A20, 14}, {0x0689, 12}, {0x0004, 3}, {0x000E, 5}, {0x001B, 6}, {0x0035, 7}, {0x000A, 4}, {0x001E, 6}, {0x0016, 5}, {0x0017, 5}, {0x001F, 6}, {0x0030, 6}, {0x0031, 6}, {0x0064, 7}, {0x0065, 7}, {0x0069, 8}, {0x0066, 7}, {0x00CE, 8}, {0x00CF, 8}, {0x00D0, 8}, {0x00D1, 8}, {0x00D2, 8}, {0x01A6, 9}, {0x01A3, 10}, {0x034E, 10}, {0x006A, 7}, {0x00D6, 8}, {0x01AE, 9}, {0x01AF, 9}, {0x034F, 10}, {0x0345, 11}, {0x01B0, 9}, {0x01B1, 9}, {0x0364, 10}, {0x006D, 7}, {0x00DC, 8}, {0x0D94, 12}, {0x0D95, 12}, {0x000E, 4}, {0x003C, 6}, {0x00DD, 8}, {0x00DE, 8}, {0x01B3, 9}, {0x003D, 6}, {0x00DF, 8}, {0x01F0, 9}, {0x03E2, 10}, {0x03E3, 10}, {0x06CB, 11}, {0x03E4, 10}, {0x07CA, 11}, {0x01F3, 9}, {0x01F4, 9}, {0x07CB, 11}, {0x07D4, 11}, {0x1A21, 14}, {0x1A22, 14}, {0x07D5, 11}, {0x1A23, 14}, {0x003F, 6}, {0x01F6, 9}, {0x01F7, 9}, {0x03EB, 10}, },{//5 {0x0000, 2}, {0x0002, 3}, {0x0006, 4}, {0x000E, 5}, {0x000F, 5}, {0x0020, 6}, {0x0021, 6}, {0x0044, 7}, {0x0045, 7}, {0x0046, 7}, {0x008E, 8}, {0x008F, 8}, {0x0090, 8}, {0x0122, 9}, {0x0246, 10}, {0x0124, 9}, {0x0005, 3}, {0x0013, 5}, {0x004A, 7}, {0x0093, 8}, {0x0018, 5}, {0x004B, 7}, {0x0032, 6}, {0x001A, 5}, {0x0033, 6}, {0x006C, 7}, {0x006D, 7}, {0x006E, 7}, {0x00DE, 8}, {0x00DF, 8}, {0x0070, 7}, {0x00E2, 8}, {0x00E3, 8}, {0x00E4, 8}, {0x00E5, 8}, {0x00E6, 8}, {0x00E7, 8}, {0x0125, 9}, {0x01D0, 9}, {0x048E, 11}, {0x091E, 12}, {0x091F, 12}, {0x7440, 15}, {0x1D11, 13}, {0x7441, 15}, {0x7442, 15}, {0x00E9, 8}, {0x01D4, 9}, {0x00EB, 8}, {0x03A3, 10}, {0x01D5, 9}, {0x1D12, 13}, {0x001E, 5}, {0x0076, 7}, {0x01DC, 9}, {0x01DD, 9}, {0x7443, 15}, {0x007C, 7}, {0x0745, 11}, {0x00EF, 8}, {0x00FA, 8}, {0x00FB, 8}, {0x01F8, 9}, {0x00FD, 8}, {0x07E4, 11}, {0x0FCA, 12}, {0x1D13, 13}, {0x7E58, 15}, {0x7E59, 15}, {0x7E5A, 15}, {0x7E5B, 15}, {0x7E5C, 15}, {0x7E5D, 15}, {0x007F, 7}, {0x3F2F, 14}, {0x07E6, 11}, {0x07E7, 11}, },{//6 {0x0000, 3}, {0x0002, 4}, {0x0003, 4}, {0x0008, 5}, {0x0009, 5}, {0x0014, 6}, {0x0015, 6}, {0x002C, 7}, {0x005A, 8}, {0x005B, 8}, {0x005C, 8}, {0x00BA, 9}, {0x00BB, 9}, {0x00BC, 9}, {0x02F4, 11}, {0x05EA, 12}, {0x0003, 3}, {0x0010, 5}, {0x0022, 6}, {0x0046, 7}, {0x0009, 4}, {0x0028, 6}, {0x0015, 5}, {0x000B, 4}, {0x0018, 5}, {0x0029, 6}, {0x0032, 6}, {0x0047, 7}, {0x0066, 7}, {0x0067, 7}, {0x0068, 7}, {0x0069, 7}, {0x006A, 7}, {0x005F, 8}, {0x00D6, 8}, {0x00D7, 8}, {0x01B0, 9}, {0x00D9, 8}, {0x017B, 10}, {0x006D, 7}, {0x00DC, 8}, {0x01B1, 9}, {0x06E8, 11}, {0x01BB, 9}, {0x0375, 10}, {0x05EB, 12}, {0x01BC, 9}, {0x6E90, 15}, {0x0038, 6}, {0x0072, 7}, {0x6E91, 15}, {0x6E92, 15}, {0x001D, 5}, {0x0073, 7}, {0x01BD, 9}, {0x06F8, 11}, {0x6E93, 15}, {0x003C, 6}, {0x01BF, 9}, {0x00F4, 8}, {0x01EA, 9}, {0x037D, 10}, {0x03D6, 10}, {0x06F9, 11}, {0x6E94, 15}, {0x00F6, 8}, {0x01EE, 9}, {0x6E95, 15}, {0x6E96, 15}, {0x6E97, 15}, {0x374C, 14}, {0x374D, 14}, {0x374E, 14}, {0x001F, 5}, {0x03D7, 10}, {0x01EF, 9}, {0x374F, 14}, },{//7 {0x0000, 2}, {0x0004, 4}, {0x000A, 5}, {0x0016, 6}, {0x002E, 7}, {0x002F, 7}, {0x0060, 8}, {0x0061, 8}, {0x00C4, 9}, {0x00C5, 9}, {0x00C6, 9}, {0x018E, 10}, {0x31E0, 15}, {0x31E1, 15}, {0x31E2, 15}, {0x31E3, 15}, {0x0004, 3}, {0x000D, 5}, {0x0019, 6}, {0x0038, 7}, {0x000A, 4}, {0x001D, 6}, {0x000B, 4}, {0x0072, 8}, {0x0073, 8}, {0x00F0, 9}, {0x01E2, 10}, {0x00F2, 9}, {0x01E3, 10}, {0x00F3, 9}, {0x01E8, 10}, {0x01E9, 10}, {0x31E4, 15}, {0x01EA, 10}, {0x031F, 11}, {0x03D6, 11}, {0x31E5, 15}, {0x01EC, 10}, {0x31E6, 15}, {0x00F7, 9}, {0x03D7, 11}, {0x31E7, 15}, {0x31E8, 15}, {0x03DA, 11}, {0x03DB, 11}, {0x31E9, 15}, {0x03E0, 11}, {0x31EA, 15}, {0x003F, 7}, {0x01F1, 10}, {0x31EB, 15}, {0x31EC, 15}, {0x0006, 3}, {0x001C, 5}, {0x0074, 7}, {0x0075, 7}, {0x00F9, 9}, {0x001E, 5}, {0x0076, 7}, {0x00FA, 9}, {0x03E1, 11}, {0x31ED, 15}, {0x18F7, 14}, {0x1F60, 14}, {0x1F61, 14}, {0x01DC, 9}, {0x01DD, 9}, {0x1F62, 14}, {0x1F63, 14}, {0x1F64, 14}, {0x1F65, 14}, {0x1F66, 14}, {0x1F67, 14}, {0x001F, 5}, {0x03ED, 11}, {0x00EF, 8}, {0x01F7, 10}, } }; static const uint16_t x8_ac1_highquant_table[8][77][2]={ {//0 {0x0000, 3}, {0x0002, 4}, {0x0006, 5}, {0x0007, 5}, {0x0008, 5}, {0x0009, 5}, {0x0014, 6}, {0x002A, 7}, {0x0016, 6}, {0x002B, 7}, {0x005C, 8}, {0x002F, 7}, {0x0030, 7}, {0x005D, 8}, {0x0062, 8}, {0x00C6, 9}, {0x0007, 4}, {0x0019, 6}, {0x001A, 6}, {0x0036, 7}, {0x0010, 5}, {0x006E, 8}, {0x0022, 6}, {0x0009, 4}, {0x000A, 4}, {0x0016, 5}, {0x0023, 6}, {0x002E, 6}, {0x002F, 6}, {0x0030, 6}, {0x0062, 7}, {0x0063, 7}, {0x0064, 7}, {0x0065, 7}, {0x0066, 7}, {0x0067, 7}, {0x0068, 7}, {0x0069, 7}, {0x006A, 7}, {0x006B, 7}, {0x006C, 7}, {0x00C7, 9}, {0x00DE, 9}, {0x00DF, 9}, {0x06D0, 11}, {0x01B5, 9}, {0x0037, 6}, {0x00DB, 8}, {0x001C, 5}, {0x0074, 7}, {0x01D4, 9}, {0x01D5, 9}, {0x0076, 7}, {0x0369, 10}, {0x3688, 14}, {0x3689, 14}, {0x368A, 14}, {0x0077, 7}, {0x03AC, 10}, {0x0078, 7}, {0x00F2, 8}, {0x01D7, 9}, {0x00F3, 8}, {0x007A, 7}, {0x368B, 14}, {0x007B, 7}, {0x007C, 7}, {0x03AD, 10}, {0x03E8, 10}, {0x368C, 14}, {0x368D, 14}, {0x03E9, 10}, {0x368E, 14}, {0x003F, 6}, {0x01F5, 9}, {0x00FB, 8}, {0x368F, 14}, },{//1 {0x0000, 2}, {0x0004, 4}, {0x000A, 5}, {0x000B, 5}, {0x0018, 6}, {0x0032, 7}, {0x0033, 7}, {0x0034, 7}, {0x006A, 8}, {0x00D6, 9}, {0x00D7, 9}, {0x00D8, 9}, {0x00D9, 9}, {0x3680, 15}, {0x01B5, 10}, {0x0369, 11}, {0x0004, 3}, {0x000E, 5}, {0x001E, 6}, {0x0037, 7}, {0x000A, 4}, {0x0016, 5}, {0x000C, 4}, {0x001F, 6}, {0x005C, 7}, {0x005D, 7}, {0x00BC, 8}, {0x00BD, 8}, {0x005F, 7}, {0x00D0, 8}, {0x00DB, 9}, {0x00D1, 8}, {0x01A4, 9}, {0x01A5, 9}, {0x01A6, 9}, {0x01A7, 9}, {0x0350, 10}, {0x06A2, 11}, {0x06A3, 11}, {0x01A9, 9}, {0x01AA, 9}, {0x06AC, 11}, {0x3681, 15}, {0x0357, 10}, {0x3682, 15}, {0x3683, 15}, {0x3684, 15}, {0x3685, 15}, {0x0036, 6}, {0x00D6, 8}, {0x3686, 15}, {0x3687, 15}, {0x000E, 4}, {0x006E, 7}, {0x00D7, 8}, {0x06AD, 11}, {0x3688, 15}, {0x001E, 5}, {0x00DE, 8}, {0x06F8, 11}, {0x037D, 10}, {0x3689, 15}, {0x368A, 15}, {0x368B, 15}, {0x368C, 15}, {0x01BF, 9}, {0x368D, 15}, {0x1B47, 14}, {0x37C8, 14}, {0x37C9, 14}, {0x37CA, 14}, {0x37CB, 14}, {0x37CC, 14}, {0x001F, 5}, {0x37CD, 14}, {0x37CE, 14}, {0x37CF, 14}, },{//2 {0x0000, 3}, {0x0002, 4}, {0x0003, 4}, {0x0008, 5}, {0x0012, 6}, {0x0026, 7}, {0x0014, 6}, {0x0027, 7}, {0x00A8, 9}, {0x00A9, 9}, {0x0055, 8}, {0x2B00, 15}, {0x00AD, 9}, {0x2B01, 15}, {0x2B02, 15}, {0x2B03, 15}, {0x0003, 3}, {0x000B, 5}, {0x0040, 7}, {0x0041, 7}, {0x0009, 4}, {0x0021, 6}, {0x0011, 5}, {0x000A, 4}, {0x000B, 4}, {0x0018, 5}, {0x0032, 6}, {0x0033, 6}, {0x0034, 6}, {0x0035, 6}, {0x006C, 7}, {0x0057, 8}, {0x006D, 7}, {0x00DC, 8}, {0x0159, 10}, {0x00DD, 8}, {0x01BC, 9}, {0x037A, 10}, {0x037B, 10}, {0x0038, 6}, {0x0072, 7}, {0x01BE, 9}, {0x01BF, 9}, {0x00E6, 8}, {0x039C, 10}, {0x01CF, 9}, {0x2B04, 15}, {0x2B05, 15}, {0x0074, 7}, {0x01D4, 9}, {0x2B06, 15}, {0x2B07, 15}, {0x001E, 5}, {0x00EB, 8}, {0x1584, 14}, {0x1585, 14}, {0x1586, 14}, {0x003B, 6}, {0x01D5, 9}, {0x01F0, 9}, {0x039D, 10}, {0x03E2, 10}, {0x1587, 14}, {0x1588, 14}, {0x1589, 14}, {0x00F9, 8}, {0x158A, 14}, {0x158B, 14}, {0x03E3, 10}, {0x158C, 14}, {0x158D, 14}, {0x01F4, 9}, {0x158E, 14}, {0x003F, 6}, {0x00FB, 8}, {0x01F5, 9}, {0x158F, 14}, },{//3 {0x0000, 3}, {0x0002, 4}, {0x0006, 5}, {0x0007, 5}, {0x0010, 6}, {0x0011, 6}, {0x0024, 7}, {0x0025, 7}, {0x0013, 6}, {0x0014, 6}, {0x002A, 7}, {0x002B, 7}, {0x00B0, 9}, {0x00B1, 9}, {0x002D, 7}, {0x0059, 8}, {0x000C, 5}, {0x0017, 6}, {0x00D0, 9}, {0x0035, 7}, {0x001B, 6}, {0x0038, 7}, {0x0039, 7}, {0x0004, 3}, {0x0005, 3}, {0x000F, 5}, {0x0018, 5}, {0x001D, 6}, {0x0032, 6}, {0x0033, 6}, {0x0068, 7}, {0x0069, 7}, {0x0069, 8}, {0x00D4, 8}, {0x00D5, 8}, {0x00D6, 8}, {0x006C, 7}, {0x0037, 6}, {0x006D, 7}, {0x0070, 7}, {0x0039, 6}, {0x00D7, 8}, {0x00D1, 9}, {0x3880, 14}, {0x3881, 14}, {0x3882, 14}, {0x0074, 7}, {0x01C5, 9}, {0x0075, 7}, {0x00E3, 8}, {0x3883, 14}, {0x3884, 14}, {0x00EC, 8}, {0x3885, 14}, {0x1C43, 13}, {0x1C44, 13}, {0x1C45, 13}, {0x00ED, 8}, {0x1C46, 13}, {0x003C, 6}, {0x0077, 7}, {0x01E8, 9}, {0x003E, 6}, {0x007B, 7}, {0x1C47, 13}, {0x007E, 7}, {0x007F, 7}, {0x1C48, 13}, {0x1C49, 13}, {0x1C4A, 13}, {0x1C4B, 13}, {0x1C4C, 13}, {0x1C4D, 13}, {0x00F5, 8}, {0x1C4E, 13}, {0x01E9, 9}, {0x1C4F, 13}, },{//4 {0x0000, 2}, {0x0004, 4}, {0x000A, 5}, {0x000B, 5}, {0x0018, 6}, {0x0019, 6}, {0x0034, 7}, {0x0035, 7}, {0x0036, 7}, {0x006E, 8}, {0x00DE, 9}, {0x00DF, 9}, {0x01C0, 10}, {0x01C1, 10}, {0x01C2, 10}, {0x3860, 15}, {0x0004, 3}, {0x000F, 5}, {0x001D, 6}, {0x0039, 7}, {0x000A, 4}, {0x002C, 6}, {0x002D, 6}, {0x000C, 4}, {0x0017, 5}, {0x0034, 6}, {0x0035, 6}, {0x0036, 6}, {0x006E, 7}, {0x006F, 7}, {0x0070, 7}, {0x0071, 7}, {0x0071, 8}, {0x00E4, 8}, {0x00E5, 8}, {0x00E6, 8}, {0x00E7, 8}, {0x00E8, 8}, {0x03A4, 10}, {0x0075, 7}, {0x00EC, 8}, {0x01D3, 9}, {0x01DA, 9}, {0x03A5, 10}, {0x03B6, 10}, {0x070D, 12}, {0x03B7, 10}, {0x070E, 12}, {0x003C, 6}, {0x00EE, 8}, {0x3861, 15}, {0x3862, 15}, {0x003D, 6}, {0x01DE, 9}, {0x3863, 15}, {0x3864, 15}, {0x3865, 15}, {0x007C, 7}, {0x070F, 12}, {0x03BE, 10}, {0x03BF, 10}, {0x3866, 15}, {0x0FA0, 12}, {0x07D1, 11}, {0x3867, 15}, {0x00FB, 8}, {0x01F5, 9}, {0x7D08, 15}, {0x0FA4, 12}, {0x7D09, 15}, {0x7D0A, 15}, {0x7D0B, 15}, {0x3E86, 14}, {0x003F, 6}, {0x0FA5, 12}, {0x07D3, 11}, {0x3E87, 14}, },{//5 {0x0000, 3}, {0x0002, 4}, {0x0003, 4}, {0x0008, 5}, {0x0009, 5}, {0x0014, 6}, {0x002A, 7}, {0x0056, 8}, {0x02B8, 11}, {0x00AF, 9}, {0x02B9, 11}, {0x015D, 10}, {0x02C0, 11}, {0x2C10, 15}, {0x2C11, 15}, {0x2C12, 15}, {0x0006, 4}, {0x000E, 5}, {0x0017, 6}, {0x002D, 7}, {0x000F, 5}, {0x0040, 7}, {0x0021, 6}, {0x0005, 3}, {0x0009, 4}, {0x0011, 5}, {0x0018, 5}, {0x0019, 5}, {0x001A, 5}, {0x0036, 6}, {0x0037, 6}, {0x0041, 7}, {0x0059, 8}, {0x00E0, 8}, {0x00E1, 8}, {0x0071, 7}, {0x00E4, 8}, {0x00B1, 9}, {0x02C2, 11}, {0x001D, 5}, {0x0073, 7}, {0x00E5, 8}, {0x00F0, 8}, {0x0079, 7}, {0x03C4, 10}, {0x01E3, 9}, {0x01E8, 9}, {0x2C13, 15}, {0x007B, 7}, {0x2C14, 15}, {0x2C15, 15}, {0x2C16, 15}, {0x007C, 7}, {0x02C3, 11}, {0x2C17, 15}, {0x160C, 14}, {0x160D, 14}, {0x007D, 7}, {0x160E, 14}, {0x01E9, 9}, {0x03C5, 10}, {0x03D4, 10}, {0x01EB, 9}, {0x160F, 14}, {0x3D50, 14}, {0x00FC, 8}, {0x07AB, 11}, {0x3D51, 14}, {0x3D52, 14}, {0x3D53, 14}, {0x3D54, 14}, {0x01FA, 9}, {0x3D55, 14}, {0x007F, 7}, {0x01FB, 9}, {0x3D56, 14}, {0x3D57, 14}, },{//6 {0x0000, 3}, {0x0002, 4}, {0x0003, 4}, {0x0008, 5}, {0x0009, 5}, {0x000A, 5}, {0x000B, 5}, {0x0018, 6}, {0x0032, 7}, {0x000D, 5}, {0x0033, 7}, {0x0E00, 13}, {0x0039, 7}, {0x0E01, 13}, {0x003A, 7}, {0x0E02, 13}, {0x0008, 4}, {0x001E, 6}, {0x003B, 7}, {0x003E, 7}, {0x0012, 5}, {0x003F, 7}, {0x0013, 5}, {0x0028, 6}, {0x0029, 6}, {0x0054, 7}, {0x002B, 6}, {0x0055, 7}, {0x0058, 7}, {0x0E03, 13}, {0x0059, 7}, {0x005A, 7}, {0x0E04, 13}, {0x0E05, 13}, {0x0703, 12}, {0x005B, 7}, {0x005C, 7}, {0x0704, 12}, {0x0705, 12}, {0x005D, 7}, {0x0706, 12}, {0x0707, 12}, {0x0708, 12}, {0x0709, 12}, {0x070A, 12}, {0x070B, 12}, {0x0018, 5}, {0x002F, 6}, {0x000D, 4}, {0x0019, 5}, {0x070C, 12}, {0x0070, 7}, {0x001D, 5}, {0x070D, 12}, {0x070E, 12}, {0x070F, 12}, {0x0710, 12}, {0x0039, 6}, {0x0711, 12}, {0x003C, 6}, {0x0712, 12}, {0x0713, 12}, {0x0714, 12}, {0x0715, 12}, {0x0716, 12}, {0x003D, 6}, {0x0717, 12}, {0x0718, 12}, {0x0719, 12}, {0x071A, 12}, {0x071B, 12}, {0x071C, 12}, {0x071D, 12}, {0x001F, 5}, {0x071E, 12}, {0x0071, 7}, {0x071F, 12}, },{//7 {0x0000, 3}, {0x0002, 4}, {0x0006, 5}, {0x000E, 6}, {0x000F, 6}, {0x0040, 8}, {0x0041, 8}, {0x0042, 8}, {0x0218, 11}, {0x2190, 15}, {0x2191, 15}, {0x2192, 15}, {0x2193, 15}, {0x2194, 15}, {0x2195, 15}, {0x2196, 15}, {0x0005, 4}, {0x0011, 6}, {0x0024, 7}, {0x0087, 9}, {0x000C, 5}, {0x004A, 8}, {0x004B, 8}, {0x0002, 2}, {0x0006, 3}, {0x000D, 5}, {0x000E, 5}, {0x000F, 5}, {0x0013, 6}, {0x0038, 6}, {0x00E4, 8}, {0x00E5, 8}, {0x01CC, 9}, {0x00E7, 8}, {0x0074, 7}, {0x00EA, 8}, {0x01CD, 9}, {0x021A, 11}, {0x2197, 15}, {0x001E, 5}, {0x0076, 7}, {0x00EB, 8}, {0x01DC, 9}, {0x00EF, 8}, {0x01DD, 9}, {0x01F0, 9}, {0x2198, 15}, {0x2199, 15}, {0x00F9, 8}, {0x03E2, 10}, {0x219A, 15}, {0x219B, 15}, {0x00FA, 8}, {0x219C, 15}, {0x219D, 15}, {0x219E, 15}, {0x219F, 15}, {0x01F6, 9}, {0x21B0, 15}, {0x00FC, 8}, {0x01F7, 9}, {0x21B1, 15}, {0x21B2, 15}, {0x21B3, 15}, {0x21B4, 15}, {0x01FA, 9}, {0x21B5, 15}, {0x21B6, 15}, {0x21B7, 15}, {0x21B8, 15}, {0x21B9, 15}, {0x03E3, 10}, {0x10DD, 14}, {0x007F, 7}, {0x01FB, 9}, {0x10DE, 14}, {0x10DF, 14}, } }; #define MAX_AC_VLC_BITS 16 #endif /* AVCODEC_INTRAX8HUF_H */
123linslouis-android-video-cutter
jni/libavcodec/intrax8huf.h
C
asf20
51,613
/* * AAC Spectral Band Replication decoding data * Copyright (c) 2008-2009 Robert Swain ( rob opendot cl ) * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * AAC Spectral Band Replication decoding data * @author Robert Swain ( rob opendot cl ) */ #ifndef AVCODEC_AACSBRDATA_H #define AVCODEC_AACSBRDATA_H #include <stdint.h> #include "libavutil/mem.h" ///< Huffman tables for SBR static const uint8_t t_huffman_env_1_5dB_bits[121] = { 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 17, 18, 16, 17, 18, 17, 16, 16, 16, 16, 15, 14, 14, 13, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 14, 15, 16, 17, 16, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, }; static const uint32_t t_huffman_env_1_5dB_codes[121] = { 0x3ffd6, 0x3ffd7, 0x3ffd8, 0x3ffd9, 0x3ffda, 0x3ffdb, 0x7ffb8, 0x7ffb9, 0x7ffba, 0x7ffbb, 0x7ffbc, 0x7ffbd, 0x7ffbe, 0x7ffbf, 0x7ffc0, 0x7ffc1, 0x7ffc2, 0x7ffc3, 0x7ffc4, 0x7ffc5, 0x7ffc6, 0x7ffc7, 0x7ffc8, 0x7ffc9, 0x7ffca, 0x7ffcb, 0x7ffcc, 0x7ffcd, 0x7ffce, 0x7ffcf, 0x7ffd0, 0x7ffd1, 0x7ffd2, 0x7ffd3, 0x1ffe6, 0x3ffd4, 0x0fff0, 0x1ffe9, 0x3ffd5, 0x1ffe7, 0x0fff1, 0x0ffec, 0x0ffed, 0x0ffee, 0x07ff4, 0x03ff9, 0x03ff7, 0x01ffa, 0x01ff9, 0x00ffb, 0x007fc, 0x003fc, 0x001fd, 0x000fd, 0x0007d, 0x0003d, 0x0001d, 0x0000d, 0x00005, 0x00001, 0x00000, 0x00004, 0x0000c, 0x0001c, 0x0003c, 0x0007c, 0x000fc, 0x001fc, 0x003fd, 0x00ffa, 0x01ff8, 0x03ff6, 0x03ff8, 0x07ff5, 0x0ffef, 0x1ffe8, 0x0fff2, 0x7ffd4, 0x7ffd5, 0x7ffd6, 0x7ffd7, 0x7ffd8, 0x7ffd9, 0x7ffda, 0x7ffdb, 0x7ffdc, 0x7ffdd, 0x7ffde, 0x7ffdf, 0x7ffe0, 0x7ffe1, 0x7ffe2, 0x7ffe3, 0x7ffe4, 0x7ffe5, 0x7ffe6, 0x7ffe7, 0x7ffe8, 0x7ffe9, 0x7ffea, 0x7ffeb, 0x7ffec, 0x7ffed, 0x7ffee, 0x7ffef, 0x7fff0, 0x7fff1, 0x7fff2, 0x7fff3, 0x7fff4, 0x7fff5, 0x7fff6, 0x7fff7, 0x7fff8, 0x7fff9, 0x7fffa, 0x7fffb, 0x7fffc, 0x7fffd, 0x7fffe, 0x7ffff, }; static const uint8_t f_huffman_env_1_5dB_bits[121] = { 19, 19, 20, 20, 20, 20, 20, 20, 20, 19, 20, 20, 20, 20, 19, 20, 19, 19, 20, 18, 20, 20, 20, 19, 20, 20, 20, 19, 20, 19, 18, 19, 18, 18, 17, 18, 17, 17, 17, 16, 16, 16, 15, 15, 14, 13, 13, 12, 12, 11, 10, 9, 9, 8, 7, 6, 5, 4, 3, 2, 2, 3, 4, 5, 6, 8, 8, 9, 10, 11, 11, 11, 12, 12, 13, 13, 14, 14, 16, 16, 17, 17, 18, 18, 18, 18, 18, 18, 18, 20, 19, 20, 20, 20, 20, 20, 20, 19, 20, 20, 20, 20, 19, 20, 18, 20, 20, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, }; static const uint32_t f_huffman_env_1_5dB_codes[121] = { 0x7ffe7, 0x7ffe8, 0xfffd2, 0xfffd3, 0xfffd4, 0xfffd5, 0xfffd6, 0xfffd7, 0xfffd8, 0x7ffda, 0xfffd9, 0xfffda, 0xfffdb, 0xfffdc, 0x7ffdb, 0xfffdd, 0x7ffdc, 0x7ffdd, 0xfffde, 0x3ffe4, 0xfffdf, 0xfffe0, 0xfffe1, 0x7ffde, 0xfffe2, 0xfffe3, 0xfffe4, 0x7ffdf, 0xfffe5, 0x7ffe0, 0x3ffe8, 0x7ffe1, 0x3ffe0, 0x3ffe9, 0x1ffef, 0x3ffe5, 0x1ffec, 0x1ffed, 0x1ffee, 0x0fff4, 0x0fff3, 0x0fff0, 0x07ff7, 0x07ff6, 0x03ffa, 0x01ffa, 0x01ff9, 0x00ffa, 0x00ff8, 0x007f9, 0x003fb, 0x001fc, 0x001fa, 0x000fb, 0x0007c, 0x0003c, 0x0001c, 0x0000c, 0x00005, 0x00001, 0x00000, 0x00004, 0x0000d, 0x0001d, 0x0003d, 0x000fa, 0x000fc, 0x001fb, 0x003fa, 0x007f8, 0x007fa, 0x007fb, 0x00ff9, 0x00ffb, 0x01ff8, 0x01ffb, 0x03ff8, 0x03ff9, 0x0fff1, 0x0fff2, 0x1ffea, 0x1ffeb, 0x3ffe1, 0x3ffe2, 0x3ffea, 0x3ffe3, 0x3ffe6, 0x3ffe7, 0x3ffeb, 0xfffe6, 0x7ffe2, 0xfffe7, 0xfffe8, 0xfffe9, 0xfffea, 0xfffeb, 0xfffec, 0x7ffe3, 0xfffed, 0xfffee, 0xfffef, 0xffff0, 0x7ffe4, 0xffff1, 0x3ffec, 0xffff2, 0xffff3, 0x7ffe5, 0x7ffe6, 0xffff4, 0xffff5, 0xffff6, 0xffff7, 0xffff8, 0xffff9, 0xffffa, 0xffffb, 0xffffc, 0xffffd, 0xffffe, 0xfffff, }; static const uint8_t t_huffman_env_bal_1_5dB_bits[49] = { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 12, 11, 9, 7, 5, 3, 1, 2, 4, 6, 8, 11, 12, 15, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, }; static const uint32_t t_huffman_env_bal_1_5dB_codes[49] = { 0x0ffe4, 0x0ffe5, 0x0ffe6, 0x0ffe7, 0x0ffe8, 0x0ffe9, 0x0ffea, 0x0ffeb, 0x0ffec, 0x0ffed, 0x0ffee, 0x0ffef, 0x0fff0, 0x0fff1, 0x0fff2, 0x0fff3, 0x0fff4, 0x0ffe2, 0x00ffc, 0x007fc, 0x001fe, 0x0007e, 0x0001e, 0x00006, 0x00000, 0x00002, 0x0000e, 0x0003e, 0x000fe, 0x007fd, 0x00ffd, 0x07ff0, 0x0ffe3, 0x0fff5, 0x0fff6, 0x0fff7, 0x0fff8, 0x0fff9, 0x0fffa, 0x1fff6, 0x1fff7, 0x1fff8, 0x1fff9, 0x1fffa, 0x1fffb, 0x1fffc, 0x1fffd, 0x1fffe, 0x1ffff, }; static const uint8_t f_huffman_env_bal_1_5dB_bits[49] = { 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 16, 17, 14, 11, 11, 8, 7, 4, 2, 1, 3, 5, 6, 9, 11, 12, 15, 16, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, }; static const uint32_t f_huffman_env_bal_1_5dB_codes[49] = { 0x3ffe2, 0x3ffe3, 0x3ffe4, 0x3ffe5, 0x3ffe6, 0x3ffe7, 0x3ffe8, 0x3ffe9, 0x3ffea, 0x3ffeb, 0x3ffec, 0x3ffed, 0x3ffee, 0x3ffef, 0x3fff0, 0x0fff7, 0x1fff0, 0x03ffc, 0x007fe, 0x007fc, 0x000fe, 0x0007e, 0x0000e, 0x00002, 0x00000, 0x00006, 0x0001e, 0x0003e, 0x001fe, 0x007fd, 0x00ffe, 0x07ffa, 0x0fff6, 0x3fff1, 0x3fff2, 0x3fff3, 0x3fff4, 0x3fff5, 0x3fff6, 0x3fff7, 0x3fff8, 0x3fff9, 0x3fffa, 0x3fffb, 0x3fffc, 0x3fffd, 0x3fffe, 0x7fffe, 0x7ffff, }; static const uint8_t t_huffman_env_3_0dB_bits[63] = { 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 17, 16, 16, 16, 14, 14, 14, 13, 12, 11, 8, 6, 4, 2, 1, 3, 5, 7, 9, 11, 13, 14, 14, 15, 16, 17, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, }; static const uint32_t t_huffman_env_3_0dB_codes[63] = { 0x3ffed, 0x3ffee, 0x7ffde, 0x7ffdf, 0x7ffe0, 0x7ffe1, 0x7ffe2, 0x7ffe3, 0x7ffe4, 0x7ffe5, 0x7ffe6, 0x7ffe7, 0x7ffe8, 0x7ffe9, 0x7ffea, 0x7ffeb, 0x7ffec, 0x1fff4, 0x0fff7, 0x0fff9, 0x0fff8, 0x03ffb, 0x03ffa, 0x03ff8, 0x01ffa, 0x00ffc, 0x007fc, 0x000fe, 0x0003e, 0x0000e, 0x00002, 0x00000, 0x00006, 0x0001e, 0x0007e, 0x001fe, 0x007fd, 0x01ffb, 0x03ff9, 0x03ffc, 0x07ffa, 0x0fff6, 0x1fff5, 0x3ffec, 0x7ffed, 0x7ffee, 0x7ffef, 0x7fff0, 0x7fff1, 0x7fff2, 0x7fff3, 0x7fff4, 0x7fff5, 0x7fff6, 0x7fff7, 0x7fff8, 0x7fff9, 0x7fffa, 0x7fffb, 0x7fffc, 0x7fffd, 0x7fffe, 0x7ffff, }; static const uint8_t f_huffman_env_3_0dB_bits[63] = { 20, 20, 20, 20, 20, 20, 20, 18, 19, 19, 19, 19, 18, 18, 20, 19, 17, 18, 17, 16, 16, 15, 14, 12, 11, 10, 9, 8, 6, 4, 2, 1, 3, 5, 8, 9, 10, 11, 12, 13, 14, 15, 15, 16, 16, 17, 17, 18, 18, 18, 20, 19, 19, 19, 20, 19, 19, 20, 20, 20, 20, 20, 20, }; static const uint32_t f_huffman_env_3_0dB_codes[63] = { 0xffff0, 0xffff1, 0xffff2, 0xffff3, 0xffff4, 0xffff5, 0xffff6, 0x3fff3, 0x7fff5, 0x7ffee, 0x7ffef, 0x7fff6, 0x3fff4, 0x3fff2, 0xffff7, 0x7fff0, 0x1fff5, 0x3fff0, 0x1fff4, 0x0fff7, 0x0fff6, 0x07ff8, 0x03ffb, 0x00ffd, 0x007fd, 0x003fd, 0x001fd, 0x000fd, 0x0003e, 0x0000e, 0x00002, 0x00000, 0x00006, 0x0001e, 0x000fc, 0x001fc, 0x003fc, 0x007fc, 0x00ffc, 0x01ffc, 0x03ffa, 0x07ff9, 0x07ffa, 0x0fff8, 0x0fff9, 0x1fff6, 0x1fff7, 0x3fff5, 0x3fff6, 0x3fff1, 0xffff8, 0x7fff1, 0x7fff2, 0x7fff3, 0xffff9, 0x7fff7, 0x7fff4, 0xffffa, 0xffffb, 0xffffc, 0xffffd, 0xffffe, 0xfffff, }; static const uint8_t t_huffman_env_bal_3_0dB_bits[25] = { 13, 13, 13, 13, 13, 13, 13, 12, 8, 7, 4, 3, 1, 2, 5, 6, 9, 13, 13, 13, 13, 13, 13, 14, 14, }; static const uint16_t t_huffman_env_bal_3_0dB_codes[25] = { 0x1ff2, 0x1ff3, 0x1ff4, 0x1ff5, 0x1ff6, 0x1ff7, 0x1ff8, 0x0ff8, 0x00fe, 0x007e, 0x000e, 0x0006, 0x0000, 0x0002, 0x001e, 0x003e, 0x01fe, 0x1ff9, 0x1ffa, 0x1ffb, 0x1ffc, 0x1ffd, 0x1ffe, 0x3ffe, 0x3fff, }; static const uint8_t f_huffman_env_bal_3_0dB_bits[25] = { 13, 13, 13, 13, 13, 14, 14, 11, 8, 7, 4, 2, 1, 3, 5, 6, 9, 12, 13, 14, 14, 14, 14, 14, 14, }; static const uint16_t f_huffman_env_bal_3_0dB_codes[25] = { 0x1ff7, 0x1ff8, 0x1ff9, 0x1ffa, 0x1ffb, 0x3ff8, 0x3ff9, 0x07fc, 0x00fe, 0x007e, 0x000e, 0x0002, 0x0000, 0x0006, 0x001e, 0x003e, 0x01fe, 0x0ffa, 0x1ff6, 0x3ffa, 0x3ffb, 0x3ffc, 0x3ffd, 0x3ffe, 0x3fff, }; static const uint8_t t_huffman_noise_3_0dB_bits[63] = { 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 11, 8, 6, 4, 3, 1, 2, 5, 8, 10, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, }; static const uint16_t t_huffman_noise_3_0dB_codes[63] = { 0x1fce, 0x1fcf, 0x1fd0, 0x1fd1, 0x1fd2, 0x1fd3, 0x1fd4, 0x1fd5, 0x1fd6, 0x1fd7, 0x1fd8, 0x1fd9, 0x1fda, 0x1fdb, 0x1fdc, 0x1fdd, 0x1fde, 0x1fdf, 0x1fe0, 0x1fe1, 0x1fe2, 0x1fe3, 0x1fe4, 0x1fe5, 0x1fe6, 0x1fe7, 0x07f2, 0x00fd, 0x003e, 0x000e, 0x0006, 0x0000, 0x0002, 0x001e, 0x00fc, 0x03f8, 0x1fcc, 0x1fe8, 0x1fe9, 0x1fea, 0x1feb, 0x1fec, 0x1fcd, 0x1fed, 0x1fee, 0x1fef, 0x1ff0, 0x1ff1, 0x1ff2, 0x1ff3, 0x1ff4, 0x1ff5, 0x1ff6, 0x1ff7, 0x1ff8, 0x1ff9, 0x1ffa, 0x1ffb, 0x1ffc, 0x1ffd, 0x1ffe, 0x3ffe, 0x3fff, }; static const uint8_t t_huffman_noise_bal_3_0dB_bits[25] = { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 2, 1, 3, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; static const uint8_t t_huffman_noise_bal_3_0dB_codes[25] = { 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0x1c, 0x02, 0x00, 0x06, 0x3a, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, }; static const int8_t sbr_offset[6][16] = { {-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7}, // fs_sbr = 16000 Hz {-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13}, // fs_sbr = 22050 Hz {-5, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16}, // fs_sbr = 24000 Hz {-6, -4, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16}, // fs_sbr = 32000 Hz {-4, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20}, // 44100 Hz <= fs_sbr <= 64000 Hz {-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20, 24}, // 64000 Hz < fs_sbr }; ///< window coefficients for analysis/synthesis QMF banks static DECLARE_ALIGNED(16, float, sbr_qmf_window_ds)[320]; static DECLARE_ALIGNED(16, float, sbr_qmf_window_us)[640] = { 0.0000000000, -0.0005525286, -0.0005617692, -0.0004947518, -0.0004875227, -0.0004893791, -0.0005040714, -0.0005226564, -0.0005466565, -0.0005677802, -0.0005870930, -0.0006132747, -0.0006312493, -0.0006540333, -0.0006777690, -0.0006941614, -0.0007157736, -0.0007255043, -0.0007440941, -0.0007490598, -0.0007681371, -0.0007724848, -0.0007834332, -0.0007779869, -0.0007803664, -0.0007801449, -0.0007757977, -0.0007630793, -0.0007530001, -0.0007319357, -0.0007215391, -0.0006917937, -0.0006650415, -0.0006341594, -0.0005946118, -0.0005564576, -0.0005145572, -0.0004606325, -0.0004095121, -0.0003501175, -0.0002896981, -0.0002098337, -0.0001446380, -0.0000617334, 0.0000134949, 0.0001094383, 0.0002043017, 0.0002949531, 0.0004026540, 0.0005107388, 0.0006239376, 0.0007458025, 0.0008608443, 0.0009885988, 0.0011250155, 0.0012577884, 0.0013902494, 0.0015443219, 0.0016868083, 0.0018348265, 0.0019841140, 0.0021461583, 0.0023017254, 0.0024625616, 0.0026201758, 0.0027870464, 0.0029469447, 0.0031125420, 0.0032739613, 0.0034418874, 0.0036008268, 0.0037603922, 0.0039207432, 0.0040819753, 0.0042264269, 0.0043730719, 0.0045209852, 0.0046606460, 0.0047932560, 0.0049137603, 0.0050393022, 0.0051407353, 0.0052461166, 0.0053471681, 0.0054196775, 0.0054876040, 0.0055475714, 0.0055938023, 0.0056220643, 0.0056455196, 0.0056389199, 0.0056266114, 0.0055917128, 0.0055404363, 0.0054753783, 0.0053838975, 0.0052715758, 0.0051382275, 0.0049839687, 0.0048109469, 0.0046039530, 0.0043801861, 0.0041251642, 0.0038456408, 0.0035401246, 0.0032091885, 0.0028446757, 0.0024508540, 0.0020274176, 0.0015784682, 0.0010902329, 0.0005832264, 0.0000276045, -0.0005464280, -0.0011568135, -0.0018039472, -0.0024826723, -0.0031933778, -0.0039401124, -0.0047222596, -0.0055337211, -0.0063792293, -0.0072615816, -0.0081798233, -0.0091325329, -0.0101150215, -0.0111315548, -0.0121849995, 0.0132718220, 0.0143904666, 0.0155405553, 0.0167324712, 0.0179433381, 0.0191872431, 0.0204531793, 0.0217467550, 0.0230680169, 0.0244160992, 0.0257875847, 0.0271859429, 0.0286072173, 0.0300502657, 0.0315017608, 0.0329754081, 0.0344620948, 0.0359697560, 0.0374812850, 0.0390053679, 0.0405349170, 0.0420649094, 0.0436097542, 0.0451488405, 0.0466843027, 0.0482165720, 0.0497385755, 0.0512556155, 0.0527630746, 0.0542452768, 0.0557173648, 0.0571616450, 0.0585915683, 0.0599837480, 0.0613455171, 0.0626857808, 0.0639715898, 0.0652247106, 0.0664367512, 0.0676075985, 0.0687043828, 0.0697630244, 0.0707628710, 0.0717002673, 0.0725682583, 0.0733620255, 0.0741003642, 0.0747452558, 0.0753137336, 0.0758008358, 0.0761992479, 0.0764992170, 0.0767093490, 0.0768173975, 0.0768230011, 0.0767204924, 0.0765050718, 0.0761748321, 0.0757305756, 0.0751576255, 0.0744664394, 0.0736406005, 0.0726774642, 0.0715826364, 0.0703533073, 0.0689664013, 0.0674525021, 0.0657690668, 0.0639444805, 0.0619602779, 0.0598166570, 0.0575152691, 0.0550460034, 0.0524093821, 0.0495978676, 0.0466303305, 0.0434768782, 0.0401458278, 0.0366418116, 0.0329583930, 0.0290824006, 0.0250307561, 0.0207997072, 0.0163701258, 0.0117623832, 0.0069636862, 0.0019765601, -0.0032086896, -0.0085711749, -0.0141288827, -0.0198834129, -0.0258227288, -0.0319531274, -0.0382776572, -0.0447806821, -0.0514804176, -0.0583705326, -0.0654409853, -0.0726943300, -0.0801372934, -0.0877547536, -0.0955533352, -0.1035329531, -0.1116826931, -0.1200077984, -0.1285002850, -0.1371551761, -0.1459766491, -0.1549607071, -0.1640958855, -0.1733808172, -0.1828172548, -0.1923966745, -0.2021250176, -0.2119735853, -0.2219652696, -0.2320690870, -0.2423016884, -0.2526480309, -0.2631053299, -0.2736634040, -0.2843214189, -0.2950716717, -0.3059098575, -0.3168278913, -0.3278113727, -0.3388722693, -0.3499914122, 0.3611589903, 0.3723795546, 0.3836350013, 0.3949211761, 0.4062317676, 0.4175696896, 0.4289119920, 0.4402553754, 0.4515996535, 0.4629308085, 0.4742453214, 0.4855253091, 0.4967708254, 0.5079817500, 0.5191234970, 0.5302240895, 0.5412553448, 0.5522051258, 0.5630789140, 0.5738524131, 0.5845403235, 0.5951123086, 0.6055783538, 0.6159109932, 0.6261242695, 0.6361980107, 0.6461269695, 0.6559016302, 0.6655139880, 0.6749663190, 0.6842353293, 0.6933282376, 0.7022388719, 0.7109410426, 0.7194462634, 0.7277448900, 0.7358211758, 0.7436827863, 0.7513137456, 0.7587080760, 0.7658674865, 0.7727780881, 0.7794287519, 0.7858353120, 0.7919735841, 0.7978466413, 0.8034485751, 0.8087695004, 0.8138191270, 0.8185776004, 0.8230419890, 0.8272275347, 0.8311038457, 0.8346937361, 0.8379717337, 0.8409541392, 0.8436238281, 0.8459818469, 0.8480315777, 0.8497805198, 0.8511971524, 0.8523047035, 0.8531020949, 0.8535720573, 0.8537385600, }; static const float sbr_noise_table[512][2] = { {-0.99948153278296, -0.59483417516607}, { 0.97113454393991, -0.67528515225647}, { 0.14130051758487, -0.95090983575689}, {-0.47005496701697, -0.37340549728647}, { 0.80705063769351, 0.29653668284408}, {-0.38981478896926, 0.89572605717087}, {-0.01053049862020, -0.66959058036166}, {-0.91266367957293, -0.11522938140034}, { 0.54840422910309, 0.75221367176302}, { 0.40009252867955, -0.98929400334421}, {-0.99867974711855, -0.88147068645358}, {-0.95531076805040, 0.90908757154593}, {-0.45725933317144, -0.56716323646760}, {-0.72929675029275, -0.98008272727324}, { 0.75622801399036, 0.20950329995549}, { 0.07069442601050, -0.78247898470706}, { 0.74496252926055, -0.91169004445807}, {-0.96440182703856, -0.94739918296622}, { 0.30424629369539, -0.49438267012479}, { 0.66565033746925, 0.64652935542491}, { 0.91697008020594, 0.17514097332009}, {-0.70774918760427, 0.52548653416543}, {-0.70051415345560, -0.45340028808763}, {-0.99496513054797, -0.90071908066973}, { 0.98164490790123, -0.77463155528697}, {-0.54671580548181, -0.02570928536004}, {-0.01689629065389, 0.00287506445732}, {-0.86110349531986, 0.42548583726477}, {-0.98892980586032, -0.87881132267556}, { 0.51756627678691, 0.66926784710139}, {-0.99635026409640, -0.58107730574765}, {-0.99969370862163, 0.98369989360250}, { 0.55266258627194, 0.59449057465591}, { 0.34581177741673, 0.94879421061866}, { 0.62664209577999, -0.74402970906471}, {-0.77149701404973, -0.33883658042801}, {-0.91592244254432, 0.03687901376713}, {-0.76285492357887, -0.91371867919124}, { 0.79788337195331, -0.93180971199849}, { 0.54473080610200, -0.11919206037186}, {-0.85639281671058, 0.42429854760451}, {-0.92882402971423, 0.27871809078609}, {-0.11708371046774, -0.99800843444966}, { 0.21356749817493, -0.90716295627033}, {-0.76191692573909, 0.99768118356265}, { 0.98111043100884, -0.95854459734407}, {-0.85913269895572, 0.95766566168880}, {-0.93307242253692, 0.49431757696466}, { 0.30485754879632, -0.70540034357529}, { 0.85289650925190, 0.46766131791044}, { 0.91328082618125, -0.99839597361769}, {-0.05890199924154, 0.70741827819497}, { 0.28398686150148, 0.34633555702188}, { 0.95258164539612, -0.54893416026939}, {-0.78566324168507, -0.75568541079691}, {-0.95789495447877, -0.20423194696966}, { 0.82411158711197, 0.96654618432562}, {-0.65185446735885, -0.88734990773289}, {-0.93643603134666, 0.99870790442385}, { 0.91427159529618, -0.98290505544444}, {-0.70395684036886, 0.58796798221039}, { 0.00563771969365, 0.61768196727244}, { 0.89065051931895, 0.52783352697585}, {-0.68683707712762, 0.80806944710339}, { 0.72165342518718, -0.69259857349564}, {-0.62928247730667, 0.13627037407335}, { 0.29938434065514, -0.46051329682246}, {-0.91781958879280, -0.74012716684186}, { 0.99298717043688, 0.40816610075661}, { 0.82368298622748, -0.74036047190173}, {-0.98512833386833, -0.99972330709594}, {-0.95915368242257, -0.99237800466040}, {-0.21411126572790, -0.93424819052545}, {-0.68821476106884, -0.26892306315457}, { 0.91851997982317, 0.09358228901785}, {-0.96062769559127, 0.36099095133739}, { 0.51646184922287, -0.71373332873917}, { 0.61130721139669, 0.46950141175917}, { 0.47336129371299, -0.27333178296162}, { 0.90998308703519, 0.96715662938132}, { 0.44844799194357, 0.99211574628306}, { 0.66614891079092, 0.96590176169121}, { 0.74922239129237, -0.89879858826087}, {-0.99571588506485, 0.52785521494349}, { 0.97401082477563, -0.16855870075190}, { 0.72683747733879, -0.48060774432251}, { 0.95432193457128, 0.68849603408441}, {-0.72962208425191, -0.76608443420917}, {-0.85359479233537, 0.88738125901579}, {-0.81412430338535, -0.97480768049637}, {-0.87930772356786, 0.74748307690436}, {-0.71573331064977, -0.98570608178923}, { 0.83524300028228, 0.83702537075163}, {-0.48086065601423, -0.98848504923531}, { 0.97139128574778, 0.80093621198236}, { 0.51992825347895, 0.80247631400510}, {-0.00848591195325, -0.76670128000486}, {-0.70294374303036, 0.55359910445577}, {-0.95894428168140, -0.43265504344783}, { 0.97079252950321, 0.09325857238682}, {-0.92404293670797, 0.85507704027855}, {-0.69506469500450, 0.98633412625459}, { 0.26559203620024, 0.73314307966524}, { 0.28038443336943, 0.14537913654427}, {-0.74138124825523, 0.99310339807762}, {-0.01752795995444, -0.82616635284178}, {-0.55126773094930, -0.98898543862153}, { 0.97960898850996, -0.94021446752851}, {-0.99196309146936, 0.67019017358456}, {-0.67684928085260, 0.12631491649378}, { 0.09140039465500, -0.20537731453108}, {-0.71658965751996, -0.97788200391224}, { 0.81014640078925, 0.53722648362443}, { 0.40616991671205, -0.26469008598449}, {-0.67680188682972, 0.94502052337695}, { 0.86849774348749, -0.18333598647899}, {-0.99500381284851, -0.02634122068550}, { 0.84329189340667, 0.10406957462213}, {-0.09215968531446, 0.69540012101253}, { 0.99956173327206, -0.12358542001404}, {-0.79732779473535, -0.91582524736159}, { 0.96349973642406, 0.96640458041000}, {-0.79942778496547, 0.64323902822857}, {-0.11566039853896, 0.28587846253726}, {-0.39922954514662, 0.94129601616966}, { 0.99089197565987, -0.92062625581587}, { 0.28631285179909, -0.91035047143603}, {-0.83302725605608, -0.67330410892084}, { 0.95404443402072, 0.49162765398743}, {-0.06449863579434, 0.03250560813135}, {-0.99575054486311, 0.42389784469507}, {-0.65501142790847, 0.82546114655624}, {-0.81254441908887, -0.51627234660629}, {-0.99646369485481, 0.84490533520752}, { 0.00287840603348, 0.64768261158166}, { 0.70176989408455, -0.20453028573322}, { 0.96361882270190, 0.40706967140989}, {-0.68883758192426, 0.91338958840772}, {-0.34875585502238, 0.71472290693300}, { 0.91980081243087, 0.66507455644919}, {-0.99009048343881, 0.85868021604848}, { 0.68865791458395, 0.55660316809678}, {-0.99484402129368, -0.20052559254934}, { 0.94214511408023, -0.99696425367461}, {-0.67414626793544, 0.49548221180078}, {-0.47339353684664, -0.85904328834047}, { 0.14323651387360, -0.94145598222488}, {-0.29268293575672, 0.05759224927952}, { 0.43793861458754, -0.78904969892724}, {-0.36345126374441, 0.64874435357162}, {-0.08750604656825, 0.97686944362527}, {-0.96495267812511, -0.53960305946511}, { 0.55526940659947, 0.78891523734774}, { 0.73538215752630, 0.96452072373404}, {-0.30889773919437, -0.80664389776860}, { 0.03574995626194, -0.97325616900959}, { 0.98720684660488, 0.48409133691962}, {-0.81689296271203, -0.90827703628298}, { 0.67866860118215, 0.81284503870856}, {-0.15808569732583, 0.85279555024382}, { 0.80723395114371, -0.24717418514605}, { 0.47788757329038, -0.46333147839295}, { 0.96367554763201, 0.38486749303242}, {-0.99143875716818, -0.24945277239809}, { 0.83081876925833, -0.94780851414763}, {-0.58753191905341, 0.01290772389163}, { 0.95538108220960, -0.85557052096538}, {-0.96490920476211, -0.64020970923102}, {-0.97327101028521, 0.12378128133110}, { 0.91400366022124, 0.57972471346930}, {-0.99925837363824, 0.71084847864067}, {-0.86875903507313, -0.20291699203564}, {-0.26240034795124, -0.68264554369108}, {-0.24664412953388, -0.87642273115183}, { 0.02416275806869, 0.27192914288905}, { 0.82068619590515, -0.85087787994476}, { 0.88547373760759, -0.89636802901469}, {-0.18173078152226, -0.26152145156800}, { 0.09355476558534, 0.54845123045604}, {-0.54668414224090, 0.95980774020221}, { 0.37050990604091, -0.59910140383171}, {-0.70373594262891, 0.91227665827081}, {-0.34600785879594, -0.99441426144200}, {-0.68774481731008, -0.30238837956299}, {-0.26843291251234, 0.83115668004362}, { 0.49072334613242, -0.45359708737775}, { 0.38975993093975, 0.95515358099121}, {-0.97757125224150, 0.05305894580606}, {-0.17325552859616, -0.92770672250494}, { 0.99948035025744, 0.58285545563426}, {-0.64946246527458, 0.68645507104960}, {-0.12016920576437, -0.57147322153312}, {-0.58947456517751, -0.34847132454388}, {-0.41815140454465, 0.16276422358861}, { 0.99885650204884, 0.11136095490444}, {-0.56649614128386, -0.90494866361587}, { 0.94138021032330, 0.35281916733018}, {-0.75725076534641, 0.53650549640587}, { 0.20541973692630, -0.94435144369918}, { 0.99980371023351, 0.79835913565599}, { 0.29078277605775, 0.35393777921520}, {-0.62858772103030, 0.38765693387102}, { 0.43440904467688, -0.98546330463232}, {-0.98298583762390, 0.21021524625209}, { 0.19513029146934, -0.94239832251867}, {-0.95476662400101, 0.98364554179143}, { 0.93379635304810, -0.70881994583682}, {-0.85235410573336, -0.08342347966410}, {-0.86425093011245, -0.45795025029466}, { 0.38879779059045, 0.97274429344593}, { 0.92045124735495, -0.62433652524220}, { 0.89162532251878, 0.54950955570563}, {-0.36834336949252, 0.96458298020975}, { 0.93891760988045, -0.89968353740388}, { 0.99267657565094, -0.03757034316958}, {-0.94063471614176, 0.41332338538963}, { 0.99740224117019, -0.16830494996370}, {-0.35899413170555, -0.46633226649613}, { 0.05237237274947, -0.25640361602661}, { 0.36703583957424, -0.38653265641875}, { 0.91653180367913, -0.30587628726597}, { 0.69000803499316, 0.90952171386132}, {-0.38658751133527, 0.99501571208985}, {-0.29250814029851, 0.37444994344615}, {-0.60182204677608, 0.86779651036123}, {-0.97418588163217, 0.96468523666475}, { 0.88461574003963, 0.57508405276414}, { 0.05198933055162, 0.21269661669964}, {-0.53499621979720, 0.97241553731237}, {-0.49429560226497, 0.98183865291903}, {-0.98935142339139, -0.40249159006933}, {-0.98081380091130, -0.72856895534041}, {-0.27338148835532, 0.99950922447209}, { 0.06310802338302, -0.54539587529618}, {-0.20461677199539, -0.14209977628489}, { 0.66223843141647, 0.72528579940326}, {-0.84764345483665, 0.02372316801261}, {-0.89039863483811, 0.88866581484602}, { 0.95903308477986, 0.76744927173873}, { 0.73504123909879, -0.03747203173192}, {-0.31744434966056, -0.36834111883652}, {-0.34110827591623, 0.40211222807691}, { 0.47803883714199, -0.39423219786288}, { 0.98299195879514, 0.01989791390047}, {-0.30963073129751, -0.18076720599336}, { 0.99992588229018, -0.26281872094289}, {-0.93149731080767, -0.98313162570490}, { 0.99923472302773, -0.80142993767554}, {-0.26024169633417, -0.75999759855752}, {-0.35712514743563, 0.19298963768574}, {-0.99899084509530, 0.74645156992493}, { 0.86557171579452, 0.55593866696299}, { 0.33408042438752, 0.86185953874709}, { 0.99010736374716, 0.04602397576623}, {-0.66694269691195, -0.91643611810148}, { 0.64016792079480, 0.15649530836856}, { 0.99570534804836, 0.45844586038111}, {-0.63431466947340, 0.21079116459234}, {-0.07706847005931, -0.89581437101329}, { 0.98590090577724, 0.88241721133981}, { 0.80099335254678, -0.36851896710853}, { 0.78368131392666, 0.45506999802597}, { 0.08707806671691, 0.80938994918745}, {-0.86811883080712, 0.39347308654705}, {-0.39466529740375, -0.66809432114456}, { 0.97875325649683, -0.72467840967746}, {-0.95038560288864, 0.89563219587625}, { 0.17005239424212, 0.54683053962658}, {-0.76910792026848, -0.96226617549298}, { 0.99743281016846, 0.42697157037567}, { 0.95437383549973, 0.97002324109952}, { 0.99578905365569, -0.54106826257356}, { 0.28058259829990, -0.85361420634036}, { 0.85256524470573, -0.64567607735589}, {-0.50608540105128, -0.65846015480300}, {-0.97210735183243, -0.23095213067791}, { 0.95424048234441, -0.99240147091219}, {-0.96926570524023, 0.73775654896574}, { 0.30872163214726, 0.41514960556126}, {-0.24523839572639, 0.63206633394807}, {-0.33813265086024, -0.38661779441897}, {-0.05826828420146, -0.06940774188029}, {-0.22898461455054, 0.97054853316316}, {-0.18509915019881, 0.47565762892084}, {-0.10488238045009, -0.87769947402394}, {-0.71886586182037, 0.78030982480538}, { 0.99793873738654, 0.90041310491497}, { 0.57563307626120, -0.91034337352097}, { 0.28909646383717, 0.96307783970534}, { 0.42188998312520, 0.48148651230437}, { 0.93335049681047, -0.43537023883588}, {-0.97087374418267, 0.86636445711364}, { 0.36722871286923, 0.65291654172961}, {-0.81093025665696, 0.08778370229363}, {-0.26240603062237, -0.92774095379098}, { 0.83996497984604, 0.55839849139647}, {-0.99909615720225, -0.96024605713970}, { 0.74649464155061, 0.12144893606462}, {-0.74774595569805, -0.26898062008959}, { 0.95781667469567, -0.79047927052628}, { 0.95472308713099, -0.08588776019550}, { 0.48708332746299, 0.99999041579432}, { 0.46332038247497, 0.10964126185063}, {-0.76497004940162, 0.89210929242238}, { 0.57397389364339, 0.35289703373760}, { 0.75374316974495, 0.96705214651335}, {-0.59174397685714, -0.89405370422752}, { 0.75087906691890, -0.29612672982396}, {-0.98607857336230, 0.25034911730023}, {-0.40761056640505, -0.90045573444695}, { 0.66929266740477, 0.98629493401748}, {-0.97463695257310, -0.00190223301301}, { 0.90145509409859, 0.99781390365446}, {-0.87259289048043, 0.99233587353666}, {-0.91529461447692, -0.15698707534206}, {-0.03305738840705, -0.37205262859764}, { 0.07223051368337, -0.88805001733626}, { 0.99498012188353, 0.97094358113387}, {-0.74904939500519, 0.99985483641521}, { 0.04585228574211, 0.99812337444082}, {-0.89054954257993, -0.31791913188064}, {-0.83782144651251, 0.97637632547466}, { 0.33454804933804, -0.86231516800408}, {-0.99707579362824, 0.93237990079441}, {-0.22827527843994, 0.18874759397997}, { 0.67248046289143, -0.03646211390569}, {-0.05146538187944, -0.92599700120679}, { 0.99947295749905, 0.93625229707912}, { 0.66951124390363, 0.98905825623893}, {-0.99602956559179, -0.44654715757688}, { 0.82104905483590, 0.99540741724928}, { 0.99186510988782, 0.72023001312947}, {-0.65284592392918, 0.52186723253637}, { 0.93885443798188, -0.74895312615259}, { 0.96735248738388, 0.90891816978629}, {-0.22225968841114, 0.57124029781228}, {-0.44132783753414, -0.92688840659280}, {-0.85694974219574, 0.88844532719844}, { 0.91783042091762, -0.46356892383970}, { 0.72556974415690, -0.99899555770747}, {-0.99711581834508, 0.58211560180426}, { 0.77638976371966, 0.94321834873819}, { 0.07717324253925, 0.58638399856595}, {-0.56049829194163, 0.82522301569036}, { 0.98398893639988, 0.39467440420569}, { 0.47546946844938, 0.68613044836811}, { 0.65675089314631, 0.18331637134880}, { 0.03273375457980, -0.74933109564108}, {-0.38684144784738, 0.51337349030406}, {-0.97346267944545, -0.96549364384098}, {-0.53282156061942, -0.91423265091354}, { 0.99817310731176, 0.61133572482148}, {-0.50254500772635, -0.88829338134294}, { 0.01995873238855, 0.85223515096765}, { 0.99930381973804, 0.94578896296649}, { 0.82907767600783, -0.06323442598128}, {-0.58660709669728, 0.96840773806582}, {-0.17573736667267, -0.48166920859485}, { 0.83434292401346, -0.13023450646997}, { 0.05946491307025, 0.20511047074866}, { 0.81505484574602, -0.94685947861369}, {-0.44976380954860, 0.40894572671545}, {-0.89746474625671, 0.99846578838537}, { 0.39677256130792, -0.74854668609359}, {-0.07588948563079, 0.74096214084170}, { 0.76343198951445, 0.41746629422634}, {-0.74490104699626, 0.94725911744610}, { 0.64880119792759, 0.41336660830571}, { 0.62319537462542, -0.93098313552599}, { 0.42215817594807, -0.07712787385208}, { 0.02704554141885, -0.05417518053666}, { 0.80001773566818, 0.91542195141039}, {-0.79351832348816, -0.36208897989136}, { 0.63872359151636, 0.08128252493444}, { 0.52890520960295, 0.60048872455592}, { 0.74238552914587, 0.04491915291044}, { 0.99096131449250, -0.19451182854402}, {-0.80412329643109, -0.88513818199457}, {-0.64612616129736, 0.72198674804544}, { 0.11657770663191, -0.83662833815041}, {-0.95053182488101, -0.96939905138082}, {-0.62228872928622, 0.82767262846661}, { 0.03004475787316, -0.99738896333384}, {-0.97987214341034, 0.36526129686425}, {-0.99986980746200, -0.36021610299715}, { 0.89110648599879, -0.97894250343044}, { 0.10407960510582, 0.77357793811619}, { 0.95964737821728, -0.35435818285502}, { 0.50843233159162, 0.96107691266205}, { 0.17006334670615, -0.76854025314829}, { 0.25872675063360, 0.99893303933816}, {-0.01115998681937, 0.98496019742444}, {-0.79598702973261, 0.97138411318894}, {-0.99264708948101, -0.99542822402536}, {-0.99829663752818, 0.01877138824311}, {-0.70801016548184, 0.33680685948117}, {-0.70467057786826, 0.93272777501857}, { 0.99846021905254, -0.98725746254433}, {-0.63364968534650, -0.16473594423746}, {-0.16258217500792, -0.95939125400802}, {-0.43645594360633, -0.94805030113284}, {-0.99848471702976, 0.96245166923809}, {-0.16796458968998, -0.98987511890470}, {-0.87979225745213, -0.71725725041680}, { 0.44183099021786, -0.93568974498761}, { 0.93310180125532, -0.99913308068246}, {-0.93941931782002, -0.56409379640356}, {-0.88590003188677, 0.47624600491382}, { 0.99971463703691, -0.83889954253462}, {-0.75376385639978, 0.00814643438625}, { 0.93887685615875, -0.11284528204636}, { 0.85126435782309, 0.52349251543547}, { 0.39701421446381, 0.81779634174316}, {-0.37024464187437, -0.87071656222959}, {-0.36024828242896, 0.34655735648287}, {-0.93388812549209, -0.84476541096429}, {-0.65298804552119, -0.18439575450921}, { 0.11960319006843, 0.99899346780168}, { 0.94292565553160, 0.83163906518293}, { 0.75081145286948, -0.35533223142265}, { 0.56721979748394, -0.24076836414499}, { 0.46857766746029, -0.30140233457198}, { 0.97312313923635, -0.99548191630031}, {-0.38299976567017, 0.98516909715427}, { 0.41025800019463, 0.02116736935734}, { 0.09638062008048, 0.04411984381457}, {-0.85283249275397, 0.91475563922421}, { 0.88866808958124, -0.99735267083226}, {-0.48202429536989, -0.96805608884164}, { 0.27572582416567, 0.58634753335832}, {-0.65889129659168, 0.58835634138583}, { 0.98838086953732, 0.99994349600236}, {-0.20651349620689, 0.54593044066355}, {-0.62126416356920, -0.59893681700392}, { 0.20320105410437, -0.86879180355289}, {-0.97790548600584, 0.96290806999242}, { 0.11112534735126, 0.21484763313301}, {-0.41368337314182, 0.28216837680365}, { 0.24133038992960, 0.51294362630238}, {-0.66393410674885, -0.08249679629081}, {-0.53697829178752, -0.97649903936228}, {-0.97224737889348, 0.22081333579837}, { 0.87392477144549, -0.12796173740361}, { 0.19050361015753, 0.01602615387195}, {-0.46353441212724, -0.95249041539006}, {-0.07064096339021, -0.94479803205886}, {-0.92444085484466, -0.10457590187436}, {-0.83822593578728, -0.01695043208885}, { 0.75214681811150, -0.99955681042665}, {-0.42102998829339, 0.99720941999394}, {-0.72094786237696, -0.35008961934255}, { 0.78843311019251, 0.52851398958271}, { 0.97394027897442, -0.26695944086561}, { 0.99206463477946, -0.57010120849429}, { 0.76789609461795, -0.76519356730966}, {-0.82002421836409, -0.73530179553767}, { 0.81924990025724, 0.99698425250579}, {-0.26719850873357, 0.68903369776193}, {-0.43311260380975, 0.85321815947490}, { 0.99194979673836, 0.91876249766422}, {-0.80692001248487, -0.32627540663214}, { 0.43080003649976, -0.21919095636638}, { 0.67709491937357, -0.95478075822906}, { 0.56151770568316, -0.70693811747778}, { 0.10831862810749, -0.08628837174592}, { 0.91229417540436, -0.65987351408410}, {-0.48972893932274, 0.56289246362686}, {-0.89033658689697, -0.71656563987082}, { 0.65269447475094, 0.65916004833932}, { 0.67439478141121, -0.81684380846796}, {-0.47770832416973, -0.16789556203025}, {-0.99715979260878, -0.93565784007648}, {-0.90889593602546, 0.62034397054380}, {-0.06618622548177, -0.23812217221359}, { 0.99430266919728, 0.18812555317553}, { 0.97686402381843, -0.28664534366620}, { 0.94813650221268, -0.97506640027128}, {-0.95434497492853, -0.79607978501983}, {-0.49104783137150, 0.32895214359663}, { 0.99881175120751, 0.88993983831354}, { 0.50449166760303, -0.85995072408434}, { 0.47162891065108, -0.18680204049569}, {-0.62081581361840, 0.75000676218956}, {-0.43867015250812, 0.99998069244322}, { 0.98630563232075, -0.53578899600662}, {-0.61510362277374, -0.89515019899997}, {-0.03841517601843, -0.69888815681179}, {-0.30102157304644, -0.07667808922205}, { 0.41881284182683, 0.02188098922282}, {-0.86135454941237, 0.98947480909359}, { 0.67226861393788, -0.13494389011014}, {-0.70737398842068, -0.76547349325992}, { 0.94044946687963, 0.09026201157416}, {-0.82386352534327, 0.08924768823676}, {-0.32070666698656, 0.50143421908753}, { 0.57593163224487, -0.98966422921509}, {-0.36326018419965, 0.07440243123228}, { 0.99979044674350, -0.14130287347405}, {-0.92366023326932, -0.97979298068180}, {-0.44607178518598, -0.54233252016394}, { 0.44226800932956, 0.71326756742752}, { 0.03671907158312, 0.63606389366675}, { 0.52175424682195, -0.85396826735705}, {-0.94701139690956, -0.01826348194255}, {-0.98759606946049, 0.82288714303073}, { 0.87434794743625, 0.89399495655433}, {-0.93412041758744, 0.41374052024363}, { 0.96063943315511, 0.93116709541280}, { 0.97534253457837, 0.86150930812689}, { 0.99642466504163, 0.70190043427512}, {-0.94705089665984, -0.29580042814306}, { 0.91599807087376, -0.98147830385781}, }; #endif /* AVCODEC_AACSBRDATA_H */
123linslouis-android-video-cutter
jni/libavcodec/aacsbrdata.h
C
asf20
37,188
/** * @file * VP5 compatible video decoder * * Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVCODEC_VP5DATA_H #define AVCODEC_VP5DATA_H #include <stdint.h> static const uint8_t vp5_coeff_groups[] = { -1, 0, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 1, 2, 2, 3, 3, 4, 3, 4, 4, 4, 3, 3, 3, 3, 3, 4, 3, 3, 3, 4, 4, 4, 4, 4, 3, 3, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, }; static const uint8_t vp5_vmc_pct[2][11] = { { 243, 220, 251, 253, 237, 232, 241, 245, 247, 251, 253 }, { 235, 211, 246, 249, 234, 231, 248, 249, 252, 252, 254 }, }; static const uint8_t vp5_dccv_pct[2][11] = { { 146, 197, 181, 207, 232, 243, 238, 251, 244, 250, 249 }, { 179, 219, 214, 240, 250, 254, 244, 254, 254, 254, 254 }, }; static const uint8_t vp5_ract_pct[3][2][6][11] = { { { { 227, 246, 230, 247, 244, 254, 254, 254, 254, 254, 254 }, { 202, 254, 209, 231, 231, 249, 249, 253, 254, 254, 254 }, { 206, 254, 225, 242, 241, 251, 253, 254, 254, 254, 254 }, { 235, 254, 241, 253, 252, 254, 254, 254, 254, 254, 254 }, { 234, 254, 248, 254, 254, 254, 254, 254, 254, 254, 254 }, { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 } }, { { 240, 254, 248, 254, 254, 254, 254, 254, 254, 254, 254 }, { 238, 254, 240, 253, 254, 254, 254, 254, 254, 254, 254 }, { 244, 254, 251, 254, 254, 254, 254, 254, 254, 254, 254 }, { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 }, { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 }, { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 } } }, { { { 206, 203, 227, 239, 247, 254, 253, 254, 254, 254, 254 }, { 207, 199, 220, 236, 243, 252, 252, 254, 254, 254, 254 }, { 212, 219, 230, 243, 244, 253, 252, 254, 254, 254, 254 }, { 236, 237, 247, 252, 253, 254, 254, 254, 254, 254, 254 }, { 240, 240, 248, 254, 254, 254, 254, 254, 254, 254, 254 }, { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 } }, { { 230, 233, 249, 254, 254, 254, 254, 254, 254, 254, 254 }, { 238, 238, 250, 254, 254, 254, 254, 254, 254, 254, 254 }, { 248, 251, 254, 254, 254, 254, 254, 254, 254, 254, 254 }, { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 }, { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 }, { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 } } }, { { { 225, 239, 227, 231, 244, 253, 243, 254, 254, 253, 254 }, { 232, 234, 224, 228, 242, 249, 242, 252, 251, 251, 254 }, { 235, 249, 238, 240, 251, 254, 249, 254, 253, 253, 254 }, { 249, 253, 251, 250, 254, 254, 254, 254, 254, 254, 254 }, { 251, 250, 249, 254, 254, 254, 254, 254, 254, 254, 254 }, { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 } }, { { 243, 244, 250, 250, 254, 254, 254, 254, 254, 254, 254 }, { 249, 248, 250, 253, 254, 254, 254, 254, 254, 254, 254 }, { 253, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 }, { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 }, { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 }, { 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254 } } }, }; static const int16_t vp5_dccv_lc[5][36][2] = { { {154, 61}, {141, 54}, { 90, 45}, { 54, 34}, { 54, 13}, {128, 109}, {136, 54}, {148, 45}, { 92, 41}, { 54, 33}, { 51, 15}, { 87, 113}, { 87, 44}, { 97, 40}, { 67, 36}, { 46, 29}, { 41, 15}, { 64, 80}, { 59, 33}, { 61, 31}, { 51, 28}, { 44, 22}, { 33, 12}, { 49, 63}, { 69, 12}, { 59, 16}, { 46, 14}, { 31, 13}, { 26, 6}, { 92, 26}, {128, 108}, { 77, 119}, { 54, 84}, { 26, 71}, { 87, 19}, { 95, 155} }, { {154, 4}, {182, 0}, {159, -8}, {128, -5}, {143, -5}, {187, 55}, {182, 0}, {228, -3}, {187, -7}, {174, -9}, {189, -11}, {169, 79}, {161, -9}, {192, -8}, {187, -9}, {169, -10}, {136, -9}, {184, 40}, {164, -11}, {179, -10}, {174, -10}, {161, -10}, {115, -7}, {197, 20}, {195, -11}, {195, -11}, {146, -10}, {110, -6}, { 95, -4}, {195, 39}, {182, 55}, {172, 77}, {177, 37}, {169, 29}, {172, 52}, { 92, 162} }, { {174, 80}, {164, 80}, { 95, 80}, { 46, 66}, { 56, 24}, { 36, 193}, {164, 80}, {166, 77}, {105, 76}, { 49, 68}, { 46, 31}, { 49, 186}, { 97, 78}, {110, 74}, { 72, 72}, { 44, 60}, { 33, 30}, { 69, 131}, { 61, 61}, { 69, 63}, { 51, 57}, { 31, 48}, { 26, 27}, { 64, 89}, { 67, 23}, { 51, 32}, { 36, 33}, { 26, 28}, { 20, 12}, { 44, 68}, { 26, 197}, { 41, 189}, { 61, 129}, { 28, 103}, { 49, 52}, {-12, 245} }, { {102, 141}, { 79, 166}, { 72, 162}, { 97, 125}, {179, 4}, {307, 0}, { 72, 168}, { 69, 175}, { 84, 160}, {105, 127}, {148, 34}, {310, 0}, { 84, 151}, { 82, 161}, { 87, 153}, { 87, 135}, {115, 51}, {317, 0}, { 97, 125}, {102, 131}, {105, 125}, { 87, 122}, { 84, 64}, { 54, 184}, {166, 18}, {146, 43}, {125, 51}, { 90, 64}, { 95, 7}, { 38, 154}, {294, 0}, { 13, 225}, { 10, 225}, { 67, 168}, { 0, 167}, {161, 94} }, { {172, 76}, {172, 75}, {136, 80}, { 64, 98}, { 74, 67}, {315, 0}, {169, 76}, {207, 56}, {164, 66}, { 97, 80}, { 67, 72}, {328, 0}, {136, 80}, {187, 53}, {154, 62}, { 72, 85}, { -2, 105}, {305, 0}, { 74, 91}, {128, 64}, {113, 64}, { 61, 77}, { 41, 75}, {259, 0}, { 46, 84}, { 51, 81}, { 28, 89}, { 31, 78}, { 23, 77}, {202, 0}, {323, 0}, {323, 0}, {300, 0}, {236, 0}, {195, 0}, {328, 0} }, }; static const int16_t vp5_ract_lc[3][3][5][6][2] = { { { { {276, 0}, {238, 0}, {195, 0}, {156, 0}, {113, 0}, {274, 0} }, { { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1} }, { {192, 59}, {182, 50}, {141, 48}, {110, 40}, { 92, 19}, {125,128} }, { {169, 87}, {169, 83}, {184, 62}, {220, 16}, {184, 0}, {264, 0} }, { {212, 40}, {212, 36}, {169, 49}, {174, 27}, { 8,120}, {182, 71} } }, { { {259, 10}, {197, 19}, {143, 22}, {123, 16}, {110, 8}, {133, 88} }, { { 0, 1}, {256, 0}, { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1} }, { {207, 46}, {187, 50}, { 97, 83}, { 23,100}, { 41, 56}, { 56,188} }, { {166, 90}, {146,108}, {161, 88}, {136, 95}, {174, 0}, {266, 0} }, { {264, 7}, {243, 18}, {184, 43}, {-14,154}, { 20,112}, { 20,199} } }, { { {230, 26}, {197, 22}, {159, 20}, {146, 12}, {136, 4}, { 54,162} }, { { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1}, { 0, 1} }, { {192, 59}, {156, 72}, { 84,101}, { 49,101}, { 79, 47}, { 79,167} }, { {138,115}, {136,116}, {166, 80}, {238, 0}, {195, 0}, {261, 0} }, { {225, 33}, {205, 42}, {159, 61}, { 79, 96}, { 92, 66}, { 28,195} } }, }, { { { {200, 37}, {197, 18}, {159, 13}, {143, 7}, {102, 5}, {123,126} }, { {197, 3}, {220, -9}, {210,-12}, {187, -6}, {151, -2}, {174, 80} }, { {200, 53}, {187, 47}, {159, 40}, {118, 38}, {100, 18}, {141,111} }, { {179, 78}, {166, 86}, {197, 50}, {207, 27}, {187, 0}, {115,139} }, { {218, 34}, {220, 29}, {174, 46}, {128, 61}, { 54, 89}, {187, 65} } }, { { {238, 14}, {197, 18}, {125, 26}, { 90, 25}, { 82, 13}, {161, 86} }, { {189, 1}, {205, -2}, {156, -4}, {143, -4}, {146, -4}, {172, 72} }, { {230, 31}, {192, 45}, {102, 76}, { 38, 85}, { 56, 41}, { 64,173} }, { {166, 91}, {141,111}, {128,116}, {118,109}, {177, 0}, { 23,222} }, { {253, 14}, {236, 21}, {174, 49}, { 33,118}, { 44, 93}, { 23,187} } }, { { {218, 28}, {179, 28}, {118, 35}, { 95, 30}, { 72, 24}, {128,108} }, { {187, 1}, {174, -1}, {125, -1}, {110, -1}, {108, -1}, {202, 52} }, { {197, 53}, {146, 75}, { 46,118}, { 33,103}, { 64, 50}, {118,126} }, { {138,114}, {128,122}, {161, 86}, {243, -6}, {195, 0}, { 38,210} }, { {215, 39}, {179, 58}, { 97,101}, { 95, 85}, { 87, 70}, { 69,152} } }, }, { { { {236, 24}, {205, 18}, {172, 12}, {154, 6}, {125, 1}, {169, 75} }, { {187, 4}, {230, -2}, {228, -4}, {236, -4}, {241, -2}, {192, 66} }, { {200, 46}, {187, 42}, {159, 34}, {136, 25}, {105, 10}, {179, 62} }, { {207, 55}, {192, 63}, {192, 54}, {195, 36}, {177, 1}, {143, 98} }, { {225, 27}, {207, 34}, {200, 30}, {131, 57}, { 97, 60}, {197, 45} } }, { { {271, 8}, {218, 13}, {133, 19}, { 90, 19}, { 72, 7}, {182, 51} }, { {179, 1}, {225, -1}, {154, -2}, {110, -1}, { 92, 0}, {195, 41} }, { {241, 26}, {189, 40}, { 82, 64}, { 33, 60}, { 67, 17}, {120, 94} }, { {192, 68}, {151, 94}, {146, 90}, {143, 72}, {161, 0}, {113,128} }, { {256, 12}, {218, 29}, {166, 48}, { 44, 99}, { 31, 87}, {148, 78} } }, { { {238, 20}, {184, 22}, {113, 27}, { 90, 22}, { 74, 9}, {192, 37} }, { {184, 0}, {215, -1}, {141, -1}, { 97, 0}, { 49, 0}, {264, 13} }, { {182, 51}, {138, 61}, { 95, 63}, { 54, 59}, { 64, 25}, {200, 45} }, { {179, 75}, {156, 87}, {174, 65}, {177, 44}, {174, 0}, {164, 85} }, { {195, 45}, {148, 65}, {105, 79}, { 95, 72}, { 87, 60}, {169, 63} } }, } }; static const uint8_t vp5_coord_div[] = { 2, 2, 2, 2, 4, 4 }; #endif /* AVCODEC_VP5DATA_H */
123linslouis-android-video-cutter
jni/libavcodec/vp5data.h
C
asf20
10,160
/* * Raw Video Encoder * Copyright (c) 2001 Fabrice Bellard * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * Raw Video Encoder */ #include "avcodec.h" #include "raw.h" #include "libavutil/pixdesc.h" #include "libavutil/intreadwrite.h" static av_cold int raw_init_encoder(AVCodecContext *avctx) { avctx->coded_frame = (AVFrame *)avctx->priv_data; avctx->coded_frame->pict_type = FF_I_TYPE; avctx->coded_frame->key_frame = 1; avctx->bits_per_coded_sample = av_get_bits_per_pixel(&av_pix_fmt_descriptors[avctx->pix_fmt]); if(!avctx->codec_tag) avctx->codec_tag = avcodec_pix_fmt_to_codec_tag(avctx->pix_fmt); return 0; } static int raw_encode(AVCodecContext *avctx, unsigned char *frame, int buf_size, void *data) { int ret = avpicture_layout((AVPicture *)data, avctx->pix_fmt, avctx->width, avctx->height, frame, buf_size); if(avctx->codec_tag == AV_RL32("yuv2") && ret > 0 && avctx->pix_fmt == PIX_FMT_YUYV422) { int x; for(x = 1; x < avctx->height*avctx->width*2; x += 2) frame[x] ^= 0x80; } return ret; } AVCodec rawvideo_encoder = { "rawvideo", AVMEDIA_TYPE_VIDEO, CODEC_ID_RAWVIDEO, sizeof(AVFrame), raw_init_encoder, raw_encode, .long_name = NULL_IF_CONFIG_SMALL("raw video"), };
123linslouis-android-video-cutter
jni/libavcodec/rawenc.c
C
asf20
2,111
/* * Aura 2 decoder * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * Aura 2 decoder */ #include "avcodec.h" typedef struct AuraDecodeContext { AVCodecContext *avctx; AVFrame frame; } AuraDecodeContext; static av_cold int aura_decode_init(AVCodecContext *avctx) { AuraDecodeContext *s = avctx->priv_data; s->avctx = avctx; /* width needs to be divisible by 4 for this codec to work */ if (avctx->width & 0x3) return -1; avctx->pix_fmt = PIX_FMT_YUV422P; return 0; } static int aura_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *pkt) { AuraDecodeContext *s=avctx->priv_data; uint8_t *Y, *U, *V; uint8_t val; int x, y; const uint8_t *buf = pkt->data; /* prediction error tables (make it clear that they are signed values) */ const int8_t *delta_table = (const int8_t*)buf + 16; if (pkt->size != 48 + avctx->height * avctx->width) { av_log(avctx, AV_LOG_ERROR, "got a buffer with %d bytes when %d were expected\n", pkt->size, 48 + avctx->height * avctx->width); return -1; } /* pixel data starts 48 bytes in, after 3x16-byte tables */ buf += 48; if(s->frame.data[0]) avctx->release_buffer(avctx, &s->frame); s->frame.buffer_hints = FF_BUFFER_HINTS_VALID; s->frame.reference = 0; if(avctx->get_buffer(avctx, &s->frame) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } Y = s->frame.data[0]; U = s->frame.data[1]; V = s->frame.data[2]; /* iterate through each line in the height */ for (y = 0; y < avctx->height; y++) { /* reset predictors */ val = *buf++; U[0] = val & 0xF0; Y[0] = val << 4; val = *buf++; V[0] = val & 0xF0; Y[1] = Y[0] + delta_table[val & 0xF]; Y += 2; U++; V++; /* iterate through the remaining pixel groups (4 pixels/group) */ for (x = 1; x < (avctx->width >> 1); x++) { val = *buf++; U[0] = U[-1] + delta_table[val >> 4]; Y[0] = Y[-1] + delta_table[val & 0xF]; val = *buf++; V[0] = V[-1] + delta_table[val >> 4]; Y[1] = Y[ 0] + delta_table[val & 0xF]; Y += 2; U++; V++; } Y += s->frame.linesize[0] - avctx->width; U += s->frame.linesize[1] - (avctx->width >> 1); V += s->frame.linesize[2] - (avctx->width >> 1); } *data_size=sizeof(AVFrame); *(AVFrame*)data= s->frame; return pkt->size; } static av_cold int aura_decode_end(AVCodecContext *avctx) { AuraDecodeContext *s = avctx->priv_data; if (s->frame.data[0]) avctx->release_buffer(avctx, &s->frame); return 0; } AVCodec aura2_decoder = { "aura2", AVMEDIA_TYPE_VIDEO, CODEC_ID_AURA2, sizeof(AuraDecodeContext), aura_decode_init, NULL, aura_decode_end, aura_decode_frame, CODEC_CAP_DR1, NULL, .long_name = NULL_IF_CONFIG_SMALL("Auravision Aura 2"), };
123linslouis-android-video-cutter
jni/libavcodec/aura.c
C
asf20
3,840
/* * The simplest mpeg encoder (well, it was the simplest!) * Copyright (c) 2000,2001 Fabrice Bellard * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> * * 4MV & hq & B-frame encoding stuff by Michael Niedermayer <michaelni@gmx.at> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * The simplest mpeg encoder (well, it was the simplest!). */ #include "libavutil/intmath.h" #include "avcodec.h" #include "dsputil.h" #include "mpegvideo.h" #include "mpegvideo_common.h" #include "mjpegenc.h" #include "msmpeg4.h" #include "faandct.h" #include "xvmc_internal.h" #include <limits.h> //#undef NDEBUG //#include <assert.h> static void dct_unquantize_mpeg1_intra_c(MpegEncContext *s, DCTELEM *block, int n, int qscale); static void dct_unquantize_mpeg1_inter_c(MpegEncContext *s, DCTELEM *block, int n, int qscale); static void dct_unquantize_mpeg2_intra_c(MpegEncContext *s, DCTELEM *block, int n, int qscale); static void dct_unquantize_mpeg2_intra_bitexact(MpegEncContext *s, DCTELEM *block, int n, int qscale); static void dct_unquantize_mpeg2_inter_c(MpegEncContext *s, DCTELEM *block, int n, int qscale); static void dct_unquantize_h263_intra_c(MpegEncContext *s, DCTELEM *block, int n, int qscale); static void dct_unquantize_h263_inter_c(MpegEncContext *s, DCTELEM *block, int n, int qscale); /* enable all paranoid tests for rounding, overflows, etc... */ //#define PARANOID //#define DEBUG static const uint8_t ff_default_chroma_qscale_table[32]={ // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 }; const uint8_t ff_mpeg1_dc_scale_table[128]={ // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; static const uint8_t mpeg2_dc_scale_table1[128]={ // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, }; static const uint8_t mpeg2_dc_scale_table2[128]={ // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, }; static const uint8_t mpeg2_dc_scale_table3[128]={ // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; const uint8_t * const ff_mpeg2_dc_scale_table[4]={ ff_mpeg1_dc_scale_table, mpeg2_dc_scale_table1, mpeg2_dc_scale_table2, mpeg2_dc_scale_table3, }; const enum PixelFormat ff_pixfmt_list_420[] = { PIX_FMT_YUV420P, PIX_FMT_NONE }; const enum PixelFormat ff_hwaccel_pixfmt_list_420[] = { PIX_FMT_DXVA2_VLD, PIX_FMT_VAAPI_VLD, PIX_FMT_YUV420P, PIX_FMT_NONE }; const uint8_t *ff_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state){ int i; assert(p<=end); if(p>=end) return end; for(i=0; i<3; i++){ uint32_t tmp= *state << 8; *state= tmp + *(p++); if(tmp == 0x100 || p==end) return p; } while(p<end){ if (p[-1] > 1 ) p+= 3; else if(p[-2] ) p+= 2; else if(p[-3]|(p[-1]-1)) p++; else{ p++; break; } } p= FFMIN(p, end)-4; *state= AV_RB32(p); return p+4; } /* init common dct for both encoder and decoder */ av_cold int ff_dct_common_init(MpegEncContext *s) { s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_c; s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_c; s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_c; s->dct_unquantize_mpeg1_inter = dct_unquantize_mpeg1_inter_c; s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_c; if(s->flags & CODEC_FLAG_BITEXACT) s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_bitexact; s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_c; #if HAVE_MMX MPV_common_init_mmx(s); #elif ARCH_ALPHA MPV_common_init_axp(s); #elif CONFIG_MLIB MPV_common_init_mlib(s); #elif HAVE_MMI MPV_common_init_mmi(s); #elif ARCH_ARM MPV_common_init_arm(s); #elif HAVE_ALTIVEC MPV_common_init_altivec(s); #elif ARCH_BFIN MPV_common_init_bfin(s); #endif /* load & permutate scantables note: only wmv uses different ones */ if(s->alternate_scan){ ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable , ff_alternate_vertical_scan); ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable , ff_alternate_vertical_scan); }else{ ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable , ff_zigzag_direct); ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable , ff_zigzag_direct); } ff_init_scantable(s->dsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan); ff_init_scantable(s->dsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan); return 0; } void ff_copy_picture(Picture *dst, Picture *src){ *dst = *src; dst->type= FF_BUFFER_TYPE_COPY; } /** * Releases a frame buffer */ static void free_frame_buffer(MpegEncContext *s, Picture *pic) { s->avctx->release_buffer(s->avctx, (AVFrame*)pic); av_freep(&pic->hwaccel_picture_private); } /** * Allocates a frame buffer */ static int alloc_frame_buffer(MpegEncContext *s, Picture *pic) { int r; if (s->avctx->hwaccel) { assert(!pic->hwaccel_picture_private); if (s->avctx->hwaccel->priv_data_size) { pic->hwaccel_picture_private = av_mallocz(s->avctx->hwaccel->priv_data_size); if (!pic->hwaccel_picture_private) { av_log(s->avctx, AV_LOG_ERROR, "alloc_frame_buffer() failed (hwaccel private data allocation)\n"); return -1; } } } r = s->avctx->get_buffer(s->avctx, (AVFrame*)pic); if (r<0 || !pic->age || !pic->type || !pic->data[0]) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %d %d %p)\n", r, pic->age, pic->type, pic->data[0]); av_freep(&pic->hwaccel_picture_private); return -1; } if (s->linesize && (s->linesize != pic->linesize[0] || s->uvlinesize != pic->linesize[1])) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (stride changed)\n"); free_frame_buffer(s, pic); return -1; } if (pic->linesize[1] != pic->linesize[2]) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (uv stride mismatch)\n"); free_frame_buffer(s, pic); return -1; } return 0; } /** * allocates a Picture * The pixels are allocated/set by calling get_buffer() if shared=0 */ int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared){ const int big_mb_num= s->mb_stride*(s->mb_height+1) + 1; //the +1 is needed so memset(,,stride*height) does not sig11 const int mb_array_size= s->mb_stride*s->mb_height; const int b8_array_size= s->b8_stride*s->mb_height*2; const int b4_array_size= s->b4_stride*s->mb_height*4; int i; int r= -1; if(shared){ assert(pic->data[0]); assert(pic->type == 0 || pic->type == FF_BUFFER_TYPE_SHARED); pic->type= FF_BUFFER_TYPE_SHARED; }else{ assert(!pic->data[0]); if (alloc_frame_buffer(s, pic) < 0) return -1; s->linesize = pic->linesize[0]; s->uvlinesize= pic->linesize[1]; } if(pic->qscale_table==NULL){ if (s->encoding) { FF_ALLOCZ_OR_GOTO(s->avctx, pic->mb_var , mb_array_size * sizeof(int16_t) , fail) FF_ALLOCZ_OR_GOTO(s->avctx, pic->mc_mb_var, mb_array_size * sizeof(int16_t) , fail) FF_ALLOCZ_OR_GOTO(s->avctx, pic->mb_mean , mb_array_size * sizeof(int8_t ) , fail) } FF_ALLOCZ_OR_GOTO(s->avctx, pic->mbskip_table , mb_array_size * sizeof(uint8_t)+2, fail) //the +2 is for the slice end check FF_ALLOCZ_OR_GOTO(s->avctx, pic->qscale_table , mb_array_size * sizeof(uint8_t) , fail) FF_ALLOCZ_OR_GOTO(s->avctx, pic->mb_type_base , (big_mb_num + s->mb_stride) * sizeof(uint32_t), fail) pic->mb_type= pic->mb_type_base + 2*s->mb_stride+1; if(s->out_format == FMT_H264){ for(i=0; i<2; i++){ FF_ALLOCZ_OR_GOTO(s->avctx, pic->motion_val_base[i], 2 * (b4_array_size+4) * sizeof(int16_t), fail) pic->motion_val[i]= pic->motion_val_base[i]+4; FF_ALLOCZ_OR_GOTO(s->avctx, pic->ref_index[i], 4*mb_array_size * sizeof(uint8_t), fail) } pic->motion_subsample_log2= 2; }else if(s->out_format == FMT_H263 || s->encoding || (s->avctx->debug&FF_DEBUG_MV) || (s->avctx->debug_mv)){ for(i=0; i<2; i++){ FF_ALLOCZ_OR_GOTO(s->avctx, pic->motion_val_base[i], 2 * (b8_array_size+4) * sizeof(int16_t), fail) pic->motion_val[i]= pic->motion_val_base[i]+4; FF_ALLOCZ_OR_GOTO(s->avctx, pic->ref_index[i], 4*mb_array_size * sizeof(uint8_t), fail) } pic->motion_subsample_log2= 3; } if(s->avctx->debug&FF_DEBUG_DCT_COEFF) { FF_ALLOCZ_OR_GOTO(s->avctx, pic->dct_coeff, 64 * mb_array_size * sizeof(DCTELEM)*6, fail) } pic->qstride= s->mb_stride; FF_ALLOCZ_OR_GOTO(s->avctx, pic->pan_scan , 1 * sizeof(AVPanScan), fail) } /* It might be nicer if the application would keep track of these * but it would require an API change. */ memmove(s->prev_pict_types+1, s->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE-1); s->prev_pict_types[0]= s->dropable ? FF_B_TYPE : s->pict_type; if(pic->age < PREV_PICT_TYPES_BUFFER_SIZE && s->prev_pict_types[pic->age] == FF_B_TYPE) pic->age= INT_MAX; // Skipped MBs in B-frames are quite rare in MPEG-1/2 and it is a bit tricky to skip them anyway. return 0; fail: //for the FF_ALLOCZ_OR_GOTO macro if(r>=0) free_frame_buffer(s, pic); return -1; } /** * deallocates a picture */ static void free_picture(MpegEncContext *s, Picture *pic){ int i; if(pic->data[0] && pic->type!=FF_BUFFER_TYPE_SHARED){ free_frame_buffer(s, pic); } av_freep(&pic->mb_var); av_freep(&pic->mc_mb_var); av_freep(&pic->mb_mean); av_freep(&pic->mbskip_table); av_freep(&pic->qscale_table); av_freep(&pic->mb_type_base); av_freep(&pic->dct_coeff); av_freep(&pic->pan_scan); pic->mb_type= NULL; for(i=0; i<2; i++){ av_freep(&pic->motion_val_base[i]); av_freep(&pic->ref_index[i]); } if(pic->type == FF_BUFFER_TYPE_SHARED){ for(i=0; i<4; i++){ pic->base[i]= pic->data[i]= NULL; } pic->type= 0; } } static int init_duplicate_context(MpegEncContext *s, MpegEncContext *base){ int i; // edge emu needs blocksize + filter length - 1 (=17x17 for halfpel / 21x21 for h264) FF_ALLOCZ_OR_GOTO(s->avctx, s->allocated_edge_emu_buffer, (s->width+64)*2*21*2, fail); //(width + edge + align)*interlaced*MBsize*tolerance s->edge_emu_buffer= s->allocated_edge_emu_buffer + (s->width+64)*2*21; //FIXME should be linesize instead of s->width*2 but that is not known before get_buffer() FF_ALLOCZ_OR_GOTO(s->avctx, s->me.scratchpad, (s->width+64)*4*16*2*sizeof(uint8_t), fail) s->me.temp= s->me.scratchpad; s->rd_scratchpad= s->me.scratchpad; s->b_scratchpad= s->me.scratchpad; s->obmc_scratchpad= s->me.scratchpad + 16; if (s->encoding) { FF_ALLOCZ_OR_GOTO(s->avctx, s->me.map , ME_MAP_SIZE*sizeof(uint32_t), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->me.score_map, ME_MAP_SIZE*sizeof(uint32_t), fail) if(s->avctx->noise_reduction){ FF_ALLOCZ_OR_GOTO(s->avctx, s->dct_error_sum, 2 * 64 * sizeof(int), fail) } } FF_ALLOCZ_OR_GOTO(s->avctx, s->blocks, 64*12*2 * sizeof(DCTELEM), fail) s->block= s->blocks[0]; for(i=0;i<12;i++){ s->pblocks[i] = &s->block[i]; } return 0; fail: return -1; //free() through MPV_common_end() } static void free_duplicate_context(MpegEncContext *s){ if(s==NULL) return; av_freep(&s->allocated_edge_emu_buffer); s->edge_emu_buffer= NULL; av_freep(&s->me.scratchpad); s->me.temp= s->rd_scratchpad= s->b_scratchpad= s->obmc_scratchpad= NULL; av_freep(&s->dct_error_sum); av_freep(&s->me.map); av_freep(&s->me.score_map); av_freep(&s->blocks); s->block= NULL; } static void backup_duplicate_context(MpegEncContext *bak, MpegEncContext *src){ #define COPY(a) bak->a= src->a COPY(allocated_edge_emu_buffer); COPY(edge_emu_buffer); COPY(me.scratchpad); COPY(me.temp); COPY(rd_scratchpad); COPY(b_scratchpad); COPY(obmc_scratchpad); COPY(me.map); COPY(me.score_map); COPY(blocks); COPY(block); COPY(start_mb_y); COPY(end_mb_y); COPY(me.map_generation); COPY(pb); COPY(dct_error_sum); COPY(dct_count[0]); COPY(dct_count[1]); #undef COPY } void ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src){ MpegEncContext bak; int i; //FIXME copy only needed parts //START_TIMER backup_duplicate_context(&bak, dst); memcpy(dst, src, sizeof(MpegEncContext)); backup_duplicate_context(dst, &bak); for(i=0;i<12;i++){ dst->pblocks[i] = &dst->block[i]; } //STOP_TIMER("update_duplicate_context") //about 10k cycles / 0.01 sec for 1000frames on 1ghz with 2 threads } /** * sets the given MpegEncContext to common defaults (same for encoding and decoding). * the changed fields will not depend upon the prior state of the MpegEncContext. */ void MPV_common_defaults(MpegEncContext *s){ s->y_dc_scale_table= s->c_dc_scale_table= ff_mpeg1_dc_scale_table; s->chroma_qscale_table= ff_default_chroma_qscale_table; s->progressive_frame= 1; s->progressive_sequence= 1; s->picture_structure= PICT_FRAME; s->coded_picture_number = 0; s->picture_number = 0; s->input_picture_number = 0; s->picture_in_gop_number = 0; s->f_code = 1; s->b_code = 1; } /** * sets the given MpegEncContext to defaults for decoding. * the changed fields will not depend upon the prior state of the MpegEncContext. */ void MPV_decode_defaults(MpegEncContext *s){ MPV_common_defaults(s); } /** * init common structure for both encoder and decoder. * this assumes that some variables like width/height are already set */ av_cold int MPV_common_init(MpegEncContext *s) { int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y, threads; if(s->codec_id == CODEC_ID_MPEG2VIDEO && !s->progressive_sequence) s->mb_height = (s->height + 31) / 32 * 2; else s->mb_height = (s->height + 15) / 16; if(s->avctx->pix_fmt == PIX_FMT_NONE){ av_log(s->avctx, AV_LOG_ERROR, "decoding to PIX_FMT_NONE is not supported.\n"); return -1; } if(s->avctx->thread_count > MAX_THREADS || (s->avctx->thread_count > s->mb_height && s->mb_height)){ av_log(s->avctx, AV_LOG_ERROR, "too many threads\n"); return -1; } if((s->width || s->height) && avcodec_check_dimensions(s->avctx, s->width, s->height)) return -1; dsputil_init(&s->dsp, s->avctx); ff_dct_common_init(s); s->flags= s->avctx->flags; s->flags2= s->avctx->flags2; s->mb_width = (s->width + 15) / 16; s->mb_stride = s->mb_width + 1; s->b8_stride = s->mb_width*2 + 1; s->b4_stride = s->mb_width*4 + 1; mb_array_size= s->mb_height * s->mb_stride; mv_table_size= (s->mb_height+2) * s->mb_stride + 1; /* set chroma shifts */ avcodec_get_chroma_sub_sample(s->avctx->pix_fmt,&(s->chroma_x_shift), &(s->chroma_y_shift) ); /* set default edge pos, will be overriden in decode_header if needed */ s->h_edge_pos= s->mb_width*16; s->v_edge_pos= s->mb_height*16; s->mb_num = s->mb_width * s->mb_height; s->block_wrap[0]= s->block_wrap[1]= s->block_wrap[2]= s->block_wrap[3]= s->b8_stride; s->block_wrap[4]= s->block_wrap[5]= s->mb_stride; y_size = s->b8_stride * (2 * s->mb_height + 1); c_size = s->mb_stride * (s->mb_height + 1); yc_size = y_size + 2 * c_size; /* convert fourcc to upper case */ s->codec_tag= toupper( s->avctx->codec_tag &0xFF) + (toupper((s->avctx->codec_tag>>8 )&0xFF)<<8 ) + (toupper((s->avctx->codec_tag>>16)&0xFF)<<16) + (toupper((s->avctx->codec_tag>>24)&0xFF)<<24); s->stream_codec_tag= toupper( s->avctx->stream_codec_tag &0xFF) + (toupper((s->avctx->stream_codec_tag>>8 )&0xFF)<<8 ) + (toupper((s->avctx->stream_codec_tag>>16)&0xFF)<<16) + (toupper((s->avctx->stream_codec_tag>>24)&0xFF)<<24); s->avctx->coded_frame= (AVFrame*)&s->current_picture; FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num+1)*sizeof(int), fail) //error ressilience code looks cleaner with this for(y=0; y<s->mb_height; y++){ for(x=0; x<s->mb_width; x++){ s->mb_index2xy[ x + y*s->mb_width ] = x + y*s->mb_stride; } } s->mb_index2xy[ s->mb_height*s->mb_width ] = (s->mb_height-1)*s->mb_stride + s->mb_width; //FIXME really needed? if (s->encoding) { /* Allocate MV tables */ FF_ALLOCZ_OR_GOTO(s->avctx, s->p_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->b_forw_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->b_back_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_forw_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_back_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->b_direct_mv_table_base , mv_table_size * 2 * sizeof(int16_t), fail) s->p_mv_table = s->p_mv_table_base + s->mb_stride + 1; s->b_forw_mv_table = s->b_forw_mv_table_base + s->mb_stride + 1; s->b_back_mv_table = s->b_back_mv_table_base + s->mb_stride + 1; s->b_bidir_forw_mv_table= s->b_bidir_forw_mv_table_base + s->mb_stride + 1; s->b_bidir_back_mv_table= s->b_bidir_back_mv_table_base + s->mb_stride + 1; s->b_direct_mv_table = s->b_direct_mv_table_base + s->mb_stride + 1; if(s->msmpeg4_version){ FF_ALLOCZ_OR_GOTO(s->avctx, s->ac_stats, 2*2*(MAX_LEVEL+1)*(MAX_RUN+1)*2*sizeof(int), fail); } FF_ALLOCZ_OR_GOTO(s->avctx, s->avctx->stats_out, 256, fail); /* Allocate MB type table */ FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_type , mb_array_size * sizeof(uint16_t), fail) //needed for encoding FF_ALLOCZ_OR_GOTO(s->avctx, s->lambda_table, mb_array_size * sizeof(int), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->q_intra_matrix , 64*32 * sizeof(int), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->q_inter_matrix , 64*32 * sizeof(int), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->q_intra_matrix16, 64*32*2 * sizeof(uint16_t), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->q_inter_matrix16, 64*32*2 * sizeof(uint16_t), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->input_picture, MAX_PICTURE_COUNT * sizeof(Picture*), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->reordered_input_picture, MAX_PICTURE_COUNT * sizeof(Picture*), fail) if(s->avctx->noise_reduction){ FF_ALLOCZ_OR_GOTO(s->avctx, s->dct_offset, 2 * 64 * sizeof(uint16_t), fail) } } FF_ALLOCZ_OR_GOTO(s->avctx, s->picture, MAX_PICTURE_COUNT * sizeof(Picture), fail) for(i = 0; i < MAX_PICTURE_COUNT; i++) { avcodec_get_frame_defaults((AVFrame *)&s->picture[i]); } FF_ALLOCZ_OR_GOTO(s->avctx, s->error_status_table, mb_array_size*sizeof(uint8_t), fail) if(s->codec_id==CODEC_ID_MPEG4 || (s->flags & CODEC_FLAG_INTERLACED_ME)){ /* interlaced direct mode decoding tables */ for(i=0; i<2; i++){ int j, k; for(j=0; j<2; j++){ for(k=0; k<2; k++){ FF_ALLOCZ_OR_GOTO(s->avctx, s->b_field_mv_table_base[i][j][k], mv_table_size * 2 * sizeof(int16_t), fail) s->b_field_mv_table[i][j][k] = s->b_field_mv_table_base[i][j][k] + s->mb_stride + 1; } FF_ALLOCZ_OR_GOTO(s->avctx, s->b_field_select_table [i][j], mb_array_size * 2 * sizeof(uint8_t), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_mv_table_base[i][j], mv_table_size * 2 * sizeof(int16_t), fail) s->p_field_mv_table[i][j] = s->p_field_mv_table_base[i][j]+ s->mb_stride + 1; } FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_select_table[i], mb_array_size * 2 * sizeof(uint8_t), fail) } } if (s->out_format == FMT_H263) { /* ac values */ FF_ALLOCZ_OR_GOTO(s->avctx, s->ac_val_base, yc_size * sizeof(int16_t) * 16, fail); s->ac_val[0] = s->ac_val_base + s->b8_stride + 1; s->ac_val[1] = s->ac_val_base + y_size + s->mb_stride + 1; s->ac_val[2] = s->ac_val[1] + c_size; /* cbp values */ FF_ALLOCZ_OR_GOTO(s->avctx, s->coded_block_base, y_size, fail); s->coded_block= s->coded_block_base + s->b8_stride + 1; /* cbp, ac_pred, pred_dir */ FF_ALLOCZ_OR_GOTO(s->avctx, s->cbp_table , mb_array_size * sizeof(uint8_t), fail) FF_ALLOCZ_OR_GOTO(s->avctx, s->pred_dir_table, mb_array_size * sizeof(uint8_t), fail) } if (s->h263_pred || s->h263_plus || !s->encoding) { /* dc values */ //MN: we need these for error resilience of intra-frames FF_ALLOCZ_OR_GOTO(s->avctx, s->dc_val_base, yc_size * sizeof(int16_t), fail); s->dc_val[0] = s->dc_val_base + s->b8_stride + 1; s->dc_val[1] = s->dc_val_base + y_size + s->mb_stride + 1; s->dc_val[2] = s->dc_val[1] + c_size; for(i=0;i<yc_size;i++) s->dc_val_base[i] = 1024; } /* which mb is a intra block */ FF_ALLOCZ_OR_GOTO(s->avctx, s->mbintra_table, mb_array_size, fail); memset(s->mbintra_table, 1, mb_array_size); /* init macroblock skip table */ FF_ALLOCZ_OR_GOTO(s->avctx, s->mbskip_table, mb_array_size+2, fail); //Note the +1 is for a quicker mpeg4 slice_end detection FF_ALLOCZ_OR_GOTO(s->avctx, s->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE, fail); s->parse_context.state= -1; if((s->avctx->debug&(FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) || (s->avctx->debug_mv)){ s->visualization_buffer[0] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH); s->visualization_buffer[1] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH); s->visualization_buffer[2] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH); } s->context_initialized = 1; s->thread_context[0]= s; threads = s->avctx->thread_count; for(i=1; i<threads; i++){ s->thread_context[i]= av_malloc(sizeof(MpegEncContext)); memcpy(s->thread_context[i], s, sizeof(MpegEncContext)); } for(i=0; i<threads; i++){ if(init_duplicate_context(s->thread_context[i], s) < 0) goto fail; s->thread_context[i]->start_mb_y= (s->mb_height*(i ) + s->avctx->thread_count/2) / s->avctx->thread_count; s->thread_context[i]->end_mb_y = (s->mb_height*(i+1) + s->avctx->thread_count/2) / s->avctx->thread_count; } return 0; fail: MPV_common_end(s); return -1; } /* init common structure for both encoder and decoder */ void MPV_common_end(MpegEncContext *s) { int i, j, k; for(i=0; i<s->avctx->thread_count; i++){ free_duplicate_context(s->thread_context[i]); } for(i=1; i<s->avctx->thread_count; i++){ av_freep(&s->thread_context[i]); } av_freep(&s->parse_context.buffer); s->parse_context.buffer_size=0; av_freep(&s->mb_type); av_freep(&s->p_mv_table_base); av_freep(&s->b_forw_mv_table_base); av_freep(&s->b_back_mv_table_base); av_freep(&s->b_bidir_forw_mv_table_base); av_freep(&s->b_bidir_back_mv_table_base); av_freep(&s->b_direct_mv_table_base); s->p_mv_table= NULL; s->b_forw_mv_table= NULL; s->b_back_mv_table= NULL; s->b_bidir_forw_mv_table= NULL; s->b_bidir_back_mv_table= NULL; s->b_direct_mv_table= NULL; for(i=0; i<2; i++){ for(j=0; j<2; j++){ for(k=0; k<2; k++){ av_freep(&s->b_field_mv_table_base[i][j][k]); s->b_field_mv_table[i][j][k]=NULL; } av_freep(&s->b_field_select_table[i][j]); av_freep(&s->p_field_mv_table_base[i][j]); s->p_field_mv_table[i][j]=NULL; } av_freep(&s->p_field_select_table[i]); } av_freep(&s->dc_val_base); av_freep(&s->ac_val_base); av_freep(&s->coded_block_base); av_freep(&s->mbintra_table); av_freep(&s->cbp_table); av_freep(&s->pred_dir_table); av_freep(&s->mbskip_table); av_freep(&s->prev_pict_types); av_freep(&s->bitstream_buffer); s->allocated_bitstream_buffer_size=0; av_freep(&s->avctx->stats_out); av_freep(&s->ac_stats); av_freep(&s->error_status_table); av_freep(&s->mb_index2xy); av_freep(&s->lambda_table); av_freep(&s->q_intra_matrix); av_freep(&s->q_inter_matrix); av_freep(&s->q_intra_matrix16); av_freep(&s->q_inter_matrix16); av_freep(&s->input_picture); av_freep(&s->reordered_input_picture); av_freep(&s->dct_offset); if(s->picture){ for(i=0; i<MAX_PICTURE_COUNT; i++){ free_picture(s, &s->picture[i]); } } av_freep(&s->picture); s->context_initialized = 0; s->last_picture_ptr= s->next_picture_ptr= s->current_picture_ptr= NULL; s->linesize= s->uvlinesize= 0; for(i=0; i<3; i++) av_freep(&s->visualization_buffer[i]); avcodec_default_free_buffers(s->avctx); } void init_rl(RLTable *rl, uint8_t static_store[2][2*MAX_RUN + MAX_LEVEL + 3]) { int8_t max_level[MAX_RUN+1], max_run[MAX_LEVEL+1]; uint8_t index_run[MAX_RUN+1]; int last, run, level, start, end, i; /* If table is static, we can quit if rl->max_level[0] is not NULL */ if(static_store && rl->max_level[0]) return; /* compute max_level[], max_run[] and index_run[] */ for(last=0;last<2;last++) { if (last == 0) { start = 0; end = rl->last; } else { start = rl->last; end = rl->n; } memset(max_level, 0, MAX_RUN + 1); memset(max_run, 0, MAX_LEVEL + 1); memset(index_run, rl->n, MAX_RUN + 1); for(i=start;i<end;i++) { run = rl->table_run[i]; level = rl->table_level[i]; if (index_run[run] == rl->n) index_run[run] = i; if (level > max_level[run]) max_level[run] = level; if (run > max_run[level]) max_run[level] = run; } if(static_store) rl->max_level[last] = static_store[last]; else rl->max_level[last] = av_malloc(MAX_RUN + 1); memcpy(rl->max_level[last], max_level, MAX_RUN + 1); if(static_store) rl->max_run[last] = static_store[last] + MAX_RUN + 1; else rl->max_run[last] = av_malloc(MAX_LEVEL + 1); memcpy(rl->max_run[last], max_run, MAX_LEVEL + 1); if(static_store) rl->index_run[last] = static_store[last] + MAX_RUN + MAX_LEVEL + 2; else rl->index_run[last] = av_malloc(MAX_RUN + 1); memcpy(rl->index_run[last], index_run, MAX_RUN + 1); } } void init_vlc_rl(RLTable *rl) { int i, q; for(q=0; q<32; q++){ int qmul= q*2; int qadd= (q-1)|1; if(q==0){ qmul=1; qadd=0; } for(i=0; i<rl->vlc.table_size; i++){ int code= rl->vlc.table[i][0]; int len = rl->vlc.table[i][1]; int level, run; if(len==0){ // illegal code run= 66; level= MAX_LEVEL; }else if(len<0){ //more bits needed run= 0; level= code; }else{ if(code==rl->n){ //esc run= 66; level= 0; }else{ run= rl->table_run [code] + 1; level= rl->table_level[code] * qmul + qadd; if(code >= rl->last) run+=192; } } rl->rl_vlc[q][i].len= len; rl->rl_vlc[q][i].level= level; rl->rl_vlc[q][i].run= run; } } } int ff_find_unused_picture(MpegEncContext *s, int shared){ int i; if(shared){ for(i=0; i<MAX_PICTURE_COUNT; i++){ if(s->picture[i].data[0]==NULL && s->picture[i].type==0) return i; } }else{ for(i=0; i<MAX_PICTURE_COUNT; i++){ if(s->picture[i].data[0]==NULL && s->picture[i].type!=0) return i; //FIXME } for(i=0; i<MAX_PICTURE_COUNT; i++){ if(s->picture[i].data[0]==NULL) return i; } } av_log(s->avctx, AV_LOG_FATAL, "Internal error, picture buffer overflow\n"); /* We could return -1, but the codec would crash trying to draw into a * non-existing frame anyway. This is safer than waiting for a random crash. * Also the return of this is never useful, an encoder must only allocate * as much as allowed in the specification. This has no relationship to how * much libavcodec could allocate (and MAX_PICTURE_COUNT is always large * enough for such valid streams). * Plus, a decoder has to check stream validity and remove frames if too * many reference frames are around. Waiting for "OOM" is not correct at * all. Similarly, missing reference frames have to be replaced by * interpolated/MC frames, anything else is a bug in the codec ... */ abort(); return -1; } static void update_noise_reduction(MpegEncContext *s){ int intra, i; for(intra=0; intra<2; intra++){ if(s->dct_count[intra] > (1<<16)){ for(i=0; i<64; i++){ s->dct_error_sum[intra][i] >>=1; } s->dct_count[intra] >>= 1; } for(i=0; i<64; i++){ s->dct_offset[intra][i]= (s->avctx->noise_reduction * s->dct_count[intra] + s->dct_error_sum[intra][i]/2) / (s->dct_error_sum[intra][i]+1); } } } /** * generic function for encode/decode called after coding/decoding the header and before a frame is coded/decoded */ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) { int i; Picture *pic; s->mb_skipped = 0; assert(s->last_picture_ptr==NULL || s->out_format != FMT_H264 || s->codec_id == CODEC_ID_SVQ3); /* mark&release old frames */ if (s->pict_type != FF_B_TYPE && s->last_picture_ptr && s->last_picture_ptr != s->next_picture_ptr && s->last_picture_ptr->data[0]) { if(s->out_format != FMT_H264 || s->codec_id == CODEC_ID_SVQ3){ free_frame_buffer(s, s->last_picture_ptr); /* release forgotten pictures */ /* if(mpeg124/h263) */ if(!s->encoding){ for(i=0; i<MAX_PICTURE_COUNT; i++){ if(s->picture[i].data[0] && &s->picture[i] != s->next_picture_ptr && s->picture[i].reference){ av_log(avctx, AV_LOG_ERROR, "releasing zombie picture\n"); free_frame_buffer(s, &s->picture[i]); } } } } } if(!s->encoding){ /* release non reference frames */ for(i=0; i<MAX_PICTURE_COUNT; i++){ if(s->picture[i].data[0] && !s->picture[i].reference /*&& s->picture[i].type!=FF_BUFFER_TYPE_SHARED*/){ free_frame_buffer(s, &s->picture[i]); } } if(s->current_picture_ptr && s->current_picture_ptr->data[0]==NULL) pic= s->current_picture_ptr; //we already have a unused image (maybe it was set before reading the header) else{ i= ff_find_unused_picture(s, 0); pic= &s->picture[i]; } pic->reference= 0; if (!s->dropable){ if (s->codec_id == CODEC_ID_H264) pic->reference = s->picture_structure; else if (s->pict_type != FF_B_TYPE) pic->reference = 3; } pic->coded_picture_number= s->coded_picture_number++; if(ff_alloc_picture(s, pic, 0) < 0) return -1; s->current_picture_ptr= pic; s->current_picture_ptr->top_field_first= s->top_field_first; //FIXME use only the vars from current_pic s->current_picture_ptr->interlaced_frame= !s->progressive_frame && !s->progressive_sequence; } s->current_picture_ptr->pict_type= s->pict_type; // if(s->flags && CODEC_FLAG_QSCALE) // s->current_picture_ptr->quality= s->new_picture_ptr->quality; s->current_picture_ptr->key_frame= s->pict_type == FF_I_TYPE; ff_copy_picture(&s->current_picture, s->current_picture_ptr); if (s->pict_type != FF_B_TYPE) { s->last_picture_ptr= s->next_picture_ptr; if(!s->dropable) s->next_picture_ptr= s->current_picture_ptr; } /* av_log(s->avctx, AV_LOG_DEBUG, "L%p N%p C%p L%p N%p C%p type:%d drop:%d\n", s->last_picture_ptr, s->next_picture_ptr,s->current_picture_ptr, s->last_picture_ptr ? s->last_picture_ptr->data[0] : NULL, s->next_picture_ptr ? s->next_picture_ptr->data[0] : NULL, s->current_picture_ptr ? s->current_picture_ptr->data[0] : NULL, s->pict_type, s->dropable);*/ if(s->codec_id != CODEC_ID_H264){ if((s->last_picture_ptr==NULL || s->last_picture_ptr->data[0]==NULL) && s->pict_type!=FF_I_TYPE){ av_log(avctx, AV_LOG_ERROR, "warning: first frame is no keyframe\n"); /* Allocate a dummy frame */ i= ff_find_unused_picture(s, 0); s->last_picture_ptr= &s->picture[i]; if(ff_alloc_picture(s, s->last_picture_ptr, 0) < 0) return -1; } if((s->next_picture_ptr==NULL || s->next_picture_ptr->data[0]==NULL) && s->pict_type==FF_B_TYPE){ /* Allocate a dummy frame */ i= ff_find_unused_picture(s, 0); s->next_picture_ptr= &s->picture[i]; if(ff_alloc_picture(s, s->next_picture_ptr, 0) < 0) return -1; } } if(s->last_picture_ptr) ff_copy_picture(&s->last_picture, s->last_picture_ptr); if(s->next_picture_ptr) ff_copy_picture(&s->next_picture, s->next_picture_ptr); assert(s->pict_type == FF_I_TYPE || (s->last_picture_ptr && s->last_picture_ptr->data[0])); if(s->picture_structure!=PICT_FRAME && s->out_format != FMT_H264){ int i; for(i=0; i<4; i++){ if(s->picture_structure == PICT_BOTTOM_FIELD){ s->current_picture.data[i] += s->current_picture.linesize[i]; } s->current_picture.linesize[i] *= 2; s->last_picture.linesize[i] *=2; s->next_picture.linesize[i] *=2; } } s->hurry_up= s->avctx->hurry_up; s->error_recognition= avctx->error_recognition; /* set dequantizer, we can't do it during init as it might change for mpeg4 and we can't do it in the header decode as init is not called for mpeg4 there yet */ if(s->mpeg_quant || s->codec_id == CODEC_ID_MPEG2VIDEO){ s->dct_unquantize_intra = s->dct_unquantize_mpeg2_intra; s->dct_unquantize_inter = s->dct_unquantize_mpeg2_inter; }else if(s->out_format == FMT_H263 || s->out_format == FMT_H261){ s->dct_unquantize_intra = s->dct_unquantize_h263_intra; s->dct_unquantize_inter = s->dct_unquantize_h263_inter; }else{ s->dct_unquantize_intra = s->dct_unquantize_mpeg1_intra; s->dct_unquantize_inter = s->dct_unquantize_mpeg1_inter; } if(s->dct_error_sum){ assert(s->avctx->noise_reduction && s->encoding); update_noise_reduction(s); } if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) return ff_xvmc_field_start(s, avctx); return 0; } /* generic function for encode/decode called after a frame has been coded/decoded */ void MPV_frame_end(MpegEncContext *s) { int i; /* draw edge for correct motion prediction if outside */ //just to make sure that all data is rendered. if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration){ ff_xvmc_field_end(s); }else if(!s->avctx->hwaccel && !(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) && s->unrestricted_mv && s->current_picture.reference && !s->intra_only && !(s->flags&CODEC_FLAG_EMU_EDGE)) { s->dsp.draw_edges(s->current_picture.data[0], s->linesize , s->h_edge_pos , s->v_edge_pos , EDGE_WIDTH ); s->dsp.draw_edges(s->current_picture.data[1], s->uvlinesize, s->h_edge_pos>>1, s->v_edge_pos>>1, EDGE_WIDTH/2); s->dsp.draw_edges(s->current_picture.data[2], s->uvlinesize, s->h_edge_pos>>1, s->v_edge_pos>>1, EDGE_WIDTH/2); } emms_c(); s->last_pict_type = s->pict_type; s->last_lambda_for[s->pict_type]= s->current_picture_ptr->quality; if(s->pict_type!=FF_B_TYPE){ s->last_non_b_pict_type= s->pict_type; } #if 0 /* copy back current_picture variables */ for(i=0; i<MAX_PICTURE_COUNT; i++){ if(s->picture[i].data[0] == s->current_picture.data[0]){ s->picture[i]= s->current_picture; break; } } assert(i<MAX_PICTURE_COUNT); #endif if(s->encoding){ /* release non-reference frames */ for(i=0; i<MAX_PICTURE_COUNT; i++){ if(s->picture[i].data[0] && !s->picture[i].reference /*&& s->picture[i].type!=FF_BUFFER_TYPE_SHARED*/){ free_frame_buffer(s, &s->picture[i]); } } } // clear copies, to avoid confusion #if 0 memset(&s->last_picture, 0, sizeof(Picture)); memset(&s->next_picture, 0, sizeof(Picture)); memset(&s->current_picture, 0, sizeof(Picture)); #endif s->avctx->coded_frame= (AVFrame*)s->current_picture_ptr; } /** * draws an line from (ex, ey) -> (sx, sy). * @param w width of the image * @param h height of the image * @param stride stride/linesize of the image * @param color color of the arrow */ static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h, int stride, int color){ int x, y, fr, f; sx= av_clip(sx, 0, w-1); sy= av_clip(sy, 0, h-1); ex= av_clip(ex, 0, w-1); ey= av_clip(ey, 0, h-1); buf[sy*stride + sx]+= color; if(FFABS(ex - sx) > FFABS(ey - sy)){ if(sx > ex){ FFSWAP(int, sx, ex); FFSWAP(int, sy, ey); } buf+= sx + sy*stride; ex-= sx; f= ((ey-sy)<<16)/ex; for(x= 0; x <= ex; x++){ y = (x*f)>>16; fr= (x*f)&0xFFFF; buf[ y *stride + x]+= (color*(0x10000-fr))>>16; buf[(y+1)*stride + x]+= (color* fr )>>16; } }else{ if(sy > ey){ FFSWAP(int, sx, ex); FFSWAP(int, sy, ey); } buf+= sx + sy*stride; ey-= sy; if(ey) f= ((ex-sx)<<16)/ey; else f= 0; for(y= 0; y <= ey; y++){ x = (y*f)>>16; fr= (y*f)&0xFFFF; buf[y*stride + x ]+= (color*(0x10000-fr))>>16; buf[y*stride + x+1]+= (color* fr )>>16; } } } /** * draws an arrow from (ex, ey) -> (sx, sy). * @param w width of the image * @param h height of the image * @param stride stride/linesize of the image * @param color color of the arrow */ static void draw_arrow(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h, int stride, int color){ int dx,dy; sx= av_clip(sx, -100, w+100); sy= av_clip(sy, -100, h+100); ex= av_clip(ex, -100, w+100); ey= av_clip(ey, -100, h+100); dx= ex - sx; dy= ey - sy; if(dx*dx + dy*dy > 3*3){ int rx= dx + dy; int ry= -dx + dy; int length= ff_sqrt((rx*rx + ry*ry)<<8); //FIXME subpixel accuracy rx= ROUNDED_DIV(rx*3<<4, length); ry= ROUNDED_DIV(ry*3<<4, length); draw_line(buf, sx, sy, sx + rx, sy + ry, w, h, stride, color); draw_line(buf, sx, sy, sx - ry, sy + rx, w, h, stride, color); } draw_line(buf, sx, sy, ex, ey, w, h, stride, color); } /** * prints debuging info for the given picture. */ void ff_print_debug_info(MpegEncContext *s, AVFrame *pict){ if(s->avctx->hwaccel || !pict || !pict->mb_type) return; if(s->avctx->debug&(FF_DEBUG_SKIP | FF_DEBUG_QP | FF_DEBUG_MB_TYPE)){ int x,y; av_log(s->avctx,AV_LOG_DEBUG,"New frame, type: "); switch (pict->pict_type) { case FF_I_TYPE: av_log(s->avctx,AV_LOG_DEBUG,"I\n"); break; case FF_P_TYPE: av_log(s->avctx,AV_LOG_DEBUG,"P\n"); break; case FF_B_TYPE: av_log(s->avctx,AV_LOG_DEBUG,"B\n"); break; case FF_S_TYPE: av_log(s->avctx,AV_LOG_DEBUG,"S\n"); break; case FF_SI_TYPE: av_log(s->avctx,AV_LOG_DEBUG,"SI\n"); break; case FF_SP_TYPE: av_log(s->avctx,AV_LOG_DEBUG,"SP\n"); break; } for(y=0; y<s->mb_height; y++){ for(x=0; x<s->mb_width; x++){ if(s->avctx->debug&FF_DEBUG_SKIP){ int count= s->mbskip_table[x + y*s->mb_stride]; if(count>9) count=9; av_log(s->avctx, AV_LOG_DEBUG, "%1d", count); } if(s->avctx->debug&FF_DEBUG_QP){ av_log(s->avctx, AV_LOG_DEBUG, "%2d", pict->qscale_table[x + y*s->mb_stride]); } if(s->avctx->debug&FF_DEBUG_MB_TYPE){ int mb_type= pict->mb_type[x + y*s->mb_stride]; //Type & MV direction if(IS_PCM(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "P"); else if(IS_INTRA(mb_type) && IS_ACPRED(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "A"); else if(IS_INTRA4x4(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "i"); else if(IS_INTRA16x16(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "I"); else if(IS_DIRECT(mb_type) && IS_SKIP(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "d"); else if(IS_DIRECT(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "D"); else if(IS_GMC(mb_type) && IS_SKIP(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "g"); else if(IS_GMC(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "G"); else if(IS_SKIP(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "S"); else if(!USES_LIST(mb_type, 1)) av_log(s->avctx, AV_LOG_DEBUG, ">"); else if(!USES_LIST(mb_type, 0)) av_log(s->avctx, AV_LOG_DEBUG, "<"); else{ assert(USES_LIST(mb_type, 0) && USES_LIST(mb_type, 1)); av_log(s->avctx, AV_LOG_DEBUG, "X"); } //segmentation if(IS_8X8(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "+"); else if(IS_16X8(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "-"); else if(IS_8X16(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, "|"); else if(IS_INTRA(mb_type) || IS_16X16(mb_type)) av_log(s->avctx, AV_LOG_DEBUG, " "); else av_log(s->avctx, AV_LOG_DEBUG, "?"); if(IS_INTERLACED(mb_type) && s->codec_id == CODEC_ID_H264) av_log(s->avctx, AV_LOG_DEBUG, "="); else av_log(s->avctx, AV_LOG_DEBUG, " "); } // av_log(s->avctx, AV_LOG_DEBUG, " "); } av_log(s->avctx, AV_LOG_DEBUG, "\n"); } } if((s->avctx->debug&(FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) || (s->avctx->debug_mv)){ const int shift= 1 + s->quarter_sample; int mb_y; uint8_t *ptr; int i; int h_chroma_shift, v_chroma_shift, block_height; const int width = s->avctx->width; const int height= s->avctx->height; const int mv_sample_log2= 4 - pict->motion_subsample_log2; const int mv_stride= (s->mb_width << mv_sample_log2) + (s->codec_id == CODEC_ID_H264 ? 0 : 1); s->low_delay=0; //needed to see the vectors without trashing the buffers avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift); for(i=0; i<3; i++){ memcpy(s->visualization_buffer[i], pict->data[i], (i==0) ? pict->linesize[i]*height:pict->linesize[i]*height >> v_chroma_shift); pict->data[i]= s->visualization_buffer[i]; } pict->type= FF_BUFFER_TYPE_COPY; ptr= pict->data[0]; block_height = 16>>v_chroma_shift; for(mb_y=0; mb_y<s->mb_height; mb_y++){ int mb_x; for(mb_x=0; mb_x<s->mb_width; mb_x++){ const int mb_index= mb_x + mb_y*s->mb_stride; if((s->avctx->debug_mv) && pict->motion_val){ int type; for(type=0; type<3; type++){ int direction = 0; switch (type) { case 0: if ((!(s->avctx->debug_mv&FF_DEBUG_VIS_MV_P_FOR)) || (pict->pict_type!=FF_P_TYPE)) continue; direction = 0; break; case 1: if ((!(s->avctx->debug_mv&FF_DEBUG_VIS_MV_B_FOR)) || (pict->pict_type!=FF_B_TYPE)) continue; direction = 0; break; case 2: if ((!(s->avctx->debug_mv&FF_DEBUG_VIS_MV_B_BACK)) || (pict->pict_type!=FF_B_TYPE)) continue; direction = 1; break; } if(!USES_LIST(pict->mb_type[mb_index], direction)) continue; if(IS_8X8(pict->mb_type[mb_index])){ int i; for(i=0; i<4; i++){ int sx= mb_x*16 + 4 + 8*(i&1); int sy= mb_y*16 + 4 + 8*(i>>1); int xy= (mb_x*2 + (i&1) + (mb_y*2 + (i>>1))*mv_stride) << (mv_sample_log2-1); int mx= (pict->motion_val[direction][xy][0]>>shift) + sx; int my= (pict->motion_val[direction][xy][1]>>shift) + sy; draw_arrow(ptr, sx, sy, mx, my, width, height, s->linesize, 100); } }else if(IS_16X8(pict->mb_type[mb_index])){ int i; for(i=0; i<2; i++){ int sx=mb_x*16 + 8; int sy=mb_y*16 + 4 + 8*i; int xy= (mb_x*2 + (mb_y*2 + i)*mv_stride) << (mv_sample_log2-1); int mx=(pict->motion_val[direction][xy][0]>>shift); int my=(pict->motion_val[direction][xy][1]>>shift); if(IS_INTERLACED(pict->mb_type[mb_index])) my*=2; draw_arrow(ptr, sx, sy, mx+sx, my+sy, width, height, s->linesize, 100); } }else if(IS_8X16(pict->mb_type[mb_index])){ int i; for(i=0; i<2; i++){ int sx=mb_x*16 + 4 + 8*i; int sy=mb_y*16 + 8; int xy= (mb_x*2 + i + mb_y*2*mv_stride) << (mv_sample_log2-1); int mx=(pict->motion_val[direction][xy][0]>>shift); int my=(pict->motion_val[direction][xy][1]>>shift); if(IS_INTERLACED(pict->mb_type[mb_index])) my*=2; draw_arrow(ptr, sx, sy, mx+sx, my+sy, width, height, s->linesize, 100); } }else{ int sx= mb_x*16 + 8; int sy= mb_y*16 + 8; int xy= (mb_x + mb_y*mv_stride) << mv_sample_log2; int mx= (pict->motion_val[direction][xy][0]>>shift) + sx; int my= (pict->motion_val[direction][xy][1]>>shift) + sy; draw_arrow(ptr, sx, sy, mx, my, width, height, s->linesize, 100); } } } if((s->avctx->debug&FF_DEBUG_VIS_QP) && pict->motion_val){ uint64_t c= (pict->qscale_table[mb_index]*128/31) * 0x0101010101010101ULL; int y; for(y=0; y<block_height; y++){ *(uint64_t*)(pict->data[1] + 8*mb_x + (block_height*mb_y + y)*pict->linesize[1])= c; *(uint64_t*)(pict->data[2] + 8*mb_x + (block_height*mb_y + y)*pict->linesize[2])= c; } } if((s->avctx->debug&FF_DEBUG_VIS_MB_TYPE) && pict->motion_val){ int mb_type= pict->mb_type[mb_index]; uint64_t u,v; int y; #define COLOR(theta, r)\ u= (int)(128 + r*cos(theta*3.141592/180));\ v= (int)(128 + r*sin(theta*3.141592/180)); u=v=128; if(IS_PCM(mb_type)){ COLOR(120,48) }else if((IS_INTRA(mb_type) && IS_ACPRED(mb_type)) || IS_INTRA16x16(mb_type)){ COLOR(30,48) }else if(IS_INTRA4x4(mb_type)){ COLOR(90,48) }else if(IS_DIRECT(mb_type) && IS_SKIP(mb_type)){ // COLOR(120,48) }else if(IS_DIRECT(mb_type)){ COLOR(150,48) }else if(IS_GMC(mb_type) && IS_SKIP(mb_type)){ COLOR(170,48) }else if(IS_GMC(mb_type)){ COLOR(190,48) }else if(IS_SKIP(mb_type)){ // COLOR(180,48) }else if(!USES_LIST(mb_type, 1)){ COLOR(240,48) }else if(!USES_LIST(mb_type, 0)){ COLOR(0,48) }else{ assert(USES_LIST(mb_type, 0) && USES_LIST(mb_type, 1)); COLOR(300,48) } u*= 0x0101010101010101ULL; v*= 0x0101010101010101ULL; for(y=0; y<block_height; y++){ *(uint64_t*)(pict->data[1] + 8*mb_x + (block_height*mb_y + y)*pict->linesize[1])= u; *(uint64_t*)(pict->data[2] + 8*mb_x + (block_height*mb_y + y)*pict->linesize[2])= v; } //segmentation if(IS_8X8(mb_type) || IS_16X8(mb_type)){ *(uint64_t*)(pict->data[0] + 16*mb_x + 0 + (16*mb_y + 8)*pict->linesize[0])^= 0x8080808080808080ULL; *(uint64_t*)(pict->data[0] + 16*mb_x + 8 + (16*mb_y + 8)*pict->linesize[0])^= 0x8080808080808080ULL; } if(IS_8X8(mb_type) || IS_8X16(mb_type)){ for(y=0; y<16; y++) pict->data[0][16*mb_x + 8 + (16*mb_y + y)*pict->linesize[0]]^= 0x80; } if(IS_8X8(mb_type) && mv_sample_log2 >= 2){ int dm= 1 << (mv_sample_log2-2); for(i=0; i<4; i++){ int sx= mb_x*16 + 8*(i&1); int sy= mb_y*16 + 8*(i>>1); int xy= (mb_x*2 + (i&1) + (mb_y*2 + (i>>1))*mv_stride) << (mv_sample_log2-1); //FIXME bidir int32_t *mv = (int32_t*)&pict->motion_val[0][xy]; if(mv[0] != mv[dm] || mv[dm*mv_stride] != mv[dm*(mv_stride+1)]) for(y=0; y<8; y++) pict->data[0][sx + 4 + (sy + y)*pict->linesize[0]]^= 0x80; if(mv[0] != mv[dm*mv_stride] || mv[dm] != mv[dm*(mv_stride+1)]) *(uint64_t*)(pict->data[0] + sx + (sy + 4)*pict->linesize[0])^= 0x8080808080808080ULL; } } if(IS_INTERLACED(mb_type) && s->codec_id == CODEC_ID_H264){ // hmm } } s->mbskip_table[mb_index]=0; } } } } static inline int hpel_motion_lowres(MpegEncContext *s, uint8_t *dest, uint8_t *src, int field_based, int field_select, int src_x, int src_y, int width, int height, int stride, int h_edge_pos, int v_edge_pos, int w, int h, h264_chroma_mc_func *pix_op, int motion_x, int motion_y) { const int lowres= s->avctx->lowres; const int op_index= FFMIN(lowres, 2); const int s_mask= (2<<lowres)-1; int emu=0; int sx, sy; if(s->quarter_sample){ motion_x/=2; motion_y/=2; } sx= motion_x & s_mask; sy= motion_y & s_mask; src_x += motion_x >> (lowres+1); src_y += motion_y >> (lowres+1); src += src_y * stride + src_x; if( (unsigned)src_x > h_edge_pos - (!!sx) - w || (unsigned)src_y >(v_edge_pos >> field_based) - (!!sy) - h){ ff_emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w+1, (h+1)<<field_based, src_x, src_y<<field_based, h_edge_pos, v_edge_pos); src= s->edge_emu_buffer; emu=1; } sx= (sx << 2) >> lowres; sy= (sy << 2) >> lowres; if(field_select) src += s->linesize; pix_op[op_index](dest, src, stride, h, sx, sy); return emu; } /* apply one mpeg motion vector to the three components */ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int field_based, int bottom_field, int field_select, uint8_t **ref_picture, h264_chroma_mc_func *pix_op, int motion_x, int motion_y, int h, int mb_y) { uint8_t *ptr_y, *ptr_cb, *ptr_cr; int mx, my, src_x, src_y, uvsrc_x, uvsrc_y, uvlinesize, linesize, sx, sy, uvsx, uvsy; const int lowres= s->avctx->lowres; const int op_index= FFMIN(lowres, 2); const int block_s= 8>>lowres; const int s_mask= (2<<lowres)-1; const int h_edge_pos = s->h_edge_pos >> lowres; const int v_edge_pos = s->v_edge_pos >> lowres; linesize = s->current_picture.linesize[0] << field_based; uvlinesize = s->current_picture.linesize[1] << field_based; if(s->quarter_sample){ //FIXME obviously not perfect but qpel will not work in lowres anyway motion_x/=2; motion_y/=2; } if(field_based){ motion_y += (bottom_field - field_select)*((1<<lowres)-1); } sx= motion_x & s_mask; sy= motion_y & s_mask; src_x = s->mb_x*2*block_s + (motion_x >> (lowres+1)); src_y =( mb_y*2*block_s>>field_based) + (motion_y >> (lowres+1)); if (s->out_format == FMT_H263) { uvsx = ((motion_x>>1) & s_mask) | (sx&1); uvsy = ((motion_y>>1) & s_mask) | (sy&1); uvsrc_x = src_x>>1; uvsrc_y = src_y>>1; }else if(s->out_format == FMT_H261){//even chroma mv's are full pel in H261 mx = motion_x / 4; my = motion_y / 4; uvsx = (2*mx) & s_mask; uvsy = (2*my) & s_mask; uvsrc_x = s->mb_x*block_s + (mx >> lowres); uvsrc_y = mb_y*block_s + (my >> lowres); } else { mx = motion_x / 2; my = motion_y / 2; uvsx = mx & s_mask; uvsy = my & s_mask; uvsrc_x = s->mb_x*block_s + (mx >> (lowres+1)); uvsrc_y =( mb_y*block_s>>field_based) + (my >> (lowres+1)); } ptr_y = ref_picture[0] + src_y * linesize + src_x; ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x; ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x; if( (unsigned)src_x > h_edge_pos - (!!sx) - 2*block_s || (unsigned)src_y >(v_edge_pos >> field_based) - (!!sy) - h){ ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based, src_x, src_y<<field_based, h_edge_pos, v_edge_pos); ptr_y = s->edge_emu_buffer; if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ uint8_t *uvbuf= s->edge_emu_buffer+18*s->linesize; ff_emulated_edge_mc(uvbuf , ptr_cb, s->uvlinesize, 9, 9+field_based, uvsrc_x, uvsrc_y<<field_based, h_edge_pos>>1, v_edge_pos>>1); ff_emulated_edge_mc(uvbuf+16, ptr_cr, s->uvlinesize, 9, 9+field_based, uvsrc_x, uvsrc_y<<field_based, h_edge_pos>>1, v_edge_pos>>1); ptr_cb= uvbuf; ptr_cr= uvbuf+16; } } if(bottom_field){ //FIXME use this for field pix too instead of the obnoxious hack which changes picture.data dest_y += s->linesize; dest_cb+= s->uvlinesize; dest_cr+= s->uvlinesize; } if(field_select){ ptr_y += s->linesize; ptr_cb+= s->uvlinesize; ptr_cr+= s->uvlinesize; } sx= (sx << 2) >> lowres; sy= (sy << 2) >> lowres; pix_op[lowres-1](dest_y, ptr_y, linesize, h, sx, sy); if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ uvsx= (uvsx << 2) >> lowres; uvsy= (uvsy << 2) >> lowres; pix_op[op_index](dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy); pix_op[op_index](dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy); } //FIXME h261 lowres loop filter } static inline void chroma_4mv_motion_lowres(MpegEncContext *s, uint8_t *dest_cb, uint8_t *dest_cr, uint8_t **ref_picture, h264_chroma_mc_func *pix_op, int mx, int my){ const int lowres= s->avctx->lowres; const int op_index= FFMIN(lowres, 2); const int block_s= 8>>lowres; const int s_mask= (2<<lowres)-1; const int h_edge_pos = s->h_edge_pos >> (lowres+1); const int v_edge_pos = s->v_edge_pos >> (lowres+1); int emu=0, src_x, src_y, offset, sx, sy; uint8_t *ptr; if(s->quarter_sample){ mx/=2; my/=2; } /* In case of 8X8, we construct a single chroma motion vector with a special rounding */ mx= ff_h263_round_chroma(mx); my= ff_h263_round_chroma(my); sx= mx & s_mask; sy= my & s_mask; src_x = s->mb_x*block_s + (mx >> (lowres+1)); src_y = s->mb_y*block_s + (my >> (lowres+1)); offset = src_y * s->uvlinesize + src_x; ptr = ref_picture[1] + offset; if(s->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)src_x > h_edge_pos - (!!sx) - block_s || (unsigned)src_y > v_edge_pos - (!!sy) - block_s){ ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, h_edge_pos, v_edge_pos); ptr= s->edge_emu_buffer; emu=1; } } sx= (sx << 2) >> lowres; sy= (sy << 2) >> lowres; pix_op[op_index](dest_cb, ptr, s->uvlinesize, block_s, sx, sy); ptr = ref_picture[2] + offset; if(emu){ ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, h_edge_pos, v_edge_pos); ptr= s->edge_emu_buffer; } pix_op[op_index](dest_cr, ptr, s->uvlinesize, block_s, sx, sy); } /** * motion compensation of a single macroblock * @param s context * @param dest_y luma destination pointer * @param dest_cb chroma cb/u destination pointer * @param dest_cr chroma cr/v destination pointer * @param dir direction (0->forward, 1->backward) * @param ref_picture array[3] of pointers to the 3 planes of the reference picture * @param pic_op halfpel motion compensation function (average or put normally) * the motion vectors are taken from s->mv and the MV type from s->mv_type */ static inline void MPV_motion_lowres(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int dir, uint8_t **ref_picture, h264_chroma_mc_func *pix_op) { int mx, my; int mb_x, mb_y, i; const int lowres= s->avctx->lowres; const int block_s= 8>>lowres; mb_x = s->mb_x; mb_y = s->mb_y; switch(s->mv_type) { case MV_TYPE_16X16: mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, 0, 0, 0, ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 2*block_s, mb_y); break; case MV_TYPE_8X8: mx = 0; my = 0; for(i=0;i<4;i++) { hpel_motion_lowres(s, dest_y + ((i & 1) + (i >> 1) * s->linesize)*block_s, ref_picture[0], 0, 0, (2*mb_x + (i & 1))*block_s, (2*mb_y + (i >>1))*block_s, s->width, s->height, s->linesize, s->h_edge_pos >> lowres, s->v_edge_pos >> lowres, block_s, block_s, pix_op, s->mv[dir][i][0], s->mv[dir][i][1]); mx += s->mv[dir][i][0]; my += s->mv[dir][i][1]; } if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)) chroma_4mv_motion_lowres(s, dest_cb, dest_cr, ref_picture, pix_op, mx, my); break; case MV_TYPE_FIELD: if (s->picture_structure == PICT_FRAME) { /* top field */ mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, 1, 0, s->field_select[dir][0], ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], block_s, mb_y); /* bottom field */ mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, 1, 1, s->field_select[dir][1], ref_picture, pix_op, s->mv[dir][1][0], s->mv[dir][1][1], block_s, mb_y); } else { if(s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != FF_B_TYPE && !s->first_field){ ref_picture= s->current_picture_ptr->data; } mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, 0, 0, s->field_select[dir][0], ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 2*block_s, mb_y>>1); } break; case MV_TYPE_16X8: for(i=0; i<2; i++){ uint8_t ** ref2picture; if(s->picture_structure == s->field_select[dir][i] + 1 || s->pict_type == FF_B_TYPE || s->first_field){ ref2picture= ref_picture; }else{ ref2picture= s->current_picture_ptr->data; } mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, 0, 0, s->field_select[dir][i], ref2picture, pix_op, s->mv[dir][i][0], s->mv[dir][i][1] + 2*block_s*i, block_s, mb_y>>1); dest_y += 2*block_s*s->linesize; dest_cb+= (2*block_s>>s->chroma_y_shift)*s->uvlinesize; dest_cr+= (2*block_s>>s->chroma_y_shift)*s->uvlinesize; } break; case MV_TYPE_DMV: if(s->picture_structure == PICT_FRAME){ for(i=0; i<2; i++){ int j; for(j=0; j<2; j++){ mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, 1, j, j^i, ref_picture, pix_op, s->mv[dir][2*i + j][0], s->mv[dir][2*i + j][1], block_s, mb_y); } pix_op = s->dsp.avg_h264_chroma_pixels_tab; } }else{ for(i=0; i<2; i++){ mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr, 0, 0, s->picture_structure != i+1, ref_picture, pix_op, s->mv[dir][2*i][0],s->mv[dir][2*i][1],2*block_s, mb_y>>1); // after put we make avg of the same block pix_op = s->dsp.avg_h264_chroma_pixels_tab; //opposite parity is always in the same frame if this is second field if(!s->first_field){ ref_picture = s->current_picture_ptr->data; } } } break; default: assert(0); } } /* put block[] to dest[] */ static inline void put_dct(MpegEncContext *s, DCTELEM *block, int i, uint8_t *dest, int line_size, int qscale) { s->dct_unquantize_intra(s, block, i, qscale); s->dsp.idct_put (dest, line_size, block); } /* add block[] to dest[] */ static inline void add_dct(MpegEncContext *s, DCTELEM *block, int i, uint8_t *dest, int line_size) { if (s->block_last_index[i] >= 0) { s->dsp.idct_add (dest, line_size, block); } } static inline void add_dequant_dct(MpegEncContext *s, DCTELEM *block, int i, uint8_t *dest, int line_size, int qscale) { if (s->block_last_index[i] >= 0) { s->dct_unquantize_inter(s, block, i, qscale); s->dsp.idct_add (dest, line_size, block); } } /** * cleans dc, ac, coded_block for the current non intra MB */ void ff_clean_intra_table_entries(MpegEncContext *s) { int wrap = s->b8_stride; int xy = s->block_index[0]; s->dc_val[0][xy ] = s->dc_val[0][xy + 1 ] = s->dc_val[0][xy + wrap] = s->dc_val[0][xy + 1 + wrap] = 1024; /* ac pred */ memset(s->ac_val[0][xy ], 0, 32 * sizeof(int16_t)); memset(s->ac_val[0][xy + wrap], 0, 32 * sizeof(int16_t)); if (s->msmpeg4_version>=3) { s->coded_block[xy ] = s->coded_block[xy + 1 ] = s->coded_block[xy + wrap] = s->coded_block[xy + 1 + wrap] = 0; } /* chroma */ wrap = s->mb_stride; xy = s->mb_x + s->mb_y * wrap; s->dc_val[1][xy] = s->dc_val[2][xy] = 1024; /* ac pred */ memset(s->ac_val[1][xy], 0, 16 * sizeof(int16_t)); memset(s->ac_val[2][xy], 0, 16 * sizeof(int16_t)); s->mbintra_table[xy]= 0; } /* generic function called after a macroblock has been parsed by the decoder or after it has been encoded by the encoder. Important variables used: s->mb_intra : true if intra macroblock s->mv_dir : motion vector direction s->mv_type : motion vector type s->mv : motion vector s->interlaced_dct : true if interlaced dct used (mpeg2) */ static av_always_inline void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64], int lowres_flag, int is_mpeg12) { const int mb_xy = s->mb_y * s->mb_stride + s->mb_x; if(CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration){ ff_xvmc_decode_mb(s);//xvmc uses pblocks return; } if(s->avctx->debug&FF_DEBUG_DCT_COEFF) { /* save DCT coefficients */ int i,j; DCTELEM *dct = &s->current_picture.dct_coeff[mb_xy*64*6]; for(i=0; i<6; i++) for(j=0; j<64; j++) *dct++ = block[i][s->dsp.idct_permutation[j]]; } s->current_picture.qscale_table[mb_xy]= s->qscale; /* update DC predictors for P macroblocks */ if (!s->mb_intra) { if (!is_mpeg12 && (s->h263_pred || s->h263_aic)) { if(s->mbintra_table[mb_xy]) ff_clean_intra_table_entries(s); } else { s->last_dc[0] = s->last_dc[1] = s->last_dc[2] = 128 << s->intra_dc_precision; } } else if (!is_mpeg12 && (s->h263_pred || s->h263_aic)) s->mbintra_table[mb_xy]=1; if ((s->flags&CODEC_FLAG_PSNR) || !(s->encoding && (s->intra_only || s->pict_type==FF_B_TYPE) && s->avctx->mb_decision != FF_MB_DECISION_RD)) { //FIXME precalc uint8_t *dest_y, *dest_cb, *dest_cr; int dct_linesize, dct_offset; op_pixels_func (*op_pix)[4]; qpel_mc_func (*op_qpix)[16]; const int linesize= s->current_picture.linesize[0]; //not s->linesize as this would be wrong for field pics const int uvlinesize= s->current_picture.linesize[1]; const int readable= s->pict_type != FF_B_TYPE || s->encoding || s->avctx->draw_horiz_band || lowres_flag; const int block_size= lowres_flag ? 8>>s->avctx->lowres : 8; /* avoid copy if macroblock skipped in last frame too */ /* skip only during decoding as we might trash the buffers during encoding a bit */ if(!s->encoding){ uint8_t *mbskip_ptr = &s->mbskip_table[mb_xy]; const int age= s->current_picture.age; assert(age); if (s->mb_skipped) { s->mb_skipped= 0; assert(s->pict_type!=FF_I_TYPE); (*mbskip_ptr) ++; /* indicate that this time we skipped it */ if(*mbskip_ptr >99) *mbskip_ptr= 99; /* if previous was skipped too, then nothing to do ! */ if (*mbskip_ptr >= age && s->current_picture.reference){ return; } } else if(!s->current_picture.reference){ (*mbskip_ptr) ++; /* increase counter so the age can be compared cleanly */ if(*mbskip_ptr >99) *mbskip_ptr= 99; } else{ *mbskip_ptr = 0; /* not skipped */ } } dct_linesize = linesize << s->interlaced_dct; dct_offset =(s->interlaced_dct)? linesize : linesize*block_size; if(readable){ dest_y= s->dest[0]; dest_cb= s->dest[1]; dest_cr= s->dest[2]; }else{ dest_y = s->b_scratchpad; dest_cb= s->b_scratchpad+16*linesize; dest_cr= s->b_scratchpad+32*linesize; } if (!s->mb_intra) { /* motion handling */ /* decoding or more than one mb_type (MC was already done otherwise) */ if(!s->encoding){ if(lowres_flag){ h264_chroma_mc_func *op_pix = s->dsp.put_h264_chroma_pixels_tab; if (s->mv_dir & MV_DIR_FORWARD) { MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.data, op_pix); op_pix = s->dsp.avg_h264_chroma_pixels_tab; } if (s->mv_dir & MV_DIR_BACKWARD) { MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.data, op_pix); } }else{ op_qpix= s->me.qpel_put; if ((!s->no_rounding) || s->pict_type==FF_B_TYPE){ op_pix = s->dsp.put_pixels_tab; }else{ op_pix = s->dsp.put_no_rnd_pixels_tab; } if (s->mv_dir & MV_DIR_FORWARD) { MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.data, op_pix, op_qpix); op_pix = s->dsp.avg_pixels_tab; op_qpix= s->me.qpel_avg; } if (s->mv_dir & MV_DIR_BACKWARD) { MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.data, op_pix, op_qpix); } } } /* skip dequant / idct if we are really late ;) */ if(s->hurry_up>1) goto skip_idct; if(s->avctx->skip_idct){ if( (s->avctx->skip_idct >= AVDISCARD_NONREF && s->pict_type == FF_B_TYPE) ||(s->avctx->skip_idct >= AVDISCARD_NONKEY && s->pict_type != FF_I_TYPE) || s->avctx->skip_idct >= AVDISCARD_ALL) goto skip_idct; } /* add dct residue */ if(s->encoding || !( s->h263_msmpeg4 || s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO || (s->codec_id==CODEC_ID_MPEG4 && !s->mpeg_quant))){ add_dequant_dct(s, block[0], 0, dest_y , dct_linesize, s->qscale); add_dequant_dct(s, block[1], 1, dest_y + block_size, dct_linesize, s->qscale); add_dequant_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->qscale); add_dequant_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale); if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ if (s->chroma_y_shift){ add_dequant_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale); add_dequant_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale); }else{ dct_linesize >>= 1; dct_offset >>=1; add_dequant_dct(s, block[4], 4, dest_cb, dct_linesize, s->chroma_qscale); add_dequant_dct(s, block[5], 5, dest_cr, dct_linesize, s->chroma_qscale); add_dequant_dct(s, block[6], 6, dest_cb + dct_offset, dct_linesize, s->chroma_qscale); add_dequant_dct(s, block[7], 7, dest_cr + dct_offset, dct_linesize, s->chroma_qscale); } } } else if(is_mpeg12 || (s->codec_id != CODEC_ID_WMV2)){ add_dct(s, block[0], 0, dest_y , dct_linesize); add_dct(s, block[1], 1, dest_y + block_size, dct_linesize); add_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize); add_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize); if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ if(s->chroma_y_shift){//Chroma420 add_dct(s, block[4], 4, dest_cb, uvlinesize); add_dct(s, block[5], 5, dest_cr, uvlinesize); }else{ //chroma422 dct_linesize = uvlinesize << s->interlaced_dct; dct_offset =(s->interlaced_dct)? uvlinesize : uvlinesize*8; add_dct(s, block[4], 4, dest_cb, dct_linesize); add_dct(s, block[5], 5, dest_cr, dct_linesize); add_dct(s, block[6], 6, dest_cb+dct_offset, dct_linesize); add_dct(s, block[7], 7, dest_cr+dct_offset, dct_linesize); if(!s->chroma_x_shift){//Chroma444 add_dct(s, block[8], 8, dest_cb+8, dct_linesize); add_dct(s, block[9], 9, dest_cr+8, dct_linesize); add_dct(s, block[10], 10, dest_cb+8+dct_offset, dct_linesize); add_dct(s, block[11], 11, dest_cr+8+dct_offset, dct_linesize); } } }//fi gray } else if (CONFIG_WMV2_DECODER || CONFIG_WMV2_ENCODER) { ff_wmv2_add_mb(s, block, dest_y, dest_cb, dest_cr); } } else { /* dct only in intra block */ if(s->encoding || !(s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO)){ put_dct(s, block[0], 0, dest_y , dct_linesize, s->qscale); put_dct(s, block[1], 1, dest_y + block_size, dct_linesize, s->qscale); put_dct(s, block[2], 2, dest_y + dct_offset , dct_linesize, s->qscale); put_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale); if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ if(s->chroma_y_shift){ put_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale); put_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale); }else{ dct_offset >>=1; dct_linesize >>=1; put_dct(s, block[4], 4, dest_cb, dct_linesize, s->chroma_qscale); put_dct(s, block[5], 5, dest_cr, dct_linesize, s->chroma_qscale); put_dct(s, block[6], 6, dest_cb + dct_offset, dct_linesize, s->chroma_qscale); put_dct(s, block[7], 7, dest_cr + dct_offset, dct_linesize, s->chroma_qscale); } } }else{ s->dsp.idct_put(dest_y , dct_linesize, block[0]); s->dsp.idct_put(dest_y + block_size, dct_linesize, block[1]); s->dsp.idct_put(dest_y + dct_offset , dct_linesize, block[2]); s->dsp.idct_put(dest_y + dct_offset + block_size, dct_linesize, block[3]); if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ if(s->chroma_y_shift){ s->dsp.idct_put(dest_cb, uvlinesize, block[4]); s->dsp.idct_put(dest_cr, uvlinesize, block[5]); }else{ dct_linesize = uvlinesize << s->interlaced_dct; dct_offset =(s->interlaced_dct)? uvlinesize : uvlinesize*8; s->dsp.idct_put(dest_cb, dct_linesize, block[4]); s->dsp.idct_put(dest_cr, dct_linesize, block[5]); s->dsp.idct_put(dest_cb + dct_offset, dct_linesize, block[6]); s->dsp.idct_put(dest_cr + dct_offset, dct_linesize, block[7]); if(!s->chroma_x_shift){//Chroma444 s->dsp.idct_put(dest_cb + 8, dct_linesize, block[8]); s->dsp.idct_put(dest_cr + 8, dct_linesize, block[9]); s->dsp.idct_put(dest_cb + 8 + dct_offset, dct_linesize, block[10]); s->dsp.idct_put(dest_cr + 8 + dct_offset, dct_linesize, block[11]); } } }//gray } } skip_idct: if(!readable){ s->dsp.put_pixels_tab[0][0](s->dest[0], dest_y , linesize,16); s->dsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[1], dest_cb, uvlinesize,16 >> s->chroma_y_shift); s->dsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[2], dest_cr, uvlinesize,16 >> s->chroma_y_shift); } } } void MPV_decode_mb(MpegEncContext *s, DCTELEM block[12][64]){ #if !CONFIG_SMALL if(s->out_format == FMT_MPEG1) { if(s->avctx->lowres) MPV_decode_mb_internal(s, block, 1, 1); else MPV_decode_mb_internal(s, block, 0, 1); } else #endif if(s->avctx->lowres) MPV_decode_mb_internal(s, block, 1, 0); else MPV_decode_mb_internal(s, block, 0, 0); } /** * * @param h is the normal height, this will be reduced automatically if needed for the last row */ void ff_draw_horiz_band(MpegEncContext *s, int y, int h){ if (s->avctx->draw_horiz_band) { AVFrame *src; const int field_pic= s->picture_structure != PICT_FRAME; int offset[4]; h= FFMIN(h, (s->avctx->height>>field_pic) - y); if(field_pic && !(s->avctx->slice_flags&SLICE_FLAG_ALLOW_FIELD)){ h <<= 1; y <<= 1; if(s->first_field) return; } if(s->pict_type==FF_B_TYPE || s->low_delay || (s->avctx->slice_flags&SLICE_FLAG_CODED_ORDER)) src= (AVFrame*)s->current_picture_ptr; else if(s->last_picture_ptr) src= (AVFrame*)s->last_picture_ptr; else return; if(s->pict_type==FF_B_TYPE && s->picture_structure == PICT_FRAME && s->out_format != FMT_H264){ offset[0]= offset[1]= offset[2]= offset[3]= 0; }else{ offset[0]= y * s->linesize; offset[1]= offset[2]= (y >> s->chroma_y_shift) * s->uvlinesize; offset[3]= 0; } emms_c(); s->avctx->draw_horiz_band(s->avctx, src, offset, y, s->picture_structure, h); } } void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename const int linesize= s->current_picture.linesize[0]; //not s->linesize as this would be wrong for field pics const int uvlinesize= s->current_picture.linesize[1]; const int mb_size= 4 - s->avctx->lowres; s->block_index[0]= s->b8_stride*(s->mb_y*2 ) - 2 + s->mb_x*2; s->block_index[1]= s->b8_stride*(s->mb_y*2 ) - 1 + s->mb_x*2; s->block_index[2]= s->b8_stride*(s->mb_y*2 + 1) - 2 + s->mb_x*2; s->block_index[3]= s->b8_stride*(s->mb_y*2 + 1) - 1 + s->mb_x*2; s->block_index[4]= s->mb_stride*(s->mb_y + 1) + s->b8_stride*s->mb_height*2 + s->mb_x - 1; s->block_index[5]= s->mb_stride*(s->mb_y + s->mb_height + 2) + s->b8_stride*s->mb_height*2 + s->mb_x - 1; //block_index is not used by mpeg2, so it is not affected by chroma_format s->dest[0] = s->current_picture.data[0] + ((s->mb_x - 1) << mb_size); s->dest[1] = s->current_picture.data[1] + ((s->mb_x - 1) << (mb_size - s->chroma_x_shift)); s->dest[2] = s->current_picture.data[2] + ((s->mb_x - 1) << (mb_size - s->chroma_x_shift)); if(!(s->pict_type==FF_B_TYPE && s->avctx->draw_horiz_band && s->picture_structure==PICT_FRAME)) { if(s->picture_structure==PICT_FRAME){ s->dest[0] += s->mb_y * linesize << mb_size; s->dest[1] += s->mb_y * uvlinesize << (mb_size - s->chroma_y_shift); s->dest[2] += s->mb_y * uvlinesize << (mb_size - s->chroma_y_shift); }else{ s->dest[0] += (s->mb_y>>1) * linesize << mb_size; s->dest[1] += (s->mb_y>>1) * uvlinesize << (mb_size - s->chroma_y_shift); s->dest[2] += (s->mb_y>>1) * uvlinesize << (mb_size - s->chroma_y_shift); assert((s->mb_y&1) == (s->picture_structure == PICT_BOTTOM_FIELD)); } } } void ff_mpeg_flush(AVCodecContext *avctx){ int i; MpegEncContext *s = avctx->priv_data; if(s==NULL || s->picture==NULL) return; for(i=0; i<MAX_PICTURE_COUNT; i++){ if(s->picture[i].data[0] && ( s->picture[i].type == FF_BUFFER_TYPE_INTERNAL || s->picture[i].type == FF_BUFFER_TYPE_USER)) free_frame_buffer(s, &s->picture[i]); } s->current_picture_ptr = s->last_picture_ptr = s->next_picture_ptr = NULL; s->mb_x= s->mb_y= 0; s->closed_gop= 0; s->parse_context.state= -1; s->parse_context.frame_start_found= 0; s->parse_context.overread= 0; s->parse_context.overread_index= 0; s->parse_context.index= 0; s->parse_context.last_index= 0; s->bitstream_buffer_size=0; s->pp_time=0; } static void dct_unquantize_mpeg1_intra_c(MpegEncContext *s, DCTELEM *block, int n, int qscale) { int i, level, nCoeffs; const uint16_t *quant_matrix; nCoeffs= s->block_last_index[n]; if (n < 4) block[0] = block[0] * s->y_dc_scale; else block[0] = block[0] * s->c_dc_scale; /* XXX: only mpeg1 */ quant_matrix = s->intra_matrix; for(i=1;i<=nCoeffs;i++) { int j= s->intra_scantable.permutated[i]; level = block[j]; if (level) { if (level < 0) { level = -level; level = (int)(level * qscale * quant_matrix[j]) >> 3; level = (level - 1) | 1; level = -level; } else { level = (int)(level * qscale * quant_matrix[j]) >> 3; level = (level - 1) | 1; } block[j] = level; } } } static void dct_unquantize_mpeg1_inter_c(MpegEncContext *s, DCTELEM *block, int n, int qscale) { int i, level, nCoeffs; const uint16_t *quant_matrix; nCoeffs= s->block_last_index[n]; quant_matrix = s->inter_matrix; for(i=0; i<=nCoeffs; i++) { int j= s->intra_scantable.permutated[i]; level = block[j]; if (level) { if (level < 0) { level = -level; level = (((level << 1) + 1) * qscale * ((int) (quant_matrix[j]))) >> 4; level = (level - 1) | 1; level = -level; } else { level = (((level << 1) + 1) * qscale * ((int) (quant_matrix[j]))) >> 4; level = (level - 1) | 1; } block[j] = level; } } } static void dct_unquantize_mpeg2_intra_c(MpegEncContext *s, DCTELEM *block, int n, int qscale) { int i, level, nCoeffs; const uint16_t *quant_matrix; if(s->alternate_scan) nCoeffs= 63; else nCoeffs= s->block_last_index[n]; if (n < 4) block[0] = block[0] * s->y_dc_scale; else block[0] = block[0] * s->c_dc_scale; quant_matrix = s->intra_matrix; for(i=1;i<=nCoeffs;i++) { int j= s->intra_scantable.permutated[i]; level = block[j]; if (level) { if (level < 0) { level = -level; level = (int)(level * qscale * quant_matrix[j]) >> 3; level = -level; } else { level = (int)(level * qscale * quant_matrix[j]) >> 3; } block[j] = level; } } } static void dct_unquantize_mpeg2_intra_bitexact(MpegEncContext *s, DCTELEM *block, int n, int qscale) { int i, level, nCoeffs; const uint16_t *quant_matrix; int sum=-1; if(s->alternate_scan) nCoeffs= 63; else nCoeffs= s->block_last_index[n]; if (n < 4) block[0] = block[0] * s->y_dc_scale; else block[0] = block[0] * s->c_dc_scale; quant_matrix = s->intra_matrix; for(i=1;i<=nCoeffs;i++) { int j= s->intra_scantable.permutated[i]; level = block[j]; if (level) { if (level < 0) { level = -level; level = (int)(level * qscale * quant_matrix[j]) >> 3; level = -level; } else { level = (int)(level * qscale * quant_matrix[j]) >> 3; } block[j] = level; sum+=level; } } block[63]^=sum&1; } static void dct_unquantize_mpeg2_inter_c(MpegEncContext *s, DCTELEM *block, int n, int qscale) { int i, level, nCoeffs; const uint16_t *quant_matrix; int sum=-1; if(s->alternate_scan) nCoeffs= 63; else nCoeffs= s->block_last_index[n]; quant_matrix = s->inter_matrix; for(i=0; i<=nCoeffs; i++) { int j= s->intra_scantable.permutated[i]; level = block[j]; if (level) { if (level < 0) { level = -level; level = (((level << 1) + 1) * qscale * ((int) (quant_matrix[j]))) >> 4; level = -level; } else { level = (((level << 1) + 1) * qscale * ((int) (quant_matrix[j]))) >> 4; } block[j] = level; sum+=level; } } block[63]^=sum&1; } static void dct_unquantize_h263_intra_c(MpegEncContext *s, DCTELEM *block, int n, int qscale) { int i, level, qmul, qadd; int nCoeffs; assert(s->block_last_index[n]>=0); qmul = qscale << 1; if (!s->h263_aic) { if (n < 4) block[0] = block[0] * s->y_dc_scale; else block[0] = block[0] * s->c_dc_scale; qadd = (qscale - 1) | 1; }else{ qadd = 0; } if(s->ac_pred) nCoeffs=63; else nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ]; for(i=1; i<=nCoeffs; i++) { level = block[i]; if (level) { if (level < 0) { level = level * qmul - qadd; } else { level = level * qmul + qadd; } block[i] = level; } } } static void dct_unquantize_h263_inter_c(MpegEncContext *s, DCTELEM *block, int n, int qscale) { int i, level, qmul, qadd; int nCoeffs; assert(s->block_last_index[n]>=0); qadd = (qscale - 1) | 1; qmul = qscale << 1; nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ]; for(i=0; i<=nCoeffs; i++) { level = block[i]; if (level) { if (level < 0) { level = level * qmul - qadd; } else { level = level * qmul + qadd; } block[i] = level; } } } /** * set qscale and update qscale dependent variables. */ void ff_set_qscale(MpegEncContext * s, int qscale) { if (qscale < 1) qscale = 1; else if (qscale > 31) qscale = 31; s->qscale = qscale; s->chroma_qscale= s->chroma_qscale_table[qscale]; s->y_dc_scale= s->y_dc_scale_table[ qscale ]; s->c_dc_scale= s->c_dc_scale_table[ s->chroma_qscale ]; }
123linslouis-android-video-cutter
jni/libavcodec/mpegvideo.c
C
asf20
94,169
/* * SIPR / ACELP.NET decoder * * Copyright (c) 2008 Vladimir Voroshilov * Copyright (c) 2009 Vitor Sessak * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include <math.h> #include <stdint.h> #include "libavutil/mathematics.h" #include "avcodec.h" #define ALT_BITSTREAM_READER_LE #include "get_bits.h" #include "dsputil.h" #include "lsp.h" #include "celp_math.h" #include "acelp_vectors.h" #include "acelp_pitch_delay.h" #include "acelp_filters.h" #include "celp_filters.h" #define MAX_SUBFRAME_COUNT 5 #include "sipr.h" #include "siprdata.h" typedef struct { const char *mode_name; uint16_t bits_per_frame; uint8_t subframe_count; uint8_t frames_per_packet; float pitch_sharp_factor; /* bitstream parameters */ uint8_t number_of_fc_indexes; uint8_t ma_predictor_bits; ///< size in bits of the switched MA predictor /** size in bits of the i-th stage vector of quantizer */ uint8_t vq_indexes_bits[5]; /** size in bits of the adaptive-codebook index for every subframe */ uint8_t pitch_delay_bits[5]; uint8_t gp_index_bits; uint8_t fc_index_bits[10]; ///< size in bits of the fixed codebook indexes uint8_t gc_index_bits; ///< size in bits of the gain codebook indexes } SiprModeParam; static const SiprModeParam modes[MODE_COUNT] = { [MODE_16k] = { .mode_name = "16k", .bits_per_frame = 160, .subframe_count = SUBFRAME_COUNT_16k, .frames_per_packet = 1, .pitch_sharp_factor = 0.00, .number_of_fc_indexes = 10, .ma_predictor_bits = 1, .vq_indexes_bits = {7, 8, 7, 7, 7}, .pitch_delay_bits = {9, 6}, .gp_index_bits = 4, .fc_index_bits = {4, 5, 4, 5, 4, 5, 4, 5, 4, 5}, .gc_index_bits = 5 }, [MODE_8k5] = { .mode_name = "8k5", .bits_per_frame = 152, .subframe_count = 3, .frames_per_packet = 1, .pitch_sharp_factor = 0.8, .number_of_fc_indexes = 3, .ma_predictor_bits = 0, .vq_indexes_bits = {6, 7, 7, 7, 5}, .pitch_delay_bits = {8, 5, 5}, .gp_index_bits = 0, .fc_index_bits = {9, 9, 9}, .gc_index_bits = 7 }, [MODE_6k5] = { .mode_name = "6k5", .bits_per_frame = 232, .subframe_count = 3, .frames_per_packet = 2, .pitch_sharp_factor = 0.8, .number_of_fc_indexes = 3, .ma_predictor_bits = 0, .vq_indexes_bits = {6, 7, 7, 7, 5}, .pitch_delay_bits = {8, 5, 5}, .gp_index_bits = 0, .fc_index_bits = {5, 5, 5}, .gc_index_bits = 7 }, [MODE_5k0] = { .mode_name = "5k0", .bits_per_frame = 296, .subframe_count = 5, .frames_per_packet = 2, .pitch_sharp_factor = 0.85, .number_of_fc_indexes = 1, .ma_predictor_bits = 0, .vq_indexes_bits = {6, 7, 7, 7, 5}, .pitch_delay_bits = {8, 5, 8, 5, 5}, .gp_index_bits = 0, .fc_index_bits = {10}, .gc_index_bits = 7 } }; const float ff_pow_0_5[] = { 1.0/(1 << 1), 1.0/(1 << 2), 1.0/(1 << 3), 1.0/(1 << 4), 1.0/(1 << 5), 1.0/(1 << 6), 1.0/(1 << 7), 1.0/(1 << 8), 1.0/(1 << 9), 1.0/(1 << 10), 1.0/(1 << 11), 1.0/(1 << 12), 1.0/(1 << 13), 1.0/(1 << 14), 1.0/(1 << 15), 1.0/(1 << 16) }; static void dequant(float *out, const int *idx, const float *cbs[]) { int i; int stride = 2; int num_vec = 5; for (i = 0; i < num_vec; i++) memcpy(out + stride*i, cbs[i] + stride*idx[i], stride*sizeof(float)); } static void lsf_decode_fp(float *lsfnew, float *lsf_history, const SiprParameters *parm) { int i; float lsf_tmp[LP_FILTER_ORDER]; dequant(lsf_tmp, parm->vq_indexes, lsf_codebooks); for (i = 0; i < LP_FILTER_ORDER; i++) lsfnew[i] = lsf_history[i] * 0.33 + lsf_tmp[i] + mean_lsf[i]; ff_sort_nearly_sorted_floats(lsfnew, LP_FILTER_ORDER - 1); /* Note that a minimum distance is not enforced between the last value and the previous one, contrary to what is done in ff_acelp_reorder_lsf() */ ff_set_min_dist_lsf(lsfnew, LSFQ_DIFF_MIN, LP_FILTER_ORDER - 1); lsfnew[9] = FFMIN(lsfnew[LP_FILTER_ORDER - 1], 1.3 * M_PI); memcpy(lsf_history, lsf_tmp, LP_FILTER_ORDER * sizeof(*lsf_history)); for (i = 0; i < LP_FILTER_ORDER - 1; i++) lsfnew[i] = cos(lsfnew[i]); lsfnew[LP_FILTER_ORDER - 1] *= 6.153848 / M_PI; } /** Apply pitch lag to the fixed vector (AMR section 6.1.2). */ static void pitch_sharpening(int pitch_lag_int, float beta, float *fixed_vector) { int i; for (i = pitch_lag_int; i < SUBFR_SIZE; i++) fixed_vector[i] += beta * fixed_vector[i - pitch_lag_int]; } /** * Extracts decoding parameters from the input bitstream. * @param parms parameters structure * @param pgb pointer to initialized GetBitContext structure */ static void decode_parameters(SiprParameters* parms, GetBitContext *pgb, const SiprModeParam *p) { int i, j; parms->ma_pred_switch = get_bits(pgb, p->ma_predictor_bits); for (i = 0; i < 5; i++) parms->vq_indexes[i] = get_bits(pgb, p->vq_indexes_bits[i]); for (i = 0; i < p->subframe_count; i++) { parms->pitch_delay[i] = get_bits(pgb, p->pitch_delay_bits[i]); parms->gp_index[i] = get_bits(pgb, p->gp_index_bits); for (j = 0; j < p->number_of_fc_indexes; j++) parms->fc_indexes[i][j] = get_bits(pgb, p->fc_index_bits[j]); parms->gc_index[i] = get_bits(pgb, p->gc_index_bits); } } static void lsp2lpc_sipr(const double *lsp, float *Az) { int lp_half_order = LP_FILTER_ORDER >> 1; double buf[(LP_FILTER_ORDER >> 1) + 1]; double pa[(LP_FILTER_ORDER >> 1) + 1]; double *qa = buf + 1; int i,j; qa[-1] = 0.0; ff_lsp2polyf(lsp , pa, lp_half_order ); ff_lsp2polyf(lsp + 1, qa, lp_half_order - 1); for (i = 1, j = LP_FILTER_ORDER - 1; i < lp_half_order; i++, j--) { double paf = pa[i] * (1 + lsp[LP_FILTER_ORDER - 1]); double qaf = (qa[i] - qa[i-2]) * (1 - lsp[LP_FILTER_ORDER - 1]); Az[i-1] = (paf + qaf) * 0.5; Az[j-1] = (paf - qaf) * 0.5; } Az[lp_half_order - 1] = (1.0 + lsp[LP_FILTER_ORDER - 1]) * pa[lp_half_order] * 0.5; Az[LP_FILTER_ORDER - 1] = lsp[LP_FILTER_ORDER - 1]; } static void sipr_decode_lp(float *lsfnew, const float *lsfold, float *Az, int num_subfr) { double lsfint[LP_FILTER_ORDER]; int i,j; float t, t0 = 1.0 / num_subfr; t = t0 * 0.5; for (i = 0; i < num_subfr; i++) { for (j = 0; j < LP_FILTER_ORDER; j++) lsfint[j] = lsfold[j] * (1 - t) + t * lsfnew[j]; lsp2lpc_sipr(lsfint, Az); Az += LP_FILTER_ORDER; t += t0; } } /** * Evaluates the adaptive impulse response. */ static void eval_ir(const float *Az, int pitch_lag, float *freq, float pitch_sharp_factor) { float tmp1[SUBFR_SIZE+1], tmp2[LP_FILTER_ORDER+1]; int i; tmp1[0] = 1.; for (i = 0; i < LP_FILTER_ORDER; i++) { tmp1[i+1] = Az[i] * ff_pow_0_55[i]; tmp2[i ] = Az[i] * ff_pow_0_7 [i]; } memset(tmp1 + 11, 0, 37 * sizeof(float)); ff_celp_lp_synthesis_filterf(freq, tmp2, tmp1, SUBFR_SIZE, LP_FILTER_ORDER); pitch_sharpening(pitch_lag, pitch_sharp_factor, freq); } /** * Evaluates the convolution of a vector with a sparse vector. */ static void convolute_with_sparse(float *out, const AMRFixed *pulses, const float *shape, int length) { int i, j; memset(out, 0, length*sizeof(float)); for (i = 0; i < pulses->n; i++) for (j = pulses->x[i]; j < length; j++) out[j] += pulses->y[i] * shape[j - pulses->x[i]]; } /** * Apply postfilter, very similar to AMR one. */ static void postfilter_5k0(SiprContext *ctx, const float *lpc, float *samples) { float buf[SUBFR_SIZE + LP_FILTER_ORDER]; float *pole_out = buf + LP_FILTER_ORDER; float lpc_n[LP_FILTER_ORDER]; float lpc_d[LP_FILTER_ORDER]; int i; for (i = 0; i < LP_FILTER_ORDER; i++) { lpc_d[i] = lpc[i] * ff_pow_0_75[i]; lpc_n[i] = lpc[i] * ff_pow_0_5 [i]; }; memcpy(pole_out - LP_FILTER_ORDER, ctx->postfilter_mem, LP_FILTER_ORDER*sizeof(float)); ff_celp_lp_synthesis_filterf(pole_out, lpc_d, samples, SUBFR_SIZE, LP_FILTER_ORDER); memcpy(ctx->postfilter_mem, pole_out + SUBFR_SIZE - LP_FILTER_ORDER, LP_FILTER_ORDER*sizeof(float)); ff_tilt_compensation(&ctx->tilt_mem, 0.4, pole_out, SUBFR_SIZE); memcpy(pole_out - LP_FILTER_ORDER, ctx->postfilter_mem5k0, LP_FILTER_ORDER*sizeof(*pole_out)); memcpy(ctx->postfilter_mem5k0, pole_out + SUBFR_SIZE - LP_FILTER_ORDER, LP_FILTER_ORDER*sizeof(*pole_out)); ff_celp_lp_zero_synthesis_filterf(samples, lpc_n, pole_out, SUBFR_SIZE, LP_FILTER_ORDER); } static void decode_fixed_sparse(AMRFixed *fixed_sparse, const int16_t *pulses, SiprMode mode, int low_gain) { int i; switch (mode) { case MODE_6k5: for (i = 0; i < 3; i++) { fixed_sparse->x[i] = 3 * (pulses[i] & 0xf) + i; fixed_sparse->y[i] = pulses[i] & 0x10 ? -1 : 1; } fixed_sparse->n = 3; break; case MODE_8k5: for (i = 0; i < 3; i++) { fixed_sparse->x[2*i ] = 3 * ((pulses[i] >> 4) & 0xf) + i; fixed_sparse->x[2*i + 1] = 3 * ( pulses[i] & 0xf) + i; fixed_sparse->y[2*i ] = (pulses[i] & 0x100) ? -1.0: 1.0; fixed_sparse->y[2*i + 1] = (fixed_sparse->x[2*i + 1] < fixed_sparse->x[2*i]) ? -fixed_sparse->y[2*i ] : fixed_sparse->y[2*i]; } fixed_sparse->n = 6; break; case MODE_5k0: default: if (low_gain) { int offset = (pulses[0] & 0x200) ? 2 : 0; int val = pulses[0]; for (i = 0; i < 3; i++) { int index = (val & 0x7) * 6 + 4 - i*2; fixed_sparse->y[i] = (offset + index) & 0x3 ? -1 : 1; fixed_sparse->x[i] = index; val >>= 3; } fixed_sparse->n = 3; } else { int pulse_subset = (pulses[0] >> 8) & 1; fixed_sparse->x[0] = ((pulses[0] >> 4) & 15) * 3 + pulse_subset; fixed_sparse->x[1] = ( pulses[0] & 15) * 3 + pulse_subset + 1; fixed_sparse->y[0] = pulses[0] & 0x200 ? -1 : 1; fixed_sparse->y[1] = -fixed_sparse->y[0]; fixed_sparse->n = 2; } break; } } static void decode_frame(SiprContext *ctx, SiprParameters *params, float *out_data) { int i, j; int subframe_count = modes[ctx->mode].subframe_count; int frame_size = subframe_count * SUBFR_SIZE; float Az[LP_FILTER_ORDER * MAX_SUBFRAME_COUNT]; float *excitation; float ir_buf[SUBFR_SIZE + LP_FILTER_ORDER]; float lsf_new[LP_FILTER_ORDER]; float *impulse_response = ir_buf + LP_FILTER_ORDER; float *synth = ctx->synth_buf + 16; // 16 instead of LP_FILTER_ORDER for // memory alignment int t0_first = 0; AMRFixed fixed_cb; memset(ir_buf, 0, LP_FILTER_ORDER * sizeof(float)); lsf_decode_fp(lsf_new, ctx->lsf_history, params); sipr_decode_lp(lsf_new, ctx->lsp_history, Az, subframe_count); memcpy(ctx->lsp_history, lsf_new, LP_FILTER_ORDER * sizeof(float)); excitation = ctx->excitation + PITCH_DELAY_MAX + L_INTERPOL; for (i = 0; i < subframe_count; i++) { float *pAz = Az + i*LP_FILTER_ORDER; float fixed_vector[SUBFR_SIZE]; int T0,T0_frac; float pitch_gain, gain_code, avg_energy; ff_decode_pitch_lag(&T0, &T0_frac, params->pitch_delay[i], t0_first, i, ctx->mode == MODE_5k0, 6); if (i == 0 || (i == 2 && ctx->mode == MODE_5k0)) t0_first = T0; ff_acelp_interpolatef(excitation, excitation - T0 + (T0_frac <= 0), ff_b60_sinc, 6, 2 * ((2 + T0_frac)%3 + 1), LP_FILTER_ORDER, SUBFR_SIZE); decode_fixed_sparse(&fixed_cb, params->fc_indexes[i], ctx->mode, ctx->past_pitch_gain < 0.8); eval_ir(pAz, T0, impulse_response, modes[ctx->mode].pitch_sharp_factor); convolute_with_sparse(fixed_vector, &fixed_cb, impulse_response, SUBFR_SIZE); avg_energy = (0.01 + ff_dot_productf(fixed_vector, fixed_vector, SUBFR_SIZE))/ SUBFR_SIZE; ctx->past_pitch_gain = pitch_gain = gain_cb[params->gc_index[i]][0]; gain_code = ff_amr_set_fixed_gain(gain_cb[params->gc_index[i]][1], avg_energy, ctx->energy_history, 34 - 15.0/(0.05*M_LN10/M_LN2), pred); ff_weighted_vector_sumf(excitation, excitation, fixed_vector, pitch_gain, gain_code, SUBFR_SIZE); pitch_gain *= 0.5 * pitch_gain; pitch_gain = FFMIN(pitch_gain, 0.4); ctx->gain_mem = 0.7 * ctx->gain_mem + 0.3 * pitch_gain; ctx->gain_mem = FFMIN(ctx->gain_mem, pitch_gain); gain_code *= ctx->gain_mem; for (j = 0; j < SUBFR_SIZE; j++) fixed_vector[j] = excitation[j] - gain_code * fixed_vector[j]; if (ctx->mode == MODE_5k0) { postfilter_5k0(ctx, pAz, fixed_vector); ff_celp_lp_synthesis_filterf(ctx->postfilter_syn5k0 + LP_FILTER_ORDER + i*SUBFR_SIZE, pAz, excitation, SUBFR_SIZE, LP_FILTER_ORDER); } ff_celp_lp_synthesis_filterf(synth + i*SUBFR_SIZE, pAz, fixed_vector, SUBFR_SIZE, LP_FILTER_ORDER); excitation += SUBFR_SIZE; } memcpy(synth - LP_FILTER_ORDER, synth + frame_size - LP_FILTER_ORDER, LP_FILTER_ORDER * sizeof(float)); if (ctx->mode == MODE_5k0) { for (i = 0; i < subframe_count; i++) { float energy = ff_dot_productf(ctx->postfilter_syn5k0 + LP_FILTER_ORDER + i*SUBFR_SIZE, ctx->postfilter_syn5k0 + LP_FILTER_ORDER + i*SUBFR_SIZE, SUBFR_SIZE); ff_adaptive_gain_control(&synth[i * SUBFR_SIZE], &synth[i * SUBFR_SIZE], energy, SUBFR_SIZE, 0.9, &ctx->postfilter_agc); } memcpy(ctx->postfilter_syn5k0, ctx->postfilter_syn5k0 + frame_size, LP_FILTER_ORDER*sizeof(float)); } memcpy(ctx->excitation, excitation - PITCH_DELAY_MAX - L_INTERPOL, (PITCH_DELAY_MAX + L_INTERPOL) * sizeof(float)); ff_acelp_apply_order_2_transfer_function(out_data, synth, (const float[2]) {-1.99997 , 1.000000000}, (const float[2]) {-1.93307352, 0.935891986}, 0.939805806, ctx->highpass_filt_mem, frame_size); } static av_cold int sipr_decoder_init(AVCodecContext * avctx) { SiprContext *ctx = avctx->priv_data; int i; if (avctx->bit_rate > 12200) ctx->mode = MODE_16k; else if (avctx->bit_rate > 7500 ) ctx->mode = MODE_8k5; else if (avctx->bit_rate > 5750 ) ctx->mode = MODE_6k5; else ctx->mode = MODE_5k0; av_log(avctx, AV_LOG_DEBUG, "Mode: %s\n", modes[ctx->mode].mode_name); if (ctx->mode == MODE_16k) ff_sipr_init_16k(ctx); for (i = 0; i < LP_FILTER_ORDER; i++) ctx->lsp_history[i] = cos((i+1) * M_PI / (LP_FILTER_ORDER + 1)); for (i = 0; i < 4; i++) ctx->energy_history[i] = -14; avctx->sample_fmt = SAMPLE_FMT_FLT; dsputil_init(&ctx->dsp, avctx); return 0; } static int sipr_decode_frame(AVCodecContext *avctx, void *datap, int *data_size, AVPacket *avpkt) { SiprContext *ctx = avctx->priv_data; const uint8_t *buf=avpkt->data; SiprParameters parm; const SiprModeParam *mode_par = &modes[ctx->mode]; GetBitContext gb; float *data = datap; int subframe_size = ctx->mode == MODE_16k ? L_SUBFR_16k : SUBFR_SIZE; int i; ctx->avctx = avctx; if (avpkt->size < (mode_par->bits_per_frame >> 3)) { av_log(avctx, AV_LOG_ERROR, "Error processing packet: packet size (%d) too small\n", avpkt->size); *data_size = 0; return -1; } if (*data_size < subframe_size * mode_par->subframe_count * sizeof(float)) { av_log(avctx, AV_LOG_ERROR, "Error processing packet: output buffer (%d) too small\n", *data_size); *data_size = 0; return -1; } init_get_bits(&gb, buf, mode_par->bits_per_frame); for (i = 0; i < mode_par->frames_per_packet; i++) { decode_parameters(&parm, &gb, mode_par); if (ctx->mode == MODE_16k) ff_sipr_decode_frame_16k(ctx, &parm, data); else decode_frame(ctx, &parm, data); data += subframe_size * mode_par->subframe_count; } *data_size = mode_par->frames_per_packet * subframe_size * mode_par->subframe_count * sizeof(float); return mode_par->bits_per_frame >> 3; }; AVCodec sipr_decoder = { "sipr", AVMEDIA_TYPE_AUDIO, CODEC_ID_SIPR, sizeof(SiprContext), sipr_decoder_init, NULL, NULL, sipr_decode_frame, .long_name = NULL_IF_CONFIG_SMALL("RealAudio SIPR / ACELP.NET"), };
123linslouis-android-video-cutter
jni/libavcodec/sipr.c
C
asf20
19,200
/* * H.264 encoder * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "libavutil/common.h" #include "get_bits.h" #include "mpegvideo.h" #include "h264data.h" /** * Write out the provided data into a NAL unit. * @param nal_ref_idc NAL reference IDC * @param nal_unit_type NAL unit payload type * @param dest the target buffer, dst+1 == src is allowed as a special case * @param destsize the length of the dst array * @param b2 the data which should be escaped * @return pointer to current position in the output buffer or NULL if an error occurred */ static uint8_t *h264_write_nal_unit(int nal_ref_idc, int nal_unit_type, uint8_t *dest, int *destsize, PutBitContext *b2) { PutBitContext b; int i, destpos, rbsplen, escape_count; uint8_t *rbsp; if (nal_unit_type != NAL_END_STREAM) put_bits(b2,1,1); // rbsp_stop_bit // Align b2 on a byte boundary align_put_bits(b2); rbsplen = put_bits_count(b2)/8; flush_put_bits(b2); rbsp = b2->buf; init_put_bits(&b,dest,*destsize); put_bits(&b,16,0); put_bits(&b,16,0x01); put_bits(&b,1,0); // forbidden zero bit put_bits(&b,2,nal_ref_idc); // nal_ref_idc put_bits(&b,5,nal_unit_type); // nal_unit_type flush_put_bits(&b); destpos = 5; escape_count= 0; for (i=0; i<rbsplen; i+=2) { if (rbsp[i]) continue; if (i>0 && rbsp[i-1]==0) i--; if (i+2<rbsplen && rbsp[i+1]==0 && rbsp[i+2]<=3) { escape_count++; i+=2; } } if(escape_count==0) { if(dest+destpos != rbsp) { memcpy(dest+destpos, rbsp, rbsplen); *destsize -= (rbsplen+destpos); } return dest+rbsplen+destpos; } if(rbsplen + escape_count + 1> *destsize) { av_log(NULL, AV_LOG_ERROR, "Destination buffer too small!\n"); return NULL; } // this should be damn rare (hopefully) for (i = 0 ; i < rbsplen ; i++) { if (i + 2 < rbsplen && (rbsp[i] == 0 && rbsp[i+1] == 0 && rbsp[i+2] < 4)) { dest[destpos++] = rbsp[i++]; dest[destpos++] = rbsp[i]; dest[destpos++] = 0x03; // emulation prevention byte } else dest[destpos++] = rbsp[i]; } *destsize -= destpos; return dest+destpos; } static const uint8_t pict_type_to_golomb[7] = {-1, 2, 0, 1, -1, 4, 3}; static const uint8_t intra4x4_cbp_to_golomb[48] = { 3, 29, 30, 17, 31, 18, 37, 8, 32, 38, 19, 9, 20, 10, 11, 2, 16, 33, 34, 21, 35, 22, 39, 4, 36, 40, 23, 5, 24, 6, 7, 1, 41, 42, 43, 25, 44, 26, 46, 12, 45, 47, 27, 13, 28, 14, 15, 0 }; static const uint8_t inter_cbp_to_golomb[48] = { 0, 2, 3, 7, 4, 8, 17, 13, 5, 18, 9, 14, 10, 15, 16, 11, 1, 32, 33, 36, 34, 37, 44, 40, 35, 45, 38, 41, 39, 42, 43, 19, 6, 24, 25, 20, 26, 21, 46, 28, 27, 47, 22, 29, 23, 30, 31, 12 }; #define QUANT_SHIFT 22 static const int quant_coeff[52][16] = { { 419430, 258111, 419430, 258111, 258111, 167772, 258111, 167772, 419430, 258111, 419430, 258111, 258111, 167772, 258111, 167772,}, { 381300, 239675, 381300, 239675, 239675, 149131, 239675, 149131, 381300, 239675, 381300, 239675, 239675, 149131, 239675, 149131,}, { 322639, 209715, 322639, 209715, 209715, 134218, 209715, 134218, 322639, 209715, 322639, 209715, 209715, 134218, 209715, 134218,}, { 299593, 186414, 299593, 186414, 186414, 116711, 186414, 116711, 299593, 186414, 299593, 186414, 186414, 116711, 186414, 116711,}, { 262144, 167772, 262144, 167772, 167772, 107374, 167772, 107374, 262144, 167772, 262144, 167772, 167772, 107374, 167772, 107374,}, { 233017, 145889, 233017, 145889, 145889, 92564, 145889, 92564, 233017, 145889, 233017, 145889, 145889, 92564, 145889, 92564,}, { 209715, 129056, 209715, 129056, 129056, 83886, 129056, 83886, 209715, 129056, 209715, 129056, 129056, 83886, 129056, 83886,}, { 190650, 119837, 190650, 119837, 119837, 74565, 119837, 74565, 190650, 119837, 190650, 119837, 119837, 74565, 119837, 74565,}, { 161319, 104858, 161319, 104858, 104858, 67109, 104858, 67109, 161319, 104858, 161319, 104858, 104858, 67109, 104858, 67109,}, { 149797, 93207, 149797, 93207, 93207, 58356, 93207, 58356, 149797, 93207, 149797, 93207, 93207, 58356, 93207, 58356,}, { 131072, 83886, 131072, 83886, 83886, 53687, 83886, 53687, 131072, 83886, 131072, 83886, 83886, 53687, 83886, 53687,}, { 116508, 72944, 116508, 72944, 72944, 46282, 72944, 46282, 116508, 72944, 116508, 72944, 72944, 46282, 72944, 46282,}, { 104858, 64528, 104858, 64528, 64528, 41943, 64528, 41943, 104858, 64528, 104858, 64528, 64528, 41943, 64528, 41943,}, { 95325, 59919, 95325, 59919, 59919, 37283, 59919, 37283, 95325, 59919, 95325, 59919, 59919, 37283, 59919, 37283,}, { 80660, 52429, 80660, 52429, 52429, 33554, 52429, 33554, 80660, 52429, 80660, 52429, 52429, 33554, 52429, 33554,}, { 74898, 46603, 74898, 46603, 46603, 29178, 46603, 29178, 74898, 46603, 74898, 46603, 46603, 29178, 46603, 29178,}, { 65536, 41943, 65536, 41943, 41943, 26844, 41943, 26844, 65536, 41943, 65536, 41943, 41943, 26844, 41943, 26844,}, { 58254, 36472, 58254, 36472, 36472, 23141, 36472, 23141, 58254, 36472, 58254, 36472, 36472, 23141, 36472, 23141,}, { 52429, 32264, 52429, 32264, 32264, 20972, 32264, 20972, 52429, 32264, 52429, 32264, 32264, 20972, 32264, 20972,}, { 47663, 29959, 47663, 29959, 29959, 18641, 29959, 18641, 47663, 29959, 47663, 29959, 29959, 18641, 29959, 18641,}, { 40330, 26214, 40330, 26214, 26214, 16777, 26214, 16777, 40330, 26214, 40330, 26214, 26214, 16777, 26214, 16777,}, { 37449, 23302, 37449, 23302, 23302, 14589, 23302, 14589, 37449, 23302, 37449, 23302, 23302, 14589, 23302, 14589,}, { 32768, 20972, 32768, 20972, 20972, 13422, 20972, 13422, 32768, 20972, 32768, 20972, 20972, 13422, 20972, 13422,}, { 29127, 18236, 29127, 18236, 18236, 11570, 18236, 11570, 29127, 18236, 29127, 18236, 18236, 11570, 18236, 11570,}, { 26214, 16132, 26214, 16132, 16132, 10486, 16132, 10486, 26214, 16132, 26214, 16132, 16132, 10486, 16132, 10486,}, { 23831, 14980, 23831, 14980, 14980, 9321, 14980, 9321, 23831, 14980, 23831, 14980, 14980, 9321, 14980, 9321,}, { 20165, 13107, 20165, 13107, 13107, 8389, 13107, 8389, 20165, 13107, 20165, 13107, 13107, 8389, 13107, 8389,}, { 18725, 11651, 18725, 11651, 11651, 7294, 11651, 7294, 18725, 11651, 18725, 11651, 11651, 7294, 11651, 7294,}, { 16384, 10486, 16384, 10486, 10486, 6711, 10486, 6711, 16384, 10486, 16384, 10486, 10486, 6711, 10486, 6711,}, { 14564, 9118, 14564, 9118, 9118, 5785, 9118, 5785, 14564, 9118, 14564, 9118, 9118, 5785, 9118, 5785,}, { 13107, 8066, 13107, 8066, 8066, 5243, 8066, 5243, 13107, 8066, 13107, 8066, 8066, 5243, 8066, 5243,}, { 11916, 7490, 11916, 7490, 7490, 4660, 7490, 4660, 11916, 7490, 11916, 7490, 7490, 4660, 7490, 4660,}, { 10082, 6554, 10082, 6554, 6554, 4194, 6554, 4194, 10082, 6554, 10082, 6554, 6554, 4194, 6554, 4194,}, { 9362, 5825, 9362, 5825, 5825, 3647, 5825, 3647, 9362, 5825, 9362, 5825, 5825, 3647, 5825, 3647,}, { 8192, 5243, 8192, 5243, 5243, 3355, 5243, 3355, 8192, 5243, 8192, 5243, 5243, 3355, 5243, 3355,}, { 7282, 4559, 7282, 4559, 4559, 2893, 4559, 2893, 7282, 4559, 7282, 4559, 4559, 2893, 4559, 2893,}, { 6554, 4033, 6554, 4033, 4033, 2621, 4033, 2621, 6554, 4033, 6554, 4033, 4033, 2621, 4033, 2621,}, { 5958, 3745, 5958, 3745, 3745, 2330, 3745, 2330, 5958, 3745, 5958, 3745, 3745, 2330, 3745, 2330,}, { 5041, 3277, 5041, 3277, 3277, 2097, 3277, 2097, 5041, 3277, 5041, 3277, 3277, 2097, 3277, 2097,}, { 4681, 2913, 4681, 2913, 2913, 1824, 2913, 1824, 4681, 2913, 4681, 2913, 2913, 1824, 2913, 1824,}, { 4096, 2621, 4096, 2621, 2621, 1678, 2621, 1678, 4096, 2621, 4096, 2621, 2621, 1678, 2621, 1678,}, { 3641, 2280, 3641, 2280, 2280, 1446, 2280, 1446, 3641, 2280, 3641, 2280, 2280, 1446, 2280, 1446,}, { 3277, 2016, 3277, 2016, 2016, 1311, 2016, 1311, 3277, 2016, 3277, 2016, 2016, 1311, 2016, 1311,}, { 2979, 1872, 2979, 1872, 1872, 1165, 1872, 1165, 2979, 1872, 2979, 1872, 1872, 1165, 1872, 1165,}, { 2521, 1638, 2521, 1638, 1638, 1049, 1638, 1049, 2521, 1638, 2521, 1638, 1638, 1049, 1638, 1049,}, { 2341, 1456, 2341, 1456, 1456, 912, 1456, 912, 2341, 1456, 2341, 1456, 1456, 912, 1456, 912,}, { 2048, 1311, 2048, 1311, 1311, 839, 1311, 839, 2048, 1311, 2048, 1311, 1311, 839, 1311, 839,}, { 1820, 1140, 1820, 1140, 1140, 723, 1140, 723, 1820, 1140, 1820, 1140, 1140, 723, 1140, 723,}, { 1638, 1008, 1638, 1008, 1008, 655, 1008, 655, 1638, 1008, 1638, 1008, 1008, 655, 1008, 655,}, { 1489, 936, 1489, 936, 936, 583, 936, 583, 1489, 936, 1489, 936, 936, 583, 936, 583,}, { 1260, 819, 1260, 819, 819, 524, 819, 524, 1260, 819, 1260, 819, 819, 524, 819, 524,}, { 1170, 728, 1170, 728, 728, 456, 728, 456, 1170, 728, 1170, 728, 728, 456, 728, 456,}, }; //FIXME need to check that this does not overflow signed 32 bit for low qp, I am not sure, it's very close //FIXME check that gcc inlines this (and optimizes intra & separate_dc stuff away) static inline int quantize_c(DCTELEM *block, uint8_t *scantable, int qscale, int intra, int separate_dc) { int i; const int * const quant_table = quant_coeff[qscale]; const int bias = intra ? (1 << QUANT_SHIFT) / 3 : (1 << QUANT_SHIFT) / 6; const unsigned int threshold1 = (1 << QUANT_SHIFT) - bias - 1; const unsigned int threshold2 = (threshold1 << 1); int last_non_zero; if (separate_dc) { if (qscale <= 18) { //avoid overflows const int dc_bias = intra ? (1 << (QUANT_SHIFT - 2)) / 3 : (1 << (QUANT_SHIFT - 2)) / 6; const unsigned int dc_threshold1 = (1 << (QUANT_SHIFT - 2)) - dc_bias - 1; const unsigned int dc_threshold2 = (dc_threshold1 << 1); int level = block[0]*quant_coeff[qscale+18][0]; if (((unsigned)(level + dc_threshold1)) > dc_threshold2) { if (level > 0) { level = (dc_bias + level) >> (QUANT_SHIFT - 2); block[0] = level; } else { level = (dc_bias - level) >> (QUANT_SHIFT - 2); block[0] = -level; } // last_non_zero = i; } else { block[0] = 0; } } else { const int dc_bias = intra ? (1 << (QUANT_SHIFT + 1)) / 3 : (1 << (QUANT_SHIFT + 1)) / 6; const unsigned int dc_threshold1 = (1 << (QUANT_SHIFT + 1)) - dc_bias - 1; const unsigned int dc_threshold2 = (dc_threshold1 << 1); int level = block[0]*quant_table[0]; if (((unsigned)(level + dc_threshold1)) > dc_threshold2) { if (level > 0) { level = (dc_bias + level) >> (QUANT_SHIFT + 1); block[0] = level; } else { level = (dc_bias - level) >> (QUANT_SHIFT + 1); block[0] = -level; } // last_non_zero = i; } else { block[0] = 0; } } last_non_zero = 0; i = 1; } else { last_non_zero = -1; i = 0; } for (; i < 16; i++) { const int j = scantable[i]; int level = block[j]*quant_table[j]; // if ( bias+level >= (1 << (QMAT_SHIFT - 3)) // || bias-level >= (1 << (QMAT_SHIFT - 3))) { if (((unsigned)(level + threshold1)) > threshold2) { if (level > 0) { level = (bias + level) >> QUANT_SHIFT; block[j] = level; } else { level = (bias - level) >> QUANT_SHIFT; block[j] = -level; } last_non_zero = i; } else { block[j] = 0; } } return last_non_zero; }
123linslouis-android-video-cutter
jni/libavcodec/h264enc.c
C
asf20
13,847
/* * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avcodec.h" static AVBitStreamFilter *first_bitstream_filter= NULL; AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f){ if(f) return f->next; else return first_bitstream_filter; } void av_register_bitstream_filter(AVBitStreamFilter *bsf){ bsf->next = first_bitstream_filter; first_bitstream_filter= bsf; } AVBitStreamFilterContext *av_bitstream_filter_init(const char *name){ AVBitStreamFilter *bsf= first_bitstream_filter; while(bsf){ if(!strcmp(name, bsf->name)){ AVBitStreamFilterContext *bsfc= av_mallocz(sizeof(AVBitStreamFilterContext)); bsfc->filter= bsf; bsfc->priv_data= av_mallocz(bsf->priv_data_size); return bsfc; } bsf= bsf->next; } return NULL; } void av_bitstream_filter_close(AVBitStreamFilterContext *bsfc){ if(bsfc->filter->close) bsfc->filter->close(bsfc); av_freep(&bsfc->priv_data); av_parser_close(bsfc->parser); av_free(bsfc); } int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args, uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int keyframe){ *poutbuf= (uint8_t *) buf; *poutbuf_size= buf_size; return bsfc->filter->filter(bsfc, avctx, args, poutbuf, poutbuf_size, buf, buf_size, keyframe); }
123linslouis-android-video-cutter
jni/libavcodec/bitstream_filter.c
C
asf20
2,266
/* * Motion estimation * Copyright (c) 2000,2001 Fabrice Bellard * Copyright (c) 2002-2004 Michael Niedermayer * * new motion estimation (X1/EPZS) by Michael Niedermayer <michaelni@gmx.at> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * Motion estimation. */ #include <stdlib.h> #include <stdio.h> #include <limits.h> #include "libavutil/intmath.h" #include "avcodec.h" #include "dsputil.h" #include "mathops.h" #include "mpegvideo.h" #undef NDEBUG #include <assert.h> #define SQ(a) ((a)*(a)) #define P_LEFT P[1] #define P_TOP P[2] #define P_TOPRIGHT P[3] #define P_MEDIAN P[4] #define P_MV1 P[9] static inline int sad_hpel_motion_search(MpegEncContext * s, int *mx_ptr, int *my_ptr, int dmin, int src_index, int ref_index, int size, int h); static inline int update_map_generation(MotionEstContext *c) { c->map_generation+= 1<<(ME_MAP_MV_BITS*2); if(c->map_generation==0){ c->map_generation= 1<<(ME_MAP_MV_BITS*2); memset(c->map, 0, sizeof(uint32_t)*ME_MAP_SIZE); } return c->map_generation; } /* shape adaptive search stuff */ typedef struct Minima{ int height; int x, y; int checked; }Minima; static int minima_cmp(const void *a, const void *b){ const Minima *da = (const Minima *) a; const Minima *db = (const Minima *) b; return da->height - db->height; } #define FLAG_QPEL 1 //must be 1 #define FLAG_CHROMA 2 #define FLAG_DIRECT 4 static inline void init_ref(MotionEstContext *c, uint8_t *src[3], uint8_t *ref[3], uint8_t *ref2[3], int x, int y, int ref_index){ const int offset[3]= { y*c-> stride + x, ((y*c->uvstride + x)>>1), ((y*c->uvstride + x)>>1), }; int i; for(i=0; i<3; i++){ c->src[0][i]= src [i] + offset[i]; c->ref[0][i]= ref [i] + offset[i]; } if(ref_index){ for(i=0; i<3; i++){ c->ref[ref_index][i]= ref2[i] + offset[i]; } } } static int get_flags(MotionEstContext *c, int direct, int chroma){ return ((c->avctx->flags&CODEC_FLAG_QPEL) ? FLAG_QPEL : 0) + (direct ? FLAG_DIRECT : 0) + (chroma ? FLAG_CHROMA : 0); } static av_always_inline int cmp_direct_inline(MpegEncContext *s, const int x, const int y, const int subx, const int suby, const int size, const int h, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, int qpel){ MotionEstContext * const c= &s->me; const int stride= c->stride; const int hx= subx + (x<<(1+qpel)); const int hy= suby + (y<<(1+qpel)); uint8_t * const * const ref= c->ref[ref_index]; uint8_t * const * const src= c->src[src_index]; int d; //FIXME check chroma 4mv, (no crashes ...) assert(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)); if(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)){ const int time_pp= s->pp_time; const int time_pb= s->pb_time; const int mask= 2*qpel+1; if(s->mv_type==MV_TYPE_8X8){ int i; for(i=0; i<4; i++){ int fx = c->direct_basis_mv[i][0] + hx; int fy = c->direct_basis_mv[i][1] + hy; int bx = hx ? fx - c->co_located_mv[i][0] : c->co_located_mv[i][0]*(time_pb - time_pp)/time_pp + ((i &1)<<(qpel+4)); int by = hy ? fy - c->co_located_mv[i][1] : c->co_located_mv[i][1]*(time_pb - time_pp)/time_pp + ((i>>1)<<(qpel+4)); int fxy= (fx&mask) + ((fy&mask)<<(qpel+1)); int bxy= (bx&mask) + ((by&mask)<<(qpel+1)); uint8_t *dst= c->temp + 8*(i&1) + 8*stride*(i>>1); if(qpel){ c->qpel_put[1][fxy](dst, ref[0] + (fx>>2) + (fy>>2)*stride, stride); c->qpel_avg[1][bxy](dst, ref[8] + (bx>>2) + (by>>2)*stride, stride); }else{ c->hpel_put[1][fxy](dst, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 8); c->hpel_avg[1][bxy](dst, ref[8] + (bx>>1) + (by>>1)*stride, stride, 8); } } }else{ int fx = c->direct_basis_mv[0][0] + hx; int fy = c->direct_basis_mv[0][1] + hy; int bx = hx ? fx - c->co_located_mv[0][0] : (c->co_located_mv[0][0]*(time_pb - time_pp)/time_pp); int by = hy ? fy - c->co_located_mv[0][1] : (c->co_located_mv[0][1]*(time_pb - time_pp)/time_pp); int fxy= (fx&mask) + ((fy&mask)<<(qpel+1)); int bxy= (bx&mask) + ((by&mask)<<(qpel+1)); if(qpel){ c->qpel_put[1][fxy](c->temp , ref[0] + (fx>>2) + (fy>>2)*stride , stride); c->qpel_put[1][fxy](c->temp + 8 , ref[0] + (fx>>2) + (fy>>2)*stride + 8 , stride); c->qpel_put[1][fxy](c->temp + 8*stride, ref[0] + (fx>>2) + (fy>>2)*stride + 8*stride, stride); c->qpel_put[1][fxy](c->temp + 8 + 8*stride, ref[0] + (fx>>2) + (fy>>2)*stride + 8 + 8*stride, stride); c->qpel_avg[1][bxy](c->temp , ref[8] + (bx>>2) + (by>>2)*stride , stride); c->qpel_avg[1][bxy](c->temp + 8 , ref[8] + (bx>>2) + (by>>2)*stride + 8 , stride); c->qpel_avg[1][bxy](c->temp + 8*stride, ref[8] + (bx>>2) + (by>>2)*stride + 8*stride, stride); c->qpel_avg[1][bxy](c->temp + 8 + 8*stride, ref[8] + (bx>>2) + (by>>2)*stride + 8 + 8*stride, stride); }else{ assert((fx>>1) + 16*s->mb_x >= -16); assert((fy>>1) + 16*s->mb_y >= -16); assert((fx>>1) + 16*s->mb_x <= s->width); assert((fy>>1) + 16*s->mb_y <= s->height); assert((bx>>1) + 16*s->mb_x >= -16); assert((by>>1) + 16*s->mb_y >= -16); assert((bx>>1) + 16*s->mb_x <= s->width); assert((by>>1) + 16*s->mb_y <= s->height); c->hpel_put[0][fxy](c->temp, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 16); c->hpel_avg[0][bxy](c->temp, ref[8] + (bx>>1) + (by>>1)*stride, stride, 16); } } d = cmp_func(s, c->temp, src[0], stride, 16); }else d= 256*256*256*32; return d; } static av_always_inline int cmp_inline(MpegEncContext *s, const int x, const int y, const int subx, const int suby, const int size, const int h, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, int qpel, int chroma){ MotionEstContext * const c= &s->me; const int stride= c->stride; const int uvstride= c->uvstride; const int dxy= subx + (suby<<(1+qpel)); //FIXME log2_subpel? const int hx= subx + (x<<(1+qpel)); const int hy= suby + (y<<(1+qpel)); uint8_t * const * const ref= c->ref[ref_index]; uint8_t * const * const src= c->src[src_index]; int d; //FIXME check chroma 4mv, (no crashes ...) int uvdxy; /* no, it might not be used uninitialized */ if(dxy){ if(qpel){ c->qpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride); //FIXME prototype (add h) if(chroma){ int cx= hx/2; int cy= hy/2; cx= (cx>>1)|(cx&1); cy= (cy>>1)|(cy&1); uvdxy= (cx&1) + 2*(cy&1); //FIXME x/y wrong, but mpeg4 qpel is sick anyway, we should drop as much of it as possible in favor for h264 } }else{ c->hpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride, h); if(chroma) uvdxy= dxy | (x&1) | (2*(y&1)); } d = cmp_func(s, c->temp, src[0], stride, h); }else{ d = cmp_func(s, src[0], ref[0] + x + y*stride, stride, h); if(chroma) uvdxy= (x&1) + 2*(y&1); } if(chroma){ uint8_t * const uvtemp= c->temp + 16*stride; c->hpel_put[size+1][uvdxy](uvtemp , ref[1] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1); c->hpel_put[size+1][uvdxy](uvtemp+8, ref[2] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1); d += chroma_cmp_func(s, uvtemp , src[1], uvstride, h>>1); d += chroma_cmp_func(s, uvtemp+8, src[2], uvstride, h>>1); } return d; } static int cmp_simple(MpegEncContext *s, const int x, const int y, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func){ return cmp_inline(s,x,y,0,0,0,16,ref_index,src_index, cmp_func, chroma_cmp_func, 0, 0); } static int cmp_fpel_internal(MpegEncContext *s, const int x, const int y, const int size, const int h, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ if(flags&FLAG_DIRECT){ return cmp_direct_inline(s,x,y,0,0,size,h,ref_index,src_index, cmp_func, chroma_cmp_func, flags&FLAG_QPEL); }else{ return cmp_inline(s,x,y,0,0,size,h,ref_index,src_index, cmp_func, chroma_cmp_func, 0, flags&FLAG_CHROMA); } } static int cmp_internal(MpegEncContext *s, const int x, const int y, const int subx, const int suby, const int size, const int h, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ if(flags&FLAG_DIRECT){ return cmp_direct_inline(s,x,y,subx,suby,size,h,ref_index,src_index, cmp_func, chroma_cmp_func, flags&FLAG_QPEL); }else{ return cmp_inline(s,x,y,subx,suby,size,h,ref_index,src_index, cmp_func, chroma_cmp_func, flags&FLAG_QPEL, flags&FLAG_CHROMA); } } /*! \brief compares a block (either a full macroblock or a partition thereof) against a proposed motion-compensated prediction of that block */ static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, const int size, const int h, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ if(av_builtin_constant_p(flags) && av_builtin_constant_p(h) && av_builtin_constant_p(size) && av_builtin_constant_p(subx) && av_builtin_constant_p(suby) && flags==0 && h==16 && size==0 && subx==0 && suby==0){ return cmp_simple(s,x,y,ref_index,src_index, cmp_func, chroma_cmp_func); }else if(av_builtin_constant_p(subx) && av_builtin_constant_p(suby) && subx==0 && suby==0){ return cmp_fpel_internal(s,x,y,size,h,ref_index,src_index, cmp_func, chroma_cmp_func,flags); }else{ return cmp_internal(s,x,y,subx,suby,size,h,ref_index,src_index, cmp_func, chroma_cmp_func, flags); } } static int cmp_hpel(MpegEncContext *s, const int x, const int y, const int subx, const int suby, const int size, const int h, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ if(flags&FLAG_DIRECT){ return cmp_direct_inline(s,x,y,subx,suby,size,h,ref_index,src_index, cmp_func, chroma_cmp_func, 0); }else{ return cmp_inline(s,x,y,subx,suby,size,h,ref_index,src_index, cmp_func, chroma_cmp_func, 0, flags&FLAG_CHROMA); } } static int cmp_qpel(MpegEncContext *s, const int x, const int y, const int subx, const int suby, const int size, const int h, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ if(flags&FLAG_DIRECT){ return cmp_direct_inline(s,x,y,subx,suby,size,h,ref_index,src_index, cmp_func, chroma_cmp_func, 1); }else{ return cmp_inline(s,x,y,subx,suby,size,h,ref_index,src_index, cmp_func, chroma_cmp_func, 1, flags&FLAG_CHROMA); } } #include "motion_est_template.c" static int zero_cmp(void *s, uint8_t *a, uint8_t *b, int stride, int h){ return 0; } static void zero_hpel(uint8_t *a, const uint8_t *b, int stride, int h){ } int ff_init_me(MpegEncContext *s){ MotionEstContext * const c= &s->me; int cache_size= FFMIN(ME_MAP_SIZE>>ME_MAP_SHIFT, 1<<ME_MAP_SHIFT); int dia_size= FFMAX(FFABS(s->avctx->dia_size)&255, FFABS(s->avctx->pre_dia_size)&255); if(FFMIN(s->avctx->dia_size, s->avctx->pre_dia_size) < -ME_MAP_SIZE){ av_log(s->avctx, AV_LOG_ERROR, "ME_MAP size is too small for SAB diamond\n"); return -1; } //special case of snow is needed because snow uses its own iterative ME code if(s->me_method!=ME_ZERO && s->me_method!=ME_EPZS && s->me_method!=ME_X1 && s->avctx->codec_id != CODEC_ID_SNOW){ av_log(s->avctx, AV_LOG_ERROR, "me_method is only allowed to be set to zero and epzs; for hex,umh,full and others see dia_size\n"); return -1; } c->avctx= s->avctx; if(cache_size < 2*dia_size && !c->stride){ av_log(s->avctx, AV_LOG_INFO, "ME_MAP size may be a little small for the selected diamond size\n"); } ff_set_cmp(&s->dsp, s->dsp.me_pre_cmp, c->avctx->me_pre_cmp); ff_set_cmp(&s->dsp, s->dsp.me_cmp, c->avctx->me_cmp); ff_set_cmp(&s->dsp, s->dsp.me_sub_cmp, c->avctx->me_sub_cmp); ff_set_cmp(&s->dsp, s->dsp.mb_cmp, c->avctx->mb_cmp); c->flags = get_flags(c, 0, c->avctx->me_cmp &FF_CMP_CHROMA); c->sub_flags= get_flags(c, 0, c->avctx->me_sub_cmp&FF_CMP_CHROMA); c->mb_flags = get_flags(c, 0, c->avctx->mb_cmp &FF_CMP_CHROMA); /*FIXME s->no_rounding b_type*/ if(s->flags&CODEC_FLAG_QPEL){ c->sub_motion_search= qpel_motion_search; c->qpel_avg= s->dsp.avg_qpel_pixels_tab; if(s->no_rounding) c->qpel_put= s->dsp.put_no_rnd_qpel_pixels_tab; else c->qpel_put= s->dsp.put_qpel_pixels_tab; }else{ if(c->avctx->me_sub_cmp&FF_CMP_CHROMA) c->sub_motion_search= hpel_motion_search; else if( c->avctx->me_sub_cmp == FF_CMP_SAD && c->avctx-> me_cmp == FF_CMP_SAD && c->avctx-> mb_cmp == FF_CMP_SAD) c->sub_motion_search= sad_hpel_motion_search; // 2050 vs. 2450 cycles else c->sub_motion_search= hpel_motion_search; } c->hpel_avg= s->dsp.avg_pixels_tab; if(s->no_rounding) c->hpel_put= s->dsp.put_no_rnd_pixels_tab; else c->hpel_put= s->dsp.put_pixels_tab; if(s->linesize){ c->stride = s->linesize; c->uvstride= s->uvlinesize; }else{ c->stride = 16*s->mb_width + 32; c->uvstride= 8*s->mb_width + 16; } /* 8x8 fullpel search would need a 4x4 chroma compare, which we do * not have yet, and even if we had, the motion estimation code * does not expect it. */ if(s->codec_id != CODEC_ID_SNOW){ if((c->avctx->me_cmp&FF_CMP_CHROMA)/* && !s->dsp.me_cmp[2]*/){ s->dsp.me_cmp[2]= zero_cmp; } if((c->avctx->me_sub_cmp&FF_CMP_CHROMA) && !s->dsp.me_sub_cmp[2]){ s->dsp.me_sub_cmp[2]= zero_cmp; } c->hpel_put[2][0]= c->hpel_put[2][1]= c->hpel_put[2][2]= c->hpel_put[2][3]= zero_hpel; } if(s->codec_id == CODEC_ID_H261){ c->sub_motion_search= no_sub_motion_search; } return 0; } #if 0 static int pix_dev(uint8_t * pix, int line_size, int mean) { int s, i, j; s = 0; for (i = 0; i < 16; i++) { for (j = 0; j < 16; j += 8) { s += FFABS(pix[0]-mean); s += FFABS(pix[1]-mean); s += FFABS(pix[2]-mean); s += FFABS(pix[3]-mean); s += FFABS(pix[4]-mean); s += FFABS(pix[5]-mean); s += FFABS(pix[6]-mean); s += FFABS(pix[7]-mean); pix += 8; } pix += line_size - 16; } return s; } #endif static inline void no_motion_search(MpegEncContext * s, int *mx_ptr, int *my_ptr) { *mx_ptr = 16 * s->mb_x; *my_ptr = 16 * s->mb_y; } #define Z_THRESHOLD 256 #define CHECK_SAD_HALF_MV(suffix, x, y) \ {\ d= s->dsp.pix_abs[size][(x?1:0)+(y?2:0)](NULL, pix, ptr+((x)>>1), stride, h);\ d += (mv_penalty[pen_x + x] + mv_penalty[pen_y + y])*penalty_factor;\ COPY3_IF_LT(dminh, d, dx, x, dy, y)\ } static inline int sad_hpel_motion_search(MpegEncContext * s, int *mx_ptr, int *my_ptr, int dmin, int src_index, int ref_index, int size, int h) { MotionEstContext * const c= &s->me; const int penalty_factor= c->sub_penalty_factor; int mx, my, dminh; uint8_t *pix, *ptr; int stride= c->stride; const int flags= c->sub_flags; LOAD_COMMON assert(flags == 0); if(c->skip){ // printf("S"); *mx_ptr = 0; *my_ptr = 0; return dmin; } // printf("N"); pix = c->src[src_index][0]; mx = *mx_ptr; my = *my_ptr; ptr = c->ref[ref_index][0] + (my * stride) + mx; dminh = dmin; if (mx > xmin && mx < xmax && my > ymin && my < ymax) { int dx=0, dy=0; int d, pen_x, pen_y; const int index= (my<<ME_MAP_SHIFT) + mx; const int t= score_map[(index-(1<<ME_MAP_SHIFT))&(ME_MAP_SIZE-1)]; const int l= score_map[(index- 1 )&(ME_MAP_SIZE-1)]; const int r= score_map[(index+ 1 )&(ME_MAP_SIZE-1)]; const int b= score_map[(index+(1<<ME_MAP_SHIFT))&(ME_MAP_SIZE-1)]; mx<<=1; my<<=1; pen_x= pred_x + mx; pen_y= pred_y + my; ptr-= stride; if(t<=b){ CHECK_SAD_HALF_MV(y2 , 0, -1) if(l<=r){ CHECK_SAD_HALF_MV(xy2, -1, -1) if(t+r<=b+l){ CHECK_SAD_HALF_MV(xy2, +1, -1) ptr+= stride; }else{ ptr+= stride; CHECK_SAD_HALF_MV(xy2, -1, +1) } CHECK_SAD_HALF_MV(x2 , -1, 0) }else{ CHECK_SAD_HALF_MV(xy2, +1, -1) if(t+l<=b+r){ CHECK_SAD_HALF_MV(xy2, -1, -1) ptr+= stride; }else{ ptr+= stride; CHECK_SAD_HALF_MV(xy2, +1, +1) } CHECK_SAD_HALF_MV(x2 , +1, 0) } }else{ if(l<=r){ if(t+l<=b+r){ CHECK_SAD_HALF_MV(xy2, -1, -1) ptr+= stride; }else{ ptr+= stride; CHECK_SAD_HALF_MV(xy2, +1, +1) } CHECK_SAD_HALF_MV(x2 , -1, 0) CHECK_SAD_HALF_MV(xy2, -1, +1) }else{ if(t+r<=b+l){ CHECK_SAD_HALF_MV(xy2, +1, -1) ptr+= stride; }else{ ptr+= stride; CHECK_SAD_HALF_MV(xy2, -1, +1) } CHECK_SAD_HALF_MV(x2 , +1, 0) CHECK_SAD_HALF_MV(xy2, +1, +1) } CHECK_SAD_HALF_MV(y2 , 0, +1) } mx+=dx; my+=dy; }else{ mx<<=1; my<<=1; } *mx_ptr = mx; *my_ptr = my; return dminh; } static inline void set_p_mv_tables(MpegEncContext * s, int mx, int my, int mv4) { const int xy= s->mb_x + s->mb_y*s->mb_stride; s->p_mv_table[xy][0] = mx; s->p_mv_table[xy][1] = my; /* has already been set to the 4 MV if 4MV is done */ if(mv4){ int mot_xy= s->block_index[0]; s->current_picture.motion_val[0][mot_xy ][0]= mx; s->current_picture.motion_val[0][mot_xy ][1]= my; s->current_picture.motion_val[0][mot_xy+1][0]= mx; s->current_picture.motion_val[0][mot_xy+1][1]= my; mot_xy += s->b8_stride; s->current_picture.motion_val[0][mot_xy ][0]= mx; s->current_picture.motion_val[0][mot_xy ][1]= my; s->current_picture.motion_val[0][mot_xy+1][0]= mx; s->current_picture.motion_val[0][mot_xy+1][1]= my; } } /** * get fullpel ME search limits. */ static inline void get_limits(MpegEncContext *s, int x, int y) { MotionEstContext * const c= &s->me; int range= c->avctx->me_range >> (1 + !!(c->flags&FLAG_QPEL)); /* if(c->avctx->me_range) c->range= c->avctx->me_range >> 1; else c->range= 16; */ if (s->unrestricted_mv) { c->xmin = - x - 16; c->ymin = - y - 16; c->xmax = - x + s->mb_width *16; c->ymax = - y + s->mb_height*16; } else if (s->out_format == FMT_H261){ // Search range of H261 is different from other codec standards c->xmin = (x > 15) ? - 15 : 0; c->ymin = (y > 15) ? - 15 : 0; c->xmax = (x < s->mb_width * 16 - 16) ? 15 : 0; c->ymax = (y < s->mb_height * 16 - 16) ? 15 : 0; } else { c->xmin = - x; c->ymin = - y; c->xmax = - x + s->mb_width *16 - 16; c->ymax = - y + s->mb_height*16 - 16; } if(range){ c->xmin = FFMAX(c->xmin,-range); c->xmax = FFMIN(c->xmax, range); c->ymin = FFMAX(c->ymin,-range); c->ymax = FFMIN(c->ymax, range); } } static inline void init_mv4_ref(MotionEstContext *c){ const int stride= c->stride; c->ref[1][0] = c->ref[0][0] + 8; c->ref[2][0] = c->ref[0][0] + 8*stride; c->ref[3][0] = c->ref[2][0] + 8; c->src[1][0] = c->src[0][0] + 8; c->src[2][0] = c->src[0][0] + 8*stride; c->src[3][0] = c->src[2][0] + 8; } static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift) { MotionEstContext * const c= &s->me; const int size= 1; const int h=8; int block; int P[10][2]; int dmin_sum=0, mx4_sum=0, my4_sum=0; int same=1; const int stride= c->stride; uint8_t *mv_penalty= c->current_mv_penalty; init_mv4_ref(c); for(block=0; block<4; block++){ int mx4, my4; int pred_x4, pred_y4; int dmin4; static const int off[4]= {2, 1, 1, -1}; const int mot_stride = s->b8_stride; const int mot_xy = s->block_index[block]; P_LEFT[0] = s->current_picture.motion_val[0][mot_xy - 1][0]; P_LEFT[1] = s->current_picture.motion_val[0][mot_xy - 1][1]; if(P_LEFT[0] > (c->xmax<<shift)) P_LEFT[0] = (c->xmax<<shift); /* special case for first line */ if (s->first_slice_line && block<2) { c->pred_x= pred_x4= P_LEFT[0]; c->pred_y= pred_y4= P_LEFT[1]; } else { P_TOP[0] = s->current_picture.motion_val[0][mot_xy - mot_stride ][0]; P_TOP[1] = s->current_picture.motion_val[0][mot_xy - mot_stride ][1]; P_TOPRIGHT[0] = s->current_picture.motion_val[0][mot_xy - mot_stride + off[block]][0]; P_TOPRIGHT[1] = s->current_picture.motion_val[0][mot_xy - mot_stride + off[block]][1]; if(P_TOP[1] > (c->ymax<<shift)) P_TOP[1] = (c->ymax<<shift); if(P_TOPRIGHT[0] < (c->xmin<<shift)) P_TOPRIGHT[0]= (c->xmin<<shift); if(P_TOPRIGHT[0] > (c->xmax<<shift)) P_TOPRIGHT[0]= (c->xmax<<shift); if(P_TOPRIGHT[1] > (c->ymax<<shift)) P_TOPRIGHT[1]= (c->ymax<<shift); P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]); P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]); c->pred_x= pred_x4 = P_MEDIAN[0]; c->pred_y= pred_y4 = P_MEDIAN[1]; } P_MV1[0]= mx; P_MV1[1]= my; dmin4 = epzs_motion_search4(s, &mx4, &my4, P, block, block, s->p_mv_table, (1<<16)>>shift); dmin4= c->sub_motion_search(s, &mx4, &my4, dmin4, block, block, size, h); if(s->dsp.me_sub_cmp[0] != s->dsp.mb_cmp[0]){ int dxy; const int offset= ((block&1) + (block>>1)*stride)*8; uint8_t *dest_y = c->scratchpad + offset; if(s->quarter_sample){ uint8_t *ref= c->ref[block][0] + (mx4>>2) + (my4>>2)*stride; dxy = ((my4 & 3) << 2) | (mx4 & 3); if(s->no_rounding) s->dsp.put_no_rnd_qpel_pixels_tab[1][dxy](dest_y , ref , stride); else s->dsp.put_qpel_pixels_tab [1][dxy](dest_y , ref , stride); }else{ uint8_t *ref= c->ref[block][0] + (mx4>>1) + (my4>>1)*stride; dxy = ((my4 & 1) << 1) | (mx4 & 1); if(s->no_rounding) s->dsp.put_no_rnd_pixels_tab[1][dxy](dest_y , ref , stride, h); else s->dsp.put_pixels_tab [1][dxy](dest_y , ref , stride, h); } dmin_sum+= (mv_penalty[mx4-pred_x4] + mv_penalty[my4-pred_y4])*c->mb_penalty_factor; }else dmin_sum+= dmin4; if(s->quarter_sample){ mx4_sum+= mx4/2; my4_sum+= my4/2; }else{ mx4_sum+= mx4; my4_sum+= my4; } s->current_picture.motion_val[0][ s->block_index[block] ][0]= mx4; s->current_picture.motion_val[0][ s->block_index[block] ][1]= my4; if(mx4 != mx || my4 != my) same=0; } if(same) return INT_MAX; if(s->dsp.me_sub_cmp[0] != s->dsp.mb_cmp[0]){ dmin_sum += s->dsp.mb_cmp[0](s, s->new_picture.data[0] + s->mb_x*16 + s->mb_y*16*stride, c->scratchpad, stride, 16); } if(c->avctx->mb_cmp&FF_CMP_CHROMA){ int dxy; int mx, my; int offset; mx= ff_h263_round_chroma(mx4_sum); my= ff_h263_round_chroma(my4_sum); dxy = ((my & 1) << 1) | (mx & 1); offset= (s->mb_x*8 + (mx>>1)) + (s->mb_y*8 + (my>>1))*s->uvlinesize; if(s->no_rounding){ s->dsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad , s->last_picture.data[1] + offset, s->uvlinesize, 8); s->dsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad+8 , s->last_picture.data[2] + offset, s->uvlinesize, 8); }else{ s->dsp.put_pixels_tab [1][dxy](c->scratchpad , s->last_picture.data[1] + offset, s->uvlinesize, 8); s->dsp.put_pixels_tab [1][dxy](c->scratchpad+8 , s->last_picture.data[2] + offset, s->uvlinesize, 8); } dmin_sum += s->dsp.mb_cmp[1](s, s->new_picture.data[1] + s->mb_x*8 + s->mb_y*8*s->uvlinesize, c->scratchpad , s->uvlinesize, 8); dmin_sum += s->dsp.mb_cmp[1](s, s->new_picture.data[2] + s->mb_x*8 + s->mb_y*8*s->uvlinesize, c->scratchpad+8, s->uvlinesize, 8); } c->pred_x= mx; c->pred_y= my; switch(c->avctx->mb_cmp&0xFF){ /*case FF_CMP_SSE: return dmin_sum+ 32*s->qscale*s->qscale;*/ case FF_CMP_RD: return dmin_sum; default: return dmin_sum+ 11*c->mb_penalty_factor; } } static inline void init_interlaced_ref(MpegEncContext *s, int ref_index){ MotionEstContext * const c= &s->me; c->ref[1+ref_index][0] = c->ref[0+ref_index][0] + s->linesize; c->src[1][0] = c->src[0][0] + s->linesize; if(c->flags & FLAG_CHROMA){ c->ref[1+ref_index][1] = c->ref[0+ref_index][1] + s->uvlinesize; c->ref[1+ref_index][2] = c->ref[0+ref_index][2] + s->uvlinesize; c->src[1][1] = c->src[0][1] + s->uvlinesize; c->src[1][2] = c->src[0][2] + s->uvlinesize; } } static int interlaced_search(MpegEncContext *s, int ref_index, int16_t (*mv_tables[2][2])[2], uint8_t *field_select_tables[2], int mx, int my, int user_field_select) { MotionEstContext * const c= &s->me; const int size=0; const int h=8; int block; int P[10][2]; uint8_t * const mv_penalty= c->current_mv_penalty; int same=1; const int stride= 2*s->linesize; int dmin_sum= 0; const int mot_stride= s->mb_stride; const int xy= s->mb_x + s->mb_y*mot_stride; c->ymin>>=1; c->ymax>>=1; c->stride<<=1; c->uvstride<<=1; init_interlaced_ref(s, ref_index); for(block=0; block<2; block++){ int field_select; int best_dmin= INT_MAX; int best_field= -1; for(field_select=0; field_select<2; field_select++){ int dmin, mx_i, my_i; int16_t (*mv_table)[2]= mv_tables[block][field_select]; if(user_field_select){ assert(field_select==0 || field_select==1); assert(field_select_tables[block][xy]==0 || field_select_tables[block][xy]==1); if(field_select_tables[block][xy] != field_select) continue; } P_LEFT[0] = mv_table[xy - 1][0]; P_LEFT[1] = mv_table[xy - 1][1]; if(P_LEFT[0] > (c->xmax<<1)) P_LEFT[0] = (c->xmax<<1); c->pred_x= P_LEFT[0]; c->pred_y= P_LEFT[1]; if(!s->first_slice_line){ P_TOP[0] = mv_table[xy - mot_stride][0]; P_TOP[1] = mv_table[xy - mot_stride][1]; P_TOPRIGHT[0] = mv_table[xy - mot_stride + 1][0]; P_TOPRIGHT[1] = mv_table[xy - mot_stride + 1][1]; if(P_TOP[1] > (c->ymax<<1)) P_TOP[1] = (c->ymax<<1); if(P_TOPRIGHT[0] < (c->xmin<<1)) P_TOPRIGHT[0]= (c->xmin<<1); if(P_TOPRIGHT[0] > (c->xmax<<1)) P_TOPRIGHT[0]= (c->xmax<<1); if(P_TOPRIGHT[1] > (c->ymax<<1)) P_TOPRIGHT[1]= (c->ymax<<1); P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]); P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]); } P_MV1[0]= mx; //FIXME not correct if block != field_select P_MV1[1]= my / 2; dmin = epzs_motion_search2(s, &mx_i, &my_i, P, block, field_select+ref_index, mv_table, (1<<16)>>1); dmin= c->sub_motion_search(s, &mx_i, &my_i, dmin, block, field_select+ref_index, size, h); mv_table[xy][0]= mx_i; mv_table[xy][1]= my_i; if(s->dsp.me_sub_cmp[0] != s->dsp.mb_cmp[0]){ int dxy; //FIXME chroma ME uint8_t *ref= c->ref[field_select+ref_index][0] + (mx_i>>1) + (my_i>>1)*stride; dxy = ((my_i & 1) << 1) | (mx_i & 1); if(s->no_rounding){ s->dsp.put_no_rnd_pixels_tab[size][dxy](c->scratchpad, ref , stride, h); }else{ s->dsp.put_pixels_tab [size][dxy](c->scratchpad, ref , stride, h); } dmin= s->dsp.mb_cmp[size](s, c->src[block][0], c->scratchpad, stride, h); dmin+= (mv_penalty[mx_i-c->pred_x] + mv_penalty[my_i-c->pred_y] + 1)*c->mb_penalty_factor; }else dmin+= c->mb_penalty_factor; //field_select bits dmin += field_select != block; //slightly prefer same field if(dmin < best_dmin){ best_dmin= dmin; best_field= field_select; } } { int16_t (*mv_table)[2]= mv_tables[block][best_field]; if(mv_table[xy][0] != mx) same=0; //FIXME check if these checks work and are any good at all if(mv_table[xy][1]&1) same=0; if(mv_table[xy][1]*2 != my) same=0; if(best_field != block) same=0; } field_select_tables[block][xy]= best_field; dmin_sum += best_dmin; } c->ymin<<=1; c->ymax<<=1; c->stride>>=1; c->uvstride>>=1; if(same) return INT_MAX; switch(c->avctx->mb_cmp&0xFF){ /*case FF_CMP_SSE: return dmin_sum+ 32*s->qscale*s->qscale;*/ case FF_CMP_RD: return dmin_sum; default: return dmin_sum+ 11*c->mb_penalty_factor; } } static void clip_input_mv(MpegEncContext * s, int16_t *mv, int interlaced){ int ymax= s->me.ymax>>interlaced; int ymin= s->me.ymin>>interlaced; if(mv[0] < s->me.xmin) mv[0] = s->me.xmin; if(mv[0] > s->me.xmax) mv[0] = s->me.xmax; if(mv[1] < ymin) mv[1] = ymin; if(mv[1] > ymax) mv[1] = ymax; } static inline int check_input_motion(MpegEncContext * s, int mb_x, int mb_y, int p_type){ MotionEstContext * const c= &s->me; Picture *p= s->current_picture_ptr; int mb_xy= mb_x + mb_y*s->mb_stride; int xy= 2*mb_x + 2*mb_y*s->b8_stride; int mb_type= s->current_picture.mb_type[mb_xy]; int flags= c->flags; int shift= (flags&FLAG_QPEL) + 1; int mask= (1<<shift)-1; int x, y, i; int d=0; me_cmp_func cmpf= s->dsp.sse[0]; me_cmp_func chroma_cmpf= s->dsp.sse[1]; if(p_type && USES_LIST(mb_type, 1)){ av_log(c->avctx, AV_LOG_ERROR, "backward motion vector in P frame\n"); return INT_MAX/2; } assert(IS_INTRA(mb_type) || USES_LIST(mb_type,0) || USES_LIST(mb_type,1)); for(i=0; i<4; i++){ int xy= s->block_index[i]; clip_input_mv(s, p->motion_val[0][xy], !!IS_INTERLACED(mb_type)); clip_input_mv(s, p->motion_val[1][xy], !!IS_INTERLACED(mb_type)); } if(IS_INTERLACED(mb_type)){ int xy2= xy + s->b8_stride; s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_INTRA; c->stride<<=1; c->uvstride<<=1; if(!(s->flags & CODEC_FLAG_INTERLACED_ME)){ av_log(c->avctx, AV_LOG_ERROR, "Interlaced macroblock selected but interlaced motion estimation disabled\n"); return INT_MAX/2; } if(USES_LIST(mb_type, 0)){ int field_select0= p->ref_index[0][4*mb_xy ]; int field_select1= p->ref_index[0][4*mb_xy+2]; assert(field_select0==0 ||field_select0==1); assert(field_select1==0 ||field_select1==1); init_interlaced_ref(s, 0); if(p_type){ s->p_field_select_table[0][mb_xy]= field_select0; s->p_field_select_table[1][mb_xy]= field_select1; *(uint32_t*)s->p_field_mv_table[0][field_select0][mb_xy]= *(uint32_t*)p->motion_val[0][xy ]; *(uint32_t*)s->p_field_mv_table[1][field_select1][mb_xy]= *(uint32_t*)p->motion_val[0][xy2]; s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_INTER_I; }else{ s->b_field_select_table[0][0][mb_xy]= field_select0; s->b_field_select_table[0][1][mb_xy]= field_select1; *(uint32_t*)s->b_field_mv_table[0][0][field_select0][mb_xy]= *(uint32_t*)p->motion_val[0][xy ]; *(uint32_t*)s->b_field_mv_table[0][1][field_select1][mb_xy]= *(uint32_t*)p->motion_val[0][xy2]; s->mb_type[mb_xy]= CANDIDATE_MB_TYPE_FORWARD_I; } x= p->motion_val[0][xy ][0]; y= p->motion_val[0][xy ][1]; d = cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 8, field_select0, 0, cmpf, chroma_cmpf, flags); x= p->motion_val[0][xy2][0]; y= p->motion_val[0][xy2][1]; d+= cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 8, field_select1, 1, cmpf, chroma_cmpf, flags); } if(USES_LIST(mb_type, 1)){ int field_select0= p->ref_index[1][4*mb_xy ]; int field_select1= p->ref_index[1][4*mb_xy+2]; assert(field_select0==0 ||field_select0==1); assert(field_select1==0 ||field_select1==1); init_interlaced_ref(s, 2); s->b_field_select_table[1][0][mb_xy]= field_select0; s->b_field_select_table[1][1][mb_xy]= field_select1; *(uint32_t*)s->b_field_mv_table[1][0][field_select0][mb_xy]= *(uint32_t*)p->motion_val[1][xy ]; *(uint32_t*)s->b_field_mv_table[1][1][field_select1][mb_xy]= *(uint32_t*)p->motion_val[1][xy2]; if(USES_LIST(mb_type, 0)){ s->mb_type[mb_xy]= CANDIDATE_MB_TYPE_BIDIR_I; }else{ s->mb_type[mb_xy]= CANDIDATE_MB_TYPE_BACKWARD_I; } x= p->motion_val[1][xy ][0]; y= p->motion_val[1][xy ][1]; d = cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 8, field_select0+2, 0, cmpf, chroma_cmpf, flags); x= p->motion_val[1][xy2][0]; y= p->motion_val[1][xy2][1]; d+= cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 8, field_select1+2, 1, cmpf, chroma_cmpf, flags); //FIXME bidir scores } c->stride>>=1; c->uvstride>>=1; }else if(IS_8X8(mb_type)){ if(!(s->flags & CODEC_FLAG_4MV)){ av_log(c->avctx, AV_LOG_ERROR, "4MV macroblock selected but 4MV encoding disabled\n"); return INT_MAX/2; } cmpf= s->dsp.sse[1]; chroma_cmpf= s->dsp.sse[1]; init_mv4_ref(c); for(i=0; i<4; i++){ xy= s->block_index[i]; x= p->motion_val[0][xy][0]; y= p->motion_val[0][xy][1]; d+= cmp(s, x>>shift, y>>shift, x&mask, y&mask, 1, 8, i, i, cmpf, chroma_cmpf, flags); } s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_INTER4V; }else{ if(USES_LIST(mb_type, 0)){ if(p_type){ *(uint32_t*)s->p_mv_table[mb_xy]= *(uint32_t*)p->motion_val[0][xy]; s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_INTER; }else if(USES_LIST(mb_type, 1)){ *(uint32_t*)s->b_bidir_forw_mv_table[mb_xy]= *(uint32_t*)p->motion_val[0][xy]; *(uint32_t*)s->b_bidir_back_mv_table[mb_xy]= *(uint32_t*)p->motion_val[1][xy]; s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_BIDIR; }else{ *(uint32_t*)s->b_forw_mv_table[mb_xy]= *(uint32_t*)p->motion_val[0][xy]; s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_FORWARD; } x= p->motion_val[0][xy][0]; y= p->motion_val[0][xy][1]; d = cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 16, 0, 0, cmpf, chroma_cmpf, flags); }else if(USES_LIST(mb_type, 1)){ *(uint32_t*)s->b_back_mv_table[mb_xy]= *(uint32_t*)p->motion_val[1][xy]; s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_BACKWARD; x= p->motion_val[1][xy][0]; y= p->motion_val[1][xy][1]; d = cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 16, 2, 0, cmpf, chroma_cmpf, flags); }else s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_INTRA; } return d; } void ff_estimate_p_frame_motion(MpegEncContext * s, int mb_x, int mb_y) { MotionEstContext * const c= &s->me; uint8_t *pix, *ppix; int sum, mx, my, dmin; int varc; ///< the variance of the block (sum of squared (p[y][x]-average)) int vard; ///< sum of squared differences with the estimated motion vector int P[10][2]; const int shift= 1+s->quarter_sample; int mb_type=0; Picture * const pic= &s->current_picture; init_ref(c, s->new_picture.data, s->last_picture.data, NULL, 16*mb_x, 16*mb_y, 0); assert(s->quarter_sample==0 || s->quarter_sample==1); assert(s->linesize == c->stride); assert(s->uvlinesize == c->uvstride); c->penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_cmp); c->sub_penalty_factor= get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_sub_cmp); c->mb_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->mb_cmp); c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_MV; get_limits(s, 16*mb_x, 16*mb_y); c->skip=0; /* intra / predictive decision */ pix = c->src[0][0]; sum = s->dsp.pix_sum(pix, s->linesize); varc = s->dsp.pix_norm1(pix, s->linesize) - (((unsigned)(sum*sum))>>8) + 500; pic->mb_mean[s->mb_stride * mb_y + mb_x] = (sum+128)>>8; pic->mb_var [s->mb_stride * mb_y + mb_x] = (varc+128)>>8; c->mb_var_sum_temp += (varc+128)>>8; if(c->avctx->me_threshold){ vard= check_input_motion(s, mb_x, mb_y, 1); if((vard+128)>>8 < c->avctx->me_threshold){ int p_score= FFMIN(vard, varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*100); int i_score= varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*20; pic->mc_mb_var[s->mb_stride * mb_y + mb_x] = (vard+128)>>8; c->mc_mb_var_sum_temp += (vard+128)>>8; c->scene_change_score+= ff_sqrt(p_score) - ff_sqrt(i_score); return; } if((vard+128)>>8 < c->avctx->mb_threshold) mb_type= s->mb_type[mb_x + mb_y*s->mb_stride]; } switch(s->me_method) { case ME_ZERO: default: no_motion_search(s, &mx, &my); mx-= mb_x*16; my-= mb_y*16; dmin = 0; break; case ME_X1: case ME_EPZS: { const int mot_stride = s->b8_stride; const int mot_xy = s->block_index[0]; P_LEFT[0] = s->current_picture.motion_val[0][mot_xy - 1][0]; P_LEFT[1] = s->current_picture.motion_val[0][mot_xy - 1][1]; if(P_LEFT[0] > (c->xmax<<shift)) P_LEFT[0] = (c->xmax<<shift); if(!s->first_slice_line) { P_TOP[0] = s->current_picture.motion_val[0][mot_xy - mot_stride ][0]; P_TOP[1] = s->current_picture.motion_val[0][mot_xy - mot_stride ][1]; P_TOPRIGHT[0] = s->current_picture.motion_val[0][mot_xy - mot_stride + 2][0]; P_TOPRIGHT[1] = s->current_picture.motion_val[0][mot_xy - mot_stride + 2][1]; if(P_TOP[1] > (c->ymax<<shift)) P_TOP[1] = (c->ymax<<shift); if(P_TOPRIGHT[0] < (c->xmin<<shift)) P_TOPRIGHT[0]= (c->xmin<<shift); if(P_TOPRIGHT[1] > (c->ymax<<shift)) P_TOPRIGHT[1]= (c->ymax<<shift); P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]); P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]); if(s->out_format == FMT_H263){ c->pred_x = P_MEDIAN[0]; c->pred_y = P_MEDIAN[1]; }else { /* mpeg1 at least */ c->pred_x= P_LEFT[0]; c->pred_y= P_LEFT[1]; } }else{ c->pred_x= P_LEFT[0]; c->pred_y= P_LEFT[1]; } } dmin = ff_epzs_motion_search(s, &mx, &my, P, 0, 0, s->p_mv_table, (1<<16)>>shift, 0, 16); break; } /* At this point (mx,my) are full-pell and the relative displacement */ ppix = c->ref[0][0] + (my * s->linesize) + mx; vard = s->dsp.sse[0](NULL, pix, ppix, s->linesize, 16); pic->mc_mb_var[s->mb_stride * mb_y + mb_x] = (vard+128)>>8; // pic->mb_cmp_score[s->mb_stride * mb_y + mb_x] = dmin; c->mc_mb_var_sum_temp += (vard+128)>>8; #if 0 printf("varc=%4d avg_var=%4d (sum=%4d) vard=%4d mx=%2d my=%2d\n", varc, s->avg_mb_var, sum, vard, mx - xx, my - yy); #endif if(mb_type){ int p_score= FFMIN(vard, varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*100); int i_score= varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*20; c->scene_change_score+= ff_sqrt(p_score) - ff_sqrt(i_score); if(mb_type == CANDIDATE_MB_TYPE_INTER){ c->sub_motion_search(s, &mx, &my, dmin, 0, 0, 0, 16); set_p_mv_tables(s, mx, my, 1); }else{ mx <<=shift; my <<=shift; } if(mb_type == CANDIDATE_MB_TYPE_INTER4V){ h263_mv4_search(s, mx, my, shift); set_p_mv_tables(s, mx, my, 0); } if(mb_type == CANDIDATE_MB_TYPE_INTER_I){ interlaced_search(s, 0, s->p_field_mv_table, s->p_field_select_table, mx, my, 1); } }else if(c->avctx->mb_decision > FF_MB_DECISION_SIMPLE){ int p_score= FFMIN(vard, varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*100); int i_score= varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*20; c->scene_change_score+= ff_sqrt(p_score) - ff_sqrt(i_score); if (vard*2 + 200*256 > varc) mb_type|= CANDIDATE_MB_TYPE_INTRA; if (varc*2 + 200*256 > vard || s->qscale > 24){ // if (varc*2 + 200*256 + 50*(s->lambda2>>FF_LAMBDA_SHIFT) > vard){ mb_type|= CANDIDATE_MB_TYPE_INTER; c->sub_motion_search(s, &mx, &my, dmin, 0, 0, 0, 16); if(s->flags&CODEC_FLAG_MV0) if(mx || my) mb_type |= CANDIDATE_MB_TYPE_SKIPPED; //FIXME check difference }else{ mx <<=shift; my <<=shift; } if((s->flags&CODEC_FLAG_4MV) && !c->skip && varc>50<<8 && vard>10<<8){ if(h263_mv4_search(s, mx, my, shift) < INT_MAX) mb_type|=CANDIDATE_MB_TYPE_INTER4V; set_p_mv_tables(s, mx, my, 0); }else set_p_mv_tables(s, mx, my, 1); if((s->flags&CODEC_FLAG_INTERLACED_ME) && !c->skip){ //FIXME varc/d checks if(interlaced_search(s, 0, s->p_field_mv_table, s->p_field_select_table, mx, my, 0) < INT_MAX) mb_type |= CANDIDATE_MB_TYPE_INTER_I; } }else{ int intra_score, i; mb_type= CANDIDATE_MB_TYPE_INTER; dmin= c->sub_motion_search(s, &mx, &my, dmin, 0, 0, 0, 16); if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip) dmin= ff_get_mb_score(s, mx, my, 0, 0, 0, 16, 1); if((s->flags&CODEC_FLAG_4MV) && !c->skip && varc>50<<8 && vard>10<<8){ int dmin4= h263_mv4_search(s, mx, my, shift); if(dmin4 < dmin){ mb_type= CANDIDATE_MB_TYPE_INTER4V; dmin=dmin4; } } if((s->flags&CODEC_FLAG_INTERLACED_ME) && !c->skip){ //FIXME varc/d checks int dmin_i= interlaced_search(s, 0, s->p_field_mv_table, s->p_field_select_table, mx, my, 0); if(dmin_i < dmin){ mb_type = CANDIDATE_MB_TYPE_INTER_I; dmin= dmin_i; } } // pic->mb_cmp_score[s->mb_stride * mb_y + mb_x] = dmin; set_p_mv_tables(s, mx, my, mb_type!=CANDIDATE_MB_TYPE_INTER4V); /* get intra luma score */ if((c->avctx->mb_cmp&0xFF)==FF_CMP_SSE){ intra_score= varc - 500; }else{ int mean= (sum+128)>>8; mean*= 0x01010101; for(i=0; i<16; i++){ *(uint32_t*)(&c->scratchpad[i*s->linesize+ 0]) = mean; *(uint32_t*)(&c->scratchpad[i*s->linesize+ 4]) = mean; *(uint32_t*)(&c->scratchpad[i*s->linesize+ 8]) = mean; *(uint32_t*)(&c->scratchpad[i*s->linesize+12]) = mean; } intra_score= s->dsp.mb_cmp[0](s, c->scratchpad, pix, s->linesize, 16); } #if 0 //FIXME /* get chroma score */ if(c->avctx->mb_cmp&FF_CMP_CHROMA){ for(i=1; i<3; i++){ uint8_t *dest_c; int mean; if(s->out_format == FMT_H263){ mean= (s->dc_val[i][mb_x + mb_y*s->b8_stride] + 4)>>3; //FIXME not exact but simple ;) }else{ mean= (s->last_dc[i] + 4)>>3; } dest_c = s->new_picture.data[i] + (mb_y * 8 * (s->uvlinesize)) + mb_x * 8; mean*= 0x01010101; for(i=0; i<8; i++){ *(uint32_t*)(&c->scratchpad[i*s->uvlinesize+ 0]) = mean; *(uint32_t*)(&c->scratchpad[i*s->uvlinesize+ 4]) = mean; } intra_score+= s->dsp.mb_cmp[1](s, c->scratchpad, dest_c, s->uvlinesize); } } #endif intra_score += c->mb_penalty_factor*16; if(intra_score < dmin){ mb_type= CANDIDATE_MB_TYPE_INTRA; s->current_picture.mb_type[mb_y*s->mb_stride + mb_x]= CANDIDATE_MB_TYPE_INTRA; //FIXME cleanup }else s->current_picture.mb_type[mb_y*s->mb_stride + mb_x]= 0; { int p_score= FFMIN(vard, varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*100); int i_score= varc-500+(s->lambda2>>FF_LAMBDA_SHIFT)*20; c->scene_change_score+= ff_sqrt(p_score) - ff_sqrt(i_score); } } s->mb_type[mb_y*s->mb_stride + mb_x]= mb_type; } int ff_pre_estimate_p_frame_motion(MpegEncContext * s, int mb_x, int mb_y) { MotionEstContext * const c= &s->me; int mx, my, dmin; int P[10][2]; const int shift= 1+s->quarter_sample; const int xy= mb_x + mb_y*s->mb_stride; init_ref(c, s->new_picture.data, s->last_picture.data, NULL, 16*mb_x, 16*mb_y, 0); assert(s->quarter_sample==0 || s->quarter_sample==1); c->pre_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_pre_cmp); c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_MV; get_limits(s, 16*mb_x, 16*mb_y); c->skip=0; P_LEFT[0] = s->p_mv_table[xy + 1][0]; P_LEFT[1] = s->p_mv_table[xy + 1][1]; if(P_LEFT[0] < (c->xmin<<shift)) P_LEFT[0] = (c->xmin<<shift); /* special case for first line */ if (s->first_slice_line) { c->pred_x= P_LEFT[0]; c->pred_y= P_LEFT[1]; P_TOP[0]= P_TOPRIGHT[0]= P_MEDIAN[0]= P_TOP[1]= P_TOPRIGHT[1]= P_MEDIAN[1]= 0; //FIXME } else { P_TOP[0] = s->p_mv_table[xy + s->mb_stride ][0]; P_TOP[1] = s->p_mv_table[xy + s->mb_stride ][1]; P_TOPRIGHT[0] = s->p_mv_table[xy + s->mb_stride - 1][0]; P_TOPRIGHT[1] = s->p_mv_table[xy + s->mb_stride - 1][1]; if(P_TOP[1] < (c->ymin<<shift)) P_TOP[1] = (c->ymin<<shift); if(P_TOPRIGHT[0] > (c->xmax<<shift)) P_TOPRIGHT[0]= (c->xmax<<shift); if(P_TOPRIGHT[1] < (c->ymin<<shift)) P_TOPRIGHT[1]= (c->ymin<<shift); P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]); P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]); c->pred_x = P_MEDIAN[0]; c->pred_y = P_MEDIAN[1]; } dmin = ff_epzs_motion_search(s, &mx, &my, P, 0, 0, s->p_mv_table, (1<<16)>>shift, 0, 16); s->p_mv_table[xy][0] = mx<<shift; s->p_mv_table[xy][1] = my<<shift; return dmin; } static int ff_estimate_motion_b(MpegEncContext * s, int mb_x, int mb_y, int16_t (*mv_table)[2], int ref_index, int f_code) { MotionEstContext * const c= &s->me; int mx, my, dmin; int P[10][2]; const int shift= 1+s->quarter_sample; const int mot_stride = s->mb_stride; const int mot_xy = mb_y*mot_stride + mb_x; uint8_t * const mv_penalty= c->mv_penalty[f_code] + MAX_MV; int mv_scale; c->penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_cmp); c->sub_penalty_factor= get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_sub_cmp); c->mb_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->mb_cmp); c->current_mv_penalty= mv_penalty; get_limits(s, 16*mb_x, 16*mb_y); switch(s->me_method) { case ME_ZERO: default: no_motion_search(s, &mx, &my); dmin = 0; mx-= mb_x*16; my-= mb_y*16; break; case ME_X1: case ME_EPZS: { P_LEFT[0] = mv_table[mot_xy - 1][0]; P_LEFT[1] = mv_table[mot_xy - 1][1]; if(P_LEFT[0] > (c->xmax<<shift)) P_LEFT[0] = (c->xmax<<shift); /* special case for first line */ if (!s->first_slice_line) { P_TOP[0] = mv_table[mot_xy - mot_stride ][0]; P_TOP[1] = mv_table[mot_xy - mot_stride ][1]; P_TOPRIGHT[0] = mv_table[mot_xy - mot_stride + 1 ][0]; P_TOPRIGHT[1] = mv_table[mot_xy - mot_stride + 1 ][1]; if(P_TOP[1] > (c->ymax<<shift)) P_TOP[1]= (c->ymax<<shift); if(P_TOPRIGHT[0] < (c->xmin<<shift)) P_TOPRIGHT[0]= (c->xmin<<shift); if(P_TOPRIGHT[1] > (c->ymax<<shift)) P_TOPRIGHT[1]= (c->ymax<<shift); P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]); P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]); } c->pred_x= P_LEFT[0]; c->pred_y= P_LEFT[1]; } if(mv_table == s->b_forw_mv_table){ mv_scale= (s->pb_time<<16) / (s->pp_time<<shift); }else{ mv_scale= ((s->pb_time - s->pp_time)<<16) / (s->pp_time<<shift); } dmin = ff_epzs_motion_search(s, &mx, &my, P, 0, ref_index, s->p_mv_table, mv_scale, 0, 16); break; } dmin= c->sub_motion_search(s, &mx, &my, dmin, 0, ref_index, 0, 16); if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip) dmin= ff_get_mb_score(s, mx, my, 0, ref_index, 0, 16, 1); //printf("%d %d %d %d//", s->mb_x, s->mb_y, mx, my); // s->mb_type[mb_y*s->mb_width + mb_x]= mb_type; mv_table[mot_xy][0]= mx; mv_table[mot_xy][1]= my; return dmin; } static inline int check_bidir_mv(MpegEncContext * s, int motion_fx, int motion_fy, int motion_bx, int motion_by, int pred_fx, int pred_fy, int pred_bx, int pred_by, int size, int h) { //FIXME optimize? //FIXME better f_code prediction (max mv & distance) //FIXME pointers MotionEstContext * const c= &s->me; uint8_t * const mv_penalty_f= c->mv_penalty[s->f_code] + MAX_MV; // f_code of the prev frame uint8_t * const mv_penalty_b= c->mv_penalty[s->b_code] + MAX_MV; // f_code of the prev frame int stride= c->stride; uint8_t *dest_y = c->scratchpad; uint8_t *ptr; int dxy; int src_x, src_y; int fbmin; uint8_t **src_data= c->src[0]; uint8_t **ref_data= c->ref[0]; uint8_t **ref2_data= c->ref[2]; if(s->quarter_sample){ dxy = ((motion_fy & 3) << 2) | (motion_fx & 3); src_x = motion_fx >> 2; src_y = motion_fy >> 2; ptr = ref_data[0] + (src_y * stride) + src_x; s->dsp.put_qpel_pixels_tab[0][dxy](dest_y , ptr , stride); dxy = ((motion_by & 3) << 2) | (motion_bx & 3); src_x = motion_bx >> 2; src_y = motion_by >> 2; ptr = ref2_data[0] + (src_y * stride) + src_x; s->dsp.avg_qpel_pixels_tab[size][dxy](dest_y , ptr , stride); }else{ dxy = ((motion_fy & 1) << 1) | (motion_fx & 1); src_x = motion_fx >> 1; src_y = motion_fy >> 1; ptr = ref_data[0] + (src_y * stride) + src_x; s->dsp.put_pixels_tab[size][dxy](dest_y , ptr , stride, h); dxy = ((motion_by & 1) << 1) | (motion_bx & 1); src_x = motion_bx >> 1; src_y = motion_by >> 1; ptr = ref2_data[0] + (src_y * stride) + src_x; s->dsp.avg_pixels_tab[size][dxy](dest_y , ptr , stride, h); } fbmin = (mv_penalty_f[motion_fx-pred_fx] + mv_penalty_f[motion_fy-pred_fy])*c->mb_penalty_factor +(mv_penalty_b[motion_bx-pred_bx] + mv_penalty_b[motion_by-pred_by])*c->mb_penalty_factor + s->dsp.mb_cmp[size](s, src_data[0], dest_y, stride, h); //FIXME new_pic if(c->avctx->mb_cmp&FF_CMP_CHROMA){ } //FIXME CHROMA !!! return fbmin; } /* refine the bidir vectors in hq mode and return the score in both lq & hq mode*/ static inline int bidir_refine(MpegEncContext * s, int mb_x, int mb_y) { MotionEstContext * const c= &s->me; const int mot_stride = s->mb_stride; const int xy = mb_y *mot_stride + mb_x; int fbmin; int pred_fx= s->b_bidir_forw_mv_table[xy-1][0]; int pred_fy= s->b_bidir_forw_mv_table[xy-1][1]; int pred_bx= s->b_bidir_back_mv_table[xy-1][0]; int pred_by= s->b_bidir_back_mv_table[xy-1][1]; int motion_fx= s->b_bidir_forw_mv_table[xy][0]= s->b_forw_mv_table[xy][0]; int motion_fy= s->b_bidir_forw_mv_table[xy][1]= s->b_forw_mv_table[xy][1]; int motion_bx= s->b_bidir_back_mv_table[xy][0]= s->b_back_mv_table[xy][0]; int motion_by= s->b_bidir_back_mv_table[xy][1]= s->b_back_mv_table[xy][1]; const int flags= c->sub_flags; const int qpel= flags&FLAG_QPEL; const int shift= 1+qpel; const int xmin= c->xmin<<shift; const int ymin= c->ymin<<shift; const int xmax= c->xmax<<shift; const int ymax= c->ymax<<shift; #define HASH(fx,fy,bx,by) ((fx)+17*(fy)+63*(bx)+117*(by)) int hashidx= HASH(motion_fx,motion_fy, motion_bx, motion_by); uint8_t map[256]; memset(map,0,sizeof(map)); map[hashidx&255] = 1; fbmin= check_bidir_mv(s, motion_fx, motion_fy, motion_bx, motion_by, pred_fx, pred_fy, pred_bx, pred_by, 0, 16); if(s->avctx->bidir_refine){ int end; static const uint8_t limittab[5]={0,8,32,64,80}; const int limit= limittab[s->avctx->bidir_refine]; static const int8_t vect[][4]={ { 0, 0, 0, 1}, { 0, 0, 0,-1}, { 0, 0, 1, 0}, { 0, 0,-1, 0}, { 0, 1, 0, 0}, { 0,-1, 0, 0}, { 1, 0, 0, 0}, {-1, 0, 0, 0}, { 0, 0, 1, 1}, { 0, 0,-1,-1}, { 0, 1, 1, 0}, { 0,-1,-1, 0}, { 1, 1, 0, 0}, {-1,-1, 0, 0}, { 1, 0, 0, 1}, {-1, 0, 0,-1}, { 0, 1, 0, 1}, { 0,-1, 0,-1}, { 1, 0, 1, 0}, {-1, 0,-1, 0}, { 0, 0,-1, 1}, { 0, 0, 1,-1}, { 0,-1, 1, 0}, { 0, 1,-1, 0}, {-1, 1, 0, 0}, { 1,-1, 0, 0}, { 1, 0, 0,-1}, {-1, 0, 0, 1}, { 0,-1, 0, 1}, { 0, 1, 0,-1}, {-1, 0, 1, 0}, { 1, 0,-1, 0}, { 0, 1, 1, 1}, { 0,-1,-1,-1}, { 1, 1, 1, 0}, {-1,-1,-1, 0}, { 1, 1, 0, 1}, {-1,-1, 0,-1}, { 1, 0, 1, 1}, {-1, 0,-1,-1}, { 0,-1, 1, 1}, { 0, 1,-1,-1}, {-1, 1, 1, 0}, { 1,-1,-1, 0}, { 1, 1, 0,-1}, {-1,-1, 0, 1}, { 1, 0,-1, 1}, {-1, 0, 1,-1}, { 0, 1,-1, 1}, { 0,-1, 1,-1}, { 1,-1, 1, 0}, {-1, 1,-1, 0}, {-1, 1, 0, 1}, { 1,-1, 0,-1}, { 1, 0, 1,-1}, {-1, 0,-1, 1}, { 0, 1, 1,-1}, { 0,-1,-1, 1}, { 1, 1,-1, 0}, {-1,-1, 1, 0}, { 1,-1, 0, 1}, {-1, 1, 0,-1}, {-1, 0, 1, 1}, { 1, 0,-1,-1}, { 1, 1, 1, 1}, {-1,-1,-1,-1}, { 1, 1, 1,-1}, {-1,-1,-1, 1}, { 1, 1,-1, 1}, {-1,-1, 1,-1}, { 1,-1, 1, 1}, {-1, 1,-1,-1}, {-1, 1, 1, 1}, { 1,-1,-1,-1}, { 1, 1,-1,-1}, {-1,-1, 1, 1}, { 1,-1,-1, 1}, {-1, 1, 1,-1}, { 1,-1, 1,-1}, {-1, 1,-1, 1}, }; static const uint8_t hash[]={ HASH( 0, 0, 0, 1), HASH( 0, 0, 0,-1), HASH( 0, 0, 1, 0), HASH( 0, 0,-1, 0), HASH( 0, 1, 0, 0), HASH( 0,-1, 0, 0), HASH( 1, 0, 0, 0), HASH(-1, 0, 0, 0), HASH( 0, 0, 1, 1), HASH( 0, 0,-1,-1), HASH( 0, 1, 1, 0), HASH( 0,-1,-1, 0), HASH( 1, 1, 0, 0), HASH(-1,-1, 0, 0), HASH( 1, 0, 0, 1), HASH(-1, 0, 0,-1), HASH( 0, 1, 0, 1), HASH( 0,-1, 0,-1), HASH( 1, 0, 1, 0), HASH(-1, 0,-1, 0), HASH( 0, 0,-1, 1), HASH( 0, 0, 1,-1), HASH( 0,-1, 1, 0), HASH( 0, 1,-1, 0), HASH(-1, 1, 0, 0), HASH( 1,-1, 0, 0), HASH( 1, 0, 0,-1), HASH(-1, 0, 0, 1), HASH( 0,-1, 0, 1), HASH( 0, 1, 0,-1), HASH(-1, 0, 1, 0), HASH( 1, 0,-1, 0), HASH( 0, 1, 1, 1), HASH( 0,-1,-1,-1), HASH( 1, 1, 1, 0), HASH(-1,-1,-1, 0), HASH( 1, 1, 0, 1), HASH(-1,-1, 0,-1), HASH( 1, 0, 1, 1), HASH(-1, 0,-1,-1), HASH( 0,-1, 1, 1), HASH( 0, 1,-1,-1), HASH(-1, 1, 1, 0), HASH( 1,-1,-1, 0), HASH( 1, 1, 0,-1), HASH(-1,-1, 0, 1), HASH( 1, 0,-1, 1), HASH(-1, 0, 1,-1), HASH( 0, 1,-1, 1), HASH( 0,-1, 1,-1), HASH( 1,-1, 1, 0), HASH(-1, 1,-1, 0), HASH(-1, 1, 0, 1), HASH( 1,-1, 0,-1), HASH( 1, 0, 1,-1), HASH(-1, 0,-1, 1), HASH( 0, 1, 1,-1), HASH( 0,-1,-1, 1), HASH( 1, 1,-1, 0), HASH(-1,-1, 1, 0), HASH( 1,-1, 0, 1), HASH(-1, 1, 0,-1), HASH(-1, 0, 1, 1), HASH( 1, 0,-1,-1), HASH( 1, 1, 1, 1), HASH(-1,-1,-1,-1), HASH( 1, 1, 1,-1), HASH(-1,-1,-1, 1), HASH( 1, 1,-1, 1), HASH(-1,-1, 1,-1), HASH( 1,-1, 1, 1), HASH(-1, 1,-1,-1), HASH(-1, 1, 1, 1), HASH( 1,-1,-1,-1), HASH( 1, 1,-1,-1), HASH(-1,-1, 1, 1), HASH( 1,-1,-1, 1), HASH(-1, 1, 1,-1), HASH( 1,-1, 1,-1), HASH(-1, 1,-1, 1), }; #define CHECK_BIDIR(fx,fy,bx,by)\ if( !map[(hashidx+HASH(fx,fy,bx,by))&255]\ &&(fx<=0 || motion_fx+fx<=xmax) && (fy<=0 || motion_fy+fy<=ymax) && (bx<=0 || motion_bx+bx<=xmax) && (by<=0 || motion_by+by<=ymax)\ &&(fx>=0 || motion_fx+fx>=xmin) && (fy>=0 || motion_fy+fy>=ymin) && (bx>=0 || motion_bx+bx>=xmin) && (by>=0 || motion_by+by>=ymin)){\ int score;\ map[(hashidx+HASH(fx,fy,bx,by))&255] = 1;\ score= check_bidir_mv(s, motion_fx+fx, motion_fy+fy, motion_bx+bx, motion_by+by, pred_fx, pred_fy, pred_bx, pred_by, 0, 16);\ if(score < fbmin){\ hashidx += HASH(fx,fy,bx,by);\ fbmin= score;\ motion_fx+=fx;\ motion_fy+=fy;\ motion_bx+=bx;\ motion_by+=by;\ end=0;\ }\ } #define CHECK_BIDIR2(a,b,c,d)\ CHECK_BIDIR(a,b,c,d)\ CHECK_BIDIR(-(a),-(b),-(c),-(d)) do{ int i; int borderdist=0; end=1; CHECK_BIDIR2(0,0,0,1) CHECK_BIDIR2(0,0,1,0) CHECK_BIDIR2(0,1,0,0) CHECK_BIDIR2(1,0,0,0) for(i=8; i<limit; i++){ int fx= motion_fx+vect[i][0]; int fy= motion_fy+vect[i][1]; int bx= motion_bx+vect[i][2]; int by= motion_by+vect[i][3]; if(borderdist<=0){ int a= (xmax - FFMAX(fx,bx))|(FFMIN(fx,bx) - xmin); int b= (ymax - FFMAX(fy,by))|(FFMIN(fy,by) - ymin); if((a|b) < 0) map[(hashidx+hash[i])&255] = 1; } if(!map[(hashidx+hash[i])&255]){ int score; map[(hashidx+hash[i])&255] = 1; score= check_bidir_mv(s, fx, fy, bx, by, pred_fx, pred_fy, pred_bx, pred_by, 0, 16); if(score < fbmin){ hashidx += hash[i]; fbmin= score; motion_fx=fx; motion_fy=fy; motion_bx=bx; motion_by=by; end=0; borderdist--; if(borderdist<=0){ int a= FFMIN(xmax - FFMAX(fx,bx), FFMIN(fx,bx) - xmin); int b= FFMIN(ymax - FFMAX(fy,by), FFMIN(fy,by) - ymin); borderdist= FFMIN(a,b); } } } } }while(!end); } s->b_bidir_forw_mv_table[xy][0]= motion_fx; s->b_bidir_forw_mv_table[xy][1]= motion_fy; s->b_bidir_back_mv_table[xy][0]= motion_bx; s->b_bidir_back_mv_table[xy][1]= motion_by; return fbmin; } static inline int direct_search(MpegEncContext * s, int mb_x, int mb_y) { MotionEstContext * const c= &s->me; int P[10][2]; const int mot_stride = s->mb_stride; const int mot_xy = mb_y*mot_stride + mb_x; const int shift= 1+s->quarter_sample; int dmin, i; const int time_pp= s->pp_time; const int time_pb= s->pb_time; int mx, my, xmin, xmax, ymin, ymax; int16_t (*mv_table)[2]= s->b_direct_mv_table; c->current_mv_penalty= c->mv_penalty[1] + MAX_MV; ymin= xmin=(-32)>>shift; ymax= xmax= 31>>shift; if(IS_8X8(s->next_picture.mb_type[mot_xy])){ s->mv_type= MV_TYPE_8X8; }else{ s->mv_type= MV_TYPE_16X16; } for(i=0; i<4; i++){ int index= s->block_index[i]; int min, max; c->co_located_mv[i][0]= s->next_picture.motion_val[0][index][0]; c->co_located_mv[i][1]= s->next_picture.motion_val[0][index][1]; c->direct_basis_mv[i][0]= c->co_located_mv[i][0]*time_pb/time_pp + ((i& 1)<<(shift+3)); c->direct_basis_mv[i][1]= c->co_located_mv[i][1]*time_pb/time_pp + ((i>>1)<<(shift+3)); // c->direct_basis_mv[1][i][0]= c->co_located_mv[i][0]*(time_pb - time_pp)/time_pp + ((i &1)<<(shift+3); // c->direct_basis_mv[1][i][1]= c->co_located_mv[i][1]*(time_pb - time_pp)/time_pp + ((i>>1)<<(shift+3); max= FFMAX(c->direct_basis_mv[i][0], c->direct_basis_mv[i][0] - c->co_located_mv[i][0])>>shift; min= FFMIN(c->direct_basis_mv[i][0], c->direct_basis_mv[i][0] - c->co_located_mv[i][0])>>shift; max+= 16*mb_x + 1; // +-1 is for the simpler rounding min+= 16*mb_x - 1; xmax= FFMIN(xmax, s->width - max); xmin= FFMAX(xmin, - 16 - min); max= FFMAX(c->direct_basis_mv[i][1], c->direct_basis_mv[i][1] - c->co_located_mv[i][1])>>shift; min= FFMIN(c->direct_basis_mv[i][1], c->direct_basis_mv[i][1] - c->co_located_mv[i][1])>>shift; max+= 16*mb_y + 1; // +-1 is for the simpler rounding min+= 16*mb_y - 1; ymax= FFMIN(ymax, s->height - max); ymin= FFMAX(ymin, - 16 - min); if(s->mv_type == MV_TYPE_16X16) break; } assert(xmax <= 15 && ymax <= 15 && xmin >= -16 && ymin >= -16); if(xmax < 0 || xmin >0 || ymax < 0 || ymin > 0){ s->b_direct_mv_table[mot_xy][0]= 0; s->b_direct_mv_table[mot_xy][1]= 0; return 256*256*256*64; } c->xmin= xmin; c->ymin= ymin; c->xmax= xmax; c->ymax= ymax; c->flags |= FLAG_DIRECT; c->sub_flags |= FLAG_DIRECT; c->pred_x=0; c->pred_y=0; P_LEFT[0] = av_clip(mv_table[mot_xy - 1][0], xmin<<shift, xmax<<shift); P_LEFT[1] = av_clip(mv_table[mot_xy - 1][1], ymin<<shift, ymax<<shift); /* special case for first line */ if (!s->first_slice_line) { //FIXME maybe allow this over thread boundary as it is clipped P_TOP[0] = av_clip(mv_table[mot_xy - mot_stride ][0], xmin<<shift, xmax<<shift); P_TOP[1] = av_clip(mv_table[mot_xy - mot_stride ][1], ymin<<shift, ymax<<shift); P_TOPRIGHT[0] = av_clip(mv_table[mot_xy - mot_stride + 1 ][0], xmin<<shift, xmax<<shift); P_TOPRIGHT[1] = av_clip(mv_table[mot_xy - mot_stride + 1 ][1], ymin<<shift, ymax<<shift); P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]); P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]); } dmin = ff_epzs_motion_search(s, &mx, &my, P, 0, 0, mv_table, 1<<(16-shift), 0, 16); if(c->sub_flags&FLAG_QPEL) dmin = qpel_motion_search(s, &mx, &my, dmin, 0, 0, 0, 16); else dmin = hpel_motion_search(s, &mx, &my, dmin, 0, 0, 0, 16); if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip) dmin= ff_get_mb_score(s, mx, my, 0, 0, 0, 16, 1); get_limits(s, 16*mb_x, 16*mb_y); //restore c->?min/max, maybe not needed mv_table[mot_xy][0]= mx; mv_table[mot_xy][1]= my; c->flags &= ~FLAG_DIRECT; c->sub_flags &= ~FLAG_DIRECT; return dmin; } void ff_estimate_b_frame_motion(MpegEncContext * s, int mb_x, int mb_y) { MotionEstContext * const c= &s->me; const int penalty_factor= c->mb_penalty_factor; int fmin, bmin, dmin, fbmin, bimin, fimin; int type=0; const int xy = mb_y*s->mb_stride + mb_x; init_ref(c, s->new_picture.data, s->last_picture.data, s->next_picture.data, 16*mb_x, 16*mb_y, 2); get_limits(s, 16*mb_x, 16*mb_y); c->skip=0; if(s->codec_id == CODEC_ID_MPEG4 && s->next_picture.mbskip_table[xy]){ int score= direct_search(s, mb_x, mb_y); //FIXME just check 0,0 score= ((unsigned)(score*score + 128*256))>>16; c->mc_mb_var_sum_temp += score; s->current_picture.mc_mb_var[mb_y*s->mb_stride + mb_x] = score; //FIXME use SSE s->mb_type[mb_y*s->mb_stride + mb_x]= CANDIDATE_MB_TYPE_DIRECT0; return; } if(c->avctx->me_threshold){ int vard= check_input_motion(s, mb_x, mb_y, 0); if((vard+128)>>8 < c->avctx->me_threshold){ // pix = c->src[0][0]; // sum = s->dsp.pix_sum(pix, s->linesize); // varc = s->dsp.pix_norm1(pix, s->linesize) - (((unsigned)(sum*sum))>>8) + 500; // pic->mb_var [s->mb_stride * mb_y + mb_x] = (varc+128)>>8; s->current_picture.mc_mb_var[s->mb_stride * mb_y + mb_x] = (vard+128)>>8; /* pic->mb_mean [s->mb_stride * mb_y + mb_x] = (sum+128)>>8; c->mb_var_sum_temp += (varc+128)>>8;*/ c->mc_mb_var_sum_temp += (vard+128)>>8; /* if (vard <= 64<<8 || vard < varc) { c->scene_change_score+= ff_sqrt(vard) - ff_sqrt(varc); }else{ c->scene_change_score+= s->qscale * s->avctx->scenechange_factor; }*/ return; } if((vard+128)>>8 < c->avctx->mb_threshold){ type= s->mb_type[mb_y*s->mb_stride + mb_x]; if(type == CANDIDATE_MB_TYPE_DIRECT){ direct_search(s, mb_x, mb_y); } if(type == CANDIDATE_MB_TYPE_FORWARD || type == CANDIDATE_MB_TYPE_BIDIR){ c->skip=0; ff_estimate_motion_b(s, mb_x, mb_y, s->b_forw_mv_table, 0, s->f_code); } if(type == CANDIDATE_MB_TYPE_BACKWARD || type == CANDIDATE_MB_TYPE_BIDIR){ c->skip=0; ff_estimate_motion_b(s, mb_x, mb_y, s->b_back_mv_table, 2, s->b_code); } if(type == CANDIDATE_MB_TYPE_FORWARD_I || type == CANDIDATE_MB_TYPE_BIDIR_I){ c->skip=0; c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_MV; interlaced_search(s, 0, s->b_field_mv_table[0], s->b_field_select_table[0], s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1], 1); } if(type == CANDIDATE_MB_TYPE_BACKWARD_I || type == CANDIDATE_MB_TYPE_BIDIR_I){ c->skip=0; c->current_mv_penalty= c->mv_penalty[s->b_code] + MAX_MV; interlaced_search(s, 2, s->b_field_mv_table[1], s->b_field_select_table[1], s->b_back_mv_table[xy][0], s->b_back_mv_table[xy][1], 1); } return; } } if (s->codec_id == CODEC_ID_MPEG4) dmin= direct_search(s, mb_x, mb_y); else dmin= INT_MAX; //FIXME penalty stuff for non mpeg4 c->skip=0; fmin= ff_estimate_motion_b(s, mb_x, mb_y, s->b_forw_mv_table, 0, s->f_code) + 3*penalty_factor; c->skip=0; bmin= ff_estimate_motion_b(s, mb_x, mb_y, s->b_back_mv_table, 2, s->b_code) + 2*penalty_factor; //printf(" %d %d ", s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1]); c->skip=0; fbmin= bidir_refine(s, mb_x, mb_y) + penalty_factor; //printf("%d %d %d %d\n", dmin, fmin, bmin, fbmin); if(s->flags & CODEC_FLAG_INTERLACED_ME){ //FIXME mb type penalty c->skip=0; c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_MV; fimin= interlaced_search(s, 0, s->b_field_mv_table[0], s->b_field_select_table[0], s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1], 0); c->current_mv_penalty= c->mv_penalty[s->b_code] + MAX_MV; bimin= interlaced_search(s, 2, s->b_field_mv_table[1], s->b_field_select_table[1], s->b_back_mv_table[xy][0], s->b_back_mv_table[xy][1], 0); }else fimin= bimin= INT_MAX; { int score= fmin; type = CANDIDATE_MB_TYPE_FORWARD; if (dmin <= score){ score = dmin; type = CANDIDATE_MB_TYPE_DIRECT; } if(bmin<score){ score=bmin; type= CANDIDATE_MB_TYPE_BACKWARD; } if(fbmin<score){ score=fbmin; type= CANDIDATE_MB_TYPE_BIDIR; } if(fimin<score){ score=fimin; type= CANDIDATE_MB_TYPE_FORWARD_I; } if(bimin<score){ score=bimin; type= CANDIDATE_MB_TYPE_BACKWARD_I; } score= ((unsigned)(score*score + 128*256))>>16; c->mc_mb_var_sum_temp += score; s->current_picture.mc_mb_var[mb_y*s->mb_stride + mb_x] = score; //FIXME use SSE } if(c->avctx->mb_decision > FF_MB_DECISION_SIMPLE){ type= CANDIDATE_MB_TYPE_FORWARD | CANDIDATE_MB_TYPE_BACKWARD | CANDIDATE_MB_TYPE_BIDIR | CANDIDATE_MB_TYPE_DIRECT; if(fimin < INT_MAX) type |= CANDIDATE_MB_TYPE_FORWARD_I; if(bimin < INT_MAX) type |= CANDIDATE_MB_TYPE_BACKWARD_I; if(fimin < INT_MAX && bimin < INT_MAX){ type |= CANDIDATE_MB_TYPE_BIDIR_I; } //FIXME something smarter if(dmin>256*256*16) type&= ~CANDIDATE_MB_TYPE_DIRECT; //do not try direct mode if it is invalid for this MB if(s->codec_id == CODEC_ID_MPEG4 && type&CANDIDATE_MB_TYPE_DIRECT && s->flags&CODEC_FLAG_MV0 && *(uint32_t*)s->b_direct_mv_table[xy]) type |= CANDIDATE_MB_TYPE_DIRECT0; #if 0 if(s->out_format == FMT_MPEG1) type |= CANDIDATE_MB_TYPE_INTRA; #endif } s->mb_type[mb_y*s->mb_stride + mb_x]= type; } /* find best f_code for ME which do unlimited searches */ int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type) { if(s->me_method>=ME_EPZS){ int score[8]; int i, y, range= s->avctx->me_range ? s->avctx->me_range : (INT_MAX/2); uint8_t * fcode_tab= s->fcode_tab; int best_fcode=-1; int best_score=-10000000; if(s->msmpeg4_version) range= FFMIN(range, 16); else if(s->codec_id == CODEC_ID_MPEG2VIDEO && s->avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL) range= FFMIN(range, 256); for(i=0; i<8; i++) score[i]= s->mb_num*(8-i); for(y=0; y<s->mb_height; y++){ int x; int xy= y*s->mb_stride; for(x=0; x<s->mb_width; x++){ if(s->mb_type[xy] & type){ int mx= mv_table[xy][0]; int my= mv_table[xy][1]; int fcode= FFMAX(fcode_tab[mx + MAX_MV], fcode_tab[my + MAX_MV]); int j; if(mx >= range || mx < -range || my >= range || my < -range) continue; for(j=0; j<fcode && j<8; j++){ if(s->pict_type==FF_B_TYPE || s->current_picture.mc_mb_var[xy] < s->current_picture.mb_var[xy]) score[j]-= 170; } } xy++; } } for(i=1; i<8; i++){ if(score[i] > best_score){ best_score= score[i]; best_fcode= i; } // printf("%d %d\n", i, score[i]); } // printf("fcode: %d type: %d\n", i, s->pict_type); return best_fcode; /* for(i=0; i<=MAX_FCODE; i++){ printf("%d ", mv_num[i]); } printf("\n");*/ }else{ return 1; } } void ff_fix_long_p_mvs(MpegEncContext * s) { MotionEstContext * const c= &s->me; const int f_code= s->f_code; int y, range; assert(s->pict_type==FF_P_TYPE); range = (((s->out_format == FMT_MPEG1 || s->msmpeg4_version) ? 8 : 16) << f_code); assert(range <= 16 || !s->msmpeg4_version); assert(range <=256 || !(s->codec_id == CODEC_ID_MPEG2VIDEO && s->avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL)); if(c->avctx->me_range && range > c->avctx->me_range) range= c->avctx->me_range; //printf("%d no:%d %d//\n", clip, noclip, f_code); if(s->flags&CODEC_FLAG_4MV){ const int wrap= s->b8_stride; /* clip / convert to intra 8x8 type MVs */ for(y=0; y<s->mb_height; y++){ int xy= y*2*wrap; int i= y*s->mb_stride; int x; for(x=0; x<s->mb_width; x++){ if(s->mb_type[i]&CANDIDATE_MB_TYPE_INTER4V){ int block; for(block=0; block<4; block++){ int off= (block& 1) + (block>>1)*wrap; int mx= s->current_picture.motion_val[0][ xy + off ][0]; int my= s->current_picture.motion_val[0][ xy + off ][1]; if( mx >=range || mx <-range || my >=range || my <-range){ s->mb_type[i] &= ~CANDIDATE_MB_TYPE_INTER4V; s->mb_type[i] |= CANDIDATE_MB_TYPE_INTRA; s->current_picture.mb_type[i]= CANDIDATE_MB_TYPE_INTRA; } } } xy+=2; i++; } } } } /** * * @param truncate 1 for truncation, 0 for using intra */ void ff_fix_long_mvs(MpegEncContext * s, uint8_t *field_select_table, int field_select, int16_t (*mv_table)[2], int f_code, int type, int truncate) { MotionEstContext * const c= &s->me; int y, h_range, v_range; // RAL: 8 in MPEG-1, 16 in MPEG-4 int range = (((s->out_format == FMT_MPEG1 || s->msmpeg4_version) ? 8 : 16) << f_code); if(c->avctx->me_range && range > c->avctx->me_range) range= c->avctx->me_range; h_range= range; v_range= field_select_table ? range>>1 : range; /* clip / convert to intra 16x16 type MVs */ for(y=0; y<s->mb_height; y++){ int x; int xy= y*s->mb_stride; for(x=0; x<s->mb_width; x++){ if (s->mb_type[xy] & type){ // RAL: "type" test added... if(field_select_table==NULL || field_select_table[xy] == field_select){ if( mv_table[xy][0] >=h_range || mv_table[xy][0] <-h_range || mv_table[xy][1] >=v_range || mv_table[xy][1] <-v_range){ if(truncate){ if (mv_table[xy][0] > h_range-1) mv_table[xy][0]= h_range-1; else if(mv_table[xy][0] < -h_range ) mv_table[xy][0]= -h_range; if (mv_table[xy][1] > v_range-1) mv_table[xy][1]= v_range-1; else if(mv_table[xy][1] < -v_range ) mv_table[xy][1]= -v_range; }else{ s->mb_type[xy] &= ~type; s->mb_type[xy] |= CANDIDATE_MB_TYPE_INTRA; mv_table[xy][0]= mv_table[xy][1]= 0; } } } } xy++; } } }
123linslouis-android-video-cutter
jni/libavcodec/motion_est.c
C
asf20
79,823
/* * WMA compatible encoder * Copyright (c) 2007 Michael Niedermayer * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avcodec.h" #include "wma.h" #undef NDEBUG #include <assert.h> static int encode_init(AVCodecContext * avctx){ WMACodecContext *s = avctx->priv_data; int i, flags1, flags2; uint8_t *extradata; s->avctx = avctx; if(avctx->channels > MAX_CHANNELS) return -1; if(avctx->bit_rate < 24*1000) return -1; /* extract flag infos */ flags1 = 0; flags2 = 1; if (avctx->codec->id == CODEC_ID_WMAV1) { extradata= av_malloc(4); avctx->extradata_size= 4; AV_WL16(extradata, flags1); AV_WL16(extradata+2, flags2); } else if (avctx->codec->id == CODEC_ID_WMAV2) { extradata= av_mallocz(10); avctx->extradata_size= 10; AV_WL32(extradata, flags1); AV_WL16(extradata+4, flags2); }else assert(0); avctx->extradata= extradata; s->use_exp_vlc = flags2 & 0x0001; s->use_bit_reservoir = flags2 & 0x0002; s->use_variable_block_len = flags2 & 0x0004; ff_wma_init(avctx, flags2); /* init MDCT */ for(i = 0; i < s->nb_block_sizes; i++) ff_mdct_init(&s->mdct_ctx[i], s->frame_len_bits - i + 1, 0, 1.0); avctx->block_align= s->block_align= avctx->bit_rate*(int64_t)s->frame_len / (avctx->sample_rate*8); //av_log(NULL, AV_LOG_ERROR, "%d %d %d %d\n", s->block_align, avctx->bit_rate, s->frame_len, avctx->sample_rate); avctx->frame_size= s->frame_len; return 0; } static void apply_window_and_mdct(AVCodecContext * avctx, signed short * audio, int len) { WMACodecContext *s = avctx->priv_data; int window_index= s->frame_len_bits - s->block_len_bits; int i, j, channel; const float * win = s->windows[window_index]; int window_len = 1 << s->block_len_bits; float n = window_len/2; for (channel = 0; channel < avctx->channels; channel++) { memcpy(s->output, s->frame_out[channel], sizeof(float)*window_len); j = channel; for (i = 0; i < len; i++, j += avctx->channels){ s->output[i+window_len] = audio[j] / n * win[window_len - i - 1]; s->frame_out[channel][i] = audio[j] / n * win[i]; } ff_mdct_calc(&s->mdct_ctx[window_index], s->coefs[channel], s->output); } } //FIXME use for decoding too static void init_exp(WMACodecContext *s, int ch, const int *exp_param){ int n; const uint16_t *ptr; float v, *q, max_scale, *q_end; ptr = s->exponent_bands[s->frame_len_bits - s->block_len_bits]; q = s->exponents[ch]; q_end = q + s->block_len; max_scale = 0; while (q < q_end) { /* XXX: use a table */ v = pow(10, *exp_param++ * (1.0 / 16.0)); max_scale= FFMAX(max_scale, v); n = *ptr++; do { *q++ = v; } while (--n); } s->max_exponent[ch] = max_scale; } static void encode_exp_vlc(WMACodecContext *s, int ch, const int *exp_param){ int last_exp; const uint16_t *ptr; float *q, *q_end; ptr = s->exponent_bands[s->frame_len_bits - s->block_len_bits]; q = s->exponents[ch]; q_end = q + s->block_len; if (s->version == 1) { last_exp= *exp_param++; assert(last_exp-10 >= 0 && last_exp-10 < 32); put_bits(&s->pb, 5, last_exp - 10); q+= *ptr++; }else last_exp = 36; while (q < q_end) { int exp = *exp_param++; int code = exp - last_exp + 60; assert(code >= 0 && code < 120); put_bits(&s->pb, ff_aac_scalefactor_bits[code], ff_aac_scalefactor_code[code]); /* XXX: use a table */ q+= *ptr++; last_exp= exp; } } static int encode_block(WMACodecContext *s, float (*src_coefs)[BLOCK_MAX_SIZE], int total_gain){ int v, bsize, ch, coef_nb_bits, parse_exponents; float mdct_norm; int nb_coefs[MAX_CHANNELS]; static const int fixed_exp[25]={20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20}; //FIXME remove duplication relative to decoder if (s->use_variable_block_len) { assert(0); //FIXME not implemented }else{ /* fixed block len */ s->next_block_len_bits = s->frame_len_bits; s->prev_block_len_bits = s->frame_len_bits; s->block_len_bits = s->frame_len_bits; } s->block_len = 1 << s->block_len_bits; // assert((s->block_pos + s->block_len) <= s->frame_len); bsize = s->frame_len_bits - s->block_len_bits; //FIXME factor v = s->coefs_end[bsize] - s->coefs_start; for(ch = 0; ch < s->nb_channels; ch++) nb_coefs[ch] = v; { int n4 = s->block_len / 2; mdct_norm = 1.0 / (float)n4; if (s->version == 1) { mdct_norm *= sqrt(n4); } } if (s->nb_channels == 2) { put_bits(&s->pb, 1, s->ms_stereo= 1); } for(ch = 0; ch < s->nb_channels; ch++) { s->channel_coded[ch] = 1; //FIXME only set channel_coded when needed, instead of always if (s->channel_coded[ch]) { init_exp(s, ch, fixed_exp); } } for(ch = 0; ch < s->nb_channels; ch++) { if (s->channel_coded[ch]) { WMACoef *coefs1; float *coefs, *exponents, mult; int i, n; coefs1 = s->coefs1[ch]; exponents = s->exponents[ch]; mult = pow(10, total_gain * 0.05) / s->max_exponent[ch]; mult *= mdct_norm; coefs = src_coefs[ch]; if (s->use_noise_coding && 0) { assert(0); //FIXME not implemented } else { coefs += s->coefs_start; n = nb_coefs[ch]; for(i = 0;i < n; i++){ double t= *coefs++ / (exponents[i] * mult); if(t<-32768 || t>32767) return -1; coefs1[i] = lrint(t); } } } } v = 0; for(ch = 0; ch < s->nb_channels; ch++) { int a = s->channel_coded[ch]; put_bits(&s->pb, 1, a); v |= a; } if (!v) return 1; for(v= total_gain-1; v>=127; v-= 127) put_bits(&s->pb, 7, 127); put_bits(&s->pb, 7, v); coef_nb_bits= ff_wma_total_gain_to_bits(total_gain); if (s->use_noise_coding) { for(ch = 0; ch < s->nb_channels; ch++) { if (s->channel_coded[ch]) { int i, n; n = s->exponent_high_sizes[bsize]; for(i=0;i<n;i++) { put_bits(&s->pb, 1, s->high_band_coded[ch][i]= 0); if (0) nb_coefs[ch] -= s->exponent_high_bands[bsize][i]; } } } } parse_exponents = 1; if (s->block_len_bits != s->frame_len_bits) { put_bits(&s->pb, 1, parse_exponents); } if (parse_exponents) { for(ch = 0; ch < s->nb_channels; ch++) { if (s->channel_coded[ch]) { if (s->use_exp_vlc) { encode_exp_vlc(s, ch, fixed_exp); } else { assert(0); //FIXME not implemented // encode_exp_lsp(s, ch); } } } } else { assert(0); //FIXME not implemented } for(ch = 0; ch < s->nb_channels; ch++) { if (s->channel_coded[ch]) { int run, tindex; WMACoef *ptr, *eptr; tindex = (ch == 1 && s->ms_stereo); ptr = &s->coefs1[ch][0]; eptr = ptr + nb_coefs[ch]; run=0; for(;ptr < eptr; ptr++){ if(*ptr){ int level= *ptr; int abs_level= FFABS(level); int code= 0; if(abs_level <= s->coef_vlcs[tindex]->max_level){ if(run < s->coef_vlcs[tindex]->levels[abs_level-1]) code= run + s->int_table[tindex][abs_level-1]; } assert(code < s->coef_vlcs[tindex]->n); put_bits(&s->pb, s->coef_vlcs[tindex]->huffbits[code], s->coef_vlcs[tindex]->huffcodes[code]); if(code == 0){ if(1<<coef_nb_bits <= abs_level) return -1; //Workaround minor rounding differences for the regression tests, FIXME we should find and replace the problematic float by fixpoint for reg tests if(abs_level == 0x71B && (s->avctx->flags & CODEC_FLAG_BITEXACT)) abs_level=0x71A; put_bits(&s->pb, coef_nb_bits, abs_level); put_bits(&s->pb, s->frame_len_bits, run); } put_bits(&s->pb, 1, level < 0); //FIXME the sign is fliped somewhere run=0; }else{ run++; } } if(run) put_bits(&s->pb, s->coef_vlcs[tindex]->huffbits[1], s->coef_vlcs[tindex]->huffcodes[1]); } if (s->version == 1 && s->nb_channels >= 2) { align_put_bits(&s->pb); } } return 0; } static int encode_frame(WMACodecContext *s, float (*src_coefs)[BLOCK_MAX_SIZE], uint8_t *buf, int buf_size, int total_gain){ init_put_bits(&s->pb, buf, buf_size); if (s->use_bit_reservoir) { assert(0);//FIXME not implemented }else{ if(encode_block(s, src_coefs, total_gain) < 0) return INT_MAX; } align_put_bits(&s->pb); return put_bits_count(&s->pb)/8 - s->block_align; } static int encode_superframe(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){ WMACodecContext *s = avctx->priv_data; short *samples = data; int i, total_gain; s->block_len_bits= s->frame_len_bits; //required by non variable block len s->block_len = 1 << s->block_len_bits; apply_window_and_mdct(avctx, samples, avctx->frame_size); if (s->ms_stereo) { float a, b; int i; for(i = 0; i < s->block_len; i++) { a = s->coefs[0][i]*0.5; b = s->coefs[1][i]*0.5; s->coefs[0][i] = a + b; s->coefs[1][i] = a - b; } } #if 1 total_gain= 128; for(i=64; i; i>>=1){ int error= encode_frame(s, s->coefs, buf, buf_size, total_gain-i); if(error<0) total_gain-= i; } #else total_gain= 90; best= encode_frame(s, s->coefs, buf, buf_size, total_gain); for(i=32; i; i>>=1){ int scoreL= encode_frame(s, s->coefs, buf, buf_size, total_gain-i); int scoreR= encode_frame(s, s->coefs, buf, buf_size, total_gain+i); av_log(NULL, AV_LOG_ERROR, "%d %d %d (%d)\n", scoreL, best, scoreR, total_gain); if(scoreL < FFMIN(best, scoreR)){ best = scoreL; total_gain -= i; }else if(scoreR < best){ best = scoreR; total_gain += i; } } #endif encode_frame(s, s->coefs, buf, buf_size, total_gain); assert((put_bits_count(&s->pb) & 7) == 0); i= s->block_align - (put_bits_count(&s->pb)+7)/8; assert(i>=0); while(i--) put_bits(&s->pb, 8, 'N'); flush_put_bits(&s->pb); return put_bits_ptr(&s->pb) - s->pb.buf; } AVCodec wmav1_encoder = { "wmav1", AVMEDIA_TYPE_AUDIO, CODEC_ID_WMAV1, sizeof(WMACodecContext), encode_init, encode_superframe, ff_wma_end, .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"), }; AVCodec wmav2_encoder = { "wmav2", AVMEDIA_TYPE_AUDIO, CODEC_ID_WMAV2, sizeof(WMACodecContext), encode_init, encode_superframe, ff_wma_end, .sample_fmts = (const enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE}, .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"), };
123linslouis-android-video-cutter
jni/libavcodec/wmaenc.c
C
asf20
12,776
/* * Header file for hardcoded AAC tables * * Copyright (c) 2010 Alex Converse <alex.converse@gmail.com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AAC_TABLEGEN_INIT_H #define AAC_TABLEGEN_INIT_H #if CONFIG_HARDCODED_TABLES #define ff_aac_tableinit() extern const float ff_aac_pow2sf_tab[428]; #else void ff_aac_tableinit(void); extern float ff_aac_pow2sf_tab[428]; #endif /* CONFIG_HARDCODED_TABLES */ #endif /* AAC_TABLEGEN_INIT_H */
123linslouis-android-video-cutter
jni/libavcodec/aac_tablegen_decl.h
C
asf20
1,176
/* * Deluxe Paint Animation decoder * Copyright (c) 2009 Peter Ross * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * Deluxe Paint Animation decoder */ #include "avcodec.h" #include "bytestream.h" typedef struct AnmContext { AVFrame frame; int x; ///< x coordinate position } AnmContext; static av_cold int decode_init(AVCodecContext *avctx) { AnmContext *s = avctx->priv_data; const uint8_t *buf; int i; avctx->pix_fmt = PIX_FMT_PAL8; if (avctx->extradata_size != 16*8 + 4*256) return -1; s->frame.reference = 1; if (avctx->get_buffer(avctx, &s->frame) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } buf = avctx->extradata + 16*8; for (i = 0; i < 256; i++) ((uint32_t*)s->frame.data[1])[i] = bytestream_get_le32(&buf); return 0; } /** * Perform decode operation * @param dst, dst_end Destination image buffer * @param buf, buf_end Source buffer (optional, see below) * @param pixel Fill color (optional, see below) * @param count Pixel count * @param x Pointer to x-axis counter * @param width Image width * @param linesize Destination image buffer linesize * @return non-zero if destination buffer is exhausted * * a copy operation is achieved when 'buf' is set * a fill operation is acheived when 'buf' is null and pixel is >= 0 * a skip operation is acheived when 'buf' is null and pixel is < 0 */ static inline int op(uint8_t **dst, const uint8_t *dst_end, const uint8_t **buf, const uint8_t *buf_end, int pixel, int count, int *x, int width, int linesize) { int remaining = width - *x; while(count > 0) { int striplen = FFMIN(count, remaining); if (buf) { striplen = FFMIN(striplen, buf_end - *buf); memcpy(*dst, *buf, striplen); *buf += striplen; } else if (pixel >= 0) memset(*dst, pixel, striplen); *dst += striplen; remaining -= striplen; count -= striplen; if (remaining <= 0) { *dst += linesize - width; remaining = width; } if (linesize > 0) { if (*dst >= dst_end) goto exhausted; } else { if (*dst <= dst_end) goto exhausted; } } *x = width - remaining; return 0; exhausted: *x = width - remaining; return 1; } static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { AnmContext *s = avctx->priv_data; const uint8_t *buf = avpkt->data; const int buf_size = avpkt->size; const uint8_t *buf_end = buf + buf_size; uint8_t *dst, *dst_end; int count; if(avctx->reget_buffer(avctx, &s->frame) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } dst = s->frame.data[0]; dst_end = s->frame.data[0] + s->frame.linesize[0]*avctx->height; if (buf[0] != 0x42) { av_log_ask_for_sample(avctx, "unknown record type\n"); return buf_size; } if (buf[1]) { av_log_ask_for_sample(avctx, "padding bytes not supported\n"); return buf_size; } buf += 4; s->x = 0; do { /* if statements are ordered by probability */ #define OP(buf, pixel, count) \ op(&dst, dst_end, (buf), buf_end, (pixel), (count), &s->x, avctx->width, s->frame.linesize[0]) int type = bytestream_get_byte(&buf); count = type & 0x7F; type >>= 7; if (count) { if (OP(type ? NULL : &buf, -1, count)) break; } else if (!type) { int pixel; count = bytestream_get_byte(&buf); /* count==0 gives nop */ pixel = bytestream_get_byte(&buf); if (OP(NULL, pixel, count)) break; } else { int pixel; type = bytestream_get_le16(&buf); count = type & 0x3FFF; type >>= 14; if (!count) { if (type == 0) break; // stop if (type == 2) { av_log_ask_for_sample(avctx, "unknown opcode"); return AVERROR_INVALIDDATA; } continue; } pixel = type == 3 ? bytestream_get_byte(&buf) : -1; if (type == 1) count += 0x4000; if (OP(type == 2 ? &buf : NULL, pixel, count)) break; } } while (buf + 1 < buf_end); *data_size = sizeof(AVFrame); *(AVFrame*)data = s->frame; return buf_size; } static av_cold int decode_end(AVCodecContext *avctx) { AnmContext *s = avctx->priv_data; if (s->frame.data[0]) avctx->release_buffer(avctx, &s->frame); return 0; } AVCodec anm_decoder = { "anm", AVMEDIA_TYPE_VIDEO, CODEC_ID_ANM, sizeof(AnmContext), decode_init, NULL, decode_end, decode_frame, CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("Deluxe Paint Animation"), };
123linslouis-android-video-cutter
jni/libavcodec/anm.c
C
asf20
5,814
/* * Copyright (c) 2007 Michael Niedermayer * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /* layer 3 "granule" */ typedef struct GranuleDef { uint8_t scfsi; int part2_3_length; int big_values; int global_gain; int scalefac_compress; uint8_t block_type; uint8_t switch_point; int table_select[3]; int subblock_gain[3]; uint8_t scalefac_scale; uint8_t count1table_select; int region_size[3]; /* number of huffman codes in each region */ int preflag; int short_start, long_end; /* long/short band indexes */ uint8_t scale_factors[40]; int32_t sb_hybrid[SBLIMIT * 18]; /* 576 samples */ } GranuleDef; void ff_mp3_init(void); /** * Compute huffman coded region sizes. */ void ff_init_short_region(MPADecodeContext *s, GranuleDef *g); /** * Compute huffman coded region sizes. */ void ff_init_long_region(MPADecodeContext *s, GranuleDef *g, int ra1, int ra2); void ff_compute_band_indexes(MPADecodeContext *s, GranuleDef *g);
123linslouis-android-video-cutter
jni/libavcodec/mpegaudio3.h
C
asf20
1,711
/* * MLP codec common code * Copyright (c) 2007-2008 Ian Caulfield * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include <stdint.h> #include "libavutil/crc.h" #include "libavutil/intreadwrite.h" #include "mlp.h" const uint8_t ff_mlp_huffman_tables[3][18][2] = { { /* Huffman table 0, -7 - +10 */ {0x01, 9}, {0x01, 8}, {0x01, 7}, {0x01, 6}, {0x01, 5}, {0x01, 4}, {0x01, 3}, {0x04, 3}, {0x05, 3}, {0x06, 3}, {0x07, 3}, {0x03, 3}, {0x05, 4}, {0x09, 5}, {0x11, 6}, {0x21, 7}, {0x41, 8}, {0x81, 9}, }, { /* Huffman table 1, -7 - +8 */ {0x01, 9}, {0x01, 8}, {0x01, 7}, {0x01, 6}, {0x01, 5}, {0x01, 4}, {0x01, 3}, {0x02, 2}, {0x03, 2}, {0x03, 3}, {0x05, 4}, {0x09, 5}, {0x11, 6}, {0x21, 7}, {0x41, 8}, {0x81, 9}, }, { /* Huffman table 2, -7 - +7 */ {0x01, 9}, {0x01, 8}, {0x01, 7}, {0x01, 6}, {0x01, 5}, {0x01, 4}, {0x01, 3}, {0x01, 1}, {0x03, 3}, {0x05, 4}, {0x09, 5}, {0x11, 6}, {0x21, 7}, {0x41, 8}, {0x81, 9}, } }; static int crc_init = 0; #if CONFIG_SMALL #define CRC_TABLE_SIZE 257 #else #define CRC_TABLE_SIZE 1024 #endif static AVCRC crc_63[CRC_TABLE_SIZE]; static AVCRC crc_1D[CRC_TABLE_SIZE]; static AVCRC crc_2D[CRC_TABLE_SIZE]; av_cold void ff_mlp_init_crc(void) { if (!crc_init) { av_crc_init(crc_63, 0, 8, 0x63, sizeof(crc_63)); av_crc_init(crc_1D, 0, 8, 0x1D, sizeof(crc_1D)); av_crc_init(crc_2D, 0, 16, 0x002D, sizeof(crc_2D)); crc_init = 1; } } uint16_t ff_mlp_checksum16(const uint8_t *buf, unsigned int buf_size) { uint16_t crc; crc = av_crc(crc_2D, 0, buf, buf_size - 2); crc ^= AV_RL16(buf + buf_size - 2); return crc; } uint8_t ff_mlp_checksum8(const uint8_t *buf, unsigned int buf_size) { uint8_t checksum = av_crc(crc_63, 0x3c, buf, buf_size - 1); // crc_63[0xa2] == 0x3c checksum ^= buf[buf_size-1]; return checksum; } uint8_t ff_mlp_restart_checksum(const uint8_t *buf, unsigned int bit_size) { int i; int num_bytes = (bit_size + 2) / 8; int crc = crc_1D[buf[0] & 0x3f]; crc = av_crc(crc_1D, crc, buf + 1, num_bytes - 2); crc ^= buf[num_bytes - 1]; for (i = 0; i < ((bit_size + 2) & 7); i++) { crc <<= 1; if (crc & 0x100) crc ^= 0x11D; crc ^= (buf[num_bytes] >> (7 - i)) & 1; } return crc; } uint8_t ff_mlp_calculate_parity(const uint8_t *buf, unsigned int buf_size) { uint32_t scratch = 0; const uint8_t *buf_end = buf + buf_size; for (; ((intptr_t) buf & 3) && buf < buf_end; buf++) scratch ^= *buf; for (; buf < buf_end - 3; buf += 4) scratch ^= *((const uint32_t*)buf); scratch = xor_32_to_8(scratch); for (; buf < buf_end; buf++) scratch ^= *buf; return scratch; }
123linslouis-android-video-cutter
jni/libavcodec/mlp.c
C
asf20
3,511
/* * SGI image encoder * Xiaohui Sun <tjnksxh@hotmail.com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVCODEC_SGI_H #define AVCODEC_SGI_H /** * SGI image file signature */ #define SGI_MAGIC 474 #define SGI_HEADER_SIZE 512 #define SGI_GRAYSCALE 1 #define SGI_RGB 3 #define SGI_RGBA 4 #endif /* AVCODEC_SGI_H */
123linslouis-android-video-cutter
jni/libavcodec/sgi.h
C
asf20
1,048
/* * Copyright (C) 2007 Marc Hoffman <marc.hoffman@analog.com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /* low level assembler interface wrapper DEFUN(put_pixels_clamped,mL1, (DCTELEM *block, uint8_t *dest, int line_size)): body rts; */ #ifndef AVCODEC_BFIN_CONFIG_BFIN_H #define AVCODEC_BFIN_CONFIG_BFIN_H #include "config.h" #ifndef DEFUN #define mL3 .text #ifndef mL1 #if defined(__FDPIC__) && CONFIG_SRAM #define mL1 .l1.text #else #define mL1 mL3 #endif #endif #define DEFUN(fname,where,interface) \ .section where; \ .global _ff_bfin_ ## fname ; \ .type _ff_bfin_ ## fname, STT_FUNC; \ .align 8; \ _ff_bfin_ ## fname #define DEFUN_END(fname) \ .size _ff_bfin_ ## fname, . - _ff_bfin_ ## fname #ifdef __FDPIC__ #define RELOC(reg,got,obj) reg = [got + obj@GOT17M4] #else #define RELOC(reg,got,obj) reg.L = obj; reg.H = obj #endif #endif #endif /* AVCODEC_BFIN_CONFIG_BFIN_H */
123linslouis-android-video-cutter
jni/libavcodec/bfin/config_bfin.h
C
asf20
1,719
/* * BlackFin DSPUTILS COMMON OPTIMIZATIONS HEADER * * Copyright (C) 2007 Marc Hoffman <mmh@pleasantst.com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVCODEC_BFIN_DSPUTIL_BFIN_H #define AVCODEC_BFIN_DSPUTIL_BFIN_H #include "config.h" #include "libavcodec/dsputil.h" #if defined(__FDPIC__) && CONFIG_SRAM #define attribute_l1_text __attribute__ ((l1_text)) #define attribute_l1_data_b __attribute__((l1_data_B)) #else #define attribute_l1_text #define attribute_l1_data_b #endif void ff_bfin_idct (DCTELEM *block) attribute_l1_text; void ff_bfin_fdct (DCTELEM *block) attribute_l1_text; void ff_bfin_vp3_idct (DCTELEM *block); void ff_bfin_vp3_idct_put (uint8_t *dest, int line_size, DCTELEM *block); void ff_bfin_vp3_idct_add (uint8_t *dest, int line_size, DCTELEM *block); void ff_bfin_add_pixels_clamped (const DCTELEM *block, uint8_t *dest, int line_size) attribute_l1_text; void ff_bfin_put_pixels_clamped (const DCTELEM *block, uint8_t *dest, int line_size) attribute_l1_text; void ff_bfin_diff_pixels (DCTELEM *block, const uint8_t *s1, const uint8_t *s2, int stride) attribute_l1_text; void ff_bfin_get_pixels (DCTELEM *restrict block, const uint8_t *pixels, int line_size) attribute_l1_text; int ff_bfin_pix_norm1 (uint8_t * pix, int line_size) attribute_l1_text; int ff_bfin_z_sad8x8 (uint8_t *blk1, uint8_t *blk2, int dsz, int line_size, int h) attribute_l1_text; int ff_bfin_z_sad16x16 (uint8_t *blk1, uint8_t *blk2, int dsz, int line_size, int h) attribute_l1_text; void ff_bfin_z_put_pixels16_xy2 (uint8_t *block, const uint8_t *s0, int dest_size, int line_size, int h) attribute_l1_text; void ff_bfin_z_put_pixels8_xy2 (uint8_t *block, const uint8_t *s0, int dest_size, int line_size, int h) attribute_l1_text; void ff_bfin_put_pixels16_xy2_nornd (uint8_t *block, const uint8_t *s0, int line_size, int h) attribute_l1_text; void ff_bfin_put_pixels8_xy2_nornd (uint8_t *block, const uint8_t *s0, int line_size, int h) attribute_l1_text; int ff_bfin_pix_sum (uint8_t *p, int stride) attribute_l1_text; void ff_bfin_put_pixels8uc (uint8_t *block, const uint8_t *s0, const uint8_t *s1, int dest_size, int line_size, int h) attribute_l1_text; void ff_bfin_put_pixels16uc (uint8_t *block, const uint8_t *s0, const uint8_t *s1, int dest_size, int line_size, int h) attribute_l1_text; void ff_bfin_put_pixels8uc_nornd (uint8_t *block, const uint8_t *s0, const uint8_t *s1, int line_size, int h) attribute_l1_text; void ff_bfin_put_pixels16uc_nornd (uint8_t *block, const uint8_t *s0, const uint8_t *s1, int line_size, int h) attribute_l1_text; int ff_bfin_sse4 (void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) attribute_l1_text; int ff_bfin_sse8 (void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) attribute_l1_text; int ff_bfin_sse16 (void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) attribute_l1_text; #ifdef BFIN_PROFILE static double Telem[16]; static char *TelemNames[16]; static int TelemCnt; #define PROF(lab,e) { int xx_e = e; char*xx_lab = lab; uint64_t xx_t0 = read_time(); #define EPROF() xx_t0 = read_time()-xx_t0; Telem[xx_e] = Telem[xx_e] + xx_t0; TelemNames[xx_e] = xx_lab; } static void prof_report (void) { int i; double s = 0; for (i=0;i<16;i++) { double v; if (TelemNames[i]) { v = Telem[i]/TelemCnt; av_log (NULL,AV_LOG_DEBUG,"%-20s: %12.4f\t%12.4f\n", TelemNames[i],v,v/64); s = s + Telem[i]; } } av_log (NULL,AV_LOG_DEBUG,"%-20s: %12.4f\t%12.4f\n%20.4f\t%d\n", "total",s/TelemCnt,s/TelemCnt/64,s,TelemCnt); } static void bfprof (void) { static int init; if (!init) atexit (prof_report); init=1; TelemCnt++; } #else #define PROF(a,b) #define EPROF() #define bfprof() #endif #endif /* AVCODEC_BFIN_DSPUTIL_BFIN_H */
123linslouis-android-video-cutter
jni/libavcodec/bfin/dsputil_bfin.h
C
asf20
4,581
/* * fdct BlackFin * * Copyright (C) 2007 Marc Hoffman <marc.hoffman@analog.com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /* void ff_bfin_fdct (DCTELEM *buf); This implementation works only for 8x8 input. The range of input must be -256 to 255 i.e. 8bit input represented in a 16bit data word. The original data must be sign extended into the 16bit data words. Chen factorization of 8 X(m) = sum (x(n) * cos ((2n+1)*m*pi/16)) n=0 C4 0 --*-------------*0+7---*-----*0+3-------*-*-------------------> 0 \ / \ / X S4,S4 1 --*-\---------/-*1+6---*-\-/-*1+2-------*-*-------------------> 4 \ / \ -C4 C3 2 --*---\-----/---*2+5---*-/-\-*1-2---------------*-*-----------> 2 \ / / \ X S3,-S3 3 --*-----\-/-----*3+4---*-----*0-3---------------*-*-----------> 6 / C7 C3 4 --*-----/-\-----*3-4------------*-*4+5--*-----*---------------> 1 / \ -C4 X \ /S7 C3 5 --*---/-----\---*2-5---*-*------*=*4-5----\-/------*-*--------> 5 / \ X S4,S4 / X S3,-S3 6 --*-/---------\-*1-6---*-*------*=*7-6----/-\------*-*--------> 3 / \ C4 X / \-S7 C3 --*-------------*0-7------------*-*7+6--*-----*---------------> 7 C7 Notation Cn = cos(n*pi/8) used throughout the code. Registers used: R0, R1, R2, R3, R4, R5, R6,R7, P0, P1, P2, P3, P4, P5, A0, A1. Other registers used: I0, I1, I2, I3, B0, B2, B3, M0, M1, L3 registers and LC0. Input - r0 - pointer to start of DCTELEM *block Output - The DCT output coefficients in the DCTELEM *block Register constraint: This code is called from jpeg_encode. R6, R5, R4 if modified should be stored and restored. Performance: (Timer version 0.6.33) Code Size : 240 Bytes. Memory Required : Input Matrix : 8 * 8 * 2 Bytes. Coefficients : 16 Bytes Temporary matrix: 8 * 8 * 2 Bytes. Cycle Count :26+{18+8*(14+2S)}*2 where S -> Stalls (7.45 c/pel) ----------------------------------------- | Size | Forward DCT | Inverse DCT | ----------------------------------------- | 8x8 | 284 Cycles | 311 Cycles | ----------------------------------------- Ck = int16(cos(k/16*pi)*32767+.5)/2 #define C4 23170 #define C3 13623 #define C6 6270 #define C7 3196 Sk = int16(sin(k/16*pi)*32767+.5)/2 #define S4 11585 #define S3 9102 #define S6 15137 #define S7 16069 the coefficients are ordered as follows: short dct_coef[] C4,S4, C6,S6, C7,S7, S3,C3, ----------------------------------------------------------- FFMPEG conformance testing results ----------------------------------------------------------- dct-test: modified with the following dct_error("BFINfdct", 0, ff_bfin_fdct, fdct, test); produces the following output: root:/u/ffmpeg/bhead/libavcodec> ./dct-test ffmpeg DCT/IDCT test 2 -131 -6 -48 -36 33 -83 24 34 52 -24 -15 5 92 57 143 -67 -43 -1 74 -16 5 -71 32 -78 106 92 -34 -38 81 20 -18 7 -62 40 2 -15 90 -62 -83 -83 1 -104 -13 43 -19 7 11 -63 31 12 -29 83 72 21 10 -17 -63 -15 73 50 -91 159 -14 DCT BFINfdct: err_inf=2 err2=0.16425938 syserr=0.00795000 maxout=2098 blockSumErr=27 DCT BFINfdct: 92.1 kdct/s root:/u/ffmpeg/bhead/libavcodec> */ #include "config.h" #include "config_bfin.h" #if defined(__FDPIC__) && CONFIG_SRAM .section .l1.data.B,"aw",@progbits #else .data #endif .align 4; dct_coeff: .short 0x5a82, 0x2d41, 0x187e, 0x3b21, 0x0c7c, 0x3ec5, 0x238e, 0x3537; #if defined(__FDPIC__) && CONFIG_SRAM .section .l1.data.A,"aw",@progbits #endif .align 4 vtmp: .space 128 .text DEFUN(fdct,mL1, (DCTELEM *block)): [--SP] = (R7:4, P5:3); // Push the registers onto the stack. b0 = r0; RELOC(r0, P3, dct_coeff); b3 = r0; RELOC(r0, P3, vtmp); b2 = r0; L3 = 16; // L3 is set to 16 to make the coefficient // array Circular. //---------------------------------------------------------------------------- /* * I0, I1, and I2 registers are used to read the input data. I3 register is used * to read the coefficients. P0 and P1 registers are used for writing the output * data. */ M0 = 12 (X); // All these initializations are used in the M1 = 16 (X); // modification of address offsets. M2 = 128 (X); P2 = 16; P3 = 32 (X); P4 = -110 (X); P5 = -62 (X); P0 = 2(X); // Prescale the input to get the correct precision. i0=b0; i1=b0; lsetup (.0, .1) LC0 = P3; r0=[i0++]; .0: r1=r0<<3 (v) || r0=[i0++] ; .1: [i1++]=r1; /* * B0 points to the "in" buffer. * B2 points to "temp" buffer in the first iteration. */ lsetup (.2, .3) LC0 = P0; .2: I0 = B0; // I0 points to Input Element (0, 0). I1 = B0; // Element 1 and 0 is read in R0. I1 += M0 || R0 = [I0++]; // I1 points to Input Element (0, 6). I2 = I1; // Element 6 is read into R3.H. I2 -= 4 || R3.H = W[I1++]; // I2 points to Input Element (0, 4). I3 = B3; // I3 points to Coefficients. P0 = B2; // P0 points to temporary array Element // (0, 0). P1 = B2; // P1 points to temporary array. R7 = [P1++P2] || R2 = [I2++]; // P1 points to temporary array // Element (1, 0). // R7 is a dummy read. X4,X5 // are read into R2. R3.L = W[I1--]; // X7 is read into R3.L. R1.H = W[I0++]; // X2 is read into R1.H. /* * X0 = (X0 + X7) / 2. * X1 = (X1 + X6) / 2. * X6 = (X1 - X6) / 2. * X7 = (X0 - X7) / 2. * It reads the data 3 in R1.L. */ R0 = R0 +|+ R3, R3 = R0 -|- R3 || R1.L = W[I0++] || NOP; /* * X2 = (X2 + X5) / 2. * X3 = (X3 + X4) / 2. * X4 = (X3 - X4) / 2. * X5 = (X2 - X5) / 2. * R7 = C4 = cos(4*pi/16) */ R1 = R1 +|+ R2, R2 = R1 -|- R2 (CO) || NOP || R7 = [I3++]; /* * At the end of stage 1 R0 has (1,0), R1 has (2,3), R2 has (4, 5) and * R3 has (6,7). * Where the notation (x, y) represents uper/lower half pairs. */ /* * X0 = X0 + X3. * X1 = X1 + X2. * X2 = X1 - X2. * X3 = X0 - X3. */ R0 = R0 +|+ R1, R1 = R0 -|- R1; lsetup (.row0, .row1) LC1 = P2 >> 1; // 1d dct, loops 8x .row0: /* * This is part 2 computation continued..... * A1 = X6 * cos(pi/4) * A0 = X6 * cos(pi/4) * A1 = A1 - X5 * cos(pi/4) * A0 = A0 + X5 * cos(pi/4). * The instruction W[I0] = R3.L is used for packing it to R2.L. */ A1=R3.H*R7.l, A0=R3.H*R7.l || I1+=M1 || W[I0] = R3.L; R4.H=(A1-=R2.L*R7.l), R4.L=(A0+=R2.L*R7.l) || I2+=M0 || NOP; /* R0 = (X1,X0) R1 = (X2,X3) R4 = (X5, X6). */ /* * A1 = X0 * cos(pi/4) * A0 = X0 * cos(pi/4) * A1 = A1 - X1 * cos(pi/4) * A0 = A0 + X1 * cos(pi/4) * R7 = (C2,C6) */ A1=R0.L*R7.h, A0=R0.L*R7.h || NOP || R3.H=W[I1++]; R5.H=(A1-=R0.H*R7.h),R5.L=(A0+=R0.H*R7.h) || R7=[I3++] || NOP; /* * A1 = X2 * cos(3pi/8) * A0 = X3 * cos(3pi/8) * A1 = A1 + X3 * cos(pi/8) * A0 = A0 - X2 * cos(pi/8) * R3 = cos(pi/4) * R7 = (cos(7pi/8),cos(pi/8)) * X4 = X4 + X5. * X5 = X4 - X5. * X6 = X7 - X6. * X7 = X7 + X6. */ A1=R1.H*R7.L, A0=R1.L*R7.L || W[P0++P3]=R5.L || R2.L=W[I0]; R2=R2+|+R4, R4=R2-|-R4 || I0+=4 || R3.L=W[I1--]; R6.H=(A1+=R1.L*R7.H),R6.L=(A0 -= R1.H * R7.H) || I0+=4 || R7=[I3++]; /* R2 = (X4, X7) R4 = (X5,X6) R5 = (X1, X0) R6 = (X2,X3). */ /* * A1 = X4 * cos(7pi/16) * A0 = X7 * cos(7pi/16) * A1 = A1 + X7 * cos(pi/16) * A0 = A0 - X4 * cos(pi/16) */ A1=R2.H*R7.L, A0=R2.L*R7.L || W[P0++P3]=R6.H || R0=[I0++]; R2.H=(A1+=R2.L*R7.H),R2.L=(A0-=R2.H*R7.H) || W[P0++P3]=R5.H || R7=[I3++]; /* * A1 = X5 * cos(3pi/16) * A0 = X6 * cos(3pi/16) * A1 = A1 + X6 * cos(5pi/16) * A0 = A0 - X5 * cos(5pi/16) * The output values are written. */ A1=R4.H*R7.H, A0=R4.L*R7.H || W[P0++P2]=R6.L || R1.H=W[I0++]; R4.H=(A1+=R4.L*R7.L),R4.L=(A0-=R4.H*R7.L) || W[P0++P4]=R2.L || R1.L=W[I0++]; /* Beginning of next stage, **pipelined** + drain and store the rest of the column store. */ R0=R0+|+R3,R3=R0-|-R3 || W[P1++P3]=R2.H || R2=[I2++]; R1=R1+|+R2,R2=R1-|-R2 (CO) || W[P1++P3]=R4.L || R7=[I3++]; .row1: R0=R0+|+R1,R1=R0-|-R1 || W[P1++P5]=R4.H || NOP; // Exchange input with output. B1 = B0; B0 = B2; .3: B2 = B1; L3=0; (r7:4,p5:3) = [sp++]; RTS; DEFUN_END(fdct)
123linslouis-android-video-cutter
jni/libavcodec/bfin/fdct_bfin.S
Motorola 68K Assembly
asf20
11,205
/* * simple math operations * * Copyright (C) 2007 Marc Hoffman <mmhoffm@gmail.com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVCODEC_BFIN_MATHOPS_H #define AVCODEC_BFIN_MATHOPS_H #include "config.h" #if CONFIG_MPEGAUDIO_HP #define MULH(X,Y) ({ int xxo; \ __asm__ ( \ "a1 = %2.L * %1.L (FU);\n\t" \ "a1 = a1 >> 16;\n\t" \ "a1 += %2.H * %1.L (IS,M);\n\t" \ "a0 = %1.H * %2.H, a1+= %1.H * %2.L (IS,M);\n\t"\ "a1 = a1 >>> 16;\n\t" \ "%0 = (a0 += a1);\n\t" \ : "=d" (xxo) : "d" (X), "d" (Y) : "A0","A1"); xxo; }) #else #define MULH(X,Y) ({ int xxo; \ __asm__ ( \ "a1 = %2.H * %1.L (IS,M);\n\t" \ "a0 = %1.H * %2.H, a1+= %1.H * %2.L (IS,M);\n\t"\ "a1 = a1 >>> 16;\n\t" \ "%0 = (a0 += a1);\n\t" \ : "=d" (xxo) : "d" (X), "d" (Y) : "A0","A1"); xxo; }) #endif /* signed 16x16 -> 32 multiply */ #define MUL16(a, b) ({ int xxo; \ __asm__ ( \ "%0 = %1.l*%2.l (is);\n\t" \ : "=W" (xxo) : "d" (a), "d" (b) : "A1"); \ xxo; }) #endif /* AVCODEC_BFIN_MATHOPS_H */
123linslouis-android-video-cutter
jni/libavcodec/bfin/mathops.h
C
asf20
2,235
/* * BlackFin MPEGVIDEO OPTIMIZATIONS * * Copyright (C) 2007 Marc Hoffman <mmh@pleasantst.com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "libavcodec/avcodec.h" #include "libavcodec/dsputil.h" #include "libavcodec/mpegvideo.h" #include "dsputil_bfin.h" static int dct_quantize_bfin (MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow) { int last_non_zero, q, start_i; const short *qmat; short *bias; const uint8_t *scantable= s->intra_scantable.scantable; short dc; int max=0; PROF("fdct",0); s->dsp.fdct(block); EPROF(); PROF("denoise",1); if(s->dct_error_sum) s->denoise_dct(s, block); EPROF(); PROF("quant-init",2); if (s->mb_intra) { if (!s->h263_aic) { if (n < 4) q = s->y_dc_scale; else q = s->c_dc_scale; q = q << 3; } else /* For AIC we skip quant/dequant of INTRADC */ q = 1 << 3; /* note: block[0] is assumed to be positive */ dc = block[0] = (block[0] + (q >> 1)) / q; start_i = 1; last_non_zero = 0; bias = s->q_intra_matrix16[qscale][1]; qmat = s->q_intra_matrix16[qscale][0]; } else { start_i = 0; last_non_zero = -1; bias = s->q_inter_matrix16[qscale][1]; qmat = s->q_inter_matrix16[qscale][0]; } EPROF(); PROF("quantize",4); /* for(i=start_i; i<64; i++) { */ /* sign = (block[i]>>15)|1; */ /* level = ((abs(block[i])+bias[0])*qmat[i])>>16; */ /* if (level < 0) level = 0; */ /* max |= level; */ /* level = level * sign; */ /* block[i] = level; */ /* } */ __asm__ volatile ("i2=%1;\n\t" "r1=[%1++]; \n\t" "r0=r1>>>15 (v); \n\t" "lsetup (0f,1f) lc0=%3; \n\t" "0: r0=r0|%4; \n\t" " r1=abs r1 (v) || r2=[%2++];\n\t" " r1=r1+|+%5; \n\t" " r1=max(r1,%6) (v); \n\t" " r1.h=(a1 =r1.h*r2.h), r1.l=(a0 =r1.l*r2.l) (tfu); \n\t" " %0=%0|r1; \n\t" " r0.h=(a1 =r1.h*r0.h), r0.l=(a0 =r1.l*r0.l) (is) || r1=[%1++];\n\t" "1: r0=r1>>>15 (v) || [i2++]=r0;\n\t" "r1=%0>>16; \n\t" "%0=%0|r1; \n\t" "%0.h=0; \n\t" : "=&d" (max) : "b" (block), "b" (qmat), "a" (32), "d" (0x00010001), "d" (bias[0]*0x10001), "d" (0) : "R0","R1","R2", "I2"); if (start_i == 1) block[0] = dc; EPROF(); PROF("zzscan",5); __asm__ volatile ("r0=b[%1--] (x); \n\t" "lsetup (0f,1f) lc0=%3; \n\t" /* for(i=63; i>=start_i; i--) { */ "0: p0=r0; \n\t" /* j = scantable[i]; */ " p0=%2+(p0<<1); \n\t" /* if (block[j]) { */ " r0=w[p0]; \n\t" /* last_non_zero = i; */ " cc=r0==0; \n\t" /* break; */ " if !cc jump 2f; \n\t" /* } */ "1: r0=b[%1--] (x); \n\t" /* } */ " %0=%4; \n\t" " jump 3f; \n\t" "2: %0=lc0; \n\t" "3:\n\t" : "=d" (last_non_zero) : "a" (scantable+63), "a" (block), "a" (63), "d" (last_non_zero) : "P0","R0"); EPROF(); *overflow= s->max_qcoeff < max; //overflow might have happened bfprof(); /* we need this permutation so that we correct the IDCT, we only permute the !=0 elements */ if (s->dsp.idct_permutation_type != FF_NO_IDCT_PERM) ff_block_permute(block, s->dsp.idct_permutation, scantable, last_non_zero); return last_non_zero; } void MPV_common_init_bfin (MpegEncContext *s) { /* s->dct_quantize= dct_quantize_bfin; */ }
123linslouis-android-video-cutter
jni/libavcodec/bfin/mpegvideo_bfin.c
C
asf20
5,498
OBJS += bfin/dsputil_bfin.o \ bfin/fdct_bfin.o \ bfin/idct_bfin.o \ bfin/mpegvideo_bfin.o \ bfin/pixels_bfin.o \ bfin/vp3_bfin.o \ bfin/vp3_idct_bfin.o \
123linslouis-android-video-cutter
jni/libavcodec/bfin/Makefile
Makefile
asf20
518
/* * vp3_idct BlackFin * * Copyright (C) 2007 Marc Hoffman <marc.hoffman@analog.com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /* This blackfin DSP code implements an 8x8 inverse type II DCT. Prototype : void ff_bfin_vp3_idct(DCTELEM *in) Registers Used : A0, A1, R0-R7, I0-I3, B0, B2, B3, M0-M2, L0-L3, P0-P5, LC0. */ #include "config.h" #include "config_bfin.h" #if defined(__FDPIC__) && CONFIG_SRAM .section .l1.data.B,"aw",@progbits #else .data #endif .align 4; coefs: .short 0x5a82; // C4 .short 0x5a82; // C4 .short 0x30FC; //cos(3pi/8) C6 .short 0x7642; //cos(pi/8) C2 .short 0x18F9; //cos(7pi/16) .short 0x7D8A; //cos(pi/16) .short 0x471D; //cos(5pi/16) .short 0x6A6E; //cos(3pi/16) .short 0x18F9; //cos(7pi/16) .short 0x7D8A; //cos(pi/16) #if defined(__FDPIC__) && CONFIG_SRAM .section .l1.data.A #endif vtmp: .space 256 #define TMP0 FP-8 #define TMP1 FP-12 #define TMP2 FP-16 .text DEFUN(vp3_idct,mL1, (DCTELEM *block)): /********************** Function Prologue *********************************/ link 16; [--SP] = (R7:4, P5:3); // Push the registers onto the stack. B0 = R0; // Pointer to Input matrix RELOC(R1, P3, coefs); // Pointer to Coefficients RELOC(R2, P3, vtmp); // Pointer to Temporary matrix B3 = R1; B2 = R2; L3 = 20; // L3 is used for making the coefficient array // circular. // MUST BE RESTORED TO ZERO at function exit. M1 = 16 (X); // All these registers are initialized for M3 = 8(X); // modifying address offsets. I0 = B0; // I0 points to Input Element (0, 0). I2 = B0; // I2 points to Input Element (0, 0). I2 += M3 || R0.H = W[I0]; // Element 0 is read into R0.H I1 = I2; // I1 points to input Element (0, 6). I1 += 4 || R0.L = W[I2++]; // I2 points to input Element (0, 4). // Element 4 is read into R0.L. P2 = 8 (X); P3 = 32 (X); P4 = -32 (X); P5 = 98 (X); R7 = 0x8000(Z); I3 = B3; // I3 points to Coefficients P0 = B2; // P0 points to array Element (0, 0) of temp P1 = B2; R7 = [I3++] || [TMP2]=R7; // Coefficient C4 is read into R7.H and R7.L. MNOP; NOP; /* * A1 = Y0 * cos(pi/4) * A0 = Y0 * cos(pi/4) * A1 = A1 + Y4 * cos(pi/4) * A0 = A0 - Y4 * cos(pi/4) * load: * R1=(Y2,Y6) * R7=(C2,C6) * res: * R3=Y0, R2=Y4 */ A1=R7.H*R0.H, A0=R7.H*R0.H (IS) || I0+= 4 || R1.L=W[I1++]; R3=(A1+=R7.H*R0.L), R2=(A0-=R7.H*R0.L) (IS) || R1.H=W[I0--] || R7=[I3++]; LSETUP (.0, .1) LC0 = P2; // perform 8 1d idcts P2 = 112 (X); P1 = P1 + P2; // P1 points to element (7, 0) of temp buffer. P2 = -94(X); .0: /* * A1 = Y2 * cos(3pi/8) * A0 = Y2 * cos(pi/8) * A1 = A1 - Y6 * cos(pi/8) * A0 = A0 + Y6 * cos(3pi/8) * R5 = (Y1,Y7) * R7 = (C1,C7) * res: * R1=Y2, R0=Y6 */ A1=R7.L*R1.H, A0=R7.H*R1.H (IS) || I0+=4 || R5.H=W[I0]; R1=(A1-=R7.H*R1.L), R0=(A0+=R7.L*R1.L) (IS) || R5.L=W[I1--] || R7=[I3++]; /* * Y0 = Y0 + Y6. * Y4 = Y4 + Y2. * Y2 = Y4 - Y2. * Y6 = Y0 - Y6. * R3 is saved * R6.l=Y3 * note: R3: Y0, R2: Y4, R1: Y2, R0: Y6 */ R3=R3+R0, R0=R3-R0; R2=R2+R1, R1=R2-R1 || [TMP0]=R3 || R6.L=W[I0--]; /* * Compute the odd portion (1,3,5,7) even is done. * * Y1 = C7 * Y1 - C1 * Y7 + C3 * Y5 - C5 * Y3. * Y7 = C1 * Y1 + C7 * Y7 + C5 * Y5 + C3 * Y3. * Y5 = C5 * Y1 + C3 * Y7 + C7 * Y5 - C1 * Y3. * Y3 = C3 * Y1 - C5 * Y7 - C1 * Y5 - C7 * Y3. */ // R5=(Y1,Y7) R6=(Y5,Y3) // R7=(C1,C7) A1 =R7.L*R5.H, A0 =R7.H*R5.H (IS) || [TMP1]=R2 || R6.H=W[I2--]; A1-=R7.H*R5.L, A0+=R7.L*R5.L (IS) || I0-=4 || R7=[I3++]; A1+=R7.H*R6.H, A0+=R7.L*R6.H (IS) || I0+=M1; // R7=(C3,C5) R3 =(A1-=R7.L*R6.L), R2 =(A0+=R7.H*R6.L) (IS); A1 =R7.L*R5.H, A0 =R7.H*R5.H (IS) || R4=[TMP0]; A1+=R7.H*R5.L, A0-=R7.L*R5.L (IS) || I1+=M1 || R7=[I3++]; // R7=(C1,C7) A1+=R7.L*R6.H, A0-=R7.H*R6.H (IS); R7 =(A1-=R7.H*R6.L), R6 =(A0-=R7.L*R6.L) (IS) || I2+=M1; // R3=Y1, R2=Y7, R7=Y5, R6=Y3 /* Transpose write column. */ R5.H=R4+R2 (RND12); // Y0=Y0+Y7 R5.L=R4-R2 (RND12) || R4 = [TMP1]; // Y7=Y7-Y0 R2.H=R1+R7 (RND12) || W[P0++P3]=R5.H; // Y2=Y2+Y5 st Y0 R2.L=R1-R7 (RND12) || W[P1++P4]=R5.L || R7=[I3++]; // Y5=Y2-Y5 st Y7 R5.H=R0-R3 (RND12) || W[P0++P3]=R2.H || R1.L=W[I1++]; // Y1=Y6-Y1 st Y2 R5.L=R0+R3 (RND12) || W[P1++P4]=R2.L || R0.H=W[I0++]; // Y6=Y6+Y1 st Y5 R3.H=R4-R6 (RND12) || W[P0++P3]=R5.H || R0.L=W[I2++]; // Y3=Y3-Y4 st Y1 R3.L=R4+R6 (RND12) || W[P1++P4]=R5.L || R1.H=W[I0++]; // Y4=Y3+Y4 st Y6 /* pipeline loop start, + drain Y3, Y4 */ A1=R7.H*R0.H, A0=R7.H*R0.H (IS) || W[P0++P2]= R3.H || R1.H = W[I0--]; .1: R3=(A1+=R7.H*R0.L), R2=(A0-=R7.H*R0.L) (IS) || W[P1++P5]= R3.L || R7 = [I3++]; I0 = B2; // I0 points to Input Element (0, 0) I2 = B2; // I2 points to Input Element (0, 0) I2 += M3 || R0.H = W[I0]; // Y0 is read in R0.H I1 = I2; // I1 points to input Element (0, 6) I1 += 4 || R0.L = W[I2++]; // I2 points to input Element (0, 4) // Y4 is read in R0.L P2 = 8 (X); I3 = B3; // I3 points to Coefficients P0 = B0; // P0 points to array Element (0, 0) for writing // output P1 = B0; R7 = [I3++]; // R7.H = C4 and R7.L = C4 NOP; /* * A1 = Y0 * cos(pi/4) * A0 = Y0 * cos(pi/4) * A1 = A1 + Y4 * cos(pi/4) * A0 = A0 - Y4 * cos(pi/4) * load: * R1=(Y2,Y6) * R7=(C2,C6) * res: * R3=Y0, R2=Y4 */ A1=R7.H*R0.H, A0=R7.H*R0.H (IS) || I0+=4 || R1.L=W[I1++]; R3=(A1+=R7.H*R0.L), R2=(A0-=R7.H*R0.L) (IS) || R1.H=W[I0--] || R7=[I3++]; LSETUP (.2, .3) LC0 = P2; // peform 8 1d idcts P2 = 112 (X); P1 = P1 + P2; P2 = -94(X); .2: /* * A1 = Y2 * cos(3pi/8) * A0 = Y2 * cos(pi/8) * A1 = A1 - Y6 * cos(pi/8) * A0 = A0 + Y6 * cos(3pi/8) * R5 = (Y1,Y7) * R7 = (C1,C7) * res: * R1=Y2, R0=Y6 */ A1=R7.L*R1.H, A0=R7.H*R1.H (IS) || I0+=4 || R5.H=W[I0]; R1=(A1-=R7.H*R1.L), R0=(A0+=R7.L*R1.L) (IS) || R5.L=W[I1--] || R7=[I3++]; /* * Y0 = Y0 + Y6. * Y4 = Y4 + Y2. * Y2 = Y4 - Y2. * Y6 = Y0 - Y6. * R3 is saved * R6.l=Y3 * note: R3: Y0, R2: Y4, R1: Y2, R0: Y6 */ R3=R3+R0, R0=R3-R0; R2=R2+R1, R1=R2-R1 || [TMP0]=R3 || R6.L=W[I0--]; /* * Compute the odd portion (1,3,5,7) even is done. * * Y1 = C7 * Y1 - C1 * Y7 + C3 * Y5 - C5 * Y3. * Y7 = C1 * Y1 + C7 * Y7 + C5 * Y5 + C3 * Y3. * Y5 = C5 * Y1 + C3 * Y7 + C7 * Y5 - C1 * Y3. * Y3 = C3 * Y1 - C5 * Y7 - C1 * Y5 - C7 * Y3. */ // R5=(Y1,Y7) R6=(Y5,Y3) // R7=(C1,C7) A1 =R7.L*R5.H, A0 =R7.H*R5.H (IS) || [TMP1]=R2 || R6.H=W[I2--]; A1-=R7.H*R5.L, A0+=R7.L*R5.L (IS) || I0-=4 || R7=[I3++]; A1+=R7.H*R6.H, A0+=R7.L*R6.H (IS) || I0+=M1; // R7=(C3,C5) R3 =(A1-=R7.L*R6.L), R2 =(A0+=R7.H*R6.L) (IS); A1 =R7.L*R5.H, A0 =R7.H*R5.H (IS) || R4=[TMP0]; A1+=R7.H*R5.L, A0-=R7.L*R5.L (IS) || I1+=M1 || R7=[I3++]; // R7=(C1,C7) A1+=R7.L*R6.H, A0-=R7.H*R6.H (IS); R7 =(A1-=R7.H*R6.L), R6 =(A0-=R7.L*R6.L) (IS) || I2+=M1; // R3=Y1, R2=Y7, R7=Y5, R6=Y3 /* Transpose write column. */ R5.H=R4+R2 (RND20); // Y0=Y0+Y7 R5.L=R4-R2 (RND20) || R4 = [TMP1]; // Y7=Y7-Y0 R5=R5>>>2(v); R2.H=R1+R7 (RND20) || W[P0++P3]=R5.H; // Y2=Y2+Y5 st Y0 R2.L=R1-R7 (RND20) || W[P1++P4]=R5.L || R7=[I3++]; // Y5=Y2-Y5 st Y7 R2=R2>>>2(v); R5.H=R0-R3 (RND20) || W[P0++P3]=R2.H || R1.L=W[I1++]; // Y1=Y6-Y1 st Y2 R5.L=R0+R3 (RND20) || W[P1++P4]=R2.L || R0.H=W[I0++]; // Y6=Y6+Y1 st Y5 R5=R5>>>2(v); R3.H=R4-R6 (RND20) || W[P0++P3]=R5.H || R0.L=W[I2++]; // Y3=Y3-Y4 st Y1 R3.L=R4+R6 (RND20) || W[P1++P4]=R5.L || R1.H=W[I0++]; // Y4=Y3+Y4 st Y6 R3=R3>>>2(v); /* pipeline loop start, + drain Y3, Y4 */ A1=R7.H*R0.H, A0=R7.H*R0.H (IS) || W[P0++P2]= R3.H || R1.H = W[I0--]; .3: R3=(A1+=R7.H*R0.L), R2=(A0-=R7.H*R0.L) (IS) || W[P1++P5]= R3.L || R7 = [I3++]; L3 = 0; (R7:4,P5:3)=[SP++]; unlink; RTS; DEFUN_END(vp3_idct)
123linslouis-android-video-cutter
jni/libavcodec/bfin/vp3_idct_bfin.S
Motorola 68K Assembly
asf20
10,599
/* * Copyright (C) 2007 Marc Hoffman <marc.hoffman@analog.com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "libavcodec/avcodec.h" #include "libavcodec/dsputil.h" #include "dsputil_bfin.h" /* Intra iDCT offset 128 */ void ff_bfin_vp3_idct_put (uint8_t *dest, int line_size, DCTELEM *block) { uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; int i,j; ff_bfin_vp3_idct (block); for (i=0;i<8;i++) for (j=0;j<8;j++) dest[line_size*i+j]=cm[128+block[i*8+j]]; } /* Inter iDCT */ void ff_bfin_vp3_idct_add (uint8_t *dest, int line_size, DCTELEM *block) { ff_bfin_vp3_idct (block); ff_bfin_add_pixels_clamped (block, dest, line_size); }
123linslouis-android-video-cutter
jni/libavcodec/bfin/vp3_bfin.c
C
asf20
1,400
/* * idct BlackFin * * Copyright (C) 2007 Marc Hoffman <marc.hoffman@analog.com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /* This blackfin DSP code implements an 8x8 inverse type II DCT. Prototype : void ff_bfin_idct(DCTELEM *in) Registers Used : A0, A1, R0-R7, I0-I3, B0, B2, B3, M0-M2, L0-L3, P0-P5, LC0. Performance : Code Size : 498 Bytes. Cycle Count : 417 Cycles ----------------------------------------------------------- FFMPEG conformance testing results ----------------------------------------------------------- dct-test: modified with the following dct_error("BFINidct", 1, ff_bfin_idct, idct, test); produces the following output root:/u/ffmpeg/bhead/libavcodec> ./dct-test -i ffmpeg DCT/IDCT test 8 15 -2 21 24 17 0 10 2 -10 -5 -5 -3 7 -14 -3 2 -13 -10 -19 18 -6 6 -2 9 4 16 -3 9 12 10 15 15 -9 -2 10 1 16 0 -15 -15 5 7 3 13 0 13 20 -6 -15 24 9 -18 1 9 -22 -8 25 23 2 -7 0 30 13 IDCT BFINidct: err_inf=1 err2=0.01002344 syserr=0.00150000 maxout=266 blockSumErr=64 IDCT BFINidct: 88.3 kdct/s */ #include "config.h" #include "config_bfin.h" #if defined(__FDPIC__) && CONFIG_SRAM .section .l1.data.B,"aw",@progbits #else .data #endif .align 4; coefs: .short 0x5a82; // C4 .short 0x5a82; // C4 .short 0x30FC; //cos(3pi/8) C6 .short 0x7642; //cos(pi/8) C2 .short 0x18F9; //cos(7pi/16) .short 0x7D8A; //cos(pi/16) .short 0x471D; //cos(5pi/16) .short 0x6A6E; //cos(3pi/16) .short 0x18F9; //cos(7pi/16) .short 0x7D8A; //cos(pi/16) #if defined(__FDPIC__) && CONFIG_SRAM .section .l1.data.A,"aw",@progbits #endif vtmp: .space 256 #define TMP0 FP-8 #define TMP1 FP-12 #define TMP2 FP-16 .text DEFUN(idct,mL1, (DCTELEM *block)): /********************** Function Prologue *********************************/ link 16; [--SP] = (R7:4, P5:3); // Push the registers onto the stack. B0 = R0; // Pointer to Input matrix RELOC(R1, P3, coefs); // Pointer to Coefficients RELOC(R2, P3, vtmp); // Pointer to Temporary matrix B3 = R1; B2 = R2; L3 = 20; // L3 is used for making the coefficient array // circular. // MUST BE RESTORED TO ZERO at function exit. M1 = 16 (X); // All these registers are initialized for M3 = 8(X); // modifying address offsets. I0 = B0; // I0 points to Input Element (0, 0). I2 = B0; // I2 points to Input Element (0, 0). I2 += M3 || R0.H = W[I0]; // Element 0 is read into R0.H I1 = I2; // I1 points to input Element (0, 6). I1 += 4 || R0.L = W[I2++]; // I2 points to input Element (0, 4). // Element 4 is read into R0.L. P2 = 8 (X); P3 = 32 (X); P4 = -32 (X); P5 = 98 (X); R7 = 0x8000(Z); I3 = B3; // I3 points to Coefficients P0 = B2; // P0 points to array Element (0, 0) of temp P1 = B2; R7 = [I3++] || [TMP2]=R7; // Coefficient C4 is read into R7.H and R7.L. MNOP; NOP; /* * A1 = Y0 * cos(pi/4) * A0 = Y0 * cos(pi/4) * A1 = A1 + Y4 * cos(pi/4) * A0 = A0 - Y4 * cos(pi/4) * load: * R1=(Y2,Y6) * R7=(C2,C6) * res: * R3=Y0, R2=Y4 */ A1=R7.H*R0.H, A0=R7.H*R0.H (IS) || I0+= 4 || R1.L=W[I1++]; R3=(A1+=R7.H*R0.L), R2=(A0-=R7.H*R0.L) (IS) || R1.H=W[I0--] || R7=[I3++]; LSETUP (.0, .1) LC0 = P2; // perform 8 1d idcts P2 = 112 (X); P1 = P1 + P2; // P1 points to element (7, 0) of temp buffer. P2 = -94(X); .0: /* * A1 = Y2 * cos(3pi/8) * A0 = Y2 * cos(pi/8) * A1 = A1 - Y6 * cos(pi/8) * A0 = A0 + Y6 * cos(3pi/8) * R5 = (Y1,Y7) * R7 = (C1,C7) * res: * R1=Y2, R0=Y6 */ A1=R7.L*R1.H, A0=R7.H*R1.H (IS) || I0+=4 || R5.H=W[I0]; R1=(A1-=R7.H*R1.L), R0=(A0+=R7.L*R1.L) (IS) || R5.L=W[I1--] || R7=[I3++]; /* * Y0 = Y0 + Y6. * Y4 = Y4 + Y2. * Y2 = Y4 - Y2. * Y6 = Y0 - Y6. * R3 is saved * R6.l=Y3 * note: R3: Y0, R2: Y4, R1: Y2, R0: Y6 */ R3=R3+R0, R0=R3-R0; R2=R2+R1, R1=R2-R1 || [TMP0]=R3 || R6.L=W[I0--]; /* * Compute the odd portion (1,3,5,7) even is done. * * Y1 = C7 * Y1 - C1 * Y7 + C3 * Y5 - C5 * Y3. * Y7 = C1 * Y1 + C7 * Y7 + C5 * Y5 + C3 * Y3. * Y5 = C5 * Y1 + C3 * Y7 + C7 * Y5 - C1 * Y3. * Y3 = C3 * Y1 - C5 * Y7 - C1 * Y5 - C7 * Y3. */ // R5=(Y1,Y7) R6=(Y5,Y3) // R7=(C1,C7) A1 =R7.L*R5.H, A0 =R7.H*R5.H (IS) || [TMP1]=R2 || R6.H=W[I2--]; A1-=R7.H*R5.L, A0+=R7.L*R5.L (IS) || I0-=4 || R7=[I3++]; A1+=R7.H*R6.H, A0+=R7.L*R6.H (IS) || I0+=M1; // R7=(C3,C5) R3 =(A1-=R7.L*R6.L), R2 =(A0+=R7.H*R6.L) (IS); A1 =R7.L*R5.H, A0 =R7.H*R5.H (IS) || R4=[TMP0]; A1+=R7.H*R5.L, A0-=R7.L*R5.L (IS) || I1+=M1 || R7=[I3++]; // R7=(C1,C7) A1+=R7.L*R6.H, A0-=R7.H*R6.H (IS); R7 =(A1-=R7.H*R6.L), R6 =(A0-=R7.L*R6.L) (IS) || I2+=M1; // R3=Y1, R2=Y7, R7=Y5, R6=Y3 /* Transpose write column. */ R5.H=R4+R2 (RND12); // Y0=Y0+Y7 R5.L=R4-R2 (RND12) || R4 = [TMP1]; // Y7=Y7-Y0 R2.H=R1+R7 (RND12) || W[P0++P3]=R5.H; // Y2=Y2+Y5 st Y0 R2.L=R1-R7 (RND12) || W[P1++P4]=R5.L || R7=[I3++]; // Y5=Y2-Y5 st Y7 R5.H=R0-R3 (RND12) || W[P0++P3]=R2.H || R1.L=W[I1++]; // Y1=Y6-Y1 st Y2 R5.L=R0+R3 (RND12) || W[P1++P4]=R2.L || R0.H=W[I0++]; // Y6=Y6+Y1 st Y5 R3.H=R4-R6 (RND12) || W[P0++P3]=R5.H || R0.L=W[I2++]; // Y3=Y3-Y4 st Y1 R3.L=R4+R6 (RND12) || W[P1++P4]=R5.L || R1.H=W[I0++]; // Y4=Y3+Y4 st Y6 /* pipeline loop start, + drain Y3, Y4 */ A1=R7.H*R0.H, A0=R7.H*R0.H (IS) || W[P0++P2]= R3.H || R1.H = W[I0--]; .1: R3=(A1+=R7.H*R0.L), R2=(A0-=R7.H*R0.L) (IS) || W[P1++P5]= R3.L || R7 = [I3++]; I0 = B2; // I0 points to Input Element (0, 0) I2 = B2; // I2 points to Input Element (0, 0) I2 += M3 || R0.H = W[I0]; // Y0 is read in R0.H I1 = I2; // I1 points to input Element (0, 6) I1 += 4 || R0.L = W[I2++]; // I2 points to input Element (0, 4) // Y4 is read in R0.L P2 = 8 (X); I3 = B3; // I3 points to Coefficients P0 = B0; // P0 points to array Element (0, 0) for writing // output P1 = B0; R7 = [I3++]; // R7.H = C4 and R7.L = C4 NOP; /* * A1 = Y0 * cos(pi/4) * A0 = Y0 * cos(pi/4) * A1 = A1 + Y4 * cos(pi/4) * A0 = A0 - Y4 * cos(pi/4) * load: * R1=(Y2,Y6) * R7=(C2,C6) * res: * R3=Y0, R2=Y4 */ A1=R7.H*R0.H, A0=R7.H*R0.H (IS) || I0+=4 || R1.L=W[I1++]; R3=(A1+=R7.H*R0.L), R2=(A0-=R7.H*R0.L) (IS) || R1.H=W[I0--] || R7=[I3++]; LSETUP (.2, .3) LC0 = P2; // peform 8 1d idcts P2 = 112 (X); P1 = P1 + P2; P2 = -94(X); .2: /* * A1 = Y2 * cos(3pi/8) * A0 = Y2 * cos(pi/8) * A1 = A1 - Y6 * cos(pi/8) * A0 = A0 + Y6 * cos(3pi/8) * R5 = (Y1,Y7) * R7 = (C1,C7) * res: * R1=Y2, R0=Y6 */ A1=R7.L*R1.H, A0=R7.H*R1.H (IS) || I0+=4 || R5.H=W[I0]; R1=(A1-=R7.H*R1.L), R0=(A0+=R7.L*R1.L) (IS) || R5.L=W[I1--] || R7=[I3++]; /* * Y0 = Y0 + Y6. * Y4 = Y4 + Y2. * Y2 = Y4 - Y2. * Y6 = Y0 - Y6. * R3 is saved * R6.l=Y3 * note: R3: Y0, R2: Y4, R1: Y2, R0: Y6 */ R3=R3+R0, R0=R3-R0; R2=R2+R1, R1=R2-R1 || [TMP0]=R3 || R6.L=W[I0--]; /* * Compute the odd portion (1,3,5,7) even is done. * * Y1 = C7 * Y1 - C1 * Y7 + C3 * Y5 - C5 * Y3. * Y7 = C1 * Y1 + C7 * Y7 + C5 * Y5 + C3 * Y3. * Y5 = C5 * Y1 + C3 * Y7 + C7 * Y5 - C1 * Y3. * Y3 = C3 * Y1 - C5 * Y7 - C1 * Y5 - C7 * Y3. */ // R5=(Y1,Y7) R6=(Y5,Y3) // R7=(C1,C7) A1 =R7.L*R5.H, A0 =R7.H*R5.H (IS) || [TMP1]=R2 || R6.H=W[I2--]; A1-=R7.H*R5.L, A0+=R7.L*R5.L (IS) || I0-=4 || R7=[I3++]; A1+=R7.H*R6.H, A0+=R7.L*R6.H (IS) || I0+=M1; // R7=(C3,C5) R3 =(A1-=R7.L*R6.L), R2 =(A0+=R7.H*R6.L) (IS); A1 =R7.L*R5.H, A0 =R7.H*R5.H (IS) || R4=[TMP0]; A1+=R7.H*R5.L, A0-=R7.L*R5.L (IS) || I1+=M1 || R7=[I3++]; // R7=(C1,C7) A1+=R7.L*R6.H, A0-=R7.H*R6.H (IS); R7 =(A1-=R7.H*R6.L), R6 =(A0-=R7.L*R6.L) (IS) || I2+=M1; // R3=Y1, R2=Y7, R7=Y5, R6=Y3 /* Transpose write column. */ R5.H=R4+R2 (RND20); // Y0=Y0+Y7 R5.L=R4-R2 (RND20) || R4 = [TMP1]; // Y7=Y7-Y0 R2.H=R1+R7 (RND20) || W[P0++P3]=R5.H; // Y2=Y2+Y5 st Y0 R2.L=R1-R7 (RND20) || W[P1++P4]=R5.L || R7=[I3++]; // Y5=Y2-Y5 st Y7 R5.H=R0-R3 (RND20) || W[P0++P3]=R2.H || R1.L=W[I1++]; // Y1=Y6-Y1 st Y2 R5.L=R0+R3 (RND20) || W[P1++P4]=R2.L || R0.H=W[I0++]; // Y6=Y6+Y1 st Y5 R3.H=R4-R6 (RND20) || W[P0++P3]=R5.H || R0.L=W[I2++]; // Y3=Y3-Y4 st Y1 R3.L=R4+R6 (RND20) || W[P1++P4]=R5.L || R1.H=W[I0++]; // Y4=Y3+Y4 st Y6 /* pipeline loop start, + drain Y3, Y4 */ A1=R7.H*R0.H, A0=R7.H*R0.H (IS) || W[P0++P2]= R3.H || R1.H = W[I0--]; .3: R3=(A1+=R7.H*R0.L), R2=(A0-=R7.H*R0.L) (IS) || W[P1++P5]= R3.L || R7 = [I3++]; L3 = 0; (R7:4,P5:3)=[SP++]; unlink; RTS; DEFUN_END(idct)
123linslouis-android-video-cutter
jni/libavcodec/bfin/idct_bfin.S
Motorola 68K Assembly
asf20
11,476
/* * BlackFin DSPUTILS * * Copyright (C) 2007 Marc Hoffman <marc.hoffman@analog.com> * Copyright (c) 2006 Michael Benjamin <michael.benjamin@analog.com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "libavcodec/avcodec.h" #include "libavcodec/dsputil.h" #include "dsputil_bfin.h" int off; static void bfin_idct_add (uint8_t *dest, int line_size, DCTELEM *block) { ff_bfin_idct (block); ff_bfin_add_pixels_clamped (block, dest, line_size); } static void bfin_idct_put (uint8_t *dest, int line_size, DCTELEM *block) { ff_bfin_idct (block); ff_bfin_put_pixels_clamped (block, dest, line_size); } static void bfin_clear_blocks (DCTELEM *blocks) { // This is just a simple memset. // __asm__("P0=192; " "I0=%0; " "R0=0; " "LSETUP(clear_blocks_blkfn_lab,clear_blocks_blkfn_lab)LC0=P0;" "clear_blocks_blkfn_lab:" "[I0++]=R0;" ::"a" (blocks):"P0","I0","R0"); } static void bfin_put_pixels8 (uint8_t *block, const uint8_t *pixels, int line_size, int h) { ff_bfin_put_pixels8uc (block, pixels, pixels, line_size, line_size, h); } static void bfin_put_pixels8_x2(uint8_t *block, const uint8_t *pixels, int line_size, int h) { ff_bfin_put_pixels8uc (block, pixels, pixels+1, line_size, line_size, h); } static void bfin_put_pixels8_y2 (uint8_t *block, const uint8_t *pixels, int line_size, int h) { ff_bfin_put_pixels8uc (block, pixels, pixels+line_size, line_size, line_size, h); } static void bfin_put_pixels8_xy2 (uint8_t *block, const uint8_t *s0, int line_size, int h) { ff_bfin_z_put_pixels8_xy2 (block,s0,line_size, line_size, h); } static void bfin_put_pixels16 (uint8_t *block, const uint8_t *pixels, int line_size, int h) { ff_bfin_put_pixels16uc (block, pixels, pixels, line_size, line_size, h); } static void bfin_put_pixels16_x2 (uint8_t *block, const uint8_t *pixels, int line_size, int h) { ff_bfin_put_pixels16uc (block, pixels, pixels+1, line_size, line_size, h); } static void bfin_put_pixels16_y2 (uint8_t *block, const uint8_t *pixels, int line_size, int h) { ff_bfin_put_pixels16uc (block, pixels, pixels+line_size, line_size, line_size, h); } static void bfin_put_pixels16_xy2 (uint8_t *block, const uint8_t *s0, int line_size, int h) { ff_bfin_z_put_pixels16_xy2 (block,s0,line_size, line_size, h); } static void bfin_put_pixels8_nornd (uint8_t *block, const uint8_t *pixels, int line_size, int h) { ff_bfin_put_pixels8uc_nornd (block, pixels, pixels, line_size, h); } static void bfin_put_pixels8_x2_nornd (uint8_t *block, const uint8_t *pixels, int line_size, int h) { ff_bfin_put_pixels8uc_nornd (block, pixels, pixels+1, line_size, h); } static void bfin_put_pixels8_y2_nornd (uint8_t *block, const uint8_t *pixels, int line_size, int h) { ff_bfin_put_pixels8uc_nornd (block, pixels, pixels+line_size, line_size, h); } static void bfin_put_pixels16_nornd (uint8_t *block, const uint8_t *pixels, int line_size, int h) { ff_bfin_put_pixels16uc_nornd (block, pixels, pixels, line_size, h); } static void bfin_put_pixels16_x2_nornd (uint8_t *block, const uint8_t *pixels, int line_size, int h) { ff_bfin_put_pixels16uc_nornd (block, pixels, pixels+1, line_size, h); } static void bfin_put_pixels16_y2_nornd (uint8_t *block, const uint8_t *pixels, int line_size, int h) { ff_bfin_put_pixels16uc_nornd (block, pixels, pixels+line_size, line_size, h); } static int bfin_pix_abs16 (void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h) { return ff_bfin_z_sad16x16 (blk1,blk2,line_size,line_size,h); } static int bfin_vsad_intra16 (void *c, uint8_t *blk1, uint8_t *dummy, int stride, int h) { return ff_bfin_z_sad16x16 (blk1,blk1+stride,stride<<1,stride<<1,h); } static int bfin_vsad (void *c, uint8_t *blk1, uint8_t *blk2, int stride, int h) { return ff_bfin_z_sad16x16 (blk1,blk1+stride,stride<<1,stride<<1,h) + ff_bfin_z_sad16x16 (blk2,blk2+stride,stride<<1,stride<<1,h); } static uint8_t vtmp_blk[256] attribute_l1_data_b; static int bfin_pix_abs16_x2 (void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h) { ff_bfin_put_pixels16uc (vtmp_blk, blk2, blk2+1, 16, line_size, h); return ff_bfin_z_sad16x16 (blk1, vtmp_blk, line_size, 16, h); } static int bfin_pix_abs16_y2 (void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h) { ff_bfin_put_pixels16uc (vtmp_blk, blk2, blk2+line_size, 16, line_size, h); return ff_bfin_z_sad16x16 (blk1, vtmp_blk, line_size, 16, h); } static int bfin_pix_abs16_xy2 (void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h) { ff_bfin_z_put_pixels16_xy2 (vtmp_blk, blk2, 16, line_size, h); return ff_bfin_z_sad16x16 (blk1, vtmp_blk, line_size, 16, h); } static int bfin_pix_abs8 (void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h) { return ff_bfin_z_sad8x8 (blk1,blk2,line_size,line_size, h); } static int bfin_pix_abs8_x2 (void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h) { ff_bfin_put_pixels8uc (vtmp_blk, blk2, blk2+1, 8, line_size, h); return ff_bfin_z_sad8x8 (blk1, vtmp_blk, line_size, 8, h); } static int bfin_pix_abs8_y2 (void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h) { ff_bfin_put_pixels8uc (vtmp_blk, blk2, blk2+line_size, 8, line_size, h); return ff_bfin_z_sad8x8 (blk1, vtmp_blk, line_size, 8, h); } static int bfin_pix_abs8_xy2 (void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h) { ff_bfin_z_put_pixels8_xy2 (vtmp_blk, blk2, 8, line_size, h); return ff_bfin_z_sad8x8 (blk1, vtmp_blk, line_size, 8, h); } /* decoder optimization start on 2/11 100 frames of 352x240@25 compiled with no optimization -g debugging 9.824s ~ 2.44x off 6.360s ~ 1.58x off with -O2 5.740s ~ 1.43x off with idcts 2.64s 2/20 same sman.mp4 decode only */ void dsputil_init_bfin( DSPContext* c, AVCodecContext *avctx ) { c->get_pixels = ff_bfin_get_pixels; c->diff_pixels = ff_bfin_diff_pixels; c->put_pixels_clamped = ff_bfin_put_pixels_clamped; c->add_pixels_clamped = ff_bfin_add_pixels_clamped; c->clear_blocks = bfin_clear_blocks; c->pix_sum = ff_bfin_pix_sum; c->pix_norm1 = ff_bfin_pix_norm1; c->sad[0] = bfin_pix_abs16; c->sad[1] = bfin_pix_abs8; /* c->vsad[0] = bfin_vsad; */ /* c->vsad[4] = bfin_vsad_intra16; */ /* TODO [0] 16 [1] 8 */ c->pix_abs[0][0] = bfin_pix_abs16; c->pix_abs[0][1] = bfin_pix_abs16_x2; c->pix_abs[0][2] = bfin_pix_abs16_y2; c->pix_abs[0][3] = bfin_pix_abs16_xy2; c->pix_abs[1][0] = bfin_pix_abs8; c->pix_abs[1][1] = bfin_pix_abs8_x2; c->pix_abs[1][2] = bfin_pix_abs8_y2; c->pix_abs[1][3] = bfin_pix_abs8_xy2; c->sse[0] = ff_bfin_sse16; c->sse[1] = ff_bfin_sse8; c->sse[2] = ff_bfin_sse4; /** * Halfpel motion compensation with rounding (a+b+1)>>1. * This is an array[4][4] of motion compensation functions for 4 * horizontal blocksizes (8,16) and the 4 halfpel positions * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ] * @param block destination where the result is stored * @param pixels source * @param line_size number of bytes in a horizontal line of block * @param h height */ c->put_pixels_tab[0][0] = bfin_put_pixels16; c->put_pixels_tab[0][1] = bfin_put_pixels16_x2; c->put_pixels_tab[0][2] = bfin_put_pixels16_y2; c->put_pixels_tab[0][3] = bfin_put_pixels16_xy2; c->put_pixels_tab[1][0] = bfin_put_pixels8; c->put_pixels_tab[1][1] = bfin_put_pixels8_x2; c->put_pixels_tab[1][2] = bfin_put_pixels8_y2; c->put_pixels_tab[1][3] = bfin_put_pixels8_xy2; c->put_no_rnd_pixels_tab[1][0] = bfin_put_pixels8_nornd; c->put_no_rnd_pixels_tab[1][1] = bfin_put_pixels8_x2_nornd; c->put_no_rnd_pixels_tab[1][2] = bfin_put_pixels8_y2_nornd; /* c->put_no_rnd_pixels_tab[1][3] = ff_bfin_put_pixels8_xy2_nornd; */ c->put_no_rnd_pixels_tab[0][0] = bfin_put_pixels16_nornd; c->put_no_rnd_pixels_tab[0][1] = bfin_put_pixels16_x2_nornd; c->put_no_rnd_pixels_tab[0][2] = bfin_put_pixels16_y2_nornd; /* c->put_no_rnd_pixels_tab[0][3] = ff_bfin_put_pixels16_xy2_nornd; */ if (avctx->dct_algo == FF_DCT_AUTO) c->fdct = ff_bfin_fdct; if (avctx->idct_algo==FF_IDCT_VP3) { c->idct_permutation_type = FF_NO_IDCT_PERM; c->idct = ff_bfin_vp3_idct; c->idct_add = ff_bfin_vp3_idct_add; c->idct_put = ff_bfin_vp3_idct_put; } else if (avctx->idct_algo == FF_IDCT_AUTO) { c->idct_permutation_type = FF_NO_IDCT_PERM; c->idct = ff_bfin_idct; c->idct_add = bfin_idct_add; c->idct_put = bfin_idct_put; } }
123linslouis-android-video-cutter
jni/libavcodec/bfin/dsputil_bfin.c
C
asf20
9,583
/* * Blackfin Pixel Operations * Copyright (C) 2007 Marc Hoffman <marc.hoffman@analog.com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "config_bfin.h" DEFUN(put_pixels_clamped,mL1, (DCTELEM *block, uint8_t *dest, int line_size)): [--SP] = (R7:4); R4 = 0; R5.l = 0x00ff; R5.h = 0x00ff; I0 = R0; // block I1 = R1; // dest R2 += -4; // line_size M1 = R2; P0 = 8; R0 = [I0++]; R1 = [I0++]; R2 = MAX(R0, R4) (V); LSETUP (ppc$0,ppc$1) LC0=P0; ppc$0: R2 = MIN(R2, R5) (V); R3 = MAX(R1, R4) (V); R3 = MIN(R3, R5) (V) || R0 = [I0++]; R6 = BYTEPACK (R2,R3) || R1 = [I0++]; R2 = MAX(R0, R4) (V) || [I1++] = R6; R2 = MIN(R2, R5) (V); R3 = MAX(R1, R4) (V); R3 = MIN(R3, R5) (V) || R0 = [I0++]; R6 = BYTEPACK (R2,R3) || R1 = [I0++]; ppc$1: R2 = Max(R0, R4) (V) || [I1++M1] = R6; (R7:4) = [SP++]; RTS; DEFUN_END(put_pixels_clamped) DEFUN(add_pixels_clamped,mL1, (DCTELEM *block, uint8_t *dest, int line_size)): [-- SP] = (R7:4); R4 = 0; I0 = 0; R2 += -4; // line_size M0 = R2; I1 = R1; // dest I3 = R0; // block I2 = R1; // dest P0 = 8; M3 = 2; R0 = [I3++] || R2 = [I1]; R2 = R2 << 8 || R0.H = W[I3--] || R3 = [I1++]; R3 = R3 >> 8 || R1.L = W[I3] || I3 += 4; R6 = BYTEOP3P(R1:0, R3:2) (LO) || R1.H = W[I3++] || R2 = [I1]; LSETUP(apc$2,apc$3) LC1 = P0; apc$2: R7 = BYTEOP3P(R1:0, R3:2) (HI, R) || R0 = [I3++] || R3 = [I1++M0]; R2 = R2 << 8 || R0.H = W[I3--]; R3 = R3 >> 8 || R1.L = W[I3] || I3 += 4; R6 = R6 + R7 (S) || R1.H = W[I3]; R6 = BYTEOP3P(R1:0, R3:2) (LO) || I3+=M3 || [I2++]=R6; R7 = BYTEOP3P(R1:0, R3:2) (HI, R) || R0 = [I3++] || R2 = [I1]; R2 = R2 << 8 || R0.H = W[I3--] || R3 = [I1++]; R3 = R3 >> 8 || R1.L = W[I3] || I3 += 4; R6 = R6 + R7 (S) || R1.H = W[I3++]; apc$3: R6 = BYTEOP3P(R1:0, R3:2) (LO) || [I2++M0] = R6 || R2 = [I1]; (R7:4) = [SP++]; RTS; DEFUN_END(add_pixels_clamped) /* motion compensation primitives * Halfpel motion compensation with rounding (a+b+1)>>1. * This is an array[4][4] of motion compensation funcions for 4 * horizontal blocksizes (8,16) and the 4 halfpel positions<br> * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ] * @param block destination where the result is stored * @param pixels source * @param line_size number of bytes in a horizontal line of block * @param h height */ DEFUN(put_pixels8uc,mL1, (uint8_t *block, const uint8_t *s0, const uint8_t *s1, int dest_size, int line_size, int h)): i3=r0; // dest i0=r1; // src0 i1=r2; // src1 r0=[sp+12]; // dest_size r2=[sp+16]; // line_size p0=[sp+20]; // h [--sp] = (r7:6); r0+=-4; m3=r0; r2+=-8; m0=r2; LSETUP(pp8$0,pp8$1) LC0=P0; DISALGNEXCPT || R0 = [I0++] || R2 =[I1++]; pp8$0: DISALGNEXCPT || R1 = [I0++] || R3 =[I1++]; R6 = BYTEOP1P(R1:0,R3:2) || R0 = [I0++M0]|| R2 =[I1++M0]; R7 = BYTEOP1P(R1:0,R3:2)(R) || R0 = [I0++] || [I3++] = R6 ; pp8$1: DISALGNEXCPT || R2 = [I1++] || [I3++M3] = R7; (r7:6) = [sp++]; RTS; DEFUN_END(put_pixels8uc) DEFUN(put_pixels16uc,mL1, (uint8_t *block, const uint8_t *s0, const uint8_t *s1, int dest_size, int line_size, int h)): link 0; [--sp] = (r7:6); i3=r0; // dest i0=r1; // src0 i1=r2; // src1 r0=[fp+20]; // dest_size r2=[fp+24]; // line_size p0=[fp+28]; // h r0+=-12; m3=r0; // line_size r2+=-16; m0=r2; LSETUP(pp16$0,pp16$1) LC0=P0; DISALGNEXCPT || R0 = [I0++] || R2 =[I1++]; pp16$0: DISALGNEXCPT || R1 = [I0++] || R3 =[I1++]; R6 = BYTEOP1P(R1:0,R3:2) || R0 = [I0++] || R2 =[I1++]; R7 = BYTEOP1P(R1:0,R3:2)(R) || R1 = [I0++] || R3 =[I1++]; [I3++] = R6; R6 = BYTEOP1P(R1:0,R3:2) || R0 = [I0++M0] || R2 =[I1++M0]; R7 = BYTEOP1P(R1:0,R3:2)(R) || R0 = [I0++] || [I3++] = R7 ; [I3++] = R6; pp16$1: DISALGNEXCPT || R2 = [I1++] || [I3++M3] = R7; (r7:6) = [sp++]; unlink; RTS; DEFUN_END(put_pixels16uc) DEFUN(put_pixels8uc_nornd,mL1, (uint8_t *block, const uint8_t *s0, const uint8_t *s1, int line_size, int h)): i3=r0; // dest i0=r1; // src0 i1=r2; // src1 r2=[sp+12]; // line_size p0=[sp+16]; // h [--sp] = (r7:6); r2+=-4; m3=r2; r2+=-4; m0=r2; LSETUP(pp8$2,pp8$3) LC0=P0; DISALGNEXCPT || R0 = [I0++] || R2 =[I1++]; pp8$2: DISALGNEXCPT || R1 = [I0++] || R3 =[I1++]; R6 = BYTEOP1P(R1:0,R3:2)(T) || R0 = [I0++M0]|| R2 =[I1++M0]; R7 = BYTEOP1P(R1:0,R3:2)(T,R) || R0 = [I0++] || [I3++] = R6 ; pp8$3: DISALGNEXCPT || R2 = [I1++] || [I3++M3] = R7; (r7:6) = [sp++]; RTS; DEFUN_END(put_pixels8uc_nornd) DEFUN(put_pixels16uc_nornd,mL1, (uint8_t *block, const uint8_t *s0, const uint8_t *s1, int line_size, int h)): i3=r0; // dest i0=r1; // src0 i1=r2; // src1 r2=[sp+12]; // line_size p0=[sp+16]; // h [--sp] = (r7:6); r2+=-12; m3=r2; // line_size r2+=-4; m0=r2; LSETUP(pp16$2,pp16$3) LC0=P0; DISALGNEXCPT || R0 = [I0++] || R2 =[I1++]; pp16$2: DISALGNEXCPT || R1 = [I0++] || R3 =[I1++]; R6 = BYTEOP1P(R1:0,R3:2)(T) || R0 = [I0++] || R2 =[I1++]; R7 = BYTEOP1P(R1:0,R3:2)(T,R) || R1 = [I0++] || R3 =[I1++]; [I3++] = R6; R6 = BYTEOP1P(R1:0,R3:2)(T) || R0 = [I0++M0] || R2 =[I1++M0]; R7 = BYTEOP1P(R1:0,R3:2)(T,R) || R0 = [I0++] || [I3++] = R7 ; [I3++] = R6; pp16$3: DISALGNEXCPT || R2 = [I1++] || [I3++M3] = R7; (r7:6) = [sp++]; RTS; DEFUN_END(put_pixels16uc_nornd) DEFUN(z_put_pixels16_xy2,mL1, (uint8_t *block, const uint8_t *s0, int dest_size, int line_size, int h)): link 0; [--sp] = (r7:4); i3=r0; // dest i0=r1; // src0--> pixels i1=r1; // src1--> pixels + line_size r2+=-12; m2=r2; // m2=dest_width-4 r2=[fp+20]; m3=r2; // line_size p0=[fp+24]; // h r2+=-16; i1+=m3; /* src1 + line_size */ m0=r2; /* line-size - 20 */ B0 = I0; B1 = I1; B3 = I3; DISALGNEXCPT || R0 = [I0++] || R2 =[I1++]; LSETUP(LS$16E,LE$16E) LC0=P0; LS$16E: DISALGNEXCPT || R1 = [I0++] || R3 =[I1++]; R4 = BYTEOP2P (R3:2,R1:0) (RNDL) || R0 = [I0++] || R2 =[I1++]; R5 = BYTEOP2P (R3:2,R1:0) (RNDL,R) || R1 = [I0++] || [I3++] = R4 ; DISALGNEXCPT || R3 = [I1++] || [I3++] = R5; R4 = BYTEOP2P (R3:2,R1:0) (RNDL) || R0 = [I0++M0]|| R2 = [I1++M0]; R5 = BYTEOP2P (R3:2,R1:0) (RNDL,R) || R0 = [I0++] || [I3++] = R4 ; LE$16E: DISALGNEXCPT || R2 = [I1++] || [I3++M2] = R5; M1 = 1; I3 = B3; I1 = B1; I0 = B0; I0 += M1; I1 += M1; DISALGNEXCPT || R0 = [I0++] || R2 =[I1++]; LSETUP(LS$16O,LE$16O) LC0=P0; LS$16O: DISALGNEXCPT || R1 = [I0++] || R3 =[I1++]; R4 = BYTEOP2P (R3:2,R1:0) (RNDH) || R0 = [I0++] || R2 =[I1++]; R5 = BYTEOP2P (R3:2,R1:0) (RNDH,R) || R1 = [I0++] || R6 =[I3++]; R4 = R4 +|+ R6 || R7 = [I3--]; R5 = R5 +|+ R7 || [I3++] = R4; DISALGNEXCPT || R3 =[I1++] || [I3++] = R5; R4 = BYTEOP2P (R3:2,R1:0) (RNDH) || R0 = [I0++M0]|| R2 = [I1++M0]; R5 = BYTEOP2P (R3:2,R1:0) (RNDH,R) || R0 = [I0++] || R6 = [I3++]; R4 = R4 +|+ R6 || R7 = [I3--]; R5 = R5 +|+ R7 || [I3++] = R4; LE$16O: DISALGNEXCPT || R2 = [I1++] || [I3++M2] = R5; (r7:4) = [sp++]; unlink; rts; DEFUN_END(z_put_pixels16_xy2) DEFUN(put_pixels16_xy2_nornd,mL1, (uint8_t *block, const uint8_t *s0, int line_size, int h)): link 0; [--sp] = (r7:4); i3=r0; // dest i0=r1; // src0--> pixels i1=r1; // src1--> pixels + line_size m3=r2; r2+=-12; m2=r2; r2+=-4; i1+=m3; /* src1 + line_size */ m0=r2; /* line-size - 20 */ p0=[fp+20]; // h B0=I0; B1=I1; B3=I3; DISALGNEXCPT || R0 = [I0++] || R2 =[I1++]; LSETUP(LS$16ET,LE$16ET) LC0=P0; LS$16ET:DISALGNEXCPT || R1 = [I0++] || R3 =[I1++]; R4 = BYTEOP2P (R3:2,R1:0) (TL) || R0 = [I0++] || R2 =[I1++]; R5 = BYTEOP2P (R3:2,R1:0) (TL,R) || R1 = [I0++] || [I3++] = R4 ; DISALGNEXCPT || R3 = [I1++] || [I3++] = R5; R4 = BYTEOP2P (R3:2,R1:0) (TL) || R0 = [I0++M0]|| R2 = [I1++M0]; R5 = BYTEOP2P (R3:2,R1:0) (TL,R) || R0 = [I0++] || [I3++] = R4 ; LE$16ET:DISALGNEXCPT || R2 = [I1++] || [I3++M2] = R5; M1 = 1; I3=B3; I1=B1; I0=B0; I0 += M1; I1 += M1; DISALGNEXCPT || R0 = [I0++] || R2 =[I1++]; LSETUP(LS$16OT,LE$16OT) LC0=P0; LS$16OT:DISALGNEXCPT || R1 = [I0++] || R3 =[I1++]; R4 = BYTEOP2P (R3:2,R1:0) (TH) || R0 = [I0++] || R2 =[I1++]; R5 = BYTEOP2P (R3:2,R1:0) (TH,R) || R1 = [I0++] || R6 =[I3++]; R4 = R4 +|+ R6 || R7 = [I3--]; R5 = R5 +|+ R7 || [I3++] = R4; DISALGNEXCPT || R3 =[I1++] || [I3++] = R5; R4 = BYTEOP2P (R3:2,R1:0) (TH) || R0 = [I0++M0]|| R2 = [I1++M0]; R5 = BYTEOP2P (R3:2,R1:0) (TH,R) || R0 = [I0++] || R6 = [I3++]; R4 = R4 +|+ R6 || R7 = [I3--]; R5 = R5 +|+ R7 || [I3++] = R4; LE$16OT:DISALGNEXCPT || R2 = [I1++] || [I3++M2] = R5; (r7:4) = [sp++]; unlink; rts; DEFUN_END(put_pixels16_xy2_nornd) DEFUN(z_put_pixels8_xy2,mL1, (uint8_t *block, const uint8_t *s0, int dest_size, int line_size, int h)): link 0; [--sp] = (r7:4); i3=r0; // dest i0=r1; // src0--> pixels i1=r1; // src1--> pixels + line_size r2+=-4; m2=r2; // m2=dest_width-4 r2=[fp+20]; m3=r2; // line_size p0=[fp+24]; // h r2+=-8; i1+=m3; /* src1 + line_size */ m0=r2; /* line-size - 20 */ b0 = I0; b1 = I1; b3 = I3; LSETUP(LS$8E,LE$8E) LC0=P0; DISALGNEXCPT || R0 = [I0++] || R2 =[I1++]; LS$8E: DISALGNEXCPT || R1 = [I0++] || R3 =[I1++]; R4 = BYTEOP2P (R3:2,R1:0) (RNDL) || R0 = [I0++M0] || R2 =[I1++M0]; R5 = BYTEOP2P (R3:2,R1:0) (RNDL,R) || R0 = [I0++] || [I3++] = R4 ; LE$8E: DISALGNEXCPT || R2 = [I1++] || [I3++M2] = R5; M1 = 1; I3 = b3; I1 = b1; I0 = b0; I0 += M1; I1 += M1; LSETUP(LS$8O,LE$8O) LC0=P0; DISALGNEXCPT || R0 = [I0++] || R2 =[I1++]; LS$8O: DISALGNEXCPT || R1 = [I0++] || R3 =[I1++]; R4 = BYTEOP2P (R3:2,R1:0) (RNDH) || R0 = [I0++M0] || R2 =[I1++M0]; R5 = BYTEOP2P (R3:2,R1:0) (RNDH,R) || R0 = [I0++] || R6 =[I3++]; R4 = R4 +|+ R6 || R7 = [I3--]; R5 = R5 +|+ R7 || [I3++] = R4; LE$8O: DISALGNEXCPT || R2 =[I1++] || [I3++M2] = R5; (r7:4) = [sp++]; unlink; rts; DEFUN_END(z_put_pixels8_xy2) DEFUN(put_pixels8_xy2_nornd,mL1, (uint8_t *block, const uint8_t *s0, int line_size, int h)): link 0; [--sp] = (r7:4); i3=r0; // dest i0=r1; // src0--> pixels i1=r1; // src1--> pixels + line_size m3=r2; r2+=-4; m2=r2; r2+=-4; i1+=m3; /* src1 + line_size */ m0=r2; /* line-size - 20 */ p0=[fp+20]; // h b0 = I0; b1 = I1; b3 = I3; LSETUP(LS$8ET,LE$8ET) LC0=P0; DISALGNEXCPT || R0 = [I0++] || R2 =[I1++]; LS$8ET: DISALGNEXCPT || R1 = [I0++] || R3 = [I1++]; R4 = BYTEOP2P (R3:2,R1:0) (TL) || R0 = [I0++M0] || R2 = [I1++M0]; R5 = BYTEOP2P (R3:2,R1:0) (TL,R) || R0 = [I0++] || [I3++] = R4 ; LE$8ET: DISALGNEXCPT || R2 = [I1++] || [I3++M2] = R5; M1 = 1; I3 = b3; I1 = b1; I0 = b0; I0 += M1; I1 += M1; LSETUP(LS$8OT,LE$8OT) LC0=P0; DISALGNEXCPT || R0 = [I0++] || R2 = [I1++]; LS$8OT: DISALGNEXCPT || R1 = [I0++] || R3 = [I1++]; R4 = BYTEOP2P (R3:2,R1:0) (TH) || R0 = [I0++M0] || R2 = [I1++M0]; R5 = BYTEOP2P (R3:2,R1:0) (TH,R) || R0 = [I0++] || R6 = [I3++]; R4 = R4 +|+ R6 || R7 = [I3--]; R5 = R5 +|+ R7 || [I3++] = R4; LE$8OT: DISALGNEXCPT || R2 =[I1++] || [I3++M2] = R5; (r7:4) = [sp++]; unlink; rts; DEFUN(diff_pixels,mL1, (DCTELEM *block, uint8_t *s1, uint8_t *s2, int stride)): link 0; [--sp] = (r7:4); p0=8; i3=r0; // block i0=r1; // s1 i1=r2; // s2 r2=[fp+20]; // stride r2+=-8; m0=r2; LSETUP(.LS0,.LE0) LC0=P0; DISALGNEXCPT || R0 = [I0++] || R2 =[I1++]; .LS0: DISALGNEXCPT || R1 = [I0++] || R3 = [I1++]; (R5,R4) = BYTEOP16M (R1:0,R3:2) || R0 = [I0++M0] || R2 = [I1++M0]; (R7,R6) = BYTEOP16M (R1:0,R3:2) (R)|| R0 = [I0++] || [I3++] = R4; DISALGNEXCPT || R2 = [I1++] || [I3++] = R5; [i3++]=r6; .LE0: [i3++]=r7; (r7:4) = [sp++]; unlink; rts; DEFUN_END(put_pixels8_xy2_nornd) /* for (i = 0; i < 16; i++) { for (j = 0; j < 16; j++) { sum += pix[j]; } pix += line_size; } */ DEFUN(pix_sum,mL1, (uint8_t *p, int stride)): link 0; [--sp] = (r7:4); p0=8; i0=r0; // s1 i1=r0; m1=r1; r1=r1+r1; r1+=-16; // stride m0=r1; i1+=m1; r6=0; LSETUP(LS$PS,LE$PS) LC0=P0; DISALGNEXCPT || R0 = [I0++] || R2 =[I1++]; LS$PS: DISALGNEXCPT || R1 = [I0++] || R3 = [I1++]; (R5,R4) = BYTEOP16P (R3:2,R1:0) || R0 = [I0++] || R2 = [I1++]; r6=r6+|+r5; r6=r6+|+r4; (R5,R4) = BYTEOP16P (R3:2,R1:0) (R)|| R1 = [I0++] || R3 = [I1++]; r6=r6+|+r5; r6=r6+|+r4; (R5,R4) = BYTEOP16P (R3:2,R1:0) || R0 = [I0++m0] || R2 = [I1++m0]; r6=r6+|+r5; r6=r6+|+r4; (R5,R4) = BYTEOP16P (R3:2,R1:0) (R)|| R0 = [I0++] || R2 = [I1++]; r6=r6+|+r5; LE$PS: r6=r6+|+r4; r0.l=r6.l+r6.h; r0.h=0; (r7:4) = [sp++]; unlink; rts; DEFUN_END(pix_sum) DEFUN(get_pixels,mL1, (DCTELEM *restrict block, const uint8_t *pixels, int line_size)): [--sp] = (r7:4); i3=r0; // dest i0=r1; // src0 p0=8; r2+=-8; m0=r2; LSETUP(gp8$0,gp8$1) LC0=P0; DISALGNEXCPT || R0 = [I0++]; DISALGNEXCPT || R1 = [I0++]; gp8$0: (R7,R6) = byteunpack R1:0 || R0 = [I0++M0]; (R5,R4) = byteunpack R1:0 (R) || R0 = [I0++] || [I3++]=R6; DISALGNEXCPT || R1 = [I0++] || [I3++]=R7; [I3++]=R4; gp8$1: [I3++]=R5 (r7:4) = [sp++]; RTS; DEFUN_END(get_pixels) /* sad = sad16x16 (ubyte *mb, ubyte *refwin, srcwidth, refwinwidth, h) */ /* 91 cycles */ DEFUN(z_sad16x16,mL1, (uint8_t *blk1, uint8_t *blk2, int dsz, int line_size, int h)): link 0; I0 = R0; I1 = R1; A1 = A0 = 0; R0 = [sp+20]; // rwidth P2 = [sp+24]; // height R3 = 16; R0 = R0 - R3; R3 = R2 - R3; M1 = R0; M0 = R3; DISALGNEXCPT || R0 = [I0++] || R2 = [I1++]; LSETUP (s$16, e$16) LC0=P2; s$16: DISALGNEXCPT || R1 = [I0++] || R3 = [I1++]; SAA (R1:0,R3:2) || R0 = [I0++] || R2 = [I1++]; SAA (R1:0,R3:2) (R) || R1 = [I0++] || R3 = [I1++]; SAA (R1:0,R3:2) || R0 = [I0++M0] || R2 = [I1++M1]; e$16: SAA (R1:0,R3:2) (R) || R0 = [I0++] || R2 = [I1++]; R3=A1.L+A1.H, R2=A0.L+A0.H ; R0 = R2 + R3 ; unlink; RTS; DEFUN_END(z_sad16x16) /* sad = sad8x8 (ubyte *mb, ubyte *refwin, int srcwidth, int refwinwidth, int h) */ /* 36 cycles */ DEFUN(z_sad8x8,mL1, (uint8_t *blk1, uint8_t *blk2, int dsz, int line_size, int h)): I0 = R0; I1 = R1; A1 = A0 = 0; r0 = [sp+12]; // rwidth P2 = [sp+16]; //height R3 = 8; R0 = R0 - R3; R3 = R2 - R3; M0 = R3; M1 = R0; LSETUP (s$8, e$8) LC0=P2; DISALGNEXCPT || R0 = [I0++] || R2 = [I1++]; DISALGNEXCPT || R1 = [I0++] || R3 = [I1++]; s$8: SAA (R1:0,R3:2) || R0 = [I0++M0] || R2 = [I1++M1]; SAA (R1:0,R3:2) (R) || R0 = [I0++] || R2 = [I1++]; e$8: DISALGNEXCPT || R1 = [I0++] || R3 = [I1++]; R3=A1.L+A1.H, R2=A0.L+A0.H ; R0 = R2 + R3 ; RTS; DEFUN_END(z_sad8x8) DEFUN(pix_norm1,mL1, (uint8_t * pix, int line_size)): [--SP]=(R7:4,P5:3); // Fetch the input arguments. P1 = R0; // pix P0 = R1; // line_size P5 = 16; // loop ctr. P0 -= P5; M0 = P0; // M0 = line_size-16; // Now for the real work. A1 = A0 = 0; lsetup(_pix_norm1_blkfn_loopStart, _pix_norm1_blkfn_loopEnd) LC1 = P5; I0 = P1; DISALGNEXCPT || r0 = [i0++]; _pix_norm1_blkfn_loopStart: // following unpacks pix1[0..15] pix1+line_size[0..15] DISALGNEXCPT || r1 = [i0++]; (r5, r4) = byteunpack r1:0 || r0 = [i0++]; a1 += r5.h * r5.h, a0 += r5.l * r5.l (is); a1 += r4.h * r4.h, a0 += r4.l * r4.l (is); (r5, r4) = byteunpack r1:0(r) || r1 = [i0++]; a1 += r5.h * r5.h, a0 += r5.l * r5.l (is); a1 += r4.h * r4.h, a0 += r4.l * r4.l (is); (r5, r4) = byteunpack r1:0 || r0 = [i0++M0]; a1 += r5.h * r5.h, a0 += r5.l * r5.l (is); a1 += r4.h * r4.h, a0 += r4.l * r4.l (is); (r5, r4) = byteunpack r1:0(r) || r0 = [i0++]; a1 += r5.h * r5.h, a0 += r5.l * r5.l (is); _pix_norm1_blkfn_loopEnd: a1 += r4.h * r4.h, a0 += r4.l * r4.l (is); // Clean up at the end: R2 = A0, R3 = A1; R0 = R2 + R3 (S); (R7:4,P5:3)=[SP++]; RTS; DEFUN_END(pix_norm1) DEFUN(sse4,mL1, (void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)): link 0; [--sp] = (r7:6); p0=[fp+24]; // h i0=r1; // pix1 i1=r2; // pix2 r2=[fp+20]; // line_size r2+=-4; m0=r2; a0=a1=0; LSETUP(.S40,.E40) LC0=P0; DISALGNEXCPT || R0 = [I0++] || R2 =[I1++]; .S40: DISALGNEXCPT || R1 = [I0++M0] || R3 = [I1++M0]; (R7,R6) = BYTEOP16M (R1:0,R3:2); a0 += r7.l * r7.l, a1 += r7.h * r7.h (is); .E40: a0 += r6.l * r6.l, a1 += r6.h * r6.h (is); a0 += a1; r0 = a0; (r7:6) = [sp++]; unlink; rts; DEFUN_END(sse4) DEFUN(sse8,mL1, (void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)): link 0; [--sp] = (r7:6); p0=[fp+24]; // h i0=r1; // pix1 i1=r2; // pix2 r2=[fp+20]; // line_size r2+=-8; m0=r2; a0=a1=0; LSETUP(.S80,.E80) LC0=P0; DISALGNEXCPT || R0 = [I0++] || R2 =[I1++]; .S80: DISALGNEXCPT || R1 = [I0++] || R3 = [I1++]; (R7,R6) = BYTEOP16M (R1:0,R3:2) || R0 = [I0++M0] || R2 = [I1++M0]; a0 += r7.l * r7.l, a1 += r7.h * r7.h (is); a0 += r6.l * r6.l, a1 += r6.h * r6.h (is); (R7,R6) = BYTEOP16M (R1:0,R3:2) (R)|| R0 = [I0++] || R2 = [I1++]; a0 += r7.l * r7.l, a1 += r7.h * r7.h (is); .E80: a0 += r6.l * r6.l, a1 += r6.h * r6.h (is); a0 += a1; r0 = a0; (r7:6) = [sp++]; unlink; rts; DEFUN_END(sse8) DEFUN(sse16,mL1, (void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)): link 0; [--sp] = (r7:6); p0=[fp+24]; // h i0=r1; // pix1 i1=r2; // pix2 r2=[fp+20]; // line_size r2+=-16; m0=r2; a0=a1=0; DISALGNEXCPT || R0 = [I0++] || R2 =[I1++]; LSETUP(.S160,.E160) LC0=P0; .S160: DISALGNEXCPT || R1 = [I0++] || R3 = [I1++]; (R7,R6) = BYTEOP16M (R1:0,R3:2) || R0 = [I0++] || R2 = [I1++]; a0 += r7.l * r7.l, a1 += r7.h * r7.h (is); a0 += r6.l * r6.l, a1 += r6.h * r6.h (is); (R7,R6) = BYTEOP16M (R1:0,R3:2) (R)|| R1 = [I0++] || R3 = [I1++]; a0 += r7.l * r7.l, a1 += r7.h * r7.h (is); a0 += r6.l * r6.l, a1 += r6.h * r6.h (is); (R7,R6) = BYTEOP16M (R1:0,R3:2) || R0 = [I0++M0] || R2 = [I1++M0]; a0 += r7.l * r7.l, a1 += r7.h * r7.h (is); a0 += r6.l * r6.l, a1 += r6.h * r6.h (is); (R7,R6) = BYTEOP16M (R1:0,R3:2) (R)|| R0 = [I0++] || R2 = [I1++]; a0 += r7.l * r7.l, a1 += r7.h * r7.h (is); .E160: a0 += r6.l * r6.l, a1 += r6.h * r6.h (is); a0 += a1; r0 = a0; (r7:6) = [sp++]; unlink; rts; DEFUN_END(sse16)
123linslouis-android-video-cutter
jni/libavcodec/bfin/pixels_bfin.S
Unix Assembly
asf20
24,287
/* * PNG image format * Copyright (c) 2003 Fabrice Bellard * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avcodec.h" #include "bytestream.h" #include "dsputil.h" #include "png.h" /* TODO: * - add 2, 4 and 16 bit depth support */ #include <zlib.h> //#define DEBUG #define IOBUF_SIZE 4096 typedef struct PNGEncContext { DSPContext dsp; uint8_t *bytestream; uint8_t *bytestream_start; uint8_t *bytestream_end; AVFrame picture; int filter_type; z_stream zstream; uint8_t buf[IOBUF_SIZE]; } PNGEncContext; static void png_get_interlaced_row(uint8_t *dst, int row_size, int bits_per_pixel, int pass, const uint8_t *src, int width) { int x, mask, dst_x, j, b, bpp; uint8_t *d; const uint8_t *s; mask = ff_png_pass_mask[pass]; switch(bits_per_pixel) { case 1: memset(dst, 0, row_size); dst_x = 0; for(x = 0; x < width; x++) { j = (x & 7); if ((mask << j) & 0x80) { b = (src[x >> 3] >> (7 - j)) & 1; dst[dst_x >> 3] |= b << (7 - (dst_x & 7)); dst_x++; } } break; default: bpp = bits_per_pixel >> 3; d = dst; s = src; for(x = 0; x < width; x++) { j = x & 7; if ((mask << j) & 0x80) { memcpy(d, s, bpp); d += bpp; } s += bpp; } break; } } static void sub_png_paeth_prediction(uint8_t *dst, uint8_t *src, uint8_t *top, int w, int bpp) { int i; for(i = 0; i < w; i++) { int a, b, c, p, pa, pb, pc; a = src[i - bpp]; b = top[i]; c = top[i - bpp]; p = b - c; pc = a - c; pa = abs(p); pb = abs(pc); pc = abs(p + pc); if (pa <= pb && pa <= pc) p = a; else if (pb <= pc) p = b; else p = c; dst[i] = src[i] - p; } } static void png_filter_row(DSPContext *dsp, uint8_t *dst, int filter_type, uint8_t *src, uint8_t *top, int size, int bpp) { int i; switch(filter_type) { case PNG_FILTER_VALUE_NONE: memcpy(dst, src, size); break; case PNG_FILTER_VALUE_SUB: dsp->diff_bytes(dst, src, src-bpp, size); memcpy(dst, src, bpp); break; case PNG_FILTER_VALUE_UP: dsp->diff_bytes(dst, src, top, size); break; case PNG_FILTER_VALUE_AVG: for(i = 0; i < bpp; i++) dst[i] = src[i] - (top[i] >> 1); for(; i < size; i++) dst[i] = src[i] - ((src[i-bpp] + top[i]) >> 1); break; case PNG_FILTER_VALUE_PAETH: for(i = 0; i < bpp; i++) dst[i] = src[i] - top[i]; sub_png_paeth_prediction(dst+i, src+i, top+i, size-i, bpp); break; } } static uint8_t *png_choose_filter(PNGEncContext *s, uint8_t *dst, uint8_t *src, uint8_t *top, int size, int bpp) { int pred = s->filter_type; assert(bpp || !pred); if(!top && pred) pred = PNG_FILTER_VALUE_SUB; if(pred == PNG_FILTER_VALUE_MIXED) { int i; int cost, bcost = INT_MAX; uint8_t *buf1 = dst, *buf2 = dst + size + 16; for(pred=0; pred<5; pred++) { png_filter_row(&s->dsp, buf1+1, pred, src, top, size, bpp); buf1[0] = pred; cost = 0; for(i=0; i<=size; i++) cost += abs((int8_t)buf1[i]); if(cost < bcost) { bcost = cost; FFSWAP(uint8_t*, buf1, buf2); } } return buf2; } else { png_filter_row(&s->dsp, dst+1, pred, src, top, size, bpp); dst[0] = pred; return dst; } } static void convert_from_rgb32(uint8_t *dst, const uint8_t *src, int width) { uint8_t *d; int j; unsigned int v; d = dst; for(j = 0; j < width; j++) { v = ((const uint32_t *)src)[j]; d[0] = v >> 16; d[1] = v >> 8; d[2] = v; d[3] = v >> 24; d += 4; } } static void png_write_chunk(uint8_t **f, uint32_t tag, const uint8_t *buf, int length) { uint32_t crc; uint8_t tagbuf[4]; bytestream_put_be32(f, length); crc = crc32(0, Z_NULL, 0); AV_WL32(tagbuf, tag); crc = crc32(crc, tagbuf, 4); bytestream_put_be32(f, bswap_32(tag)); if (length > 0) { crc = crc32(crc, buf, length); memcpy(*f, buf, length); *f += length; } bytestream_put_be32(f, crc); } /* XXX: do filtering */ static int png_write_row(PNGEncContext *s, const uint8_t *data, int size) { int ret; s->zstream.avail_in = size; s->zstream.next_in = (uint8_t *)data; while (s->zstream.avail_in > 0) { ret = deflate(&s->zstream, Z_NO_FLUSH); if (ret != Z_OK) return -1; if (s->zstream.avail_out == 0) { if(s->bytestream_end - s->bytestream > IOBUF_SIZE + 100) png_write_chunk(&s->bytestream, MKTAG('I', 'D', 'A', 'T'), s->buf, IOBUF_SIZE); s->zstream.avail_out = IOBUF_SIZE; s->zstream.next_out = s->buf; } } return 0; } static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){ PNGEncContext *s = avctx->priv_data; AVFrame *pict = data; AVFrame * const p= &s->picture; int bit_depth, color_type, y, len, row_size, ret, is_progressive; int bits_per_pixel, pass_row_size; int compression_level; uint8_t *ptr, *top; uint8_t *crow_base = NULL, *crow_buf, *crow; uint8_t *progressive_buf = NULL; uint8_t *rgba_buf = NULL; uint8_t *top_buf = NULL; *p = *pict; p->pict_type= FF_I_TYPE; p->key_frame= 1; s->bytestream_start= s->bytestream= buf; s->bytestream_end= buf+buf_size; is_progressive = !!(avctx->flags & CODEC_FLAG_INTERLACED_DCT); switch(avctx->pix_fmt) { case PIX_FMT_RGB32: bit_depth = 8; color_type = PNG_COLOR_TYPE_RGB_ALPHA; break; case PIX_FMT_RGB24: bit_depth = 8; color_type = PNG_COLOR_TYPE_RGB; break; case PIX_FMT_GRAY8: bit_depth = 8; color_type = PNG_COLOR_TYPE_GRAY; break; case PIX_FMT_MONOBLACK: bit_depth = 1; color_type = PNG_COLOR_TYPE_GRAY; break; case PIX_FMT_PAL8: bit_depth = 8; color_type = PNG_COLOR_TYPE_PALETTE; break; default: return -1; } bits_per_pixel = ff_png_get_nb_channels(color_type) * bit_depth; row_size = (avctx->width * bits_per_pixel + 7) >> 3; s->zstream.zalloc = ff_png_zalloc; s->zstream.zfree = ff_png_zfree; s->zstream.opaque = NULL; compression_level = avctx->compression_level == FF_COMPRESSION_DEFAULT ? Z_DEFAULT_COMPRESSION : av_clip(avctx->compression_level, 0, 9); ret = deflateInit2(&s->zstream, compression_level, Z_DEFLATED, 15, 8, Z_DEFAULT_STRATEGY); if (ret != Z_OK) return -1; crow_base = av_malloc((row_size + 32) << (s->filter_type == PNG_FILTER_VALUE_MIXED)); if (!crow_base) goto fail; crow_buf = crow_base + 15; // pixel data should be aligned, but there's a control byte before it if (is_progressive) { progressive_buf = av_malloc(row_size + 1); if (!progressive_buf) goto fail; } if (color_type == PNG_COLOR_TYPE_RGB_ALPHA) { rgba_buf = av_malloc(row_size + 1); if (!rgba_buf) goto fail; } if (is_progressive || color_type == PNG_COLOR_TYPE_RGB_ALPHA) { top_buf = av_malloc(row_size + 1); if (!top_buf) goto fail; } /* write png header */ memcpy(s->bytestream, ff_pngsig, 8); s->bytestream += 8; AV_WB32(s->buf, avctx->width); AV_WB32(s->buf + 4, avctx->height); s->buf[8] = bit_depth; s->buf[9] = color_type; s->buf[10] = 0; /* compression type */ s->buf[11] = 0; /* filter type */ s->buf[12] = is_progressive; /* interlace type */ png_write_chunk(&s->bytestream, MKTAG('I', 'H', 'D', 'R'), s->buf, 13); /* put the palette if needed */ if (color_type == PNG_COLOR_TYPE_PALETTE) { int has_alpha, alpha, i; unsigned int v; uint32_t *palette; uint8_t *alpha_ptr; palette = (uint32_t *)p->data[1]; ptr = s->buf; alpha_ptr = s->buf + 256 * 3; has_alpha = 0; for(i = 0; i < 256; i++) { v = palette[i]; alpha = v >> 24; if (alpha && alpha != 0xff) has_alpha = 1; *alpha_ptr++ = alpha; bytestream_put_be24(&ptr, v); } png_write_chunk(&s->bytestream, MKTAG('P', 'L', 'T', 'E'), s->buf, 256 * 3); if (has_alpha) { png_write_chunk(&s->bytestream, MKTAG('t', 'R', 'N', 'S'), s->buf + 256 * 3, 256); } } /* now put each row */ s->zstream.avail_out = IOBUF_SIZE; s->zstream.next_out = s->buf; if (is_progressive) { int pass; for(pass = 0; pass < NB_PASSES; pass++) { /* NOTE: a pass is completely omited if no pixels would be output */ pass_row_size = ff_png_pass_row_size(pass, bits_per_pixel, avctx->width); if (pass_row_size > 0) { top = NULL; for(y = 0; y < avctx->height; y++) { if ((ff_png_pass_ymask[pass] << (y & 7)) & 0x80) { ptr = p->data[0] + y * p->linesize[0]; FFSWAP(uint8_t*, progressive_buf, top_buf); if (color_type == PNG_COLOR_TYPE_RGB_ALPHA) { convert_from_rgb32(rgba_buf, ptr, avctx->width); ptr = rgba_buf; } png_get_interlaced_row(progressive_buf, pass_row_size, bits_per_pixel, pass, ptr, avctx->width); crow = png_choose_filter(s, crow_buf, progressive_buf, top, pass_row_size, bits_per_pixel>>3); png_write_row(s, crow, pass_row_size + 1); top = progressive_buf; } } } } } else { top = NULL; for(y = 0; y < avctx->height; y++) { ptr = p->data[0] + y * p->linesize[0]; if (color_type == PNG_COLOR_TYPE_RGB_ALPHA) { FFSWAP(uint8_t*, rgba_buf, top_buf); convert_from_rgb32(rgba_buf, ptr, avctx->width); ptr = rgba_buf; } crow = png_choose_filter(s, crow_buf, ptr, top, row_size, bits_per_pixel>>3); png_write_row(s, crow, row_size + 1); top = ptr; } } /* compress last bytes */ for(;;) { ret = deflate(&s->zstream, Z_FINISH); if (ret == Z_OK || ret == Z_STREAM_END) { len = IOBUF_SIZE - s->zstream.avail_out; if (len > 0 && s->bytestream_end - s->bytestream > len + 100) { png_write_chunk(&s->bytestream, MKTAG('I', 'D', 'A', 'T'), s->buf, len); } s->zstream.avail_out = IOBUF_SIZE; s->zstream.next_out = s->buf; if (ret == Z_STREAM_END) break; } else { goto fail; } } png_write_chunk(&s->bytestream, MKTAG('I', 'E', 'N', 'D'), NULL, 0); ret = s->bytestream - s->bytestream_start; the_end: av_free(crow_base); av_free(progressive_buf); av_free(rgba_buf); av_free(top_buf); deflateEnd(&s->zstream); return ret; fail: ret = -1; goto the_end; } static av_cold int png_enc_init(AVCodecContext *avctx){ PNGEncContext *s = avctx->priv_data; avcodec_get_frame_defaults(&s->picture); avctx->coded_frame= &s->picture; dsputil_init(&s->dsp, avctx); s->filter_type = av_clip(avctx->prediction_method, PNG_FILTER_VALUE_NONE, PNG_FILTER_VALUE_MIXED); if(avctx->pix_fmt == PIX_FMT_MONOBLACK) s->filter_type = PNG_FILTER_VALUE_NONE; return 0; } AVCodec png_encoder = { "png", AVMEDIA_TYPE_VIDEO, CODEC_ID_PNG, sizeof(PNGEncContext), png_enc_init, encode_frame, NULL, //encode_end, .pix_fmts= (const enum PixelFormat[]){PIX_FMT_RGB24, PIX_FMT_RGB32, PIX_FMT_PAL8, PIX_FMT_GRAY8, PIX_FMT_MONOBLACK, PIX_FMT_NONE}, .long_name= NULL_IF_CONFIG_SMALL("PNG image"), };
123linslouis-android-video-cutter
jni/libavcodec/pngenc.c
C
asf20
13,517
/* * Bink IDCT algorithm * Copyright (c) 2009 Kostya Shishkov * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * Bink IDCT algorithm */ #include "dsputil.h" #define A1 2896 /* (1/sqrt(2))<<12 */ #define A2 2217 #define A3 3784 #define A4 -5352 #define IDCT_TRANSFORM(dest,s0,s1,s2,s3,s4,s5,s6,s7,d0,d1,d2,d3,d4,d5,d6,d7,munge,src) {\ const int a0 = (src)[s0] + (src)[s4]; \ const int a1 = (src)[s0] - (src)[s4]; \ const int a2 = (src)[s2] + (src)[s6]; \ const int a3 = (A1*((src)[s2] - (src)[s6])) >> 11; \ const int a4 = (src)[s5] + (src)[s3]; \ const int a5 = (src)[s5] - (src)[s3]; \ const int a6 = (src)[s1] + (src)[s7]; \ const int a7 = (src)[s1] - (src)[s7]; \ const int b0 = a4 + a6; \ const int b1 = (A3*(a5 + a7)) >> 11; \ const int b2 = ((A4*a5) >> 11) - b0 + b1; \ const int b3 = (A1*(a6 - a4) >> 11) - b2; \ const int b4 = ((A2*a7) >> 11) + b3 - b1; \ (dest)[d0] = munge(a0+a2 +b0); \ (dest)[d1] = munge(a1+a3-a2+b2); \ (dest)[d2] = munge(a1-a3+a2+b3); \ (dest)[d3] = munge(a0-a2 -b4); \ (dest)[d4] = munge(a0-a2 +b4); \ (dest)[d5] = munge(a1-a3+a2-b3); \ (dest)[d6] = munge(a1+a3-a2-b2); \ (dest)[d7] = munge(a0+a2 -b0); \ } /* end IDCT_TRANSFORM macro */ #define MUNGE_NONE(x) (x) #define IDCT_COL(dest,src) IDCT_TRANSFORM(dest,0,8,16,24,32,40,48,56,0,8,16,24,32,40,48,56,MUNGE_NONE,src) #define MUNGE_ROW(x) (((x) + 0x7F)>>8) #define IDCT_ROW(dest,src) IDCT_TRANSFORM(dest,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,MUNGE_ROW,src) static inline void bink_idct_col(DCTELEM *dest, const DCTELEM *src) { if ((src[8]|src[16]|src[24]|src[32]|src[40]|src[48]|src[56])==0) { dest[0] = dest[8] = dest[16] = dest[24] = dest[32] = dest[40] = dest[48] = dest[56] = src[0]; } else { IDCT_COL(dest, src); } } void ff_bink_idct_c(DCTELEM *block) { int i; DCTELEM temp[64]; for (i = 0; i < 8; i++) bink_idct_col(&temp[i], &block[i]); for (i = 0; i < 8; i++) { IDCT_ROW( (&block[8*i]), (&temp[8*i]) ); } } void ff_bink_idct_add_c(uint8_t *dest, int linesize, DCTELEM *block) { int i, j; ff_bink_idct_c(block); for (i = 0; i < 8; i++, dest += linesize, block += 8) for (j = 0; j < 8; j++) dest[j] += block[j]; } void ff_bink_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block) { int i; DCTELEM temp[64]; for (i = 0; i < 8; i++) bink_idct_col(&temp[i], &block[i]); for (i = 0; i < 8; i++) { IDCT_ROW( (&dest[i*linesize]), (&temp[8*i]) ); } }
123linslouis-android-video-cutter
jni/libavcodec/binkidct.c
C
asf20
3,361
/* * Forward Uncompressed * * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger@gmx.de> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avcodec.h" #include "bytestream.h" #include "libavutil/intreadwrite.h" static av_cold int decode_init(AVCodecContext *avctx) { if (avctx->width & 1) { av_log(avctx, AV_LOG_ERROR, "FRWU needs even width\n"); return -1; } avctx->pix_fmt = PIX_FMT_UYVY422; avctx->coded_frame = avcodec_alloc_frame(); return 0; } static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { int field; AVFrame *pic = avctx->coded_frame; const uint8_t *buf = avpkt->data; const uint8_t *buf_end = buf + avpkt->size; if (pic->data[0]) avctx->release_buffer(avctx, pic); if (avpkt->size < avctx->width * 2 * avctx->height + 4 + 2*8) { av_log(avctx, AV_LOG_ERROR, "Packet is too small.\n"); return -1; } if (bytestream_get_le32(&buf) != AV_RL32("FRW1")) { av_log(avctx, AV_LOG_ERROR, "incorrect marker\n"); return -1; } pic->reference = 0; if (avctx->get_buffer(avctx, pic) < 0) return -1; pic->pict_type = FF_I_TYPE; pic->key_frame = 1; pic->interlaced_frame = 1; pic->top_field_first = 1; for (field = 0; field < 2; field++) { int i; int field_h = (avctx->height + !field) >> 1; int field_size, min_field_size = avctx->width * 2 * field_h; uint8_t *dst = pic->data[0]; if (buf_end - buf < 8) return -1; buf += 4; // flags? 0x80 == bottom field maybe? field_size = bytestream_get_le32(&buf); if (field_size < min_field_size) { av_log(avctx, AV_LOG_ERROR, "Field size %i is too small (required %i)\n", field_size, min_field_size); return -1; } if (buf_end - buf < field_size) { av_log(avctx, AV_LOG_ERROR, "Packet is too small, need %i, have %i\n", field_size, (int)(buf_end - buf)); return -1; } if (field) dst += pic->linesize[0]; for (i = 0; i < field_h; i++) { memcpy(dst, buf, avctx->width * 2); buf += avctx->width * 2; dst += pic->linesize[0] << 1; } buf += field_size - min_field_size; } *data_size = sizeof(AVFrame); *(AVFrame*)data = *pic; return avpkt->size; } static av_cold int decode_close(AVCodecContext *avctx) { AVFrame *pic = avctx->coded_frame; if (pic->data[0]) avctx->release_buffer(avctx, pic); av_freep(&avctx->coded_frame); return 0; } AVCodec frwu_decoder = { "FRWU", AVMEDIA_TYPE_VIDEO, CODEC_ID_FRWU, 0, decode_init, NULL, decode_close, decode_frame, CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("Forward Uncompressed"), };
123linslouis-android-video-cutter
jni/libavcodec/frwu.c
C
asf20
3,629
/* * Common code between the AC-3 encoder and decoder * Copyright (c) 2000 Fabrice Bellard * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * Common code between the AC-3 encoder and decoder. */ #include "avcodec.h" #include "ac3.h" #include "get_bits.h" #if CONFIG_HARDCODED_TABLES /** * Starting frequency coefficient bin for each critical band. */ static const uint8_t band_start_tab[51] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 31, 34, 37, 40, 43, 46, 49, 55, 61, 67, 73, 79, 85, 97, 109, 121, 133, 157, 181, 205, 229, 253 }; /** * Maps each frequency coefficient bin to the critical band that contains it. */ static const uint8_t bin_to_band_tab[253] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 36, 37, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49 }; #else /* CONFIG_HARDCODED_TABLES */ static uint8_t band_start_tab[51]; static uint8_t bin_to_band_tab[253]; #endif static inline int calc_lowcomp1(int a, int b0, int b1, int c) { if ((b0 + 256) == b1) { a = c; } else if (b0 > b1) { a = FFMAX(a - 64, 0); } return a; } static inline int calc_lowcomp(int a, int b0, int b1, int bin) { if (bin < 7) { return calc_lowcomp1(a, b0, b1, 384); } else if (bin < 20) { return calc_lowcomp1(a, b0, b1, 320); } else { return FFMAX(a - 128, 0); } } void ff_ac3_bit_alloc_calc_psd(int8_t *exp, int start, int end, int16_t *psd, int16_t *band_psd) { int bin, band; /* exponent mapping to PSD */ for (bin = start; bin < end; bin++) { psd[bin]=(3072 - (exp[bin] << 7)); } /* PSD integration */ bin = start; band = bin_to_band_tab[start]; do { int v = psd[bin++]; int band_end = FFMIN(band_start_tab[band+1], end); for (; bin < band_end; bin++) { int max = FFMAX(v, psd[bin]); /* logadd */ int adr = FFMIN(max - ((v + psd[bin] + 1) >> 1), 255); v = max + ff_ac3_log_add_tab[adr]; } band_psd[band++] = v; } while (end > band_start_tab[band]); } int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd, int start, int end, int fast_gain, int is_lfe, int dba_mode, int dba_nsegs, uint8_t *dba_offsets, uint8_t *dba_lengths, uint8_t *dba_values, int16_t *mask) { int16_t excite[50]; /* excitation */ int band; int band_start, band_end, begin, end1; int lowcomp, fastleak, slowleak; /* excitation function */ band_start = bin_to_band_tab[start]; band_end = bin_to_band_tab[end-1] + 1; if (band_start == 0) { lowcomp = 0; lowcomp = calc_lowcomp1(lowcomp, band_psd[0], band_psd[1], 384); excite[0] = band_psd[0] - fast_gain - lowcomp; lowcomp = calc_lowcomp1(lowcomp, band_psd[1], band_psd[2], 384); excite[1] = band_psd[1] - fast_gain - lowcomp; begin = 7; for (band = 2; band < 7; band++) { if (!(is_lfe && band == 6)) lowcomp = calc_lowcomp1(lowcomp, band_psd[band], band_psd[band+1], 384); fastleak = band_psd[band] - fast_gain; slowleak = band_psd[band] - s->slow_gain; excite[band] = fastleak - lowcomp; if (!(is_lfe && band == 6)) { if (band_psd[band] <= band_psd[band+1]) { begin = band + 1; break; } } } end1 = FFMIN(band_end, 22); for (band = begin; band < end1; band++) { if (!(is_lfe && band == 6)) lowcomp = calc_lowcomp(lowcomp, band_psd[band], band_psd[band+1], band); fastleak = FFMAX(fastleak - s->fast_decay, band_psd[band] - fast_gain); slowleak = FFMAX(slowleak - s->slow_decay, band_psd[band] - s->slow_gain); excite[band] = FFMAX(fastleak - lowcomp, slowleak); } begin = 22; } else { /* coupling channel */ begin = band_start; fastleak = (s->cpl_fast_leak << 8) + 768; slowleak = (s->cpl_slow_leak << 8) + 768; } for (band = begin; band < band_end; band++) { fastleak = FFMAX(fastleak - s->fast_decay, band_psd[band] - fast_gain); slowleak = FFMAX(slowleak - s->slow_decay, band_psd[band] - s->slow_gain); excite[band] = FFMAX(fastleak, slowleak); } /* compute masking curve */ for (band = band_start; band < band_end; band++) { int tmp = s->db_per_bit - band_psd[band]; if (tmp > 0) { excite[band] += tmp >> 2; } mask[band] = FFMAX(ff_ac3_hearing_threshold_tab[band >> s->sr_shift][s->sr_code], excite[band]); } /* delta bit allocation */ if (dba_mode == DBA_REUSE || dba_mode == DBA_NEW) { int i, seg, delta; if (dba_nsegs >= 8) return -1; band = 0; for (seg = 0; seg < dba_nsegs; seg++) { band += dba_offsets[seg]; if (band >= 50 || dba_lengths[seg] > 50-band) return -1; if (dba_values[seg] >= 4) { delta = (dba_values[seg] - 3) << 7; } else { delta = (dba_values[seg] - 4) << 7; } for (i = 0; i < dba_lengths[seg]; i++) { mask[band++] += delta; } } } return 0; } void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end, int snr_offset, int floor, const uint8_t *bap_tab, uint8_t *bap) { int bin, band; /* special case, if snr offset is -960, set all bap's to zero */ if (snr_offset == -960) { memset(bap, 0, 256); return; } bin = start; band = bin_to_band_tab[start]; do { int m = (FFMAX(mask[band] - snr_offset - floor, 0) & 0x1FE0) + floor; int band_end = FFMIN(band_start_tab[band+1], end); for (; bin < band_end; bin++) { int address = av_clip((psd[bin] - m) >> 5, 0, 63); bap[bin] = bap_tab[address]; } } while (end > band_start_tab[band++]); } /* AC-3 bit allocation. The algorithm is the one described in the AC-3 spec. */ void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap, int8_t *exp, int start, int end, int snr_offset, int fast_gain, int is_lfe, int dba_mode, int dba_nsegs, uint8_t *dba_offsets, uint8_t *dba_lengths, uint8_t *dba_values) { int16_t psd[256]; /* scaled exponents */ int16_t band_psd[50]; /* interpolated exponents */ int16_t mask[50]; /* masking value */ ff_ac3_bit_alloc_calc_psd(exp, start, end, psd, band_psd); ff_ac3_bit_alloc_calc_mask(s, band_psd, start, end, fast_gain, is_lfe, dba_mode, dba_nsegs, dba_offsets, dba_lengths, dba_values, mask); ff_ac3_bit_alloc_calc_bap(mask, psd, start, end, snr_offset, s->floor, ff_ac3_bap_tab, bap); } /** * Initializes some tables. * note: This function must remain thread safe because it is called by the * AVParser init code. */ av_cold void ac3_common_init(void) { #if !CONFIG_HARDCODED_TABLES /* compute bndtab and masktab from bandsz */ int bin = 0, band; for (band = 0; band < 50; band++) { int band_end = bin + ff_ac3_critical_band_size_tab[band]; band_start_tab[band] = bin; while (bin < band_end) bin_to_band_tab[bin++] = band; } band_start_tab[50] = bin; #endif /* !CONFIG_HARDCODED_TABLES */ }
123linslouis-android-video-cutter
jni/libavcodec/ac3.c
C
asf20
9,747
/* * Audio and Video frame extraction * Copyright (c) 2003 Fabrice Bellard * Copyright (c) 2003 Michael Niedermayer * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "parser.h" #include "aac_ac3_parser.h" #include "aac_parser.h" #include "get_bits.h" #include "mpeg4audio.h" int ff_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr) { int size, rdb, ch, sr; int aot, crc_abs; if(get_bits(gbc, 12) != 0xfff) return AAC_AC3_PARSE_ERROR_SYNC; skip_bits1(gbc); /* id */ skip_bits(gbc, 2); /* layer */ crc_abs = get_bits1(gbc); /* protection_absent */ aot = get_bits(gbc, 2); /* profile_objecttype */ sr = get_bits(gbc, 4); /* sample_frequency_index */ if(!ff_mpeg4audio_sample_rates[sr]) return AAC_AC3_PARSE_ERROR_SAMPLE_RATE; skip_bits1(gbc); /* private_bit */ ch = get_bits(gbc, 3); /* channel_configuration */ skip_bits1(gbc); /* original/copy */ skip_bits1(gbc); /* home */ /* adts_variable_header */ skip_bits1(gbc); /* copyright_identification_bit */ skip_bits1(gbc); /* copyright_identification_start */ size = get_bits(gbc, 13); /* aac_frame_length */ if(size < AAC_ADTS_HEADER_SIZE) return AAC_AC3_PARSE_ERROR_FRAME_SIZE; skip_bits(gbc, 11); /* adts_buffer_fullness */ rdb = get_bits(gbc, 2); /* number_of_raw_data_blocks_in_frame */ hdr->object_type = aot + 1; hdr->chan_config = ch; hdr->crc_absent = crc_abs; hdr->num_aac_frames = rdb + 1; hdr->sampling_index = sr; hdr->sample_rate = ff_mpeg4audio_sample_rates[sr]; hdr->samples = (rdb + 1) * 1024; hdr->bit_rate = size * 8 * hdr->sample_rate / hdr->samples; return size; } static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info, int *need_next_header, int *new_frame_start) { GetBitContext bits; AACADTSHeaderInfo hdr; int size; union { uint64_t u64; uint8_t u8[8]; } tmp; tmp.u64 = be2me_64(state); init_get_bits(&bits, tmp.u8+8-AAC_ADTS_HEADER_SIZE, AAC_ADTS_HEADER_SIZE * 8); if ((size = ff_aac_parse_header(&bits, &hdr)) < 0) return 0; *need_next_header = 0; *new_frame_start = 1; hdr_info->sample_rate = hdr.sample_rate; hdr_info->channels = ff_mpeg4audio_channels[hdr.chan_config]; hdr_info->samples = hdr.samples; hdr_info->bit_rate = hdr.bit_rate; return size; } static av_cold int aac_parse_init(AVCodecParserContext *s1) { AACAC3ParseContext *s = s1->priv_data; s->header_size = AAC_ADTS_HEADER_SIZE; s->sync = aac_sync; return 0; } AVCodecParser aac_parser = { { CODEC_ID_AAC }, sizeof(AACAC3ParseContext), aac_parse_init, ff_aac_ac3_parse, ff_parse_close, };
123linslouis-android-video-cutter
jni/libavcodec/aac_parser.c
C
asf20
3,617
/* * H263/MPEG4 backend for ffmpeg encoder and decoder * Copyright (c) 2000,2001 Fabrice Bellard * H263+ support. * Copyright (c) 2001 Juan J. Sierralta P * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * h263/mpeg4 codec. */ //#define DEBUG #include <limits.h> #include "dsputil.h" #include "avcodec.h" #include "mpegvideo.h" #include "h263.h" #include "h263data.h" #include "mathops.h" #include "unary.h" #include "flv.h" #include "mpeg4video.h" //#undef NDEBUG //#include <assert.h> uint8_t ff_h263_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3]; void ff_h263_update_motion_val(MpegEncContext * s){ const int mb_xy = s->mb_y * s->mb_stride + s->mb_x; //FIXME a lot of that is only needed for !low_delay const int wrap = s->b8_stride; const int xy = s->block_index[0]; s->current_picture.mbskip_table[mb_xy]= s->mb_skipped; if(s->mv_type != MV_TYPE_8X8){ int motion_x, motion_y; if (s->mb_intra) { motion_x = 0; motion_y = 0; } else if (s->mv_type == MV_TYPE_16X16) { motion_x = s->mv[0][0][0]; motion_y = s->mv[0][0][1]; } else /*if (s->mv_type == MV_TYPE_FIELD)*/ { int i; motion_x = s->mv[0][0][0] + s->mv[0][1][0]; motion_y = s->mv[0][0][1] + s->mv[0][1][1]; motion_x = (motion_x>>1) | (motion_x&1); for(i=0; i<2; i++){ s->p_field_mv_table[i][0][mb_xy][0]= s->mv[0][i][0]; s->p_field_mv_table[i][0][mb_xy][1]= s->mv[0][i][1]; } s->current_picture.ref_index[0][4*mb_xy ]= s->current_picture.ref_index[0][4*mb_xy + 1]= s->field_select[0][0]; s->current_picture.ref_index[0][4*mb_xy + 2]= s->current_picture.ref_index[0][4*mb_xy + 3]= s->field_select[0][1]; } /* no update if 8X8 because it has been done during parsing */ s->current_picture.motion_val[0][xy][0] = motion_x; s->current_picture.motion_val[0][xy][1] = motion_y; s->current_picture.motion_val[0][xy + 1][0] = motion_x; s->current_picture.motion_val[0][xy + 1][1] = motion_y; s->current_picture.motion_val[0][xy + wrap][0] = motion_x; s->current_picture.motion_val[0][xy + wrap][1] = motion_y; s->current_picture.motion_val[0][xy + 1 + wrap][0] = motion_x; s->current_picture.motion_val[0][xy + 1 + wrap][1] = motion_y; } if(s->encoding){ //FIXME encoding MUST be cleaned up if (s->mv_type == MV_TYPE_8X8) s->current_picture.mb_type[mb_xy]= MB_TYPE_L0 | MB_TYPE_8x8; else if(s->mb_intra) s->current_picture.mb_type[mb_xy]= MB_TYPE_INTRA; else s->current_picture.mb_type[mb_xy]= MB_TYPE_L0 | MB_TYPE_16x16; } } int h263_pred_dc(MpegEncContext * s, int n, int16_t **dc_val_ptr) { int x, y, wrap, a, c, pred_dc; int16_t *dc_val; /* find prediction */ if (n < 4) { x = 2 * s->mb_x + (n & 1); y = 2 * s->mb_y + ((n & 2) >> 1); wrap = s->b8_stride; dc_val = s->dc_val[0]; } else { x = s->mb_x; y = s->mb_y; wrap = s->mb_stride; dc_val = s->dc_val[n - 4 + 1]; } /* B C * A X */ a = dc_val[(x - 1) + (y) * wrap]; c = dc_val[(x) + (y - 1) * wrap]; /* No prediction outside GOB boundary */ if(s->first_slice_line && n!=3){ if(n!=2) c= 1024; if(n!=1 && s->mb_x == s->resync_mb_x) a= 1024; } /* just DC prediction */ if (a != 1024 && c != 1024) pred_dc = (a + c) >> 1; else if (a != 1024) pred_dc = a; else pred_dc = c; /* we assume pred is positive */ *dc_val_ptr = &dc_val[x + y * wrap]; return pred_dc; } void ff_h263_loop_filter(MpegEncContext * s){ int qp_c; const int linesize = s->linesize; const int uvlinesize= s->uvlinesize; const int xy = s->mb_y * s->mb_stride + s->mb_x; uint8_t *dest_y = s->dest[0]; uint8_t *dest_cb= s->dest[1]; uint8_t *dest_cr= s->dest[2]; // if(s->pict_type==FF_B_TYPE && !s->readable) return; /* Diag Top Left Center */ if(!IS_SKIP(s->current_picture.mb_type[xy])){ qp_c= s->qscale; s->dsp.h263_v_loop_filter(dest_y+8*linesize , linesize, qp_c); s->dsp.h263_v_loop_filter(dest_y+8*linesize+8, linesize, qp_c); }else qp_c= 0; if(s->mb_y){ int qp_dt, qp_tt, qp_tc; if(IS_SKIP(s->current_picture.mb_type[xy-s->mb_stride])) qp_tt=0; else qp_tt= s->current_picture.qscale_table[xy-s->mb_stride]; if(qp_c) qp_tc= qp_c; else qp_tc= qp_tt; if(qp_tc){ const int chroma_qp= s->chroma_qscale_table[qp_tc]; s->dsp.h263_v_loop_filter(dest_y , linesize, qp_tc); s->dsp.h263_v_loop_filter(dest_y+8, linesize, qp_tc); s->dsp.h263_v_loop_filter(dest_cb , uvlinesize, chroma_qp); s->dsp.h263_v_loop_filter(dest_cr , uvlinesize, chroma_qp); } if(qp_tt) s->dsp.h263_h_loop_filter(dest_y-8*linesize+8 , linesize, qp_tt); if(s->mb_x){ if(qp_tt || IS_SKIP(s->current_picture.mb_type[xy-1-s->mb_stride])) qp_dt= qp_tt; else qp_dt= s->current_picture.qscale_table[xy-1-s->mb_stride]; if(qp_dt){ const int chroma_qp= s->chroma_qscale_table[qp_dt]; s->dsp.h263_h_loop_filter(dest_y -8*linesize , linesize, qp_dt); s->dsp.h263_h_loop_filter(dest_cb-8*uvlinesize, uvlinesize, chroma_qp); s->dsp.h263_h_loop_filter(dest_cr-8*uvlinesize, uvlinesize, chroma_qp); } } } if(qp_c){ s->dsp.h263_h_loop_filter(dest_y +8, linesize, qp_c); if(s->mb_y + 1 == s->mb_height) s->dsp.h263_h_loop_filter(dest_y+8*linesize+8, linesize, qp_c); } if(s->mb_x){ int qp_lc; if(qp_c || IS_SKIP(s->current_picture.mb_type[xy-1])) qp_lc= qp_c; else qp_lc= s->current_picture.qscale_table[xy-1]; if(qp_lc){ s->dsp.h263_h_loop_filter(dest_y, linesize, qp_lc); if(s->mb_y + 1 == s->mb_height){ const int chroma_qp= s->chroma_qscale_table[qp_lc]; s->dsp.h263_h_loop_filter(dest_y +8* linesize, linesize, qp_lc); s->dsp.h263_h_loop_filter(dest_cb , uvlinesize, chroma_qp); s->dsp.h263_h_loop_filter(dest_cr , uvlinesize, chroma_qp); } } } } void h263_pred_acdc(MpegEncContext * s, DCTELEM *block, int n) { int x, y, wrap, a, c, pred_dc, scale, i; int16_t *dc_val, *ac_val, *ac_val1; /* find prediction */ if (n < 4) { x = 2 * s->mb_x + (n & 1); y = 2 * s->mb_y + (n>> 1); wrap = s->b8_stride; dc_val = s->dc_val[0]; ac_val = s->ac_val[0][0]; scale = s->y_dc_scale; } else { x = s->mb_x; y = s->mb_y; wrap = s->mb_stride; dc_val = s->dc_val[n - 4 + 1]; ac_val = s->ac_val[n - 4 + 1][0]; scale = s->c_dc_scale; } ac_val += ((y) * wrap + (x)) * 16; ac_val1 = ac_val; /* B C * A X */ a = dc_val[(x - 1) + (y) * wrap]; c = dc_val[(x) + (y - 1) * wrap]; /* No prediction outside GOB boundary */ if(s->first_slice_line && n!=3){ if(n!=2) c= 1024; if(n!=1 && s->mb_x == s->resync_mb_x) a= 1024; } if (s->ac_pred) { pred_dc = 1024; if (s->h263_aic_dir) { /* left prediction */ if (a != 1024) { ac_val -= 16; for(i=1;i<8;i++) { block[s->dsp.idct_permutation[i<<3]] += ac_val[i]; } pred_dc = a; } } else { /* top prediction */ if (c != 1024) { ac_val -= 16 * wrap; for(i=1;i<8;i++) { block[s->dsp.idct_permutation[i ]] += ac_val[i + 8]; } pred_dc = c; } } } else { /* just DC prediction */ if (a != 1024 && c != 1024) pred_dc = (a + c) >> 1; else if (a != 1024) pred_dc = a; else pred_dc = c; } /* we assume pred is positive */ block[0]=block[0]*scale + pred_dc; if (block[0] < 0) block[0] = 0; else block[0] |= 1; /* Update AC/DC tables */ dc_val[(x) + (y) * wrap] = block[0]; /* left copy */ for(i=1;i<8;i++) ac_val1[i ] = block[s->dsp.idct_permutation[i<<3]]; /* top copy */ for(i=1;i<8;i++) ac_val1[8 + i] = block[s->dsp.idct_permutation[i ]]; } int16_t *h263_pred_motion(MpegEncContext * s, int block, int dir, int *px, int *py) { int wrap; int16_t *A, *B, *C, (*mot_val)[2]; static const int off[4]= {2, 1, 1, -1}; wrap = s->b8_stride; mot_val = s->current_picture.motion_val[dir] + s->block_index[block]; A = mot_val[ - 1]; /* special case for first (slice) line */ if (s->first_slice_line && block<3) { // we can't just change some MVs to simulate that as we need them for the B frames (and ME) // and if we ever support non rectangular objects than we need to do a few ifs here anyway :( if(block==0){ //most common case if(s->mb_x == s->resync_mb_x){ //rare *px= *py = 0; }else if(s->mb_x + 1 == s->resync_mb_x && s->h263_pred){ //rare C = mot_val[off[block] - wrap]; if(s->mb_x==0){ *px = C[0]; *py = C[1]; }else{ *px = mid_pred(A[0], 0, C[0]); *py = mid_pred(A[1], 0, C[1]); } }else{ *px = A[0]; *py = A[1]; } }else if(block==1){ if(s->mb_x + 1 == s->resync_mb_x && s->h263_pred){ //rare C = mot_val[off[block] - wrap]; *px = mid_pred(A[0], 0, C[0]); *py = mid_pred(A[1], 0, C[1]); }else{ *px = A[0]; *py = A[1]; } }else{ /* block==2*/ B = mot_val[ - wrap]; C = mot_val[off[block] - wrap]; if(s->mb_x == s->resync_mb_x) //rare A[0]=A[1]=0; *px = mid_pred(A[0], B[0], C[0]); *py = mid_pred(A[1], B[1], C[1]); } } else { B = mot_val[ - wrap]; C = mot_val[off[block] - wrap]; *px = mid_pred(A[0], B[0], C[0]); *py = mid_pred(A[1], B[1], C[1]); } return *mot_val; } /** * Get the GOB height based on picture height. */ int ff_h263_get_gob_height(MpegEncContext *s){ if (s->height <= 400) return 1; else if (s->height <= 800) return 2; else return 4; }
123linslouis-android-video-cutter
jni/libavcodec/h263.c
C
asf20
11,973
/* * LZW decoder * Copyright (c) 2003 Fabrice Bellard * Copyright (c) 2006 Konstantin Shishkov * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * @brief LZW decoding routines * @author Fabrice Bellard * Modified for use in TIFF by Konstantin Shishkov */ #include "avcodec.h" #include "lzw.h" #define LZW_MAXBITS 12 #define LZW_SIZTABLE (1<<LZW_MAXBITS) static const uint16_t mask[17] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F, 0x001F, 0x003F, 0x007F, 0x00FF, 0x01FF, 0x03FF, 0x07FF, 0x0FFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF }; struct LZWState { const uint8_t *pbuf, *ebuf; int bbits; unsigned int bbuf; int mode; ///< Decoder mode int cursize; ///< The current code size int curmask; int codesize; int clear_code; int end_code; int newcodes; ///< First available code int top_slot; ///< Highest code for current size int extra_slot; int slot; ///< Last read code int fc, oc; uint8_t *sp; uint8_t stack[LZW_SIZTABLE]; uint8_t suffix[LZW_SIZTABLE]; uint16_t prefix[LZW_SIZTABLE]; int bs; ///< current buffer size for GIF }; /* get one code from stream */ static int lzw_get_code(struct LZWState * s) { int c; if(s->mode == FF_LZW_GIF) { while (s->bbits < s->cursize) { if (!s->bs) { s->bs = *s->pbuf++; } s->bbuf |= (*s->pbuf++) << s->bbits; s->bbits += 8; s->bs--; } c = s->bbuf; s->bbuf >>= s->cursize; } else { // TIFF while (s->bbits < s->cursize) { s->bbuf = (s->bbuf << 8) | (*s->pbuf++); s->bbits += 8; } c = s->bbuf >> (s->bbits - s->cursize); } s->bbits -= s->cursize; return c & s->curmask; } const uint8_t* ff_lzw_cur_ptr(LZWState *p) { return ((struct LZWState*)p)->pbuf; } void ff_lzw_decode_tail(LZWState *p) { struct LZWState *s = (struct LZWState *)p; if(s->mode == FF_LZW_GIF) { while(s->pbuf < s->ebuf && s->bs>0){ s->pbuf += s->bs; s->bs = *s->pbuf++; } }else s->pbuf= s->ebuf; } av_cold void ff_lzw_decode_open(LZWState **p) { *p = av_mallocz(sizeof(struct LZWState)); } av_cold void ff_lzw_decode_close(LZWState **p) { av_freep(p); } /** * Initialize LZW decoder * @param s LZW context * @param csize initial code size in bits * @param buf input data * @param buf_size input data size * @param mode decoder working mode - either GIF or TIFF */ int ff_lzw_decode_init(LZWState *p, int csize, const uint8_t *buf, int buf_size, int mode) { struct LZWState *s = (struct LZWState *)p; if(csize < 1 || csize >= LZW_MAXBITS) return -1; /* read buffer */ s->pbuf = buf; s->ebuf = s->pbuf + buf_size; s->bbuf = 0; s->bbits = 0; s->bs = 0; /* decoder */ s->codesize = csize; s->cursize = s->codesize + 1; s->curmask = mask[s->cursize]; s->top_slot = 1 << s->cursize; s->clear_code = 1 << s->codesize; s->end_code = s->clear_code + 1; s->slot = s->newcodes = s->clear_code + 2; s->oc = s->fc = -1; s->sp = s->stack; s->mode = mode; s->extra_slot = s->mode == FF_LZW_TIFF; return 0; } /** * Decode given number of bytes * NOTE: the algorithm here is inspired from the LZW GIF decoder * written by Steven A. Bennett in 1987. * * @param s LZW context * @param buf output buffer * @param len number of bytes to decode * @return number of bytes decoded */ int ff_lzw_decode(LZWState *p, uint8_t *buf, int len){ int l, c, code, oc, fc; uint8_t *sp; struct LZWState *s = (struct LZWState *)p; if (s->end_code < 0) return 0; l = len; sp = s->sp; oc = s->oc; fc = s->fc; for (;;) { while (sp > s->stack) { *buf++ = *(--sp); if ((--l) == 0) goto the_end; } c = lzw_get_code(s); if (c == s->end_code) { break; } else if (c == s->clear_code) { s->cursize = s->codesize + 1; s->curmask = mask[s->cursize]; s->slot = s->newcodes; s->top_slot = 1 << s->cursize; fc= oc= -1; } else { code = c; if (code == s->slot && fc>=0) { *sp++ = fc; code = oc; }else if(code >= s->slot) break; while (code >= s->newcodes) { *sp++ = s->suffix[code]; code = s->prefix[code]; } *sp++ = code; if (s->slot < s->top_slot && oc>=0) { s->suffix[s->slot] = code; s->prefix[s->slot++] = oc; } fc = code; oc = c; if (s->slot >= s->top_slot - s->extra_slot) { if (s->cursize < LZW_MAXBITS) { s->top_slot <<= 1; s->curmask = mask[++s->cursize]; } } } } s->end_code = -1; the_end: s->sp = sp; s->oc = oc; s->fc = fc; return len - l; }
123linslouis-android-video-cutter
jni/libavcodec/lzw.c
C
asf20
6,004
/* * Copyright (c) 2000-2002 Fabrice Bellard * Copyright (c) 2002-2004 Michael Niedermayer * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * rl header. */ #ifndef AVCODEC_RL_H #define AVCODEC_RL_H #include <stdint.h> #include "get_bits.h" /* run length table */ #define MAX_RUN 64 #define MAX_LEVEL 64 /** RLTable. */ typedef struct RLTable { int n; ///< number of entries of table_vlc minus 1 int last; ///< number of values for last = 0 const uint16_t (*table_vlc)[2]; const int8_t *table_run; const int8_t *table_level; uint8_t *index_run[2]; ///< encoding only int8_t *max_level[2]; ///< encoding & decoding int8_t *max_run[2]; ///< encoding & decoding VLC vlc; ///< decoding only deprecated FIXME remove RL_VLC_ELEM *rl_vlc[32]; ///< decoding only } RLTable; /** * * @param static_store static uint8_t array[2][2*MAX_RUN + MAX_LEVEL + 3] which will hold * the level and run tables, if this is NULL av_malloc() will be used */ void init_rl(RLTable *rl, uint8_t static_store[2][2*MAX_RUN + MAX_LEVEL + 3]); void init_vlc_rl(RLTable *rl); #define INIT_VLC_RL(rl, static_size)\ {\ int q;\ static RL_VLC_ELEM rl_vlc_table[32][static_size];\ INIT_VLC_STATIC(&rl.vlc, 9, rl.n + 1,\ &rl.table_vlc[0][1], 4, 2,\ &rl.table_vlc[0][0], 4, 2, static_size);\ \ if(!rl.rl_vlc[0]){\ for(q=0; q<32; q++)\ rl.rl_vlc[q]= rl_vlc_table[q];\ \ init_vlc_rl(&rl);\ }\ } static inline int get_rl_index(const RLTable *rl, int last, int run, int level) { int index; index = rl->index_run[last][run]; if (index >= rl->n) return rl->n; if (level > rl->max_level[last][run]) return rl->n; return index + level - 1; } #endif /* AVCODEC_RL_H */
123linslouis-android-video-cutter
jni/libavcodec/rl.h
C
asf20
2,638
/* * Copyright (C) 2003 David S. Miller <davem@redhat.com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /* You may be asking why I hard-code the instruction opcodes and don't * use the normal VIS assembler mnenomics for the VIS instructions. * * The reason is that Sun, in their infinite wisdom, decided that a binary * using a VIS instruction will cause it to be marked (in the ELF headers) * as doing so, and this prevents the OS from loading such binaries if the * current cpu doesn't have VIS. There is no way to easily override this * behavior of the assembler that I am aware of. * * This totally defeats what libmpeg2 is trying to do which is allow a * single binary to be created, and then detect the availability of VIS * at runtime. * * I'm not saying that tainting the binary by default is bad, rather I'm * saying that not providing a way to override this easily unnecessarily * ties people's hands. * * Thus, we do the opcode encoding by hand and output 32-bit words in * the assembler to keep the binary from becoming tainted. */ #ifndef AVCODEC_SPARC_VIS_H #define AVCODEC_SPARC_VIS_H #define vis_opc_base ((0x1 << 31) | (0x36 << 19)) #define vis_opf(X) ((X) << 5) #define vis_sreg(X) (X) #define vis_dreg(X) (((X)&0x1f)|((X)>>5)) #define vis_rs1_s(X) (vis_sreg(X) << 14) #define vis_rs1_d(X) (vis_dreg(X) << 14) #define vis_rs2_s(X) (vis_sreg(X) << 0) #define vis_rs2_d(X) (vis_dreg(X) << 0) #define vis_rd_s(X) (vis_sreg(X) << 25) #define vis_rd_d(X) (vis_dreg(X) << 25) #define vis_ss2s(opf,rs1,rs2,rd) \ __asm__ volatile (".word %0" \ : : "i" (vis_opc_base | vis_opf(opf) | \ vis_rs1_s(rs1) | \ vis_rs2_s(rs2) | \ vis_rd_s(rd))) #define vis_dd2d(opf,rs1,rs2,rd) \ __asm__ volatile (".word %0" \ : : "i" (vis_opc_base | vis_opf(opf) | \ vis_rs1_d(rs1) | \ vis_rs2_d(rs2) | \ vis_rd_d(rd))) #define vis_ss2d(opf,rs1,rs2,rd) \ __asm__ volatile (".word %0" \ : : "i" (vis_opc_base | vis_opf(opf) | \ vis_rs1_s(rs1) | \ vis_rs2_s(rs2) | \ vis_rd_d(rd))) #define vis_sd2d(opf,rs1,rs2,rd) \ __asm__ volatile (".word %0" \ : : "i" (vis_opc_base | vis_opf(opf) | \ vis_rs1_s(rs1) | \ vis_rs2_d(rs2) | \ vis_rd_d(rd))) #define vis_d2s(opf,rs2,rd) \ __asm__ volatile (".word %0" \ : : "i" (vis_opc_base | vis_opf(opf) | \ vis_rs2_d(rs2) | \ vis_rd_s(rd))) #define vis_s2d(opf,rs2,rd) \ __asm__ volatile (".word %0" \ : : "i" (vis_opc_base | vis_opf(opf) | \ vis_rs2_s(rs2) | \ vis_rd_d(rd))) #define vis_d12d(opf,rs1,rd) \ __asm__ volatile (".word %0" \ : : "i" (vis_opc_base | vis_opf(opf) | \ vis_rs1_d(rs1) | \ vis_rd_d(rd))) #define vis_d22d(opf,rs2,rd) \ __asm__ volatile (".word %0" \ : : "i" (vis_opc_base | vis_opf(opf) | \ vis_rs2_d(rs2) | \ vis_rd_d(rd))) #define vis_s12s(opf,rs1,rd) \ __asm__ volatile (".word %0" \ : : "i" (vis_opc_base | vis_opf(opf) | \ vis_rs1_s(rs1) | \ vis_rd_s(rd))) #define vis_s22s(opf,rs2,rd) \ __asm__ volatile (".word %0" \ : : "i" (vis_opc_base | vis_opf(opf) | \ vis_rs2_s(rs2) | \ vis_rd_s(rd))) #define vis_s(opf,rd) \ __asm__ volatile (".word %0" \ : : "i" (vis_opc_base | vis_opf(opf) | \ vis_rd_s(rd))) #define vis_d(opf,rd) \ __asm__ volatile (".word %0" \ : : "i" (vis_opc_base | vis_opf(opf) | \ vis_rd_d(rd))) #define vis_r2m(op,rd,mem) \ __asm__ volatile (#op "\t%%f" #rd ", [%0]" : : "r" (&(mem)) ) #define vis_r2m_2(op,rd,mem1,mem2) \ __asm__ volatile (#op "\t%%f" #rd ", [%0 + %1]" : : "r" (mem1), "r" (mem2) ) #define vis_m2r(op,mem,rd) \ __asm__ volatile (#op "\t[%0], %%f" #rd : : "r" (&(mem)) ) #define vis_m2r_2(op,mem1,mem2,rd) \ __asm__ volatile (#op "\t[%0 + %1], %%f" #rd : : "r" (mem1), "r" (mem2) ) static inline void vis_set_gsr(unsigned int _val) { register unsigned int val __asm__("g1"); val = _val; __asm__ volatile(".word 0xa7804000" : : "r" (val)); } #define VIS_GSR_ALIGNADDR_MASK 0x0000007 #define VIS_GSR_ALIGNADDR_SHIFT 0 #define VIS_GSR_SCALEFACT_MASK 0x0000078 #define VIS_GSR_SCALEFACT_SHIFT 3 #define vis_ld32(mem,rs1) vis_m2r(ld, mem, rs1) #define vis_ld32_2(mem1,mem2,rs1) vis_m2r_2(ld, mem1, mem2, rs1) #define vis_st32(rs1,mem) vis_r2m(st, rs1, mem) #define vis_st32_2(rs1,mem1,mem2) vis_r2m_2(st, rs1, mem1, mem2) #define vis_ld64(mem,rs1) vis_m2r(ldd, mem, rs1) #define vis_ld64_2(mem1,mem2,rs1) vis_m2r_2(ldd, mem1, mem2, rs1) #define vis_st64(rs1,mem) vis_r2m(std, rs1, mem) #define vis_st64_2(rs1,mem1,mem2) vis_r2m_2(std, rs1, mem1, mem2) #define vis_ldblk(mem, rd) \ do { register void *__mem __asm__("g1"); \ __mem = &(mem); \ __asm__ volatile(".word 0xc1985e00 | %1" \ : \ : "r" (__mem), \ "i" (vis_rd_d(rd)) \ : "memory"); \ } while (0) #define vis_stblk(rd, mem) \ do { register void *__mem __asm__("g1"); \ __mem = &(mem); \ __asm__ volatile(".word 0xc1b85e00 | %1" \ : \ : "r" (__mem), \ "i" (vis_rd_d(rd)) \ : "memory"); \ } while (0) #define vis_membar_storestore() \ __asm__ volatile(".word 0x8143e008" : : : "memory") #define vis_membar_sync() \ __asm__ volatile(".word 0x8143e040" : : : "memory") /* 16 and 32 bit partitioned addition and subtraction. The normal * versions perform 4 16-bit or 2 32-bit additions or subtractions. * The 's' versions perform 2 16-bit or 1 32-bit additions or * subtractions. */ #define vis_padd16(rs1,rs2,rd) vis_dd2d(0x50, rs1, rs2, rd) #define vis_padd16s(rs1,rs2,rd) vis_ss2s(0x51, rs1, rs2, rd) #define vis_padd32(rs1,rs2,rd) vis_dd2d(0x52, rs1, rs2, rd) #define vis_padd32s(rs1,rs2,rd) vis_ss2s(0x53, rs1, rs2, rd) #define vis_psub16(rs1,rs2,rd) vis_dd2d(0x54, rs1, rs2, rd) #define vis_psub16s(rs1,rs2,rd) vis_ss2s(0x55, rs1, rs2, rd) #define vis_psub32(rs1,rs2,rd) vis_dd2d(0x56, rs1, rs2, rd) #define vis_psub32s(rs1,rs2,rd) vis_ss2s(0x57, rs1, rs2, rd) /* Pixel formatting instructions. */ #define vis_pack16(rs2,rd) vis_d2s( 0x3b, rs2, rd) #define vis_pack32(rs1,rs2,rd) vis_dd2d(0x3a, rs1, rs2, rd) #define vis_packfix(rs2,rd) vis_d2s( 0x3d, rs2, rd) #define vis_expand(rs2,rd) vis_s2d( 0x4d, rs2, rd) #define vis_pmerge(rs1,rs2,rd) vis_ss2d(0x4b, rs1, rs2, rd) /* Partitioned multiply instructions. */ #define vis_mul8x16(rs1,rs2,rd) vis_sd2d(0x31, rs1, rs2, rd) #define vis_mul8x16au(rs1,rs2,rd) vis_ss2d(0x33, rs1, rs2, rd) #define vis_mul8x16al(rs1,rs2,rd) vis_ss2d(0x35, rs1, rs2, rd) #define vis_mul8sux16(rs1,rs2,rd) vis_dd2d(0x36, rs1, rs2, rd) #define vis_mul8ulx16(rs1,rs2,rd) vis_dd2d(0x37, rs1, rs2, rd) #define vis_muld8sux16(rs1,rs2,rd) vis_ss2d(0x38, rs1, rs2, rd) #define vis_muld8ulx16(rs1,rs2,rd) vis_ss2d(0x39, rs1, rs2, rd) /* Alignment instructions. */ static inline const void *vis_alignaddr(const void *_ptr) { register const void *ptr __asm__("g1"); ptr = _ptr; __asm__ volatile(".word %2" : "=&r" (ptr) : "0" (ptr), "i" (vis_opc_base | vis_opf(0x18) | vis_rs1_s(1) | vis_rs2_s(0) | vis_rd_s(1))); return ptr; } static inline void vis_alignaddr_g0(void *_ptr) { register void *ptr __asm__("g1"); ptr = _ptr; __asm__ volatile(".word %2" : "=&r" (ptr) : "0" (ptr), "i" (vis_opc_base | vis_opf(0x18) | vis_rs1_s(1) | vis_rs2_s(0) | vis_rd_s(0))); } static inline void *vis_alignaddrl(void *_ptr) { register void *ptr __asm__("g1"); ptr = _ptr; __asm__ volatile(".word %2" : "=&r" (ptr) : "0" (ptr), "i" (vis_opc_base | vis_opf(0x19) | vis_rs1_s(1) | vis_rs2_s(0) | vis_rd_s(1))); return ptr; } static inline void vis_alignaddrl_g0(void *_ptr) { register void *ptr __asm__("g1"); ptr = _ptr; __asm__ volatile(".word %2" : "=&r" (ptr) : "0" (ptr), "i" (vis_opc_base | vis_opf(0x19) | vis_rs1_s(1) | vis_rs2_s(0) | vis_rd_s(0))); } #define vis_faligndata(rs1,rs2,rd) vis_dd2d(0x48, rs1, rs2, rd) /* Logical operate instructions. */ #define vis_fzero(rd) vis_d( 0x60, rd) #define vis_fzeros(rd) vis_s( 0x61, rd) #define vis_fone(rd) vis_d( 0x7e, rd) #define vis_fones(rd) vis_s( 0x7f, rd) #define vis_src1(rs1,rd) vis_d12d(0x74, rs1, rd) #define vis_src1s(rs1,rd) vis_s12s(0x75, rs1, rd) #define vis_src2(rs2,rd) vis_d22d(0x78, rs2, rd) #define vis_src2s(rs2,rd) vis_s22s(0x79, rs2, rd) #define vis_not1(rs1,rd) vis_d12d(0x6a, rs1, rd) #define vis_not1s(rs1,rd) vis_s12s(0x6b, rs1, rd) #define vis_not2(rs2,rd) vis_d22d(0x66, rs2, rd) #define vis_not2s(rs2,rd) vis_s22s(0x67, rs2, rd) #define vis_or(rs1,rs2,rd) vis_dd2d(0x7c, rs1, rs2, rd) #define vis_ors(rs1,rs2,rd) vis_ss2s(0x7d, rs1, rs2, rd) #define vis_nor(rs1,rs2,rd) vis_dd2d(0x62, rs1, rs2, rd) #define vis_nors(rs1,rs2,rd) vis_ss2s(0x63, rs1, rs2, rd) #define vis_and(rs1,rs2,rd) vis_dd2d(0x70, rs1, rs2, rd) #define vis_ands(rs1,rs2,rd) vis_ss2s(0x71, rs1, rs2, rd) #define vis_nand(rs1,rs2,rd) vis_dd2d(0x6e, rs1, rs2, rd) #define vis_nands(rs1,rs2,rd) vis_ss2s(0x6f, rs1, rs2, rd) #define vis_xor(rs1,rs2,rd) vis_dd2d(0x6c, rs1, rs2, rd) #define vis_xors(rs1,rs2,rd) vis_ss2s(0x6d, rs1, rs2, rd) #define vis_xnor(rs1,rs2,rd) vis_dd2d(0x72, rs1, rs2, rd) #define vis_xnors(rs1,rs2,rd) vis_ss2s(0x73, rs1, rs2, rd) #define vis_ornot1(rs1,rs2,rd) vis_dd2d(0x7a, rs1, rs2, rd) #define vis_ornot1s(rs1,rs2,rd) vis_ss2s(0x7b, rs1, rs2, rd) #define vis_ornot2(rs1,rs2,rd) vis_dd2d(0x76, rs1, rs2, rd) #define vis_ornot2s(rs1,rs2,rd) vis_ss2s(0x77, rs1, rs2, rd) #define vis_andnot1(rs1,rs2,rd) vis_dd2d(0x68, rs1, rs2, rd) #define vis_andnot1s(rs1,rs2,rd) vis_ss2s(0x69, rs1, rs2, rd) #define vis_andnot2(rs1,rs2,rd) vis_dd2d(0x64, rs1, rs2, rd) #define vis_andnot2s(rs1,rs2,rd) vis_ss2s(0x65, rs1, rs2, rd) /* Pixel component distance. */ #define vis_pdist(rs1,rs2,rd) vis_dd2d(0x3e, rs1, rs2, rd) #endif /* AVCODEC_SPARC_VIS_H */
123linslouis-android-video-cutter
jni/libavcodec/sparc/vis.h
C
asf20
13,755
OBJS-$(HAVE_VIS) += sparc/dsputil_vis.o \ sparc/simple_idct_vis.o \
123linslouis-android-video-cutter
jni/libavcodec/sparc/Makefile
Makefile
asf20
148
/* * SPARC VIS optimized inverse DCT * Copyright (c) 2007 Denes Balatoni < dbalatoni XatX interware XdotX hu > * * I did consult the following fine web page about dct * http://www.geocities.com/ssavekar/dct.htm * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "libavcodec/dsputil.h" #include "dsputil_vis.h" static const DECLARE_ALIGNED(8, int16_t, coeffs)[28] = { - 1259,- 1259,- 1259,- 1259, - 4989,- 4989,- 4989,- 4989, -11045,-11045,-11045,-11045, -19195,-19195,-19195,-19195, -29126,-29126,-29126,-29126, 25080, 25080, 25080, 25080, 12785, 12785, 12785, 12785 }; static const DECLARE_ALIGNED(8, uint16_t, scale)[4] = { 65536>>6, 65536>>6, 65536>>6, 65536>>6 }; static const DECLARE_ALIGNED(8, uint16_t, rounder)[4] = { 1<<5, 1<<5, 1<<5, 1<<5 }; static const DECLARE_ALIGNED(8, uint16_t, expand)[4] = { 1<<14, 1<<14, 1<<14, 1<<14 }; #define INIT_IDCT \ "ldd [%1], %%f32 \n\t"\ "ldd [%1+8], %%f34 \n\t"\ "ldd [%1+16], %%f36 \n\t"\ "ldd [%1+24], %%f38 \n\t"\ "ldd [%1+32], %%f40 \n\t"\ "ldd [%1+40], %%f42 \n\t"\ "ldd [%1+48], %%f44 \n\t"\ "ldd [%0], %%f46 \n\t"\ "fzero %%f62 \n\t"\ #define LOADSCALE(in) \ "ldd [" in "], %%f0 \n\t"\ "ldd [" in "+16], %%f2 \n\t"\ "ldd [" in "+32], %%f4 \n\t"\ "ldd [" in "+48], %%f6 \n\t"\ "ldd [" in "+64], %%f8 \n\t"\ "ldd [" in "+80], %%f10 \n\t"\ "ldd [" in "+96], %%f12 \n\t"\ "ldd [" in "+112], %%f14 \n\t"\ "fpadd16 %%f0, %%f0, %%f0 \n\t"\ "fpadd16 %%f2, %%f2, %%f2 \n\t"\ "fpadd16 %%f4, %%f4, %%f4 \n\t"\ "fpadd16 %%f6, %%f6, %%f6 \n\t"\ "fpadd16 %%f8, %%f8, %%f8 \n\t"\ "fpadd16 %%f10, %%f10, %%f10 \n\t"\ "fpadd16 %%f12, %%f12, %%f12 \n\t"\ "fpadd16 %%f14, %%f14, %%f14 \n\t"\ \ "fpadd16 %%f0, %%f0, %%f0 \n\t"\ "fpadd16 %%f2, %%f2, %%f2 \n\t"\ "fpadd16 %%f4, %%f4, %%f4 \n\t"\ "fpadd16 %%f6, %%f6, %%f6 \n\t"\ "fpadd16 %%f8, %%f8, %%f8 \n\t"\ "fpadd16 %%f10, %%f10, %%f10 \n\t"\ "fpadd16 %%f12, %%f12, %%f12 \n\t"\ "fpadd16 %%f14, %%f14, %%f14 \n\t"\ \ "fpadd16 %%f0, %%f0, %%f0 \n\t"\ "fpadd16 %%f2, %%f2, %%f2 \n\t"\ "fpadd16 %%f4, %%f4, %%f4 \n\t"\ "fpadd16 %%f6, %%f6, %%f6 \n\t"\ "fpadd16 %%f8, %%f8, %%f8 \n\t"\ "fpadd16 %%f10, %%f10, %%f10 \n\t"\ "fpadd16 %%f12, %%f12, %%f12 \n\t"\ "fpadd16 %%f14, %%f14, %%f14 \n\t"\ \ "fpadd16 %%f0, %%f0, %%f0 \n\t"\ "fpadd16 %%f2, %%f2, %%f2 \n\t"\ "fpadd16 %%f4, %%f4, %%f4 \n\t"\ "fpadd16 %%f6, %%f6, %%f6 \n\t"\ "fpadd16 %%f8, %%f8, %%f8 \n\t"\ "fpadd16 %%f10, %%f10, %%f10 \n\t"\ "fpadd16 %%f12, %%f12, %%f12 \n\t"\ "fpadd16 %%f14, %%f14, %%f14 \n\t"\ #define LOAD(in) \ "ldd [" in "], %%f16 \n\t"\ "ldd [" in "+8], %%f18 \n\t"\ "ldd [" in "+16], %%f20 \n\t"\ "ldd [" in "+24], %%f22 \n\t"\ "ldd [" in "+32], %%f24 \n\t"\ "ldd [" in "+40], %%f26 \n\t"\ "ldd [" in "+48], %%f28 \n\t"\ "ldd [" in "+56], %%f30 \n\t"\ #define TRANSPOSE \ "fpmerge %%f16, %%f24, %%f0 \n\t"\ "fpmerge %%f20, %%f28, %%f2 \n\t"\ "fpmerge %%f17, %%f25, %%f4 \n\t"\ "fpmerge %%f21, %%f29, %%f6 \n\t"\ "fpmerge %%f18, %%f26, %%f8 \n\t"\ "fpmerge %%f22, %%f30, %%f10 \n\t"\ "fpmerge %%f19, %%f27, %%f12 \n\t"\ "fpmerge %%f23, %%f31, %%f14 \n\t"\ \ "fpmerge %%f0, %%f2, %%f16 \n\t"\ "fpmerge %%f1, %%f3, %%f18 \n\t"\ "fpmerge %%f4, %%f6, %%f20 \n\t"\ "fpmerge %%f5, %%f7, %%f22 \n\t"\ "fpmerge %%f8, %%f10, %%f24 \n\t"\ "fpmerge %%f9, %%f11, %%f26 \n\t"\ "fpmerge %%f12, %%f14, %%f28 \n\t"\ "fpmerge %%f13, %%f15, %%f30 \n\t"\ \ "fpmerge %%f16, %%f17, %%f0 \n\t"\ "fpmerge %%f18, %%f19, %%f2 \n\t"\ "fpmerge %%f20, %%f21, %%f4 \n\t"\ "fpmerge %%f22, %%f23, %%f6 \n\t"\ "fpmerge %%f24, %%f25, %%f8 \n\t"\ "fpmerge %%f26, %%f27, %%f10 \n\t"\ "fpmerge %%f28, %%f29, %%f12 \n\t"\ "fpmerge %%f30, %%f31, %%f14 \n\t"\ #define IDCT4ROWS \ /* 1. column */\ "fmul8ulx16 %%f0, %%f38, %%f28 \n\t"\ "for %%f4, %%f6, %%f60 \n\t"\ "fmul8ulx16 %%f2, %%f32, %%f18 \n\t"\ "fmul8ulx16 %%f2, %%f36, %%f22 \n\t"\ "fmul8ulx16 %%f2, %%f40, %%f26 \n\t"\ "fmul8ulx16 %%f2, %%f44, %%f30 \n\t"\ \ ADDROUNDER\ \ "fmul8sux16 %%f0, %%f38, %%f48 \n\t"\ "fcmpd %%fcc0, %%f62, %%f60 \n\t"\ "for %%f8, %%f10, %%f60 \n\t"\ "fmul8sux16 %%f2, %%f32, %%f50 \n\t"\ "fmul8sux16 %%f2, %%f36, %%f52 \n\t"\ "fmul8sux16 %%f2, %%f40, %%f54 \n\t"\ "fmul8sux16 %%f2, %%f44, %%f56 \n\t"\ \ "fpadd16 %%f48, %%f28, %%f28 \n\t"\ "fcmpd %%fcc1, %%f62, %%f60 \n\t"\ "for %%f12, %%f14, %%f60 \n\t"\ "fpadd16 %%f50, %%f18, %%f18 \n\t"\ "fpadd16 %%f52, %%f22, %%f22 \n\t"\ "fpadd16 %%f54, %%f26, %%f26 \n\t"\ "fpadd16 %%f56, %%f30, %%f30 \n\t"\ \ "fpadd16 %%f28, %%f0, %%f16 \n\t"\ "fcmpd %%fcc2, %%f62, %%f60 \n\t"\ "fpadd16 %%f28, %%f0, %%f20 \n\t"\ "fpadd16 %%f28, %%f0, %%f24 \n\t"\ "fpadd16 %%f28, %%f0, %%f28 \n\t"\ "fpadd16 %%f18, %%f2, %%f18 \n\t"\ "fpadd16 %%f22, %%f2, %%f22 \n\t"\ /* 2. column */\ "fbe %%fcc0, 3f \n\t"\ "fpadd16 %%f26, %%f2, %%f26 \n\t"\ "fmul8ulx16 %%f4, %%f34, %%f48 \n\t"\ "fmul8ulx16 %%f4, %%f42, %%f50 \n\t"\ "fmul8ulx16 %%f6, %%f36, %%f52 \n\t"\ "fmul8ulx16 %%f6, %%f44, %%f54 \n\t"\ "fmul8ulx16 %%f6, %%f32, %%f56 \n\t"\ "fmul8ulx16 %%f6, %%f40, %%f58 \n\t"\ \ "fpadd16 %%f16, %%f48, %%f16 \n\t"\ "fpadd16 %%f20, %%f50, %%f20 \n\t"\ "fpsub16 %%f24, %%f50, %%f24 \n\t"\ "fpsub16 %%f28, %%f48, %%f28 \n\t"\ "fpadd16 %%f18, %%f52, %%f18 \n\t"\ "fpsub16 %%f22, %%f54, %%f22 \n\t"\ "fpsub16 %%f26, %%f56, %%f26 \n\t"\ "fpsub16 %%f30, %%f58, %%f30 \n\t"\ \ "fmul8sux16 %%f4, %%f34, %%f48 \n\t"\ "fmul8sux16 %%f4, %%f42, %%f50 \n\t"\ "fmul8sux16 %%f6, %%f36, %%f52 \n\t"\ "fmul8sux16 %%f6, %%f44, %%f54 \n\t"\ "fmul8sux16 %%f6, %%f32, %%f56 \n\t"\ "fmul8sux16 %%f6, %%f40, %%f58 \n\t"\ \ "fpadd16 %%f16, %%f48, %%f16 \n\t"\ "fpadd16 %%f20, %%f50, %%f20 \n\t"\ "fpsub16 %%f24, %%f50, %%f24 \n\t"\ "fpsub16 %%f28, %%f48, %%f28 \n\t"\ "fpadd16 %%f18, %%f52, %%f18 \n\t"\ "fpsub16 %%f22, %%f54, %%f22 \n\t"\ "fpsub16 %%f26, %%f56, %%f26 \n\t"\ "fpsub16 %%f30, %%f58, %%f30 \n\t"\ \ "fpadd16 %%f16, %%f4, %%f16 \n\t"\ "fpsub16 %%f28, %%f4, %%f28 \n\t"\ "fpadd16 %%f18, %%f6, %%f18 \n\t"\ "fpsub16 %%f26, %%f6, %%f26 \n\t"\ /* 3. column */\ "3: \n\t"\ "fbe %%fcc1, 4f \n\t"\ "fpsub16 %%f30, %%f6, %%f30 \n\t"\ "fmul8ulx16 %%f8, %%f38, %%f48 \n\t"\ "fmul8ulx16 %%f10, %%f40, %%f50 \n\t"\ "fmul8ulx16 %%f10, %%f32, %%f52 \n\t"\ "fmul8ulx16 %%f10, %%f44, %%f54 \n\t"\ "fmul8ulx16 %%f10, %%f36, %%f56 \n\t"\ \ "fpadd16 %%f16, %%f48, %%f16 \n\t"\ "fpsub16 %%f20, %%f48, %%f20 \n\t"\ "fpsub16 %%f24, %%f48, %%f24 \n\t"\ "fpadd16 %%f28, %%f48, %%f28 \n\t"\ "fpadd16 %%f18, %%f50, %%f18 \n\t"\ "fpsub16 %%f22, %%f52, %%f22 \n\t"\ "fpadd16 %%f26, %%f54, %%f26 \n\t"\ "fpadd16 %%f30, %%f56, %%f30 \n\t"\ \ "fmul8sux16 %%f8, %%f38, %%f48 \n\t"\ "fmul8sux16 %%f10, %%f40, %%f50 \n\t"\ "fmul8sux16 %%f10, %%f32, %%f52 \n\t"\ "fmul8sux16 %%f10, %%f44, %%f54 \n\t"\ "fmul8sux16 %%f10, %%f36, %%f56 \n\t"\ \ "fpadd16 %%f16, %%f48, %%f16 \n\t"\ "fpsub16 %%f20, %%f48, %%f20 \n\t"\ "fpsub16 %%f24, %%f48, %%f24 \n\t"\ "fpadd16 %%f28, %%f48, %%f28 \n\t"\ "fpadd16 %%f18, %%f50, %%f18 \n\t"\ "fpsub16 %%f22, %%f52, %%f22 \n\t"\ "fpadd16 %%f26, %%f54, %%f26 \n\t"\ "fpadd16 %%f30, %%f56, %%f30 \n\t"\ \ "fpadd16 %%f16, %%f8, %%f16 \n\t"\ "fpsub16 %%f20, %%f8, %%f20 \n\t"\ "fpsub16 %%f24, %%f8, %%f24 \n\t"\ "fpadd16 %%f28, %%f8, %%f28 \n\t"\ "fpadd16 %%f18, %%f10, %%f18 \n\t"\ "fpsub16 %%f22, %%f10, %%f22 \n\t"\ /* 4. column */\ "4: \n\t"\ "fbe %%fcc2, 5f \n\t"\ "fpadd16 %%f30, %%f10, %%f30 \n\t"\ "fmul8ulx16 %%f12, %%f42, %%f48 \n\t"\ "fmul8ulx16 %%f12, %%f34, %%f50 \n\t"\ "fmul8ulx16 %%f14, %%f44, %%f52 \n\t"\ "fmul8ulx16 %%f14, %%f40, %%f54 \n\t"\ "fmul8ulx16 %%f14, %%f36, %%f56 \n\t"\ "fmul8ulx16 %%f14, %%f32, %%f58 \n\t"\ \ "fpadd16 %%f16, %%f48, %%f16 \n\t"\ "fpsub16 %%f20, %%f50, %%f20 \n\t"\ "fpadd16 %%f24, %%f50, %%f24 \n\t"\ "fpsub16 %%f28, %%f48, %%f28 \n\t"\ "fpadd16 %%f18, %%f52, %%f18 \n\t"\ "fpsub16 %%f22, %%f54, %%f22 \n\t"\ "fpadd16 %%f26, %%f56, %%f26 \n\t"\ "fpsub16 %%f30, %%f58, %%f30 \n\t"\ \ "fmul8sux16 %%f12, %%f42, %%f48 \n\t"\ "fmul8sux16 %%f12, %%f34, %%f50 \n\t"\ "fmul8sux16 %%f14, %%f44, %%f52 \n\t"\ "fmul8sux16 %%f14, %%f40, %%f54 \n\t"\ "fmul8sux16 %%f14, %%f36, %%f56 \n\t"\ "fmul8sux16 %%f14, %%f32, %%f58 \n\t"\ \ "fpadd16 %%f16, %%f48, %%f16 \n\t"\ "fpsub16 %%f20, %%f50, %%f20 \n\t"\ "fpadd16 %%f24, %%f50, %%f24 \n\t"\ "fpsub16 %%f28, %%f48, %%f28 \n\t"\ "fpadd16 %%f18, %%f52, %%f18 \n\t"\ "fpsub16 %%f22, %%f54, %%f22 \n\t"\ "fpadd16 %%f26, %%f56, %%f26 \n\t"\ "fpsub16 %%f30, %%f58, %%f30 \n\t"\ \ "fpsub16 %%f20, %%f12, %%f20 \n\t"\ "fpadd16 %%f24, %%f12, %%f24 \n\t"\ "fpsub16 %%f22, %%f14, %%f22 \n\t"\ "fpadd16 %%f26, %%f14, %%f26 \n\t"\ "fpsub16 %%f30, %%f14, %%f30 \n\t"\ /* final butterfly */\ "5: \n\t"\ "fpsub16 %%f16, %%f18, %%f48 \n\t"\ "fpsub16 %%f20, %%f22, %%f50 \n\t"\ "fpsub16 %%f24, %%f26, %%f52 \n\t"\ "fpsub16 %%f28, %%f30, %%f54 \n\t"\ "fpadd16 %%f16, %%f18, %%f16 \n\t"\ "fpadd16 %%f20, %%f22, %%f20 \n\t"\ "fpadd16 %%f24, %%f26, %%f24 \n\t"\ "fpadd16 %%f28, %%f30, %%f28 \n\t"\ #define STOREROWS(out) \ "std %%f48, [" out "+112] \n\t"\ "std %%f50, [" out "+96] \n\t"\ "std %%f52, [" out "+80] \n\t"\ "std %%f54, [" out "+64] \n\t"\ "std %%f16, [" out "] \n\t"\ "std %%f20, [" out "+16] \n\t"\ "std %%f24, [" out "+32] \n\t"\ "std %%f28, [" out "+48] \n\t"\ #define SCALEROWS \ "fmul8sux16 %%f46, %%f48, %%f48 \n\t"\ "fmul8sux16 %%f46, %%f50, %%f50 \n\t"\ "fmul8sux16 %%f46, %%f52, %%f52 \n\t"\ "fmul8sux16 %%f46, %%f54, %%f54 \n\t"\ "fmul8sux16 %%f46, %%f16, %%f16 \n\t"\ "fmul8sux16 %%f46, %%f20, %%f20 \n\t"\ "fmul8sux16 %%f46, %%f24, %%f24 \n\t"\ "fmul8sux16 %%f46, %%f28, %%f28 \n\t"\ #define PUTPIXELSCLAMPED(dest) \ "fpack16 %%f48, %%f14 \n\t"\ "fpack16 %%f50, %%f12 \n\t"\ "fpack16 %%f16, %%f0 \n\t"\ "fpack16 %%f20, %%f2 \n\t"\ "fpack16 %%f24, %%f4 \n\t"\ "fpack16 %%f28, %%f6 \n\t"\ "fpack16 %%f54, %%f8 \n\t"\ "fpack16 %%f52, %%f10 \n\t"\ "st %%f0, [%3+" dest "] \n\t"\ "st %%f2, [%5+" dest "] \n\t"\ "st %%f4, [%6+" dest "] \n\t"\ "st %%f6, [%7+" dest "] \n\t"\ "st %%f8, [%8+" dest "] \n\t"\ "st %%f10, [%9+" dest "] \n\t"\ "st %%f12, [%10+" dest "] \n\t"\ "st %%f14, [%11+" dest "] \n\t"\ #define ADDPIXELSCLAMPED(dest) \ "ldd [%5], %%f18 \n\t"\ "ld [%3+" dest"], %%f0 \n\t"\ "ld [%6+" dest"], %%f2 \n\t"\ "ld [%7+" dest"], %%f4 \n\t"\ "ld [%8+" dest"], %%f6 \n\t"\ "ld [%9+" dest"], %%f8 \n\t"\ "ld [%10+" dest"], %%f10 \n\t"\ "ld [%11+" dest"], %%f12 \n\t"\ "ld [%12+" dest"], %%f14 \n\t"\ "fmul8x16 %%f0, %%f18, %%f0 \n\t"\ "fmul8x16 %%f2, %%f18, %%f2 \n\t"\ "fmul8x16 %%f4, %%f18, %%f4 \n\t"\ "fmul8x16 %%f6, %%f18, %%f6 \n\t"\ "fmul8x16 %%f8, %%f18, %%f8 \n\t"\ "fmul8x16 %%f10, %%f18, %%f10 \n\t"\ "fmul8x16 %%f12, %%f18, %%f12 \n\t"\ "fmul8x16 %%f14, %%f18, %%f14 \n\t"\ "fpadd16 %%f0, %%f16, %%f0 \n\t"\ "fpadd16 %%f2, %%f20, %%f2 \n\t"\ "fpadd16 %%f4, %%f24, %%f4 \n\t"\ "fpadd16 %%f6, %%f28, %%f6 \n\t"\ "fpadd16 %%f8, %%f54, %%f8 \n\t"\ "fpadd16 %%f10, %%f52, %%f10 \n\t"\ "fpadd16 %%f12, %%f50, %%f12 \n\t"\ "fpadd16 %%f14, %%f48, %%f14 \n\t"\ "fpack16 %%f0, %%f0 \n\t"\ "fpack16 %%f2, %%f2 \n\t"\ "fpack16 %%f4, %%f4 \n\t"\ "fpack16 %%f6, %%f6 \n\t"\ "fpack16 %%f8, %%f8 \n\t"\ "fpack16 %%f10, %%f10 \n\t"\ "fpack16 %%f12, %%f12 \n\t"\ "fpack16 %%f14, %%f14 \n\t"\ "st %%f0, [%3+" dest "] \n\t"\ "st %%f2, [%6+" dest "] \n\t"\ "st %%f4, [%7+" dest "] \n\t"\ "st %%f6, [%8+" dest "] \n\t"\ "st %%f8, [%9+" dest "] \n\t"\ "st %%f10, [%10+" dest "] \n\t"\ "st %%f12, [%11+" dest "] \n\t"\ "st %%f14, [%12+" dest "] \n\t"\ void ff_simple_idct_vis(DCTELEM *data) { int out1, out2, out3, out4; DECLARE_ALIGNED(8, int16_t, temp)[8*8]; __asm__ volatile( INIT_IDCT #define ADDROUNDER // shift right 16-4=12 LOADSCALE("%2+8") IDCT4ROWS STOREROWS("%3+8") LOADSCALE("%2+0") IDCT4ROWS "std %%f48, [%3+112] \n\t" "std %%f50, [%3+96] \n\t" "std %%f52, [%3+80] \n\t" "std %%f54, [%3+64] \n\t" // shift right 16+4 "ldd [%3+8], %%f18 \n\t" "ldd [%3+24], %%f22 \n\t" "ldd [%3+40], %%f26 \n\t" "ldd [%3+56], %%f30 \n\t" TRANSPOSE IDCT4ROWS SCALEROWS STOREROWS("%2+0") LOAD("%3+64") TRANSPOSE IDCT4ROWS SCALEROWS STOREROWS("%2+8") : "=r" (out1), "=r" (out2), "=r" (out3), "=r" (out4) : "0" (scale), "1" (coeffs), "2" (data), "3" (temp) ); } void ff_simple_idct_put_vis(uint8_t *dest, int line_size, DCTELEM *data) { int out1, out2, out3, out4, out5; int r1, r2, r3, r4, r5, r6, r7; __asm__ volatile( "wr %%g0, 0x8, %%gsr \n\t" INIT_IDCT "add %3, %4, %5 \n\t" "add %5, %4, %6 \n\t" "add %6, %4, %7 \n\t" "add %7, %4, %8 \n\t" "add %8, %4, %9 \n\t" "add %9, %4, %10 \n\t" "add %10, %4, %11 \n\t" // shift right 16-4=12 LOADSCALE("%2+8") IDCT4ROWS STOREROWS("%2+8") LOADSCALE("%2+0") IDCT4ROWS "std %%f48, [%2+112] \n\t" "std %%f50, [%2+96] \n\t" "std %%f52, [%2+80] \n\t" "std %%f54, [%2+64] \n\t" #undef ADDROUNDER #define ADDROUNDER "fpadd16 %%f28, %%f46, %%f28 \n\t" // shift right 16+4 "ldd [%2+8], %%f18 \n\t" "ldd [%2+24], %%f22 \n\t" "ldd [%2+40], %%f26 \n\t" "ldd [%2+56], %%f30 \n\t" TRANSPOSE IDCT4ROWS PUTPIXELSCLAMPED("0") LOAD("%2+64") TRANSPOSE IDCT4ROWS PUTPIXELSCLAMPED("4") : "=r" (out1), "=r" (out2), "=r" (out3), "=r" (out4), "=r" (out5), "=r" (r1), "=r" (r2), "=r" (r3), "=r" (r4), "=r" (r5), "=r" (r6), "=r" (r7) : "0" (rounder), "1" (coeffs), "2" (data), "3" (dest), "4" (line_size) ); } void ff_simple_idct_add_vis(uint8_t *dest, int line_size, DCTELEM *data) { int out1, out2, out3, out4, out5, out6; int r1, r2, r3, r4, r5, r6, r7; __asm__ volatile( "wr %%g0, 0x8, %%gsr \n\t" INIT_IDCT "add %3, %4, %6 \n\t" "add %6, %4, %7 \n\t" "add %7, %4, %8 \n\t" "add %8, %4, %9 \n\t" "add %9, %4, %10 \n\t" "add %10, %4, %11 \n\t" "add %11, %4, %12 \n\t" #undef ADDROUNDER #define ADDROUNDER // shift right 16-4=12 LOADSCALE("%2+8") IDCT4ROWS STOREROWS("%2+8") LOADSCALE("%2+0") IDCT4ROWS "std %%f48, [%2+112] \n\t" "std %%f50, [%2+96] \n\t" "std %%f52, [%2+80] \n\t" "std %%f54, [%2+64] \n\t" #undef ADDROUNDER #define ADDROUNDER "fpadd16 %%f28, %%f46, %%f28 \n\t" // shift right 16+4 "ldd [%2+8], %%f18 \n\t" "ldd [%2+24], %%f22 \n\t" "ldd [%2+40], %%f26 \n\t" "ldd [%2+56], %%f30 \n\t" TRANSPOSE IDCT4ROWS ADDPIXELSCLAMPED("0") LOAD("%2+64") TRANSPOSE IDCT4ROWS ADDPIXELSCLAMPED("4") : "=r" (out1), "=r" (out2), "=r" (out3), "=r" (out4), "=r" (out5), "=r" (out6), "=r" (r1), "=r" (r2), "=r" (r3), "=r" (r4), "=r" (r5), "=r" (r6), "=r" (r7) : "0" (rounder), "1" (coeffs), "2" (data), "3" (dest), "4" (line_size), "5" (expand) ); }
123linslouis-android-video-cutter
jni/libavcodec/sparc/simple_idct_vis.c
C
asf20
18,753
/* * Copyright (C) 2003 David S. Miller <davem@redhat.com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /* The *no_round* functions have been added by James A. Morrison, 2003,2004. The vis code from libmpeg2 was adapted for ffmpeg by James A. Morrison. */ #include "config.h" #include <inttypes.h> #include "libavcodec/dsputil.h" #include "dsputil_vis.h" #include "vis.h" /* The trick used in some of this file is the formula from the MMX * motion comp code, which is: * * (x+y+1)>>1 == (x|y)-((x^y)>>1) * * This allows us to average 8 bytes at a time in a 64-bit FPU reg. * We avoid overflows by masking before we do the shift, and we * implement the shift by multiplying by 1/2 using mul8x16. So in * VIS this is (assume 'x' is in f0, 'y' is in f2, a repeating mask * of '0xfe' is in f4, a repeating mask of '0x7f' is in f6, and * the value 0x80808080 is in f8): * * fxor f0, f2, f10 * fand f10, f4, f10 * fmul8x16 f8, f10, f10 * fand f10, f6, f10 * for f0, f2, f12 * fpsub16 f12, f10, f10 */ #define DUP4(x) {x, x, x, x} #define DUP8(x) {x, x, x, x, x, x, x, x} DECLARE_ALIGNED(8, static const int16_t, constants1)[] = DUP4 (1); DECLARE_ALIGNED(8, static const int16_t, constants2)[] = DUP4 (2); DECLARE_ALIGNED(8, static const int16_t, constants3)[] = DUP4 (3); DECLARE_ALIGNED(8, static const int16_t, constants6)[] = DUP4 (6); DECLARE_ALIGNED(8, static const int8_t, constants_fe)[] = DUP8 (0xfe); DECLARE_ALIGNED(8, static const int8_t, constants_7f)[] = DUP8 (0x7f); DECLARE_ALIGNED(8, static const int8_t, constants128)[] = DUP8 (128); DECLARE_ALIGNED(8, static const int16_t, constants256_512)[] = {256, 512, 256, 512}; DECLARE_ALIGNED(8, static const int16_t, constants256_1024)[] = {256, 1024, 256, 1024}; #define REF_0 0 #define REF_0_1 1 #define REF_2 2 #define REF_2_1 3 #define REF_4 4 #define REF_4_1 5 #define REF_6 6 #define REF_6_1 7 #define REF_S0 8 #define REF_S0_1 9 #define REF_S2 10 #define REF_S2_1 11 #define REF_S4 12 #define REF_S4_1 13 #define REF_S6 14 #define REF_S6_1 15 #define DST_0 16 #define DST_1 17 #define DST_2 18 #define DST_3 19 #define CONST_1 20 #define CONST_2 20 #define CONST_3 20 #define CONST_6 20 #define MASK_fe 20 #define CONST_128 22 #define CONST_256 22 #define CONST_512 22 #define CONST_1024 22 #define TMP0 24 #define TMP1 25 #define TMP2 26 #define TMP3 27 #define TMP4 28 #define TMP5 29 #define ZERO 30 #define MASK_7f 30 #define TMP6 32 #define TMP8 34 #define TMP10 36 #define TMP12 38 #define TMP14 40 #define TMP16 42 #define TMP18 44 #define TMP20 46 #define TMP22 48 #define TMP24 50 #define TMP26 52 #define TMP28 54 #define TMP30 56 #define TMP32 58 static void MC_put_o_16_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { ref = vis_alignaddr(ref); do { /* 5 cycles */ vis_ld64(ref[0], TMP0); vis_ld64_2(ref, 8, TMP2); vis_ld64_2(ref, 16, TMP4); ref += stride; vis_faligndata(TMP0, TMP2, REF_0); vis_st64(REF_0, dest[0]); vis_faligndata(TMP2, TMP4, REF_2); vis_st64_2(REF_2, dest, 8); dest += stride; } while (--height); } static void MC_put_o_8_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { ref = vis_alignaddr(ref); do { /* 4 cycles */ vis_ld64(ref[0], TMP0); vis_ld64(ref[8], TMP2); ref += stride; /* stall */ vis_faligndata(TMP0, TMP2, REF_0); vis_st64(REF_0, dest[0]); dest += stride; } while (--height); } static void MC_avg_o_16_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { int stride_8 = stride + 8; ref = vis_alignaddr(ref); vis_ld64(ref[0], TMP0); vis_ld64(ref[8], TMP2); vis_ld64(ref[16], TMP4); vis_ld64(dest[0], DST_0); vis_ld64(dest[8], DST_2); vis_ld64(constants_fe[0], MASK_fe); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64(constants_7f[0], MASK_7f); vis_faligndata(TMP2, TMP4, REF_2); vis_ld64(constants128[0], CONST_128); ref += stride; height = (height >> 1) - 1; do { /* 24 cycles */ vis_ld64(ref[0], TMP0); vis_xor(DST_0, REF_0, TMP6); vis_ld64_2(ref, 8, TMP2); vis_and(TMP6, MASK_fe, TMP6); vis_ld64_2(ref, 16, TMP4); ref += stride; vis_mul8x16(CONST_128, TMP6, TMP6); vis_xor(DST_2, REF_2, TMP8); vis_and(TMP8, MASK_fe, TMP8); vis_or(DST_0, REF_0, TMP10); vis_ld64_2(dest, stride, DST_0); vis_mul8x16(CONST_128, TMP8, TMP8); vis_or(DST_2, REF_2, TMP12); vis_ld64_2(dest, stride_8, DST_2); vis_ld64(ref[0], TMP14); vis_and(TMP6, MASK_7f, TMP6); vis_and(TMP8, MASK_7f, TMP8); vis_psub16(TMP10, TMP6, TMP6); vis_st64(TMP6, dest[0]); vis_psub16(TMP12, TMP8, TMP8); vis_st64_2(TMP8, dest, 8); dest += stride; vis_ld64_2(ref, 8, TMP16); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64_2(ref, 16, TMP18); vis_faligndata(TMP2, TMP4, REF_2); ref += stride; vis_xor(DST_0, REF_0, TMP20); vis_and(TMP20, MASK_fe, TMP20); vis_xor(DST_2, REF_2, TMP22); vis_mul8x16(CONST_128, TMP20, TMP20); vis_and(TMP22, MASK_fe, TMP22); vis_or(DST_0, REF_0, TMP24); vis_mul8x16(CONST_128, TMP22, TMP22); vis_or(DST_2, REF_2, TMP26); vis_ld64_2(dest, stride, DST_0); vis_faligndata(TMP14, TMP16, REF_0); vis_ld64_2(dest, stride_8, DST_2); vis_faligndata(TMP16, TMP18, REF_2); vis_and(TMP20, MASK_7f, TMP20); vis_and(TMP22, MASK_7f, TMP22); vis_psub16(TMP24, TMP20, TMP20); vis_st64(TMP20, dest[0]); vis_psub16(TMP26, TMP22, TMP22); vis_st64_2(TMP22, dest, 8); dest += stride; } while (--height); vis_ld64(ref[0], TMP0); vis_xor(DST_0, REF_0, TMP6); vis_ld64_2(ref, 8, TMP2); vis_and(TMP6, MASK_fe, TMP6); vis_ld64_2(ref, 16, TMP4); vis_mul8x16(CONST_128, TMP6, TMP6); vis_xor(DST_2, REF_2, TMP8); vis_and(TMP8, MASK_fe, TMP8); vis_or(DST_0, REF_0, TMP10); vis_ld64_2(dest, stride, DST_0); vis_mul8x16(CONST_128, TMP8, TMP8); vis_or(DST_2, REF_2, TMP12); vis_ld64_2(dest, stride_8, DST_2); vis_ld64(ref[0], TMP14); vis_and(TMP6, MASK_7f, TMP6); vis_and(TMP8, MASK_7f, TMP8); vis_psub16(TMP10, TMP6, TMP6); vis_st64(TMP6, dest[0]); vis_psub16(TMP12, TMP8, TMP8); vis_st64_2(TMP8, dest, 8); dest += stride; vis_faligndata(TMP0, TMP2, REF_0); vis_faligndata(TMP2, TMP4, REF_2); vis_xor(DST_0, REF_0, TMP20); vis_and(TMP20, MASK_fe, TMP20); vis_xor(DST_2, REF_2, TMP22); vis_mul8x16(CONST_128, TMP20, TMP20); vis_and(TMP22, MASK_fe, TMP22); vis_or(DST_0, REF_0, TMP24); vis_mul8x16(CONST_128, TMP22, TMP22); vis_or(DST_2, REF_2, TMP26); vis_and(TMP20, MASK_7f, TMP20); vis_and(TMP22, MASK_7f, TMP22); vis_psub16(TMP24, TMP20, TMP20); vis_st64(TMP20, dest[0]); vis_psub16(TMP26, TMP22, TMP22); vis_st64_2(TMP22, dest, 8); } static void MC_avg_o_8_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { ref = vis_alignaddr(ref); vis_ld64(ref[0], TMP0); vis_ld64(ref[8], TMP2); vis_ld64(dest[0], DST_0); vis_ld64(constants_fe[0], MASK_fe); vis_ld64(constants_7f[0], MASK_7f); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64(constants128[0], CONST_128); ref += stride; height = (height >> 1) - 1; do { /* 12 cycles */ vis_ld64(ref[0], TMP0); vis_xor(DST_0, REF_0, TMP4); vis_ld64(ref[8], TMP2); vis_and(TMP4, MASK_fe, TMP4); vis_or(DST_0, REF_0, TMP6); vis_ld64_2(dest, stride, DST_0); ref += stride; vis_mul8x16(CONST_128, TMP4, TMP4); vis_ld64(ref[0], TMP12); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64(ref[8], TMP2); vis_xor(DST_0, REF_0, TMP0); ref += stride; vis_and(TMP0, MASK_fe, TMP0); vis_and(TMP4, MASK_7f, TMP4); vis_psub16(TMP6, TMP4, TMP4); vis_st64(TMP4, dest[0]); dest += stride; vis_mul8x16(CONST_128, TMP0, TMP0); vis_or(DST_0, REF_0, TMP6); vis_ld64_2(dest, stride, DST_0); vis_faligndata(TMP12, TMP2, REF_0); vis_and(TMP0, MASK_7f, TMP0); vis_psub16(TMP6, TMP0, TMP4); vis_st64(TMP4, dest[0]); dest += stride; } while (--height); vis_ld64(ref[0], TMP0); vis_xor(DST_0, REF_0, TMP4); vis_ld64(ref[8], TMP2); vis_and(TMP4, MASK_fe, TMP4); vis_or(DST_0, REF_0, TMP6); vis_ld64_2(dest, stride, DST_0); vis_mul8x16(CONST_128, TMP4, TMP4); vis_faligndata(TMP0, TMP2, REF_0); vis_xor(DST_0, REF_0, TMP0); vis_and(TMP0, MASK_fe, TMP0); vis_and(TMP4, MASK_7f, TMP4); vis_psub16(TMP6, TMP4, TMP4); vis_st64(TMP4, dest[0]); dest += stride; vis_mul8x16(CONST_128, TMP0, TMP0); vis_or(DST_0, REF_0, TMP6); vis_and(TMP0, MASK_7f, TMP0); vis_psub16(TMP6, TMP0, TMP4); vis_st64(TMP4, dest[0]); } static void MC_put_x_16_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { unsigned long off = (unsigned long) ref & 0x7; unsigned long off_plus_1 = off + 1; ref = vis_alignaddr(ref); vis_ld64(ref[0], TMP0); vis_ld64_2(ref, 8, TMP2); vis_ld64_2(ref, 16, TMP4); vis_ld64(constants_fe[0], MASK_fe); vis_ld64(constants_7f[0], MASK_7f); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64(constants128[0], CONST_128); vis_faligndata(TMP2, TMP4, REF_4); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_2); vis_faligndata(TMP2, TMP4, REF_6); } else { vis_src1(TMP2, REF_2); vis_src1(TMP4, REF_6); } ref += stride; height = (height >> 1) - 1; do { /* 34 cycles */ vis_ld64(ref[0], TMP0); vis_xor(REF_0, REF_2, TMP6); vis_ld64_2(ref, 8, TMP2); vis_xor(REF_4, REF_6, TMP8); vis_ld64_2(ref, 16, TMP4); vis_and(TMP6, MASK_fe, TMP6); ref += stride; vis_ld64(ref[0], TMP14); vis_mul8x16(CONST_128, TMP6, TMP6); vis_and(TMP8, MASK_fe, TMP8); vis_ld64_2(ref, 8, TMP16); vis_mul8x16(CONST_128, TMP8, TMP8); vis_or(REF_0, REF_2, TMP10); vis_ld64_2(ref, 16, TMP18); ref += stride; vis_or(REF_4, REF_6, TMP12); vis_alignaddr_g0((void *)off); vis_faligndata(TMP0, TMP2, REF_0); vis_faligndata(TMP2, TMP4, REF_4); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_2); vis_faligndata(TMP2, TMP4, REF_6); } else { vis_src1(TMP2, REF_2); vis_src1(TMP4, REF_6); } vis_and(TMP6, MASK_7f, TMP6); vis_and(TMP8, MASK_7f, TMP8); vis_psub16(TMP10, TMP6, TMP6); vis_st64(TMP6, dest[0]); vis_psub16(TMP12, TMP8, TMP8); vis_st64_2(TMP8, dest, 8); dest += stride; vis_xor(REF_0, REF_2, TMP6); vis_xor(REF_4, REF_6, TMP8); vis_and(TMP6, MASK_fe, TMP6); vis_mul8x16(CONST_128, TMP6, TMP6); vis_and(TMP8, MASK_fe, TMP8); vis_mul8x16(CONST_128, TMP8, TMP8); vis_or(REF_0, REF_2, TMP10); vis_or(REF_4, REF_6, TMP12); vis_alignaddr_g0((void *)off); vis_faligndata(TMP14, TMP16, REF_0); vis_faligndata(TMP16, TMP18, REF_4); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP14, TMP16, REF_2); vis_faligndata(TMP16, TMP18, REF_6); } else { vis_src1(TMP16, REF_2); vis_src1(TMP18, REF_6); } vis_and(TMP6, MASK_7f, TMP6); vis_and(TMP8, MASK_7f, TMP8); vis_psub16(TMP10, TMP6, TMP6); vis_st64(TMP6, dest[0]); vis_psub16(TMP12, TMP8, TMP8); vis_st64_2(TMP8, dest, 8); dest += stride; } while (--height); vis_ld64(ref[0], TMP0); vis_xor(REF_0, REF_2, TMP6); vis_ld64_2(ref, 8, TMP2); vis_xor(REF_4, REF_6, TMP8); vis_ld64_2(ref, 16, TMP4); vis_and(TMP6, MASK_fe, TMP6); vis_mul8x16(CONST_128, TMP6, TMP6); vis_and(TMP8, MASK_fe, TMP8); vis_mul8x16(CONST_128, TMP8, TMP8); vis_or(REF_0, REF_2, TMP10); vis_or(REF_4, REF_6, TMP12); vis_alignaddr_g0((void *)off); vis_faligndata(TMP0, TMP2, REF_0); vis_faligndata(TMP2, TMP4, REF_4); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_2); vis_faligndata(TMP2, TMP4, REF_6); } else { vis_src1(TMP2, REF_2); vis_src1(TMP4, REF_6); } vis_and(TMP6, MASK_7f, TMP6); vis_and(TMP8, MASK_7f, TMP8); vis_psub16(TMP10, TMP6, TMP6); vis_st64(TMP6, dest[0]); vis_psub16(TMP12, TMP8, TMP8); vis_st64_2(TMP8, dest, 8); dest += stride; vis_xor(REF_0, REF_2, TMP6); vis_xor(REF_4, REF_6, TMP8); vis_and(TMP6, MASK_fe, TMP6); vis_mul8x16(CONST_128, TMP6, TMP6); vis_and(TMP8, MASK_fe, TMP8); vis_mul8x16(CONST_128, TMP8, TMP8); vis_or(REF_0, REF_2, TMP10); vis_or(REF_4, REF_6, TMP12); vis_and(TMP6, MASK_7f, TMP6); vis_and(TMP8, MASK_7f, TMP8); vis_psub16(TMP10, TMP6, TMP6); vis_st64(TMP6, dest[0]); vis_psub16(TMP12, TMP8, TMP8); vis_st64_2(TMP8, dest, 8); } static void MC_put_x_8_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { unsigned long off = (unsigned long) ref & 0x7; unsigned long off_plus_1 = off + 1; ref = vis_alignaddr(ref); vis_ld64(ref[0], TMP0); vis_ld64(ref[8], TMP2); vis_ld64(constants_fe[0], MASK_fe); vis_ld64(constants_7f[0], MASK_7f); vis_ld64(constants128[0], CONST_128); vis_faligndata(TMP0, TMP2, REF_0); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_2); } else { vis_src1(TMP2, REF_2); } ref += stride; height = (height >> 1) - 1; do { /* 20 cycles */ vis_ld64(ref[0], TMP0); vis_xor(REF_0, REF_2, TMP4); vis_ld64_2(ref, 8, TMP2); vis_and(TMP4, MASK_fe, TMP4); ref += stride; vis_ld64(ref[0], TMP8); vis_or(REF_0, REF_2, TMP6); vis_mul8x16(CONST_128, TMP4, TMP4); vis_alignaddr_g0((void *)off); vis_ld64_2(ref, 8, TMP10); ref += stride; vis_faligndata(TMP0, TMP2, REF_0); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_2); } else { vis_src1(TMP2, REF_2); } vis_and(TMP4, MASK_7f, TMP4); vis_psub16(TMP6, TMP4, DST_0); vis_st64(DST_0, dest[0]); dest += stride; vis_xor(REF_0, REF_2, TMP12); vis_and(TMP12, MASK_fe, TMP12); vis_or(REF_0, REF_2, TMP14); vis_mul8x16(CONST_128, TMP12, TMP12); vis_alignaddr_g0((void *)off); vis_faligndata(TMP8, TMP10, REF_0); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP8, TMP10, REF_2); } else { vis_src1(TMP10, REF_2); } vis_and(TMP12, MASK_7f, TMP12); vis_psub16(TMP14, TMP12, DST_0); vis_st64(DST_0, dest[0]); dest += stride; } while (--height); vis_ld64(ref[0], TMP0); vis_xor(REF_0, REF_2, TMP4); vis_ld64_2(ref, 8, TMP2); vis_and(TMP4, MASK_fe, TMP4); vis_or(REF_0, REF_2, TMP6); vis_mul8x16(CONST_128, TMP4, TMP4); vis_alignaddr_g0((void *)off); vis_faligndata(TMP0, TMP2, REF_0); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_2); } else { vis_src1(TMP2, REF_2); } vis_and(TMP4, MASK_7f, TMP4); vis_psub16(TMP6, TMP4, DST_0); vis_st64(DST_0, dest[0]); dest += stride; vis_xor(REF_0, REF_2, TMP12); vis_and(TMP12, MASK_fe, TMP12); vis_or(REF_0, REF_2, TMP14); vis_mul8x16(CONST_128, TMP12, TMP12); vis_and(TMP12, MASK_7f, TMP12); vis_psub16(TMP14, TMP12, DST_0); vis_st64(DST_0, dest[0]); dest += stride; } static void MC_avg_x_16_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { unsigned long off = (unsigned long) ref & 0x7; unsigned long off_plus_1 = off + 1; vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT); vis_ld64(constants3[0], CONST_3); vis_fzero(ZERO); vis_ld64(constants256_512[0], CONST_256); ref = vis_alignaddr(ref); do { /* 26 cycles */ vis_ld64(ref[0], TMP0); vis_ld64(ref[8], TMP2); vis_alignaddr_g0((void *)off); vis_ld64(ref[16], TMP4); vis_ld64(dest[0], DST_0); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64(dest[8], DST_2); vis_faligndata(TMP2, TMP4, REF_4); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_2); vis_faligndata(TMP2, TMP4, REF_6); } else { vis_src1(TMP2, REF_2); vis_src1(TMP4, REF_6); } vis_mul8x16au(REF_0, CONST_256, TMP0); vis_pmerge(ZERO, REF_2, TMP4); vis_mul8x16au(REF_0_1, CONST_256, TMP2); vis_pmerge(ZERO, REF_2_1, TMP6); vis_padd16(TMP0, TMP4, TMP0); vis_mul8x16al(DST_0, CONST_512, TMP4); vis_padd16(TMP2, TMP6, TMP2); vis_mul8x16al(DST_1, CONST_512, TMP6); vis_mul8x16au(REF_6, CONST_256, TMP12); vis_padd16(TMP0, TMP4, TMP0); vis_mul8x16au(REF_6_1, CONST_256, TMP14); vis_padd16(TMP2, TMP6, TMP2); vis_mul8x16au(REF_4, CONST_256, TMP16); vis_padd16(TMP0, CONST_3, TMP8); vis_mul8x16au(REF_4_1, CONST_256, TMP18); vis_padd16(TMP2, CONST_3, TMP10); vis_pack16(TMP8, DST_0); vis_pack16(TMP10, DST_1); vis_padd16(TMP16, TMP12, TMP0); vis_st64(DST_0, dest[0]); vis_mul8x16al(DST_2, CONST_512, TMP4); vis_padd16(TMP18, TMP14, TMP2); vis_mul8x16al(DST_3, CONST_512, TMP6); vis_padd16(TMP0, CONST_3, TMP0); vis_padd16(TMP2, CONST_3, TMP2); vis_padd16(TMP0, TMP4, TMP0); vis_padd16(TMP2, TMP6, TMP2); vis_pack16(TMP0, DST_2); vis_pack16(TMP2, DST_3); vis_st64(DST_2, dest[8]); ref += stride; dest += stride; } while (--height); } static void MC_avg_x_8_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { unsigned long off = (unsigned long) ref & 0x7; unsigned long off_plus_1 = off + 1; int stride_times_2 = stride << 1; vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT); vis_ld64(constants3[0], CONST_3); vis_fzero(ZERO); vis_ld64(constants256_512[0], CONST_256); ref = vis_alignaddr(ref); height >>= 2; do { /* 47 cycles */ vis_ld64(ref[0], TMP0); vis_ld64_2(ref, 8, TMP2); ref += stride; vis_alignaddr_g0((void *)off); vis_ld64(ref[0], TMP4); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64_2(ref, 8, TMP6); ref += stride; vis_ld64(ref[0], TMP8); vis_ld64_2(ref, 8, TMP10); ref += stride; vis_faligndata(TMP4, TMP6, REF_4); vis_ld64(ref[0], TMP12); vis_ld64_2(ref, 8, TMP14); ref += stride; vis_faligndata(TMP8, TMP10, REF_S0); vis_faligndata(TMP12, TMP14, REF_S4); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_ld64(dest[0], DST_0); vis_faligndata(TMP0, TMP2, REF_2); vis_ld64_2(dest, stride, DST_2); vis_faligndata(TMP4, TMP6, REF_6); vis_faligndata(TMP8, TMP10, REF_S2); vis_faligndata(TMP12, TMP14, REF_S6); } else { vis_ld64(dest[0], DST_0); vis_src1(TMP2, REF_2); vis_ld64_2(dest, stride, DST_2); vis_src1(TMP6, REF_6); vis_src1(TMP10, REF_S2); vis_src1(TMP14, REF_S6); } vis_pmerge(ZERO, REF_0, TMP0); vis_mul8x16au(REF_0_1, CONST_256, TMP2); vis_pmerge(ZERO, REF_2, TMP4); vis_mul8x16au(REF_2_1, CONST_256, TMP6); vis_padd16(TMP0, CONST_3, TMP0); vis_mul8x16al(DST_0, CONST_512, TMP16); vis_padd16(TMP2, CONST_3, TMP2); vis_mul8x16al(DST_1, CONST_512, TMP18); vis_padd16(TMP0, TMP4, TMP0); vis_mul8x16au(REF_4, CONST_256, TMP8); vis_padd16(TMP2, TMP6, TMP2); vis_mul8x16au(REF_4_1, CONST_256, TMP10); vis_padd16(TMP0, TMP16, TMP0); vis_mul8x16au(REF_6, CONST_256, TMP12); vis_padd16(TMP2, TMP18, TMP2); vis_mul8x16au(REF_6_1, CONST_256, TMP14); vis_padd16(TMP8, CONST_3, TMP8); vis_mul8x16al(DST_2, CONST_512, TMP16); vis_padd16(TMP8, TMP12, TMP8); vis_mul8x16al(DST_3, CONST_512, TMP18); vis_padd16(TMP10, TMP14, TMP10); vis_pack16(TMP0, DST_0); vis_pack16(TMP2, DST_1); vis_st64(DST_0, dest[0]); dest += stride; vis_padd16(TMP10, CONST_3, TMP10); vis_ld64_2(dest, stride, DST_0); vis_padd16(TMP8, TMP16, TMP8); vis_ld64_2(dest, stride_times_2, TMP4/*DST_2*/); vis_padd16(TMP10, TMP18, TMP10); vis_pack16(TMP8, DST_2); vis_pack16(TMP10, DST_3); vis_st64(DST_2, dest[0]); dest += stride; vis_mul8x16au(REF_S0_1, CONST_256, TMP2); vis_pmerge(ZERO, REF_S0, TMP0); vis_pmerge(ZERO, REF_S2, TMP24); vis_mul8x16au(REF_S2_1, CONST_256, TMP6); vis_padd16(TMP0, CONST_3, TMP0); vis_mul8x16au(REF_S4, CONST_256, TMP8); vis_padd16(TMP2, CONST_3, TMP2); vis_mul8x16au(REF_S4_1, CONST_256, TMP10); vis_padd16(TMP0, TMP24, TMP0); vis_mul8x16au(REF_S6, CONST_256, TMP12); vis_padd16(TMP2, TMP6, TMP2); vis_mul8x16au(REF_S6_1, CONST_256, TMP14); vis_padd16(TMP8, CONST_3, TMP8); vis_mul8x16al(DST_0, CONST_512, TMP16); vis_padd16(TMP10, CONST_3, TMP10); vis_mul8x16al(DST_1, CONST_512, TMP18); vis_padd16(TMP8, TMP12, TMP8); vis_mul8x16al(TMP4/*DST_2*/, CONST_512, TMP20); vis_mul8x16al(TMP5/*DST_3*/, CONST_512, TMP22); vis_padd16(TMP0, TMP16, TMP0); vis_padd16(TMP2, TMP18, TMP2); vis_pack16(TMP0, DST_0); vis_padd16(TMP10, TMP14, TMP10); vis_pack16(TMP2, DST_1); vis_st64(DST_0, dest[0]); dest += stride; vis_padd16(TMP8, TMP20, TMP8); vis_padd16(TMP10, TMP22, TMP10); vis_pack16(TMP8, DST_2); vis_pack16(TMP10, DST_3); vis_st64(DST_2, dest[0]); dest += stride; } while (--height); } static void MC_put_y_16_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { ref = vis_alignaddr(ref); vis_ld64(ref[0], TMP0); vis_ld64_2(ref, 8, TMP2); vis_ld64_2(ref, 16, TMP4); ref += stride; vis_ld64(ref[0], TMP6); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64_2(ref, 8, TMP8); vis_faligndata(TMP2, TMP4, REF_4); vis_ld64_2(ref, 16, TMP10); ref += stride; vis_ld64(constants_fe[0], MASK_fe); vis_faligndata(TMP6, TMP8, REF_2); vis_ld64(constants_7f[0], MASK_7f); vis_faligndata(TMP8, TMP10, REF_6); vis_ld64(constants128[0], CONST_128); height = (height >> 1) - 1; do { /* 24 cycles */ vis_ld64(ref[0], TMP0); vis_xor(REF_0, REF_2, TMP12); vis_ld64_2(ref, 8, TMP2); vis_xor(REF_4, REF_6, TMP16); vis_ld64_2(ref, 16, TMP4); ref += stride; vis_or(REF_0, REF_2, TMP14); vis_ld64(ref[0], TMP6); vis_or(REF_4, REF_6, TMP18); vis_ld64_2(ref, 8, TMP8); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64_2(ref, 16, TMP10); ref += stride; vis_faligndata(TMP2, TMP4, REF_4); vis_and(TMP12, MASK_fe, TMP12); vis_and(TMP16, MASK_fe, TMP16); vis_mul8x16(CONST_128, TMP12, TMP12); vis_mul8x16(CONST_128, TMP16, TMP16); vis_xor(REF_0, REF_2, TMP0); vis_xor(REF_4, REF_6, TMP2); vis_or(REF_0, REF_2, TMP20); vis_and(TMP12, MASK_7f, TMP12); vis_and(TMP16, MASK_7f, TMP16); vis_psub16(TMP14, TMP12, TMP12); vis_st64(TMP12, dest[0]); vis_psub16(TMP18, TMP16, TMP16); vis_st64_2(TMP16, dest, 8); dest += stride; vis_or(REF_4, REF_6, TMP18); vis_and(TMP0, MASK_fe, TMP0); vis_and(TMP2, MASK_fe, TMP2); vis_mul8x16(CONST_128, TMP0, TMP0); vis_faligndata(TMP6, TMP8, REF_2); vis_mul8x16(CONST_128, TMP2, TMP2); vis_faligndata(TMP8, TMP10, REF_6); vis_and(TMP0, MASK_7f, TMP0); vis_and(TMP2, MASK_7f, TMP2); vis_psub16(TMP20, TMP0, TMP0); vis_st64(TMP0, dest[0]); vis_psub16(TMP18, TMP2, TMP2); vis_st64_2(TMP2, dest, 8); dest += stride; } while (--height); vis_ld64(ref[0], TMP0); vis_xor(REF_0, REF_2, TMP12); vis_ld64_2(ref, 8, TMP2); vis_xor(REF_4, REF_6, TMP16); vis_ld64_2(ref, 16, TMP4); vis_or(REF_0, REF_2, TMP14); vis_or(REF_4, REF_6, TMP18); vis_faligndata(TMP0, TMP2, REF_0); vis_faligndata(TMP2, TMP4, REF_4); vis_and(TMP12, MASK_fe, TMP12); vis_and(TMP16, MASK_fe, TMP16); vis_mul8x16(CONST_128, TMP12, TMP12); vis_mul8x16(CONST_128, TMP16, TMP16); vis_xor(REF_0, REF_2, TMP0); vis_xor(REF_4, REF_6, TMP2); vis_or(REF_0, REF_2, TMP20); vis_and(TMP12, MASK_7f, TMP12); vis_and(TMP16, MASK_7f, TMP16); vis_psub16(TMP14, TMP12, TMP12); vis_st64(TMP12, dest[0]); vis_psub16(TMP18, TMP16, TMP16); vis_st64_2(TMP16, dest, 8); dest += stride; vis_or(REF_4, REF_6, TMP18); vis_and(TMP0, MASK_fe, TMP0); vis_and(TMP2, MASK_fe, TMP2); vis_mul8x16(CONST_128, TMP0, TMP0); vis_mul8x16(CONST_128, TMP2, TMP2); vis_and(TMP0, MASK_7f, TMP0); vis_and(TMP2, MASK_7f, TMP2); vis_psub16(TMP20, TMP0, TMP0); vis_st64(TMP0, dest[0]); vis_psub16(TMP18, TMP2, TMP2); vis_st64_2(TMP2, dest, 8); } static void MC_put_y_8_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { ref = vis_alignaddr(ref); vis_ld64(ref[0], TMP0); vis_ld64_2(ref, 8, TMP2); ref += stride; vis_ld64(ref[0], TMP4); vis_ld64_2(ref, 8, TMP6); ref += stride; vis_ld64(constants_fe[0], MASK_fe); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64(constants_7f[0], MASK_7f); vis_faligndata(TMP4, TMP6, REF_2); vis_ld64(constants128[0], CONST_128); height = (height >> 1) - 1; do { /* 12 cycles */ vis_ld64(ref[0], TMP0); vis_xor(REF_0, REF_2, TMP4); vis_ld64_2(ref, 8, TMP2); ref += stride; vis_and(TMP4, MASK_fe, TMP4); vis_or(REF_0, REF_2, TMP6); vis_mul8x16(CONST_128, TMP4, TMP4); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64(ref[0], TMP0); vis_ld64_2(ref, 8, TMP2); ref += stride; vis_xor(REF_0, REF_2, TMP12); vis_and(TMP4, MASK_7f, TMP4); vis_and(TMP12, MASK_fe, TMP12); vis_mul8x16(CONST_128, TMP12, TMP12); vis_or(REF_0, REF_2, TMP14); vis_psub16(TMP6, TMP4, DST_0); vis_st64(DST_0, dest[0]); dest += stride; vis_faligndata(TMP0, TMP2, REF_2); vis_and(TMP12, MASK_7f, TMP12); vis_psub16(TMP14, TMP12, DST_0); vis_st64(DST_0, dest[0]); dest += stride; } while (--height); vis_ld64(ref[0], TMP0); vis_xor(REF_0, REF_2, TMP4); vis_ld64_2(ref, 8, TMP2); vis_and(TMP4, MASK_fe, TMP4); vis_or(REF_0, REF_2, TMP6); vis_mul8x16(CONST_128, TMP4, TMP4); vis_faligndata(TMP0, TMP2, REF_0); vis_xor(REF_0, REF_2, TMP12); vis_and(TMP4, MASK_7f, TMP4); vis_and(TMP12, MASK_fe, TMP12); vis_mul8x16(CONST_128, TMP12, TMP12); vis_or(REF_0, REF_2, TMP14); vis_psub16(TMP6, TMP4, DST_0); vis_st64(DST_0, dest[0]); dest += stride; vis_and(TMP12, MASK_7f, TMP12); vis_psub16(TMP14, TMP12, DST_0); vis_st64(DST_0, dest[0]); } static void MC_avg_y_16_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { int stride_8 = stride + 8; int stride_16 = stride + 16; vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT); ref = vis_alignaddr(ref); vis_ld64(ref[ 0], TMP0); vis_fzero(ZERO); vis_ld64(ref[ 8], TMP2); vis_ld64(ref[16], TMP4); vis_ld64(constants3[0], CONST_3); vis_faligndata(TMP0, TMP2, REF_2); vis_ld64(constants256_512[0], CONST_256); vis_faligndata(TMP2, TMP4, REF_6); height >>= 1; do { /* 31 cycles */ vis_ld64_2(ref, stride, TMP0); vis_pmerge(ZERO, REF_2, TMP12); vis_mul8x16au(REF_2_1, CONST_256, TMP14); vis_ld64_2(ref, stride_8, TMP2); vis_pmerge(ZERO, REF_6, TMP16); vis_mul8x16au(REF_6_1, CONST_256, TMP18); vis_ld64_2(ref, stride_16, TMP4); ref += stride; vis_ld64(dest[0], DST_0); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64_2(dest, 8, DST_2); vis_faligndata(TMP2, TMP4, REF_4); vis_ld64_2(ref, stride, TMP6); vis_pmerge(ZERO, REF_0, TMP0); vis_mul8x16au(REF_0_1, CONST_256, TMP2); vis_ld64_2(ref, stride_8, TMP8); vis_pmerge(ZERO, REF_4, TMP4); vis_ld64_2(ref, stride_16, TMP10); ref += stride; vis_ld64_2(dest, stride, REF_S0/*DST_4*/); vis_faligndata(TMP6, TMP8, REF_2); vis_mul8x16au(REF_4_1, CONST_256, TMP6); vis_ld64_2(dest, stride_8, REF_S2/*DST_6*/); vis_faligndata(TMP8, TMP10, REF_6); vis_mul8x16al(DST_0, CONST_512, TMP20); vis_padd16(TMP0, CONST_3, TMP0); vis_mul8x16al(DST_1, CONST_512, TMP22); vis_padd16(TMP2, CONST_3, TMP2); vis_mul8x16al(DST_2, CONST_512, TMP24); vis_padd16(TMP4, CONST_3, TMP4); vis_mul8x16al(DST_3, CONST_512, TMP26); vis_padd16(TMP6, CONST_3, TMP6); vis_padd16(TMP12, TMP20, TMP12); vis_mul8x16al(REF_S0, CONST_512, TMP20); vis_padd16(TMP14, TMP22, TMP14); vis_mul8x16al(REF_S0_1, CONST_512, TMP22); vis_padd16(TMP16, TMP24, TMP16); vis_mul8x16al(REF_S2, CONST_512, TMP24); vis_padd16(TMP18, TMP26, TMP18); vis_mul8x16al(REF_S2_1, CONST_512, TMP26); vis_padd16(TMP12, TMP0, TMP12); vis_mul8x16au(REF_2, CONST_256, TMP28); vis_padd16(TMP14, TMP2, TMP14); vis_mul8x16au(REF_2_1, CONST_256, TMP30); vis_padd16(TMP16, TMP4, TMP16); vis_mul8x16au(REF_6, CONST_256, REF_S4); vis_padd16(TMP18, TMP6, TMP18); vis_mul8x16au(REF_6_1, CONST_256, REF_S6); vis_pack16(TMP12, DST_0); vis_padd16(TMP28, TMP0, TMP12); vis_pack16(TMP14, DST_1); vis_st64(DST_0, dest[0]); vis_padd16(TMP30, TMP2, TMP14); vis_pack16(TMP16, DST_2); vis_padd16(REF_S4, TMP4, TMP16); vis_pack16(TMP18, DST_3); vis_st64_2(DST_2, dest, 8); dest += stride; vis_padd16(REF_S6, TMP6, TMP18); vis_padd16(TMP12, TMP20, TMP12); vis_padd16(TMP14, TMP22, TMP14); vis_pack16(TMP12, DST_0); vis_padd16(TMP16, TMP24, TMP16); vis_pack16(TMP14, DST_1); vis_st64(DST_0, dest[0]); vis_padd16(TMP18, TMP26, TMP18); vis_pack16(TMP16, DST_2); vis_pack16(TMP18, DST_3); vis_st64_2(DST_2, dest, 8); dest += stride; } while (--height); } static void MC_avg_y_8_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { int stride_8 = stride + 8; vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT); ref = vis_alignaddr(ref); vis_ld64(ref[ 0], TMP0); vis_fzero(ZERO); vis_ld64(ref[ 8], TMP2); vis_ld64(constants3[0], CONST_3); vis_faligndata(TMP0, TMP2, REF_2); vis_ld64(constants256_512[0], CONST_256); height >>= 1; do { /* 20 cycles */ vis_ld64_2(ref, stride, TMP0); vis_pmerge(ZERO, REF_2, TMP8); vis_mul8x16au(REF_2_1, CONST_256, TMP10); vis_ld64_2(ref, stride_8, TMP2); ref += stride; vis_ld64(dest[0], DST_0); vis_ld64_2(dest, stride, DST_2); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64_2(ref, stride, TMP4); vis_mul8x16al(DST_0, CONST_512, TMP16); vis_pmerge(ZERO, REF_0, TMP12); vis_ld64_2(ref, stride_8, TMP6); ref += stride; vis_mul8x16al(DST_1, CONST_512, TMP18); vis_pmerge(ZERO, REF_0_1, TMP14); vis_padd16(TMP12, CONST_3, TMP12); vis_mul8x16al(DST_2, CONST_512, TMP24); vis_padd16(TMP14, CONST_3, TMP14); vis_mul8x16al(DST_3, CONST_512, TMP26); vis_faligndata(TMP4, TMP6, REF_2); vis_padd16(TMP8, TMP12, TMP8); vis_padd16(TMP10, TMP14, TMP10); vis_mul8x16au(REF_2, CONST_256, TMP20); vis_padd16(TMP8, TMP16, TMP0); vis_mul8x16au(REF_2_1, CONST_256, TMP22); vis_padd16(TMP10, TMP18, TMP2); vis_pack16(TMP0, DST_0); vis_pack16(TMP2, DST_1); vis_st64(DST_0, dest[0]); dest += stride; vis_padd16(TMP12, TMP20, TMP12); vis_padd16(TMP14, TMP22, TMP14); vis_padd16(TMP12, TMP24, TMP0); vis_padd16(TMP14, TMP26, TMP2); vis_pack16(TMP0, DST_2); vis_pack16(TMP2, DST_3); vis_st64(DST_2, dest[0]); dest += stride; } while (--height); } static void MC_put_xy_16_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { unsigned long off = (unsigned long) ref & 0x7; unsigned long off_plus_1 = off + 1; int stride_8 = stride + 8; int stride_16 = stride + 16; vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT); ref = vis_alignaddr(ref); vis_ld64(ref[ 0], TMP0); vis_fzero(ZERO); vis_ld64(ref[ 8], TMP2); vis_ld64(ref[16], TMP4); vis_ld64(constants2[0], CONST_2); vis_faligndata(TMP0, TMP2, REF_S0); vis_ld64(constants256_512[0], CONST_256); vis_faligndata(TMP2, TMP4, REF_S4); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_S2); vis_faligndata(TMP2, TMP4, REF_S6); } else { vis_src1(TMP2, REF_S2); vis_src1(TMP4, REF_S6); } height >>= 1; do { vis_ld64_2(ref, stride, TMP0); vis_mul8x16au(REF_S0, CONST_256, TMP12); vis_pmerge(ZERO, REF_S0_1, TMP14); vis_alignaddr_g0((void *)off); vis_ld64_2(ref, stride_8, TMP2); vis_mul8x16au(REF_S2, CONST_256, TMP16); vis_pmerge(ZERO, REF_S2_1, TMP18); vis_ld64_2(ref, stride_16, TMP4); ref += stride; vis_mul8x16au(REF_S4, CONST_256, TMP20); vis_pmerge(ZERO, REF_S4_1, TMP22); vis_ld64_2(ref, stride, TMP6); vis_mul8x16au(REF_S6, CONST_256, TMP24); vis_pmerge(ZERO, REF_S6_1, TMP26); vis_ld64_2(ref, stride_8, TMP8); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64_2(ref, stride_16, TMP10); ref += stride; vis_faligndata(TMP2, TMP4, REF_4); vis_faligndata(TMP6, TMP8, REF_S0); vis_faligndata(TMP8, TMP10, REF_S4); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_2); vis_faligndata(TMP2, TMP4, REF_6); vis_faligndata(TMP6, TMP8, REF_S2); vis_faligndata(TMP8, TMP10, REF_S6); } else { vis_src1(TMP2, REF_2); vis_src1(TMP4, REF_6); vis_src1(TMP8, REF_S2); vis_src1(TMP10, REF_S6); } vis_mul8x16au(REF_0, CONST_256, TMP0); vis_pmerge(ZERO, REF_0_1, TMP2); vis_mul8x16au(REF_2, CONST_256, TMP4); vis_pmerge(ZERO, REF_2_1, TMP6); vis_padd16(TMP0, CONST_2, TMP8); vis_mul8x16au(REF_4, CONST_256, TMP0); vis_padd16(TMP2, CONST_2, TMP10); vis_mul8x16au(REF_4_1, CONST_256, TMP2); vis_padd16(TMP8, TMP4, TMP8); vis_mul8x16au(REF_6, CONST_256, TMP4); vis_padd16(TMP10, TMP6, TMP10); vis_mul8x16au(REF_6_1, CONST_256, TMP6); vis_padd16(TMP12, TMP8, TMP12); vis_padd16(TMP14, TMP10, TMP14); vis_padd16(TMP12, TMP16, TMP12); vis_padd16(TMP14, TMP18, TMP14); vis_pack16(TMP12, DST_0); vis_pack16(TMP14, DST_1); vis_st64(DST_0, dest[0]); vis_padd16(TMP0, CONST_2, TMP12); vis_mul8x16au(REF_S0, CONST_256, TMP0); vis_padd16(TMP2, CONST_2, TMP14); vis_mul8x16au(REF_S0_1, CONST_256, TMP2); vis_padd16(TMP12, TMP4, TMP12); vis_mul8x16au(REF_S2, CONST_256, TMP4); vis_padd16(TMP14, TMP6, TMP14); vis_mul8x16au(REF_S2_1, CONST_256, TMP6); vis_padd16(TMP20, TMP12, TMP20); vis_padd16(TMP22, TMP14, TMP22); vis_padd16(TMP20, TMP24, TMP20); vis_padd16(TMP22, TMP26, TMP22); vis_pack16(TMP20, DST_2); vis_pack16(TMP22, DST_3); vis_st64_2(DST_2, dest, 8); dest += stride; vis_padd16(TMP0, TMP4, TMP24); vis_mul8x16au(REF_S4, CONST_256, TMP0); vis_padd16(TMP2, TMP6, TMP26); vis_mul8x16au(REF_S4_1, CONST_256, TMP2); vis_padd16(TMP24, TMP8, TMP24); vis_padd16(TMP26, TMP10, TMP26); vis_pack16(TMP24, DST_0); vis_pack16(TMP26, DST_1); vis_st64(DST_0, dest[0]); vis_pmerge(ZERO, REF_S6, TMP4); vis_pmerge(ZERO, REF_S6_1, TMP6); vis_padd16(TMP0, TMP4, TMP0); vis_padd16(TMP2, TMP6, TMP2); vis_padd16(TMP0, TMP12, TMP0); vis_padd16(TMP2, TMP14, TMP2); vis_pack16(TMP0, DST_2); vis_pack16(TMP2, DST_3); vis_st64_2(DST_2, dest, 8); dest += stride; } while (--height); } static void MC_put_xy_8_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { unsigned long off = (unsigned long) ref & 0x7; unsigned long off_plus_1 = off + 1; int stride_8 = stride + 8; vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT); ref = vis_alignaddr(ref); vis_ld64(ref[ 0], TMP0); vis_fzero(ZERO); vis_ld64(ref[ 8], TMP2); vis_ld64(constants2[0], CONST_2); vis_ld64(constants256_512[0], CONST_256); vis_faligndata(TMP0, TMP2, REF_S0); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_S2); } else { vis_src1(TMP2, REF_S2); } height >>= 1; do { /* 26 cycles */ vis_ld64_2(ref, stride, TMP0); vis_mul8x16au(REF_S0, CONST_256, TMP8); vis_pmerge(ZERO, REF_S2, TMP12); vis_alignaddr_g0((void *)off); vis_ld64_2(ref, stride_8, TMP2); ref += stride; vis_mul8x16au(REF_S0_1, CONST_256, TMP10); vis_pmerge(ZERO, REF_S2_1, TMP14); vis_ld64_2(ref, stride, TMP4); vis_ld64_2(ref, stride_8, TMP6); ref += stride; vis_faligndata(TMP0, TMP2, REF_S4); vis_pmerge(ZERO, REF_S4, TMP18); vis_pmerge(ZERO, REF_S4_1, TMP20); vis_faligndata(TMP4, TMP6, REF_S0); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_S6); vis_faligndata(TMP4, TMP6, REF_S2); } else { vis_src1(TMP2, REF_S6); vis_src1(TMP6, REF_S2); } vis_padd16(TMP18, CONST_2, TMP18); vis_mul8x16au(REF_S6, CONST_256, TMP22); vis_padd16(TMP20, CONST_2, TMP20); vis_mul8x16au(REF_S6_1, CONST_256, TMP24); vis_mul8x16au(REF_S0, CONST_256, TMP26); vis_pmerge(ZERO, REF_S0_1, TMP28); vis_mul8x16au(REF_S2, CONST_256, TMP30); vis_padd16(TMP18, TMP22, TMP18); vis_mul8x16au(REF_S2_1, CONST_256, TMP32); vis_padd16(TMP20, TMP24, TMP20); vis_padd16(TMP8, TMP18, TMP8); vis_padd16(TMP10, TMP20, TMP10); vis_padd16(TMP8, TMP12, TMP8); vis_padd16(TMP10, TMP14, TMP10); vis_pack16(TMP8, DST_0); vis_pack16(TMP10, DST_1); vis_st64(DST_0, dest[0]); dest += stride; vis_padd16(TMP18, TMP26, TMP18); vis_padd16(TMP20, TMP28, TMP20); vis_padd16(TMP18, TMP30, TMP18); vis_padd16(TMP20, TMP32, TMP20); vis_pack16(TMP18, DST_2); vis_pack16(TMP20, DST_3); vis_st64(DST_2, dest[0]); dest += stride; } while (--height); } static void MC_avg_xy_16_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { unsigned long off = (unsigned long) ref & 0x7; unsigned long off_plus_1 = off + 1; int stride_8 = stride + 8; int stride_16 = stride + 16; vis_set_gsr(4 << VIS_GSR_SCALEFACT_SHIFT); ref = vis_alignaddr(ref); vis_ld64(ref[ 0], TMP0); vis_fzero(ZERO); vis_ld64(ref[ 8], TMP2); vis_ld64(ref[16], TMP4); vis_ld64(constants6[0], CONST_6); vis_faligndata(TMP0, TMP2, REF_S0); vis_ld64(constants256_1024[0], CONST_256); vis_faligndata(TMP2, TMP4, REF_S4); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_S2); vis_faligndata(TMP2, TMP4, REF_S6); } else { vis_src1(TMP2, REF_S2); vis_src1(TMP4, REF_S6); } height >>= 1; do { /* 55 cycles */ vis_ld64_2(ref, stride, TMP0); vis_mul8x16au(REF_S0, CONST_256, TMP12); vis_pmerge(ZERO, REF_S0_1, TMP14); vis_alignaddr_g0((void *)off); vis_ld64_2(ref, stride_8, TMP2); vis_mul8x16au(REF_S2, CONST_256, TMP16); vis_pmerge(ZERO, REF_S2_1, TMP18); vis_ld64_2(ref, stride_16, TMP4); ref += stride; vis_mul8x16au(REF_S4, CONST_256, TMP20); vis_pmerge(ZERO, REF_S4_1, TMP22); vis_ld64_2(ref, stride, TMP6); vis_mul8x16au(REF_S6, CONST_256, TMP24); vis_pmerge(ZERO, REF_S6_1, TMP26); vis_ld64_2(ref, stride_8, TMP8); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64_2(ref, stride_16, TMP10); ref += stride; vis_faligndata(TMP2, TMP4, REF_4); vis_ld64(dest[0], DST_0); vis_faligndata(TMP6, TMP8, REF_S0); vis_ld64_2(dest, 8, DST_2); vis_faligndata(TMP8, TMP10, REF_S4); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_2); vis_faligndata(TMP2, TMP4, REF_6); vis_faligndata(TMP6, TMP8, REF_S2); vis_faligndata(TMP8, TMP10, REF_S6); } else { vis_src1(TMP2, REF_2); vis_src1(TMP4, REF_6); vis_src1(TMP8, REF_S2); vis_src1(TMP10, REF_S6); } vis_mul8x16al(DST_0, CONST_1024, TMP30); vis_pmerge(ZERO, REF_0, TMP0); vis_mul8x16al(DST_1, CONST_1024, TMP32); vis_pmerge(ZERO, REF_0_1, TMP2); vis_mul8x16au(REF_2, CONST_256, TMP4); vis_pmerge(ZERO, REF_2_1, TMP6); vis_mul8x16al(DST_2, CONST_1024, REF_0); vis_padd16(TMP0, CONST_6, TMP0); vis_mul8x16al(DST_3, CONST_1024, REF_2); vis_padd16(TMP2, CONST_6, TMP2); vis_padd16(TMP0, TMP4, TMP0); vis_mul8x16au(REF_4, CONST_256, TMP4); vis_padd16(TMP2, TMP6, TMP2); vis_mul8x16au(REF_4_1, CONST_256, TMP6); vis_padd16(TMP12, TMP0, TMP12); vis_mul8x16au(REF_6, CONST_256, TMP8); vis_padd16(TMP14, TMP2, TMP14); vis_mul8x16au(REF_6_1, CONST_256, TMP10); vis_padd16(TMP12, TMP16, TMP12); vis_mul8x16au(REF_S0, CONST_256, REF_4); vis_padd16(TMP14, TMP18, TMP14); vis_mul8x16au(REF_S0_1, CONST_256, REF_6); vis_padd16(TMP12, TMP30, TMP12); vis_padd16(TMP14, TMP32, TMP14); vis_pack16(TMP12, DST_0); vis_pack16(TMP14, DST_1); vis_st64(DST_0, dest[0]); vis_padd16(TMP4, CONST_6, TMP4); vis_ld64_2(dest, stride, DST_0); vis_padd16(TMP6, CONST_6, TMP6); vis_mul8x16au(REF_S2, CONST_256, TMP12); vis_padd16(TMP4, TMP8, TMP4); vis_mul8x16au(REF_S2_1, CONST_256, TMP14); vis_padd16(TMP6, TMP10, TMP6); vis_padd16(TMP20, TMP4, TMP20); vis_padd16(TMP22, TMP6, TMP22); vis_padd16(TMP20, TMP24, TMP20); vis_padd16(TMP22, TMP26, TMP22); vis_padd16(TMP20, REF_0, TMP20); vis_mul8x16au(REF_S4, CONST_256, REF_0); vis_padd16(TMP22, REF_2, TMP22); vis_pack16(TMP20, DST_2); vis_pack16(TMP22, DST_3); vis_st64_2(DST_2, dest, 8); dest += stride; vis_ld64_2(dest, 8, DST_2); vis_mul8x16al(DST_0, CONST_1024, TMP30); vis_pmerge(ZERO, REF_S4_1, REF_2); vis_mul8x16al(DST_1, CONST_1024, TMP32); vis_padd16(REF_4, TMP0, TMP8); vis_mul8x16au(REF_S6, CONST_256, REF_4); vis_padd16(REF_6, TMP2, TMP10); vis_mul8x16au(REF_S6_1, CONST_256, REF_6); vis_padd16(TMP8, TMP12, TMP8); vis_padd16(TMP10, TMP14, TMP10); vis_padd16(TMP8, TMP30, TMP8); vis_padd16(TMP10, TMP32, TMP10); vis_pack16(TMP8, DST_0); vis_pack16(TMP10, DST_1); vis_st64(DST_0, dest[0]); vis_padd16(REF_0, TMP4, REF_0); vis_mul8x16al(DST_2, CONST_1024, TMP30); vis_padd16(REF_2, TMP6, REF_2); vis_mul8x16al(DST_3, CONST_1024, TMP32); vis_padd16(REF_0, REF_4, REF_0); vis_padd16(REF_2, REF_6, REF_2); vis_padd16(REF_0, TMP30, REF_0); /* stall */ vis_padd16(REF_2, TMP32, REF_2); vis_pack16(REF_0, DST_2); vis_pack16(REF_2, DST_3); vis_st64_2(DST_2, dest, 8); dest += stride; } while (--height); } static void MC_avg_xy_8_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { unsigned long off = (unsigned long) ref & 0x7; unsigned long off_plus_1 = off + 1; int stride_8 = stride + 8; vis_set_gsr(4 << VIS_GSR_SCALEFACT_SHIFT); ref = vis_alignaddr(ref); vis_ld64(ref[0], TMP0); vis_fzero(ZERO); vis_ld64_2(ref, 8, TMP2); vis_ld64(constants6[0], CONST_6); vis_ld64(constants256_1024[0], CONST_256); vis_faligndata(TMP0, TMP2, REF_S0); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_S2); } else { vis_src1(TMP2, REF_S2); } height >>= 1; do { /* 31 cycles */ vis_ld64_2(ref, stride, TMP0); vis_mul8x16au(REF_S0, CONST_256, TMP8); vis_pmerge(ZERO, REF_S0_1, TMP10); vis_ld64_2(ref, stride_8, TMP2); ref += stride; vis_mul8x16au(REF_S2, CONST_256, TMP12); vis_pmerge(ZERO, REF_S2_1, TMP14); vis_alignaddr_g0((void *)off); vis_ld64_2(ref, stride, TMP4); vis_faligndata(TMP0, TMP2, REF_S4); vis_ld64_2(ref, stride_8, TMP6); ref += stride; vis_ld64(dest[0], DST_0); vis_faligndata(TMP4, TMP6, REF_S0); vis_ld64_2(dest, stride, DST_2); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_S6); vis_faligndata(TMP4, TMP6, REF_S2); } else { vis_src1(TMP2, REF_S6); vis_src1(TMP6, REF_S2); } vis_mul8x16al(DST_0, CONST_1024, TMP30); vis_pmerge(ZERO, REF_S4, TMP22); vis_mul8x16al(DST_1, CONST_1024, TMP32); vis_pmerge(ZERO, REF_S4_1, TMP24); vis_mul8x16au(REF_S6, CONST_256, TMP26); vis_pmerge(ZERO, REF_S6_1, TMP28); vis_mul8x16au(REF_S0, CONST_256, REF_S4); vis_padd16(TMP22, CONST_6, TMP22); vis_mul8x16au(REF_S0_1, CONST_256, REF_S6); vis_padd16(TMP24, CONST_6, TMP24); vis_mul8x16al(DST_2, CONST_1024, REF_0); vis_padd16(TMP22, TMP26, TMP22); vis_mul8x16al(DST_3, CONST_1024, REF_2); vis_padd16(TMP24, TMP28, TMP24); vis_mul8x16au(REF_S2, CONST_256, TMP26); vis_padd16(TMP8, TMP22, TMP8); vis_mul8x16au(REF_S2_1, CONST_256, TMP28); vis_padd16(TMP10, TMP24, TMP10); vis_padd16(TMP8, TMP12, TMP8); vis_padd16(TMP10, TMP14, TMP10); vis_padd16(TMP8, TMP30, TMP8); vis_padd16(TMP10, TMP32, TMP10); vis_pack16(TMP8, DST_0); vis_pack16(TMP10, DST_1); vis_st64(DST_0, dest[0]); dest += stride; vis_padd16(REF_S4, TMP22, TMP12); vis_padd16(REF_S6, TMP24, TMP14); vis_padd16(TMP12, TMP26, TMP12); vis_padd16(TMP14, TMP28, TMP14); vis_padd16(TMP12, REF_0, TMP12); vis_padd16(TMP14, REF_2, TMP14); vis_pack16(TMP12, DST_2); vis_pack16(TMP14, DST_3); vis_st64(DST_2, dest[0]); dest += stride; } while (--height); } /* End of rounding code */ /* Start of no rounding code */ /* The trick used in some of this file is the formula from the MMX * motion comp code, which is: * * (x+y)>>1 == (x&y)+((x^y)>>1) * * This allows us to average 8 bytes at a time in a 64-bit FPU reg. * We avoid overflows by masking before we do the shift, and we * implement the shift by multiplying by 1/2 using mul8x16. So in * VIS this is (assume 'x' is in f0, 'y' is in f2, a repeating mask * of '0xfe' is in f4, a repeating mask of '0x7f' is in f6, and * the value 0x80808080 is in f8): * * fxor f0, f2, f10 * fand f10, f4, f10 * fmul8x16 f8, f10, f10 * fand f10, f6, f10 * fand f0, f2, f12 * fpadd16 f12, f10, f10 */ static void MC_put_no_round_o_16_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { ref = vis_alignaddr(ref); do { /* 5 cycles */ vis_ld64(ref[0], TMP0); vis_ld64_2(ref, 8, TMP2); vis_ld64_2(ref, 16, TMP4); ref += stride; vis_faligndata(TMP0, TMP2, REF_0); vis_st64(REF_0, dest[0]); vis_faligndata(TMP2, TMP4, REF_2); vis_st64_2(REF_2, dest, 8); dest += stride; } while (--height); } static void MC_put_no_round_o_8_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { ref = vis_alignaddr(ref); do { /* 4 cycles */ vis_ld64(ref[0], TMP0); vis_ld64(ref[8], TMP2); ref += stride; /* stall */ vis_faligndata(TMP0, TMP2, REF_0); vis_st64(REF_0, dest[0]); dest += stride; } while (--height); } static void MC_avg_no_round_o_16_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { int stride_8 = stride + 8; ref = vis_alignaddr(ref); vis_ld64(ref[0], TMP0); vis_ld64(ref[8], TMP2); vis_ld64(ref[16], TMP4); vis_ld64(dest[0], DST_0); vis_ld64(dest[8], DST_2); vis_ld64(constants_fe[0], MASK_fe); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64(constants_7f[0], MASK_7f); vis_faligndata(TMP2, TMP4, REF_2); vis_ld64(constants128[0], CONST_128); ref += stride; height = (height >> 1) - 1; do { /* 24 cycles */ vis_ld64(ref[0], TMP0); vis_xor(DST_0, REF_0, TMP6); vis_ld64_2(ref, 8, TMP2); vis_and(TMP6, MASK_fe, TMP6); vis_ld64_2(ref, 16, TMP4); ref += stride; vis_mul8x16(CONST_128, TMP6, TMP6); vis_xor(DST_2, REF_2, TMP8); vis_and(TMP8, MASK_fe, TMP8); vis_and(DST_0, REF_0, TMP10); vis_ld64_2(dest, stride, DST_0); vis_mul8x16(CONST_128, TMP8, TMP8); vis_and(DST_2, REF_2, TMP12); vis_ld64_2(dest, stride_8, DST_2); vis_ld64(ref[0], TMP14); vis_and(TMP6, MASK_7f, TMP6); vis_and(TMP8, MASK_7f, TMP8); vis_padd16(TMP10, TMP6, TMP6); vis_st64(TMP6, dest[0]); vis_padd16(TMP12, TMP8, TMP8); vis_st64_2(TMP8, dest, 8); dest += stride; vis_ld64_2(ref, 8, TMP16); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64_2(ref, 16, TMP18); vis_faligndata(TMP2, TMP4, REF_2); ref += stride; vis_xor(DST_0, REF_0, TMP20); vis_and(TMP20, MASK_fe, TMP20); vis_xor(DST_2, REF_2, TMP22); vis_mul8x16(CONST_128, TMP20, TMP20); vis_and(TMP22, MASK_fe, TMP22); vis_and(DST_0, REF_0, TMP24); vis_mul8x16(CONST_128, TMP22, TMP22); vis_and(DST_2, REF_2, TMP26); vis_ld64_2(dest, stride, DST_0); vis_faligndata(TMP14, TMP16, REF_0); vis_ld64_2(dest, stride_8, DST_2); vis_faligndata(TMP16, TMP18, REF_2); vis_and(TMP20, MASK_7f, TMP20); vis_and(TMP22, MASK_7f, TMP22); vis_padd16(TMP24, TMP20, TMP20); vis_st64(TMP20, dest[0]); vis_padd16(TMP26, TMP22, TMP22); vis_st64_2(TMP22, dest, 8); dest += stride; } while (--height); vis_ld64(ref[0], TMP0); vis_xor(DST_0, REF_0, TMP6); vis_ld64_2(ref, 8, TMP2); vis_and(TMP6, MASK_fe, TMP6); vis_ld64_2(ref, 16, TMP4); vis_mul8x16(CONST_128, TMP6, TMP6); vis_xor(DST_2, REF_2, TMP8); vis_and(TMP8, MASK_fe, TMP8); vis_and(DST_0, REF_0, TMP10); vis_ld64_2(dest, stride, DST_0); vis_mul8x16(CONST_128, TMP8, TMP8); vis_and(DST_2, REF_2, TMP12); vis_ld64_2(dest, stride_8, DST_2); vis_ld64(ref[0], TMP14); vis_and(TMP6, MASK_7f, TMP6); vis_and(TMP8, MASK_7f, TMP8); vis_padd16(TMP10, TMP6, TMP6); vis_st64(TMP6, dest[0]); vis_padd16(TMP12, TMP8, TMP8); vis_st64_2(TMP8, dest, 8); dest += stride; vis_faligndata(TMP0, TMP2, REF_0); vis_faligndata(TMP2, TMP4, REF_2); vis_xor(DST_0, REF_0, TMP20); vis_and(TMP20, MASK_fe, TMP20); vis_xor(DST_2, REF_2, TMP22); vis_mul8x16(CONST_128, TMP20, TMP20); vis_and(TMP22, MASK_fe, TMP22); vis_and(DST_0, REF_0, TMP24); vis_mul8x16(CONST_128, TMP22, TMP22); vis_and(DST_2, REF_2, TMP26); vis_and(TMP20, MASK_7f, TMP20); vis_and(TMP22, MASK_7f, TMP22); vis_padd16(TMP24, TMP20, TMP20); vis_st64(TMP20, dest[0]); vis_padd16(TMP26, TMP22, TMP22); vis_st64_2(TMP22, dest, 8); } static void MC_avg_no_round_o_8_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { ref = vis_alignaddr(ref); vis_ld64(ref[0], TMP0); vis_ld64(ref[8], TMP2); vis_ld64(dest[0], DST_0); vis_ld64(constants_fe[0], MASK_fe); vis_ld64(constants_7f[0], MASK_7f); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64(constants128[0], CONST_128); ref += stride; height = (height >> 1) - 1; do { /* 12 cycles */ vis_ld64(ref[0], TMP0); vis_xor(DST_0, REF_0, TMP4); vis_ld64(ref[8], TMP2); vis_and(TMP4, MASK_fe, TMP4); vis_and(DST_0, REF_0, TMP6); vis_ld64_2(dest, stride, DST_0); ref += stride; vis_mul8x16(CONST_128, TMP4, TMP4); vis_ld64(ref[0], TMP12); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64(ref[8], TMP2); vis_xor(DST_0, REF_0, TMP0); ref += stride; vis_and(TMP0, MASK_fe, TMP0); vis_and(TMP4, MASK_7f, TMP4); vis_padd16(TMP6, TMP4, TMP4); vis_st64(TMP4, dest[0]); dest += stride; vis_mul8x16(CONST_128, TMP0, TMP0); vis_and(DST_0, REF_0, TMP6); vis_ld64_2(dest, stride, DST_0); vis_faligndata(TMP12, TMP2, REF_0); vis_and(TMP0, MASK_7f, TMP0); vis_padd16(TMP6, TMP0, TMP4); vis_st64(TMP4, dest[0]); dest += stride; } while (--height); vis_ld64(ref[0], TMP0); vis_xor(DST_0, REF_0, TMP4); vis_ld64(ref[8], TMP2); vis_and(TMP4, MASK_fe, TMP4); vis_and(DST_0, REF_0, TMP6); vis_ld64_2(dest, stride, DST_0); vis_mul8x16(CONST_128, TMP4, TMP4); vis_faligndata(TMP0, TMP2, REF_0); vis_xor(DST_0, REF_0, TMP0); vis_and(TMP0, MASK_fe, TMP0); vis_and(TMP4, MASK_7f, TMP4); vis_padd16(TMP6, TMP4, TMP4); vis_st64(TMP4, dest[0]); dest += stride; vis_mul8x16(CONST_128, TMP0, TMP0); vis_and(DST_0, REF_0, TMP6); vis_and(TMP0, MASK_7f, TMP0); vis_padd16(TMP6, TMP0, TMP4); vis_st64(TMP4, dest[0]); } static void MC_put_no_round_x_16_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { unsigned long off = (unsigned long) ref & 0x7; unsigned long off_plus_1 = off + 1; ref = vis_alignaddr(ref); vis_ld64(ref[0], TMP0); vis_ld64_2(ref, 8, TMP2); vis_ld64_2(ref, 16, TMP4); vis_ld64(constants_fe[0], MASK_fe); vis_ld64(constants_7f[0], MASK_7f); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64(constants128[0], CONST_128); vis_faligndata(TMP2, TMP4, REF_4); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_2); vis_faligndata(TMP2, TMP4, REF_6); } else { vis_src1(TMP2, REF_2); vis_src1(TMP4, REF_6); } ref += stride; height = (height >> 1) - 1; do { /* 34 cycles */ vis_ld64(ref[0], TMP0); vis_xor(REF_0, REF_2, TMP6); vis_ld64_2(ref, 8, TMP2); vis_xor(REF_4, REF_6, TMP8); vis_ld64_2(ref, 16, TMP4); vis_and(TMP6, MASK_fe, TMP6); ref += stride; vis_ld64(ref[0], TMP14); vis_mul8x16(CONST_128, TMP6, TMP6); vis_and(TMP8, MASK_fe, TMP8); vis_ld64_2(ref, 8, TMP16); vis_mul8x16(CONST_128, TMP8, TMP8); vis_and(REF_0, REF_2, TMP10); vis_ld64_2(ref, 16, TMP18); ref += stride; vis_and(REF_4, REF_6, TMP12); vis_alignaddr_g0((void *)off); vis_faligndata(TMP0, TMP2, REF_0); vis_faligndata(TMP2, TMP4, REF_4); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_2); vis_faligndata(TMP2, TMP4, REF_6); } else { vis_src1(TMP2, REF_2); vis_src1(TMP4, REF_6); } vis_and(TMP6, MASK_7f, TMP6); vis_and(TMP8, MASK_7f, TMP8); vis_padd16(TMP10, TMP6, TMP6); vis_st64(TMP6, dest[0]); vis_padd16(TMP12, TMP8, TMP8); vis_st64_2(TMP8, dest, 8); dest += stride; vis_xor(REF_0, REF_2, TMP6); vis_xor(REF_4, REF_6, TMP8); vis_and(TMP6, MASK_fe, TMP6); vis_mul8x16(CONST_128, TMP6, TMP6); vis_and(TMP8, MASK_fe, TMP8); vis_mul8x16(CONST_128, TMP8, TMP8); vis_and(REF_0, REF_2, TMP10); vis_and(REF_4, REF_6, TMP12); vis_alignaddr_g0((void *)off); vis_faligndata(TMP14, TMP16, REF_0); vis_faligndata(TMP16, TMP18, REF_4); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP14, TMP16, REF_2); vis_faligndata(TMP16, TMP18, REF_6); } else { vis_src1(TMP16, REF_2); vis_src1(TMP18, REF_6); } vis_and(TMP6, MASK_7f, TMP6); vis_and(TMP8, MASK_7f, TMP8); vis_padd16(TMP10, TMP6, TMP6); vis_st64(TMP6, dest[0]); vis_padd16(TMP12, TMP8, TMP8); vis_st64_2(TMP8, dest, 8); dest += stride; } while (--height); vis_ld64(ref[0], TMP0); vis_xor(REF_0, REF_2, TMP6); vis_ld64_2(ref, 8, TMP2); vis_xor(REF_4, REF_6, TMP8); vis_ld64_2(ref, 16, TMP4); vis_and(TMP6, MASK_fe, TMP6); vis_mul8x16(CONST_128, TMP6, TMP6); vis_and(TMP8, MASK_fe, TMP8); vis_mul8x16(CONST_128, TMP8, TMP8); vis_and(REF_0, REF_2, TMP10); vis_and(REF_4, REF_6, TMP12); vis_alignaddr_g0((void *)off); vis_faligndata(TMP0, TMP2, REF_0); vis_faligndata(TMP2, TMP4, REF_4); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_2); vis_faligndata(TMP2, TMP4, REF_6); } else { vis_src1(TMP2, REF_2); vis_src1(TMP4, REF_6); } vis_and(TMP6, MASK_7f, TMP6); vis_and(TMP8, MASK_7f, TMP8); vis_padd16(TMP10, TMP6, TMP6); vis_st64(TMP6, dest[0]); vis_padd16(TMP12, TMP8, TMP8); vis_st64_2(TMP8, dest, 8); dest += stride; vis_xor(REF_0, REF_2, TMP6); vis_xor(REF_4, REF_6, TMP8); vis_and(TMP6, MASK_fe, TMP6); vis_mul8x16(CONST_128, TMP6, TMP6); vis_and(TMP8, MASK_fe, TMP8); vis_mul8x16(CONST_128, TMP8, TMP8); vis_and(REF_0, REF_2, TMP10); vis_and(REF_4, REF_6, TMP12); vis_and(TMP6, MASK_7f, TMP6); vis_and(TMP8, MASK_7f, TMP8); vis_padd16(TMP10, TMP6, TMP6); vis_st64(TMP6, dest[0]); vis_padd16(TMP12, TMP8, TMP8); vis_st64_2(TMP8, dest, 8); } static void MC_put_no_round_x_8_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { unsigned long off = (unsigned long) ref & 0x7; unsigned long off_plus_1 = off + 1; ref = vis_alignaddr(ref); vis_ld64(ref[0], TMP0); vis_ld64(ref[8], TMP2); vis_ld64(constants_fe[0], MASK_fe); vis_ld64(constants_7f[0], MASK_7f); vis_ld64(constants128[0], CONST_128); vis_faligndata(TMP0, TMP2, REF_0); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_2); } else { vis_src1(TMP2, REF_2); } ref += stride; height = (height >> 1) - 1; do { /* 20 cycles */ vis_ld64(ref[0], TMP0); vis_xor(REF_0, REF_2, TMP4); vis_ld64_2(ref, 8, TMP2); vis_and(TMP4, MASK_fe, TMP4); ref += stride; vis_ld64(ref[0], TMP8); vis_and(REF_0, REF_2, TMP6); vis_mul8x16(CONST_128, TMP4, TMP4); vis_alignaddr_g0((void *)off); vis_ld64_2(ref, 8, TMP10); ref += stride; vis_faligndata(TMP0, TMP2, REF_0); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_2); } else { vis_src1(TMP2, REF_2); } vis_and(TMP4, MASK_7f, TMP4); vis_padd16(TMP6, TMP4, DST_0); vis_st64(DST_0, dest[0]); dest += stride; vis_xor(REF_0, REF_2, TMP12); vis_and(TMP12, MASK_fe, TMP12); vis_and(REF_0, REF_2, TMP14); vis_mul8x16(CONST_128, TMP12, TMP12); vis_alignaddr_g0((void *)off); vis_faligndata(TMP8, TMP10, REF_0); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP8, TMP10, REF_2); } else { vis_src1(TMP10, REF_2); } vis_and(TMP12, MASK_7f, TMP12); vis_padd16(TMP14, TMP12, DST_0); vis_st64(DST_0, dest[0]); dest += stride; } while (--height); vis_ld64(ref[0], TMP0); vis_xor(REF_0, REF_2, TMP4); vis_ld64_2(ref, 8, TMP2); vis_and(TMP4, MASK_fe, TMP4); vis_and(REF_0, REF_2, TMP6); vis_mul8x16(CONST_128, TMP4, TMP4); vis_alignaddr_g0((void *)off); vis_faligndata(TMP0, TMP2, REF_0); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_2); } else { vis_src1(TMP2, REF_2); } vis_and(TMP4, MASK_7f, TMP4); vis_padd16(TMP6, TMP4, DST_0); vis_st64(DST_0, dest[0]); dest += stride; vis_xor(REF_0, REF_2, TMP12); vis_and(TMP12, MASK_fe, TMP12); vis_and(REF_0, REF_2, TMP14); vis_mul8x16(CONST_128, TMP12, TMP12); vis_and(TMP12, MASK_7f, TMP12); vis_padd16(TMP14, TMP12, DST_0); vis_st64(DST_0, dest[0]); dest += stride; } static void MC_avg_no_round_x_16_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { unsigned long off = (unsigned long) ref & 0x7; unsigned long off_plus_1 = off + 1; vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT); vis_ld64(constants3[0], CONST_3); vis_fzero(ZERO); vis_ld64(constants256_512[0], CONST_256); ref = vis_alignaddr(ref); do { /* 26 cycles */ vis_ld64(ref[0], TMP0); vis_ld64(ref[8], TMP2); vis_alignaddr_g0((void *)off); vis_ld64(ref[16], TMP4); vis_ld64(dest[0], DST_0); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64(dest[8], DST_2); vis_faligndata(TMP2, TMP4, REF_4); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_2); vis_faligndata(TMP2, TMP4, REF_6); } else { vis_src1(TMP2, REF_2); vis_src1(TMP4, REF_6); } vis_mul8x16au(REF_0, CONST_256, TMP0); vis_pmerge(ZERO, REF_2, TMP4); vis_mul8x16au(REF_0_1, CONST_256, TMP2); vis_pmerge(ZERO, REF_2_1, TMP6); vis_padd16(TMP0, TMP4, TMP0); vis_mul8x16al(DST_0, CONST_512, TMP4); vis_padd16(TMP2, TMP6, TMP2); vis_mul8x16al(DST_1, CONST_512, TMP6); vis_mul8x16au(REF_6, CONST_256, TMP12); vis_padd16(TMP0, TMP4, TMP0); vis_mul8x16au(REF_6_1, CONST_256, TMP14); vis_padd16(TMP2, TMP6, TMP2); vis_mul8x16au(REF_4, CONST_256, TMP16); vis_padd16(TMP0, CONST_3, TMP8); vis_mul8x16au(REF_4_1, CONST_256, TMP18); vis_padd16(TMP2, CONST_3, TMP10); vis_pack16(TMP8, DST_0); vis_pack16(TMP10, DST_1); vis_padd16(TMP16, TMP12, TMP0); vis_st64(DST_0, dest[0]); vis_mul8x16al(DST_2, CONST_512, TMP4); vis_padd16(TMP18, TMP14, TMP2); vis_mul8x16al(DST_3, CONST_512, TMP6); vis_padd16(TMP0, CONST_3, TMP0); vis_padd16(TMP2, CONST_3, TMP2); vis_padd16(TMP0, TMP4, TMP0); vis_padd16(TMP2, TMP6, TMP2); vis_pack16(TMP0, DST_2); vis_pack16(TMP2, DST_3); vis_st64(DST_2, dest[8]); ref += stride; dest += stride; } while (--height); } static void MC_avg_no_round_x_8_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { unsigned long off = (unsigned long) ref & 0x7; unsigned long off_plus_1 = off + 1; int stride_times_2 = stride << 1; vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT); vis_ld64(constants3[0], CONST_3); vis_fzero(ZERO); vis_ld64(constants256_512[0], CONST_256); ref = vis_alignaddr(ref); height >>= 2; do { /* 47 cycles */ vis_ld64(ref[0], TMP0); vis_ld64_2(ref, 8, TMP2); ref += stride; vis_alignaddr_g0((void *)off); vis_ld64(ref[0], TMP4); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64_2(ref, 8, TMP6); ref += stride; vis_ld64(ref[0], TMP8); vis_ld64_2(ref, 8, TMP10); ref += stride; vis_faligndata(TMP4, TMP6, REF_4); vis_ld64(ref[0], TMP12); vis_ld64_2(ref, 8, TMP14); ref += stride; vis_faligndata(TMP8, TMP10, REF_S0); vis_faligndata(TMP12, TMP14, REF_S4); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_ld64(dest[0], DST_0); vis_faligndata(TMP0, TMP2, REF_2); vis_ld64_2(dest, stride, DST_2); vis_faligndata(TMP4, TMP6, REF_6); vis_faligndata(TMP8, TMP10, REF_S2); vis_faligndata(TMP12, TMP14, REF_S6); } else { vis_ld64(dest[0], DST_0); vis_src1(TMP2, REF_2); vis_ld64_2(dest, stride, DST_2); vis_src1(TMP6, REF_6); vis_src1(TMP10, REF_S2); vis_src1(TMP14, REF_S6); } vis_pmerge(ZERO, REF_0, TMP0); vis_mul8x16au(REF_0_1, CONST_256, TMP2); vis_pmerge(ZERO, REF_2, TMP4); vis_mul8x16au(REF_2_1, CONST_256, TMP6); vis_padd16(TMP0, CONST_3, TMP0); vis_mul8x16al(DST_0, CONST_512, TMP16); vis_padd16(TMP2, CONST_3, TMP2); vis_mul8x16al(DST_1, CONST_512, TMP18); vis_padd16(TMP0, TMP4, TMP0); vis_mul8x16au(REF_4, CONST_256, TMP8); vis_padd16(TMP2, TMP6, TMP2); vis_mul8x16au(REF_4_1, CONST_256, TMP10); vis_padd16(TMP0, TMP16, TMP0); vis_mul8x16au(REF_6, CONST_256, TMP12); vis_padd16(TMP2, TMP18, TMP2); vis_mul8x16au(REF_6_1, CONST_256, TMP14); vis_padd16(TMP8, CONST_3, TMP8); vis_mul8x16al(DST_2, CONST_512, TMP16); vis_padd16(TMP8, TMP12, TMP8); vis_mul8x16al(DST_3, CONST_512, TMP18); vis_padd16(TMP10, TMP14, TMP10); vis_pack16(TMP0, DST_0); vis_pack16(TMP2, DST_1); vis_st64(DST_0, dest[0]); dest += stride; vis_padd16(TMP10, CONST_3, TMP10); vis_ld64_2(dest, stride, DST_0); vis_padd16(TMP8, TMP16, TMP8); vis_ld64_2(dest, stride_times_2, TMP4/*DST_2*/); vis_padd16(TMP10, TMP18, TMP10); vis_pack16(TMP8, DST_2); vis_pack16(TMP10, DST_3); vis_st64(DST_2, dest[0]); dest += stride; vis_mul8x16au(REF_S0_1, CONST_256, TMP2); vis_pmerge(ZERO, REF_S0, TMP0); vis_pmerge(ZERO, REF_S2, TMP24); vis_mul8x16au(REF_S2_1, CONST_256, TMP6); vis_padd16(TMP0, CONST_3, TMP0); vis_mul8x16au(REF_S4, CONST_256, TMP8); vis_padd16(TMP2, CONST_3, TMP2); vis_mul8x16au(REF_S4_1, CONST_256, TMP10); vis_padd16(TMP0, TMP24, TMP0); vis_mul8x16au(REF_S6, CONST_256, TMP12); vis_padd16(TMP2, TMP6, TMP2); vis_mul8x16au(REF_S6_1, CONST_256, TMP14); vis_padd16(TMP8, CONST_3, TMP8); vis_mul8x16al(DST_0, CONST_512, TMP16); vis_padd16(TMP10, CONST_3, TMP10); vis_mul8x16al(DST_1, CONST_512, TMP18); vis_padd16(TMP8, TMP12, TMP8); vis_mul8x16al(TMP4/*DST_2*/, CONST_512, TMP20); vis_mul8x16al(TMP5/*DST_3*/, CONST_512, TMP22); vis_padd16(TMP0, TMP16, TMP0); vis_padd16(TMP2, TMP18, TMP2); vis_pack16(TMP0, DST_0); vis_padd16(TMP10, TMP14, TMP10); vis_pack16(TMP2, DST_1); vis_st64(DST_0, dest[0]); dest += stride; vis_padd16(TMP8, TMP20, TMP8); vis_padd16(TMP10, TMP22, TMP10); vis_pack16(TMP8, DST_2); vis_pack16(TMP10, DST_3); vis_st64(DST_2, dest[0]); dest += stride; } while (--height); } static void MC_put_no_round_y_16_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { ref = vis_alignaddr(ref); vis_ld64(ref[0], TMP0); vis_ld64_2(ref, 8, TMP2); vis_ld64_2(ref, 16, TMP4); ref += stride; vis_ld64(ref[0], TMP6); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64_2(ref, 8, TMP8); vis_faligndata(TMP2, TMP4, REF_4); vis_ld64_2(ref, 16, TMP10); ref += stride; vis_ld64(constants_fe[0], MASK_fe); vis_faligndata(TMP6, TMP8, REF_2); vis_ld64(constants_7f[0], MASK_7f); vis_faligndata(TMP8, TMP10, REF_6); vis_ld64(constants128[0], CONST_128); height = (height >> 1) - 1; do { /* 24 cycles */ vis_ld64(ref[0], TMP0); vis_xor(REF_0, REF_2, TMP12); vis_ld64_2(ref, 8, TMP2); vis_xor(REF_4, REF_6, TMP16); vis_ld64_2(ref, 16, TMP4); ref += stride; vis_and(REF_0, REF_2, TMP14); vis_ld64(ref[0], TMP6); vis_and(REF_4, REF_6, TMP18); vis_ld64_2(ref, 8, TMP8); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64_2(ref, 16, TMP10); ref += stride; vis_faligndata(TMP2, TMP4, REF_4); vis_and(TMP12, MASK_fe, TMP12); vis_and(TMP16, MASK_fe, TMP16); vis_mul8x16(CONST_128, TMP12, TMP12); vis_mul8x16(CONST_128, TMP16, TMP16); vis_xor(REF_0, REF_2, TMP0); vis_xor(REF_4, REF_6, TMP2); vis_and(REF_0, REF_2, TMP20); vis_and(TMP12, MASK_7f, TMP12); vis_and(TMP16, MASK_7f, TMP16); vis_padd16(TMP14, TMP12, TMP12); vis_st64(TMP12, dest[0]); vis_padd16(TMP18, TMP16, TMP16); vis_st64_2(TMP16, dest, 8); dest += stride; vis_and(REF_4, REF_6, TMP18); vis_and(TMP0, MASK_fe, TMP0); vis_and(TMP2, MASK_fe, TMP2); vis_mul8x16(CONST_128, TMP0, TMP0); vis_faligndata(TMP6, TMP8, REF_2); vis_mul8x16(CONST_128, TMP2, TMP2); vis_faligndata(TMP8, TMP10, REF_6); vis_and(TMP0, MASK_7f, TMP0); vis_and(TMP2, MASK_7f, TMP2); vis_padd16(TMP20, TMP0, TMP0); vis_st64(TMP0, dest[0]); vis_padd16(TMP18, TMP2, TMP2); vis_st64_2(TMP2, dest, 8); dest += stride; } while (--height); vis_ld64(ref[0], TMP0); vis_xor(REF_0, REF_2, TMP12); vis_ld64_2(ref, 8, TMP2); vis_xor(REF_4, REF_6, TMP16); vis_ld64_2(ref, 16, TMP4); vis_and(REF_0, REF_2, TMP14); vis_and(REF_4, REF_6, TMP18); vis_faligndata(TMP0, TMP2, REF_0); vis_faligndata(TMP2, TMP4, REF_4); vis_and(TMP12, MASK_fe, TMP12); vis_and(TMP16, MASK_fe, TMP16); vis_mul8x16(CONST_128, TMP12, TMP12); vis_mul8x16(CONST_128, TMP16, TMP16); vis_xor(REF_0, REF_2, TMP0); vis_xor(REF_4, REF_6, TMP2); vis_and(REF_0, REF_2, TMP20); vis_and(TMP12, MASK_7f, TMP12); vis_and(TMP16, MASK_7f, TMP16); vis_padd16(TMP14, TMP12, TMP12); vis_st64(TMP12, dest[0]); vis_padd16(TMP18, TMP16, TMP16); vis_st64_2(TMP16, dest, 8); dest += stride; vis_and(REF_4, REF_6, TMP18); vis_and(TMP0, MASK_fe, TMP0); vis_and(TMP2, MASK_fe, TMP2); vis_mul8x16(CONST_128, TMP0, TMP0); vis_mul8x16(CONST_128, TMP2, TMP2); vis_and(TMP0, MASK_7f, TMP0); vis_and(TMP2, MASK_7f, TMP2); vis_padd16(TMP20, TMP0, TMP0); vis_st64(TMP0, dest[0]); vis_padd16(TMP18, TMP2, TMP2); vis_st64_2(TMP2, dest, 8); } static void MC_put_no_round_y_8_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { ref = vis_alignaddr(ref); vis_ld64(ref[0], TMP0); vis_ld64_2(ref, 8, TMP2); ref += stride; vis_ld64(ref[0], TMP4); vis_ld64_2(ref, 8, TMP6); ref += stride; vis_ld64(constants_fe[0], MASK_fe); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64(constants_7f[0], MASK_7f); vis_faligndata(TMP4, TMP6, REF_2); vis_ld64(constants128[0], CONST_128); height = (height >> 1) - 1; do { /* 12 cycles */ vis_ld64(ref[0], TMP0); vis_xor(REF_0, REF_2, TMP4); vis_ld64_2(ref, 8, TMP2); ref += stride; vis_and(TMP4, MASK_fe, TMP4); vis_and(REF_0, REF_2, TMP6); vis_mul8x16(CONST_128, TMP4, TMP4); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64(ref[0], TMP0); vis_ld64_2(ref, 8, TMP2); ref += stride; vis_xor(REF_0, REF_2, TMP12); vis_and(TMP4, MASK_7f, TMP4); vis_and(TMP12, MASK_fe, TMP12); vis_mul8x16(CONST_128, TMP12, TMP12); vis_and(REF_0, REF_2, TMP14); vis_padd16(TMP6, TMP4, DST_0); vis_st64(DST_0, dest[0]); dest += stride; vis_faligndata(TMP0, TMP2, REF_2); vis_and(TMP12, MASK_7f, TMP12); vis_padd16(TMP14, TMP12, DST_0); vis_st64(DST_0, dest[0]); dest += stride; } while (--height); vis_ld64(ref[0], TMP0); vis_xor(REF_0, REF_2, TMP4); vis_ld64_2(ref, 8, TMP2); vis_and(TMP4, MASK_fe, TMP4); vis_and(REF_0, REF_2, TMP6); vis_mul8x16(CONST_128, TMP4, TMP4); vis_faligndata(TMP0, TMP2, REF_0); vis_xor(REF_0, REF_2, TMP12); vis_and(TMP4, MASK_7f, TMP4); vis_and(TMP12, MASK_fe, TMP12); vis_mul8x16(CONST_128, TMP12, TMP12); vis_and(REF_0, REF_2, TMP14); vis_padd16(TMP6, TMP4, DST_0); vis_st64(DST_0, dest[0]); dest += stride; vis_and(TMP12, MASK_7f, TMP12); vis_padd16(TMP14, TMP12, DST_0); vis_st64(DST_0, dest[0]); } static void MC_avg_no_round_y_16_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { int stride_8 = stride + 8; int stride_16 = stride + 16; vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT); ref = vis_alignaddr(ref); vis_ld64(ref[ 0], TMP0); vis_fzero(ZERO); vis_ld64(ref[ 8], TMP2); vis_ld64(ref[16], TMP4); vis_ld64(constants3[0], CONST_3); vis_faligndata(TMP0, TMP2, REF_2); vis_ld64(constants256_512[0], CONST_256); vis_faligndata(TMP2, TMP4, REF_6); height >>= 1; do { /* 31 cycles */ vis_ld64_2(ref, stride, TMP0); vis_pmerge(ZERO, REF_2, TMP12); vis_mul8x16au(REF_2_1, CONST_256, TMP14); vis_ld64_2(ref, stride_8, TMP2); vis_pmerge(ZERO, REF_6, TMP16); vis_mul8x16au(REF_6_1, CONST_256, TMP18); vis_ld64_2(ref, stride_16, TMP4); ref += stride; vis_ld64(dest[0], DST_0); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64_2(dest, 8, DST_2); vis_faligndata(TMP2, TMP4, REF_4); vis_ld64_2(ref, stride, TMP6); vis_pmerge(ZERO, REF_0, TMP0); vis_mul8x16au(REF_0_1, CONST_256, TMP2); vis_ld64_2(ref, stride_8, TMP8); vis_pmerge(ZERO, REF_4, TMP4); vis_ld64_2(ref, stride_16, TMP10); ref += stride; vis_ld64_2(dest, stride, REF_S0/*DST_4*/); vis_faligndata(TMP6, TMP8, REF_2); vis_mul8x16au(REF_4_1, CONST_256, TMP6); vis_ld64_2(dest, stride_8, REF_S2/*DST_6*/); vis_faligndata(TMP8, TMP10, REF_6); vis_mul8x16al(DST_0, CONST_512, TMP20); vis_padd16(TMP0, CONST_3, TMP0); vis_mul8x16al(DST_1, CONST_512, TMP22); vis_padd16(TMP2, CONST_3, TMP2); vis_mul8x16al(DST_2, CONST_512, TMP24); vis_padd16(TMP4, CONST_3, TMP4); vis_mul8x16al(DST_3, CONST_512, TMP26); vis_padd16(TMP6, CONST_3, TMP6); vis_padd16(TMP12, TMP20, TMP12); vis_mul8x16al(REF_S0, CONST_512, TMP20); vis_padd16(TMP14, TMP22, TMP14); vis_mul8x16al(REF_S0_1, CONST_512, TMP22); vis_padd16(TMP16, TMP24, TMP16); vis_mul8x16al(REF_S2, CONST_512, TMP24); vis_padd16(TMP18, TMP26, TMP18); vis_mul8x16al(REF_S2_1, CONST_512, TMP26); vis_padd16(TMP12, TMP0, TMP12); vis_mul8x16au(REF_2, CONST_256, TMP28); vis_padd16(TMP14, TMP2, TMP14); vis_mul8x16au(REF_2_1, CONST_256, TMP30); vis_padd16(TMP16, TMP4, TMP16); vis_mul8x16au(REF_6, CONST_256, REF_S4); vis_padd16(TMP18, TMP6, TMP18); vis_mul8x16au(REF_6_1, CONST_256, REF_S6); vis_pack16(TMP12, DST_0); vis_padd16(TMP28, TMP0, TMP12); vis_pack16(TMP14, DST_1); vis_st64(DST_0, dest[0]); vis_padd16(TMP30, TMP2, TMP14); vis_pack16(TMP16, DST_2); vis_padd16(REF_S4, TMP4, TMP16); vis_pack16(TMP18, DST_3); vis_st64_2(DST_2, dest, 8); dest += stride; vis_padd16(REF_S6, TMP6, TMP18); vis_padd16(TMP12, TMP20, TMP12); vis_padd16(TMP14, TMP22, TMP14); vis_pack16(TMP12, DST_0); vis_padd16(TMP16, TMP24, TMP16); vis_pack16(TMP14, DST_1); vis_st64(DST_0, dest[0]); vis_padd16(TMP18, TMP26, TMP18); vis_pack16(TMP16, DST_2); vis_pack16(TMP18, DST_3); vis_st64_2(DST_2, dest, 8); dest += stride; } while (--height); } static void MC_avg_no_round_y_8_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { int stride_8 = stride + 8; vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT); ref = vis_alignaddr(ref); vis_ld64(ref[ 0], TMP0); vis_fzero(ZERO); vis_ld64(ref[ 8], TMP2); vis_ld64(constants3[0], CONST_3); vis_faligndata(TMP0, TMP2, REF_2); vis_ld64(constants256_512[0], CONST_256); height >>= 1; do { /* 20 cycles */ vis_ld64_2(ref, stride, TMP0); vis_pmerge(ZERO, REF_2, TMP8); vis_mul8x16au(REF_2_1, CONST_256, TMP10); vis_ld64_2(ref, stride_8, TMP2); ref += stride; vis_ld64(dest[0], DST_0); vis_ld64_2(dest, stride, DST_2); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64_2(ref, stride, TMP4); vis_mul8x16al(DST_0, CONST_512, TMP16); vis_pmerge(ZERO, REF_0, TMP12); vis_ld64_2(ref, stride_8, TMP6); ref += stride; vis_mul8x16al(DST_1, CONST_512, TMP18); vis_pmerge(ZERO, REF_0_1, TMP14); vis_padd16(TMP12, CONST_3, TMP12); vis_mul8x16al(DST_2, CONST_512, TMP24); vis_padd16(TMP14, CONST_3, TMP14); vis_mul8x16al(DST_3, CONST_512, TMP26); vis_faligndata(TMP4, TMP6, REF_2); vis_padd16(TMP8, TMP12, TMP8); vis_padd16(TMP10, TMP14, TMP10); vis_mul8x16au(REF_2, CONST_256, TMP20); vis_padd16(TMP8, TMP16, TMP0); vis_mul8x16au(REF_2_1, CONST_256, TMP22); vis_padd16(TMP10, TMP18, TMP2); vis_pack16(TMP0, DST_0); vis_pack16(TMP2, DST_1); vis_st64(DST_0, dest[0]); dest += stride; vis_padd16(TMP12, TMP20, TMP12); vis_padd16(TMP14, TMP22, TMP14); vis_padd16(TMP12, TMP24, TMP0); vis_padd16(TMP14, TMP26, TMP2); vis_pack16(TMP0, DST_2); vis_pack16(TMP2, DST_3); vis_st64(DST_2, dest[0]); dest += stride; } while (--height); } static void MC_put_no_round_xy_16_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { unsigned long off = (unsigned long) ref & 0x7; unsigned long off_plus_1 = off + 1; int stride_8 = stride + 8; int stride_16 = stride + 16; vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT); ref = vis_alignaddr(ref); vis_ld64(ref[ 0], TMP0); vis_fzero(ZERO); vis_ld64(ref[ 8], TMP2); vis_ld64(ref[16], TMP4); vis_ld64(constants1[0], CONST_1); vis_faligndata(TMP0, TMP2, REF_S0); vis_ld64(constants256_512[0], CONST_256); vis_faligndata(TMP2, TMP4, REF_S4); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_S2); vis_faligndata(TMP2, TMP4, REF_S6); } else { vis_src1(TMP2, REF_S2); vis_src1(TMP4, REF_S6); } height >>= 1; do { vis_ld64_2(ref, stride, TMP0); vis_mul8x16au(REF_S0, CONST_256, TMP12); vis_pmerge(ZERO, REF_S0_1, TMP14); vis_alignaddr_g0((void *)off); vis_ld64_2(ref, stride_8, TMP2); vis_mul8x16au(REF_S2, CONST_256, TMP16); vis_pmerge(ZERO, REF_S2_1, TMP18); vis_ld64_2(ref, stride_16, TMP4); ref += stride; vis_mul8x16au(REF_S4, CONST_256, TMP20); vis_pmerge(ZERO, REF_S4_1, TMP22); vis_ld64_2(ref, stride, TMP6); vis_mul8x16au(REF_S6, CONST_256, TMP24); vis_pmerge(ZERO, REF_S6_1, TMP26); vis_ld64_2(ref, stride_8, TMP8); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64_2(ref, stride_16, TMP10); ref += stride; vis_faligndata(TMP2, TMP4, REF_4); vis_faligndata(TMP6, TMP8, REF_S0); vis_faligndata(TMP8, TMP10, REF_S4); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_2); vis_faligndata(TMP2, TMP4, REF_6); vis_faligndata(TMP6, TMP8, REF_S2); vis_faligndata(TMP8, TMP10, REF_S6); } else { vis_src1(TMP2, REF_2); vis_src1(TMP4, REF_6); vis_src1(TMP8, REF_S2); vis_src1(TMP10, REF_S6); } vis_mul8x16au(REF_0, CONST_256, TMP0); vis_pmerge(ZERO, REF_0_1, TMP2); vis_mul8x16au(REF_2, CONST_256, TMP4); vis_pmerge(ZERO, REF_2_1, TMP6); vis_padd16(TMP0, CONST_2, TMP8); vis_mul8x16au(REF_4, CONST_256, TMP0); vis_padd16(TMP2, CONST_1, TMP10); vis_mul8x16au(REF_4_1, CONST_256, TMP2); vis_padd16(TMP8, TMP4, TMP8); vis_mul8x16au(REF_6, CONST_256, TMP4); vis_padd16(TMP10, TMP6, TMP10); vis_mul8x16au(REF_6_1, CONST_256, TMP6); vis_padd16(TMP12, TMP8, TMP12); vis_padd16(TMP14, TMP10, TMP14); vis_padd16(TMP12, TMP16, TMP12); vis_padd16(TMP14, TMP18, TMP14); vis_pack16(TMP12, DST_0); vis_pack16(TMP14, DST_1); vis_st64(DST_0, dest[0]); vis_padd16(TMP0, CONST_1, TMP12); vis_mul8x16au(REF_S0, CONST_256, TMP0); vis_padd16(TMP2, CONST_1, TMP14); vis_mul8x16au(REF_S0_1, CONST_256, TMP2); vis_padd16(TMP12, TMP4, TMP12); vis_mul8x16au(REF_S2, CONST_256, TMP4); vis_padd16(TMP14, TMP6, TMP14); vis_mul8x16au(REF_S2_1, CONST_256, TMP6); vis_padd16(TMP20, TMP12, TMP20); vis_padd16(TMP22, TMP14, TMP22); vis_padd16(TMP20, TMP24, TMP20); vis_padd16(TMP22, TMP26, TMP22); vis_pack16(TMP20, DST_2); vis_pack16(TMP22, DST_3); vis_st64_2(DST_2, dest, 8); dest += stride; vis_padd16(TMP0, TMP4, TMP24); vis_mul8x16au(REF_S4, CONST_256, TMP0); vis_padd16(TMP2, TMP6, TMP26); vis_mul8x16au(REF_S4_1, CONST_256, TMP2); vis_padd16(TMP24, TMP8, TMP24); vis_padd16(TMP26, TMP10, TMP26); vis_pack16(TMP24, DST_0); vis_pack16(TMP26, DST_1); vis_st64(DST_0, dest[0]); vis_pmerge(ZERO, REF_S6, TMP4); vis_pmerge(ZERO, REF_S6_1, TMP6); vis_padd16(TMP0, TMP4, TMP0); vis_padd16(TMP2, TMP6, TMP2); vis_padd16(TMP0, TMP12, TMP0); vis_padd16(TMP2, TMP14, TMP2); vis_pack16(TMP0, DST_2); vis_pack16(TMP2, DST_3); vis_st64_2(DST_2, dest, 8); dest += stride; } while (--height); } static void MC_put_no_round_xy_8_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { unsigned long off = (unsigned long) ref & 0x7; unsigned long off_plus_1 = off + 1; int stride_8 = stride + 8; vis_set_gsr(5 << VIS_GSR_SCALEFACT_SHIFT); ref = vis_alignaddr(ref); vis_ld64(ref[ 0], TMP0); vis_fzero(ZERO); vis_ld64(ref[ 8], TMP2); vis_ld64(constants1[0], CONST_1); vis_ld64(constants256_512[0], CONST_256); vis_faligndata(TMP0, TMP2, REF_S0); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_S2); } else { vis_src1(TMP2, REF_S2); } height >>= 1; do { /* 26 cycles */ vis_ld64_2(ref, stride, TMP0); vis_mul8x16au(REF_S0, CONST_256, TMP8); vis_pmerge(ZERO, REF_S2, TMP12); vis_alignaddr_g0((void *)off); vis_ld64_2(ref, stride_8, TMP2); ref += stride; vis_mul8x16au(REF_S0_1, CONST_256, TMP10); vis_pmerge(ZERO, REF_S2_1, TMP14); vis_ld64_2(ref, stride, TMP4); vis_ld64_2(ref, stride_8, TMP6); ref += stride; vis_faligndata(TMP0, TMP2, REF_S4); vis_pmerge(ZERO, REF_S4, TMP18); vis_pmerge(ZERO, REF_S4_1, TMP20); vis_faligndata(TMP4, TMP6, REF_S0); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_S6); vis_faligndata(TMP4, TMP6, REF_S2); } else { vis_src1(TMP2, REF_S6); vis_src1(TMP6, REF_S2); } vis_padd16(TMP18, CONST_1, TMP18); vis_mul8x16au(REF_S6, CONST_256, TMP22); vis_padd16(TMP20, CONST_1, TMP20); vis_mul8x16au(REF_S6_1, CONST_256, TMP24); vis_mul8x16au(REF_S0, CONST_256, TMP26); vis_pmerge(ZERO, REF_S0_1, TMP28); vis_mul8x16au(REF_S2, CONST_256, TMP30); vis_padd16(TMP18, TMP22, TMP18); vis_mul8x16au(REF_S2_1, CONST_256, TMP32); vis_padd16(TMP20, TMP24, TMP20); vis_padd16(TMP8, TMP18, TMP8); vis_padd16(TMP10, TMP20, TMP10); vis_padd16(TMP8, TMP12, TMP8); vis_padd16(TMP10, TMP14, TMP10); vis_pack16(TMP8, DST_0); vis_pack16(TMP10, DST_1); vis_st64(DST_0, dest[0]); dest += stride; vis_padd16(TMP18, TMP26, TMP18); vis_padd16(TMP20, TMP28, TMP20); vis_padd16(TMP18, TMP30, TMP18); vis_padd16(TMP20, TMP32, TMP20); vis_pack16(TMP18, DST_2); vis_pack16(TMP20, DST_3); vis_st64(DST_2, dest[0]); dest += stride; } while (--height); } static void MC_avg_no_round_xy_16_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { unsigned long off = (unsigned long) ref & 0x7; unsigned long off_plus_1 = off + 1; int stride_8 = stride + 8; int stride_16 = stride + 16; vis_set_gsr(4 << VIS_GSR_SCALEFACT_SHIFT); ref = vis_alignaddr(ref); vis_ld64(ref[ 0], TMP0); vis_fzero(ZERO); vis_ld64(ref[ 8], TMP2); vis_ld64(ref[16], TMP4); vis_ld64(constants6[0], CONST_6); vis_faligndata(TMP0, TMP2, REF_S0); vis_ld64(constants256_1024[0], CONST_256); vis_faligndata(TMP2, TMP4, REF_S4); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_S2); vis_faligndata(TMP2, TMP4, REF_S6); } else { vis_src1(TMP2, REF_S2); vis_src1(TMP4, REF_S6); } height >>= 1; do { /* 55 cycles */ vis_ld64_2(ref, stride, TMP0); vis_mul8x16au(REF_S0, CONST_256, TMP12); vis_pmerge(ZERO, REF_S0_1, TMP14); vis_alignaddr_g0((void *)off); vis_ld64_2(ref, stride_8, TMP2); vis_mul8x16au(REF_S2, CONST_256, TMP16); vis_pmerge(ZERO, REF_S2_1, TMP18); vis_ld64_2(ref, stride_16, TMP4); ref += stride; vis_mul8x16au(REF_S4, CONST_256, TMP20); vis_pmerge(ZERO, REF_S4_1, TMP22); vis_ld64_2(ref, stride, TMP6); vis_mul8x16au(REF_S6, CONST_256, TMP24); vis_pmerge(ZERO, REF_S6_1, TMP26); vis_ld64_2(ref, stride_8, TMP8); vis_faligndata(TMP0, TMP2, REF_0); vis_ld64_2(ref, stride_16, TMP10); ref += stride; vis_faligndata(TMP2, TMP4, REF_4); vis_ld64(dest[0], DST_0); vis_faligndata(TMP6, TMP8, REF_S0); vis_ld64_2(dest, 8, DST_2); vis_faligndata(TMP8, TMP10, REF_S4); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_2); vis_faligndata(TMP2, TMP4, REF_6); vis_faligndata(TMP6, TMP8, REF_S2); vis_faligndata(TMP8, TMP10, REF_S6); } else { vis_src1(TMP2, REF_2); vis_src1(TMP4, REF_6); vis_src1(TMP8, REF_S2); vis_src1(TMP10, REF_S6); } vis_mul8x16al(DST_0, CONST_1024, TMP30); vis_pmerge(ZERO, REF_0, TMP0); vis_mul8x16al(DST_1, CONST_1024, TMP32); vis_pmerge(ZERO, REF_0_1, TMP2); vis_mul8x16au(REF_2, CONST_256, TMP4); vis_pmerge(ZERO, REF_2_1, TMP6); vis_mul8x16al(DST_2, CONST_1024, REF_0); vis_padd16(TMP0, CONST_6, TMP0); vis_mul8x16al(DST_3, CONST_1024, REF_2); vis_padd16(TMP2, CONST_6, TMP2); vis_padd16(TMP0, TMP4, TMP0); vis_mul8x16au(REF_4, CONST_256, TMP4); vis_padd16(TMP2, TMP6, TMP2); vis_mul8x16au(REF_4_1, CONST_256, TMP6); vis_padd16(TMP12, TMP0, TMP12); vis_mul8x16au(REF_6, CONST_256, TMP8); vis_padd16(TMP14, TMP2, TMP14); vis_mul8x16au(REF_6_1, CONST_256, TMP10); vis_padd16(TMP12, TMP16, TMP12); vis_mul8x16au(REF_S0, CONST_256, REF_4); vis_padd16(TMP14, TMP18, TMP14); vis_mul8x16au(REF_S0_1, CONST_256, REF_6); vis_padd16(TMP12, TMP30, TMP12); vis_padd16(TMP14, TMP32, TMP14); vis_pack16(TMP12, DST_0); vis_pack16(TMP14, DST_1); vis_st64(DST_0, dest[0]); vis_padd16(TMP4, CONST_6, TMP4); vis_ld64_2(dest, stride, DST_0); vis_padd16(TMP6, CONST_6, TMP6); vis_mul8x16au(REF_S2, CONST_256, TMP12); vis_padd16(TMP4, TMP8, TMP4); vis_mul8x16au(REF_S2_1, CONST_256, TMP14); vis_padd16(TMP6, TMP10, TMP6); vis_padd16(TMP20, TMP4, TMP20); vis_padd16(TMP22, TMP6, TMP22); vis_padd16(TMP20, TMP24, TMP20); vis_padd16(TMP22, TMP26, TMP22); vis_padd16(TMP20, REF_0, TMP20); vis_mul8x16au(REF_S4, CONST_256, REF_0); vis_padd16(TMP22, REF_2, TMP22); vis_pack16(TMP20, DST_2); vis_pack16(TMP22, DST_3); vis_st64_2(DST_2, dest, 8); dest += stride; vis_ld64_2(dest, 8, DST_2); vis_mul8x16al(DST_0, CONST_1024, TMP30); vis_pmerge(ZERO, REF_S4_1, REF_2); vis_mul8x16al(DST_1, CONST_1024, TMP32); vis_padd16(REF_4, TMP0, TMP8); vis_mul8x16au(REF_S6, CONST_256, REF_4); vis_padd16(REF_6, TMP2, TMP10); vis_mul8x16au(REF_S6_1, CONST_256, REF_6); vis_padd16(TMP8, TMP12, TMP8); vis_padd16(TMP10, TMP14, TMP10); vis_padd16(TMP8, TMP30, TMP8); vis_padd16(TMP10, TMP32, TMP10); vis_pack16(TMP8, DST_0); vis_pack16(TMP10, DST_1); vis_st64(DST_0, dest[0]); vis_padd16(REF_0, TMP4, REF_0); vis_mul8x16al(DST_2, CONST_1024, TMP30); vis_padd16(REF_2, TMP6, REF_2); vis_mul8x16al(DST_3, CONST_1024, TMP32); vis_padd16(REF_0, REF_4, REF_0); vis_padd16(REF_2, REF_6, REF_2); vis_padd16(REF_0, TMP30, REF_0); /* stall */ vis_padd16(REF_2, TMP32, REF_2); vis_pack16(REF_0, DST_2); vis_pack16(REF_2, DST_3); vis_st64_2(DST_2, dest, 8); dest += stride; } while (--height); } static void MC_avg_no_round_xy_8_vis (uint8_t * dest, const uint8_t * ref, const int stride, int height) { unsigned long off = (unsigned long) ref & 0x7; unsigned long off_plus_1 = off + 1; int stride_8 = stride + 8; vis_set_gsr(4 << VIS_GSR_SCALEFACT_SHIFT); ref = vis_alignaddr(ref); vis_ld64(ref[0], TMP0); vis_fzero(ZERO); vis_ld64_2(ref, 8, TMP2); vis_ld64(constants6[0], CONST_6); vis_ld64(constants256_1024[0], CONST_256); vis_faligndata(TMP0, TMP2, REF_S0); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_S2); } else { vis_src1(TMP2, REF_S2); } height >>= 1; do { /* 31 cycles */ vis_ld64_2(ref, stride, TMP0); vis_mul8x16au(REF_S0, CONST_256, TMP8); vis_pmerge(ZERO, REF_S0_1, TMP10); vis_ld64_2(ref, stride_8, TMP2); ref += stride; vis_mul8x16au(REF_S2, CONST_256, TMP12); vis_pmerge(ZERO, REF_S2_1, TMP14); vis_alignaddr_g0((void *)off); vis_ld64_2(ref, stride, TMP4); vis_faligndata(TMP0, TMP2, REF_S4); vis_ld64_2(ref, stride_8, TMP6); ref += stride; vis_ld64(dest[0], DST_0); vis_faligndata(TMP4, TMP6, REF_S0); vis_ld64_2(dest, stride, DST_2); if (off != 0x7) { vis_alignaddr_g0((void *)off_plus_1); vis_faligndata(TMP0, TMP2, REF_S6); vis_faligndata(TMP4, TMP6, REF_S2); } else { vis_src1(TMP2, REF_S6); vis_src1(TMP6, REF_S2); } vis_mul8x16al(DST_0, CONST_1024, TMP30); vis_pmerge(ZERO, REF_S4, TMP22); vis_mul8x16al(DST_1, CONST_1024, TMP32); vis_pmerge(ZERO, REF_S4_1, TMP24); vis_mul8x16au(REF_S6, CONST_256, TMP26); vis_pmerge(ZERO, REF_S6_1, TMP28); vis_mul8x16au(REF_S0, CONST_256, REF_S4); vis_padd16(TMP22, CONST_6, TMP22); vis_mul8x16au(REF_S0_1, CONST_256, REF_S6); vis_padd16(TMP24, CONST_6, TMP24); vis_mul8x16al(DST_2, CONST_1024, REF_0); vis_padd16(TMP22, TMP26, TMP22); vis_mul8x16al(DST_3, CONST_1024, REF_2); vis_padd16(TMP24, TMP28, TMP24); vis_mul8x16au(REF_S2, CONST_256, TMP26); vis_padd16(TMP8, TMP22, TMP8); vis_mul8x16au(REF_S2_1, CONST_256, TMP28); vis_padd16(TMP10, TMP24, TMP10); vis_padd16(TMP8, TMP12, TMP8); vis_padd16(TMP10, TMP14, TMP10); vis_padd16(TMP8, TMP30, TMP8); vis_padd16(TMP10, TMP32, TMP10); vis_pack16(TMP8, DST_0); vis_pack16(TMP10, DST_1); vis_st64(DST_0, dest[0]); dest += stride; vis_padd16(REF_S4, TMP22, TMP12); vis_padd16(REF_S6, TMP24, TMP14); vis_padd16(TMP12, TMP26, TMP12); vis_padd16(TMP14, TMP28, TMP14); vis_padd16(TMP12, REF_0, TMP12); vis_padd16(TMP14, REF_2, TMP14); vis_pack16(TMP12, DST_2); vis_pack16(TMP14, DST_3); vis_st64(DST_2, dest[0]); dest += stride; } while (--height); } /* End of no rounding code */ #define ACCEL_SPARC_VIS 1 #define ACCEL_SPARC_VIS2 2 static int vis_level(void) { int accel = 0; accel |= ACCEL_SPARC_VIS; accel |= ACCEL_SPARC_VIS2; return accel; } /* libavcodec initialization code */ void dsputil_init_vis(DSPContext* c, AVCodecContext *avctx) { /* VIS-specific optimizations */ int accel = vis_level (); if (accel & ACCEL_SPARC_VIS) { if(avctx->idct_algo==FF_IDCT_SIMPLEVIS){ c->idct_put = ff_simple_idct_put_vis; c->idct_add = ff_simple_idct_add_vis; c->idct = ff_simple_idct_vis; c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; } c->put_pixels_tab[0][0] = MC_put_o_16_vis; c->put_pixels_tab[0][1] = MC_put_x_16_vis; c->put_pixels_tab[0][2] = MC_put_y_16_vis; c->put_pixels_tab[0][3] = MC_put_xy_16_vis; c->put_pixels_tab[1][0] = MC_put_o_8_vis; c->put_pixels_tab[1][1] = MC_put_x_8_vis; c->put_pixels_tab[1][2] = MC_put_y_8_vis; c->put_pixels_tab[1][3] = MC_put_xy_8_vis; c->avg_pixels_tab[0][0] = MC_avg_o_16_vis; c->avg_pixels_tab[0][1] = MC_avg_x_16_vis; c->avg_pixels_tab[0][2] = MC_avg_y_16_vis; c->avg_pixels_tab[0][3] = MC_avg_xy_16_vis; c->avg_pixels_tab[1][0] = MC_avg_o_8_vis; c->avg_pixels_tab[1][1] = MC_avg_x_8_vis; c->avg_pixels_tab[1][2] = MC_avg_y_8_vis; c->avg_pixels_tab[1][3] = MC_avg_xy_8_vis; c->put_no_rnd_pixels_tab[0][0] = MC_put_no_round_o_16_vis; c->put_no_rnd_pixels_tab[0][1] = MC_put_no_round_x_16_vis; c->put_no_rnd_pixels_tab[0][2] = MC_put_no_round_y_16_vis; c->put_no_rnd_pixels_tab[0][3] = MC_put_no_round_xy_16_vis; c->put_no_rnd_pixels_tab[1][0] = MC_put_no_round_o_8_vis; c->put_no_rnd_pixels_tab[1][1] = MC_put_no_round_x_8_vis; c->put_no_rnd_pixels_tab[1][2] = MC_put_no_round_y_8_vis; c->put_no_rnd_pixels_tab[1][3] = MC_put_no_round_xy_8_vis; c->avg_no_rnd_pixels_tab[0][0] = MC_avg_no_round_o_16_vis; c->avg_no_rnd_pixels_tab[0][1] = MC_avg_no_round_x_16_vis; c->avg_no_rnd_pixels_tab[0][2] = MC_avg_no_round_y_16_vis; c->avg_no_rnd_pixels_tab[0][3] = MC_avg_no_round_xy_16_vis; c->avg_no_rnd_pixels_tab[1][0] = MC_avg_no_round_o_8_vis; c->avg_no_rnd_pixels_tab[1][1] = MC_avg_no_round_x_8_vis; c->avg_no_rnd_pixels_tab[1][2] = MC_avg_no_round_y_8_vis; c->avg_no_rnd_pixels_tab[1][3] = MC_avg_no_round_xy_8_vis; } }
123linslouis-android-video-cutter
jni/libavcodec/sparc/dsputil_vis.c
C
asf20
120,600
/* * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVCODEC_SPARC_DSPUTIL_VIS_H #define AVCODEC_SPARC_DSPUTIL_VIS_H #include <stdint.h> #include "libavcodec/dsputil.h" void ff_simple_idct_put_vis(uint8_t *dest, int line_size, DCTELEM *data); void ff_simple_idct_add_vis(uint8_t *dest, int line_size, DCTELEM *data); void ff_simple_idct_vis(DCTELEM *data); #endif
123linslouis-android-video-cutter
jni/libavcodec/sparc/dsputil_vis.h
C
asf20
1,086
/* * MPEG-4 Parametric Stereo definitions and declarations * Copyright (c) 2010 Alex Converse <alex.converse@gmail.com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVCODEC_PS_H #define AVCODEC_PS_H #include <stdint.h> #include "avcodec.h" #include "get_bits.h" #define PS_MAX_NUM_ENV 5 #define PS_MAX_NR_IIDICC 34 #define PS_MAX_NR_IPDOPD 17 #define PS_MAX_SSB 91 #define PS_MAX_AP_BANDS 50 #define PS_QMF_TIME_SLOTS 32 #define PS_MAX_DELAY 14 #define PS_AP_LINKS 3 #define PS_MAX_AP_DELAY 5 typedef struct { int start; int enable_iid; int iid_quant; int nr_iid_par; int nr_ipdopd_par; int enable_icc; int icc_mode; int nr_icc_par; int enable_ext; int frame_class; int num_env_old; int num_env; int enable_ipdopd; int border_position[PS_MAX_NUM_ENV+1]; int8_t iid_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; //<Inter-channel Intensity Difference Parameters int8_t icc_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; //<Inter-Channel Coherence Parameters /* ipd/opd is iid/icc sized so that the same functions can handle both */ int8_t ipd_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; //<Inter-channel Phase Difference Parameters int8_t opd_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; //<Overall Phase Difference Parameters int is34bands; int is34bands_old; float in_buf[5][44][2]; float delay[PS_MAX_SSB][PS_QMF_TIME_SLOTS + PS_MAX_DELAY][2]; float ap_delay[PS_MAX_AP_BANDS][PS_AP_LINKS][PS_QMF_TIME_SLOTS + PS_MAX_AP_DELAY][2]; float peak_decay_nrg[34]; float power_smooth[34]; float peak_decay_diff_smooth[34]; float H11[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]; float H12[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]; float H21[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]; float H22[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]; int8_t opd_hist[PS_MAX_NR_IIDICC]; int8_t ipd_hist[PS_MAX_NR_IIDICC]; } PSContext; void ff_ps_init(void); void ff_ps_ctx_init(PSContext *ps); int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb, PSContext *ps, int bits_left); int ff_ps_apply(AVCodecContext *avctx, PSContext *ps, float L[2][38][64], float R[2][38][64], int top); #endif /* AVCODEC_PS_H */
123linslouis-android-video-cutter
jni/libavcodec/aacps.h
C
asf20
2,980
/* * RV10 encoder * Copyright (c) 2000,2001 Fabrice Bellard * Copyright (c) 2002-2004 Michael Niedermayer * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * RV10 encoder */ #include "mpegvideo.h" #include "put_bits.h" void rv10_encode_picture_header(MpegEncContext *s, int picture_number) { int full_frame= 0; align_put_bits(&s->pb); put_bits(&s->pb, 1, 1); /* marker */ put_bits(&s->pb, 1, (s->pict_type == FF_P_TYPE)); put_bits(&s->pb, 1, 0); /* not PB frame */ put_bits(&s->pb, 5, s->qscale); if (s->pict_type == FF_I_TYPE) { /* specific MPEG like DC coding not used */ } /* if multiple packets per frame are sent, the position at which to display the macroblocks is coded here */ if(!full_frame){ put_bits(&s->pb, 6, 0); /* mb_x */ put_bits(&s->pb, 6, 0); /* mb_y */ put_bits(&s->pb, 12, s->mb_width * s->mb_height); } put_bits(&s->pb, 3, 0); /* ignored */ } AVCodec rv10_encoder = { "rv10", AVMEDIA_TYPE_VIDEO, CODEC_ID_RV10, sizeof(MpegEncContext), MPV_encode_init, MPV_encode_picture, MPV_encode_end, .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, .long_name= NULL_IF_CONFIG_SMALL("RealVideo 1.0"), };
123linslouis-android-video-cutter
jni/libavcodec/rv10enc.c
C
asf20
2,010
/* * (c) 2001 Fabrice Bellard * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * motion test. */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <sys/time.h> #include <unistd.h> #include "config.h" #include "dsputil.h" #include "libavutil/lfg.h" #undef exit #undef printf #define WIDTH 64 #define HEIGHT 64 uint8_t img1[WIDTH * HEIGHT]; uint8_t img2[WIDTH * HEIGHT]; static void fill_random(uint8_t *tab, int size) { int i; AVLFG prng; av_lfg_init(&prng, 1); for(i=0;i<size;i++) { #if 1 tab[i] = av_lfg_get(&prng) % 256; #else tab[i] = i; #endif } } static void help(void) { printf("motion-test [-h]\n" "test motion implementations\n"); exit(1); } static int64_t gettime(void) { struct timeval tv; gettimeofday(&tv,NULL); return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec; } #define NB_ITS 500 int dummy; static void test_motion(const char *name, me_cmp_func test_func, me_cmp_func ref_func) { int x, y, d1, d2, it; uint8_t *ptr; int64_t ti; printf("testing '%s'\n", name); /* test correctness */ for(it=0;it<20;it++) { fill_random(img1, WIDTH * HEIGHT); fill_random(img2, WIDTH * HEIGHT); for(y=0;y<HEIGHT-17;y++) { for(x=0;x<WIDTH-17;x++) { ptr = img2 + y * WIDTH + x; d1 = test_func(NULL, img1, ptr, WIDTH, 1); d2 = ref_func(NULL, img1, ptr, WIDTH, 1); if (d1 != d2) { printf("error: mmx=%d c=%d\n", d1, d2); } } } } emms_c(); /* speed test */ ti = gettime(); d1 = 0; for(it=0;it<NB_ITS;it++) { for(y=0;y<HEIGHT-17;y++) { for(x=0;x<WIDTH-17;x++) { ptr = img2 + y * WIDTH + x; d1 += test_func(NULL, img1, ptr, WIDTH, 1); } } } emms_c(); dummy = d1; /* avoid optimization */ ti = gettime() - ti; printf(" %0.0f kop/s\n", (double)NB_ITS * (WIDTH - 16) * (HEIGHT - 16) / (double)(ti / 1000.0)); } int main(int argc, char **argv) { AVCodecContext *ctx; int c; DSPContext cctx, mmxctx; int flags[2] = { FF_MM_MMX, FF_MM_MMX2 }; int flags_size = HAVE_MMX2 ? 2 : 1; for(;;) { c = getopt(argc, argv, "h"); if (c == -1) break; switch(c) { case 'h': help(); break; } } printf("ffmpeg motion test\n"); ctx = avcodec_alloc_context(); ctx->dsp_mask = FF_MM_FORCE; dsputil_init(&cctx, ctx); for (c = 0; c < flags_size; c++) { int x; ctx->dsp_mask = FF_MM_FORCE | flags[c]; dsputil_init(&mmxctx, ctx); for (x = 0; x < 2; x++) { printf("%s for %dx%d pixels\n", c ? "mmx2" : "mmx", x ? 8 : 16, x ? 8 : 16); test_motion("mmx", mmxctx.pix_abs[x][0], cctx.pix_abs[x][0]); test_motion("mmx_x2", mmxctx.pix_abs[x][1], cctx.pix_abs[x][1]); test_motion("mmx_y2", mmxctx.pix_abs[x][2], cctx.pix_abs[x][2]); test_motion("mmx_xy2", mmxctx.pix_abs[x][3], cctx.pix_abs[x][3]); } } av_free(ctx); return 0; }
123linslouis-android-video-cutter
jni/libavcodec/motion-test.c
C
asf20
4,018
/* * AVOptions * copyright (c) 2005 Michael Niedermayer <michaelni@gmx.at> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVCODEC_OPT_H #define AVCODEC_OPT_H /** * @file * AVOptions */ #include "libavutil/rational.h" #include "avcodec.h" enum AVOptionType{ FF_OPT_TYPE_FLAGS, FF_OPT_TYPE_INT, FF_OPT_TYPE_INT64, FF_OPT_TYPE_DOUBLE, FF_OPT_TYPE_FLOAT, FF_OPT_TYPE_STRING, FF_OPT_TYPE_RATIONAL, FF_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length FF_OPT_TYPE_CONST=128, }; /** * AVOption */ typedef struct AVOption { const char *name; /** * short English help text * @todo What about other languages? */ const char *help; /** * The offset relative to the context structure where the option * value is stored. It should be 0 for named constants. */ int offset; enum AVOptionType type; /** * the default value for scalar options */ double default_val; double min; ///< minimum valid value for the option double max; ///< maximum valid value for the option int flags; #define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding #define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding #define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ... #define AV_OPT_FLAG_AUDIO_PARAM 8 #define AV_OPT_FLAG_VIDEO_PARAM 16 #define AV_OPT_FLAG_SUBTITLE_PARAM 32 //FIXME think about enc-audio, ... style flags /** * The logical unit to which the option belongs. Non-constant * options and corresponding named constants share the same * unit. May be NULL. */ const char *unit; } AVOption; /** * AVOption2. * THIS IS NOT PART OF THE API/ABI YET! * This is identical to AVOption except that default_val was replaced by * an union, it should be compatible with AVOption on normal platforms. */ typedef struct AVOption2 { const char *name; /** * short English help text * @todo What about other languages? */ const char *help; /** * The offset relative to the context structure where the option * value is stored. It should be 0 for named constants. */ int offset; enum AVOptionType type; /** * the default value for scalar options */ union { double dbl; const char *str; } default_val; double min; ///< minimum valid value for the option double max; ///< maximum valid value for the option int flags; /* #define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding #define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding #define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ... #define AV_OPT_FLAG_AUDIO_PARAM 8 #define AV_OPT_FLAG_VIDEO_PARAM 16 #define AV_OPT_FLAG_SUBTITLE_PARAM 32 */ //FIXME think about enc-audio, ... style flags /** * The logical unit to which the option belongs. Non-constant * options and corresponding named constants share the same * unit. May be NULL. */ const char *unit; } AVOption2; /** * Looks for an option in obj. Looks only for the options which * have the flags set as specified in mask and flags (that is, * for which it is the case that opt->flags & mask == flags). * * @param[in] obj a pointer to a struct whose first element is a * pointer to an AVClass * @param[in] name the name of the option to look for * @param[in] unit the unit of the option to look for, or any if NULL * @return a pointer to the option found, or NULL if no option * has been found */ const AVOption *av_find_opt(void *obj, const char *name, const char *unit, int mask, int flags); #if LIBAVCODEC_VERSION_MAJOR < 53 /** * @see av_set_string2() */ attribute_deprecated const AVOption *av_set_string(void *obj, const char *name, const char *val); /** * @return a pointer to the AVOption corresponding to the field set or * NULL if no matching AVOption exists, or if the value val is not * valid * @see av_set_string3() */ attribute_deprecated const AVOption *av_set_string2(void *obj, const char *name, const char *val, int alloc); #endif /** * Sets the field of obj with the given name to value. * * @param[in] obj A struct whose first element is a pointer to an * AVClass. * @param[in] name the name of the field to set * @param[in] val The value to set. If the field is not of a string * type, then the given string is parsed. * SI postfixes and some named scalars are supported. * If the field is of a numeric type, it has to be a numeric or named * scalar. Behavior with more than one scalar and +- infix operators * is undefined. * If the field is of a flags type, it has to be a sequence of numeric * scalars or named flags separated by '+' or '-'. Prefixing a flag * with '+' causes it to be set without affecting the other flags; * similarly, '-' unsets a flag. * @param[out] o_out if non-NULL put here a pointer to the AVOption * found * @param alloc when 1 then the old value will be av_freed() and the * new av_strduped() * when 0 then no av_free() nor av_strdup() will be used * @return 0 if the value has been set, or an AVERROR code in case of * error: * AVERROR(ENOENT) if no matching option exists * AVERROR(ERANGE) if the value is out of range * AVERROR(EINVAL) if the value is not valid */ int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out); const AVOption *av_set_double(void *obj, const char *name, double n); const AVOption *av_set_q(void *obj, const char *name, AVRational n); const AVOption *av_set_int(void *obj, const char *name, int64_t n); double av_get_double(void *obj, const char *name, const AVOption **o_out); AVRational av_get_q(void *obj, const char *name, const AVOption **o_out); int64_t av_get_int(void *obj, const char *name, const AVOption **o_out); const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len); const AVOption *av_next_option(void *obj, const AVOption *last); int av_opt_show(void *obj, void *av_log_obj); void av_opt_set_defaults(void *s); void av_opt_set_defaults2(void *s, int mask, int flags); #endif /* AVCODEC_OPT_H */
123linslouis-android-video-cutter
jni/libavcodec/opt.h
C
asf20
7,367
/* * exp golomb vlc stuff * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * @brief * exp golomb vlc stuff * @author Michael Niedermayer <michaelni@gmx.at> */ #include "libavutil/common.h" const uint8_t ff_golomb_vlc_len[512]={ 14,13,12,12,11,11,11,11,10,10,10,10,10,10,10,10,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }; const uint8_t ff_ue_golomb_vlc_code[512]={ 31,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; const int8_t ff_se_golomb_vlc_code[512]={ 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 8, -8, 9, -9, 10,-10, 11,-11, 12,-12, 13,-13, 14,-14, 15,-15, 4, 4, 4, 4, -4, -4, -4, -4, 5, 5, 5, 5, -5, -5, -5, -5, 6, 6, 6, 6, -6, -6, -6, -6, 7, 7, 7, 7, -7, -7, -7, -7, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; const uint8_t ff_ue_golomb_len[256]={ 1, 3, 3, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,13, 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,15, 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,17, }; const uint8_t ff_interleaved_golomb_vlc_len[256]={ 9,9,7,7,9,9,7,7,5,5,5,5,5,5,5,5, 9,9,7,7,9,9,7,7,5,5,5,5,5,5,5,5, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 9,9,7,7,9,9,7,7,5,5,5,5,5,5,5,5, 9,9,7,7,9,9,7,7,5,5,5,5,5,5,5,5, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, }; const uint8_t ff_interleaved_ue_golomb_vlc_code[256]={ 15,16,7, 7, 17,18,8, 8, 3, 3, 3, 3, 3, 3, 3, 3, 19,20,9, 9, 21,22,10,10,4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 23,24,11,11,25,26,12,12,5, 5, 5, 5, 5, 5, 5, 5, 27,28,13,13,29,30,14,14,6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; const int8_t ff_interleaved_se_golomb_vlc_code[256]={ 8, -8, 4, 4, 9, -9, -4, -4, 2, 2, 2, 2, 2, 2, 2, 2, 10,-10, 5, 5, 11,-11, -5, -5, -2, -2, -2, -2, -2, -2, -2, -2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 12,-12, 6, 6, 13,-13, -6, -6, 3, 3, 3, 3, 3, 3, 3, 3, 14,-14, 7, 7, 15,-15, -7, -7, -3, -3, -3, -3, -3, -3, -3, -3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; const uint8_t ff_interleaved_dirac_golomb_vlc_code[256]={ 0, 1, 0, 0, 2, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 2, 2, 6, 7, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 9, 4, 4, 10,11,5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 12,13,6, 6, 14,15,7, 7, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,};
123linslouis-android-video-cutter
jni/libavcodec/golomb.c
C
asf20
9,966
/* * MPEG1/2 common code * Copyright (c) 2007 Aurelien Jacobs <aurel@gnuage.org> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVCODEC_MPEG12_H #define AVCODEC_MPEG12_H #include "mpegvideo.h" #define DC_VLC_BITS 9 #define TEX_VLC_BITS 9 static VLC dc_lum_vlc; static VLC dc_chroma_vlc; extern uint8_t ff_mpeg12_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3]; void ff_mpeg12_common_init(MpegEncContext *s); void ff_mpeg12_init_vlcs(void); static inline int decode_dc(GetBitContext *gb, int component) { int code, diff; if (component == 0) { code = get_vlc2(gb, dc_lum_vlc.table, DC_VLC_BITS, 2); } else { code = get_vlc2(gb, dc_chroma_vlc.table, DC_VLC_BITS, 2); } if (code < 0){ av_log(NULL, AV_LOG_ERROR, "invalid dc code at\n"); return 0xffff; } if (code == 0) { diff = 0; } else { diff = get_xbits(gb, code); } return diff; } extern int ff_mpeg1_decode_block_intra(MpegEncContext *s, DCTELEM *block, int n); #endif /* AVCODEC_MPEG12_H */
123linslouis-android-video-cutter
jni/libavcodec/mpeg12.h
C
asf20
1,774
/* * ATI VCR1 codec * Copyright (c) 2003 Michael Niedermayer * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * ati vcr1 codec. */ #include "avcodec.h" #include "dsputil.h" //#undef NDEBUG //#include <assert.h> /* Disable the encoder. */ #undef CONFIG_VCR1_ENCODER #define CONFIG_VCR1_ENCODER 0 typedef struct VCR1Context{ AVCodecContext *avctx; AVFrame picture; int delta[16]; int offset[4]; } VCR1Context; static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; VCR1Context * const a = avctx->priv_data; AVFrame *picture = data; AVFrame * const p= (AVFrame*)&a->picture; const uint8_t *bytestream= buf; int i, x, y; if(p->data[0]) avctx->release_buffer(avctx, p); p->reference= 0; if(avctx->get_buffer(avctx, p) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } p->pict_type= FF_I_TYPE; p->key_frame= 1; for(i=0; i<16; i++){ a->delta[i]= *(bytestream++); bytestream++; } for(y=0; y<avctx->height; y++){ int offset; uint8_t *luma= &a->picture.data[0][ y*a->picture.linesize[0] ]; if((y&3) == 0){ uint8_t *cb= &a->picture.data[1][ (y>>2)*a->picture.linesize[1] ]; uint8_t *cr= &a->picture.data[2][ (y>>2)*a->picture.linesize[2] ]; for(i=0; i<4; i++) a->offset[i]= *(bytestream++); offset= a->offset[0] - a->delta[ bytestream[2]&0xF ]; for(x=0; x<avctx->width; x+=4){ luma[0]=( offset += a->delta[ bytestream[2]&0xF ]); luma[1]=( offset += a->delta[ bytestream[2]>>4 ]); luma[2]=( offset += a->delta[ bytestream[0]&0xF ]); luma[3]=( offset += a->delta[ bytestream[0]>>4 ]); luma += 4; *(cb++) = bytestream[3]; *(cr++) = bytestream[1]; bytestream+= 4; } }else{ offset= a->offset[y&3] - a->delta[ bytestream[2]&0xF ]; for(x=0; x<avctx->width; x+=8){ luma[0]=( offset += a->delta[ bytestream[2]&0xF ]); luma[1]=( offset += a->delta[ bytestream[2]>>4 ]); luma[2]=( offset += a->delta[ bytestream[3]&0xF ]); luma[3]=( offset += a->delta[ bytestream[3]>>4 ]); luma[4]=( offset += a->delta[ bytestream[0]&0xF ]); luma[5]=( offset += a->delta[ bytestream[0]>>4 ]); luma[6]=( offset += a->delta[ bytestream[1]&0xF ]); luma[7]=( offset += a->delta[ bytestream[1]>>4 ]); luma += 8; bytestream+= 4; } } } *picture= *(AVFrame*)&a->picture; *data_size = sizeof(AVPicture); emms_c(); return buf_size; } #if CONFIG_VCR1_ENCODER static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){ VCR1Context * const a = avctx->priv_data; AVFrame *pict = data; AVFrame * const p= (AVFrame*)&a->picture; int size; *p = *pict; p->pict_type= FF_I_TYPE; p->key_frame= 1; emms_c(); align_put_bits(&a->pb); while(get_bit_count(&a->pb)&31) put_bits(&a->pb, 8, 0); size= get_bit_count(&a->pb)/32; return size*4; } #endif static av_cold void common_init(AVCodecContext *avctx){ VCR1Context * const a = avctx->priv_data; avctx->coded_frame= (AVFrame*)&a->picture; a->avctx= avctx; } static av_cold int decode_init(AVCodecContext *avctx){ common_init(avctx); avctx->pix_fmt= PIX_FMT_YUV410P; return 0; } static av_cold int decode_end(AVCodecContext *avctx){ VCR1Context *s = avctx->priv_data; if (s->picture.data[0]) avctx->release_buffer(avctx, &s->picture); return 0; } #if CONFIG_VCR1_ENCODER static av_cold int encode_init(AVCodecContext *avctx){ common_init(avctx); return 0; } #endif AVCodec vcr1_decoder = { "vcr1", AVMEDIA_TYPE_VIDEO, CODEC_ID_VCR1, sizeof(VCR1Context), decode_init, NULL, decode_end, decode_frame, CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("ATI VCR1"), }; #if CONFIG_VCR1_ENCODER AVCodec vcr1_encoder = { "vcr1", AVMEDIA_TYPE_VIDEO, CODEC_ID_VCR1, sizeof(VCR1Context), encode_init, encode_frame, //encode_end, .long_name = NULL_IF_CONFIG_SMALL("ATI VCR1"), }; #endif
123linslouis-android-video-cutter
jni/libavcodec/vcr1.c
C
asf20
5,316
/* * 8088flex TMV video decoder * Copyright (c) 2009 Daniel Verkamp <daniel at drv.nu> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * 8088flex TMV video decoder * @file * @author Daniel Verkamp * @sa http://www.oldskool.org/pc/8088_Corruption */ #include "avcodec.h" #include "cga_data.h" typedef struct TMVContext { AVFrame pic; } TMVContext; static int tmv_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { TMVContext *tmv = avctx->priv_data; const uint8_t *src = avpkt->data; uint8_t *dst, *dst_char; unsigned char_cols = avctx->width >> 3; unsigned char_rows = avctx->height >> 3; unsigned x, y, mask, char_y, fg, bg, c; if (tmv->pic.data[0]) avctx->release_buffer(avctx, &tmv->pic); if (avctx->get_buffer(avctx, &tmv->pic) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } if (avpkt->size < 2*char_rows*char_cols) { av_log(avctx, AV_LOG_ERROR, "Input buffer too small, truncated sample?\n"); *data_size = 0; return -1; } tmv->pic.pict_type = FF_I_TYPE; tmv->pic.key_frame = 1; dst = tmv->pic.data[0]; tmv->pic.palette_has_changed = 1; memcpy(tmv->pic.data[1], ff_cga_palette, 16 * 4); for (y = 0; y < char_rows; y++) { for (x = 0; x < char_cols; x++) { c = *src++ * 8; bg = *src >> 4; fg = *src++ & 0xF; dst_char = dst + x * 8; for (char_y = 0; char_y < 8; char_y++) { for (mask = 0x80; mask; mask >>= 1) { *dst_char++ = ff_cga_font[c + char_y] & mask ? fg : bg; } dst_char += tmv->pic.linesize[0] - 8; } } dst += tmv->pic.linesize[0] * 8; } *data_size = sizeof(AVFrame); *(AVFrame *)data = tmv->pic; return avpkt->size; } static av_cold int tmv_decode_close(AVCodecContext *avctx) { TMVContext *tmv = avctx->priv_data; if (tmv->pic.data[0]) avctx->release_buffer(avctx, &tmv->pic); return 0; } AVCodec tmv_decoder = { .name = "tmv", .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_TMV, .priv_data_size = sizeof(TMVContext), .close = tmv_decode_close, .decode = tmv_decode_frame, .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("8088flex TMV"), };
123linslouis-android-video-cutter
jni/libavcodec/tmv.c
C
asf20
3,239
/* * SVQ1 decoder * ported to MPlayer by Arpi <arpi@thot.banki.hu> * ported to libavcodec by Nick Kurshev <nickols_k@mail.ru> * * Copyright (C) 2002 the xine project * Copyright (C) 2002 the ffmpeg project * * SVQ1 Encoder (c) 2004 Mike Melanson <melanson@pcisys.net> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * Sorenson Vector Quantizer #1 (SVQ1) video codec. * For more information of the SVQ1 algorithm, visit: * http://www.pcisys.net/~melanson/codecs/ */ #include "svq1.h" #include "svq1_cb.h" #include "svq1_vlc.h" /* standard video sizes */ const struct svq1_frame_size ff_svq1_frame_size_table[7] = { { 160, 120 }, { 128, 96 }, { 176, 144 }, { 352, 288 }, { 704, 576 }, { 240, 180 }, { 320, 240 } };
123linslouis-android-video-cutter
jni/libavcodec/svq1.c
C
asf20
1,463
/* * RV30/40 decoder common data declarations * Copyright (c) 2007 Mike Melanson, Konstantin Shishkov * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * RV30 and RV40 decoder common data declarations */ #ifndef AVCODEC_RV34_H #define AVCODEC_RV34_H #include "avcodec.h" #include "dsputil.h" #include "mpegvideo.h" #include "h264pred.h" #define MB_TYPE_SEPARATE_DC 0x01000000 #define IS_SEPARATE_DC(a) ((a) & MB_TYPE_SEPARATE_DC) /** * RV30 and RV40 Macroblock types */ enum RV40BlockTypes{ RV34_MB_TYPE_INTRA, ///< Intra macroblock RV34_MB_TYPE_INTRA16x16, ///< Intra macroblock with DCs in a separate 4x4 block RV34_MB_P_16x16, ///< P-frame macroblock, one motion frame RV34_MB_P_8x8, ///< P-frame macroblock, 8x8 motion compensation partitions RV34_MB_B_FORWARD, ///< B-frame macroblock, forward prediction RV34_MB_B_BACKWARD, ///< B-frame macroblock, backward prediction RV34_MB_SKIP, ///< Skipped block RV34_MB_B_DIRECT, ///< Bidirectionally predicted B-frame macroblock, no motion vectors RV34_MB_P_16x8, ///< P-frame macroblock, 16x8 motion compensation partitions RV34_MB_P_8x16, ///< P-frame macroblock, 8x16 motion compensation partitions RV34_MB_B_BIDIR, ///< Bidirectionally predicted B-frame macroblock, two motion vectors RV34_MB_P_MIX16x16, ///< P-frame macroblock with DCs in a separate 4x4 block, one motion vector RV34_MB_TYPES }; /** * VLC tables used by the decoder * * Intra frame VLC sets do not contain some of those tables. */ typedef struct RV34VLC{ VLC cbppattern[2]; ///< VLCs used for pattern of coded block patterns decoding VLC cbp[2][4]; ///< VLCs used for coded block patterns decoding VLC first_pattern[4]; ///< VLCs used for decoding coefficients in the first subblock VLC second_pattern[2]; ///< VLCs used for decoding coefficients in the subblocks 2 and 3 VLC third_pattern[2]; ///< VLCs used for decoding coefficients in the last subblock VLC coefficient; ///< VLCs used for decoding big coefficients }RV34VLC; /** essential slice information */ typedef struct SliceInfo{ int type; ///< slice type (intra, inter) int quant; ///< quantizer used for this slice int vlc_set; ///< VLCs used for this slice int start, end; ///< start and end macroblocks of the slice int width; ///< coded width int height; ///< coded height int pts; ///< frame timestamp }SliceInfo; /** decoder context */ typedef struct RV34DecContext{ MpegEncContext s; int8_t *intra_types_hist;///< old block types, used for prediction int8_t *intra_types; ///< block types int intra_types_stride;///< block types array stride const uint8_t *luma_dc_quant_i;///< luma subblock DC quantizer for intraframes const uint8_t *luma_dc_quant_p;///< luma subblock DC quantizer for interframes RV34VLC *cur_vlcs; ///< VLC set used for current frame decoding int bits; ///< slice size in bits H264PredContext h; ///< functions for 4x4 and 16x16 intra block prediction SliceInfo si; ///< current slice information int *mb_type; ///< internal macroblock types int block_type; ///< current block type int luma_vlc; ///< which VLC set will be used for decoding of luma blocks int chroma_vlc; ///< which VLC set will be used for decoding of chroma blocks int is16; ///< current block has additional 16x16 specific features or not int dmv[4][2]; ///< differential motion vectors for the current macroblock int rv30; ///< indicates which RV variasnt is currently decoded int rpr; ///< one field size in RV30 slice header int cur_pts, last_pts, next_pts; uint16_t *cbp_luma; ///< CBP values for luma subblocks uint8_t *cbp_chroma; ///< CBP values for chroma subblocks int *deblock_coefs; ///< deblock coefficients for each macroblock /** 8x8 block available flags (for MV prediction) */ DECLARE_ALIGNED(8, uint32_t, avail_cache)[3*4]; int (*parse_slice_header)(struct RV34DecContext *r, GetBitContext *gb, SliceInfo *si); int (*decode_mb_info)(struct RV34DecContext *r); int (*decode_intra_types)(struct RV34DecContext *r, GetBitContext *gb, int8_t *dst); void (*loop_filter)(struct RV34DecContext *r, int row); }RV34DecContext; /** * common decoding functions */ int ff_rv34_get_start_offset(GetBitContext *gb, int blocks); int ff_rv34_decode_init(AVCodecContext *avctx); int ff_rv34_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt); int ff_rv34_decode_end(AVCodecContext *avctx); #endif /* AVCODEC_RV34_H */
123linslouis-android-video-cutter
jni/libavcodec/rv34.h
C
asf20
5,637
/* * CAF common code * Copyright (c) 2007 Justin Ruggles * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * CAF common code */ #ifndef AVFORMAT_CAF_H #define AVFORMAT_CAF_H #include "riff.h" extern const AVCodecTag ff_codec_caf_tags[]; #endif /* AVFORMAT_CAF_H */
123linslouis-android-video-cutter
jni/libavformat/caf.h
C
asf20
1,001
/* * FLI/FLC Animation File Demuxer * Copyright (c) 2003 The ffmpeg Project * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * FLI/FLC file demuxer * by Mike Melanson (melanson@pcisys.net) * for more information on the .fli/.flc file format and all of its many * variations, visit: * http://www.compuphase.com/flic.htm * * This demuxer handles standard 0xAF11- and 0xAF12-type FLIs. It also handles * special FLIs from the PC games "Magic Carpet" and "X-COM: Terror from the Deep". */ #include "libavutil/intreadwrite.h" #include "avformat.h" #define FLIC_FILE_MAGIC_1 0xAF11 #define FLIC_FILE_MAGIC_2 0xAF12 #define FLIC_FILE_MAGIC_3 0xAF44 /* Flic Type for Extended FLX Format which originated in Dave's Targa Animator (DTA) */ #define FLIC_CHUNK_MAGIC_1 0xF1FA #define FLIC_CHUNK_MAGIC_2 0xF5FA #define FLIC_MC_SPEED 5 /* speed for Magic Carpet game FLIs */ #define FLIC_DEFAULT_SPEED 5 /* for FLIs that have 0 speed */ #define FLIC_TFTD_CHUNK_AUDIO 0xAAAA /* Audio chunk. Used in Terror from the Deep. Has 10 B extra header not accounted for in the chunk header */ #define FLIC_TFTD_SAMPLE_RATE 22050 #define FLIC_HEADER_SIZE 128 #define FLIC_PREAMBLE_SIZE 6 typedef struct FlicDemuxContext { int video_stream_index; int audio_stream_index; int frame_number; } FlicDemuxContext; static int flic_probe(AVProbeData *p) { int magic_number; if(p->buf_size < FLIC_HEADER_SIZE) return 0; magic_number = AV_RL16(&p->buf[4]); if ((magic_number != FLIC_FILE_MAGIC_1) && (magic_number != FLIC_FILE_MAGIC_2) && (magic_number != FLIC_FILE_MAGIC_3)) return 0; if(AV_RL16(&p->buf[0x10]) != FLIC_CHUNK_MAGIC_1){ if(AV_RL32(&p->buf[0x10]) > 2000) return 0; } if( AV_RL16(&p->buf[0x08]) > 4096 || AV_RL16(&p->buf[0x0A]) > 4096) return 0; return AVPROBE_SCORE_MAX; } static int flic_read_header(AVFormatContext *s, AVFormatParameters *ap) { FlicDemuxContext *flic = s->priv_data; ByteIOContext *pb = s->pb; unsigned char header[FLIC_HEADER_SIZE]; AVStream *st, *ast; int speed; int magic_number; unsigned char preamble[FLIC_PREAMBLE_SIZE]; flic->frame_number = 0; /* load the whole header and pull out the width and height */ if (get_buffer(pb, header, FLIC_HEADER_SIZE) != FLIC_HEADER_SIZE) return AVERROR(EIO); magic_number = AV_RL16(&header[4]); speed = AV_RL32(&header[0x10]); if (speed == 0) speed = FLIC_DEFAULT_SPEED; /* initialize the decoder streams */ st = av_new_stream(s, 0); if (!st) return AVERROR(ENOMEM); flic->video_stream_index = st->index; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_FLIC; st->codec->codec_tag = 0; /* no fourcc */ st->codec->width = AV_RL16(&header[0x08]); st->codec->height = AV_RL16(&header[0x0A]); if (!st->codec->width || !st->codec->height) { /* Ugly hack needed for the following sample: */ /* http://samples.mplayerhq.hu/fli-flc/fli-bugs/specular.flc */ av_log(s, AV_LOG_WARNING, "File with no specified width/height. Trying 640x480.\n"); st->codec->width = 640; st->codec->height = 480; } /* send over the whole 128-byte FLIC header */ st->codec->extradata_size = FLIC_HEADER_SIZE; st->codec->extradata = av_malloc(FLIC_HEADER_SIZE); memcpy(st->codec->extradata, header, FLIC_HEADER_SIZE); /* peek at the preamble to detect TFTD videos - they seem to always start with an audio chunk */ if (get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE) != FLIC_PREAMBLE_SIZE) { av_log(s, AV_LOG_ERROR, "Failed to peek at preamble\n"); return AVERROR(EIO); } url_fseek(pb, -FLIC_PREAMBLE_SIZE, SEEK_CUR); /* Time to figure out the framerate: * If the first preamble's magic number is 0xAAAA then this file is from * X-COM: Terror from the Deep. If on the other hand there is a FLIC chunk * magic number at offset 0x10 assume this file is from Magic Carpet instead. * If neither of the above is true then this is a normal FLIC file. */ if (AV_RL16(&preamble[4]) == FLIC_TFTD_CHUNK_AUDIO) { /* TFTD videos have an extra 22050 Hz 8-bit mono audio stream */ ast = av_new_stream(s, 1); if (!ast) return AVERROR(ENOMEM); flic->audio_stream_index = ast->index; /* all audio frames are the same size, so use the size of the first chunk for block_align */ ast->codec->block_align = AV_RL32(&preamble[0]); ast->codec->codec_type = CODEC_TYPE_AUDIO; ast->codec->codec_id = CODEC_ID_PCM_U8; ast->codec->codec_tag = 0; ast->codec->sample_rate = FLIC_TFTD_SAMPLE_RATE; ast->codec->channels = 1; ast->codec->sample_fmt = SAMPLE_FMT_U8; ast->codec->bit_rate = st->codec->sample_rate * 8; ast->codec->bits_per_coded_sample = 8; ast->codec->channel_layout = CH_LAYOUT_MONO; ast->codec->extradata_size = 0; /* Since the header information is incorrect we have to figure out the * framerate using block_align and the fact that the audio is 22050 Hz. * We usually have two cases: 2205 -> 10 fps and 1470 -> 15 fps */ av_set_pts_info(st, 64, ast->codec->block_align, FLIC_TFTD_SAMPLE_RATE); av_set_pts_info(ast, 64, 1, FLIC_TFTD_SAMPLE_RATE); } else if (AV_RL16(&header[0x10]) == FLIC_CHUNK_MAGIC_1) { av_set_pts_info(st, 64, FLIC_MC_SPEED, 70); /* rewind the stream since the first chunk is at offset 12 */ url_fseek(pb, 12, SEEK_SET); /* send over abbreviated FLIC header chunk */ av_free(st->codec->extradata); st->codec->extradata_size = 12; st->codec->extradata = av_malloc(12); memcpy(st->codec->extradata, header, 12); } else if (magic_number == FLIC_FILE_MAGIC_1) { av_set_pts_info(st, 64, speed, 70); } else if ((magic_number == FLIC_FILE_MAGIC_2) || (magic_number == FLIC_FILE_MAGIC_3)) { av_set_pts_info(st, 64, speed, 1000); } else { av_log(s, AV_LOG_INFO, "Invalid or unsupported magic chunk in file\n"); return AVERROR_INVALIDDATA; } return 0; } static int flic_read_packet(AVFormatContext *s, AVPacket *pkt) { FlicDemuxContext *flic = s->priv_data; ByteIOContext *pb = s->pb; int packet_read = 0; unsigned int size; int magic; int ret = 0; unsigned char preamble[FLIC_PREAMBLE_SIZE]; while (!packet_read) { if ((ret = get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE)) != FLIC_PREAMBLE_SIZE) { ret = AVERROR(EIO); break; } size = AV_RL32(&preamble[0]); magic = AV_RL16(&preamble[4]); if (((magic == FLIC_CHUNK_MAGIC_1) || (magic == FLIC_CHUNK_MAGIC_2)) && size > FLIC_PREAMBLE_SIZE) { if (av_new_packet(pkt, size)) { ret = AVERROR(EIO); break; } pkt->stream_index = flic->video_stream_index; pkt->pts = flic->frame_number++; pkt->pos = url_ftell(pb); memcpy(pkt->data, preamble, FLIC_PREAMBLE_SIZE); ret = get_buffer(pb, pkt->data + FLIC_PREAMBLE_SIZE, size - FLIC_PREAMBLE_SIZE); if (ret != size - FLIC_PREAMBLE_SIZE) { av_free_packet(pkt); ret = AVERROR(EIO); } packet_read = 1; } else if (magic == FLIC_TFTD_CHUNK_AUDIO) { if (av_new_packet(pkt, size)) { ret = AVERROR(EIO); break; } /* skip useless 10B sub-header (yes, it's not accounted for in the chunk header) */ url_fseek(pb, 10, SEEK_CUR); pkt->stream_index = flic->audio_stream_index; pkt->pos = url_ftell(pb); ret = get_buffer(pb, pkt->data, size); if (ret != size) { av_free_packet(pkt); ret = AVERROR(EIO); } packet_read = 1; } else { /* not interested in this chunk */ url_fseek(pb, size - 6, SEEK_CUR); } } return ret; } AVInputFormat flic_demuxer = { "flic", NULL_IF_CONFIG_SMALL("FLI/FLC/FLX animation format"), sizeof(FlicDemuxContext), flic_probe, flic_read_header, flic_read_packet, };
123linslouis-android-video-cutter
jni/libavformat/flic.c
C
asf20
9,365
/* * copyright (c) 2009 Michael Niedermayer * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include <strings.h> #include "avformat.h" #include "metadata.h" AVMetadataTag * av_metadata_get(AVMetadata *m, const char *key, const AVMetadataTag *prev, int flags) { unsigned int i, j; if(!m) return NULL; if(prev) i= prev - m->elems + 1; else i= 0; for(; i<m->count; i++){ const char *s= m->elems[i].key; if(flags & AV_METADATA_MATCH_CASE) for(j=0; s[j] == key[j] && key[j]; j++); else for(j=0; toupper(s[j]) == toupper(key[j]) && key[j]; j++); if(key[j]) continue; if(s[j] && !(flags & AV_METADATA_IGNORE_SUFFIX)) continue; return &m->elems[i]; } return NULL; } int av_metadata_set2(AVMetadata **pm, const char *key, const char *value, int flags) { AVMetadata *m= *pm; AVMetadataTag *tag= av_metadata_get(m, key, NULL, AV_METADATA_MATCH_CASE); if(!m) m=*pm= av_mallocz(sizeof(*m)); if(tag){ if (flags & AV_METADATA_DONT_OVERWRITE) return 0; av_free(tag->value); av_free(tag->key); *tag= m->elems[--m->count]; }else{ AVMetadataTag *tmp= av_realloc(m->elems, (m->count+1) * sizeof(*m->elems)); if(tmp){ m->elems= tmp; }else return AVERROR(ENOMEM); } if(value){ if(flags & AV_METADATA_DONT_STRDUP_KEY){ m->elems[m->count].key = key; }else m->elems[m->count].key = av_strdup(key ); if(flags & AV_METADATA_DONT_STRDUP_VAL){ m->elems[m->count].value= value; }else m->elems[m->count].value= av_strdup(value); m->count++; } if(!m->count) { av_free(m->elems); av_freep(pm); } return 0; } #if LIBAVFORMAT_VERSION_MAJOR == 52 int av_metadata_set(AVMetadata **pm, const char *key, const char *value) { return av_metadata_set2(pm, key, value, 0); } #endif void av_metadata_free(AVMetadata **pm) { AVMetadata *m= *pm; if(m){ while(m->count--){ av_free(m->elems[m->count].key); av_free(m->elems[m->count].value); } av_free(m->elems); } av_freep(pm); } void metadata_conv(AVMetadata **pm, const AVMetadataConv *d_conv, const AVMetadataConv *s_conv) { /* TODO: use binary search to look up the two conversion tables if the tables are getting big enough that it would matter speed wise */ const AVMetadataConv *sc, *dc; AVMetadataTag *mtag = NULL; AVMetadata *dst = NULL; const char *key; while((mtag=av_metadata_get(*pm, "", mtag, AV_METADATA_IGNORE_SUFFIX))) { key = mtag->key; if (s_conv != d_conv) { if (s_conv) for (sc=s_conv; sc->native; sc++) if (!strcasecmp(key, sc->native)) { key = sc->generic; break; } if (d_conv) for (dc=d_conv; dc->native; dc++) if (!strcasecmp(key, dc->generic)) { key = dc->native; break; } } av_metadata_set2(&dst, key, mtag->value, 0); } av_metadata_free(pm); *pm = dst; } void av_metadata_conv(AVFormatContext *ctx, const AVMetadataConv *d_conv, const AVMetadataConv *s_conv) { int i; metadata_conv(&ctx->metadata, d_conv, s_conv); for (i=0; i<ctx->nb_streams ; i++) metadata_conv(&ctx->streams [i]->metadata, d_conv, s_conv); for (i=0; i<ctx->nb_chapters; i++) metadata_conv(&ctx->chapters[i]->metadata, d_conv, s_conv); for (i=0; i<ctx->nb_programs; i++) metadata_conv(&ctx->programs[i]->metadata, d_conv, s_conv); }
123linslouis-android-video-cutter
jni/libavformat/metadata.c
C
asf20
4,673
/* * RTSP definitions * Copyright (c) 2002 Fabrice Bellard * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVFORMAT_RTSP_H #define AVFORMAT_RTSP_H #include <stdint.h> #include "avformat.h" #include "rtspcodes.h" #include "rtpdec.h" #include "network.h" #include "httpauth.h" /** * Network layer over which RTP/etc packet data will be transported. */ enum RTSPLowerTransport { RTSP_LOWER_TRANSPORT_UDP = 0, /**< UDP/unicast */ RTSP_LOWER_TRANSPORT_TCP = 1, /**< TCP; interleaved in RTSP */ RTSP_LOWER_TRANSPORT_UDP_MULTICAST = 2, /**< UDP/multicast */ RTSP_LOWER_TRANSPORT_NB }; /** * Packet profile of the data that we will be receiving. Real servers * commonly send RDT (although they can sometimes send RTP as well), * whereas most others will send RTP. */ enum RTSPTransport { RTSP_TRANSPORT_RTP, /**< Standards-compliant RTP */ RTSP_TRANSPORT_RDT, /**< Realmedia Data Transport */ RTSP_TRANSPORT_NB }; #define RTSP_DEFAULT_PORT 554 #define RTSP_MAX_TRANSPORTS 8 #define RTSP_TCP_MAX_PACKET_SIZE 1472 #define RTSP_DEFAULT_NB_AUDIO_CHANNELS 2 #define RTSP_DEFAULT_AUDIO_SAMPLERATE 44100 #define RTSP_RTP_PORT_MIN 5000 #define RTSP_RTP_PORT_MAX 10000 /** * This describes a single item in the "Transport:" line of one stream as * negotiated by the SETUP RTSP command. Multiple transports are comma- * separated ("Transport: x-read-rdt/tcp;interleaved=0-1,rtp/avp/udp; * client_port=1000-1001;server_port=1800-1801") and described in separate * RTSPTransportFields. */ typedef struct RTSPTransportField { /** interleave ids, if TCP transport; each TCP/RTSP data packet starts * with a '$', stream length and stream ID. If the stream ID is within * the range of this interleaved_min-max, then the packet belongs to * this stream. */ int interleaved_min, interleaved_max; /** UDP multicast port range; the ports to which we should connect to * receive multicast UDP data. */ int port_min, port_max; /** UDP client ports; these should be the local ports of the UDP RTP * (and RTCP) sockets over which we receive RTP/RTCP data. */ int client_port_min, client_port_max; /** UDP unicast server port range; the ports to which we should connect * to receive unicast UDP RTP/RTCP data. */ int server_port_min, server_port_max; /** time-to-live value (required for multicast); the amount of HOPs that * packets will be allowed to make before being discarded. */ int ttl; uint32_t destination; /**< destination IP address */ /** data/packet transport protocol; e.g. RTP or RDT */ enum RTSPTransport transport; /** network layer transport protocol; e.g. TCP or UDP uni-/multicast */ enum RTSPLowerTransport lower_transport; } RTSPTransportField; /** * This describes the server response to each RTSP command. */ typedef struct RTSPMessageHeader { /** length of the data following this header */ int content_length; enum RTSPStatusCode status_code; /**< response code from server */ /** number of items in the 'transports' variable below */ int nb_transports; /** Time range of the streams that the server will stream. In * AV_TIME_BASE unit, AV_NOPTS_VALUE if not used */ int64_t range_start, range_end; /** describes the complete "Transport:" line of the server in response * to a SETUP RTSP command by the client */ RTSPTransportField transports[RTSP_MAX_TRANSPORTS]; int seq; /**< sequence number */ /** the "Session:" field. This value is initially set by the server and * should be re-transmitted by the client in every RTSP command. */ char session_id[512]; /** the "Location:" field. This value is used to handle redirection. */ char location[4096]; /** the "RealChallenge1:" field from the server */ char real_challenge[64]; /** the "Server: field, which can be used to identify some special-case * servers that are not 100% standards-compliant. We use this to identify * Windows Media Server, which has a value "WMServer/v.e.r.sion", where * version is a sequence of digits (e.g. 9.0.0.3372). Helix/Real servers * use something like "Helix [..] Server Version v.e.r.sion (platform) * (RealServer compatible)" or "RealServer Version v.e.r.sion (platform)", * where platform is the output of $uname -msr | sed 's/ /-/g'. */ char server[64]; /** The "timeout" comes as part of the server response to the "SETUP" * command, in the "Session: <xyz>[;timeout=<value>]" line. It is the * time, in seconds, that the server will go without traffic over the * RTSP/TCP connection before it closes the connection. To prevent * this, sent dummy requests (e.g. OPTIONS) with intervals smaller * than this value. */ int timeout; /** The "Notice" or "X-Notice" field value. See * http://tools.ietf.org/html/draft-stiemerling-rtsp-announce-00 * for a complete list of supported values. */ int notice; } RTSPMessageHeader; /** * Client state, i.e. whether we are currently receiving data (PLAYING) or * setup-but-not-receiving (PAUSED). State can be changed in applications * by calling av_read_play/pause(). */ enum RTSPClientState { RTSP_STATE_IDLE, /**< not initialized */ RTSP_STATE_STREAMING, /**< initialized and sending/receiving data */ RTSP_STATE_PAUSED, /**< initialized, but not receiving data */ RTSP_STATE_SEEKING, /**< initialized, requesting a seek */ }; /** * Identifies particular servers that require special handling, such as * standards-incompliant "Transport:" lines in the SETUP request. */ enum RTSPServerType { RTSP_SERVER_RTP, /**< Standards-compliant RTP-server */ RTSP_SERVER_REAL, /**< Realmedia-style server */ RTSP_SERVER_WMS, /**< Windows Media server */ RTSP_SERVER_NB }; /** * Private data for the RTSP demuxer. * * @todo Use ByteIOContext instead of URLContext */ typedef struct RTSPState { URLContext *rtsp_hd; /* RTSP TCP connexion handle */ /** number of items in the 'rtsp_streams' variable */ int nb_rtsp_streams; struct RTSPStream **rtsp_streams; /**< streams in this session */ /** indicator of whether we are currently receiving data from the * server. Basically this isn't more than a simple cache of the * last PLAY/PAUSE command sent to the server, to make sure we don't * send 2x the same unexpectedly or commands in the wrong state. */ enum RTSPClientState state; /** the seek value requested when calling av_seek_frame(). This value * is subsequently used as part of the "Range" parameter when emitting * the RTSP PLAY command. If we are currently playing, this command is * called instantly. If we are currently paused, this command is called * whenever we resume playback. Either way, the value is only used once, * see rtsp_read_play() and rtsp_read_seek(). */ int64_t seek_timestamp; /* XXX: currently we use unbuffered input */ // ByteIOContext rtsp_gb; int seq; /**< RTSP command sequence number */ /** copy of RTSPMessageHeader->session_id, i.e. the server-provided session * identifier that the client should re-transmit in each RTSP command */ char session_id[512]; /** copy of RTSPMessageHeader->timeout, i.e. the time (in seconds) that * the server will go without traffic on the RTSP/TCP line before it * closes the connection. */ int timeout; /** timestamp of the last RTSP command that we sent to the RTSP server. * This is used to calculate when to send dummy commands to keep the * connection alive, in conjunction with timeout. */ int64_t last_cmd_time; /** the negotiated data/packet transport protocol; e.g. RTP or RDT */ enum RTSPTransport transport; /** the negotiated network layer transport protocol; e.g. TCP or UDP * uni-/multicast */ enum RTSPLowerTransport lower_transport; /** brand of server that we're talking to; e.g. WMS, REAL or other. * Detected based on the value of RTSPMessageHeader->server or the presence * of RTSPMessageHeader->real_challenge */ enum RTSPServerType server_type; /** plaintext authorization line (username:password) */ char auth[128]; /** authentication state */ HTTPAuthState auth_state; /** The last reply of the server to a RTSP command */ char last_reply[2048]; /* XXX: allocate ? */ /** RTSPStream->transport_priv of the last stream that we read a * packet from */ void *cur_transport_priv; /** The following are used for Real stream selection */ //@{ /** whether we need to send a "SET_PARAMETER Subscribe:" command */ int need_subscription; /** stream setup during the last frame read. This is used to detect if * we need to subscribe or unsubscribe to any new streams. */ enum AVDiscard real_setup_cache[MAX_STREAMS]; /** the last value of the "SET_PARAMETER Subscribe:" RTSP command. * this is used to send the same "Unsubscribe:" if stream setup changed, * before sending a new "Subscribe:" command. */ char last_subscription[1024]; //@} /** The following are used for RTP/ASF streams */ //@{ /** ASF demuxer context for the embedded ASF stream from WMS servers */ AVFormatContext *asf_ctx; /** cache for position of the asf demuxer, since we load a new * data packet in the bytecontext for each incoming RTSP packet. */ uint64_t asf_pb_pos; //@} /** some MS RTSP streams contain a URL in the SDP that we need to use * for all subsequent RTSP requests, rather than the input URI; in * other cases, this is a copy of AVFormatContext->filename. */ char control_uri[1024]; /** The synchronized start time of the output streams. */ int64_t start_time; } RTSPState; /** * Describes a single stream, as identified by a single m= line block in the * SDP content. In the case of RDT, one RTSPStream can represent multiple * AVStreams. In this case, each AVStream in this set has similar content * (but different codec/bitrate). */ typedef struct RTSPStream { URLContext *rtp_handle; /**< RTP stream handle (if UDP) */ void *transport_priv; /**< RTP/RDT parse context if input, RTP AVFormatContext if output */ /** corresponding stream index, if any. -1 if none (MPEG2TS case) */ int stream_index; /** interleave IDs; copies of RTSPTransportField->interleaved_min/max * for the selected transport. Only used for TCP. */ int interleaved_min, interleaved_max; char control_url[1024]; /**< url for this stream (from SDP) */ /** The following are used only in SDP, not RTSP */ //@{ int sdp_port; /**< port (from SDP content) */ struct in_addr sdp_ip; /**< IP address (from SDP content) */ int sdp_ttl; /**< IP Time-To-Live (from SDP content) */ int sdp_payload_type; /**< payload type */ //@} /** rtp payload parsing infos from SDP (i.e. mapping between private * payload IDs and media-types (string), so that we can derive what * type of payload we're dealing with (and how to parse it). */ RTPPayloadData rtp_payload_data; /** The following are used for dynamic protocols (rtp_*.c/rdt.c) */ //@{ /** handler structure */ RTPDynamicProtocolHandler *dynamic_handler; /** private data associated with the dynamic protocol */ PayloadContext *dynamic_protocol_context; //@} } RTSPStream; void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf, HTTPAuthState *auth_state); #if LIBAVFORMAT_VERSION_INT < (53 << 16) extern int rtsp_default_protocols; #endif extern int rtsp_rtp_port_min; extern int rtsp_rtp_port_max; /** * Send a command to the RTSP server without waiting for the reply. * * @param s RTSP (de)muxer context * @param method the method for the request * @param url the target url for the request * @param headers extra header lines to include in the request * @param send_content if non-null, the data to send as request body content * @param send_content_length the length of the send_content data, or 0 if * send_content is null */ void ff_rtsp_send_cmd_with_content_async(AVFormatContext *s, const char *method, const char *url, const char *headers, const unsigned char *send_content, int send_content_length); /** * Send a command to the RTSP server without waiting for the reply. * * @see rtsp_send_cmd_with_content_async */ void ff_rtsp_send_cmd_async(AVFormatContext *s, const char *method, const char *url, const char *headers); /** * Send a command to the RTSP server and wait for the reply. * * @param s RTSP (de)muxer context * @param method the method for the request * @param url the target url for the request * @param headers extra header lines to include in the request * @param reply pointer where the RTSP message header will be stored * @param content_ptr pointer where the RTSP message body, if any, will * be stored (length is in reply) * @param send_content if non-null, the data to send as request body content * @param send_content_length the length of the send_content data, or 0 if * send_content is null */ void ff_rtsp_send_cmd_with_content(AVFormatContext *s, const char *method, const char *url, const char *headers, RTSPMessageHeader *reply, unsigned char **content_ptr, const unsigned char *send_content, int send_content_length); /** * Send a command to the RTSP server and wait for the reply. * * @see rtsp_send_cmd_with_content */ void ff_rtsp_send_cmd(AVFormatContext *s, const char *method, const char *url, const char *headers, RTSPMessageHeader *reply, unsigned char **content_ptr); /** * Read a RTSP message from the server, or prepare to read data * packets if we're reading data interleaved over the TCP/RTSP * connection as well. * * @param s RTSP (de)muxer context * @param reply pointer where the RTSP message header will be stored * @param content_ptr pointer where the RTSP message body, if any, will * be stored (length is in reply) * @param return_on_interleaved_data whether the function may return if we * encounter a data marker ('$'), which precedes data * packets over interleaved TCP/RTSP connections. If this * is set, this function will return 1 after encountering * a '$'. If it is not set, the function will skip any * data packets (if they are encountered), until a reply * has been fully parsed. If no more data is available * without parsing a reply, it will return an error. * * @return 1 if a data packets is ready to be received, -1 on error, * and 0 on success. */ int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply, unsigned char **content_ptr, int return_on_interleaved_data); /** * Skip a RTP/TCP interleaved packet. */ void ff_rtsp_skip_packet(AVFormatContext *s); /** * Connect to the RTSP server and set up the individual media streams. * This can be used for both muxers and demuxers. * * @param s RTSP (de)muxer context * * @return 0 on success, < 0 on error. Cleans up all allocations done * within the function on error. */ int ff_rtsp_connect(AVFormatContext *s); /** * Close and free all streams within the RTSP (de)muxer * * @param s RTSP (de)muxer context */ void ff_rtsp_close_streams(AVFormatContext *s); #endif /* AVFORMAT_RTSP_H */
123linslouis-android-video-cutter
jni/libavformat/rtsp.h
C
asf20
16,944
/* * nut muxer * Copyright (c) 2004-2007 Michael Niedermayer * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "libavutil/intreadwrite.h" #include "libavutil/tree.h" #include "libavcodec/mpegaudiodata.h" #include "nut.h" static int find_expected_header(AVCodecContext *c, int size, int key_frame, uint8_t out[64]){ int sample_rate= c->sample_rate; if(size>4096) return 0; AV_WB24(out, 1); if(c->codec_id == CODEC_ID_MPEG4){ if(key_frame){ return 3; }else{ out[3]= 0xB6; return 4; } }else if(c->codec_id == CODEC_ID_MPEG1VIDEO || c->codec_id == CODEC_ID_MPEG2VIDEO){ return 3; }else if(c->codec_id == CODEC_ID_H264){ return 3; }else if(c->codec_id == CODEC_ID_MP3 || c->codec_id == CODEC_ID_MP2){ int lsf, mpeg25, sample_rate_index, bitrate_index, frame_size; int layer= c->codec_id == CODEC_ID_MP3 ? 3 : 2; unsigned int header= 0xFFF00000; lsf = sample_rate < (24000+32000)/2; mpeg25 = sample_rate < (12000+16000)/2; sample_rate <<= lsf + mpeg25; if (sample_rate < (32000 + 44100)/2) sample_rate_index=2; else if(sample_rate < (44100 + 48000)/2) sample_rate_index=0; else sample_rate_index=1; sample_rate= ff_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25); for(bitrate_index=2; bitrate_index<30; bitrate_index++){ frame_size = ff_mpa_bitrate_tab[lsf][layer-1][bitrate_index>>1]; frame_size = (frame_size * 144000) / (sample_rate << lsf) + (bitrate_index&1); if(frame_size == size) break; } header |= (!lsf)<<19; header |= (4-layer)<<17; header |= 1<<16; //no crc AV_WB32(out, header); if(size <= 0) return 2; //we guess there is no crc, if there is one the user clearly does not care about overhead if(bitrate_index == 30) return -1; //something is wrong ... header |= (bitrate_index>>1)<<12; header |= sample_rate_index<<10; header |= (bitrate_index&1)<<9; return 2; //FIXME actually put the needed ones in build_elision_headers() return 3; //we guess that the private bit is not set //FIXME the above assumptions should be checked, if these turn out false too often something should be done } return 0; } static int find_header_idx(AVFormatContext *s, AVCodecContext *c, int size, int frame_type){ NUTContext *nut = s->priv_data; uint8_t out[64]; int i; int len= find_expected_header(c, size, frame_type, out); //av_log(NULL, AV_LOG_ERROR, "expected_h len=%d size=%d codec_id=%d\n", len, size, c->codec_id); for(i=1; i<nut->header_count; i++){ if( len == nut->header_len[i] && !memcmp(out, nut->header[i], len)){ // av_log(NULL, AV_LOG_ERROR, "found %d\n", i); return i; } } // av_log(NULL, AV_LOG_ERROR, "nothing found\n"); return 0; } static void build_elision_headers(AVFormatContext *s){ NUTContext *nut = s->priv_data; int i; //FIXME this is lame //FIXME write a 2pass mode to find the maximal headers static const uint8_t headers[][5]={ {3, 0x00, 0x00, 0x01}, {4, 0x00, 0x00, 0x01, 0xB6}, {2, 0xFF, 0xFA}, //mp3+crc {2, 0xFF, 0xFB}, //mp3 {2, 0xFF, 0xFC}, //mp2+crc {2, 0xFF, 0xFD}, //mp2 }; nut->header_count= 7; for(i=1; i<nut->header_count; i++){ nut->header_len[i]= headers[i-1][0]; nut->header [i]= &headers[i-1][1]; } } static void build_frame_code(AVFormatContext *s){ NUTContext *nut = s->priv_data; int key_frame, index, pred, stream_id; int start=1; int end= 254; int keyframe_0_esc= s->nb_streams > 2; int pred_table[10]; FrameCode *ft; ft= &nut->frame_code[start]; ft->flags= FLAG_CODED; ft->size_mul=1; ft->pts_delta=1; start++; if(keyframe_0_esc){ /* keyframe = 0 escape */ FrameCode *ft= &nut->frame_code[start]; ft->flags= FLAG_STREAM_ID | FLAG_SIZE_MSB | FLAG_CODED_PTS; ft->size_mul=1; start++; } for(stream_id= 0; stream_id<s->nb_streams; stream_id++){ int start2= start + (end-start)*stream_id / s->nb_streams; int end2 = start + (end-start)*(stream_id+1) / s->nb_streams; AVCodecContext *codec = s->streams[stream_id]->codec; int is_audio= codec->codec_type == AVMEDIA_TYPE_AUDIO; int intra_only= /*codec->intra_only || */is_audio; int pred_count; for(key_frame=0; key_frame<2; key_frame++){ if(intra_only && keyframe_0_esc && key_frame==0) continue; { FrameCode *ft= &nut->frame_code[start2]; ft->flags= FLAG_KEY*key_frame; ft->flags|= FLAG_SIZE_MSB | FLAG_CODED_PTS; ft->stream_id= stream_id; ft->size_mul=1; if(is_audio) ft->header_idx= find_header_idx(s, codec, -1, key_frame); start2++; } } key_frame= intra_only; #if 1 if(is_audio){ int frame_bytes= codec->frame_size*(int64_t)codec->bit_rate / (8*codec->sample_rate); int pts; for(pts=0; pts<2; pts++){ for(pred=0; pred<2; pred++){ FrameCode *ft= &nut->frame_code[start2]; ft->flags= FLAG_KEY*key_frame; ft->stream_id= stream_id; ft->size_mul=frame_bytes + 2; ft->size_lsb=frame_bytes + pred; ft->pts_delta=pts; ft->header_idx= find_header_idx(s, codec, frame_bytes + pred, key_frame); start2++; } } }else{ FrameCode *ft= &nut->frame_code[start2]; ft->flags= FLAG_KEY | FLAG_SIZE_MSB; ft->stream_id= stream_id; ft->size_mul=1; ft->pts_delta=1; start2++; } #endif if(codec->has_b_frames){ pred_count=5; pred_table[0]=-2; pred_table[1]=-1; pred_table[2]=1; pred_table[3]=3; pred_table[4]=4; }else if(codec->codec_id == CODEC_ID_VORBIS){ pred_count=3; pred_table[0]=2; pred_table[1]=9; pred_table[2]=16; }else{ pred_count=1; pred_table[0]=1; } for(pred=0; pred<pred_count; pred++){ int start3= start2 + (end2-start2)*pred / pred_count; int end3 = start2 + (end2-start2)*(pred+1) / pred_count; for(index=start3; index<end3; index++){ FrameCode *ft= &nut->frame_code[index]; ft->flags= FLAG_KEY*key_frame; ft->flags|= FLAG_SIZE_MSB; ft->stream_id= stream_id; //FIXME use single byte size and pred from last ft->size_mul= end3-start3; ft->size_lsb= index - start3; ft->pts_delta= pred_table[pred]; if(is_audio) ft->header_idx= find_header_idx(s, codec, -1, key_frame); } } } memmove(&nut->frame_code['N'+1], &nut->frame_code['N'], sizeof(FrameCode)*(255-'N')); nut->frame_code[ 0].flags= nut->frame_code[255].flags= nut->frame_code['N'].flags= FLAG_INVALID; } /** * Gets the length in bytes which is needed to store val as v. */ static int get_length(uint64_t val){ int i=1; while(val>>=7) i++; return i; } static void put_v(ByteIOContext *bc, uint64_t val){ int i= get_length(val); while(--i>0) put_byte(bc, 128 | (val>>(7*i))); put_byte(bc, val&127); } static void put_tt(NUTContext *nut, StreamContext *nus, ByteIOContext *bc, uint64_t val){ val *= nut->time_base_count; val += nus->time_base - nut->time_base; put_v(bc, val); } /** * Stores a string as vb. */ static void put_str(ByteIOContext *bc, const char *string){ int len= strlen(string); put_v(bc, len); put_buffer(bc, string, len); } static void put_s(ByteIOContext *bc, int64_t val){ put_v(bc, 2*FFABS(val) - (val>0)); } #ifdef TRACE static inline void put_v_trace(ByteIOContext *bc, uint64_t v, char *file, char *func, int line){ av_log(NULL, AV_LOG_DEBUG, "put_v %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line); put_v(bc, v); } static inline void put_s_trace(ByteIOContext *bc, int64_t v, char *file, char *func, int line){ av_log(NULL, AV_LOG_DEBUG, "put_s %5"PRId64" / %"PRIX64" in %s %s:%d\n", v, v, file, func, line); put_s(bc, v); } #define put_v(bc, v) put_v_trace(bc, v, __FILE__, __PRETTY_FUNCTION__, __LINE__) #define put_s(bc, v) put_s_trace(bc, v, __FILE__, __PRETTY_FUNCTION__, __LINE__) #endif //FIXME remove calculate_checksum static void put_packet(NUTContext *nut, ByteIOContext *bc, ByteIOContext *dyn_bc, int calculate_checksum, uint64_t startcode){ uint8_t *dyn_buf=NULL; int dyn_size= url_close_dyn_buf(dyn_bc, &dyn_buf); int forw_ptr= dyn_size + 4*calculate_checksum; if(forw_ptr > 4096) init_checksum(bc, ff_crc04C11DB7_update, 0); put_be64(bc, startcode); put_v(bc, forw_ptr); if(forw_ptr > 4096) put_le32(bc, get_checksum(bc)); if(calculate_checksum) init_checksum(bc, ff_crc04C11DB7_update, 0); put_buffer(bc, dyn_buf, dyn_size); if(calculate_checksum) put_le32(bc, get_checksum(bc)); av_free(dyn_buf); } static void write_mainheader(NUTContext *nut, ByteIOContext *bc){ int i, j, tmp_pts, tmp_flags, tmp_stream, tmp_mul, tmp_size, tmp_fields, tmp_head_idx; int64_t tmp_match; put_v(bc, 3); /* version */ put_v(bc, nut->avf->nb_streams); put_v(bc, nut->max_distance); put_v(bc, nut->time_base_count); for(i=0; i<nut->time_base_count; i++){ put_v(bc, nut->time_base[i].num); put_v(bc, nut->time_base[i].den); } tmp_pts=0; tmp_mul=1; tmp_stream=0; tmp_match= 1-(1LL<<62); tmp_head_idx= 0; for(i=0; i<256;){ tmp_fields=0; tmp_size=0; // tmp_res=0; if(tmp_pts != nut->frame_code[i].pts_delta) tmp_fields=1; if(tmp_mul != nut->frame_code[i].size_mul ) tmp_fields=2; if(tmp_stream != nut->frame_code[i].stream_id) tmp_fields=3; if(tmp_size != nut->frame_code[i].size_lsb ) tmp_fields=4; // if(tmp_res != nut->frame_code[i].res ) tmp_fields=5; if(tmp_head_idx!=nut->frame_code[i].header_idx)tmp_fields=8; tmp_pts = nut->frame_code[i].pts_delta; tmp_flags = nut->frame_code[i].flags; tmp_stream= nut->frame_code[i].stream_id; tmp_mul = nut->frame_code[i].size_mul; tmp_size = nut->frame_code[i].size_lsb; // tmp_res = nut->frame_code[i].res; tmp_head_idx= nut->frame_code[i].header_idx; for(j=0; i<256; j++,i++){ if(i == 'N'){ j--; continue; } if(nut->frame_code[i].pts_delta != tmp_pts ) break; if(nut->frame_code[i].flags != tmp_flags ) break; if(nut->frame_code[i].stream_id != tmp_stream) break; if(nut->frame_code[i].size_mul != tmp_mul ) break; if(nut->frame_code[i].size_lsb != tmp_size+j) break; // if(nut->frame_code[i].res != tmp_res ) break; if(nut->frame_code[i].header_idx!= tmp_head_idx) break; } if(j != tmp_mul - tmp_size) tmp_fields=6; put_v(bc, tmp_flags); put_v(bc, tmp_fields); if(tmp_fields>0) put_s(bc, tmp_pts); if(tmp_fields>1) put_v(bc, tmp_mul); if(tmp_fields>2) put_v(bc, tmp_stream); if(tmp_fields>3) put_v(bc, tmp_size); if(tmp_fields>4) put_v(bc, 0 /*tmp_res*/); if(tmp_fields>5) put_v(bc, j); if(tmp_fields>6) put_v(bc, tmp_match); if(tmp_fields>7) put_v(bc, tmp_head_idx); } put_v(bc, nut->header_count-1); for(i=1; i<nut->header_count; i++){ put_v(bc, nut->header_len[i]); put_buffer(bc, nut->header[i], nut->header_len[i]); } } static int write_streamheader(NUTContext *nut, ByteIOContext *bc, AVStream *st, int i){ AVCodecContext *codec = st->codec; put_v(bc, i); switch(codec->codec_type){ case AVMEDIA_TYPE_VIDEO: put_v(bc, 0); break; case AVMEDIA_TYPE_AUDIO: put_v(bc, 1); break; case AVMEDIA_TYPE_SUBTITLE: put_v(bc, 2); break; default : put_v(bc, 3); break; } put_v(bc, 4); if (codec->codec_tag){ put_le32(bc, codec->codec_tag); }else return -1; put_v(bc, nut->stream[i].time_base - nut->time_base); put_v(bc, nut->stream[i].msb_pts_shift); put_v(bc, nut->stream[i].max_pts_distance); put_v(bc, codec->has_b_frames); put_byte(bc, 0); /* flags: 0x1 - fixed_fps, 0x2 - index_present */ put_v(bc, codec->extradata_size); put_buffer(bc, codec->extradata, codec->extradata_size); switch(codec->codec_type){ case AVMEDIA_TYPE_AUDIO: put_v(bc, codec->sample_rate); put_v(bc, 1); put_v(bc, codec->channels); break; case AVMEDIA_TYPE_VIDEO: put_v(bc, codec->width); put_v(bc, codec->height); if(st->sample_aspect_ratio.num<=0 || st->sample_aspect_ratio.den<=0){ put_v(bc, 0); put_v(bc, 0); }else{ put_v(bc, st->sample_aspect_ratio.num); put_v(bc, st->sample_aspect_ratio.den); } put_v(bc, 0); /* csp type -- unknown */ break; default: break; } return 0; } static int add_info(ByteIOContext *bc, const char *type, const char *value){ put_str(bc, type); put_s(bc, -1); put_str(bc, value); return 1; } static int write_globalinfo(NUTContext *nut, ByteIOContext *bc){ AVFormatContext *s= nut->avf; AVMetadataTag *t = NULL; ByteIOContext *dyn_bc; uint8_t *dyn_buf=NULL; int count=0, dyn_size; int ret = url_open_dyn_buf(&dyn_bc); if(ret < 0) return ret; while ((t = av_metadata_get(s->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) count += add_info(dyn_bc, t->key, t->value); put_v(bc, 0); //stream_if_plus1 put_v(bc, 0); //chapter_id put_v(bc, 0); //timestamp_start put_v(bc, 0); //length put_v(bc, count); dyn_size= url_close_dyn_buf(dyn_bc, &dyn_buf); put_buffer(bc, dyn_buf, dyn_size); av_free(dyn_buf); return 0; } static int write_streaminfo(NUTContext *nut, ByteIOContext *bc, int stream_id){ AVFormatContext *s= nut->avf; AVStream* st = s->streams[stream_id]; ByteIOContext *dyn_bc; uint8_t *dyn_buf=NULL; int count=0, dyn_size, i; int ret = url_open_dyn_buf(&dyn_bc); if(ret < 0) return ret; for (i=0; ff_nut_dispositions[i].flag; ++i) { if (st->disposition & ff_nut_dispositions[i].flag) count += add_info(dyn_bc, "Disposition", ff_nut_dispositions[i].str); } dyn_size = url_close_dyn_buf(dyn_bc, &dyn_buf); if (count) { put_v(bc, stream_id + 1); //stream_id_plus1 put_v(bc, 0); //chapter_id put_v(bc, 0); //timestamp_start put_v(bc, 0); //length put_v(bc, count); put_buffer(bc, dyn_buf, dyn_size); } av_free(dyn_buf); return count; } static int write_headers(NUTContext *nut, ByteIOContext *bc){ ByteIOContext *dyn_bc; int i, ret; ret = url_open_dyn_buf(&dyn_bc); if(ret < 0) return ret; write_mainheader(nut, dyn_bc); put_packet(nut, bc, dyn_bc, 1, MAIN_STARTCODE); for (i=0; i < nut->avf->nb_streams; i++){ ret = url_open_dyn_buf(&dyn_bc); if(ret < 0) return ret; write_streamheader(nut, dyn_bc, nut->avf->streams[i], i); put_packet(nut, bc, dyn_bc, 1, STREAM_STARTCODE); } ret = url_open_dyn_buf(&dyn_bc); if(ret < 0) return ret; write_globalinfo(nut, dyn_bc); put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE); for (i = 0; i < nut->avf->nb_streams; i++) { ret = url_open_dyn_buf(&dyn_bc); if(ret < 0) return ret; ret = write_streaminfo(nut, dyn_bc, i); if (ret < 0) return ret; if (ret > 0) put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE); else { uint8_t* buf; url_close_dyn_buf(dyn_bc, &buf); av_free(buf); } } nut->last_syncpoint_pos= INT_MIN; nut->header_count++; return 0; } static int write_header(AVFormatContext *s){ NUTContext *nut = s->priv_data; ByteIOContext *bc = s->pb; int i, j; nut->avf= s; nut->stream = av_mallocz(sizeof(StreamContext)*s->nb_streams); nut->time_base= av_mallocz(sizeof(AVRational )*s->nb_streams); for(i=0; i<s->nb_streams; i++){ AVStream *st= s->streams[i]; int ssize; AVRational time_base; ff_parse_specific_params(st->codec, &time_base.den, &ssize, &time_base.num); av_set_pts_info(st, 64, time_base.num, time_base.den); for(j=0; j<nut->time_base_count; j++){ if(!memcmp(&time_base, &nut->time_base[j], sizeof(AVRational))){ break; } } nut->time_base[j]= time_base; nut->stream[i].time_base= &nut->time_base[j]; if(j==nut->time_base_count) nut->time_base_count++; if(av_q2d(time_base) >= 0.001) nut->stream[i].msb_pts_shift = 7; else nut->stream[i].msb_pts_shift = 14; nut->stream[i].max_pts_distance= FFMAX(1/av_q2d(time_base), 1); } nut->max_distance = MAX_DISTANCE; build_elision_headers(s); build_frame_code(s); assert(nut->frame_code['N'].flags == FLAG_INVALID); put_buffer(bc, ID_STRING, strlen(ID_STRING)); put_byte(bc, 0); write_headers(nut, bc); put_flush_packet(bc); //FIXME index return 0; } static int get_needed_flags(NUTContext *nut, StreamContext *nus, FrameCode *fc, AVPacket *pkt){ int flags= 0; if(pkt->flags & AV_PKT_FLAG_KEY ) flags |= FLAG_KEY; if(pkt->stream_index != fc->stream_id ) flags |= FLAG_STREAM_ID; if(pkt->size / fc->size_mul ) flags |= FLAG_SIZE_MSB; if(pkt->pts - nus->last_pts != fc->pts_delta) flags |= FLAG_CODED_PTS; if(pkt->size > 2*nut->max_distance ) flags |= FLAG_CHECKSUM; if(FFABS(pkt->pts - nus->last_pts) > nus->max_pts_distance) flags |= FLAG_CHECKSUM; if( pkt->size < nut->header_len[fc->header_idx] || (pkt->size > 4096 && fc->header_idx) || memcmp(pkt->data, nut->header[fc->header_idx], nut->header_len[fc->header_idx])) flags |= FLAG_HEADER_IDX; return flags | (fc->flags & FLAG_CODED); } static int find_best_header_idx(NUTContext *nut, AVPacket *pkt){ int i; int best_i = 0; int best_len= 0; if(pkt->size > 4096) return 0; for(i=1; i<nut->header_count; i++){ if( pkt->size >= nut->header_len[i] && nut->header_len[i] > best_len && !memcmp(pkt->data, nut->header[i], nut->header_len[i])){ best_i= i; best_len= nut->header_len[i]; } } return best_i; } static int write_packet(AVFormatContext *s, AVPacket *pkt){ NUTContext *nut = s->priv_data; StreamContext *nus= &nut->stream[pkt->stream_index]; ByteIOContext *bc = s->pb, *dyn_bc; FrameCode *fc; int64_t coded_pts; int best_length, frame_code, flags, needed_flags, i, header_idx, best_header_idx; int key_frame = !!(pkt->flags & AV_PKT_FLAG_KEY); int store_sp=0; int ret; if(pkt->pts < 0) return -1; if(1LL<<(20+3*nut->header_count) <= url_ftell(bc)) write_headers(nut, bc); if(key_frame && !(nus->last_flags & FLAG_KEY)) store_sp= 1; if(pkt->size + 30/*FIXME check*/ + url_ftell(bc) >= nut->last_syncpoint_pos + nut->max_distance) store_sp= 1; //FIXME: Ensure store_sp is 1 in the first place. if(store_sp){ Syncpoint *sp, dummy= {.pos= INT64_MAX}; ff_nut_reset_ts(nut, *nus->time_base, pkt->dts); for(i=0; i<s->nb_streams; i++){ AVStream *st= s->streams[i]; int64_t dts_tb = av_rescale_rnd(pkt->dts, nus->time_base->num * (int64_t)nut->stream[i].time_base->den, nus->time_base->den * (int64_t)nut->stream[i].time_base->num, AV_ROUND_DOWN); int index= av_index_search_timestamp(st, dts_tb, AVSEEK_FLAG_BACKWARD); if(index>=0) dummy.pos= FFMIN(dummy.pos, st->index_entries[index].pos); } if(dummy.pos == INT64_MAX) dummy.pos= 0; sp= av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pos_cmp, NULL); nut->last_syncpoint_pos= url_ftell(bc); ret = url_open_dyn_buf(&dyn_bc); if(ret < 0) return ret; put_tt(nut, nus, dyn_bc, pkt->dts); put_v(dyn_bc, sp ? (nut->last_syncpoint_pos - sp->pos)>>4 : 0); put_packet(nut, bc, dyn_bc, 1, SYNCPOINT_STARTCODE); ff_nut_add_sp(nut, nut->last_syncpoint_pos, 0/*unused*/, pkt->dts); } assert(nus->last_pts != AV_NOPTS_VALUE); coded_pts = pkt->pts & ((1<<nus->msb_pts_shift)-1); if(ff_lsb2full(nus, coded_pts) != pkt->pts) coded_pts= pkt->pts + (1<<nus->msb_pts_shift); best_header_idx= find_best_header_idx(nut, pkt); best_length=INT_MAX; frame_code= -1; for(i=0; i<256; i++){ int length= 0; FrameCode *fc= &nut->frame_code[i]; int flags= fc->flags; if(flags & FLAG_INVALID) continue; needed_flags= get_needed_flags(nut, nus, fc, pkt); if(flags & FLAG_CODED){ length++; flags = needed_flags; } if((flags & needed_flags) != needed_flags) continue; if((flags ^ needed_flags) & FLAG_KEY) continue; if(flags & FLAG_STREAM_ID) length+= get_length(pkt->stream_index); if(pkt->size % fc->size_mul != fc->size_lsb) continue; if(flags & FLAG_SIZE_MSB) length += get_length(pkt->size / fc->size_mul); if(flags & FLAG_CHECKSUM) length+=4; if(flags & FLAG_CODED_PTS) length += get_length(coded_pts); if( (flags & FLAG_CODED) && nut->header_len[best_header_idx] > nut->header_len[fc->header_idx]+1){ flags |= FLAG_HEADER_IDX; } if(flags & FLAG_HEADER_IDX){ length += 1 - nut->header_len[best_header_idx]; }else{ length -= nut->header_len[fc->header_idx]; } length*=4; length+= !(flags & FLAG_CODED_PTS); length+= !(flags & FLAG_CHECKSUM); if(length < best_length){ best_length= length; frame_code=i; } } assert(frame_code != -1); fc= &nut->frame_code[frame_code]; flags= fc->flags; needed_flags= get_needed_flags(nut, nus, fc, pkt); header_idx= fc->header_idx; init_checksum(bc, ff_crc04C11DB7_update, 0); put_byte(bc, frame_code); if(flags & FLAG_CODED){ put_v(bc, (flags^needed_flags) & ~(FLAG_CODED)); flags = needed_flags; } if(flags & FLAG_STREAM_ID) put_v(bc, pkt->stream_index); if(flags & FLAG_CODED_PTS) put_v(bc, coded_pts); if(flags & FLAG_SIZE_MSB) put_v(bc, pkt->size / fc->size_mul); if(flags & FLAG_HEADER_IDX) put_v(bc, header_idx= best_header_idx); if(flags & FLAG_CHECKSUM) put_le32(bc, get_checksum(bc)); else get_checksum(bc); put_buffer(bc, pkt->data + nut->header_len[header_idx], pkt->size - nut->header_len[header_idx]); nus->last_flags= flags; nus->last_pts= pkt->pts; //FIXME just store one per syncpoint if(flags & FLAG_KEY) av_add_index_entry( s->streams[pkt->stream_index], nut->last_syncpoint_pos, pkt->pts, 0, 0, AVINDEX_KEYFRAME); return 0; } static int write_trailer(AVFormatContext *s){ NUTContext *nut= s->priv_data; ByteIOContext *bc= s->pb; while(nut->header_count<3) write_headers(nut, bc); put_flush_packet(bc); ff_nut_free_sp(nut); av_freep(&nut->stream); av_freep(&nut->time_base); return 0; } AVOutputFormat nut_muxer = { "nut", NULL_IF_CONFIG_SMALL("NUT format"), "video/x-nut", "nut", sizeof(NUTContext), #if CONFIG_LIBVORBIS CODEC_ID_VORBIS, #elif CONFIG_LIBMP3LAME CODEC_ID_MP3, #else CODEC_ID_MP2, #endif CODEC_ID_MPEG4, write_header, write_packet, write_trailer, .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS, .codec_tag= (const AVCodecTag* const []){ff_codec_bmp_tags, ff_codec_wav_tags, ff_nut_subtitle_tags, 0}, .metadata_conv = ff_nut_metadata_conv, };
123linslouis-android-video-cutter
jni/libavformat/nutenc.c
C
asf20
26,102
/* * Bink demuxer * Copyright (c) 2008-2010 Peter Ross (pross@xvid.org) * Copyright (c) 2009 Daniel Verkamp (daniel@drv.nu) * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * Bink demuxer * * Technical details here: * http://wiki.multimedia.cx/index.php?title=Bink_Container */ #include "libavutil/intreadwrite.h" #include "avformat.h" enum BinkAudFlags { BINK_AUD_16BITS = 0x4000, ///< prefer 16-bit output BINK_AUD_STEREO = 0x2000, BINK_AUD_USEDCT = 0x1000, }; #define BINK_EXTRADATA_SIZE 1 #define BINK_MAX_AUDIO_TRACKS 256 #define BINK_MAX_WIDTH 7680 #define BINK_MAX_HEIGHT 4800 typedef struct { uint32_t file_size; uint32_t num_audio_tracks; int current_track; ///< audio track to return in next packet int64_t video_pts; int64_t audio_pts[BINK_MAX_AUDIO_TRACKS]; uint32_t remain_packet_size; } BinkDemuxContext; static int probe(AVProbeData *p) { const uint8_t *b = p->buf; if ( b[0] == 'B' && b[1] == 'I' && b[2] == 'K' && (b[3] == 'b' || b[3] == 'f' || b[3] == 'g' || b[3] == 'h' || b[3] == 'i') && AV_RL32(b+8) > 0 && // num_frames AV_RL32(b+20) > 0 && AV_RL32(b+20) <= BINK_MAX_WIDTH && AV_RL32(b+24) > 0 && AV_RL32(b+24) <= BINK_MAX_HEIGHT && AV_RL32(b+28) > 0 && AV_RL32(b+32) > 0) // fps num,den return AVPROBE_SCORE_MAX; return 0; } static int read_header(AVFormatContext *s, AVFormatParameters *ap) { BinkDemuxContext *bink = s->priv_data; ByteIOContext *pb = s->pb; uint32_t fps_num, fps_den; AVStream *vst, *ast; unsigned int i; uint32_t pos, next_pos; uint16_t flags; int keyframe; vst = av_new_stream(s, 0); if (!vst) return AVERROR(ENOMEM); vst->codec->codec_tag = get_le32(pb); bink->file_size = get_le32(pb) + 8; vst->duration = get_le32(pb); if (vst->duration > 1000000) { av_log(s, AV_LOG_ERROR, "invalid header: more than 1000000 frames\n"); return AVERROR(EIO); } if (get_le32(pb) > bink->file_size) { av_log(s, AV_LOG_ERROR, "invalid header: largest frame size greater than file size\n"); return AVERROR(EIO); } url_fskip(pb, 4); vst->codec->width = get_le32(pb); vst->codec->height = get_le32(pb); fps_num = get_le32(pb); fps_den = get_le32(pb); if (fps_num == 0 || fps_den == 0) { av_log(s, AV_LOG_ERROR, "invalid header: invalid fps (%d/%d)\n", fps_num, fps_den); return AVERROR(EIO); } av_set_pts_info(vst, 64, fps_den, fps_num); vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; vst->codec->codec_id = CODEC_ID_BINKVIDEO; vst->codec->extradata = av_mallocz(4 + FF_INPUT_BUFFER_PADDING_SIZE); vst->codec->extradata_size = 4; get_buffer(pb, vst->codec->extradata, 4); bink->num_audio_tracks = get_le32(pb); if (bink->num_audio_tracks > BINK_MAX_AUDIO_TRACKS) { av_log(s, AV_LOG_ERROR, "invalid header: more than "AV_STRINGIFY(BINK_MAX_AUDIO_TRACKS)" audio tracks (%d)\n", bink->num_audio_tracks); return AVERROR(EIO); } if (bink->num_audio_tracks) { url_fskip(pb, 4 * bink->num_audio_tracks); for (i = 0; i < bink->num_audio_tracks; i++) { ast = av_new_stream(s, 1); if (!ast) return AVERROR(ENOMEM); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; ast->codec->codec_tag = 0; ast->codec->sample_rate = get_le16(pb); av_set_pts_info(ast, 64, 1, ast->codec->sample_rate); flags = get_le16(pb); ast->codec->codec_id = flags & BINK_AUD_USEDCT ? CODEC_ID_BINKAUDIO_DCT : CODEC_ID_BINKAUDIO_RDFT; ast->codec->channels = flags & BINK_AUD_STEREO ? 2 : 1; } url_fskip(pb, 4 * bink->num_audio_tracks); } /* frame index table */ next_pos = get_le32(pb); for (i = 0; i < vst->duration; i++) { pos = next_pos; if (i == vst->duration - 1) { next_pos = bink->file_size; keyframe = 0; } else { next_pos = get_le32(pb); keyframe = pos & 1; } pos &= ~1; next_pos &= ~1; if (next_pos <= pos) { av_log(s, AV_LOG_ERROR, "invalid frame index table\n"); return AVERROR(EIO); } av_add_index_entry(vst, pos, i, next_pos - pos, 0, keyframe ? AVINDEX_KEYFRAME : 0); } url_fskip(pb, 4); bink->current_track = -1; return 0; } static int read_packet(AVFormatContext *s, AVPacket *pkt) { BinkDemuxContext *bink = s->priv_data; ByteIOContext *pb = s->pb; int ret; if (bink->current_track < 0) { int index_entry; AVStream *st = s->streams[0]; // stream 0 is video stream with index if (bink->video_pts >= st->duration) return AVERROR(EIO); index_entry = av_index_search_timestamp(st, bink->video_pts, AVSEEK_FLAG_ANY); if (index_entry < 0) { av_log(s, AV_LOG_ERROR, "could not find index entry for frame %"PRId64"\n", bink->video_pts); return AVERROR(EIO); } bink->remain_packet_size = st->index_entries[index_entry].size; bink->current_track = 0; } while (bink->current_track < bink->num_audio_tracks) { uint32_t audio_size = get_le32(pb); if (audio_size > bink->remain_packet_size - 4) { av_log(s, AV_LOG_ERROR, "frame %"PRId64": audio size in header (%u) > size of packet left (%u)\n", bink->video_pts, audio_size, bink->remain_packet_size); return AVERROR(EIO); } bink->remain_packet_size -= 4 + audio_size; bink->current_track++; if (audio_size >= 4) { /* get one audio packet per track */ if ((ret = av_get_packet(pb, pkt, audio_size)) < 0) return ret; pkt->stream_index = bink->current_track; pkt->pts = bink->audio_pts[bink->current_track - 1]; /* Each audio packet reports the number of decompressed samples (in bytes). We use this value to calcuate the audio PTS */ if (pkt->size >= 4) bink->audio_pts[bink->current_track -1] += AV_RL32(pkt->data) / (2 * s->streams[bink->current_track]->codec->channels); return 0; } else { url_fseek(pb, audio_size, SEEK_CUR); } } /* get video packet */ if ((ret = av_get_packet(pb, pkt, bink->remain_packet_size)) < 0) return ret; pkt->stream_index = 0; pkt->pts = bink->video_pts++; pkt->flags |= AV_PKT_FLAG_KEY; /* -1 instructs the next call to read_packet() to read the next frame */ bink->current_track = -1; return 0; } static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { BinkDemuxContext *bink = s->priv_data; AVStream *vst = s->streams[0]; if (url_is_streamed(s->pb)) return -1; /* seek to the first frame */ url_fseek(s->pb, vst->index_entries[0].pos, SEEK_SET); bink->video_pts = 0; memset(bink->audio_pts, 0, sizeof(bink->audio_pts)); bink->current_track = -1; return 0; } AVInputFormat bink_demuxer = { "bink", NULL_IF_CONFIG_SMALL("Bink"), sizeof(BinkDemuxContext), probe, read_header, read_packet, NULL, read_seek, };
123linslouis-android-video-cutter
jni/libavformat/bink.c
C
asf20
8,386
/* * Flash Compatible Streaming Format demuxer * Copyright (c) 2000 Fabrice Bellard * Copyright (c) 2003 Tinic Uro * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "libavutil/intreadwrite.h" #include "swf.h" static int get_swf_tag(ByteIOContext *pb, int *len_ptr) { int tag, len; if (url_feof(pb)) return -1; tag = get_le16(pb); len = tag & 0x3f; tag = tag >> 6; if (len == 0x3f) { len = get_le32(pb); } // av_log(NULL, AV_LOG_DEBUG, "Tag: %d - Len: %d\n", tag, len); *len_ptr = len; return tag; } static int swf_probe(AVProbeData *p) { /* check file header */ if ((p->buf[0] == 'F' || p->buf[0] == 'C') && p->buf[1] == 'W' && p->buf[2] == 'S') return AVPROBE_SCORE_MAX; else return 0; } static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap) { SWFContext *swf = s->priv_data; ByteIOContext *pb = s->pb; int nbits, len, tag; tag = get_be32(pb) & 0xffffff00; if (tag == MKBETAG('C', 'W', 'S', 0)) { av_log(s, AV_LOG_ERROR, "Compressed SWF format not supported\n"); return AVERROR(EIO); } if (tag != MKBETAG('F', 'W', 'S', 0)) return AVERROR(EIO); get_le32(pb); /* skip rectangle size */ nbits = get_byte(pb) >> 3; len = (4 * nbits - 3 + 7) / 8; url_fskip(pb, len); swf->frame_rate = get_le16(pb); /* 8.8 fixed */ get_le16(pb); /* frame count */ swf->samples_per_frame = 0; s->ctx_flags |= AVFMTCTX_NOHEADER; return 0; } static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) { SWFContext *swf = s->priv_data; ByteIOContext *pb = s->pb; AVStream *vst = NULL, *ast = NULL, *st = 0; int tag, len, i, frame, v; for(;;) { uint64_t pos = url_ftell(pb); tag = get_swf_tag(pb, &len); if (tag < 0) return AVERROR(EIO); if (tag == TAG_VIDEOSTREAM) { int ch_id = get_le16(pb); len -= 2; for (i=0; i<s->nb_streams; i++) { st = s->streams[i]; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && st->id == ch_id) goto skip; } get_le16(pb); get_le16(pb); get_le16(pb); get_byte(pb); /* Check for FLV1 */ vst = av_new_stream(s, ch_id); if (!vst) return -1; vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, get_byte(pb)); av_set_pts_info(vst, 16, 256, swf->frame_rate); vst->codec->time_base = (AVRational){ 256, swf->frame_rate }; len -= 8; } else if (tag == TAG_STREAMHEAD || tag == TAG_STREAMHEAD2) { /* streaming found */ int sample_rate_code; for (i=0; i<s->nb_streams; i++) { st = s->streams[i]; if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->id == -1) goto skip; } get_byte(pb); v = get_byte(pb); swf->samples_per_frame = get_le16(pb); ast = av_new_stream(s, -1); /* -1 to avoid clash with video stream ch_id */ if (!ast) return -1; ast->codec->channels = 1 + (v&1); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; ast->codec->codec_id = ff_codec_get_id(swf_audio_codec_tags, (v>>4) & 15); ast->need_parsing = AVSTREAM_PARSE_FULL; sample_rate_code= (v>>2) & 3; if (!sample_rate_code) return AVERROR(EIO); ast->codec->sample_rate = 11025 << (sample_rate_code-1); av_set_pts_info(ast, 64, 1, ast->codec->sample_rate); len -= 4; } else if (tag == TAG_VIDEOFRAME) { int ch_id = get_le16(pb); len -= 2; for(i=0; i<s->nb_streams; i++) { st = s->streams[i]; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && st->id == ch_id) { frame = get_le16(pb); av_get_packet(pb, pkt, len-2); pkt->pos = pos; pkt->pts = frame; pkt->stream_index = st->index; return pkt->size; } } } else if (tag == TAG_STREAMBLOCK) { for (i = 0; i < s->nb_streams; i++) { st = s->streams[i]; if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->id == -1) { if (st->codec->codec_id == CODEC_ID_MP3) { url_fskip(pb, 4); av_get_packet(pb, pkt, len-4); } else { // ADPCM, PCM av_get_packet(pb, pkt, len); } pkt->pos = pos; pkt->stream_index = st->index; return pkt->size; } } } else if (tag == TAG_JPEG2) { for (i=0; i<s->nb_streams; i++) { st = s->streams[i]; if (st->codec->codec_id == CODEC_ID_MJPEG && st->id == -2) break; } if (i == s->nb_streams) { vst = av_new_stream(s, -2); /* -2 to avoid clash with video stream and audio stream */ if (!vst) return -1; vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; vst->codec->codec_id = CODEC_ID_MJPEG; av_set_pts_info(vst, 64, 256, swf->frame_rate); vst->codec->time_base = (AVRational){ 256, swf->frame_rate }; st = vst; } get_le16(pb); /* BITMAP_ID */ av_new_packet(pkt, len-2); get_buffer(pb, pkt->data, 4); if (AV_RB32(pkt->data) == 0xffd8ffd9 || AV_RB32(pkt->data) == 0xffd9ffd8) { /* old SWF files containing SOI/EOI as data start */ /* files created by swink have reversed tag */ pkt->size -= 4; get_buffer(pb, pkt->data, pkt->size); } else { get_buffer(pb, pkt->data + 4, pkt->size - 4); } pkt->pos = pos; pkt->stream_index = st->index; return pkt->size; } skip: url_fskip(pb, len); } return 0; } AVInputFormat swf_demuxer = { "swf", NULL_IF_CONFIG_SMALL("Flash format"), sizeof(SWFContext), swf_probe, swf_read_header, swf_read_packet, };
123linslouis-android-video-cutter
jni/libavformat/swfdec.c
C
asf20
7,300
/* Copyright (C) 2008 Reimar Döffinger Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **/ #include <stdlib.h> #include "libavutil/bswap.h" #include "libavutil/avstring.h" #include "libavcodec/get_bits.h" #include "libavcodec/bytestream.h" #include "avformat.h" #include "oggdec.h" struct speex_params { int final_packet_duration; int seq; }; static int speex_header(AVFormatContext *s, int idx) { struct ogg *ogg = s->priv_data; struct ogg_stream *os = ogg->streams + idx; struct speex_params *spxp = os->private; AVStream *st = s->streams[idx]; uint8_t *p = os->buf + os->pstart; if (!spxp) { spxp = av_mallocz(sizeof(*spxp)); os->private = spxp; } if (spxp->seq > 1) return 0; if (spxp->seq == 0) { int frames_per_packet; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_SPEEX; st->codec->sample_rate = AV_RL32(p + 36); st->codec->channels = AV_RL32(p + 48); /* We treat the whole Speex packet as a single frame everywhere Speex is handled in FFmpeg. This avoids the complexities of splitting and joining individual Speex frames, which are not always byte-aligned. */ st->codec->frame_size = AV_RL32(p + 56); frames_per_packet = AV_RL32(p + 64); if (frames_per_packet) st->codec->frame_size *= frames_per_packet; st->codec->extradata_size = os->psize; st->codec->extradata = av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); memcpy(st->codec->extradata, p, st->codec->extradata_size); st->time_base.num = 1; st->time_base.den = st->codec->sample_rate; } else ff_vorbis_comment(s, &st->metadata, p, os->psize); spxp->seq++; return 1; } static int ogg_page_packets(struct ogg_stream *os) { int i; int packets = 0; for (i = 0; i < os->nsegs; i++) if (os->segments[i] < 255) packets++; return packets; } static int speex_packet(AVFormatContext *s, int idx) { struct ogg *ogg = s->priv_data; struct ogg_stream *os = ogg->streams + idx; struct speex_params *spxp = os->private; int packet_size = s->streams[idx]->codec->frame_size; if (os->flags & OGG_FLAG_EOS && os->lastpts != AV_NOPTS_VALUE && os->granule > 0) { /* first packet of final page. we have to calculate the final packet duration here because it is the only place we know the next-to-last granule position. */ spxp->final_packet_duration = os->granule - os->lastpts - packet_size * (ogg_page_packets(os) - 1); } if (!os->lastpts && os->granule > 0) /* first packet */ os->pduration = os->granule - packet_size * (ogg_page_packets(os) - 1); else if (os->flags & OGG_FLAG_EOS && os->segp == os->nsegs && spxp->final_packet_duration) /* final packet */ os->pduration = spxp->final_packet_duration; else os->pduration = packet_size; return 0; } const struct ogg_codec ff_speex_codec = { .magic = "Speex ", .magicsize = 8, .header = speex_header, .packet = speex_packet };
123linslouis-android-video-cutter
jni/libavformat/oggparsespeex.c
C
asf20
4,399
/* * MOV, 3GP, MP4 muxer * Copyright (c) 2003 Thomas Raivio * Copyright (c) 2004 Gildas Bazin <gbazin at videolan dot org> * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "movenc.h" #include "avformat.h" #include "riff.h" #include "avio.h" #include "isom.h" #include "avc.h" #include "libavcodec/get_bits.h" #include "libavcodec/put_bits.h" #include "internal.h" #include "libavutil/avstring.h" #undef NDEBUG #include <assert.h> //FIXME support 64 bit variant with wide placeholders static int64_t updateSize(ByteIOContext *pb, int64_t pos) { int64_t curpos = url_ftell(pb); url_fseek(pb, pos, SEEK_SET); put_be32(pb, curpos - pos); /* rewrite size */ url_fseek(pb, curpos, SEEK_SET); return curpos - pos; } /* Chunk offset atom */ static int mov_write_stco_tag(ByteIOContext *pb, MOVTrack *track) { int i; int mode64 = 0; // use 32 bit size variant if possible int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ if (pos > UINT32_MAX) { mode64 = 1; put_tag(pb, "co64"); } else put_tag(pb, "stco"); put_be32(pb, 0); /* version & flags */ put_be32(pb, track->entry); /* entry count */ for (i=0; i<track->entry; i++) { if(mode64 == 1) put_be64(pb, track->cluster[i].pos); else put_be32(pb, track->cluster[i].pos); } return updateSize(pb, pos); } /* Sample size atom */ static int mov_write_stsz_tag(ByteIOContext *pb, MOVTrack *track) { int equalChunks = 1; int i, j, entries = 0, tst = -1, oldtst = -1; int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ put_tag(pb, "stsz"); put_be32(pb, 0); /* version & flags */ for (i=0; i<track->entry; i++) { tst = track->cluster[i].size/track->cluster[i].entries; if(oldtst != -1 && tst != oldtst) { equalChunks = 0; } oldtst = tst; entries += track->cluster[i].entries; } if (equalChunks) { int sSize = track->cluster[0].size/track->cluster[0].entries; put_be32(pb, sSize); // sample size put_be32(pb, entries); // sample count } else { put_be32(pb, 0); // sample size put_be32(pb, entries); // sample count for (i=0; i<track->entry; i++) { for (j=0; j<track->cluster[i].entries; j++) { put_be32(pb, track->cluster[i].size / track->cluster[i].entries); } } } return updateSize(pb, pos); } /* Sample to chunk atom */ static int mov_write_stsc_tag(ByteIOContext *pb, MOVTrack *track) { int index = 0, oldval = -1, i; int64_t entryPos, curpos; int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ put_tag(pb, "stsc"); put_be32(pb, 0); // version & flags entryPos = url_ftell(pb); put_be32(pb, track->entry); // entry count for (i=0; i<track->entry; i++) { if(oldval != track->cluster[i].samplesInChunk) { put_be32(pb, i+1); // first chunk put_be32(pb, track->cluster[i].samplesInChunk); // samples per chunk put_be32(pb, 0x1); // sample description index oldval = track->cluster[i].samplesInChunk; index++; } } curpos = url_ftell(pb); url_fseek(pb, entryPos, SEEK_SET); put_be32(pb, index); // rewrite size url_fseek(pb, curpos, SEEK_SET); return updateSize(pb, pos); } /* Sync sample atom */ static int mov_write_stss_tag(ByteIOContext *pb, MOVTrack *track, uint32_t flag) { int64_t curpos, entryPos; int i, index = 0; int64_t pos = url_ftell(pb); put_be32(pb, 0); // size put_tag(pb, flag == MOV_SYNC_SAMPLE ? "stss" : "stps"); put_be32(pb, 0); // version & flags entryPos = url_ftell(pb); put_be32(pb, track->entry); // entry count for (i=0; i<track->entry; i++) { if (track->cluster[i].flags & flag) { put_be32(pb, i+1); index++; } } curpos = url_ftell(pb); url_fseek(pb, entryPos, SEEK_SET); put_be32(pb, index); // rewrite size url_fseek(pb, curpos, SEEK_SET); return updateSize(pb, pos); } static int mov_write_amr_tag(ByteIOContext *pb, MOVTrack *track) { put_be32(pb, 0x11); /* size */ if (track->mode == MODE_MOV) put_tag(pb, "samr"); else put_tag(pb, "damr"); put_tag(pb, "FFMP"); put_byte(pb, 0); /* decoder version */ put_be16(pb, 0x81FF); /* Mode set (all modes for AMR_NB) */ put_byte(pb, 0x00); /* Mode change period (no restriction) */ put_byte(pb, 0x01); /* Frames per sample */ return 0x11; } static int mov_write_ac3_tag(ByteIOContext *pb, MOVTrack *track) { GetBitContext gbc; PutBitContext pbc; uint8_t buf[3]; int fscod, bsid, bsmod, acmod, lfeon, frmsizecod; if (track->vosLen < 7) return -1; put_be32(pb, 11); put_tag(pb, "dac3"); init_get_bits(&gbc, track->vosData+4, track->vosLen-4); fscod = get_bits(&gbc, 2); frmsizecod = get_bits(&gbc, 6); bsid = get_bits(&gbc, 5); bsmod = get_bits(&gbc, 3); acmod = get_bits(&gbc, 3); if (acmod == 2) { skip_bits(&gbc, 2); // dsurmod } else { if ((acmod & 1) && acmod != 1) skip_bits(&gbc, 2); // cmixlev if (acmod & 4) skip_bits(&gbc, 2); // surmixlev } lfeon = get_bits1(&gbc); init_put_bits(&pbc, buf, sizeof(buf)); put_bits(&pbc, 2, fscod); put_bits(&pbc, 5, bsid); put_bits(&pbc, 3, bsmod); put_bits(&pbc, 3, acmod); put_bits(&pbc, 1, lfeon); put_bits(&pbc, 5, frmsizecod>>1); // bit_rate_code put_bits(&pbc, 5, 0); // reserved flush_put_bits(&pbc); put_buffer(pb, buf, sizeof(buf)); return 11; } /** * This function writes extradata "as is". * Extradata must be formated like a valid atom (with size and tag) */ static int mov_write_extradata_tag(ByteIOContext *pb, MOVTrack *track) { put_buffer(pb, track->enc->extradata, track->enc->extradata_size); return track->enc->extradata_size; } static int mov_write_enda_tag(ByteIOContext *pb) { put_be32(pb, 10); put_tag(pb, "enda"); put_be16(pb, 1); /* little endian */ return 10; } static unsigned int descrLength(unsigned int len) { int i; for(i=1; len>>(7*i); i++); return len + 1 + i; } static void putDescr(ByteIOContext *pb, int tag, unsigned int size) { int i= descrLength(size) - size - 2; put_byte(pb, tag); for(; i>0; i--) put_byte(pb, (size>>(7*i)) | 0x80); put_byte(pb, size & 0x7F); } static int mov_write_esds_tag(ByteIOContext *pb, MOVTrack *track) // Basic { int64_t pos = url_ftell(pb); int decoderSpecificInfoLen = track->vosLen ? descrLength(track->vosLen):0; put_be32(pb, 0); // size put_tag(pb, "esds"); put_be32(pb, 0); // Version // ES descriptor putDescr(pb, 0x03, 3 + descrLength(13 + decoderSpecificInfoLen) + descrLength(1)); put_be16(pb, track->trackID); put_byte(pb, 0x00); // flags (= no flags) // DecoderConfig descriptor putDescr(pb, 0x04, 13 + decoderSpecificInfoLen); // Object type indication if ((track->enc->codec_id == CODEC_ID_MP2 || track->enc->codec_id == CODEC_ID_MP3) && track->enc->sample_rate > 24000) put_byte(pb, 0x6B); // 11172-3 else put_byte(pb, ff_codec_get_tag(ff_mp4_obj_type, track->enc->codec_id)); // the following fields is made of 6 bits to identify the streamtype (4 for video, 5 for audio) // plus 1 bit to indicate upstream and 1 bit set to 1 (reserved) if(track->enc->codec_type == AVMEDIA_TYPE_AUDIO) put_byte(pb, 0x15); // flags (= Audiostream) else put_byte(pb, 0x11); // flags (= Visualstream) put_byte(pb, track->enc->rc_buffer_size>>(3+16)); // Buffersize DB (24 bits) put_be16(pb, (track->enc->rc_buffer_size>>3)&0xFFFF); // Buffersize DB put_be32(pb, FFMAX(track->enc->bit_rate, track->enc->rc_max_rate)); // maxbitrate (FIXME should be max rate in any 1 sec window) if(track->enc->rc_max_rate != track->enc->rc_min_rate || track->enc->rc_min_rate==0) put_be32(pb, 0); // vbr else put_be32(pb, track->enc->rc_max_rate); // avg bitrate if (track->vosLen) { // DecoderSpecific info descriptor putDescr(pb, 0x05, track->vosLen); put_buffer(pb, track->vosData, track->vosLen); } // SL descriptor putDescr(pb, 0x06, 1); put_byte(pb, 0x02); return updateSize(pb, pos); } static int mov_pcm_le_gt16(enum CodecID codec_id) { return codec_id == CODEC_ID_PCM_S24LE || codec_id == CODEC_ID_PCM_S32LE || codec_id == CODEC_ID_PCM_F32LE || codec_id == CODEC_ID_PCM_F64LE; } static int mov_write_wave_tag(ByteIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ put_tag(pb, "wave"); put_be32(pb, 12); /* size */ put_tag(pb, "frma"); put_le32(pb, track->tag); if (track->enc->codec_id == CODEC_ID_AAC) { /* useless atom needed by mplayer, ipod, not needed by quicktime */ put_be32(pb, 12); /* size */ put_tag(pb, "mp4a"); put_be32(pb, 0); mov_write_esds_tag(pb, track); } else if (mov_pcm_le_gt16(track->enc->codec_id)) { mov_write_enda_tag(pb); } else if (track->enc->codec_id == CODEC_ID_AMR_NB) { mov_write_amr_tag(pb, track); } else if (track->enc->codec_id == CODEC_ID_AC3) { mov_write_ac3_tag(pb, track); } else if (track->enc->codec_id == CODEC_ID_ALAC) { mov_write_extradata_tag(pb, track); } put_be32(pb, 8); /* size */ put_be32(pb, 0); /* null tag */ return updateSize(pb, pos); } static int mov_write_glbl_tag(ByteIOContext *pb, MOVTrack *track) { put_be32(pb, track->vosLen+8); put_tag(pb, "glbl"); put_buffer(pb, track->vosData, track->vosLen); return 8+track->vosLen; } /** * Compute flags for 'lpcm' tag. * See CoreAudioTypes and AudioStreamBasicDescription at Apple. */ static int mov_get_lpcm_flags(enum CodecID codec_id) { switch (codec_id) { case CODEC_ID_PCM_F32BE: case CODEC_ID_PCM_F64BE: return 11; case CODEC_ID_PCM_F32LE: case CODEC_ID_PCM_F64LE: return 9; case CODEC_ID_PCM_U8: return 10; case CODEC_ID_PCM_S16BE: case CODEC_ID_PCM_S24BE: case CODEC_ID_PCM_S32BE: return 14; case CODEC_ID_PCM_S8: case CODEC_ID_PCM_S16LE: case CODEC_ID_PCM_S24LE: case CODEC_ID_PCM_S32LE: return 12; default: return 0; } } static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); int version = 0; uint32_t tag = track->tag; if (track->mode == MODE_MOV) { if (track->timescale > UINT16_MAX) { if (mov_get_lpcm_flags(track->enc->codec_id)) tag = AV_RL32("lpcm"); version = 2; } else if (track->audio_vbr || mov_pcm_le_gt16(track->enc->codec_id)) { version = 1; } } put_be32(pb, 0); /* size */ put_le32(pb, tag); // store it byteswapped put_be32(pb, 0); /* Reserved */ put_be16(pb, 0); /* Reserved */ put_be16(pb, 1); /* Data-reference index, XXX == 1 */ /* SoundDescription */ put_be16(pb, version); /* Version */ put_be16(pb, 0); /* Revision level */ put_be32(pb, 0); /* Reserved */ if (version == 2) { put_be16(pb, 3); put_be16(pb, 16); put_be16(pb, 0xfffe); put_be16(pb, 0); put_be32(pb, 0x00010000); put_be32(pb, 72); put_be64(pb, av_dbl2int(track->timescale)); put_be32(pb, track->enc->channels); put_be32(pb, 0x7F000000); put_be32(pb, av_get_bits_per_sample(track->enc->codec_id)); put_be32(pb, mov_get_lpcm_flags(track->enc->codec_id)); put_be32(pb, track->sampleSize); put_be32(pb, track->enc->frame_size); } else { if (track->mode == MODE_MOV) { put_be16(pb, track->enc->channels); if (track->enc->codec_id == CODEC_ID_PCM_U8 || track->enc->codec_id == CODEC_ID_PCM_S8) put_be16(pb, 8); /* bits per sample */ else put_be16(pb, 16); put_be16(pb, track->audio_vbr ? -2 : 0); /* compression ID */ } else { /* reserved for mp4/3gp */ put_be16(pb, 2); put_be16(pb, 16); put_be16(pb, 0); } put_be16(pb, 0); /* packet size (= 0) */ put_be16(pb, track->timescale); /* Time scale */ put_be16(pb, 0); /* Reserved */ } if(version == 1) { /* SoundDescription V1 extended info */ put_be32(pb, track->enc->frame_size); /* Samples per packet */ put_be32(pb, track->sampleSize / track->enc->channels); /* Bytes per packet */ put_be32(pb, track->sampleSize); /* Bytes per frame */ put_be32(pb, 2); /* Bytes per sample */ } if(track->mode == MODE_MOV && (track->enc->codec_id == CODEC_ID_AAC || track->enc->codec_id == CODEC_ID_AC3 || track->enc->codec_id == CODEC_ID_AMR_NB || track->enc->codec_id == CODEC_ID_ALAC || mov_pcm_le_gt16(track->enc->codec_id))) mov_write_wave_tag(pb, track); else if(track->tag == MKTAG('m','p','4','a')) mov_write_esds_tag(pb, track); else if(track->enc->codec_id == CODEC_ID_AMR_NB) mov_write_amr_tag(pb, track); else if(track->enc->codec_id == CODEC_ID_AC3) mov_write_ac3_tag(pb, track); else if(track->enc->codec_id == CODEC_ID_ALAC) mov_write_extradata_tag(pb, track); else if(track->vosLen > 0) mov_write_glbl_tag(pb, track); return updateSize(pb, pos); } static int mov_write_d263_tag(ByteIOContext *pb) { put_be32(pb, 0xf); /* size */ put_tag(pb, "d263"); put_tag(pb, "FFMP"); put_byte(pb, 0); /* decoder version */ /* FIXME use AVCodecContext level/profile, when encoder will set values */ put_byte(pb, 0xa); /* level */ put_byte(pb, 0); /* profile */ return 0xf; } /* TODO: No idea about these values */ static int mov_write_svq3_tag(ByteIOContext *pb) { put_be32(pb, 0x15); put_tag(pb, "SMI "); put_tag(pb, "SEQH"); put_be32(pb, 0x5); put_be32(pb, 0xe2c0211d); put_be32(pb, 0xc0000000); put_byte(pb, 0); return 0x15; } static int mov_write_avcc_tag(ByteIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); put_be32(pb, 0); put_tag(pb, "avcC"); ff_isom_write_avcc(pb, track->vosData, track->vosLen); return updateSize(pb, pos); } /* also used by all avid codecs (dv, imx, meridien) and their variants */ static int mov_write_avid_tag(ByteIOContext *pb, MOVTrack *track) { int i; put_be32(pb, 24); /* size */ put_tag(pb, "ACLR"); put_tag(pb, "ACLR"); put_tag(pb, "0001"); put_be32(pb, 1); /* yuv 1 / rgb 2 ? */ put_be32(pb, 0); /* unknown */ put_be32(pb, 24); /* size */ put_tag(pb, "APRG"); put_tag(pb, "APRG"); put_tag(pb, "0001"); put_be32(pb, 1); /* unknown */ put_be32(pb, 0); /* unknown */ put_be32(pb, 120); /* size */ put_tag(pb, "ARES"); put_tag(pb, "ARES"); put_tag(pb, "0001"); put_be32(pb, AV_RB32(track->vosData + 0x28)); /* dnxhd cid, some id ? */ put_be32(pb, track->enc->width); /* values below are based on samples created with quicktime and avid codecs */ if (track->vosData[5] & 2) { // interlaced put_be32(pb, track->enc->height/2); put_be32(pb, 2); /* unknown */ put_be32(pb, 0); /* unknown */ put_be32(pb, 4); /* unknown */ } else { put_be32(pb, track->enc->height); put_be32(pb, 1); /* unknown */ put_be32(pb, 0); /* unknown */ if (track->enc->height == 1080) put_be32(pb, 5); /* unknown */ else put_be32(pb, 6); /* unknown */ } /* padding */ for (i = 0; i < 10; i++) put_be64(pb, 0); /* extra padding for stsd needed */ put_be32(pb, 0); return 0; } static int mp4_get_codec_tag(AVFormatContext *s, MOVTrack *track) { int tag = track->enc->codec_tag; if (!ff_codec_get_tag(ff_mp4_obj_type, track->enc->codec_id)) return 0; if (track->enc->codec_id == CODEC_ID_H264) tag = MKTAG('a','v','c','1'); else if (track->enc->codec_id == CODEC_ID_AC3) tag = MKTAG('a','c','-','3'); else if (track->enc->codec_id == CODEC_ID_DIRAC) tag = MKTAG('d','r','a','c'); else if (track->enc->codec_id == CODEC_ID_MOV_TEXT) tag = MKTAG('t','x','3','g'); else if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) tag = MKTAG('m','p','4','v'); else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) tag = MKTAG('m','p','4','a'); return tag; } static const AVCodecTag codec_ipod_tags[] = { { CODEC_ID_H264, MKTAG('a','v','c','1') }, { CODEC_ID_MPEG4, MKTAG('m','p','4','v') }, { CODEC_ID_AAC, MKTAG('m','p','4','a') }, { CODEC_ID_ALAC, MKTAG('a','l','a','c') }, { CODEC_ID_AC3, MKTAG('a','c','-','3') }, { CODEC_ID_MOV_TEXT, MKTAG('t','x','3','g') }, { CODEC_ID_MOV_TEXT, MKTAG('t','e','x','t') }, { CODEC_ID_NONE, 0 }, }; static int ipod_get_codec_tag(AVFormatContext *s, MOVTrack *track) { int tag = track->enc->codec_tag; // keep original tag for subs, ipod supports both formats if (!(track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE && (tag == MKTAG('t','x','3','g') || tag == MKTAG('t','e','x','t')))) tag = ff_codec_get_tag(codec_ipod_tags, track->enc->codec_id); if (!av_match_ext(s->filename, "m4a") && !av_match_ext(s->filename, "m4v")) av_log(s, AV_LOG_WARNING, "Warning, extension is not .m4a nor .m4v " "Quicktime/Ipod might not play the file\n"); return tag; } static int mov_get_dv_codec_tag(AVFormatContext *s, MOVTrack *track) { int tag; if (track->enc->height == 480) /* NTSC */ if (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','n'); else tag = MKTAG('d','v','c',' '); else if (track->enc->pix_fmt == PIX_FMT_YUV422P) tag = MKTAG('d','v','5','p'); else if (track->enc->pix_fmt == PIX_FMT_YUV420P) tag = MKTAG('d','v','c','p'); else tag = MKTAG('d','v','p','p'); return tag; } static const struct { enum PixelFormat pix_fmt; uint32_t tag; unsigned bps; } mov_pix_fmt_tags[] = { { PIX_FMT_YUYV422, MKTAG('y','u','v','s'), 0 }, { PIX_FMT_UYVY422, MKTAG('2','v','u','y'), 0 }, { PIX_FMT_BGR555, MKTAG('r','a','w',' '), 16 }, { PIX_FMT_RGB555LE,MKTAG('L','5','5','5'), 16 }, { PIX_FMT_RGB565LE,MKTAG('L','5','6','5'), 16 }, { PIX_FMT_RGB565BE,MKTAG('B','5','6','5'), 16 }, { PIX_FMT_RGB24, MKTAG('r','a','w',' '), 24 }, { PIX_FMT_BGR24, MKTAG('2','4','B','G'), 24 }, { PIX_FMT_ARGB, MKTAG('r','a','w',' '), 32 }, { PIX_FMT_BGRA, MKTAG('B','G','R','A'), 32 }, { PIX_FMT_RGBA, MKTAG('R','G','B','A'), 32 }, }; static int mov_get_rawvideo_codec_tag(AVFormatContext *s, MOVTrack *track) { int tag = track->enc->codec_tag; int i; for (i = 0; i < FF_ARRAY_ELEMS(mov_pix_fmt_tags); i++) { if (track->enc->pix_fmt == mov_pix_fmt_tags[i].pix_fmt) { tag = mov_pix_fmt_tags[i].tag; track->enc->bits_per_coded_sample = mov_pix_fmt_tags[i].bps; break; } } return tag; } static int mov_get_codec_tag(AVFormatContext *s, MOVTrack *track) { int tag = track->enc->codec_tag; if (!tag || (track->enc->strict_std_compliance >= FF_COMPLIANCE_NORMAL && (tag == MKTAG('d','v','c','p') || track->enc->codec_id == CODEC_ID_RAWVIDEO || av_get_bits_per_sample(track->enc->codec_id)))) { // pcm audio if (track->enc->codec_id == CODEC_ID_DVVIDEO) tag = mov_get_dv_codec_tag(s, track); else if (track->enc->codec_id == CODEC_ID_RAWVIDEO) tag = mov_get_rawvideo_codec_tag(s, track); else if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) { tag = ff_codec_get_tag(codec_movvideo_tags, track->enc->codec_id); if (!tag) { // if no mac fcc found, try with Microsoft tags tag = ff_codec_get_tag(ff_codec_bmp_tags, track->enc->codec_id); if (tag) av_log(s, AV_LOG_INFO, "Warning, using MS style video codec tag, " "the file may be unplayable!\n"); } } else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) { tag = ff_codec_get_tag(codec_movaudio_tags, track->enc->codec_id); if (!tag) { // if no mac fcc found, try with Microsoft tags int ms_tag = ff_codec_get_tag(ff_codec_wav_tags, track->enc->codec_id); if (ms_tag) { tag = MKTAG('m', 's', ((ms_tag >> 8) & 0xff), (ms_tag & 0xff)); av_log(s, AV_LOG_INFO, "Warning, using MS style audio codec tag, " "the file may be unplayable!\n"); } } } else if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE) tag = ff_codec_get_tag(ff_codec_movsubtitle_tags, track->enc->codec_id); } return tag; } static const AVCodecTag codec_3gp_tags[] = { { CODEC_ID_H263, MKTAG('s','2','6','3') }, { CODEC_ID_H264, MKTAG('a','v','c','1') }, { CODEC_ID_MPEG4, MKTAG('m','p','4','v') }, { CODEC_ID_AAC, MKTAG('m','p','4','a') }, { CODEC_ID_AMR_NB, MKTAG('s','a','m','r') }, { CODEC_ID_AMR_WB, MKTAG('s','a','w','b') }, { CODEC_ID_MOV_TEXT, MKTAG('t','x','3','g') }, { CODEC_ID_NONE, 0 }, }; static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track) { int tag = track->enc->codec_tag; if (track->mode == MODE_MP4 || track->mode == MODE_PSP) tag = mp4_get_codec_tag(s, track); else if (track->mode == MODE_IPOD) tag = ipod_get_codec_tag(s, track); else if (track->mode & MODE_3GP) tag = ff_codec_get_tag(codec_3gp_tags, track->enc->codec_id); else tag = mov_get_codec_tag(s, track); return tag; } /** Write uuid atom. * Needed to make file play in iPods running newest firmware * goes after avcC atom in moov.trak.mdia.minf.stbl.stsd.avc1 */ static int mov_write_uuid_tag_ipod(ByteIOContext *pb) { put_be32(pb, 28); put_tag(pb, "uuid"); put_be32(pb, 0x6b6840f2); put_be32(pb, 0x5f244fc5); put_be32(pb, 0xba39a51b); put_be32(pb, 0xcf0323f3); put_be32(pb, 0x0); return 28; } static int mov_write_subtitle_tag(ByteIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ put_le32(pb, track->tag); // store it byteswapped put_be32(pb, 0); /* Reserved */ put_be16(pb, 0); /* Reserved */ put_be16(pb, 1); /* Data-reference index */ if (track->enc->extradata_size) put_buffer(pb, track->enc->extradata, track->enc->extradata_size); return updateSize(pb, pos); } static int mov_write_video_tag(ByteIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); char compressor_name[32]; put_be32(pb, 0); /* size */ put_le32(pb, track->tag); // store it byteswapped put_be32(pb, 0); /* Reserved */ put_be16(pb, 0); /* Reserved */ put_be16(pb, 1); /* Data-reference index */ put_be16(pb, 0); /* Codec stream version */ put_be16(pb, 0); /* Codec stream revision (=0) */ if (track->mode == MODE_MOV) { put_tag(pb, "FFMP"); /* Vendor */ if(track->enc->codec_id == CODEC_ID_RAWVIDEO) { put_be32(pb, 0); /* Temporal Quality */ put_be32(pb, 0x400); /* Spatial Quality = lossless*/ } else { put_be32(pb, 0x200); /* Temporal Quality = normal */ put_be32(pb, 0x200); /* Spatial Quality = normal */ } } else { put_be32(pb, 0); /* Reserved */ put_be32(pb, 0); /* Reserved */ put_be32(pb, 0); /* Reserved */ } put_be16(pb, track->enc->width); /* Video width */ put_be16(pb, track->height); /* Video height */ put_be32(pb, 0x00480000); /* Horizontal resolution 72dpi */ put_be32(pb, 0x00480000); /* Vertical resolution 72dpi */ put_be32(pb, 0); /* Data size (= 0) */ put_be16(pb, 1); /* Frame count (= 1) */ memset(compressor_name,0,32); /* FIXME not sure, ISO 14496-1 draft where it shall be set to 0 */ if (track->mode == MODE_MOV && track->enc->codec && track->enc->codec->name) strncpy(compressor_name,track->enc->codec->name,31); put_byte(pb, strlen(compressor_name)); put_buffer(pb, compressor_name, 31); if (track->mode == MODE_MOV && track->enc->bits_per_coded_sample) put_be16(pb, track->enc->bits_per_coded_sample); else put_be16(pb, 0x18); /* Reserved */ put_be16(pb, 0xffff); /* Reserved */ if(track->tag == MKTAG('m','p','4','v')) mov_write_esds_tag(pb, track); else if(track->enc->codec_id == CODEC_ID_H263) mov_write_d263_tag(pb); else if(track->enc->codec_id == CODEC_ID_SVQ3) mov_write_svq3_tag(pb); else if(track->enc->codec_id == CODEC_ID_DNXHD) mov_write_avid_tag(pb, track); else if(track->enc->codec_id == CODEC_ID_H264) { mov_write_avcc_tag(pb, track); if(track->mode == MODE_IPOD) mov_write_uuid_tag_ipod(pb); } else if(track->vosLen > 0) mov_write_glbl_tag(pb, track); return updateSize(pb, pos); } static int mov_write_rtp_tag(ByteIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ put_tag(pb, "rtp "); put_be32(pb, 0); /* Reserved */ put_be16(pb, 0); /* Reserved */ put_be16(pb, 1); /* Data-reference index */ put_be16(pb, 1); /* Hint track version */ put_be16(pb, 1); /* Highest compatible version */ put_be32(pb, track->max_packet_size); /* Max packet size */ put_be32(pb, 12); /* size */ put_tag(pb, "tims"); put_be32(pb, track->timescale); return updateSize(pb, pos); } static int mov_write_stsd_tag(ByteIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ put_tag(pb, "stsd"); put_be32(pb, 0); /* version & flags */ put_be32(pb, 1); /* entry count */ if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) mov_write_video_tag(pb, track); else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) mov_write_audio_tag(pb, track); else if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE) mov_write_subtitle_tag(pb, track); else if (track->enc->codec_tag == MKTAG('r','t','p',' ')) mov_write_rtp_tag(pb, track); return updateSize(pb, pos); } static int mov_write_ctts_tag(ByteIOContext *pb, MOVTrack *track) { MOVStts *ctts_entries; uint32_t entries = 0; uint32_t atom_size; int i; ctts_entries = av_malloc((track->entry + 1) * sizeof(*ctts_entries)); /* worst case */ ctts_entries[0].count = 1; ctts_entries[0].duration = track->cluster[0].cts; for (i=1; i<track->entry; i++) { if (track->cluster[i].cts == ctts_entries[entries].duration) { ctts_entries[entries].count++; /* compress */ } else { entries++; ctts_entries[entries].duration = track->cluster[i].cts; ctts_entries[entries].count = 1; } } entries++; /* last one */ atom_size = 16 + (entries * 8); put_be32(pb, atom_size); /* size */ put_tag(pb, "ctts"); put_be32(pb, 0); /* version & flags */ put_be32(pb, entries); /* entry count */ for (i=0; i<entries; i++) { put_be32(pb, ctts_entries[i].count); put_be32(pb, ctts_entries[i].duration); } av_free(ctts_entries); return atom_size; } /* Time to sample atom */ static int mov_write_stts_tag(ByteIOContext *pb, MOVTrack *track) { MOVStts *stts_entries; uint32_t entries = -1; uint32_t atom_size; int i; if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO && !track->audio_vbr) { stts_entries = av_malloc(sizeof(*stts_entries)); /* one entry */ stts_entries[0].count = track->sampleCount; stts_entries[0].duration = 1; entries = 1; } else { stts_entries = av_malloc(track->entry * sizeof(*stts_entries)); /* worst case */ for (i=0; i<track->entry; i++) { int64_t duration = i + 1 == track->entry ? track->trackDuration - track->cluster[i].dts + track->cluster[0].dts : /* readjusting */ track->cluster[i+1].dts - track->cluster[i].dts; if (i && duration == stts_entries[entries].duration) { stts_entries[entries].count++; /* compress */ } else { entries++; stts_entries[entries].duration = duration; stts_entries[entries].count = 1; } } entries++; /* last one */ } atom_size = 16 + (entries * 8); put_be32(pb, atom_size); /* size */ put_tag(pb, "stts"); put_be32(pb, 0); /* version & flags */ put_be32(pb, entries); /* entry count */ for (i=0; i<entries; i++) { put_be32(pb, stts_entries[i].count); put_be32(pb, stts_entries[i].duration); } av_free(stts_entries); return atom_size; } static int mov_write_dref_tag(ByteIOContext *pb) { put_be32(pb, 28); /* size */ put_tag(pb, "dref"); put_be32(pb, 0); /* version & flags */ put_be32(pb, 1); /* entry count */ put_be32(pb, 0xc); /* size */ put_tag(pb, "url "); put_be32(pb, 1); /* version & flags */ return 28; } static int mov_write_stbl_tag(ByteIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ put_tag(pb, "stbl"); mov_write_stsd_tag(pb, track); mov_write_stts_tag(pb, track); if ((track->enc->codec_type == AVMEDIA_TYPE_VIDEO || track->enc->codec_tag == MKTAG('r','t','p',' ')) && track->hasKeyframes && track->hasKeyframes < track->entry) mov_write_stss_tag(pb, track, MOV_SYNC_SAMPLE); if (track->mode == MODE_MOV && track->flags & MOV_TRACK_STPS) mov_write_stss_tag(pb, track, MOV_PARTIAL_SYNC_SAMPLE); if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO && track->flags & MOV_TRACK_CTTS) mov_write_ctts_tag(pb, track); mov_write_stsc_tag(pb, track); mov_write_stsz_tag(pb, track); mov_write_stco_tag(pb, track); return updateSize(pb, pos); } static int mov_write_dinf_tag(ByteIOContext *pb) { int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ put_tag(pb, "dinf"); mov_write_dref_tag(pb); return updateSize(pb, pos); } static int mov_write_nmhd_tag(ByteIOContext *pb) { put_be32(pb, 12); put_tag(pb, "nmhd"); put_be32(pb, 0); return 12; } static int mov_write_gmhd_tag(ByteIOContext *pb) { put_be32(pb, 0x20); /* size */ put_tag(pb, "gmhd"); put_be32(pb, 0x18); /* gmin size */ put_tag(pb, "gmin"); /* generic media info */ put_be32(pb, 0); /* version & flags */ put_be16(pb, 0x40); /* graphics mode = */ put_be16(pb, 0x8000); /* opColor (r?) */ put_be16(pb, 0x8000); /* opColor (g?) */ put_be16(pb, 0x8000); /* opColor (b?) */ put_be16(pb, 0); /* balance */ put_be16(pb, 0); /* reserved */ return 0x20; } static int mov_write_smhd_tag(ByteIOContext *pb) { put_be32(pb, 16); /* size */ put_tag(pb, "smhd"); put_be32(pb, 0); /* version & flags */ put_be16(pb, 0); /* reserved (balance, normally = 0) */ put_be16(pb, 0); /* reserved */ return 16; } static int mov_write_vmhd_tag(ByteIOContext *pb) { put_be32(pb, 0x14); /* size (always 0x14) */ put_tag(pb, "vmhd"); put_be32(pb, 0x01); /* version & flags */ put_be64(pb, 0); /* reserved (graphics mode = copy) */ return 0x14; } static int mov_write_hdlr_tag(ByteIOContext *pb, MOVTrack *track) { const char *hdlr, *descr = NULL, *hdlr_type = NULL; int64_t pos = url_ftell(pb); if (!track) { /* no media --> data handler */ hdlr = "dhlr"; hdlr_type = "url "; descr = "DataHandler"; } else { hdlr = (track->mode == MODE_MOV) ? "mhlr" : "\0\0\0\0"; if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) { hdlr_type = "vide"; descr = "VideoHandler"; } else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) { hdlr_type = "soun"; descr = "SoundHandler"; } else if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE) { if (track->tag == MKTAG('t','x','3','g')) hdlr_type = "sbtl"; else hdlr_type = "text"; descr = "SubtitleHandler"; } else if (track->enc->codec_tag == MKTAG('r','t','p',' ')) { hdlr_type = "hint"; descr = "HintHandler"; } } put_be32(pb, 0); /* size */ put_tag(pb, "hdlr"); put_be32(pb, 0); /* Version & flags */ put_buffer(pb, hdlr, 4); /* handler */ put_tag(pb, hdlr_type); /* handler type */ put_be32(pb ,0); /* reserved */ put_be32(pb ,0); /* reserved */ put_be32(pb ,0); /* reserved */ if (!track || track->mode == MODE_MOV) put_byte(pb, strlen(descr)); /* pascal string */ put_buffer(pb, descr, strlen(descr)); /* handler description */ if (track && track->mode != MODE_MOV) put_byte(pb, 0); /* c string */ return updateSize(pb, pos); } static int mov_write_hmhd_tag(ByteIOContext *pb) { /* This atom must be present, but leaving the values at zero * seems harmless. */ put_be32(pb, 28); /* size */ put_tag(pb, "hmhd"); put_be32(pb, 0); /* version, flags */ put_be16(pb, 0); /* maxPDUsize */ put_be16(pb, 0); /* avgPDUsize */ put_be32(pb, 0); /* maxbitrate */ put_be32(pb, 0); /* avgbitrate */ put_be32(pb, 0); /* reserved */ return 28; } static int mov_write_minf_tag(ByteIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ put_tag(pb, "minf"); if(track->enc->codec_type == AVMEDIA_TYPE_VIDEO) mov_write_vmhd_tag(pb); else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) mov_write_smhd_tag(pb); else if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE) { if (track->tag == MKTAG('t','e','x','t')) mov_write_gmhd_tag(pb); else mov_write_nmhd_tag(pb); } else if (track->tag == MKTAG('r','t','p',' ')) { mov_write_hmhd_tag(pb); } if (track->mode == MODE_MOV) /* FIXME: Why do it for MODE_MOV only ? */ mov_write_hdlr_tag(pb, NULL); mov_write_dinf_tag(pb); mov_write_stbl_tag(pb, track); return updateSize(pb, pos); } static int mov_write_mdhd_tag(ByteIOContext *pb, MOVTrack *track) { int version = track->trackDuration < INT32_MAX ? 0 : 1; (version == 1) ? put_be32(pb, 44) : put_be32(pb, 32); /* size */ put_tag(pb, "mdhd"); put_byte(pb, version); put_be24(pb, 0); /* flags */ if (version == 1) { put_be64(pb, track->time); put_be64(pb, track->time); } else { put_be32(pb, track->time); /* creation time */ put_be32(pb, track->time); /* modification time */ } put_be32(pb, track->timescale); /* time scale (sample rate for audio) */ (version == 1) ? put_be64(pb, track->trackDuration) : put_be32(pb, track->trackDuration); /* duration */ put_be16(pb, track->language); /* language */ put_be16(pb, 0); /* reserved (quality) */ if(version!=0 && track->mode == MODE_MOV){ av_log(NULL, AV_LOG_ERROR, "FATAL error, file duration too long for timebase, this file will not be\n" "playable with quicktime. Choose a different timebase or a different\n" "container format\n"); } return 32; } static int mov_write_mdia_tag(ByteIOContext *pb, MOVTrack *track) { int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ put_tag(pb, "mdia"); mov_write_mdhd_tag(pb, track); mov_write_hdlr_tag(pb, track); mov_write_minf_tag(pb, track); return updateSize(pb, pos); } static int mov_write_tkhd_tag(ByteIOContext *pb, MOVTrack *track, AVStream *st) { int64_t duration = av_rescale_rnd(track->trackDuration, MOV_TIMESCALE, track->timescale, AV_ROUND_UP); int version = duration < INT32_MAX ? 0 : 1; (version == 1) ? put_be32(pb, 104) : put_be32(pb, 92); /* size */ put_tag(pb, "tkhd"); put_byte(pb, version); put_be24(pb, 0xf); /* flags (track enabled) */ if (version == 1) { put_be64(pb, track->time); put_be64(pb, track->time); } else { put_be32(pb, track->time); /* creation time */ put_be32(pb, track->time); /* modification time */ } put_be32(pb, track->trackID); /* track-id */ put_be32(pb, 0); /* reserved */ (version == 1) ? put_be64(pb, duration) : put_be32(pb, duration); put_be32(pb, 0); /* reserved */ put_be32(pb, 0); /* reserved */ put_be32(pb, 0x0); /* reserved (Layer & Alternate group) */ /* Volume, only for audio */ if(track->enc->codec_type == AVMEDIA_TYPE_AUDIO) put_be16(pb, 0x0100); else put_be16(pb, 0); put_be16(pb, 0); /* reserved */ /* Matrix structure */ put_be32(pb, 0x00010000); /* reserved */ put_be32(pb, 0x0); /* reserved */ put_be32(pb, 0x0); /* reserved */ put_be32(pb, 0x0); /* reserved */ put_be32(pb, 0x00010000); /* reserved */ put_be32(pb, 0x0); /* reserved */ put_be32(pb, 0x0); /* reserved */ put_be32(pb, 0x0); /* reserved */ put_be32(pb, 0x40000000); /* reserved */ /* Track width and height, for visual only */ if(st && (track->enc->codec_type == AVMEDIA_TYPE_VIDEO || track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE)) { double sample_aspect_ratio = av_q2d(st->sample_aspect_ratio); if(!sample_aspect_ratio || track->height != track->enc->height) sample_aspect_ratio = 1; put_be32(pb, sample_aspect_ratio * track->enc->width*0x10000); put_be32(pb, track->height*0x10000); } else { put_be32(pb, 0); put_be32(pb, 0); } return 0x5c; } // This box seems important for the psp playback ... without it the movie seems to hang static int mov_write_edts_tag(ByteIOContext *pb, MOVTrack *track) { put_be32(pb, 0x24); /* size */ put_tag(pb, "edts"); put_be32(pb, 0x1c); /* size */ put_tag(pb, "elst"); put_be32(pb, 0x0); put_be32(pb, 0x1); /* duration ... doesn't seem to effect psp */ put_be32(pb, av_rescale_rnd(track->trackDuration, MOV_TIMESCALE, track->timescale, AV_ROUND_UP)); put_be32(pb, track->cluster[0].cts); /* first pts is cts since dts is 0 */ put_be32(pb, 0x00010000); return 0x24; } static int mov_write_tref_tag(ByteIOContext *pb, MOVTrack *track) { put_be32(pb, 20); // size put_tag(pb, "tref"); put_be32(pb, 12); // size (subatom) put_le32(pb, track->tref_tag); put_be32(pb, track->tref_id); return 20; } // goes at the end of each track! ... Critical for PSP playback ("Incompatible data" without it) static int mov_write_uuid_tag_psp(ByteIOContext *pb, MOVTrack *mov) { put_be32(pb, 0x34); /* size ... reports as 28 in mp4box! */ put_tag(pb, "uuid"); put_tag(pb, "USMT"); put_be32(pb, 0x21d24fce); put_be32(pb, 0xbb88695c); put_be32(pb, 0xfac9c740); put_be32(pb, 0x1c); // another size here! put_tag(pb, "MTDT"); put_be32(pb, 0x00010012); put_be32(pb, 0x0a); put_be32(pb, 0x55c40000); put_be32(pb, 0x1); put_be32(pb, 0x0); return 0x34; } static int mov_write_udta_sdp(ByteIOContext *pb, AVCodecContext *ctx, int index) { char buf[1000] = ""; int len; ff_sdp_write_media(buf, sizeof(buf), ctx, NULL, 0, 0); av_strlcatf(buf, sizeof(buf), "a=control:streamid=%d\r\n", index); len = strlen(buf); put_be32(pb, len + 24); put_tag (pb, "udta"); put_be32(pb, len + 16); put_tag (pb, "hnti"); put_be32(pb, len + 8); put_tag (pb, "sdp "); put_buffer(pb, buf, len); return len + 24; } static int mov_write_trak_tag(ByteIOContext *pb, MOVTrack *track, AVStream *st) { int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ put_tag(pb, "trak"); mov_write_tkhd_tag(pb, track, st); if (track->mode == MODE_PSP || track->flags & MOV_TRACK_CTTS) mov_write_edts_tag(pb, track); // PSP Movies require edts box if (track->tref_tag) mov_write_tref_tag(pb, track); mov_write_mdia_tag(pb, track); if (track->mode == MODE_PSP) mov_write_uuid_tag_psp(pb,track); // PSP Movies require this uuid box if (track->tag == MKTAG('r','t','p',' ')) mov_write_udta_sdp(pb, track->rtp_ctx->streams[0]->codec, track->trackID); return updateSize(pb, pos); } #if 0 /* TODO: Not sorted out, but not necessary either */ static int mov_write_iods_tag(ByteIOContext *pb, MOVMuxContext *mov) { put_be32(pb, 0x15); /* size */ put_tag(pb, "iods"); put_be32(pb, 0); /* version & flags */ put_be16(pb, 0x1007); put_byte(pb, 0); put_be16(pb, 0x4fff); put_be16(pb, 0xfffe); put_be16(pb, 0x01ff); return 0x15; } #endif static int mov_write_mvhd_tag(ByteIOContext *pb, MOVMuxContext *mov) { int maxTrackID = 1, i; int64_t maxTrackLenTemp, maxTrackLen = 0; int version; for (i=0; i<mov->nb_streams; i++) { if(mov->tracks[i].entry > 0) { maxTrackLenTemp = av_rescale_rnd(mov->tracks[i].trackDuration, MOV_TIMESCALE, mov->tracks[i].timescale, AV_ROUND_UP); if(maxTrackLen < maxTrackLenTemp) maxTrackLen = maxTrackLenTemp; if(maxTrackID < mov->tracks[i].trackID) maxTrackID = mov->tracks[i].trackID; } } version = maxTrackLen < UINT32_MAX ? 0 : 1; (version == 1) ? put_be32(pb, 120) : put_be32(pb, 108); /* size */ put_tag(pb, "mvhd"); put_byte(pb, version); put_be24(pb, 0); /* flags */ if (version == 1) { put_be64(pb, mov->time); put_be64(pb, mov->time); } else { put_be32(pb, mov->time); /* creation time */ put_be32(pb, mov->time); /* modification time */ } put_be32(pb, MOV_TIMESCALE); (version == 1) ? put_be64(pb, maxTrackLen) : put_be32(pb, maxTrackLen); /* duration of longest track */ put_be32(pb, 0x00010000); /* reserved (preferred rate) 1.0 = normal */ put_be16(pb, 0x0100); /* reserved (preferred volume) 1.0 = normal */ put_be16(pb, 0); /* reserved */ put_be32(pb, 0); /* reserved */ put_be32(pb, 0); /* reserved */ /* Matrix structure */ put_be32(pb, 0x00010000); /* reserved */ put_be32(pb, 0x0); /* reserved */ put_be32(pb, 0x0); /* reserved */ put_be32(pb, 0x0); /* reserved */ put_be32(pb, 0x00010000); /* reserved */ put_be32(pb, 0x0); /* reserved */ put_be32(pb, 0x0); /* reserved */ put_be32(pb, 0x0); /* reserved */ put_be32(pb, 0x40000000); /* reserved */ put_be32(pb, 0); /* reserved (preview time) */ put_be32(pb, 0); /* reserved (preview duration) */ put_be32(pb, 0); /* reserved (poster time) */ put_be32(pb, 0); /* reserved (selection time) */ put_be32(pb, 0); /* reserved (selection duration) */ put_be32(pb, 0); /* reserved (current time) */ put_be32(pb, maxTrackID+1); /* Next track id */ return 0x6c; } static int mov_write_itunes_hdlr_tag(ByteIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { put_be32(pb, 33); /* size */ put_tag(pb, "hdlr"); put_be32(pb, 0); put_be32(pb, 0); put_tag(pb, "mdir"); put_tag(pb, "appl"); put_be32(pb, 0); put_be32(pb, 0); put_byte(pb, 0); return 33; } /* helper function to write a data tag with the specified string as data */ static int mov_write_string_data_tag(ByteIOContext *pb, const char *data, int lang, int long_style) { if(long_style){ int size = 16 + strlen(data); put_be32(pb, size); /* size */ put_tag(pb, "data"); put_be32(pb, 1); put_be32(pb, 0); put_buffer(pb, data, strlen(data)); return size; }else{ if (!lang) lang = ff_mov_iso639_to_lang("und", 1); put_be16(pb, strlen(data)); /* string length */ put_be16(pb, lang); put_buffer(pb, data, strlen(data)); return strlen(data) + 4; } } static int mov_write_string_tag(ByteIOContext *pb, const char *name, const char *value, int lang, int long_style){ int size = 0; if (value && value[0]) { int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ put_tag(pb, name); mov_write_string_data_tag(pb, value, lang, long_style); size= updateSize(pb, pos); } return size; } static int mov_write_string_metadata(AVFormatContext *s, ByteIOContext *pb, const char *name, const char *tag, int long_style) { int l, lang = 0, len, len2; AVMetadataTag *t, *t2 = NULL; char tag2[16]; if (!(t = av_metadata_get(s->metadata, tag, NULL, 0))) return 0; len = strlen(t->key); snprintf(tag2, sizeof(tag2), "%s-", tag); while ((t2 = av_metadata_get(s->metadata, tag2, t2, AV_METADATA_IGNORE_SUFFIX))) { len2 = strlen(t2->key); if (len2 == len+4 && !strcmp(t->value, t2->value) && (l=ff_mov_iso639_to_lang(&t2->key[len2-3], 1)) >= 0) { lang = l; break; } } return mov_write_string_tag(pb, name, t->value, lang, long_style); } /* iTunes track number */ static int mov_write_trkn_tag(ByteIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { AVMetadataTag *t = av_metadata_get(s->metadata, "track", NULL, 0); int size = 0, track = t ? atoi(t->value) : 0; if (track) { put_be32(pb, 32); /* size */ put_tag(pb, "trkn"); put_be32(pb, 24); /* size */ put_tag(pb, "data"); put_be32(pb, 0); // 8 bytes empty put_be32(pb, 0); put_be16(pb, 0); // empty put_be16(pb, track); // track number put_be16(pb, 0); // total track number put_be16(pb, 0); // empty size = 32; } return size; } /* iTunes meta data list */ static int mov_write_ilst_tag(ByteIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ put_tag(pb, "ilst"); mov_write_string_metadata(s, pb, "\251nam", "title" , 1); mov_write_string_metadata(s, pb, "\251ART", "artist" , 1); mov_write_string_metadata(s, pb, "aART", "album_artist", 1); mov_write_string_metadata(s, pb, "\251wrt", "composer" , 1); mov_write_string_metadata(s, pb, "\251alb", "album" , 1); mov_write_string_metadata(s, pb, "\251day", "date" , 1); mov_write_string_tag(pb, "\251too", LIBAVFORMAT_IDENT, 0, 1); mov_write_string_metadata(s, pb, "\251cmt", "comment" , 1); mov_write_string_metadata(s, pb, "\251gen", "genre" , 1); mov_write_string_metadata(s, pb, "\251cpy", "copyright", 1); mov_write_string_metadata(s, pb, "\251grp", "grouping" , 1); mov_write_string_metadata(s, pb, "\251lyr", "lyrics" , 1); mov_write_string_metadata(s, pb, "desc", "description",1); mov_write_string_metadata(s, pb, "ldes", "synopsis" , 1); mov_write_string_metadata(s, pb, "tvsh", "show" , 1); mov_write_string_metadata(s, pb, "tven", "episode_id",1); mov_write_string_metadata(s, pb, "tvnn", "network" , 1); mov_write_trkn_tag(pb, mov, s); return updateSize(pb, pos); } /* iTunes meta data tag */ static int mov_write_meta_tag(ByteIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { int size = 0; int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size */ put_tag(pb, "meta"); put_be32(pb, 0); mov_write_itunes_hdlr_tag(pb, mov, s); mov_write_ilst_tag(pb, mov, s); size = updateSize(pb, pos); return size; } static int utf8len(const uint8_t *b) { int len=0; int val; while(*b){ GET_UTF8(val, *b++, return -1;) len++; } return len; } static int ascii_to_wc(ByteIOContext *pb, const uint8_t *b) { int val; while(*b){ GET_UTF8(val, *b++, return -1;) put_be16(pb, val); } put_be16(pb, 0x00); return 0; } static uint16_t language_code(const char *str) { return (((str[0]-0x60) & 0x1F) << 10) + (((str[1]-0x60) & 0x1F) << 5) + ((str[2]-0x60) & 0x1F); } static int mov_write_3gp_udta_tag(ByteIOContext *pb, AVFormatContext *s, const char *tag, const char *str) { int64_t pos = url_ftell(pb); AVMetadataTag *t = av_metadata_get(s->metadata, str, NULL, 0); if (!t || !utf8len(t->value)) return 0; put_be32(pb, 0); /* size */ put_tag (pb, tag); /* type */ put_be32(pb, 0); /* version + flags */ if (!strcmp(tag, "yrrc")) put_be16(pb, atoi(t->value)); else { put_be16(pb, language_code("eng")); /* language */ put_buffer(pb, t->value, strlen(t->value)+1); /* UTF8 string value */ if (!strcmp(tag, "albm") && (t = av_metadata_get(s->metadata, "date", NULL, 0))) put_byte(pb, atoi(t->value)); } return updateSize(pb, pos); } static int mov_write_chpl_tag(ByteIOContext *pb, AVFormatContext *s) { int64_t pos = url_ftell(pb); int i, nb_chapters = FFMIN(s->nb_chapters, 255); put_be32(pb, 0); // size put_tag (pb, "chpl"); put_be32(pb, 0x01000000); // version + flags put_be32(pb, 0); // unknown put_byte(pb, nb_chapters); for (i = 0; i < nb_chapters; i++) { AVChapter *c = s->chapters[i]; AVMetadataTag *t; put_be64(pb, av_rescale_q(c->start, c->time_base, (AVRational){1,10000000})); if ((t = av_metadata_get(c->metadata, "title", NULL, 0))) { int len = FFMIN(strlen(t->value), 255); put_byte(pb, len); put_buffer(pb, t->value, len); } else put_byte(pb, 0); } return updateSize(pb, pos); } static int mov_write_udta_tag(ByteIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { ByteIOContext *pb_buf; int i, ret, size; uint8_t *buf; for (i = 0; i < s->nb_streams; i++) if (mov->tracks[i].enc->flags & CODEC_FLAG_BITEXACT) { return 0; } ret = url_open_dyn_buf(&pb_buf); if(ret < 0) return ret; if (mov->mode & MODE_3GP) { mov_write_3gp_udta_tag(pb_buf, s, "perf", "artist"); mov_write_3gp_udta_tag(pb_buf, s, "titl", "title"); mov_write_3gp_udta_tag(pb_buf, s, "auth", "author"); mov_write_3gp_udta_tag(pb_buf, s, "gnre", "genre"); mov_write_3gp_udta_tag(pb_buf, s, "dscp", "comment"); mov_write_3gp_udta_tag(pb_buf, s, "albm", "album"); mov_write_3gp_udta_tag(pb_buf, s, "cprt", "copyright"); mov_write_3gp_udta_tag(pb_buf, s, "yrrc", "date"); } else if (mov->mode == MODE_MOV) { // the title field breaks gtkpod with mp4 and my suspicion is that stuff is not valid in mp4 mov_write_string_metadata(s, pb_buf, "\251nam", "title" , 0); mov_write_string_metadata(s, pb_buf, "\251aut", "author" , 0); mov_write_string_metadata(s, pb_buf, "\251alb", "album" , 0); mov_write_string_metadata(s, pb_buf, "\251day", "date" , 0); mov_write_string_tag(pb_buf, "\251enc", LIBAVFORMAT_IDENT, 0, 0); mov_write_string_metadata(s, pb_buf, "\251des", "comment" , 0); mov_write_string_metadata(s, pb_buf, "\251gen", "genre" , 0); mov_write_string_metadata(s, pb_buf, "\251cpy", "copyright" , 0); } else { /* iTunes meta data */ mov_write_meta_tag(pb_buf, mov, s); } if (s->nb_chapters) mov_write_chpl_tag(pb_buf, s); if ((size = url_close_dyn_buf(pb_buf, &buf)) > 0) { put_be32(pb, size+8); put_tag(pb, "udta"); put_buffer(pb, buf, size); av_free(buf); } return 0; } static void mov_write_psp_udta_tag(ByteIOContext *pb, const char *str, const char *lang, int type) { int len = utf8len(str)+1; if(len<=0) return; put_be16(pb, len*2+10); /* size */ put_be32(pb, type); /* type */ put_be16(pb, language_code(lang)); /* language */ put_be16(pb, 0x01); /* ? */ ascii_to_wc(pb, str); } static int mov_write_uuidusmt_tag(ByteIOContext *pb, AVFormatContext *s) { AVMetadataTag *title = av_metadata_get(s->metadata, "title", NULL, 0); int64_t pos, pos2; if (title) { pos = url_ftell(pb); put_be32(pb, 0); /* size placeholder*/ put_tag(pb, "uuid"); put_tag(pb, "USMT"); put_be32(pb, 0x21d24fce); /* 96 bit UUID */ put_be32(pb, 0xbb88695c); put_be32(pb, 0xfac9c740); pos2 = url_ftell(pb); put_be32(pb, 0); /* size placeholder*/ put_tag(pb, "MTDT"); put_be16(pb, 4); // ? put_be16(pb, 0x0C); /* size */ put_be32(pb, 0x0B); /* type */ put_be16(pb, language_code("und")); /* language */ put_be16(pb, 0x0); /* ? */ put_be16(pb, 0x021C); /* data */ mov_write_psp_udta_tag(pb, LIBAVCODEC_IDENT, "eng", 0x04); mov_write_psp_udta_tag(pb, title->value, "eng", 0x01); // snprintf(dt,32,"%04d/%02d/%02d %02d:%02d:%02d",t_st->tm_year+1900,t_st->tm_mon+1,t_st->tm_mday,t_st->tm_hour,t_st->tm_min,t_st->tm_sec); mov_write_psp_udta_tag(pb, "2006/04/01 11:11:11", "und", 0x03); updateSize(pb, pos2); return updateSize(pb, pos); } return 0; } static int mov_write_moov_tag(ByteIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { int i; int64_t pos = url_ftell(pb); put_be32(pb, 0); /* size placeholder*/ put_tag(pb, "moov"); for (i=0; i<mov->nb_streams; i++) { if(mov->tracks[i].entry <= 0) continue; mov->tracks[i].time = mov->time; mov->tracks[i].trackID = i+1; } if (mov->chapter_track) for (i=0; i<s->nb_streams; i++) { mov->tracks[i].tref_tag = MKTAG('c','h','a','p'); mov->tracks[i].tref_id = mov->tracks[mov->chapter_track].trackID; } for (i = 0; i < mov->nb_streams; i++) { if (mov->tracks[i].tag == MKTAG('r','t','p',' ')) { mov->tracks[i].tref_tag = MKTAG('h','i','n','t'); mov->tracks[i].tref_id = mov->tracks[mov->tracks[i].src_track].trackID; } } mov_write_mvhd_tag(pb, mov); //mov_write_iods_tag(pb, mov); for (i=0; i<mov->nb_streams; i++) { if(mov->tracks[i].entry > 0) { mov_write_trak_tag(pb, &(mov->tracks[i]), i < s->nb_streams ? s->streams[i] : NULL); } } if (mov->mode == MODE_PSP) mov_write_uuidusmt_tag(pb, s); else mov_write_udta_tag(pb, mov, s); return updateSize(pb, pos); } static int mov_write_mdat_tag(ByteIOContext *pb, MOVMuxContext *mov) { put_be32(pb, 8); // placeholder for extended size field (64 bit) put_tag(pb, mov->mode == MODE_MOV ? "wide" : "free"); mov->mdat_pos = url_ftell(pb); put_be32(pb, 0); /* size placeholder*/ put_tag(pb, "mdat"); return 0; } /* TODO: This needs to be more general */ static int mov_write_ftyp_tag(ByteIOContext *pb, AVFormatContext *s) { MOVMuxContext *mov = s->priv_data; int64_t pos = url_ftell(pb); int has_h264 = 0, has_video = 0; int minor = 0x200; int i; for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) has_video = 1; if (st->codec->codec_id == CODEC_ID_H264) has_h264 = 1; } put_be32(pb, 0); /* size */ put_tag(pb, "ftyp"); if (mov->mode == MODE_3GP) { put_tag(pb, has_h264 ? "3gp6" : "3gp4"); minor = has_h264 ? 0x100 : 0x200; } else if (mov->mode & MODE_3G2) { put_tag(pb, has_h264 ? "3g2b" : "3g2a"); minor = has_h264 ? 0x20000 : 0x10000; }else if (mov->mode == MODE_PSP) put_tag(pb, "MSNV"); else if (mov->mode == MODE_MP4) put_tag(pb, "isom"); else if (mov->mode == MODE_IPOD) put_tag(pb, has_video ? "M4V ":"M4A "); else put_tag(pb, "qt "); put_be32(pb, minor); if(mov->mode == MODE_MOV) put_tag(pb, "qt "); else{ put_tag(pb, "isom"); put_tag(pb, "iso2"); if(has_h264) put_tag(pb, "avc1"); } if (mov->mode == MODE_3GP) put_tag(pb, has_h264 ? "3gp6":"3gp4"); else if (mov->mode & MODE_3G2) put_tag(pb, has_h264 ? "3g2b":"3g2a"); else if (mov->mode == MODE_PSP) put_tag(pb, "MSNV"); else if (mov->mode == MODE_MP4) put_tag(pb, "mp41"); return updateSize(pb, pos); } static void mov_write_uuidprof_tag(ByteIOContext *pb, AVFormatContext *s) { AVCodecContext *VideoCodec = s->streams[0]->codec; AVCodecContext *AudioCodec = s->streams[1]->codec; int AudioRate = AudioCodec->sample_rate; int FrameRate = ((VideoCodec->time_base.den) * (0x10000))/ (VideoCodec->time_base.num); int audio_kbitrate= AudioCodec->bit_rate / 1000; int video_kbitrate= FFMIN(VideoCodec->bit_rate / 1000, 800 - audio_kbitrate); put_be32(pb, 0x94); /* size */ put_tag(pb, "uuid"); put_tag(pb, "PROF"); put_be32(pb, 0x21d24fce); /* 96 bit UUID */ put_be32(pb, 0xbb88695c); put_be32(pb, 0xfac9c740); put_be32(pb, 0x0); /* ? */ put_be32(pb, 0x3); /* 3 sections ? */ put_be32(pb, 0x14); /* size */ put_tag(pb, "FPRF"); put_be32(pb, 0x0); /* ? */ put_be32(pb, 0x0); /* ? */ put_be32(pb, 0x0); /* ? */ put_be32(pb, 0x2c); /* size */ put_tag(pb, "APRF"); /* audio */ put_be32(pb, 0x0); put_be32(pb, 0x2); /* TrackID */ put_tag(pb, "mp4a"); put_be32(pb, 0x20f); put_be32(pb, 0x0); put_be32(pb, audio_kbitrate); put_be32(pb, audio_kbitrate); put_be32(pb, AudioRate); put_be32(pb, AudioCodec->channels); put_be32(pb, 0x34); /* size */ put_tag(pb, "VPRF"); /* video */ put_be32(pb, 0x0); put_be32(pb, 0x1); /* TrackID */ if (VideoCodec->codec_id == CODEC_ID_H264) { put_tag(pb, "avc1"); put_be16(pb, 0x014D); put_be16(pb, 0x0015); } else { put_tag(pb, "mp4v"); put_be16(pb, 0x0000); put_be16(pb, 0x0103); } put_be32(pb, 0x0); put_be32(pb, video_kbitrate); put_be32(pb, video_kbitrate); put_be32(pb, FrameRate); put_be32(pb, FrameRate); put_be16(pb, VideoCodec->width); put_be16(pb, VideoCodec->height); put_be32(pb, 0x010001); /* ? */ } static int mov_parse_mpeg2_frame(AVPacket *pkt, uint32_t *flags) { uint32_t c = -1; int i, closed_gop = 0; for (i = 0; i < pkt->size - 4; i++) { c = (c<<8) + pkt->data[i]; if (c == 0x1b8) { // gop closed_gop = pkt->data[i+4]>>6 & 0x01; } else if (c == 0x100) { // pic int temp_ref = (pkt->data[i+1]<<2) | (pkt->data[i+2]>>6); if (!temp_ref || closed_gop) // I picture is not reordered *flags = MOV_SYNC_SAMPLE; else *flags = MOV_PARTIAL_SYNC_SAMPLE; break; } } return 0; } int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) { MOVMuxContext *mov = s->priv_data; ByteIOContext *pb = s->pb; MOVTrack *trk = &mov->tracks[pkt->stream_index]; AVCodecContext *enc = trk->enc; unsigned int samplesInChunk = 0; int size= pkt->size; if (url_is_streamed(s->pb)) return 0; /* Can't handle that */ if (!size) return 0; /* Discard 0 sized packets */ if (enc->codec_id == CODEC_ID_AMR_NB) { /* We must find out how many AMR blocks there are in one packet */ static uint16_t packed_size[16] = {13, 14, 16, 18, 20, 21, 27, 32, 6, 0, 0, 0, 0, 0, 0, 0}; int len = 0; while (len < size && samplesInChunk < 100) { len += packed_size[(pkt->data[len] >> 3) & 0x0F]; samplesInChunk++; } if(samplesInChunk > 1){ av_log(s, AV_LOG_ERROR, "fatal error, input is not a single packet, implement a AVParser for it\n"); return -1; } } else if (trk->sampleSize) samplesInChunk = size/trk->sampleSize; else samplesInChunk = 1; /* copy extradata if it exists */ if (trk->vosLen == 0 && enc->extradata_size > 0) { trk->vosLen = enc->extradata_size; trk->vosData = av_malloc(trk->vosLen); memcpy(trk->vosData, enc->extradata, trk->vosLen); } if (enc->codec_id == CODEC_ID_H264 && trk->vosLen > 0 && *(uint8_t *)trk->vosData != 1) { /* from x264 or from bytestream h264 */ /* nal reformating needed */ size = ff_avc_parse_nal_units(pb, pkt->data, pkt->size); } else { put_buffer(pb, pkt->data, size); } if ((enc->codec_id == CODEC_ID_DNXHD || enc->codec_id == CODEC_ID_AC3) && !trk->vosLen) { /* copy frame to create needed atoms */ trk->vosLen = size; trk->vosData = av_malloc(size); if (!trk->vosData) return AVERROR(ENOMEM); memcpy(trk->vosData, pkt->data, size); } if (!(trk->entry % MOV_INDEX_CLUSTER_SIZE)) { trk->cluster = av_realloc(trk->cluster, (trk->entry + MOV_INDEX_CLUSTER_SIZE) * sizeof(*trk->cluster)); if (!trk->cluster) return -1; } trk->cluster[trk->entry].pos = url_ftell(pb) - size; trk->cluster[trk->entry].samplesInChunk = samplesInChunk; trk->cluster[trk->entry].size = size; trk->cluster[trk->entry].entries = samplesInChunk; trk->cluster[trk->entry].dts = pkt->dts; trk->trackDuration = pkt->dts - trk->cluster[0].dts + pkt->duration; if (pkt->pts == AV_NOPTS_VALUE) { av_log(s, AV_LOG_WARNING, "pts has no value\n"); pkt->pts = pkt->dts; } if (pkt->dts != pkt->pts) trk->flags |= MOV_TRACK_CTTS; trk->cluster[trk->entry].cts = pkt->pts - pkt->dts; trk->cluster[trk->entry].flags = 0; if (pkt->flags & AV_PKT_FLAG_KEY) { if (mov->mode == MODE_MOV && enc->codec_id == CODEC_ID_MPEG2VIDEO) { mov_parse_mpeg2_frame(pkt, &trk->cluster[trk->entry].flags); if (trk->cluster[trk->entry].flags & MOV_PARTIAL_SYNC_SAMPLE) trk->flags |= MOV_TRACK_STPS; } else { trk->cluster[trk->entry].flags = MOV_SYNC_SAMPLE; } if (trk->cluster[trk->entry].flags & MOV_SYNC_SAMPLE) trk->hasKeyframes++; } trk->entry++; trk->sampleCount += samplesInChunk; mov->mdat_size += size; put_flush_packet(pb); if (trk->hint_track >= 0 && trk->hint_track < mov->nb_streams) ff_mov_add_hinted_packet(s, pkt, trk->hint_track, trk->entry); return 0; } // QuickTime chapters involve an additional text track with the chapter names // as samples, and a tref pointing from the other tracks to the chapter one. static void mov_create_chapter_track(AVFormatContext *s, int tracknum) { MOVMuxContext *mov = s->priv_data; MOVTrack *track = &mov->tracks[tracknum]; AVPacket pkt = { .stream_index = tracknum, .flags = AV_PKT_FLAG_KEY }; int i, len; track->mode = mov->mode; track->tag = MKTAG('t','e','x','t'); track->timescale = MOV_TIMESCALE; track->enc = avcodec_alloc_context(); track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE; for (i = 0; i < s->nb_chapters; i++) { AVChapter *c = s->chapters[i]; AVMetadataTag *t; int64_t end = av_rescale_q(c->end, c->time_base, (AVRational){1,MOV_TIMESCALE}); pkt.pts = pkt.dts = av_rescale_q(c->start, c->time_base, (AVRational){1,MOV_TIMESCALE}); pkt.duration = end - pkt.dts; if ((t = av_metadata_get(c->metadata, "title", NULL, 0))) { len = strlen(t->value); pkt.size = len+2; pkt.data = av_malloc(pkt.size); AV_WB16(pkt.data, len); memcpy(pkt.data+2, t->value, len); ff_mov_write_packet(s, &pkt); av_freep(&pkt.data); } } } static int mov_write_header(AVFormatContext *s) { ByteIOContext *pb = s->pb; MOVMuxContext *mov = s->priv_data; int i, hint_track = 0; if (url_is_streamed(s->pb)) { av_log(s, AV_LOG_ERROR, "muxer does not support non seekable output\n"); return -1; } /* Default mode == MP4 */ mov->mode = MODE_MP4; if (s->oformat != NULL) { if (!strcmp("3gp", s->oformat->name)) mov->mode = MODE_3GP; else if (!strcmp("3g2", s->oformat->name)) mov->mode = MODE_3GP|MODE_3G2; else if (!strcmp("mov", s->oformat->name)) mov->mode = MODE_MOV; else if (!strcmp("psp", s->oformat->name)) mov->mode = MODE_PSP; else if (!strcmp("ipod",s->oformat->name)) mov->mode = MODE_IPOD; mov_write_ftyp_tag(pb,s); if (mov->mode == MODE_PSP) { if (s->nb_streams != 2) { av_log(s, AV_LOG_ERROR, "PSP mode need one video and one audio stream\n"); return -1; } mov_write_uuidprof_tag(pb,s); } } mov->nb_streams = s->nb_streams; if (mov->mode & (MODE_MOV|MODE_IPOD) && s->nb_chapters) mov->chapter_track = mov->nb_streams++; if (s->flags & AVFMT_FLAG_RTP_HINT) { /* Add hint tracks for each audio and video stream */ hint_track = mov->nb_streams; for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO || st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { mov->nb_streams++; } } } mov->tracks = av_mallocz(mov->nb_streams*sizeof(*mov->tracks)); if (!mov->tracks) return AVERROR(ENOMEM); for(i=0; i<s->nb_streams; i++){ AVStream *st= s->streams[i]; MOVTrack *track= &mov->tracks[i]; AVMetadataTag *lang = av_metadata_get(st->metadata, "language", NULL,0); track->enc = st->codec; track->language = ff_mov_iso639_to_lang(lang?lang->value:"und", mov->mode!=MODE_MOV); if (track->language < 0) track->language = 0; track->mode = mov->mode; track->tag = mov_find_codec_tag(s, track); if (!track->tag) { av_log(s, AV_LOG_ERROR, "track %d: could not find tag, " "codec not currently supported in container\n", i); goto error; } /* If hinting of this track is enabled by a later hint track, * this is updated. */ track->hint_track = -1; if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO){ if (track->tag == MKTAG('m','x','3','p') || track->tag == MKTAG('m','x','3','n') || track->tag == MKTAG('m','x','4','p') || track->tag == MKTAG('m','x','4','n') || track->tag == MKTAG('m','x','5','p') || track->tag == MKTAG('m','x','5','n')) { if (st->codec->width != 720 || (st->codec->height != 608 && st->codec->height != 512)) { av_log(s, AV_LOG_ERROR, "D-10/IMX must use 720x608 or 720x512 video resolution\n"); goto error; } track->height = track->tag>>24 == 'n' ? 486 : 576; } track->timescale = st->codec->time_base.den; if (track->mode == MODE_MOV && track->timescale > 100000) av_log(s, AV_LOG_WARNING, "WARNING codec timebase is very high. If duration is too long,\n" "file may not be playable by quicktime. Specify a shorter timebase\n" "or choose different container.\n"); }else if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO){ track->timescale = st->codec->sample_rate; if(!st->codec->frame_size && !av_get_bits_per_sample(st->codec->codec_id)) { av_log(s, AV_LOG_ERROR, "track %d: codec frame size is not set\n", i); goto error; }else if(st->codec->frame_size > 1){ /* assume compressed audio */ track->audio_vbr = 1; }else{ st->codec->frame_size = 1; track->sampleSize = (av_get_bits_per_sample(st->codec->codec_id) >> 3) * st->codec->channels; } if (track->mode != MODE_MOV) { if (track->timescale > UINT16_MAX) { av_log(s, AV_LOG_ERROR, "track %d: output format does not support " "sample rate %dhz\n", i, track->timescale); goto error; } if (track->enc->codec_id == CODEC_ID_MP3 && track->timescale < 16000) { av_log(s, AV_LOG_ERROR, "track %d: muxing mp3 at %dhz is not supported\n", i, track->enc->sample_rate); goto error; } } }else if(st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE){ track->timescale = st->codec->time_base.den; } if (!track->height) track->height = st->codec->height; av_set_pts_info(st, 64, 1, track->timescale); } mov_write_mdat_tag(pb, mov); mov->time = s->timestamp + 0x7C25B080; //1970 based -> 1904 based if (mov->chapter_track) mov_create_chapter_track(s, mov->chapter_track); if (s->flags & AVFMT_FLAG_RTP_HINT) { /* Initialize the hint tracks for each audio and video stream */ for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO || st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { ff_mov_init_hinting(s, hint_track, i); hint_track++; } } } put_flush_packet(pb); return 0; error: av_freep(&mov->tracks); return -1; } static int mov_write_trailer(AVFormatContext *s) { MOVMuxContext *mov = s->priv_data; ByteIOContext *pb = s->pb; int res = 0; int i; int64_t moov_pos = url_ftell(pb); /* Write size of mdat tag */ if (mov->mdat_size+8 <= UINT32_MAX) { url_fseek(pb, mov->mdat_pos, SEEK_SET); put_be32(pb, mov->mdat_size+8); } else { /* overwrite 'wide' placeholder atom */ url_fseek(pb, mov->mdat_pos - 8, SEEK_SET); put_be32(pb, 1); /* special value: real atom size will be 64 bit value after tag field */ put_tag(pb, "mdat"); put_be64(pb, mov->mdat_size+16); } url_fseek(pb, moov_pos, SEEK_SET); mov_write_moov_tag(pb, mov, s); if (mov->chapter_track) av_freep(&mov->tracks[mov->chapter_track].enc); for (i=0; i<mov->nb_streams; i++) { if (mov->tracks[i].tag == MKTAG('r','t','p',' ')) ff_mov_close_hinting(&mov->tracks[i]); av_freep(&mov->tracks[i].cluster); if(mov->tracks[i].vosLen) av_free(mov->tracks[i].vosData); } put_flush_packet(pb); av_freep(&mov->tracks); return res; } #if CONFIG_MOV_MUXER AVOutputFormat mov_muxer = { "mov", NULL_IF_CONFIG_SMALL("MOV format"), NULL, "mov", sizeof(MOVMuxContext), CODEC_ID_AAC, CODEC_ID_MPEG4, mov_write_header, ff_mov_write_packet, mov_write_trailer, .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS, .codec_tag = (const AVCodecTag* const []){codec_movvideo_tags, codec_movaudio_tags, 0}, }; #endif #if CONFIG_TGP_MUXER AVOutputFormat tgp_muxer = { "3gp", NULL_IF_CONFIG_SMALL("3GP format"), NULL, "3gp", sizeof(MOVMuxContext), CODEC_ID_AMR_NB, CODEC_ID_H263, mov_write_header, ff_mov_write_packet, mov_write_trailer, .flags = AVFMT_GLOBALHEADER, .codec_tag = (const AVCodecTag* const []){codec_3gp_tags, 0}, }; #endif #if CONFIG_MP4_MUXER AVOutputFormat mp4_muxer = { "mp4", NULL_IF_CONFIG_SMALL("MP4 format"), "application/mp4", "mp4", sizeof(MOVMuxContext), CODEC_ID_AAC, CODEC_ID_MPEG4, mov_write_header, ff_mov_write_packet, mov_write_trailer, .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS, .codec_tag = (const AVCodecTag* const []){ff_mp4_obj_type, 0}, }; #endif #if CONFIG_PSP_MUXER AVOutputFormat psp_muxer = { "psp", NULL_IF_CONFIG_SMALL("PSP MP4 format"), NULL, "mp4,psp", sizeof(MOVMuxContext), CODEC_ID_AAC, CODEC_ID_MPEG4, mov_write_header, ff_mov_write_packet, mov_write_trailer, .flags = AVFMT_GLOBALHEADER, .codec_tag = (const AVCodecTag* const []){ff_mp4_obj_type, 0}, }; #endif #if CONFIG_TG2_MUXER AVOutputFormat tg2_muxer = { "3g2", NULL_IF_CONFIG_SMALL("3GP2 format"), NULL, "3g2", sizeof(MOVMuxContext), CODEC_ID_AMR_NB, CODEC_ID_H263, mov_write_header, ff_mov_write_packet, mov_write_trailer, .flags = AVFMT_GLOBALHEADER, .codec_tag = (const AVCodecTag* const []){codec_3gp_tags, 0}, }; #endif #if CONFIG_IPOD_MUXER AVOutputFormat ipod_muxer = { "ipod", NULL_IF_CONFIG_SMALL("iPod H.264 MP4 format"), "application/mp4", "m4v,m4a", sizeof(MOVMuxContext), CODEC_ID_AAC, CODEC_ID_H264, mov_write_header, ff_mov_write_packet, mov_write_trailer, .flags = AVFMT_GLOBALHEADER, .codec_tag = (const AVCodecTag* const []){codec_ipod_tags, 0}, }; #endif
123linslouis-android-video-cutter
jni/libavformat/movenc.c
C
asf20
75,747
/* * MXF * Copyright (c) 2006 SmartJog S.A., Baptiste Coudurier <baptiste dot coudurier at smartjog dot com> * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVFORMAT_MXF_H #define AVFORMAT_MXF_H #include "libavcodec/avcodec.h" #include <stdint.h> typedef uint8_t UID[16]; enum MXFMetadataSetType { AnyType, MaterialPackage, SourcePackage, SourceClip, TimecodeComponent, Sequence, MultipleDescriptor, Descriptor, Track, CryptoContext, Preface, Identification, ContentStorage, SubDescriptor, IndexTableSegment, EssenceContainerData, TypeBottom,// add metadata type before this }; typedef struct { UID key; int64_t offset; uint64_t length; } KLVPacket; typedef struct { UID uid; unsigned matching_len; int id; } MXFCodecUL; extern const MXFCodecUL ff_mxf_data_definition_uls[]; extern const MXFCodecUL ff_mxf_codec_uls[]; #ifdef DEBUG #define PRINT_KEY(pc, s, x) dprintf(pc, "%s %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", s, \ (x)[0], (x)[1], (x)[2], (x)[3], (x)[4], (x)[5], (x)[6], (x)[7], (x)[8], (x)[9], (x)[10], (x)[11], (x)[12], (x)[13], (x)[14], (x)[15]) #else #define PRINT_KEY(pc, s, x) #endif #endif /* AVFORMAT_MXF_H */
123linslouis-android-video-cutter
jni/libavformat/mxf.h
C
asf20
2,022
/* * Sony OpenMG (OMA) demuxer * * Copyright (c) 2008 Maxim Poliakovski * 2008 Benjamin Larsson * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * This is a demuxer for Sony OpenMG Music files * * Known file extensions: ".oma", "aa3" * The format of such files consists of three parts: * - "ea3" header carrying overall info and metadata. * - "EA3" header is a Sony-specific header containing information about * the OpenMG file: codec type (usually ATRAC, can also be MP3 or WMA), * codec specific info (packet size, sample rate, channels and so on) * and DRM related info (file encryption, content id). * - Sound data organized in packets follow the EA3 header * (can be encrypted using the Sony DRM!). * * LIMITATIONS: This version supports only plain (unencrypted) OMA files. * If any DRM-protected (encrypted) file is encountered you will get the * corresponding error message. Try to remove the encryption using any * Sony software (for example SonicStage). * CODEC SUPPORT: Only ATRAC3 codec is currently supported! */ #include "avformat.h" #include "libavutil/intreadwrite.h" #include "raw.h" #include "riff.h" #define EA3_HEADER_SIZE 96 enum { OMA_CODECID_ATRAC3 = 0, OMA_CODECID_ATRAC3P = 1, OMA_CODECID_MP3 = 3, OMA_CODECID_LPCM = 4, OMA_CODECID_WMA = 5, }; static const AVCodecTag codec_oma_tags[] = { { CODEC_ID_ATRAC3, OMA_CODECID_ATRAC3 }, { CODEC_ID_ATRAC3P, OMA_CODECID_ATRAC3P }, { CODEC_ID_MP3, OMA_CODECID_MP3 }, }; static int oma_read_header(AVFormatContext *s, AVFormatParameters *ap) { static const uint16_t srate_tab[6] = {320,441,480,882,960,0}; int ret, ea3_taglen, EA3_pos, framesize, jsflag, samplerate; uint32_t codec_params; int16_t eid; uint8_t buf[EA3_HEADER_SIZE]; uint8_t *edata; AVStream *st; ret = get_buffer(s->pb, buf, 10); if (ret != 10) return -1; if(!memcmp(buf, "ea3", 3)) { ea3_taglen = ((buf[6] & 0x7f) << 21) | ((buf[7] & 0x7f) << 14) | ((buf[8] & 0x7f) << 7) | (buf[9] & 0x7f); EA3_pos = ea3_taglen + 10; if (buf[5] & 0x10) EA3_pos += 10; url_fseek(s->pb, EA3_pos, SEEK_SET); ret = get_buffer(s->pb, buf, EA3_HEADER_SIZE); if (ret != EA3_HEADER_SIZE) return -1; } else { ret = get_buffer(s->pb, buf + 10, EA3_HEADER_SIZE - 10); EA3_pos = 0; } if (memcmp(buf, ((const uint8_t[]){'E', 'A', '3'}),3) || buf[4] != 0 || buf[5] != EA3_HEADER_SIZE) { av_log(s, AV_LOG_ERROR, "Couldn't find the EA3 header !\n"); return -1; } eid = AV_RB16(&buf[6]); if (eid != -1 && eid != -128) { av_log(s, AV_LOG_ERROR, "Encrypted file! Eid: %d\n", eid); return -1; } codec_params = AV_RB24(&buf[33]); st = av_new_stream(s, 0); if (!st) return AVERROR(ENOMEM); st->start_time = 0; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_tag = buf[32]; st->codec->codec_id = ff_codec_get_id(codec_oma_tags, st->codec->codec_tag); switch (buf[32]) { case OMA_CODECID_ATRAC3: samplerate = srate_tab[(codec_params >> 13) & 7]*100; if (samplerate != 44100) av_log(s, AV_LOG_ERROR, "Unsupported sample rate, send sample file to developers: %d\n", samplerate); framesize = (codec_params & 0x3FF) * 8; jsflag = (codec_params >> 17) & 1; /* get stereo coding mode, 1 for joint-stereo */ st->codec->channels = 2; st->codec->sample_rate = samplerate; st->codec->bit_rate = st->codec->sample_rate * framesize * 8 / 1024; /* fake the atrac3 extradata (wav format, makes stream copy to wav work) */ st->codec->extradata_size = 14; edata = av_mallocz(14 + FF_INPUT_BUFFER_PADDING_SIZE); if (!edata) return AVERROR(ENOMEM); st->codec->extradata = edata; AV_WL16(&edata[0], 1); // always 1 AV_WL32(&edata[2], samplerate); // samples rate AV_WL16(&edata[6], jsflag); // coding mode AV_WL16(&edata[8], jsflag); // coding mode AV_WL16(&edata[10], 1); // always 1 // AV_WL16(&edata[12], 0); // always 0 av_set_pts_info(st, 64, 1, st->codec->sample_rate); break; case OMA_CODECID_ATRAC3P: st->codec->channels = (codec_params >> 10) & 7; framesize = ((codec_params & 0x3FF) * 8) + 8; st->codec->sample_rate = srate_tab[(codec_params >> 13) & 7]*100; st->codec->bit_rate = st->codec->sample_rate * framesize * 8 / 1024; av_set_pts_info(st, 64, 1, st->codec->sample_rate); av_log(s, AV_LOG_ERROR, "Unsupported codec ATRAC3+!\n"); break; case OMA_CODECID_MP3: st->need_parsing = AVSTREAM_PARSE_FULL; framesize = 1024; break; default: av_log(s, AV_LOG_ERROR, "Unsupported codec %d!\n",buf[32]); return -1; break; } st->codec->block_align = framesize; url_fseek(s->pb, EA3_pos + EA3_HEADER_SIZE, SEEK_SET); return 0; } static int oma_read_packet(AVFormatContext *s, AVPacket *pkt) { int ret = av_get_packet(s->pb, pkt, s->streams[0]->codec->block_align); pkt->stream_index = 0; if (ret <= 0) return AVERROR(EIO); return ret; } static int oma_read_probe(AVProbeData *p) { if (!memcmp(p->buf, ((const uint8_t[]){'e', 'a', '3', 3, 0}), 5) || (!memcmp(p->buf, "EA3", 3) && !p->buf[4] && p->buf[5] == EA3_HEADER_SIZE)) return AVPROBE_SCORE_MAX; else return 0; } AVInputFormat oma_demuxer = { "oma", NULL_IF_CONFIG_SMALL("Sony OpenMG audio"), 0, oma_read_probe, oma_read_header, oma_read_packet, 0, pcm_read_seek, .flags= AVFMT_GENERIC_INDEX, .extensions = "oma,aa3", .codec_tag= (const AVCodecTag* const []){codec_oma_tags, 0}, };
123linslouis-android-video-cutter
jni/libavformat/oma.c
C
asf20
6,898
/* * APE tag handling * Copyright (c) 2007 Benjamin Zores <ben@geexbox.org> * based upon libdemac from Dave Chapman. * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "libavutil/intreadwrite.h" #include "avformat.h" #include "apetag.h" #define ENABLE_DEBUG 0 #define APE_TAG_VERSION 2000 #define APE_TAG_FOOTER_BYTES 32 #define APE_TAG_FLAG_CONTAINS_HEADER (1 << 31) #define APE_TAG_FLAG_IS_HEADER (1 << 29) static int ape_tag_read_field(AVFormatContext *s) { ByteIOContext *pb = s->pb; uint8_t key[1024], *value; uint32_t size, flags; int i, c; size = get_le32(pb); /* field size */ flags = get_le32(pb); /* field flags */ for (i = 0; i < sizeof(key) - 1; i++) { c = get_byte(pb); if (c < 0x20 || c > 0x7E) break; else key[i] = c; } key[i] = 0; if (c != 0) { av_log(s, AV_LOG_WARNING, "Invalid APE tag key '%s'.\n", key); return -1; } if (size >= UINT_MAX) return -1; value = av_malloc(size+1); if (!value) return AVERROR(ENOMEM); get_buffer(pb, value, size); value[size] = 0; av_metadata_set2(&s->metadata, key, value, AV_METADATA_DONT_STRDUP_VAL); return 0; } void ff_ape_parse_tag(AVFormatContext *s) { ByteIOContext *pb = s->pb; int file_size = url_fsize(pb); uint32_t val, fields, tag_bytes; uint8_t buf[8]; int i; if (file_size < APE_TAG_FOOTER_BYTES) return; url_fseek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET); get_buffer(pb, buf, 8); /* APETAGEX */ if (strncmp(buf, "APETAGEX", 8)) { return; } val = get_le32(pb); /* APE tag version */ if (val > APE_TAG_VERSION) { av_log(s, AV_LOG_ERROR, "Unsupported tag version. (>=%d)\n", APE_TAG_VERSION); return; } tag_bytes = get_le32(pb); /* tag size */ if (tag_bytes - APE_TAG_FOOTER_BYTES > (1024 * 1024 * 16)) { av_log(s, AV_LOG_ERROR, "Tag size is way too big\n"); return; } fields = get_le32(pb); /* number of fields */ if (fields > 65536) { av_log(s, AV_LOG_ERROR, "Too many tag fields (%d)\n", fields); return; } val = get_le32(pb); /* flags */ if (val & APE_TAG_FLAG_IS_HEADER) { av_log(s, AV_LOG_ERROR, "APE Tag is a header\n"); return; } url_fseek(pb, file_size - tag_bytes, SEEK_SET); for (i=0; i<fields; i++) if (ape_tag_read_field(s) < 0) break; }
123linslouis-android-video-cutter
jni/libavformat/apetag.c
C
asf20
3,249
/** * @file * FLV common header * * Copyright (c) 2006 The FFmpeg Project * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVFORMAT_FLV_H #define AVFORMAT_FLV_H /* offsets for packed values */ #define FLV_AUDIO_SAMPLESSIZE_OFFSET 1 #define FLV_AUDIO_SAMPLERATE_OFFSET 2 #define FLV_AUDIO_CODECID_OFFSET 4 #define FLV_VIDEO_FRAMETYPE_OFFSET 4 /* bitmasks to isolate specific values */ #define FLV_AUDIO_CHANNEL_MASK 0x01 #define FLV_AUDIO_SAMPLESIZE_MASK 0x02 #define FLV_AUDIO_SAMPLERATE_MASK 0x0c #define FLV_AUDIO_CODECID_MASK 0xf0 #define FLV_VIDEO_CODECID_MASK 0x0f #define FLV_VIDEO_FRAMETYPE_MASK 0xf0 #define AMF_END_OF_OBJECT 0x09 enum { FLV_HEADER_FLAG_HASVIDEO = 1, FLV_HEADER_FLAG_HASAUDIO = 4, }; enum { FLV_TAG_TYPE_AUDIO = 0x08, FLV_TAG_TYPE_VIDEO = 0x09, FLV_TAG_TYPE_META = 0x12, }; enum { FLV_MONO = 0, FLV_STEREO = 1, }; enum { FLV_SAMPLESSIZE_8BIT = 0, FLV_SAMPLESSIZE_16BIT = 1 << FLV_AUDIO_SAMPLESSIZE_OFFSET, }; enum { FLV_SAMPLERATE_SPECIAL = 0, /**< signifies 5512Hz and 8000Hz in the case of NELLYMOSER */ FLV_SAMPLERATE_11025HZ = 1 << FLV_AUDIO_SAMPLERATE_OFFSET, FLV_SAMPLERATE_22050HZ = 2 << FLV_AUDIO_SAMPLERATE_OFFSET, FLV_SAMPLERATE_44100HZ = 3 << FLV_AUDIO_SAMPLERATE_OFFSET, }; enum { FLV_CODECID_PCM = 0, FLV_CODECID_ADPCM = 1 << FLV_AUDIO_CODECID_OFFSET, FLV_CODECID_MP3 = 2 << FLV_AUDIO_CODECID_OFFSET, FLV_CODECID_PCM_LE = 3 << FLV_AUDIO_CODECID_OFFSET, FLV_CODECID_NELLYMOSER_8KHZ_MONO = 5 << FLV_AUDIO_CODECID_OFFSET, FLV_CODECID_NELLYMOSER = 6 << FLV_AUDIO_CODECID_OFFSET, FLV_CODECID_AAC = 10<< FLV_AUDIO_CODECID_OFFSET, FLV_CODECID_SPEEX = 11<< FLV_AUDIO_CODECID_OFFSET, }; enum { FLV_CODECID_H263 = 2, FLV_CODECID_SCREEN = 3, FLV_CODECID_VP6 = 4, FLV_CODECID_VP6A = 5, FLV_CODECID_SCREEN2 = 6, FLV_CODECID_H264 = 7, }; enum { FLV_FRAME_KEY = 1 << FLV_VIDEO_FRAMETYPE_OFFSET, FLV_FRAME_INTER = 2 << FLV_VIDEO_FRAMETYPE_OFFSET, FLV_FRAME_DISP_INTER = 3 << FLV_VIDEO_FRAMETYPE_OFFSET, }; typedef enum { AMF_DATA_TYPE_NUMBER = 0x00, AMF_DATA_TYPE_BOOL = 0x01, AMF_DATA_TYPE_STRING = 0x02, AMF_DATA_TYPE_OBJECT = 0x03, AMF_DATA_TYPE_NULL = 0x05, AMF_DATA_TYPE_UNDEFINED = 0x06, AMF_DATA_TYPE_REFERENCE = 0x07, AMF_DATA_TYPE_MIXEDARRAY = 0x08, AMF_DATA_TYPE_OBJECT_END = 0x09, AMF_DATA_TYPE_ARRAY = 0x0a, AMF_DATA_TYPE_DATE = 0x0b, AMF_DATA_TYPE_LONG_STRING = 0x0c, AMF_DATA_TYPE_UNSUPPORTED = 0x0d, } AMFDataType; #endif /* AVFORMAT_FLV_H */
123linslouis-android-video-cutter
jni/libavformat/flv.h
C
asf20
3,502