mbpitch.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 "blockd.h"
  11. void vp8_setup_block_dptrs(MACROBLOCKD *x) {
  12. int r, c;
  13. for (r = 0; r < 4; ++r) {
  14. for (c = 0; c < 4; ++c) {
  15. x->block[r * 4 + c].predictor = x->predictor + r * 4 * 16 + c * 4;
  16. }
  17. }
  18. for (r = 0; r < 2; ++r) {
  19. for (c = 0; c < 2; ++c) {
  20. x->block[16 + r * 2 + c].predictor =
  21. x->predictor + 256 + r * 4 * 8 + c * 4;
  22. }
  23. }
  24. for (r = 0; r < 2; ++r) {
  25. for (c = 0; c < 2; ++c) {
  26. x->block[20 + r * 2 + c].predictor =
  27. x->predictor + 320 + r * 4 * 8 + c * 4;
  28. }
  29. }
  30. for (r = 0; r < 25; ++r) {
  31. x->block[r].qcoeff = x->qcoeff + r * 16;
  32. x->block[r].dqcoeff = x->dqcoeff + r * 16;
  33. x->block[r].eob = x->eobs + r;
  34. }
  35. }
  36. void vp8_build_block_doffsets(MACROBLOCKD *x) {
  37. int block;
  38. for (block = 0; block < 16; ++block) /* y blocks */
  39. {
  40. x->block[block].offset =
  41. (block >> 2) * 4 * x->dst.y_stride + (block & 3) * 4;
  42. }
  43. for (block = 16; block < 20; ++block) /* U and V blocks */
  44. {
  45. x->block[block + 4].offset = x->block[block].offset =
  46. ((block - 16) >> 1) * 4 * x->dst.uv_stride + (block & 1) * 4;
  47. }
  48. }