summaryrefslogtreecommitdiff
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2012-12-15 09:46:02 -0800
committerLuca Barbato <lu_zero@gentoo.org>2012-12-20 13:40:45 +0100
commit8c53d39e7f0604127bfc96fa1182c8abe3847ac6 (patch)
tree18495cabf7f0e6d365871d3407f2534f2b80b653 /libavcodec/h264.c
parenta925f723a915bc0255e2673f8817af5212131763 (diff)
lavc: introduce VideoDSPContext
Move some functions from dsputil. The idea is that videodsp contains functions that are useful for a large and varied set of video decoders. Currently, it contains emulated_edge_mc() and prefetch(). Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c56
1 files changed, 29 insertions, 27 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index ad3f15c3f3..1a0b341641 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -486,11 +486,11 @@ static av_always_inline void mc_dir_part(H264Context *h, Picture *pic,
full_my < 0 - extra_height ||
full_mx + 16 /*FIXME*/ > pic_width + extra_width ||
full_my + 16 /*FIXME*/ > pic_height + extra_height) {
- s->dsp.emulated_edge_mc(s->edge_emu_buffer,
- src_y - (2 << pixel_shift) - 2 * h->mb_linesize,
- h->mb_linesize,
- 16 + 5, 16 + 5 /*FIXME*/, full_mx - 2,
- full_my - 2, pic_width, pic_height);
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer,
+ src_y - (2 << pixel_shift) - 2 * h->mb_linesize,
+ h->mb_linesize,
+ 16 + 5, 16 + 5 /*FIXME*/, full_mx - 2,
+ full_my - 2, pic_width, pic_height);
src_y = s->edge_emu_buffer + (2 << pixel_shift) + 2 * h->mb_linesize;
emu = 1;
}
@@ -505,12 +505,12 @@ static av_always_inline void mc_dir_part(H264Context *h, Picture *pic,
if (chroma_idc == 3 /* yuv444 */) {
src_cb = pic->f.data[1] + offset;
if (emu) {
- s->dsp.emulated_edge_mc(s->edge_emu_buffer,
- src_cb - (2 << pixel_shift) - 2 * h->mb_linesize,
- h->mb_linesize,
- 16 + 5, 16 + 5 /*FIXME*/,
- full_mx - 2, full_my - 2,
- pic_width, pic_height);
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer,
+ src_cb - (2 << pixel_shift) - 2 * h->mb_linesize,
+ h->mb_linesize,
+ 16 + 5, 16 + 5 /*FIXME*/,
+ full_mx - 2, full_my - 2,
+ pic_width, pic_height);
src_cb = s->edge_emu_buffer + (2 << pixel_shift) + 2 * h->mb_linesize;
}
qpix_op[luma_xy](dest_cb, src_cb, h->mb_linesize); // FIXME try variable height perhaps?
@@ -519,12 +519,12 @@ static av_always_inline void mc_dir_part(H264Context *h, Picture *pic,
src_cr = pic->f.data[2] + offset;
if (emu) {
- s->dsp.emulated_edge_mc(s->edge_emu_buffer,
- src_cr - (2 << pixel_shift) - 2 * h->mb_linesize,
- h->mb_linesize,
- 16 + 5, 16 + 5 /*FIXME*/,
- full_mx - 2, full_my - 2,
- pic_width, pic_height);
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer,
+ src_cr - (2 << pixel_shift) - 2 * h->mb_linesize,
+ h->mb_linesize,
+ 16 + 5, 16 + 5 /*FIXME*/,
+ full_mx - 2, full_my - 2,
+ pic_width, pic_height);
src_cr = s->edge_emu_buffer + (2 << pixel_shift) + 2 * h->mb_linesize;
}
qpix_op[luma_xy](dest_cr, src_cr, h->mb_linesize); // FIXME try variable height perhaps?
@@ -546,9 +546,9 @@ static av_always_inline void mc_dir_part(H264Context *h, Picture *pic,
(my >> ysh) * h->mb_uvlinesize;
if (emu) {
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_cb, h->mb_uvlinesize,
- 9, 8 * chroma_idc + 1, (mx >> 3), (my >> ysh),
- pic_width >> 1, pic_height >> (chroma_idc == 1 /* yuv420 */));
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, src_cb, h->mb_uvlinesize,
+ 9, 8 * chroma_idc + 1, (mx >> 3), (my >> ysh),
+ pic_width >> 1, pic_height >> (chroma_idc == 1 /* yuv420 */));
src_cb = s->edge_emu_buffer;
}
chroma_op(dest_cb, src_cb, h->mb_uvlinesize,
@@ -556,9 +556,9 @@ static av_always_inline void mc_dir_part(H264Context *h, Picture *pic,
mx & 7, (my << (chroma_idc == 2 /* yuv422 */)) & 7);
if (emu) {
- s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_cr, h->mb_uvlinesize,
- 9, 8 * chroma_idc + 1, (mx >> 3), (my >> ysh),
- pic_width >> 1, pic_height >> (chroma_idc == 1 /* yuv420 */));
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, src_cr, h->mb_uvlinesize,
+ 9, 8 * chroma_idc + 1, (mx >> 3), (my >> ysh),
+ pic_width >> 1, pic_height >> (chroma_idc == 1 /* yuv420 */));
src_cr = s->edge_emu_buffer;
}
chroma_op(dest_cr, src_cr, h->mb_uvlinesize, height >> (chroma_idc == 1 /* yuv420 */),
@@ -735,15 +735,15 @@ static av_always_inline void prefetch_motion(H264Context *h, int list,
int off = (mx << pixel_shift) +
(my + (s->mb_x & 3) * 4) * h->mb_linesize +
(64 << pixel_shift);
- s->dsp.prefetch(src[0] + off, s->linesize, 4);
+ s->vdsp.prefetch(src[0] + off, s->linesize, 4);
if (chroma_idc == 3 /* yuv444 */) {
- s->dsp.prefetch(src[1] + off, s->linesize, 4);
- s->dsp.prefetch(src[2] + off, s->linesize, 4);
+ s->vdsp.prefetch(src[1] + off, s->linesize, 4);
+ s->vdsp.prefetch(src[2] + off, s->linesize, 4);
} else {
off = ((mx >> 1) << pixel_shift) +
((my >> 1) + (s->mb_x & 7)) * s->uvlinesize +
(64 << pixel_shift);
- s->dsp.prefetch(src[1] + off, src[2] - src[1], 2);
+ s->vdsp.prefetch(src[1] + off, src[2] - src[1], 2);
}
}
}
@@ -973,6 +973,7 @@ static av_cold void common_init(H264Context *h)
/* needed so that IDCT permutation is known early */
ff_dsputil_init(&s->dsp, s->avctx);
+ ff_videodsp_init(&s->vdsp, 8);
memset(h->pps.scaling_matrix4, 16, 6 * 16 * sizeof(uint8_t));
memset(h->pps.scaling_matrix8, 16, 2 * 64 * sizeof(uint8_t));
@@ -2439,6 +2440,7 @@ static int h264_set_parameter_from_sps(H264Context *h)
h->sps.chroma_format_idc);
s->dsp.dct_bits = h->sps.bit_depth_luma > 8 ? 32 : 16;
ff_dsputil_init(&s->dsp, s->avctx);
+ ff_videodsp_init(&s->vdsp, h->sps.bit_depth_luma);
} else {
av_log(s->avctx, AV_LOG_ERROR, "Unsupported bit depth: %d\n",
h->sps.bit_depth_luma);