idct_blk_mmx.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 "vp8/common/blockd.h"
  13. #include "vpx_mem/vpx_mem.h"
  14. extern void vp8_dequantize_b_impl_mmx(short *sq, short *dq, short *q);
  15. void vp8_dequantize_b_mmx(BLOCKD *d, short *DQC) {
  16. short *sq = (short *)d->qcoeff;
  17. short *dq = (short *)d->dqcoeff;
  18. vp8_dequantize_b_impl_mmx(sq, dq, DQC);
  19. }
  20. void vp8_dequant_idct_add_y_block_mmx(short *q, short *dq, unsigned char *dst,
  21. int stride, char *eobs) {
  22. int i;
  23. for (i = 0; i < 4; ++i) {
  24. if (eobs[0] > 1) {
  25. vp8_dequant_idct_add_mmx(q, dq, dst, stride);
  26. } else if (eobs[0] == 1) {
  27. vp8_dc_only_idct_add_mmx(q[0] * dq[0], dst, stride, dst, stride);
  28. memset(q, 0, 2 * sizeof(q[0]));
  29. }
  30. if (eobs[1] > 1) {
  31. vp8_dequant_idct_add_mmx(q + 16, dq, dst + 4, stride);
  32. } else if (eobs[1] == 1) {
  33. vp8_dc_only_idct_add_mmx(q[16] * dq[0], dst + 4, stride, dst + 4, stride);
  34. memset(q + 16, 0, 2 * sizeof(q[0]));
  35. }
  36. if (eobs[2] > 1) {
  37. vp8_dequant_idct_add_mmx(q + 32, dq, dst + 8, stride);
  38. } else if (eobs[2] == 1) {
  39. vp8_dc_only_idct_add_mmx(q[32] * dq[0], dst + 8, stride, dst + 8, stride);
  40. memset(q + 32, 0, 2 * sizeof(q[0]));
  41. }
  42. if (eobs[3] > 1) {
  43. vp8_dequant_idct_add_mmx(q + 48, dq, dst + 12, stride);
  44. } else if (eobs[3] == 1) {
  45. vp8_dc_only_idct_add_mmx(q[48] * dq[0], dst + 12, stride, dst + 12,
  46. stride);
  47. memset(q + 48, 0, 2 * sizeof(q[0]));
  48. }
  49. q += 64;
  50. dst += 4 * stride;
  51. eobs += 4;
  52. }
  53. }
  54. void vp8_dequant_idct_add_uv_block_mmx(short *q, short *dq, unsigned char *dstu,
  55. unsigned char *dstv, int stride,
  56. char *eobs) {
  57. int i;
  58. for (i = 0; i < 2; ++i) {
  59. if (eobs[0] > 1) {
  60. vp8_dequant_idct_add_mmx(q, dq, dstu, stride);
  61. } else if (eobs[0] == 1) {
  62. vp8_dc_only_idct_add_mmx(q[0] * dq[0], dstu, stride, dstu, stride);
  63. memset(q, 0, 2 * sizeof(q[0]));
  64. }
  65. if (eobs[1] > 1) {
  66. vp8_dequant_idct_add_mmx(q + 16, dq, dstu + 4, stride);
  67. } else if (eobs[1] == 1) {
  68. vp8_dc_only_idct_add_mmx(q[16] * dq[0], dstu + 4, stride, dstu + 4,
  69. stride);
  70. memset(q + 16, 0, 2 * sizeof(q[0]));
  71. }
  72. q += 32;
  73. dstu += 4 * stride;
  74. eobs += 2;
  75. }
  76. for (i = 0; i < 2; ++i) {
  77. if (eobs[0] > 1) {
  78. vp8_dequant_idct_add_mmx(q, dq, dstv, stride);
  79. } else if (eobs[0] == 1) {
  80. vp8_dc_only_idct_add_mmx(q[0] * dq[0], dstv, stride, dstv, stride);
  81. memset(q, 0, 2 * sizeof(q[0]));
  82. }
  83. if (eobs[1] > 1) {
  84. vp8_dequant_idct_add_mmx(q + 16, dq, dstv + 4, stride);
  85. } else if (eobs[1] == 1) {
  86. vp8_dc_only_idct_add_mmx(q[16] * dq[0], dstv + 4, stride, dstv + 4,
  87. stride);
  88. memset(q + 16, 0, 2 * sizeof(q[0]));
  89. }
  90. q += 32;
  91. dstv += 4 * stride;
  92. eobs += 2;
  93. }
  94. }