You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
3.1KB

  1. /*
  2. * Copyright (c) 2003 Michael Niedermayer
  3. *
  4. * This file is part of Libav.
  5. *
  6. * Libav is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * Libav is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with Libav; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. /**
  21. * @file
  22. * ASUS V1/V2 encoder/decoder common data
  23. */
  24. #include <stdint.h>
  25. #include "asv.h"
  26. #include "avcodec.h"
  27. const uint8_t ff_asv_scantab[64] = {
  28. 0x00,0x08,0x01,0x09,0x10,0x18,0x11,0x19,
  29. 0x02,0x0A,0x03,0x0B,0x12,0x1A,0x13,0x1B,
  30. 0x04,0x0C,0x05,0x0D,0x20,0x28,0x21,0x29,
  31. 0x06,0x0E,0x07,0x0F,0x14,0x1C,0x15,0x1D,
  32. 0x22,0x2A,0x23,0x2B,0x30,0x38,0x31,0x39,
  33. 0x16,0x1E,0x17,0x1F,0x24,0x2C,0x25,0x2D,
  34. 0x32,0x3A,0x33,0x3B,0x26,0x2E,0x27,0x2F,
  35. 0x34,0x3C,0x35,0x3D,0x36,0x3E,0x37,0x3F,
  36. };
  37. const uint8_t ff_asv_ccp_tab[17][2] = {
  38. {0x2,2}, {0x7,5}, {0xB,5}, {0x3,5},
  39. {0xD,5}, {0x5,5}, {0x9,5}, {0x1,5},
  40. {0xE,5}, {0x6,5}, {0xA,5}, {0x2,5},
  41. {0xC,5}, {0x4,5}, {0x8,5}, {0x3,2},
  42. {0xF,5}, //EOB
  43. };
  44. const uint8_t ff_asv_level_tab[7][2] = {
  45. {3,4}, {3,3}, {3,2}, {0,3}, {2,2}, {2,3}, {2,4}
  46. };
  47. const uint8_t ff_asv_dc_ccp_tab[8][2] = {
  48. {0x1,2}, {0xD,4}, {0xF,4}, {0xC,4},
  49. {0x5,3}, {0xE,4}, {0x4,3}, {0x0,2},
  50. };
  51. const uint8_t ff_asv_ac_ccp_tab[16][2] = {
  52. {0x00,2}, {0x3B,6}, {0x0A,4}, {0x3A,6},
  53. {0x02,3}, {0x39,6}, {0x3C,6}, {0x38,6},
  54. {0x03,3}, {0x3D,6}, {0x08,4}, {0x1F,5},
  55. {0x09,4}, {0x0B,4}, {0x0D,4}, {0x0C,4},
  56. };
  57. const uint8_t ff_asv2_level_tab[63][2] = {
  58. {0x3F,10},{0x2F,10},{0x37,10},{0x27,10},{0x3B,10},{0x2B,10},{0x33,10},{0x23,10},
  59. {0x3D,10},{0x2D,10},{0x35,10},{0x25,10},{0x39,10},{0x29,10},{0x31,10},{0x21,10},
  60. {0x1F, 8},{0x17, 8},{0x1B, 8},{0x13, 8},{0x1D, 8},{0x15, 8},{0x19, 8},{0x11, 8},
  61. {0x0F, 6},{0x0B, 6},{0x0D, 6},{0x09, 6},
  62. {0x07, 4},{0x05, 4},
  63. {0x03, 2},
  64. {0x00, 5},
  65. {0x02, 2},
  66. {0x04, 4},{0x06, 4},
  67. {0x08, 6},{0x0C, 6},{0x0A, 6},{0x0E, 6},
  68. {0x10, 8},{0x18, 8},{0x14, 8},{0x1C, 8},{0x12, 8},{0x1A, 8},{0x16, 8},{0x1E, 8},
  69. {0x20,10},{0x30,10},{0x28,10},{0x38,10},{0x24,10},{0x34,10},{0x2C,10},{0x3C,10},
  70. {0x22,10},{0x32,10},{0x2A,10},{0x3A,10},{0x26,10},{0x36,10},{0x2E,10},{0x3E,10},
  71. };
  72. av_cold void ff_asv_common_init(AVCodecContext *avctx) {
  73. ASV1Context * const a = avctx->priv_data;
  74. ff_dsputil_init(&a->dsp, avctx);
  75. a->mb_width = (avctx->width + 15) / 16;
  76. a->mb_height = (avctx->height + 15) / 16;
  77. a->mb_width2 = (avctx->width + 0) / 16;
  78. a->mb_height2 = (avctx->height + 0) / 16;
  79. avctx->coded_frame= &a->picture;
  80. a->avctx= avctx;
  81. }