annotate mlib/dsputil_mlib.c @ 1283:00dcdda701ca libavcodec

rework SVQ1 decoder to use more intuitive VLC tables as well as ffmpeg's native VLC facilities; also added decoding of some more frame header fields
author tmmm
date Mon, 26 May 2003 17:44:24 +0000
parents d5719a953ee0
children 7d328fd9d8a5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
1 /*
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
2 * Sun mediaLib optimized DSP utils
429
718a22dc121f license/copyright change
glantau
parents: 90
diff changeset
3 * Copyright (c) 2001 Fabrice Bellard.
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
4 *
429
718a22dc121f license/copyright change
glantau
parents: 90
diff changeset
5 * This library is free software; you can redistribute it and/or
718a22dc121f license/copyright change
glantau
parents: 90
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
718a22dc121f license/copyright change
glantau
parents: 90
diff changeset
7 * License as published by the Free Software Foundation; either
718a22dc121f license/copyright change
glantau
parents: 90
diff changeset
8 * version 2 of the License, or (at your option) any later version.
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
9 *
429
718a22dc121f license/copyright change
glantau
parents: 90
diff changeset
10 * This library is distributed in the hope that it will be useful,
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
429
718a22dc121f license/copyright change
glantau
parents: 90
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
718a22dc121f license/copyright change
glantau
parents: 90
diff changeset
13 * Lesser General Public License for more details.
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
14 *
429
718a22dc121f license/copyright change
glantau
parents: 90
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
718a22dc121f license/copyright change
glantau
parents: 90
diff changeset
16 * License along with this library; if not, write to the Free Software
718a22dc121f license/copyright change
glantau
parents: 90
diff changeset
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
18 */
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
19
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
20 #include "../dsputil.h"
628
f596db4aa871 sun solaris compilation bugfix, patch by (Martin Olschewski <olschewski at zpr dot uni-koeln dot de>)
michaelni
parents: 429
diff changeset
21 #include "../mpegvideo.h"
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
22
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
23 #include <mlib_types.h>
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
24 #include <mlib_status.h>
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
25 #include <mlib_sys.h>
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
26 #include <mlib_video.h>
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
27
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
28
735
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
29 /* copy block, width 16 pixel, height 8/16 */
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
30
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
31 static void put_pixels16_mlib (uint8_t * dest, const uint8_t * ref,
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
32 int stride, int height)
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
33 {
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
34 assert(height == 16 || height == 8);
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
35 if (height == 16)
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
36 mlib_VideoCopyRef_U8_U8_16x16(dest, (uint8_t *)ref, stride);
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
37 else
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
38 mlib_VideoCopyRef_U8_U8_16x8 (dest, (uint8_t *)ref, stride);
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
39 }
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
40
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
41 static void put_pixels16_x2_mlib (uint8_t * dest, const uint8_t * ref,
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
42 int stride, int height)
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
43 {
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
44 assert(height == 16 || height == 8);
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
45 if (height == 16)
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
46 mlib_VideoInterpX_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
47 else
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
48 mlib_VideoInterpX_U8_U8_16x8 (dest, (uint8_t *)ref, stride, stride);
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
49 }
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
50
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
51 static void put_pixels16_y2_mlib (uint8_t * dest, const uint8_t * ref,
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
52 int stride, int height)
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
53 {
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
54 assert(height == 16 || height == 8);
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
55 if (height == 16)
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
56 mlib_VideoInterpY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
57 else
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
58 mlib_VideoInterpY_U8_U8_16x8 (dest, (uint8_t *)ref, stride, stride);
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
59 }
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
60
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
61 static void put_pixels16_xy2_mlib(uint8_t * dest, const uint8_t * ref,
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
62 int stride, int height)
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
63 {
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
64 assert(height == 16 || height == 8);
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
65 if (height == 16)
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
66 mlib_VideoInterpXY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
67 else
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
68 mlib_VideoInterpXY_U8_U8_16x8 (dest, (uint8_t *)ref, stride, stride);
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
69 }
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
70
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
71
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
72 /* copy block, width 8 pixel, height 8/16 */
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
73
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
74 static void put_pixels8_mlib (uint8_t * dest, const uint8_t * ref,
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
75 int stride, int height)
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
76 {
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
77 assert(height == 16 || height == 8);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
78 if (height == 16)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
79 mlib_VideoCopyRef_U8_U8_8x16(dest, (uint8_t *)ref, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
80 else
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
81 mlib_VideoCopyRef_U8_U8_8x8 (dest, (uint8_t *)ref, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
82 }
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
83
735
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
84 static void put_pixels8_x2_mlib (uint8_t * dest, const uint8_t * ref,
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
85 int stride, int height)
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
86 {
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
87 assert(height == 16 || height == 8);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
88 if (height == 16)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
89 mlib_VideoInterpX_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
90 else
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
91 mlib_VideoInterpX_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
92 }
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
93
735
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
94 static void put_pixels8_y2_mlib (uint8_t * dest, const uint8_t * ref,
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
95 int stride, int height)
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
96 {
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
97 assert(height == 16 || height == 8);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
98 if (height == 16)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
99 mlib_VideoInterpY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
100 else
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
101 mlib_VideoInterpY_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
102 }
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
103
735
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
104 static void put_pixels8_xy2_mlib(uint8_t * dest, const uint8_t * ref,
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
105 int stride, int height)
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
106 {
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
107 assert(height == 16 || height == 8);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
108 if (height == 16)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
109 mlib_VideoInterpXY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
110 else
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
111 mlib_VideoInterpXY_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
112 }
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
113
735
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
114
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
115 /* average/merge dest+source block, width 16 pixel, height 8/16 */
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
116
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
117 static void avg_pixels16_mlib (uint8_t * dest, const uint8_t * ref,
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
118 int stride, int height)
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
119 {
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
120 assert(height == 16 || height == 8);
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
121 if (height == 16)
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
122 mlib_VideoCopyRefAve_U8_U8_16x16(dest, (uint8_t *)ref, stride);
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
123 else
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
124 mlib_VideoCopyRefAve_U8_U8_16x8 (dest, (uint8_t *)ref, stride);
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
125 }
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
126
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
127 static void avg_pixels16_x2_mlib (uint8_t * dest, const uint8_t * ref,
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
128 int stride, int height)
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
129 {
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
130 assert(height == 16 || height == 8);
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
131 if (height == 16)
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
132 mlib_VideoInterpAveX_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
133 else
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
134 mlib_VideoInterpAveX_U8_U8_16x8 (dest, (uint8_t *)ref, stride, stride);
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
135 }
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
136
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
137 static void avg_pixels16_y2_mlib (uint8_t * dest, const uint8_t * ref,
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
138 int stride, int height)
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
139 {
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
140 assert(height == 16 || height == 8);
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
141 if (height == 16)
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
142 mlib_VideoInterpAveY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
143 else
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
144 mlib_VideoInterpAveY_U8_U8_16x8 (dest, (uint8_t *)ref, stride, stride);
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
145 }
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
146
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
147 static void avg_pixels16_xy2_mlib (uint8_t * dest, const uint8_t * ref,
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
148 int stride, int height)
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
149 {
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
150 assert(height == 16 || height == 8);
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
151 if (height == 16)
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
152 mlib_VideoInterpAveXY_U8_U8_16x16(dest, (uint8_t *)ref, stride, stride);
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
153 else
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
154 mlib_VideoInterpAveXY_U8_U8_16x8 (dest, (uint8_t *)ref, stride, stride);
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
155 }
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
156
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
157
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
158 /* average/merge dest+source block, width 8 pixel, height 8/16 */
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
159
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
160 static void avg_pixels8_mlib (uint8_t * dest, const uint8_t * ref,
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
161 int stride, int height)
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
162 {
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
163 assert(height == 16 || height == 8);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
164 if (height == 16)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
165 mlib_VideoCopyRefAve_U8_U8_8x16(dest, (uint8_t *)ref, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
166 else
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
167 mlib_VideoCopyRefAve_U8_U8_8x8 (dest, (uint8_t *)ref, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
168 }
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
169
735
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
170 static void avg_pixels8_x2_mlib (uint8_t * dest, const uint8_t * ref,
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
171 int stride, int height)
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
172 {
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
173 assert(height == 16 || height == 8);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
174 if (height == 16)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
175 mlib_VideoInterpAveX_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
176 else
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
177 mlib_VideoInterpAveX_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
178 }
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
179
735
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
180 static void avg_pixels8_y2_mlib (uint8_t * dest, const uint8_t * ref,
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
181 int stride, int height)
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
182 {
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
183 assert(height == 16 || height == 8);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
184 if (height == 16)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
185 mlib_VideoInterpAveY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
186 else
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
187 mlib_VideoInterpAveY_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
188 }
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
189
735
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
190 static void avg_pixels8_xy2_mlib (uint8_t * dest, const uint8_t * ref,
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
191 int stride, int height)
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
192 {
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
193 assert(height == 16 || height == 8);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
194 if (height == 16)
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
195 mlib_VideoInterpAveXY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
196 else
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
197 mlib_VideoInterpAveXY_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
198 }
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
199
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
200
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 929
diff changeset
201 static void (*put_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size);
929
c35f06d95e64 mlib fix patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 856
diff changeset
202
c35f06d95e64 mlib fix patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 856
diff changeset
203
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 929
diff changeset
204 static void add_pixels_clamped_mlib(const DCTELEM *block, uint8_t *pixels, int line_size)
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
205 {
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
206 mlib_VideoAddBlock_U8_S16(pixels, (mlib_s16 *)block, line_size);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
207 }
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
208
735
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
209
730
b24ea84b23e2 trying to fix the non-x86 IDCTs (untested)
michaelni
parents: 682
diff changeset
210 /* XXX: those functions should be suppressed ASAP when all IDCTs are
b24ea84b23e2 trying to fix the non-x86 IDCTs (untested)
michaelni
parents: 682
diff changeset
211 converted */
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 929
diff changeset
212 static void ff_idct_put_mlib(uint8_t *dest, int line_size, DCTELEM *data)
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
213 {
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
214 mlib_VideoIDCT8x8_S16_S16 (data, data);
735
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
215 put_pixels_clamped(data, dest, line_size);
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
216 }
735
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
217
1064
b32afefe7d33 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 929
diff changeset
218 static void ff_idct_add_mlib(uint8_t *dest, int line_size, DCTELEM *data)
730
b24ea84b23e2 trying to fix the non-x86 IDCTs (untested)
michaelni
parents: 682
diff changeset
219 {
b24ea84b23e2 trying to fix the non-x86 IDCTs (untested)
michaelni
parents: 682
diff changeset
220 mlib_VideoIDCT8x8_S16_S16 (data, data);
929
c35f06d95e64 mlib fix patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 856
diff changeset
221 mlib_VideoAddBlock_U8_S16(dest, (mlib_s16 *)data, line_size);
730
b24ea84b23e2 trying to fix the non-x86 IDCTs (untested)
michaelni
parents: 682
diff changeset
222 }
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
223
735
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
224 static void ff_fdct_mlib(DCTELEM *data)
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
225 {
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
226 mlib_VideoDCT8x8_S16_S16 (data, data);
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
227 }
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
228
1276
d5719a953ee0 * compile fixes by Mitch at Bits.COM
kabi
parents: 1064
diff changeset
229 void dsputil_init_mlib(DSPContext* c, AVCodecContext *avctx)
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
230 {
856
3c6df37177dd * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 768
diff changeset
231 c->put_pixels_tab[0][0] = put_pixels16_mlib;
3c6df37177dd * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 768
diff changeset
232 c->put_pixels_tab[0][1] = put_pixels16_x2_mlib;
3c6df37177dd * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 768
diff changeset
233 c->put_pixels_tab[0][2] = put_pixels16_y2_mlib;
3c6df37177dd * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 768
diff changeset
234 c->put_pixels_tab[0][3] = put_pixels16_xy2_mlib;
3c6df37177dd * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 768
diff changeset
235 c->put_pixels_tab[1][0] = put_pixels8_mlib;
3c6df37177dd * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 768
diff changeset
236 c->put_pixels_tab[1][1] = put_pixels8_x2_mlib;
3c6df37177dd * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 768
diff changeset
237 c->put_pixels_tab[1][2] = put_pixels8_y2_mlib;
3c6df37177dd * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 768
diff changeset
238 c->put_pixels_tab[1][3] = put_pixels8_xy2_mlib;
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
239
856
3c6df37177dd * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 768
diff changeset
240 c->avg_pixels_tab[0][0] = avg_pixels16_mlib;
3c6df37177dd * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 768
diff changeset
241 c->avg_pixels_tab[0][1] = avg_pixels16_x2_mlib;
3c6df37177dd * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 768
diff changeset
242 c->avg_pixels_tab[0][2] = avg_pixels16_y2_mlib;
3c6df37177dd * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 768
diff changeset
243 c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mlib;
3c6df37177dd * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 768
diff changeset
244 c->avg_pixels_tab[1][0] = avg_pixels8_mlib;
3c6df37177dd * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 768
diff changeset
245 c->avg_pixels_tab[1][1] = avg_pixels8_x2_mlib;
3c6df37177dd * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 768
diff changeset
246 c->avg_pixels_tab[1][2] = avg_pixels8_y2_mlib;
3c6df37177dd * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 768
diff changeset
247 c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mlib;
3c6df37177dd * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 768
diff changeset
248
3c6df37177dd * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 768
diff changeset
249 c->put_no_rnd_pixels_tab[0][0] = put_pixels16_mlib;
3c6df37177dd * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 768
diff changeset
250 c->put_no_rnd_pixels_tab[1][0] = put_pixels8_mlib;
3c6df37177dd * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 768
diff changeset
251
3c6df37177dd * using DSPContext - so each codec could use its local (sub)set of CPU extension
kabi
parents: 768
diff changeset
252 c->add_pixels_clamped = add_pixels_clamped_mlib;
929
c35f06d95e64 mlib fix patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 856
diff changeset
253 put_pixels_clamped = c->put_pixels_clamped;
88
06f63b58d2a8 mlib merge
glantau
parents:
diff changeset
254 }
628
f596db4aa871 sun solaris compilation bugfix, patch by (Martin Olschewski <olschewski at zpr dot uni-koeln dot de>)
michaelni
parents: 429
diff changeset
255
f596db4aa871 sun solaris compilation bugfix, patch by (Martin Olschewski <olschewski at zpr dot uni-koeln dot de>)
michaelni
parents: 429
diff changeset
256 void MPV_common_init_mlib(MpegEncContext *s)
f596db4aa871 sun solaris compilation bugfix, patch by (Martin Olschewski <olschewski at zpr dot uni-koeln dot de>)
michaelni
parents: 429
diff changeset
257 {
730
b24ea84b23e2 trying to fix the non-x86 IDCTs (untested)
michaelni
parents: 682
diff changeset
258 int i;
b24ea84b23e2 trying to fix the non-x86 IDCTs (untested)
michaelni
parents: 682
diff changeset
259
628
f596db4aa871 sun solaris compilation bugfix, patch by (Martin Olschewski <olschewski at zpr dot uni-koeln dot de>)
michaelni
parents: 429
diff changeset
260 if(s->avctx->dct_algo==FF_DCT_AUTO || s->avctx->dct_algo==FF_DCT_MLIB){
1276
d5719a953ee0 * compile fixes by Mitch at Bits.COM
kabi
parents: 1064
diff changeset
261 s->dsp.fdct = ff_fdct_mlib;
628
f596db4aa871 sun solaris compilation bugfix, patch by (Martin Olschewski <olschewski at zpr dot uni-koeln dot de>)
michaelni
parents: 429
diff changeset
262 }
730
b24ea84b23e2 trying to fix the non-x86 IDCTs (untested)
michaelni
parents: 682
diff changeset
263
735
b4bf95260ffe 16x{8,16} {avg,put}_pixels support patch by (Juergen Keil <jk at tools dot de>)
michaelni
parents: 730
diff changeset
264 if(s->avctx->idct_algo==FF_IDCT_AUTO || s->avctx->idct_algo==FF_IDCT_MLIB){
1276
d5719a953ee0 * compile fixes by Mitch at Bits.COM
kabi
parents: 1064
diff changeset
265 s->dsp.idct_put= ff_idct_put_mlib;
d5719a953ee0 * compile fixes by Mitch at Bits.COM
kabi
parents: 1064
diff changeset
266 s->dsp.idct_add= ff_idct_add_mlib;
d5719a953ee0 * compile fixes by Mitch at Bits.COM
kabi
parents: 1064
diff changeset
267 s->dsp.idct_permutation_type= FF_NO_IDCT_PERM;
730
b24ea84b23e2 trying to fix the non-x86 IDCTs (untested)
michaelni
parents: 682
diff changeset
268 }
628
f596db4aa871 sun solaris compilation bugfix, patch by (Martin Olschewski <olschewski at zpr dot uni-koeln dot de>)
michaelni
parents: 429
diff changeset
269 }