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 
11 
12 #include "blockd.h"
13 
vp8_setup_block_dptrs(MACROBLOCKD * x)14 void vp8_setup_block_dptrs(MACROBLOCKD *x)
15 {
16     int r, c;
17 
18     for (r = 0; r < 4; r++)
19     {
20         for (c = 0; c < 4; c++)
21         {
22             x->block[r*4+c].predictor = x->predictor + r * 4 * 16 + c * 4;
23         }
24     }
25 
26     for (r = 0; r < 2; r++)
27     {
28         for (c = 0; c < 2; c++)
29         {
30             x->block[16+r*2+c].predictor = x->predictor + 256 + r * 4 * 8 + c * 4;
31 
32         }
33     }
34 
35     for (r = 0; r < 2; r++)
36     {
37         for (c = 0; c < 2; c++)
38         {
39             x->block[20+r*2+c].predictor = x->predictor + 320 + r * 4 * 8 + c * 4;
40 
41         }
42     }
43 
44     for (r = 0; r < 25; r++)
45     {
46         x->block[r].qcoeff  = x->qcoeff  + r * 16;
47         x->block[r].dqcoeff = x->dqcoeff + r * 16;
48         x->block[r].eob     = x->eobs + r;
49     }
50 }
51 
vp8_build_block_doffsets(MACROBLOCKD * x)52 void vp8_build_block_doffsets(MACROBLOCKD *x)
53 {
54     int block;
55 
56     for (block = 0; block < 16; block++) /* y blocks */
57     {
58         x->block[block].offset =
59             (block >> 2) * 4 * x->dst.y_stride + (block & 3) * 4;
60     }
61 
62     for (block = 16; block < 20; block++) /* U and V blocks */
63     {
64         x->block[block+4].offset =
65         x->block[block].offset =
66             ((block - 16) >> 1) * 4 * x->dst.uv_stride + (block & 1) * 4;
67     }
68 }
69