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.

48 lines
1.7KB

  1. /*
  2. * VP5/6/8 decoder
  3. * Copyright (c) 2010 Fiona Glaser <fiona@x264.com>
  4. *
  5. * This file is part of Libav.
  6. *
  7. * Libav is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * Libav is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with Libav; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #include "libavutil/common.h"
  22. #include "vp56.h"
  23. const uint8_t ff_vp56_norm_shift[256]= {
  24. 8,7,6,6,5,5,5,5,4,4,4,4,4,4,4,4,
  25. 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
  26. 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
  27. 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
  28. 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  29. 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  30. 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  31. 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
  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,
  33. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  34. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  35. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  36. };
  37. void ff_vp56_init_range_decoder(VP56RangeCoder *c, const uint8_t *buf, int buf_size)
  38. {
  39. c->high = 255;
  40. c->bits = -16;
  41. c->buffer = buf;
  42. c->end = buf + buf_size;
  43. c->code_word = bytestream_get_be24(&c->buffer);
  44. }