annotate bfin/dsputil_bfin.c @ 12401:f25a00f68cfa libavcodec

Initial version of the a64 (multicolor charset) codec
author bindhammer
date Mon, 23 Aug 2010 11:46:32 +0000
parents 34b9819efef5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3728
4d346abd723c ADI Blackfin optimizations
diego
parents:
diff changeset
1 /*
4765
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
2 * BlackFin DSPUTILS
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
3 *
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
4 * Copyright (C) 2007 Marc Hoffman <marc.hoffman@analog.com>
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
5 * Copyright (c) 2006 Michael Benjamin <michael.benjamin@analog.com>
3728
4d346abd723c ADI Blackfin optimizations
diego
parents:
diff changeset
6 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3728
diff changeset
7 * This file is part of FFmpeg.
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3728
diff changeset
8 *
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3728
diff changeset
9 * FFmpeg is free software; you can redistribute it and/or
3728
4d346abd723c ADI Blackfin optimizations
diego
parents:
diff changeset
10 * modify it under the terms of the GNU Lesser General Public
4d346abd723c ADI Blackfin optimizations
diego
parents:
diff changeset
11 * License as published by the Free Software Foundation; either
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3728
diff changeset
12 * version 2.1 of the License, or (at your option) any later version.
3728
4d346abd723c ADI Blackfin optimizations
diego
parents:
diff changeset
13 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3728
diff changeset
14 * FFmpeg is distributed in the hope that it will be useful,
3728
4d346abd723c ADI Blackfin optimizations
diego
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
4d346abd723c ADI Blackfin optimizations
diego
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4d346abd723c ADI Blackfin optimizations
diego
parents:
diff changeset
17 * Lesser General Public License for more details.
4d346abd723c ADI Blackfin optimizations
diego
parents:
diff changeset
18 *
4d346abd723c ADI Blackfin optimizations
diego
parents:
diff changeset
19 * You should have received a copy of the GNU Lesser General Public
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3728
diff changeset
20 * License along with FFmpeg; if not, write to the Free Software
3728
4d346abd723c ADI Blackfin optimizations
diego
parents:
diff changeset
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
4d346abd723c ADI Blackfin optimizations
diego
parents:
diff changeset
22 */
4d346abd723c ADI Blackfin optimizations
diego
parents:
diff changeset
23
6763
f7cbb7733146 Use full path for #includes from another directory.
diego
parents: 6362
diff changeset
24 #include "libavcodec/avcodec.h"
f7cbb7733146 Use full path for #includes from another directory.
diego
parents: 6362
diff changeset
25 #include "libavcodec/dsputil.h"
5180
3d6f2ff62910 renaming L1CODE to attribute_l1_text, which is defined in dsputil_bfin.h
mhoffman
parents: 5130
diff changeset
26 #include "dsputil_bfin.h"
4765
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
27
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
28 int off;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
29
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
30 static void bfin_idct_add (uint8_t *dest, int line_size, DCTELEM *block)
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
31 {
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
32 ff_bfin_idct (block);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
33 ff_bfin_add_pixels_clamped (block, dest, line_size);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
34 }
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
35
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
36 static void bfin_idct_put (uint8_t *dest, int line_size, DCTELEM *block)
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
37 {
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
38 ff_bfin_idct (block);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
39 ff_bfin_put_pixels_clamped (block, dest, line_size);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
40 }
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
41
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
42
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
43 static void bfin_clear_blocks (DCTELEM *blocks)
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
44 {
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
45 // This is just a simple memset.
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
46 //
8031
eebc7209c47f Convert asm keyword into __asm__.
flameeyes
parents: 6763
diff changeset
47 __asm__("P0=192; "
4765
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
48 "I0=%0; "
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
49 "R0=0; "
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
50 "LSETUP(clear_blocks_blkfn_lab,clear_blocks_blkfn_lab)LC0=P0;"
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
51 "clear_blocks_blkfn_lab:"
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
52 "[I0++]=R0;"
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
53 ::"a" (blocks):"P0","I0","R0");
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
54 }
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
55
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
56
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
57
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
58 static void bfin_put_pixels8 (uint8_t *block, const uint8_t *pixels, int line_size, int h)
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
59 {
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
60 ff_bfin_put_pixels8uc (block, pixels, pixels, line_size, line_size, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
61 }
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
62
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
63 static void bfin_put_pixels8_x2(uint8_t *block, const uint8_t *pixels, int line_size, int h)
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
64 {
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
65 ff_bfin_put_pixels8uc (block, pixels, pixels+1, line_size, line_size, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
66 }
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
67
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
68 static void bfin_put_pixels8_y2 (uint8_t *block, const uint8_t *pixels, int line_size, int h)
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
69 {
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
70 ff_bfin_put_pixels8uc (block, pixels, pixels+line_size, line_size, line_size, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
71 }
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
72
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
73 static void bfin_put_pixels8_xy2 (uint8_t *block, const uint8_t *s0, int line_size, int h)
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
74 {
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
75 ff_bfin_z_put_pixels8_xy2 (block,s0,line_size, line_size, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
76 }
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
77
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
78 static void bfin_put_pixels16 (uint8_t *block, const uint8_t *pixels, int line_size, int h)
3728
4d346abd723c ADI Blackfin optimizations
diego
parents:
diff changeset
79 {
4765
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
80 ff_bfin_put_pixels16uc (block, pixels, pixels, line_size, line_size, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
81 }
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
82
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
83 static void bfin_put_pixels16_x2 (uint8_t *block, const uint8_t *pixels, int line_size, int h)
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
84 {
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
85 ff_bfin_put_pixels16uc (block, pixels, pixels+1, line_size, line_size, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
86 }
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
87
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
88 static void bfin_put_pixels16_y2 (uint8_t *block, const uint8_t *pixels, int line_size, int h)
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
89 {
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
90 ff_bfin_put_pixels16uc (block, pixels, pixels+line_size, line_size, line_size, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
91 }
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
92
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
93 static void bfin_put_pixels16_xy2 (uint8_t *block, const uint8_t *s0, int line_size, int h)
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
94 {
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
95 ff_bfin_z_put_pixels16_xy2 (block,s0,line_size, line_size, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
96 }
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
97
11398
00b80bf84ad9 bfin: fix function prototypes
mru
parents: 9981
diff changeset
98 static void bfin_put_pixels8_nornd (uint8_t *block, const uint8_t *pixels, int line_size, int h)
4765
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
99 {
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
100 ff_bfin_put_pixels8uc_nornd (block, pixels, pixels, line_size, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
101 }
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
102
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
103 static void bfin_put_pixels8_x2_nornd (uint8_t *block, const uint8_t *pixels, int line_size, int h)
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
104 {
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
105 ff_bfin_put_pixels8uc_nornd (block, pixels, pixels+1, line_size, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
106 }
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
107
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
108 static void bfin_put_pixels8_y2_nornd (uint8_t *block, const uint8_t *pixels, int line_size, int h)
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
109 {
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
110 ff_bfin_put_pixels8uc_nornd (block, pixels, pixels+line_size, line_size, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
111 }
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
112
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
113
11398
00b80bf84ad9 bfin: fix function prototypes
mru
parents: 9981
diff changeset
114 static void bfin_put_pixels16_nornd (uint8_t *block, const uint8_t *pixels, int line_size, int h)
4765
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
115 {
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
116 ff_bfin_put_pixels16uc_nornd (block, pixels, pixels, line_size, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
117 }
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
118
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
119 static void bfin_put_pixels16_x2_nornd (uint8_t *block, const uint8_t *pixels, int line_size, int h)
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
120 {
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
121 ff_bfin_put_pixels16uc_nornd (block, pixels, pixels+1, line_size, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
122 }
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
123
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
124 static void bfin_put_pixels16_y2_nornd (uint8_t *block, const uint8_t *pixels, int line_size, int h)
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
125 {
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
126 ff_bfin_put_pixels16uc_nornd (block, pixels, pixels+line_size, line_size, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
127 }
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
128
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
129 static int bfin_pix_abs16 (void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h)
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
130 {
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
131 return ff_bfin_z_sad16x16 (blk1,blk2,line_size,line_size,h);
3728
4d346abd723c ADI Blackfin optimizations
diego
parents:
diff changeset
132 }
4d346abd723c ADI Blackfin optimizations
diego
parents:
diff changeset
133
5690
930587f0259d blackfin vsad primitives
mhoffman
parents: 5541
diff changeset
134 static int bfin_vsad_intra16 (void *c, uint8_t *blk1, uint8_t *dummy, int stride, int h) {
930587f0259d blackfin vsad primitives
mhoffman
parents: 5541
diff changeset
135 return ff_bfin_z_sad16x16 (blk1,blk1+stride,stride<<1,stride<<1,h);
930587f0259d blackfin vsad primitives
mhoffman
parents: 5541
diff changeset
136 }
930587f0259d blackfin vsad primitives
mhoffman
parents: 5541
diff changeset
137
930587f0259d blackfin vsad primitives
mhoffman
parents: 5541
diff changeset
138 static int bfin_vsad (void *c, uint8_t *blk1, uint8_t *blk2, int stride, int h) {
930587f0259d blackfin vsad primitives
mhoffman
parents: 5541
diff changeset
139 return ff_bfin_z_sad16x16 (blk1,blk1+stride,stride<<1,stride<<1,h)
930587f0259d blackfin vsad primitives
mhoffman
parents: 5541
diff changeset
140 + ff_bfin_z_sad16x16 (blk2,blk2+stride,stride<<1,stride<<1,h);
930587f0259d blackfin vsad primitives
mhoffman
parents: 5541
diff changeset
141 }
930587f0259d blackfin vsad primitives
mhoffman
parents: 5541
diff changeset
142
6362
78aa57eba353 FLAT objects cannot have multiple sections, so using the L1 attributes breaks
diego
parents: 5776
diff changeset
143 static uint8_t vtmp_blk[256] attribute_l1_data_b;
4765
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
144
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
145 static int bfin_pix_abs16_x2 (void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h)
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
146 {
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
147 ff_bfin_put_pixels16uc (vtmp_blk, blk2, blk2+1, 16, line_size, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
148 return ff_bfin_z_sad16x16 (blk1, vtmp_blk, line_size, 16, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
149 }
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
150
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
151 static int bfin_pix_abs16_y2 (void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h)
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
152 {
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
153 ff_bfin_put_pixels16uc (vtmp_blk, blk2, blk2+line_size, 16, line_size, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
154 return ff_bfin_z_sad16x16 (blk1, vtmp_blk, line_size, 16, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
155 }
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
156
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
157 static int bfin_pix_abs16_xy2 (void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h)
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
158 {
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
159 ff_bfin_z_put_pixels16_xy2 (vtmp_blk, blk2, 16, line_size, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
160 return ff_bfin_z_sad16x16 (blk1, vtmp_blk, line_size, 16, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
161 }
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
162
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
163 static int bfin_pix_abs8 (void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h)
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
164 {
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
165 return ff_bfin_z_sad8x8 (blk1,blk2,line_size,line_size, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
166 }
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
167
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
168 static int bfin_pix_abs8_x2 (void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h)
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
169 {
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
170 ff_bfin_put_pixels8uc (vtmp_blk, blk2, blk2+1, 8, line_size, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
171 return ff_bfin_z_sad8x8 (blk1, vtmp_blk, line_size, 8, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
172 }
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
173
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
174 static int bfin_pix_abs8_y2 (void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h)
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
175 {
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
176 ff_bfin_put_pixels8uc (vtmp_blk, blk2, blk2+line_size, 8, line_size, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
177 return ff_bfin_z_sad8x8 (blk1, vtmp_blk, line_size, 8, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
178 }
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
179
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
180 static int bfin_pix_abs8_xy2 (void *c, uint8_t *blk1, uint8_t *blk2, int line_size, int h)
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
181 {
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
182 ff_bfin_z_put_pixels8_xy2 (vtmp_blk, blk2, 8, line_size, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
183 return ff_bfin_z_sad8x8 (blk1, vtmp_blk, line_size, 8, h);
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
184 }
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
185
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
186
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
187 /*
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
188 decoder optimization
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
189 start on 2/11 100 frames of 352x240@25 compiled with no optimization -g debugging
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
190 9.824s ~ 2.44x off
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
191 6.360s ~ 1.58x off with -O2
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
192 5.740s ~ 1.43x off with idcts
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
193
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
194 2.64s 2/20 same sman.mp4 decode only
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
195
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
196 */
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
197
3728
4d346abd723c ADI Blackfin optimizations
diego
parents:
diff changeset
198 void dsputil_init_bfin( DSPContext* c, AVCodecContext *avctx )
4d346abd723c ADI Blackfin optimizations
diego
parents:
diff changeset
199 {
4765
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
200 c->get_pixels = ff_bfin_get_pixels;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
201 c->diff_pixels = ff_bfin_diff_pixels;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
202 c->put_pixels_clamped = ff_bfin_put_pixels_clamped;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
203 c->add_pixels_clamped = ff_bfin_add_pixels_clamped;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
204
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
205 c->clear_blocks = bfin_clear_blocks;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
206 c->pix_sum = ff_bfin_pix_sum;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
207 c->pix_norm1 = ff_bfin_pix_norm1;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
208
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
209 c->sad[0] = bfin_pix_abs16;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
210 c->sad[1] = bfin_pix_abs8;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
211
9728
5d5528c6eaf7 blackfin: disable broken dsputil functions
mru
parents: 9727
diff changeset
212 /* c->vsad[0] = bfin_vsad; */
5d5528c6eaf7 blackfin: disable broken dsputil functions
mru
parents: 9727
diff changeset
213 /* c->vsad[4] = bfin_vsad_intra16; */
5690
930587f0259d blackfin vsad primitives
mhoffman
parents: 5541
diff changeset
214
4765
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
215 /* TODO [0] 16 [1] 8 */
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
216 c->pix_abs[0][0] = bfin_pix_abs16;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
217 c->pix_abs[0][1] = bfin_pix_abs16_x2;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
218 c->pix_abs[0][2] = bfin_pix_abs16_y2;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
219 c->pix_abs[0][3] = bfin_pix_abs16_xy2;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
220
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
221 c->pix_abs[1][0] = bfin_pix_abs8;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
222 c->pix_abs[1][1] = bfin_pix_abs8_x2;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
223 c->pix_abs[1][2] = bfin_pix_abs8_y2;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
224 c->pix_abs[1][3] = bfin_pix_abs8_xy2;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
225
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
226
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
227 c->sse[0] = ff_bfin_sse16;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
228 c->sse[1] = ff_bfin_sse8;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
229 c->sse[2] = ff_bfin_sse4;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
230
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
231 c->put_pixels_tab[0][0] = bfin_put_pixels16;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
232 c->put_pixels_tab[0][1] = bfin_put_pixels16_x2;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
233 c->put_pixels_tab[0][2] = bfin_put_pixels16_y2;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
234 c->put_pixels_tab[0][3] = bfin_put_pixels16_xy2;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
235
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
236 c->put_pixels_tab[1][0] = bfin_put_pixels8;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
237 c->put_pixels_tab[1][1] = bfin_put_pixels8_x2;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
238 c->put_pixels_tab[1][2] = bfin_put_pixels8_y2;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
239 c->put_pixels_tab[1][3] = bfin_put_pixels8_xy2;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
240
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
241 c->put_no_rnd_pixels_tab[1][0] = bfin_put_pixels8_nornd;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
242 c->put_no_rnd_pixels_tab[1][1] = bfin_put_pixels8_x2_nornd;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
243 c->put_no_rnd_pixels_tab[1][2] = bfin_put_pixels8_y2_nornd;
9728
5d5528c6eaf7 blackfin: disable broken dsputil functions
mru
parents: 9727
diff changeset
244 /* c->put_no_rnd_pixels_tab[1][3] = ff_bfin_put_pixels8_xy2_nornd; */
4765
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
245
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
246 c->put_no_rnd_pixels_tab[0][0] = bfin_put_pixels16_nornd;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
247 c->put_no_rnd_pixels_tab[0][1] = bfin_put_pixels16_x2_nornd;
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
248 c->put_no_rnd_pixels_tab[0][2] = bfin_put_pixels16_y2_nornd;
9728
5d5528c6eaf7 blackfin: disable broken dsputil functions
mru
parents: 9727
diff changeset
249 /* c->put_no_rnd_pixels_tab[0][3] = ff_bfin_put_pixels16_xy2_nornd; */
4765
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
250
9726
28796439526a blackfin: use optimised (I)DCT only when ctx->(i)dct_algo is auto
mru
parents: 8250
diff changeset
251 if (avctx->dct_algo == FF_DCT_AUTO)
28796439526a blackfin: use optimised (I)DCT only when ctx->(i)dct_algo is auto
mru
parents: 8250
diff changeset
252 c->fdct = ff_bfin_fdct;
28796439526a blackfin: use optimised (I)DCT only when ctx->(i)dct_algo is auto
mru
parents: 8250
diff changeset
253
5776
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents: 5690
diff changeset
254 if (avctx->idct_algo==FF_IDCT_VP3) {
9726
28796439526a blackfin: use optimised (I)DCT only when ctx->(i)dct_algo is auto
mru
parents: 8250
diff changeset
255 c->idct_permutation_type = FF_NO_IDCT_PERM;
5776
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents: 5690
diff changeset
256 c->idct = ff_bfin_vp3_idct;
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents: 5690
diff changeset
257 c->idct_add = ff_bfin_vp3_idct_add;
73ec16dbcbc1 blackfin optimized vp3 transform and infastructure for idct
mhoffman
parents: 5690
diff changeset
258 c->idct_put = ff_bfin_vp3_idct_put;
9726
28796439526a blackfin: use optimised (I)DCT only when ctx->(i)dct_algo is auto
mru
parents: 8250
diff changeset
259 } else if (avctx->idct_algo == FF_IDCT_AUTO) {
28796439526a blackfin: use optimised (I)DCT only when ctx->(i)dct_algo is auto
mru
parents: 8250
diff changeset
260 c->idct_permutation_type = FF_NO_IDCT_PERM;
5541
6c385356e61f special handling for vp3 idct, use the c reference
mhoffman
parents: 5181
diff changeset
261 c->idct = ff_bfin_idct;
6c385356e61f special handling for vp3 idct, use the c reference
mhoffman
parents: 5181
diff changeset
262 c->idct_add = bfin_idct_add;
6c385356e61f special handling for vp3 idct, use the c reference
mhoffman
parents: 5181
diff changeset
263 c->idct_put = bfin_idct_put;
6c385356e61f special handling for vp3 idct, use the c reference
mhoffman
parents: 5181
diff changeset
264 }
3728
4d346abd723c ADI Blackfin optimizations
diego
parents:
diff changeset
265 }
4765
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
266
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
267
85298e8c55c4 bfin dsputils, basic pixel operations sads, diffs, motion compensation
diego
parents: 3947
diff changeset
268