idct_blk.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #include "vpx_config.h"
  11. #include "vp8_rtcd.h"
  12. #include "vpx_mem/vpx_mem.h"
  13. void vp8_dequant_idct_add_c(short *input, short *dq, unsigned char *dest,
  14. int stride);
  15. void vp8_dc_only_idct_add_c(short input_dc, unsigned char *pred,
  16. int pred_stride, unsigned char *dst_ptr,
  17. int dst_stride);
  18. void vp8_dequant_idct_add_y_block_c(short *q, short *dq, unsigned char *dst,
  19. int stride, char *eobs) {
  20. int i, j;
  21. for (i = 0; i < 4; ++i) {
  22. for (j = 0; j < 4; ++j) {
  23. if (*eobs++ > 1) {
  24. vp8_dequant_idct_add_c(q, dq, dst, stride);
  25. } else {
  26. vp8_dc_only_idct_add_c(q[0] * dq[0], dst, stride, dst, stride);
  27. memset(q, 0, 2 * sizeof(q[0]));
  28. }
  29. q += 16;
  30. dst += 4;
  31. }
  32. dst += 4 * stride - 16;
  33. }
  34. }
  35. void vp8_dequant_idct_add_uv_block_c(short *q, short *dq, unsigned char *dstu,
  36. unsigned char *dstv, int stride,
  37. char *eobs) {
  38. int i, j;
  39. for (i = 0; i < 2; ++i) {
  40. for (j = 0; j < 2; ++j) {
  41. if (*eobs++ > 1) {
  42. vp8_dequant_idct_add_c(q, dq, dstu, stride);
  43. } else {
  44. vp8_dc_only_idct_add_c(q[0] * dq[0], dstu, stride, dstu, stride);
  45. memset(q, 0, 2 * sizeof(q[0]));
  46. }
  47. q += 16;
  48. dstu += 4;
  49. }
  50. dstu += 4 * stride - 8;
  51. }
  52. for (i = 0; i < 2; ++i) {
  53. for (j = 0; j < 2; ++j) {
  54. if (*eobs++ > 1) {
  55. vp8_dequant_idct_add_c(q, dq, dstv, stride);
  56. } else {
  57. vp8_dc_only_idct_add_c(q[0] * dq[0], dstv, stride, dstv, stride);
  58. memset(q, 0, 2 * sizeof(q[0]));
  59. }
  60. q += 16;
  61. dstv += 4;
  62. }
  63. dstv += 4 * stride - 8;
  64. }
  65. }