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
1bca8f4b
Commit
1bca8f4b
authored
Sep 24, 2011
by
Janne Grunau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rv34: move inverse transform functions to DSP context
parent
cad0c375
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
121 additions
and
81 deletions
+121
-81
Makefile
libavcodec/Makefile
+2
-2
rv30dsp.c
libavcodec/rv30dsp.c
+3
-0
rv34.c
libavcodec/rv34.c
+3
-79
rv34dsp.c
libavcodec/rv34dsp.c
+106
-0
rv34dsp.h
libavcodec/rv34dsp.h
+4
-0
rv40dsp.c
libavcodec/rv40dsp.c
+3
-0
No files found.
libavcodec/Makefile
View file @
1bca8f4b
...
...
@@ -324,9 +324,9 @@ OBJS-$(CONFIG_RV10_DECODER) += rv10.o
OBJS-$(CONFIG_RV10_ENCODER)
+=
rv10enc.o
OBJS-$(CONFIG_RV20_DECODER)
+=
rv10.o
OBJS-$(CONFIG_RV20_ENCODER)
+=
rv20enc.o
OBJS-$(CONFIG_RV30_DECODER)
+=
rv30.o
rv34.o
rv30dsp.o
\
OBJS-$(CONFIG_RV30_DECODER)
+=
rv30.o
rv34.o
rv30dsp.o
rv34dsp.o
\
mpegvideo.o
error_resilience.o
OBJS-$(CONFIG_RV40_DECODER)
+=
rv40.o
rv34.o
rv
40dsp.o
\
OBJS-$(CONFIG_RV40_DECODER)
+=
rv40.o
rv34.o
rv
34dsp.o
rv40dsp.o
\
mpegvideo.o
error_resilience.o
OBJS-$(CONFIG_S302M_DECODER)
+=
s302m.o
OBJS-$(CONFIG_SGI_DECODER)
+=
sgidec.o
...
...
libavcodec/rv30dsp.c
View file @
1bca8f4b
...
...
@@ -253,6 +253,9 @@ RV30_MC(avg_, 8)
RV30_MC
(
avg_
,
16
)
av_cold
void
ff_rv30dsp_init
(
RV34DSPContext
*
c
,
DSPContext
*
dsp
)
{
ff_rv34dsp_init
(
c
,
dsp
);
c
->
put_pixels_tab
[
0
][
0
]
=
dsp
->
put_h264_qpel_pixels_tab
[
0
][
0
];
c
->
put_pixels_tab
[
0
][
1
]
=
put_rv30_tpel16_mc10_c
;
c
->
put_pixels_tab
[
0
][
2
]
=
put_rv30_tpel16_mc20_c
;
...
...
libavcodec/rv34.c
View file @
1bca8f4b
...
...
@@ -171,82 +171,6 @@ static av_cold void rv34_init_tables(void)
/** @} */
// vlc group
/**
* @name RV30/40 inverse transform functions
* @{
*/
static
av_always_inline
void
rv34_row_transform
(
int
temp
[
16
],
DCTELEM
*
block
)
{
int
i
;
for
(
i
=
0
;
i
<
4
;
i
++
){
const
int
z0
=
13
*
(
block
[
i
+
8
*
0
]
+
block
[
i
+
8
*
2
]);
const
int
z1
=
13
*
(
block
[
i
+
8
*
0
]
-
block
[
i
+
8
*
2
]);
const
int
z2
=
7
*
block
[
i
+
8
*
1
]
-
17
*
block
[
i
+
8
*
3
];
const
int
z3
=
17
*
block
[
i
+
8
*
1
]
+
7
*
block
[
i
+
8
*
3
];
temp
[
4
*
i
+
0
]
=
z0
+
z3
;
temp
[
4
*
i
+
1
]
=
z1
+
z2
;
temp
[
4
*
i
+
2
]
=
z1
-
z2
;
temp
[
4
*
i
+
3
]
=
z0
-
z3
;
}
}
/**
* Real Video 3.0/4.0 inverse transform
* Code is almost the same as in SVQ3, only scaling is different.
*/
static
void
rv34_inv_transform
(
DCTELEM
*
block
){
int
temp
[
16
];
int
i
;
rv34_row_transform
(
temp
,
block
);
for
(
i
=
0
;
i
<
4
;
i
++
){
const
int
z0
=
13
*
(
temp
[
4
*
0
+
i
]
+
temp
[
4
*
2
+
i
])
+
0x200
;
const
int
z1
=
13
*
(
temp
[
4
*
0
+
i
]
-
temp
[
4
*
2
+
i
])
+
0x200
;
const
int
z2
=
7
*
temp
[
4
*
1
+
i
]
-
17
*
temp
[
4
*
3
+
i
];
const
int
z3
=
17
*
temp
[
4
*
1
+
i
]
+
7
*
temp
[
4
*
3
+
i
];
block
[
i
*
8
+
0
]
=
(
z0
+
z3
)
>>
10
;
block
[
i
*
8
+
1
]
=
(
z1
+
z2
)
>>
10
;
block
[
i
*
8
+
2
]
=
(
z1
-
z2
)
>>
10
;
block
[
i
*
8
+
3
]
=
(
z0
-
z3
)
>>
10
;
}
}
/**
* RealVideo 3.0/4.0 inverse transform for DC block
*
* Code is almost the same as rv34_inv_transform()
* but final coefficients are multiplied by 1.5 and have no rounding.
*/
static
void
rv34_inv_transform_noround
(
DCTELEM
*
block
){
int
temp
[
16
];
int
i
;
rv34_row_transform
(
temp
,
block
);
for
(
i
=
0
;
i
<
4
;
i
++
){
const
int
z0
=
13
*
(
temp
[
4
*
0
+
i
]
+
temp
[
4
*
2
+
i
]);
const
int
z1
=
13
*
(
temp
[
4
*
0
+
i
]
-
temp
[
4
*
2
+
i
]);
const
int
z2
=
7
*
temp
[
4
*
1
+
i
]
-
17
*
temp
[
4
*
3
+
i
];
const
int
z3
=
17
*
temp
[
4
*
1
+
i
]
+
7
*
temp
[
4
*
3
+
i
];
block
[
i
*
8
+
0
]
=
((
z0
+
z3
)
*
3
)
>>
11
;
block
[
i
*
8
+
1
]
=
((
z1
+
z2
)
*
3
)
>>
11
;
block
[
i
*
8
+
2
]
=
((
z1
-
z2
)
*
3
)
>>
11
;
block
[
i
*
8
+
3
]
=
((
z0
-
z3
)
*
3
)
>>
11
;
}
}
/** @} */
// transform
/**
* @name RV30/40 4x4 block decoding functions
* @{
...
...
@@ -1226,7 +1150,7 @@ static int rv34_decode_macroblock(RV34DecContext *r, int8_t *intra_types)
memset
(
block16
,
0
,
sizeof
(
block16
));
rv34_decode_block
(
block16
,
gb
,
r
->
cur_vlcs
,
3
,
0
);
rv34_dequant4x4_16x16
(
block16
,
rv34_qscale_tab
[
luma_dc_quant
],
rv34_qscale_tab
[
s
->
qscale
]);
r
v34_inv_transform_noround
(
block16
);
r
->
rdsp
.
rv34_inv_transform_tab
[
1
]
(
block16
);
}
for
(
i
=
0
;
i
<
16
;
i
++
,
cbp
>>=
1
){
...
...
@@ -1238,7 +1162,7 @@ static int rv34_decode_macroblock(RV34DecContext *r, int8_t *intra_types)
rv34_dequant4x4
(
s
->
block
[
blknum
]
+
blkoff
,
rv34_qscale_tab
[
s
->
qscale
],
rv34_qscale_tab
[
s
->
qscale
]);
if
(
r
->
is16
)
//FIXME: optimize
s
->
block
[
blknum
][
blkoff
]
=
block16
[(
i
&
3
)
|
((
i
&
0xC
)
<<
1
)];
r
v34_inv_transform
(
s
->
block
[
blknum
]
+
blkoff
);
r
->
rdsp
.
rv34_inv_transform_tab
[
0
]
(
s
->
block
[
blknum
]
+
blkoff
);
}
if
(
r
->
block_type
==
RV34_MB_P_MIX16x16
)
r
->
cur_vlcs
=
choose_vlc_set
(
r
->
si
.
quant
,
r
->
si
.
vlc_set
,
1
);
...
...
@@ -1248,7 +1172,7 @@ static int rv34_decode_macroblock(RV34DecContext *r, int8_t *intra_types)
blkoff
=
((
i
&
1
)
<<
2
)
+
((
i
&
2
)
<<
4
);
rv34_decode_block
(
s
->
block
[
blknum
]
+
blkoff
,
gb
,
r
->
cur_vlcs
,
r
->
chroma_vlc
,
1
);
rv34_dequant4x4
(
s
->
block
[
blknum
]
+
blkoff
,
rv34_qscale_tab
[
rv34_chroma_quant
[
1
][
s
->
qscale
]],
rv34_qscale_tab
[
rv34_chroma_quant
[
0
][
s
->
qscale
]]);
r
v34_inv_transform
(
s
->
block
[
blknum
]
+
blkoff
);
r
->
rdsp
.
rv34_inv_transform_tab
[
0
]
(
s
->
block
[
blknum
]
+
blkoff
);
}
if
(
IS_INTRA
(
s
->
current_picture_ptr
->
f
.
mb_type
[
mb_pos
]))
rv34_output_macroblock
(
r
,
intra_types
,
cbp2
,
r
->
is16
);
...
...
libavcodec/rv34dsp.c
0 → 100644
View file @
1bca8f4b
/*
* RV30/40 decoder common dsp functions
* Copyright (c) 2007 Mike Melanson, Konstantin Shishkov
* Copyright (c) 2011 Janne Grunau
*
* 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
* RV30/40 decoder common dsp functions
*/
#include "dsputil.h"
#include "rv34dsp.h"
/**
* @name RV30/40 inverse transform functions
* @{
*/
static
av_always_inline
void
rv34_row_transform
(
int
temp
[
16
],
DCTELEM
*
block
)
{
int
i
;
for
(
i
=
0
;
i
<
4
;
i
++
){
const
int
z0
=
13
*
(
block
[
i
+
8
*
0
]
+
block
[
i
+
8
*
2
]);
const
int
z1
=
13
*
(
block
[
i
+
8
*
0
]
-
block
[
i
+
8
*
2
]);
const
int
z2
=
7
*
block
[
i
+
8
*
1
]
-
17
*
block
[
i
+
8
*
3
];
const
int
z3
=
17
*
block
[
i
+
8
*
1
]
+
7
*
block
[
i
+
8
*
3
];
temp
[
4
*
i
+
0
]
=
z0
+
z3
;
temp
[
4
*
i
+
1
]
=
z1
+
z2
;
temp
[
4
*
i
+
2
]
=
z1
-
z2
;
temp
[
4
*
i
+
3
]
=
z0
-
z3
;
}
}
/**
* Real Video 3.0/4.0 inverse transform
* Code is almost the same as in SVQ3, only scaling is different.
*/
static
void
rv34_inv_transform_c
(
DCTELEM
*
block
){
int
temp
[
16
];
int
i
;
rv34_row_transform
(
temp
,
block
);
for
(
i
=
0
;
i
<
4
;
i
++
){
const
int
z0
=
13
*
(
temp
[
4
*
0
+
i
]
+
temp
[
4
*
2
+
i
])
+
0x200
;
const
int
z1
=
13
*
(
temp
[
4
*
0
+
i
]
-
temp
[
4
*
2
+
i
])
+
0x200
;
const
int
z2
=
7
*
temp
[
4
*
1
+
i
]
-
17
*
temp
[
4
*
3
+
i
];
const
int
z3
=
17
*
temp
[
4
*
1
+
i
]
+
7
*
temp
[
4
*
3
+
i
];
block
[
i
*
8
+
0
]
=
(
z0
+
z3
)
>>
10
;
block
[
i
*
8
+
1
]
=
(
z1
+
z2
)
>>
10
;
block
[
i
*
8
+
2
]
=
(
z1
-
z2
)
>>
10
;
block
[
i
*
8
+
3
]
=
(
z0
-
z3
)
>>
10
;
}
}
/**
* RealVideo 3.0/4.0 inverse transform for DC block
*
* Code is almost the same as rv34_inv_transform()
* but final coefficients are multiplied by 1.5 and have no rounding.
*/
static
void
rv34_inv_transform_noround_c
(
DCTELEM
*
block
){
int
temp
[
16
];
int
i
;
rv34_row_transform
(
temp
,
block
);
for
(
i
=
0
;
i
<
4
;
i
++
){
const
int
z0
=
13
*
(
temp
[
4
*
0
+
i
]
+
temp
[
4
*
2
+
i
]);
const
int
z1
=
13
*
(
temp
[
4
*
0
+
i
]
-
temp
[
4
*
2
+
i
]);
const
int
z2
=
7
*
temp
[
4
*
1
+
i
]
-
17
*
temp
[
4
*
3
+
i
];
const
int
z3
=
17
*
temp
[
4
*
1
+
i
]
+
7
*
temp
[
4
*
3
+
i
];
block
[
i
*
8
+
0
]
=
((
z0
+
z3
)
*
3
)
>>
11
;
block
[
i
*
8
+
1
]
=
((
z1
+
z2
)
*
3
)
>>
11
;
block
[
i
*
8
+
2
]
=
((
z1
-
z2
)
*
3
)
>>
11
;
block
[
i
*
8
+
3
]
=
((
z0
-
z3
)
*
3
)
>>
11
;
}
}
/** @} */
// transform
av_cold
void
ff_rv34dsp_init
(
RV34DSPContext
*
c
,
DSPContext
*
dsp
)
{
c
->
rv34_inv_transform_tab
[
0
]
=
rv34_inv_transform_c
;
c
->
rv34_inv_transform_tab
[
1
]
=
rv34_inv_transform_noround_c
;
}
libavcodec/rv34dsp.h
View file @
1bca8f4b
...
...
@@ -34,15 +34,19 @@ typedef void (*rv40_weight_func)(uint8_t *dst/*align width (8 or 16)*/,
uint8_t
*
src2
/*align width (8 or 16)*/
,
int
w1
,
int
w2
,
int
stride
);
typedef
void
(
*
rv34_inv_transform_func
)(
DCTELEM
*
block
);
typedef
struct
RV34DSPContext
{
qpel_mc_func
put_pixels_tab
[
4
][
16
];
qpel_mc_func
avg_pixels_tab
[
4
][
16
];
h264_chroma_mc_func
put_chroma_pixels_tab
[
3
];
h264_chroma_mc_func
avg_chroma_pixels_tab
[
3
];
rv40_weight_func
rv40_weight_pixels_tab
[
2
];
rv34_inv_transform_func
rv34_inv_transform_tab
[
2
];
}
RV34DSPContext
;
void
ff_rv30dsp_init
(
RV34DSPContext
*
c
,
DSPContext
*
dsp
);
void
ff_rv34dsp_init
(
RV34DSPContext
*
c
,
DSPContext
*
dsp
);
void
ff_rv40dsp_init
(
RV34DSPContext
*
c
,
DSPContext
*
dsp
);
void
ff_rv40dsp_init_x86
(
RV34DSPContext
*
c
,
DSPContext
*
dsp
);
...
...
libavcodec/rv40dsp.c
View file @
1bca8f4b
...
...
@@ -295,6 +295,9 @@ RV40_WEIGHT_FUNC(16)
RV40_WEIGHT_FUNC
(
8
)
av_cold
void
ff_rv40dsp_init
(
RV34DSPContext
*
c
,
DSPContext
*
dsp
)
{
ff_rv34dsp_init
(
c
,
dsp
);
c
->
put_pixels_tab
[
0
][
0
]
=
dsp
->
put_h264_qpel_pixels_tab
[
0
][
0
];
c
->
put_pixels_tab
[
0
][
1
]
=
put_rv40_qpel16_mc10_c
;
c
->
put_pixels_tab
[
0
][
2
]
=
dsp
->
put_h264_qpel_pixels_tab
[
0
][
2
];
...
...
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