Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
ea031b75
Commit
ea031b75
authored
Apr 09, 2015
by
Vittorio Giovara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hqx: Move DSP related code to a separate file
parent
17aa81d9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
207 additions
and
137 deletions
+207
-137
Makefile
libavcodec/Makefile
+1
-1
hqx.c
libavcodec/hqx.c
+33
-136
hqx.h
libavcodec/hqx.h
+3
-0
hqxdsp.c
libavcodec/hqxdsp.c
+131
-0
hqxdsp.h
libavcodec/hqxdsp.h
+39
-0
No files found.
libavcodec/Makefile
View file @
ea031b75
...
...
@@ -232,7 +232,7 @@ OBJS-$(CONFIG_HEVC_DECODER) += hevc.o hevc_mvs.o hevc_ps.o hevc_sei.o
hevc_cabac.o
hevc_refs.o
hevcpred.o
\
hevcdsp.o
hevc_filter.o
OBJS-$(CONFIG_HNM4_VIDEO_DECODER)
+=
hnm4video.o
OBJS-$(CONFIG_HQX_DECODER)
+=
hqx.o
hqxvlc.o
OBJS-$(CONFIG_HQX_DECODER)
+=
hqx.o
hqxvlc.o
hqxdsp.o
OBJS-$(CONFIG_HUFFYUV_DECODER)
+=
huffyuv.o
huffyuvdec.o
OBJS-$(CONFIG_HUFFYUV_ENCODER)
+=
huffyuv.o
huffyuvenc.o
OBJS-$(CONFIG_IDCIN_DECODER)
+=
idcinvideo.o
...
...
libavcodec/hqx.c
View file @
ea031b75
...
...
@@ -28,6 +28,7 @@
#include "internal.h"
#include "hqx.h"
#include "hqxdsp.h"
/* HQX has four modes - 422, 444, 422alpha and 444alpha - all 12-bit */
enum
HQXFormat
{
...
...
@@ -81,115 +82,7 @@ static const uint8_t hqx_quant_chroma[64] = {
44
,
91
,
96
,
197
,
203
,
209
,
232
,
246
,
};
static
inline
void
idct_col
(
int16_t
*
blk
,
const
uint8_t
*
quant
)
{
int
t0
,
t1
,
t2
,
t3
,
t4
,
t5
,
t6
,
t7
,
t8
,
t9
,
tA
,
tB
,
tC
,
tD
,
tE
,
tF
;
int
t10
,
t11
,
t12
,
t13
;
int
s0
,
s1
,
s2
,
s3
,
s4
,
s5
,
s6
,
s7
;
s0
=
(
int
)
blk
[
0
*
8
]
*
quant
[
0
*
8
];
s1
=
(
int
)
blk
[
1
*
8
]
*
quant
[
1
*
8
];
s2
=
(
int
)
blk
[
2
*
8
]
*
quant
[
2
*
8
];
s3
=
(
int
)
blk
[
3
*
8
]
*
quant
[
3
*
8
];
s4
=
(
int
)
blk
[
4
*
8
]
*
quant
[
4
*
8
];
s5
=
(
int
)
blk
[
5
*
8
]
*
quant
[
5
*
8
];
s6
=
(
int
)
blk
[
6
*
8
]
*
quant
[
6
*
8
];
s7
=
(
int
)
blk
[
7
*
8
]
*
quant
[
7
*
8
];
t0
=
(
s3
*
19266
+
s5
*
12873
)
>>
15
;
t1
=
(
s5
*
19266
-
s3
*
12873
)
>>
15
;
t2
=
((
s7
*
4520
+
s1
*
22725
)
>>
15
)
-
t0
;
t3
=
((
s1
*
4520
-
s7
*
22725
)
>>
15
)
-
t1
;
t4
=
t0
*
2
+
t2
;
t5
=
t1
*
2
+
t3
;
t6
=
t2
-
t3
;
t7
=
t3
*
2
+
t6
;
t8
=
(
t6
*
11585
)
>>
14
;
t9
=
(
t7
*
11585
)
>>
14
;
tA
=
(
s2
*
8867
-
s6
*
21407
)
>>
14
;
tB
=
(
s6
*
8867
+
s2
*
21407
)
>>
14
;
tC
=
(
s0
>>
1
)
-
(
s4
>>
1
);
tD
=
(
s4
>>
1
)
*
2
+
tC
;
tE
=
tC
-
(
tA
>>
1
);
tF
=
tD
-
(
tB
>>
1
);
t10
=
tF
-
t5
;
t11
=
tE
-
t8
;
t12
=
tE
+
(
tA
>>
1
)
*
2
-
t9
;
t13
=
tF
+
(
tB
>>
1
)
*
2
-
t4
;
blk
[
0
*
8
]
=
t13
+
t4
*
2
;
blk
[
1
*
8
]
=
t12
+
t9
*
2
;
blk
[
2
*
8
]
=
t11
+
t8
*
2
;
blk
[
3
*
8
]
=
t10
+
t5
*
2
;
blk
[
4
*
8
]
=
t10
;
blk
[
5
*
8
]
=
t11
;
blk
[
6
*
8
]
=
t12
;
blk
[
7
*
8
]
=
t13
;
}
static
inline
void
idct_row
(
int16_t
*
blk
)
{
int
t0
,
t1
,
t2
,
t3
,
t4
,
t5
,
t6
,
t7
,
t8
,
t9
,
tA
,
tB
,
tC
,
tD
,
tE
,
tF
;
int
t10
,
t11
,
t12
,
t13
;
t0
=
(
blk
[
3
]
*
19266
+
blk
[
5
]
*
12873
)
>>
14
;
t1
=
(
blk
[
5
]
*
19266
-
blk
[
3
]
*
12873
)
>>
14
;
t2
=
((
blk
[
7
]
*
4520
+
blk
[
1
]
*
22725
)
>>
14
)
-
t0
;
t3
=
((
blk
[
1
]
*
4520
-
blk
[
7
]
*
22725
)
>>
14
)
-
t1
;
t4
=
t0
*
2
+
t2
;
t5
=
t1
*
2
+
t3
;
t6
=
t2
-
t3
;
t7
=
t3
*
2
+
t6
;
t8
=
(
t6
*
11585
)
>>
14
;
t9
=
(
t7
*
11585
)
>>
14
;
tA
=
(
blk
[
2
]
*
8867
-
blk
[
6
]
*
21407
)
>>
14
;
tB
=
(
blk
[
6
]
*
8867
+
blk
[
2
]
*
21407
)
>>
14
;
tC
=
blk
[
0
]
-
blk
[
4
];
tD
=
blk
[
4
]
*
2
+
tC
;
tE
=
tC
-
tA
;
tF
=
tD
-
tB
;
t10
=
tF
-
t5
;
t11
=
tE
-
t8
;
t12
=
tE
+
tA
*
2
-
t9
;
t13
=
tF
+
tB
*
2
-
t4
;
blk
[
0
]
=
(
t13
+
t4
*
2
+
4
)
>>
3
;
blk
[
1
]
=
(
t12
+
t9
*
2
+
4
)
>>
3
;
blk
[
2
]
=
(
t11
+
t8
*
2
+
4
)
>>
3
;
blk
[
3
]
=
(
t10
+
t5
*
2
+
4
)
>>
3
;
blk
[
4
]
=
(
t10
+
4
)
>>
3
;
blk
[
5
]
=
(
t11
+
4
)
>>
3
;
blk
[
6
]
=
(
t12
+
4
)
>>
3
;
blk
[
7
]
=
(
t13
+
4
)
>>
3
;
}
static
void
hqx_idct
(
int16_t
*
block
,
const
uint8_t
*
quant
)
{
int
i
;
for
(
i
=
0
;
i
<
8
;
i
++
)
idct_col
(
block
+
i
,
quant
+
i
);
for
(
i
=
0
;
i
<
8
;
i
++
)
idct_row
(
block
+
i
*
8
);
}
static
void
hqx_idct_put
(
uint16_t
*
dst
,
ptrdiff_t
stride
,
int16_t
*
block
,
const
uint8_t
*
quant
)
{
int
i
,
j
;
hqx_idct
(
block
,
quant
);
for
(
i
=
0
;
i
<
8
;
i
++
)
{
for
(
j
=
0
;
j
<
8
;
j
++
)
{
int
v
=
av_clip
(
block
[
j
+
i
*
8
]
+
0x800
,
0
,
0xFFF
);
dst
[
j
]
=
(
v
<<
4
)
|
(
v
>>
8
);
}
dst
+=
stride
>>
1
;
}
}
static
inline
void
put_blocks
(
AVFrame
*
pic
,
int
plane
,
static
inline
void
put_blocks
(
HQXContext
*
ctx
,
AVFrame
*
pic
,
int
plane
,
int
x
,
int
y
,
int
ilace
,
int16_t
*
block0
,
int16_t
*
block1
,
const
uint8_t
*
quant
)
...
...
@@ -198,9 +91,10 @@ static inline void put_blocks(AVFrame *pic, int plane,
int
lsize
=
pic
->
linesize
[
plane
];
uint8_t
*
p
=
pic
->
data
[
plane
]
+
x
*
2
;
hqx_idct_put
((
uint16_t
*
)(
p
+
y
*
lsize
),
lsize
*
fields
,
block0
,
quant
);
hqx_idct_put
((
uint16_t
*
)(
p
+
(
y
+
(
ilace
?
1
:
8
))
*
lsize
),
lsize
*
fields
,
block1
,
quant
);
ctx
->
hqxdsp
.
idct_put
((
uint16_t
*
)(
p
+
y
*
lsize
),
lsize
*
fields
,
block0
,
quant
);
ctx
->
hqxdsp
.
idct_put
((
uint16_t
*
)(
p
+
(
y
+
(
ilace
?
1
:
8
))
*
lsize
),
lsize
*
fields
,
block1
,
quant
);
}
static
inline
void
hqx_get_ac
(
GetBitContext
*
gb
,
const
HQXAC
*
ac
,
...
...
@@ -285,10 +179,10 @@ static int hqx_decode_422(HQXContext *ctx, AVFrame *pic,
return
ret
;
}
put_blocks
(
pic
,
0
,
x
,
y
,
flag
,
ctx
->
block
[
0
],
ctx
->
block
[
2
],
hqx_quant_luma
);
put_blocks
(
pic
,
0
,
x
+
8
,
y
,
flag
,
ctx
->
block
[
1
],
ctx
->
block
[
3
],
hqx_quant_luma
);
put_blocks
(
pic
,
2
,
x
>>
1
,
y
,
flag
,
ctx
->
block
[
4
],
ctx
->
block
[
5
],
hqx_quant_chroma
);
put_blocks
(
pic
,
1
,
x
>>
1
,
y
,
flag
,
ctx
->
block
[
6
],
ctx
->
block
[
7
],
hqx_quant_chroma
);
put_blocks
(
ctx
,
pic
,
0
,
x
,
y
,
flag
,
ctx
->
block
[
0
],
ctx
->
block
[
2
],
hqx_quant_luma
);
put_blocks
(
ctx
,
pic
,
0
,
x
+
8
,
y
,
flag
,
ctx
->
block
[
1
],
ctx
->
block
[
3
],
hqx_quant_luma
);
put_blocks
(
ctx
,
pic
,
2
,
x
>>
1
,
y
,
flag
,
ctx
->
block
[
4
],
ctx
->
block
[
5
],
hqx_quant_chroma
);
put_blocks
(
ctx
,
pic
,
1
,
x
>>
1
,
y
,
flag
,
ctx
->
block
[
6
],
ctx
->
block
[
7
],
hqx_quant_chroma
);
return
0
;
}
...
...
@@ -332,12 +226,12 @@ static int hqx_decode_422a(HQXContext *ctx, AVFrame *pic,
}
}
put_blocks
(
pic
,
3
,
x
,
y
,
flag
,
ctx
->
block
[
0
],
ctx
->
block
[
2
],
hqx_quant_luma
);
put_blocks
(
pic
,
3
,
x
+
8
,
y
,
flag
,
ctx
->
block
[
1
],
ctx
->
block
[
3
],
hqx_quant_luma
);
put_blocks
(
pic
,
0
,
x
,
y
,
flag
,
ctx
->
block
[
4
],
ctx
->
block
[
6
],
hqx_quant_luma
);
put_blocks
(
pic
,
0
,
x
+
8
,
y
,
flag
,
ctx
->
block
[
5
],
ctx
->
block
[
7
],
hqx_quant_luma
);
put_blocks
(
pic
,
2
,
x
>>
1
,
y
,
flag
,
ctx
->
block
[
8
],
ctx
->
block
[
9
],
hqx_quant_chroma
);
put_blocks
(
pic
,
1
,
x
>>
1
,
y
,
flag
,
ctx
->
block
[
10
],
ctx
->
block
[
11
],
hqx_quant_chroma
);
put_blocks
(
ctx
,
pic
,
3
,
x
,
y
,
flag
,
ctx
->
block
[
0
],
ctx
->
block
[
2
],
hqx_quant_luma
);
put_blocks
(
ctx
,
pic
,
3
,
x
+
8
,
y
,
flag
,
ctx
->
block
[
1
],
ctx
->
block
[
3
],
hqx_quant_luma
);
put_blocks
(
ctx
,
pic
,
0
,
x
,
y
,
flag
,
ctx
->
block
[
4
],
ctx
->
block
[
6
],
hqx_quant_luma
);
put_blocks
(
ctx
,
pic
,
0
,
x
+
8
,
y
,
flag
,
ctx
->
block
[
5
],
ctx
->
block
[
7
],
hqx_quant_luma
);
put_blocks
(
ctx
,
pic
,
2
,
x
>>
1
,
y
,
flag
,
ctx
->
block
[
8
],
ctx
->
block
[
9
],
hqx_quant_chroma
);
put_blocks
(
ctx
,
pic
,
1
,
x
>>
1
,
y
,
flag
,
ctx
->
block
[
10
],
ctx
->
block
[
11
],
hqx_quant_chroma
);
return
0
;
}
...
...
@@ -367,12 +261,12 @@ static int hqx_decode_444(HQXContext *ctx, AVFrame *pic,
return
ret
;
}
put_blocks
(
pic
,
0
,
x
,
y
,
flag
,
ctx
->
block
[
0
],
ctx
->
block
[
2
],
hqx_quant_luma
);
put_blocks
(
pic
,
0
,
x
+
8
,
y
,
flag
,
ctx
->
block
[
1
],
ctx
->
block
[
3
],
hqx_quant_luma
);
put_blocks
(
pic
,
2
,
x
,
y
,
flag
,
ctx
->
block
[
4
],
ctx
->
block
[
6
],
hqx_quant_chroma
);
put_blocks
(
pic
,
2
,
x
+
8
,
y
,
flag
,
ctx
->
block
[
5
],
ctx
->
block
[
7
],
hqx_quant_chroma
);
put_blocks
(
pic
,
1
,
x
,
y
,
flag
,
ctx
->
block
[
8
],
ctx
->
block
[
10
],
hqx_quant_chroma
);
put_blocks
(
pic
,
1
,
x
+
8
,
y
,
flag
,
ctx
->
block
[
9
],
ctx
->
block
[
11
],
hqx_quant_chroma
);
put_blocks
(
ctx
,
pic
,
0
,
x
,
y
,
flag
,
ctx
->
block
[
0
],
ctx
->
block
[
2
],
hqx_quant_luma
);
put_blocks
(
ctx
,
pic
,
0
,
x
+
8
,
y
,
flag
,
ctx
->
block
[
1
],
ctx
->
block
[
3
],
hqx_quant_luma
);
put_blocks
(
ctx
,
pic
,
2
,
x
,
y
,
flag
,
ctx
->
block
[
4
],
ctx
->
block
[
6
],
hqx_quant_chroma
);
put_blocks
(
ctx
,
pic
,
2
,
x
+
8
,
y
,
flag
,
ctx
->
block
[
5
],
ctx
->
block
[
7
],
hqx_quant_chroma
);
put_blocks
(
ctx
,
pic
,
1
,
x
,
y
,
flag
,
ctx
->
block
[
8
],
ctx
->
block
[
10
],
hqx_quant_chroma
);
put_blocks
(
ctx
,
pic
,
1
,
x
+
8
,
y
,
flag
,
ctx
->
block
[
9
],
ctx
->
block
[
11
],
hqx_quant_chroma
);
return
0
;
}
...
...
@@ -413,14 +307,14 @@ static int hqx_decode_444a(HQXContext *ctx, AVFrame *pic,
}
}
put_blocks
(
pic
,
3
,
x
,
y
,
flag
,
ctx
->
block
[
0
],
ctx
->
block
[
2
],
hqx_quant_luma
);
put_blocks
(
pic
,
3
,
x
+
8
,
y
,
flag
,
ctx
->
block
[
1
],
ctx
->
block
[
3
],
hqx_quant_luma
);
put_blocks
(
pic
,
0
,
x
,
y
,
flag
,
ctx
->
block
[
4
],
ctx
->
block
[
6
],
hqx_quant_luma
);
put_blocks
(
pic
,
0
,
x
+
8
,
y
,
flag
,
ctx
->
block
[
5
],
ctx
->
block
[
7
],
hqx_quant_luma
);
put_blocks
(
pic
,
2
,
x
,
y
,
flag
,
ctx
->
block
[
8
],
ctx
->
block
[
10
],
hqx_quant_chroma
);
put_blocks
(
pic
,
2
,
x
+
8
,
y
,
flag
,
ctx
->
block
[
9
],
ctx
->
block
[
11
],
hqx_quant_chroma
);
put_blocks
(
pic
,
1
,
x
,
y
,
flag
,
ctx
->
block
[
12
],
ctx
->
block
[
14
],
hqx_quant_chroma
);
put_blocks
(
pic
,
1
,
x
+
8
,
y
,
flag
,
ctx
->
block
[
13
],
ctx
->
block
[
15
],
hqx_quant_chroma
);
put_blocks
(
ctx
,
pic
,
3
,
x
,
y
,
flag
,
ctx
->
block
[
0
],
ctx
->
block
[
2
],
hqx_quant_luma
);
put_blocks
(
ctx
,
pic
,
3
,
x
+
8
,
y
,
flag
,
ctx
->
block
[
1
],
ctx
->
block
[
3
],
hqx_quant_luma
);
put_blocks
(
ctx
,
pic
,
0
,
x
,
y
,
flag
,
ctx
->
block
[
4
],
ctx
->
block
[
6
],
hqx_quant_luma
);
put_blocks
(
ctx
,
pic
,
0
,
x
+
8
,
y
,
flag
,
ctx
->
block
[
5
],
ctx
->
block
[
7
],
hqx_quant_luma
);
put_blocks
(
ctx
,
pic
,
2
,
x
,
y
,
flag
,
ctx
->
block
[
8
],
ctx
->
block
[
10
],
hqx_quant_chroma
);
put_blocks
(
ctx
,
pic
,
2
,
x
+
8
,
y
,
flag
,
ctx
->
block
[
9
],
ctx
->
block
[
11
],
hqx_quant_chroma
);
put_blocks
(
ctx
,
pic
,
1
,
x
,
y
,
flag
,
ctx
->
block
[
12
],
ctx
->
block
[
14
],
hqx_quant_chroma
);
put_blocks
(
ctx
,
pic
,
1
,
x
+
8
,
y
,
flag
,
ctx
->
block
[
13
],
ctx
->
block
[
15
],
hqx_quant_chroma
);
return
0
;
}
...
...
@@ -628,6 +522,9 @@ static av_cold int hqx_decode_init(AVCodecContext *avctx)
int
ret
=
ff_hqx_init_vlcs
(
ctx
);
if
(
ret
<
0
)
hqx_decode_close
(
avctx
);
ff_hqxdsp_init
(
&
ctx
->
hqxdsp
);
return
ret
;
}
...
...
libavcodec/hqx.h
View file @
ea031b75
...
...
@@ -24,6 +24,7 @@
#include <stdint.h>
#include "libavutil/mem.h"
#include "get_bits.h"
#include "hqxdsp.h"
enum
HQXACMode
{
HQX_AC_Q0
=
0
,
...
...
@@ -47,6 +48,8 @@ typedef struct HQXAC {
}
HQXAC
;
typedef
struct
HQXContext
{
HQXDSPContext
hqxdsp
;
int
format
,
dcb
,
width
,
height
;
int
interlaced
;
...
...
libavcodec/hqxdsp.c
0 → 100644
View file @
ea031b75
/*
* HQX DSP routines
*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdint.h>
#include "libavutil/common.h"
#include "hqxdsp.h"
static
inline
void
idct_col
(
int16_t
*
blk
,
const
uint8_t
*
quant
)
{
int
t0
,
t1
,
t2
,
t3
,
t4
,
t5
,
t6
,
t7
,
t8
,
t9
,
tA
,
tB
,
tC
,
tD
,
tE
,
tF
;
int
t10
,
t11
,
t12
,
t13
;
int
s0
,
s1
,
s2
,
s3
,
s4
,
s5
,
s6
,
s7
;
s0
=
(
int
)
blk
[
0
*
8
]
*
quant
[
0
*
8
];
s1
=
(
int
)
blk
[
1
*
8
]
*
quant
[
1
*
8
];
s2
=
(
int
)
blk
[
2
*
8
]
*
quant
[
2
*
8
];
s3
=
(
int
)
blk
[
3
*
8
]
*
quant
[
3
*
8
];
s4
=
(
int
)
blk
[
4
*
8
]
*
quant
[
4
*
8
];
s5
=
(
int
)
blk
[
5
*
8
]
*
quant
[
5
*
8
];
s6
=
(
int
)
blk
[
6
*
8
]
*
quant
[
6
*
8
];
s7
=
(
int
)
blk
[
7
*
8
]
*
quant
[
7
*
8
];
t0
=
(
s3
*
19266
+
s5
*
12873
)
>>
15
;
t1
=
(
s5
*
19266
-
s3
*
12873
)
>>
15
;
t2
=
((
s7
*
4520
+
s1
*
22725
)
>>
15
)
-
t0
;
t3
=
((
s1
*
4520
-
s7
*
22725
)
>>
15
)
-
t1
;
t4
=
t0
*
2
+
t2
;
t5
=
t1
*
2
+
t3
;
t6
=
t2
-
t3
;
t7
=
t3
*
2
+
t6
;
t8
=
(
t6
*
11585
)
>>
14
;
t9
=
(
t7
*
11585
)
>>
14
;
tA
=
(
s2
*
8867
-
s6
*
21407
)
>>
14
;
tB
=
(
s6
*
8867
+
s2
*
21407
)
>>
14
;
tC
=
(
s0
>>
1
)
-
(
s4
>>
1
);
tD
=
(
s4
>>
1
)
*
2
+
tC
;
tE
=
tC
-
(
tA
>>
1
);
tF
=
tD
-
(
tB
>>
1
);
t10
=
tF
-
t5
;
t11
=
tE
-
t8
;
t12
=
tE
+
(
tA
>>
1
)
*
2
-
t9
;
t13
=
tF
+
(
tB
>>
1
)
*
2
-
t4
;
blk
[
0
*
8
]
=
t13
+
t4
*
2
;
blk
[
1
*
8
]
=
t12
+
t9
*
2
;
blk
[
2
*
8
]
=
t11
+
t8
*
2
;
blk
[
3
*
8
]
=
t10
+
t5
*
2
;
blk
[
4
*
8
]
=
t10
;
blk
[
5
*
8
]
=
t11
;
blk
[
6
*
8
]
=
t12
;
blk
[
7
*
8
]
=
t13
;
}
static
inline
void
idct_row
(
int16_t
*
blk
)
{
int
t0
,
t1
,
t2
,
t3
,
t4
,
t5
,
t6
,
t7
,
t8
,
t9
,
tA
,
tB
,
tC
,
tD
,
tE
,
tF
;
int
t10
,
t11
,
t12
,
t13
;
t0
=
(
blk
[
3
]
*
19266
+
blk
[
5
]
*
12873
)
>>
14
;
t1
=
(
blk
[
5
]
*
19266
-
blk
[
3
]
*
12873
)
>>
14
;
t2
=
((
blk
[
7
]
*
4520
+
blk
[
1
]
*
22725
)
>>
14
)
-
t0
;
t3
=
((
blk
[
1
]
*
4520
-
blk
[
7
]
*
22725
)
>>
14
)
-
t1
;
t4
=
t0
*
2
+
t2
;
t5
=
t1
*
2
+
t3
;
t6
=
t2
-
t3
;
t7
=
t3
*
2
+
t6
;
t8
=
(
t6
*
11585
)
>>
14
;
t9
=
(
t7
*
11585
)
>>
14
;
tA
=
(
blk
[
2
]
*
8867
-
blk
[
6
]
*
21407
)
>>
14
;
tB
=
(
blk
[
6
]
*
8867
+
blk
[
2
]
*
21407
)
>>
14
;
tC
=
blk
[
0
]
-
blk
[
4
];
tD
=
blk
[
4
]
*
2
+
tC
;
tE
=
tC
-
tA
;
tF
=
tD
-
tB
;
t10
=
tF
-
t5
;
t11
=
tE
-
t8
;
t12
=
tE
+
tA
*
2
-
t9
;
t13
=
tF
+
tB
*
2
-
t4
;
blk
[
0
]
=
(
t13
+
t4
*
2
+
4
)
>>
3
;
blk
[
1
]
=
(
t12
+
t9
*
2
+
4
)
>>
3
;
blk
[
2
]
=
(
t11
+
t8
*
2
+
4
)
>>
3
;
blk
[
3
]
=
(
t10
+
t5
*
2
+
4
)
>>
3
;
blk
[
4
]
=
(
t10
+
4
)
>>
3
;
blk
[
5
]
=
(
t11
+
4
)
>>
3
;
blk
[
6
]
=
(
t12
+
4
)
>>
3
;
blk
[
7
]
=
(
t13
+
4
)
>>
3
;
}
static
void
hqx_idct_put
(
uint16_t
*
dst
,
ptrdiff_t
stride
,
int16_t
*
block
,
const
uint8_t
*
quant
)
{
int
i
,
j
;
for
(
i
=
0
;
i
<
8
;
i
++
)
idct_col
(
block
+
i
,
quant
+
i
);
for
(
i
=
0
;
i
<
8
;
i
++
)
idct_row
(
block
+
i
*
8
);
for
(
i
=
0
;
i
<
8
;
i
++
)
{
for
(
j
=
0
;
j
<
8
;
j
++
)
{
int
v
=
av_clip
(
block
[
j
+
i
*
8
]
+
0x800
,
0
,
0xFFF
);
dst
[
j
]
=
(
v
<<
4
)
|
(
v
>>
8
);
}
dst
+=
stride
>>
1
;
}
}
av_cold
void
ff_hqxdsp_init
(
HQXDSPContext
*
c
)
{
c
->
idct_put
=
hqx_idct_put
;
}
libavcodec/hqxdsp.h
0 → 100644
View file @
ea031b75
/*
* HQX DSP routines
*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* HQX DSP routines
*/
#ifndef AVCODEC_HQXDSP_H
#define AVCODEC_HQXDSP_H
#include <stdint.h>
typedef
struct
HQXDSPContext
{
void
(
*
idct_put
)(
uint16_t
*
dst
,
ptrdiff_t
stride
,
int16_t
*
block
,
const
uint8_t
*
quant
);
}
HQXDSPContext
;
void
ff_hqxdsp_init
(
HQXDSPContext
*
c
);
#endif
/* AVCODEC_HQXDSP_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment