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
0ef1dbed
Commit
0ef1dbed
authored
Jun 27, 2010
by
David Conrad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VP8 bilinear filter
Originally committed as revision 23813 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
a02bb835
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
85 additions
and
8 deletions
+85
-8
vp8.c
libavcodec/vp8.c
+14
-8
vp8dsp.c
libavcodec/vp8dsp.c
+70
-0
vp8dsp.h
libavcodec/vp8dsp.h
+1
-0
No files found.
libavcodec/vp8.c
View file @
0ef1dbed
...
@@ -45,6 +45,7 @@ typedef struct {
...
@@ -45,6 +45,7 @@ typedef struct {
DSPContext
dsp
;
DSPContext
dsp
;
VP8DSPContext
vp8dsp
;
VP8DSPContext
vp8dsp
;
H264PredContext
hpc
;
H264PredContext
hpc
;
vp8_mc_func
put_pixels_tab
[
3
][
3
][
3
];
AVFrame
frames
[
4
];
AVFrame
frames
[
4
];
AVFrame
*
framep
[
4
];
AVFrame
*
framep
[
4
];
uint8_t
*
edge_emu_buffer
;
uint8_t
*
edge_emu_buffer
;
...
@@ -379,8 +380,13 @@ static int decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_size)
...
@@ -379,8 +380,13 @@ static int decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_size)
buf
+=
3
;
buf
+=
3
;
buf_size
-=
3
;
buf_size
-=
3
;
if
(
s
->
profile
)
if
(
s
->
profile
>
3
)
av_log
(
s
->
avctx
,
AV_LOG_WARNING
,
"Profile %d not fully handled
\n
"
,
s
->
profile
);
av_log
(
s
->
avctx
,
AV_LOG_WARNING
,
"Unknown profile %d
\n
"
,
s
->
profile
);
if
(
!
s
->
profile
)
memcpy
(
s
->
put_pixels_tab
,
s
->
vp8dsp
.
put_vp8_epel_pixels_tab
,
sizeof
(
s
->
put_pixels_tab
));
else
// profile 1-3 use bilinear, 4+ aren't defined so whatever
memcpy
(
s
->
put_pixels_tab
,
s
->
vp8dsp
.
put_vp8_bilinear_pixels_tab
,
sizeof
(
s
->
put_pixels_tab
));
if
(
header_size
>
buf_size
-
7
*
s
->
keyframe
)
{
if
(
header_size
>
buf_size
-
7
*
s
->
keyframe
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Header size larger than data provided
\n
"
);
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Header size larger than data provided
\n
"
);
...
@@ -951,7 +957,7 @@ static void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
...
@@ -951,7 +957,7 @@ static void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
/* Y */
/* Y */
vp8_mc
(
s
,
1
,
dst
[
0
],
s
->
framep
[
mb
->
ref_frame
]
->
data
[
0
],
&
mb
->
mv
,
vp8_mc
(
s
,
1
,
dst
[
0
],
s
->
framep
[
mb
->
ref_frame
]
->
data
[
0
],
&
mb
->
mv
,
x_off
,
y_off
,
16
,
16
,
width
,
height
,
s
->
linesize
,
x_off
,
y_off
,
16
,
16
,
width
,
height
,
s
->
linesize
,
s
->
vp8dsp
.
put_vp8_epel
_pixels_tab
[
0
]);
s
->
put
_pixels_tab
[
0
]);
/* U/V */
/* U/V */
uvmv
=
mb
->
mv
;
uvmv
=
mb
->
mv
;
...
@@ -962,10 +968,10 @@ static void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
...
@@ -962,10 +968,10 @@ static void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
x_off
>>=
1
;
y_off
>>=
1
;
width
>>=
1
;
height
>>=
1
;
x_off
>>=
1
;
y_off
>>=
1
;
width
>>=
1
;
height
>>=
1
;
vp8_mc
(
s
,
0
,
dst
[
1
],
s
->
framep
[
mb
->
ref_frame
]
->
data
[
1
],
&
uvmv
,
vp8_mc
(
s
,
0
,
dst
[
1
],
s
->
framep
[
mb
->
ref_frame
]
->
data
[
1
],
&
uvmv
,
x_off
,
y_off
,
8
,
8
,
width
,
height
,
s
->
uvlinesize
,
x_off
,
y_off
,
8
,
8
,
width
,
height
,
s
->
uvlinesize
,
s
->
vp8dsp
.
put_vp8_epel
_pixels_tab
[
1
]);
s
->
put
_pixels_tab
[
1
]);
vp8_mc
(
s
,
0
,
dst
[
2
],
s
->
framep
[
mb
->
ref_frame
]
->
data
[
2
],
&
uvmv
,
vp8_mc
(
s
,
0
,
dst
[
2
],
s
->
framep
[
mb
->
ref_frame
]
->
data
[
2
],
&
uvmv
,
x_off
,
y_off
,
8
,
8
,
width
,
height
,
s
->
uvlinesize
,
x_off
,
y_off
,
8
,
8
,
width
,
height
,
s
->
uvlinesize
,
s
->
vp8dsp
.
put_vp8_epel
_pixels_tab
[
1
]);
s
->
put
_pixels_tab
[
1
]);
}
else
{
}
else
{
int
x
,
y
;
int
x
,
y
;
...
@@ -976,7 +982,7 @@ static void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
...
@@ -976,7 +982,7 @@ static void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
s
->
framep
[
mb
->
ref_frame
]
->
data
[
0
],
&
mb
->
bmv
[
4
*
y
+
x
],
s
->
framep
[
mb
->
ref_frame
]
->
data
[
0
],
&
mb
->
bmv
[
4
*
y
+
x
],
4
*
x
+
x_off
,
4
*
y
+
y_off
,
4
,
4
,
4
*
x
+
x_off
,
4
*
y
+
y_off
,
4
,
4
,
width
,
height
,
s
->
linesize
,
width
,
height
,
s
->
linesize
,
s
->
vp8dsp
.
put_vp8_epel
_pixels_tab
[
2
]);
s
->
put
_pixels_tab
[
2
]);
}
}
}
}
...
@@ -1002,12 +1008,12 @@ static void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
...
@@ -1002,12 +1008,12 @@ static void inter_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
s
->
framep
[
mb
->
ref_frame
]
->
data
[
1
],
&
uvmv
,
s
->
framep
[
mb
->
ref_frame
]
->
data
[
1
],
&
uvmv
,
4
*
x
+
x_off
,
4
*
y
+
y_off
,
4
,
4
,
4
*
x
+
x_off
,
4
*
y
+
y_off
,
4
,
4
,
width
,
height
,
s
->
uvlinesize
,
width
,
height
,
s
->
uvlinesize
,
s
->
vp8dsp
.
put_vp8_epel
_pixels_tab
[
2
]);
s
->
put
_pixels_tab
[
2
]);
vp8_mc
(
s
,
0
,
dst
[
2
]
+
4
*
y
*
s
->
uvlinesize
+
x
*
4
,
vp8_mc
(
s
,
0
,
dst
[
2
]
+
4
*
y
*
s
->
uvlinesize
+
x
*
4
,
s
->
framep
[
mb
->
ref_frame
]
->
data
[
2
],
&
uvmv
,
s
->
framep
[
mb
->
ref_frame
]
->
data
[
2
],
&
uvmv
,
4
*
x
+
x_off
,
4
*
y
+
y_off
,
4
,
4
,
4
*
x
+
x_off
,
4
*
y
+
y_off
,
4
,
4
,
width
,
height
,
s
->
uvlinesize
,
width
,
height
,
s
->
uvlinesize
,
s
->
vp8dsp
.
put_vp8_epel
_pixels_tab
[
2
]);
s
->
put
_pixels_tab
[
2
]);
}
}
}
}
}
}
...
...
libavcodec/vp8dsp.c
View file @
0ef1dbed
...
@@ -348,6 +348,61 @@ VP8_EPEL_HV(16, FILTER_6TAP, FILTER_6TAP, h6v6)
...
@@ -348,6 +348,61 @@ VP8_EPEL_HV(16, FILTER_6TAP, FILTER_6TAP, h6v6)
VP8_EPEL_HV
(
8
,
FILTER_6TAP
,
FILTER_6TAP
,
h6v6
)
VP8_EPEL_HV
(
8
,
FILTER_6TAP
,
FILTER_6TAP
,
h6v6
)
VP8_EPEL_HV
(
4
,
FILTER_6TAP
,
FILTER_6TAP
,
h6v6
)
VP8_EPEL_HV
(
4
,
FILTER_6TAP
,
FILTER_6TAP
,
h6v6
)
#define VP8_BILINEAR(SIZE) \
static void put_vp8_bilinear ## SIZE ## _h_c(uint8_t *dst, int stride, uint8_t *src, int s2, int h, int mx, int my) \
{ \
int a = 8-mx, b = mx; \
int x, y; \
\
for (y = 0; y < h; y++) { \
for (x = 0; x < SIZE; x++) \
dst[x] = (a*src[x] + b*src[x+1] + 4) >> 3; \
dst += stride; \
src += stride; \
} \
} \
static void put_vp8_bilinear ## SIZE ## _v_c(uint8_t *dst, int stride, uint8_t *src, int s2, int h, int mx, int my) \
{ \
int c = 8-my, d = my; \
int x, y; \
\
for (y = 0; y < h; y++) { \
for (x = 0; x < SIZE; x++) \
dst[x] = (c*src[x] + d*src[x+stride] + 4) >> 3; \
dst += stride; \
src += stride; \
} \
} \
\
static void put_vp8_bilinear ## SIZE ## _hv_c(uint8_t *dst, int stride, uint8_t *src, int s2, int h, int mx, int my) \
{ \
int a = 8-mx, b = mx; \
int c = 8-my, d = my; \
int x, y; \
uint8_t tmp_array[(2*SIZE+1)*SIZE]; \
uint8_t *tmp = tmp_array; \
\
for (y = 0; y < h+1; y++) { \
for (x = 0; x < SIZE; x++) \
tmp[x] = (a*src[x] + b*src[x+1] + 4) >> 3; \
tmp += SIZE; \
src += stride; \
} \
\
tmp = tmp_array; \
\
for (y = 0; y < h; y++) { \
for (x = 0; x < SIZE; x++) \
dst[x] = (c*tmp[x] + d*tmp[x+SIZE] + 4) >> 3; \
dst += stride; \
tmp += SIZE; \
} \
}
VP8_BILINEAR
(
16
)
VP8_BILINEAR
(
8
)
VP8_BILINEAR
(
4
)
#define VP8_MC_FUNC(IDX, SIZE) \
#define VP8_MC_FUNC(IDX, SIZE) \
dsp->put_vp8_epel_pixels_tab[IDX][0][0] = put_vp8_pixels ## SIZE ## _c; \
dsp->put_vp8_epel_pixels_tab[IDX][0][0] = put_vp8_pixels ## SIZE ## _c; \
dsp->put_vp8_epel_pixels_tab[IDX][0][1] = put_vp8_epel ## SIZE ## _h4_c; \
dsp->put_vp8_epel_pixels_tab[IDX][0][1] = put_vp8_epel ## SIZE ## _h4_c; \
...
@@ -359,6 +414,17 @@ VP8_EPEL_HV(4, FILTER_6TAP, FILTER_6TAP, h6v6)
...
@@ -359,6 +414,17 @@ VP8_EPEL_HV(4, FILTER_6TAP, FILTER_6TAP, h6v6)
dsp->put_vp8_epel_pixels_tab[IDX][2][1] = put_vp8_epel ## SIZE ## _h4v6_c; \
dsp->put_vp8_epel_pixels_tab[IDX][2][1] = put_vp8_epel ## SIZE ## _h4v6_c; \
dsp->put_vp8_epel_pixels_tab[IDX][2][2] = put_vp8_epel ## SIZE ## _h6v6_c
dsp->put_vp8_epel_pixels_tab[IDX][2][2] = put_vp8_epel ## SIZE ## _h6v6_c
#define VP8_BILINEAR_MC_FUNC(IDX, SIZE) \
dsp->put_vp8_bilinear_pixels_tab[IDX][0][0] = put_vp8_pixels ## SIZE ## _c; \
dsp->put_vp8_bilinear_pixels_tab[IDX][0][1] = put_vp8_bilinear ## SIZE ## _h_c; \
dsp->put_vp8_bilinear_pixels_tab[IDX][0][2] = put_vp8_bilinear ## SIZE ## _h_c; \
dsp->put_vp8_bilinear_pixels_tab[IDX][1][0] = put_vp8_bilinear ## SIZE ## _v_c; \
dsp->put_vp8_bilinear_pixels_tab[IDX][1][1] = put_vp8_bilinear ## SIZE ## _hv_c; \
dsp->put_vp8_bilinear_pixels_tab[IDX][1][2] = put_vp8_bilinear ## SIZE ## _hv_c; \
dsp->put_vp8_bilinear_pixels_tab[IDX][2][0] = put_vp8_bilinear ## SIZE ## _v_c; \
dsp->put_vp8_bilinear_pixels_tab[IDX][2][1] = put_vp8_bilinear ## SIZE ## _hv_c; \
dsp->put_vp8_bilinear_pixels_tab[IDX][2][2] = put_vp8_bilinear ## SIZE ## _hv_c
av_cold
void
ff_vp8dsp_init
(
VP8DSPContext
*
dsp
)
av_cold
void
ff_vp8dsp_init
(
VP8DSPContext
*
dsp
)
{
{
dsp
->
vp8_luma_dc_wht
=
vp8_luma_dc_wht_c
;
dsp
->
vp8_luma_dc_wht
=
vp8_luma_dc_wht_c
;
...
@@ -381,4 +447,8 @@ av_cold void ff_vp8dsp_init(VP8DSPContext *dsp)
...
@@ -381,4 +447,8 @@ av_cold void ff_vp8dsp_init(VP8DSPContext *dsp)
VP8_MC_FUNC
(
0
,
16
);
VP8_MC_FUNC
(
0
,
16
);
VP8_MC_FUNC
(
1
,
8
);
VP8_MC_FUNC
(
1
,
8
);
VP8_MC_FUNC
(
2
,
4
);
VP8_MC_FUNC
(
2
,
4
);
VP8_BILINEAR_MC_FUNC
(
0
,
16
);
VP8_BILINEAR_MC_FUNC
(
1
,
8
);
VP8_BILINEAR_MC_FUNC
(
2
,
4
);
}
}
libavcodec/vp8dsp.h
View file @
0ef1dbed
...
@@ -58,6 +58,7 @@ typedef struct VP8DSPContext {
...
@@ -58,6 +58,7 @@ typedef struct VP8DSPContext {
* so something like put_vp8_epel_pixels_tab[width>>3][2*!!my-(my&1)][2*!!mx-(mx&1)](..., mx, my)
* so something like put_vp8_epel_pixels_tab[width>>3][2*!!my-(my&1)][2*!!mx-(mx&1)](..., mx, my)
*/
*/
vp8_mc_func
put_vp8_epel_pixels_tab
[
3
][
3
][
3
];
vp8_mc_func
put_vp8_epel_pixels_tab
[
3
][
3
][
3
];
vp8_mc_func
put_vp8_bilinear_pixels_tab
[
3
][
3
][
3
];
}
VP8DSPContext
;
}
VP8DSPContext
;
void
ff_put_vp8_pixels16_c
(
uint8_t
*
dst
,
uint8_t
*
src
,
int
stride
,
int
h
,
int
x
,
int
y
);
void
ff_put_vp8_pixels16_c
(
uint8_t
*
dst
,
uint8_t
*
src
,
int
stride
,
int
h
,
int
x
,
int
y
);
...
...
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