2
0

dirac_vlc.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright (C) 2016 Open Broadcast Systems Ltd.
  3. * Author 2016 Rostislav Pehlivanov <rpehlivanov@obe.tv>
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg 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. * FFmpeg 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 FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #ifndef AVCODEC_DIRAC_VLC_H
  22. #define AVCODEC_DIRAC_VLC_H
  23. #include "libavutil/avutil.h"
  24. /* Can be 32 bits wide for some performance gain on some machines, but it will
  25. * incorrectly decode very long coefficients (usually only 1 or 2 per frame) */
  26. typedef uint64_t residual;
  27. #define LUT_BITS 8
  28. /* Exactly 64 bytes */
  29. typedef struct DiracGolombLUT {
  30. residual preamble, leftover;
  31. int32_t ready[LUT_BITS];
  32. int32_t preamble_bits, leftover_bits, ready_num;
  33. int8_t need_s, sign;
  34. } DiracGolombLUT;
  35. av_cold int ff_dirac_golomb_reader_init(DiracGolombLUT **lut_ctx);
  36. int ff_dirac_golomb_read_32bit(DiracGolombLUT *lut_ctx, const uint8_t *buf,
  37. int bytes, uint8_t *dst, int coeffs);
  38. int ff_dirac_golomb_read_16bit(DiracGolombLUT *lut_ctx, const uint8_t *buf,
  39. int bytes, uint8_t *_dst, int coeffs);
  40. av_cold void ff_dirac_golomb_reader_end(DiracGolombLUT **lut_ctx);
  41. #endif /* AVCODEC_DIRAC_VLC_H */