idct_blk.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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_y_block_c(short *q, short *dq, unsigned char *dst,
  14. int stride, char *eobs) {
  15. int i, j;
  16. for (i = 0; i < 4; ++i) {
  17. for (j = 0; j < 4; ++j) {
  18. if (*eobs++ > 1) {
  19. vp8_dequant_idct_add_c(q, dq, dst, stride);
  20. } else {
  21. vp8_dc_only_idct_add_c(q[0] * dq[0], dst, stride, dst, stride);
  22. memset(q, 0, 2 * sizeof(q[0]));
  23. }
  24. q += 16;
  25. dst += 4;
  26. }
  27. dst += 4 * stride - 16;
  28. }
  29. }
  30. void vp8_dequant_idct_add_uv_block_c(short *q, short *dq, unsigned char *dst_u,
  31. unsigned char *dst_v, int stride,
  32. char *eobs) {
  33. int i, j;
  34. for (i = 0; i < 2; ++i) {
  35. for (j = 0; j < 2; ++j) {
  36. if (*eobs++ > 1) {
  37. vp8_dequant_idct_add_c(q, dq, dst_u, stride);
  38. } else {
  39. vp8_dc_only_idct_add_c(q[0] * dq[0], dst_u, stride, dst_u, stride);
  40. memset(q, 0, 2 * sizeof(q[0]));
  41. }
  42. q += 16;
  43. dst_u += 4;
  44. }
  45. dst_u += 4 * stride - 8;
  46. }
  47. for (i = 0; i < 2; ++i) {
  48. for (j = 0; j < 2; ++j) {
  49. if (*eobs++ > 1) {
  50. vp8_dequant_idct_add_c(q, dq, dst_v, stride);
  51. } else {
  52. vp8_dc_only_idct_add_c(q[0] * dq[0], dst_v, stride, dst_v, stride);
  53. memset(q, 0, 2 * sizeof(q[0]));
  54. }
  55. q += 16;
  56. dst_v += 4;
  57. }
  58. dst_v += 4 * stride - 8;
  59. }
  60. }