v210dec_init.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * V210 decoder DSP init
  3. *
  4. * Copyright (C) 2009 Michael Niedermayer <michaelni@gmx.at>
  5. * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
  6. *
  7. * This file is part of FFmpeg.
  8. *
  9. * FFmpeg is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation; either
  12. * version 2.1 of the License, or (at your option) any later version.
  13. *
  14. * FFmpeg is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with FFmpeg; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. */
  23. #ifndef AVCODEC_V210DEC_INIT_H
  24. #define AVCODEC_V210DEC_INIT_H
  25. #include <stdint.h>
  26. #include "config.h"
  27. #include "libavutil/attributes.h"
  28. #include "libavutil/bswap.h"
  29. #include "v210dec.h"
  30. #define READ_PIXELS(a, b, c) \
  31. do { \
  32. val = av_le2ne32(*src++); \
  33. *a++ = val & 0x3FF; \
  34. *b++ = (val >> 10) & 0x3FF; \
  35. *c++ = (val >> 20) & 0x3FF; \
  36. } while (0)
  37. static void v210_planar_unpack_c(const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, int width)
  38. {
  39. uint32_t val;
  40. for (int i = 0; i < width - 5; i += 6) {
  41. READ_PIXELS(u, y, v);
  42. READ_PIXELS(y, u, y);
  43. READ_PIXELS(v, y, u);
  44. READ_PIXELS(y, v, y);
  45. }
  46. }
  47. av_unused static av_cold void ff_v210dec_init(V210DecContext *s)
  48. {
  49. s->unpack_frame = v210_planar_unpack_c;
  50. #if ARCH_X86
  51. ff_v210_x86_init(s);
  52. #endif
  53. }
  54. #endif /* AVCODEC_V210DEC_INIT_H */