2015-04-22 02:54:51 +02:00
|
|
|
/*
|
|
|
|
* VP9 compatible video decoder
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013 Ronald S. Bultje <rsbultje gmail com>
|
|
|
|
* Copyright (C) 2013 Clément Bœsch <u pkh me>
|
|
|
|
*
|
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg 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.
|
|
|
|
*
|
|
|
|
* FFmpeg 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 FFmpeg; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2015-04-24 17:28:30 +02:00
|
|
|
#define ROUNDED_DIV_MVx2(a, b) \
|
avcodec/vp8, vp9: Avoid using VP56mv and VP56Frame in VP8/9
Instead replace VP56mv by new and identical structures VP8mv and VP9mv.
Also replace VP56Frame by VP8FrameType in vp8.h and use that
in VP8 code. Also remove VP56_FRAME_GOLDEN2, as this has only
been used by VP8, and use VP8_FRAME_ALTREF as replacement for
its usage in VP8 as this is more in line with VP8 verbiage.
This allows to remove all inclusions of vp56.h from everything
that is not VP5/6. This also removes implicit inclusions
of hpeldsp.h, h264chroma.h, vp3dsp.h and vp56dsp.h from all VP8/9
files.
(This also fixes a build issue: If one compiles with -O0 and disables
everything except the VP8-VAAPI encoder, the file containing
ff_vpx_norm_shift is not compiled, yet this is used implicitly
by vp56_rac_gets_nn() which is defined in vp56.h; it is unused
by the VP8-VAAPI encoder and declared as av_unused, yet with -O0
unused noninline functions are not optimized away, leading to
linking failures. With this patch, said function is not included
in vaapi_encode_vp8.c any more.)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-23 02:01:41 +02:00
|
|
|
(VP9mv) { .x = ROUNDED_DIV(a.x + b.x, 2), .y = ROUNDED_DIV(a.y + b.y, 2) }
|
2015-04-24 17:28:30 +02:00
|
|
|
#define ROUNDED_DIV_MVx4(a, b, c, d) \
|
avcodec/vp8, vp9: Avoid using VP56mv and VP56Frame in VP8/9
Instead replace VP56mv by new and identical structures VP8mv and VP9mv.
Also replace VP56Frame by VP8FrameType in vp8.h and use that
in VP8 code. Also remove VP56_FRAME_GOLDEN2, as this has only
been used by VP8, and use VP8_FRAME_ALTREF as replacement for
its usage in VP8 as this is more in line with VP8 verbiage.
This allows to remove all inclusions of vp56.h from everything
that is not VP5/6. This also removes implicit inclusions
of hpeldsp.h, h264chroma.h, vp3dsp.h and vp56dsp.h from all VP8/9
files.
(This also fixes a build issue: If one compiles with -O0 and disables
everything except the VP8-VAAPI encoder, the file containing
ff_vpx_norm_shift is not compiled, yet this is used implicitly
by vp56_rac_gets_nn() which is defined in vp56.h; it is unused
by the VP8-VAAPI encoder and declared as av_unused, yet with -O0
unused noninline functions are not optimized away, leading to
linking failures. With this patch, said function is not included
in vaapi_encode_vp8.c any more.)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-23 02:01:41 +02:00
|
|
|
(VP9mv) { .x = ROUNDED_DIV(a.x + b.x + c.x + d.x, 4), \
|
2015-04-24 17:28:30 +02:00
|
|
|
.y = ROUNDED_DIV(a.y + b.y + c.y + d.y, 4) }
|
|
|
|
|
2017-09-07 23:02:49 +02:00
|
|
|
static void FN(inter_pred)(VP9TileData *td)
|
2015-04-22 02:54:51 +02:00
|
|
|
{
|
|
|
|
static const uint8_t bwlog_tab[2][N_BS_SIZES] = {
|
|
|
|
{ 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 },
|
|
|
|
{ 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4 },
|
|
|
|
};
|
2022-07-23 03:34:17 +02:00
|
|
|
const VP9Context *s = td->s;
|
2017-09-07 23:02:49 +02:00
|
|
|
VP9Block *b = td->b;
|
|
|
|
int row = td->row, col = td->col;
|
2022-07-22 07:11:47 +02:00
|
|
|
const ThreadFrame *tref1 = &s->s.refs[s->s.h.refidx[b->ref[0]]], *tref2;
|
|
|
|
const AVFrame *ref1 = tref1->f, *ref2;
|
2015-04-22 02:54:51 +02:00
|
|
|
int w1 = ref1->width, h1 = ref1->height, w2, h2;
|
2017-09-07 23:02:49 +02:00
|
|
|
ptrdiff_t ls_y = td->y_stride, ls_uv = td->uv_stride;
|
2015-05-06 17:52:07 +02:00
|
|
|
int bytesperpixel = BYTES_PER_PIXEL;
|
2015-04-22 02:54:51 +02:00
|
|
|
|
|
|
|
if (b->comp) {
|
2015-10-14 10:03:20 +02:00
|
|
|
tref2 = &s->s.refs[s->s.h.refidx[b->ref[1]]];
|
2015-04-22 02:54:51 +02:00
|
|
|
ref2 = tref2->f;
|
|
|
|
w2 = ref2->width;
|
|
|
|
h2 = ref2->height;
|
|
|
|
}
|
|
|
|
|
|
|
|
// y inter pred
|
|
|
|
if (b->bs > BS_8x8) {
|
avcodec/vp8, vp9: Avoid using VP56mv and VP56Frame in VP8/9
Instead replace VP56mv by new and identical structures VP8mv and VP9mv.
Also replace VP56Frame by VP8FrameType in vp8.h and use that
in VP8 code. Also remove VP56_FRAME_GOLDEN2, as this has only
been used by VP8, and use VP8_FRAME_ALTREF as replacement for
its usage in VP8 as this is more in line with VP8 verbiage.
This allows to remove all inclusions of vp56.h from everything
that is not VP5/6. This also removes implicit inclusions
of hpeldsp.h, h264chroma.h, vp3dsp.h and vp56dsp.h from all VP8/9
files.
(This also fixes a build issue: If one compiles with -O0 and disables
everything except the VP8-VAAPI encoder, the file containing
ff_vpx_norm_shift is not compiled, yet this is used implicitly
by vp56_rac_gets_nn() which is defined in vp56.h; it is unused
by the VP8-VAAPI encoder and declared as av_unused, yet with -O0
unused noninline functions are not optimized away, leading to
linking failures. With this patch, said function is not included
in vaapi_encode_vp8.c any more.)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-23 02:01:41 +02:00
|
|
|
VP9mv uvmv;
|
2015-04-24 17:28:30 +02:00
|
|
|
|
2015-05-14 22:38:53 +02:00
|
|
|
#if SCALED == 0
|
2015-04-22 02:54:51 +02:00
|
|
|
if (b->bs == BS_8x4) {
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_luma_dir(td, mc[3][b->filter][0], td->dst[0], ls_y,
|
2015-04-22 02:54:51 +02:00
|
|
|
ref1->data[0], ref1->linesize[0], tref1,
|
2015-05-16 14:36:19 +02:00
|
|
|
row << 3, col << 3, &b->mv[0][0],,,,, 8, 4, w1, h1, 0);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_luma_dir(td, mc[3][b->filter][0],
|
|
|
|
td->dst[0] + 4 * ls_y, ls_y,
|
2015-04-22 02:54:51 +02:00
|
|
|
ref1->data[0], ref1->linesize[0], tref1,
|
2015-05-16 14:36:19 +02:00
|
|
|
(row << 3) + 4, col << 3, &b->mv[2][0],,,,, 8, 4, w1, h1, 0);
|
2015-04-24 17:28:30 +02:00
|
|
|
w1 = (w1 + s->ss_h) >> s->ss_h;
|
|
|
|
if (s->ss_v) {
|
|
|
|
h1 = (h1 + 1) >> 1;
|
|
|
|
uvmv = ROUNDED_DIV_MVx2(b->mv[0][0], b->mv[2][0]);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[3 + s->ss_h][b->filter][0],
|
|
|
|
td->dst[1], td->dst[2], ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref1->data[1], ref1->linesize[1],
|
|
|
|
ref1->data[2], ref1->linesize[2], tref1,
|
|
|
|
row << 2, col << (3 - s->ss_h),
|
2015-05-16 14:36:19 +02:00
|
|
|
&uvmv,,,,, 8 >> s->ss_h, 4, w1, h1, 0);
|
2015-04-24 17:28:30 +02:00
|
|
|
} else {
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[3 + s->ss_h][b->filter][0],
|
|
|
|
td->dst[1], td->dst[2], ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref1->data[1], ref1->linesize[1],
|
|
|
|
ref1->data[2], ref1->linesize[2], tref1,
|
|
|
|
row << 3, col << (3 - s->ss_h),
|
2015-05-16 14:36:19 +02:00
|
|
|
&b->mv[0][0],,,,, 8 >> s->ss_h, 4, w1, h1, 0);
|
2015-04-30 17:44:12 +02:00
|
|
|
// BUG for 4:2:2 bs=8x4, libvpx uses the wrong block index
|
|
|
|
// to get the motion vector for the bottom 4x4 block
|
|
|
|
// https://code.google.com/p/webm/issues/detail?id=993
|
|
|
|
if (s->ss_h == 0) {
|
|
|
|
uvmv = b->mv[2][0];
|
|
|
|
} else {
|
|
|
|
uvmv = ROUNDED_DIV_MVx2(b->mv[0][0], b->mv[2][0]);
|
|
|
|
}
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[3 + s->ss_h][b->filter][0],
|
|
|
|
td->dst[1] + 4 * ls_uv, td->dst[2] + 4 * ls_uv, ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref1->data[1], ref1->linesize[1],
|
|
|
|
ref1->data[2], ref1->linesize[2], tref1,
|
|
|
|
(row << 3) + 4, col << (3 - s->ss_h),
|
2015-05-16 14:36:19 +02:00
|
|
|
&uvmv,,,,, 8 >> s->ss_h, 4, w1, h1, 0);
|
2015-04-24 17:28:30 +02:00
|
|
|
}
|
2015-04-22 02:54:51 +02:00
|
|
|
|
|
|
|
if (b->comp) {
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_luma_dir(td, mc[3][b->filter][1], td->dst[0], ls_y,
|
2015-04-22 02:54:51 +02:00
|
|
|
ref2->data[0], ref2->linesize[0], tref2,
|
2015-05-16 14:36:19 +02:00
|
|
|
row << 3, col << 3, &b->mv[0][1],,,,, 8, 4, w2, h2, 1);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_luma_dir(td, mc[3][b->filter][1],
|
|
|
|
td->dst[0] + 4 * ls_y, ls_y,
|
2015-04-22 02:54:51 +02:00
|
|
|
ref2->data[0], ref2->linesize[0], tref2,
|
2015-05-16 14:36:19 +02:00
|
|
|
(row << 3) + 4, col << 3, &b->mv[2][1],,,,, 8, 4, w2, h2, 1);
|
2015-04-24 17:28:30 +02:00
|
|
|
w2 = (w2 + s->ss_h) >> s->ss_h;
|
|
|
|
if (s->ss_v) {
|
|
|
|
h2 = (h2 + 1) >> 1;
|
|
|
|
uvmv = ROUNDED_DIV_MVx2(b->mv[0][1], b->mv[2][1]);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[3 + s->ss_h][b->filter][1],
|
|
|
|
td->dst[1], td->dst[2], ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref2->data[1], ref2->linesize[1],
|
|
|
|
ref2->data[2], ref2->linesize[2], tref2,
|
|
|
|
row << 2, col << (3 - s->ss_h),
|
2015-05-16 14:36:19 +02:00
|
|
|
&uvmv,,,,, 8 >> s->ss_h, 4, w2, h2, 1);
|
2015-04-24 17:28:30 +02:00
|
|
|
} else {
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[3 + s->ss_h][b->filter][1],
|
|
|
|
td->dst[1], td->dst[2], ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref2->data[1], ref2->linesize[1],
|
|
|
|
ref2->data[2], ref2->linesize[2], tref2,
|
|
|
|
row << 3, col << (3 - s->ss_h),
|
2015-05-16 14:36:19 +02:00
|
|
|
&b->mv[0][1],,,,, 8 >> s->ss_h, 4, w2, h2, 1);
|
2015-04-30 17:44:12 +02:00
|
|
|
// BUG for 4:2:2 bs=8x4, libvpx uses the wrong block index
|
|
|
|
// to get the motion vector for the bottom 4x4 block
|
|
|
|
// https://code.google.com/p/webm/issues/detail?id=993
|
|
|
|
if (s->ss_h == 0) {
|
|
|
|
uvmv = b->mv[2][1];
|
|
|
|
} else {
|
|
|
|
uvmv = ROUNDED_DIV_MVx2(b->mv[0][1], b->mv[2][1]);
|
|
|
|
}
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[3 + s->ss_h][b->filter][1],
|
|
|
|
td->dst[1] + 4 * ls_uv, td->dst[2] + 4 * ls_uv, ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref2->data[1], ref2->linesize[1],
|
|
|
|
ref2->data[2], ref2->linesize[2], tref2,
|
|
|
|
(row << 3) + 4, col << (3 - s->ss_h),
|
2015-05-16 14:36:19 +02:00
|
|
|
&uvmv,,,,, 8 >> s->ss_h, 4, w2, h2, 1);
|
2015-04-24 17:28:30 +02:00
|
|
|
}
|
2015-04-22 02:54:51 +02:00
|
|
|
}
|
|
|
|
} else if (b->bs == BS_4x8) {
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_luma_dir(td, mc[4][b->filter][0], td->dst[0], ls_y,
|
2015-04-22 02:54:51 +02:00
|
|
|
ref1->data[0], ref1->linesize[0], tref1,
|
2015-05-16 14:36:19 +02:00
|
|
|
row << 3, col << 3, &b->mv[0][0],,,,, 4, 8, w1, h1, 0);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_luma_dir(td, mc[4][b->filter][0], td->dst[0] + 4 * bytesperpixel, ls_y,
|
2015-04-22 02:54:51 +02:00
|
|
|
ref1->data[0], ref1->linesize[0], tref1,
|
2015-05-16 14:36:19 +02:00
|
|
|
row << 3, (col << 3) + 4, &b->mv[1][0],,,,, 4, 8, w1, h1, 0);
|
2015-04-24 17:28:30 +02:00
|
|
|
h1 = (h1 + s->ss_v) >> s->ss_v;
|
|
|
|
if (s->ss_h) {
|
|
|
|
w1 = (w1 + 1) >> 1;
|
|
|
|
uvmv = ROUNDED_DIV_MVx2(b->mv[0][0], b->mv[1][0]);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[4][b->filter][0],
|
|
|
|
td->dst[1], td->dst[2], ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref1->data[1], ref1->linesize[1],
|
|
|
|
ref1->data[2], ref1->linesize[2], tref1,
|
|
|
|
row << (3 - s->ss_v), col << 2,
|
2015-05-16 14:36:19 +02:00
|
|
|
&uvmv,,,,, 4, 8 >> s->ss_v, w1, h1, 0);
|
2015-04-24 17:28:30 +02:00
|
|
|
} else {
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[4][b->filter][0],
|
|
|
|
td->dst[1], td->dst[2], ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref1->data[1], ref1->linesize[1],
|
|
|
|
ref1->data[2], ref1->linesize[2], tref1,
|
|
|
|
row << (3 - s->ss_v), col << 3,
|
2015-05-16 14:36:19 +02:00
|
|
|
&b->mv[0][0],,,,, 4, 8 >> s->ss_v, w1, h1, 0);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[4][b->filter][0],
|
|
|
|
td->dst[1] + 4 * bytesperpixel,
|
|
|
|
td->dst[2] + 4 * bytesperpixel, ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref1->data[1], ref1->linesize[1],
|
|
|
|
ref1->data[2], ref1->linesize[2], tref1,
|
|
|
|
row << (3 - s->ss_v), (col << 3) + 4,
|
2015-05-16 14:36:19 +02:00
|
|
|
&b->mv[1][0],,,,, 4, 8 >> s->ss_v, w1, h1, 0);
|
2015-04-24 17:28:30 +02:00
|
|
|
}
|
2015-04-22 02:54:51 +02:00
|
|
|
|
|
|
|
if (b->comp) {
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_luma_dir(td, mc[4][b->filter][1], td->dst[0], ls_y,
|
2015-04-22 02:54:51 +02:00
|
|
|
ref2->data[0], ref2->linesize[0], tref2,
|
2015-05-16 14:36:19 +02:00
|
|
|
row << 3, col << 3, &b->mv[0][1],,,,, 4, 8, w2, h2, 1);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_luma_dir(td, mc[4][b->filter][1], td->dst[0] + 4 * bytesperpixel, ls_y,
|
2015-04-22 02:54:51 +02:00
|
|
|
ref2->data[0], ref2->linesize[0], tref2,
|
2015-05-16 14:36:19 +02:00
|
|
|
row << 3, (col << 3) + 4, &b->mv[1][1],,,,, 4, 8, w2, h2, 1);
|
2015-04-24 17:28:30 +02:00
|
|
|
h2 = (h2 + s->ss_v) >> s->ss_v;
|
|
|
|
if (s->ss_h) {
|
|
|
|
w2 = (w2 + 1) >> 1;
|
|
|
|
uvmv = ROUNDED_DIV_MVx2(b->mv[0][1], b->mv[1][1]);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[4][b->filter][1],
|
|
|
|
td->dst[1], td->dst[2], ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref2->data[1], ref2->linesize[1],
|
|
|
|
ref2->data[2], ref2->linesize[2], tref2,
|
|
|
|
row << (3 - s->ss_v), col << 2,
|
2015-05-16 14:36:19 +02:00
|
|
|
&uvmv,,,,, 4, 8 >> s->ss_v, w2, h2, 1);
|
2015-04-24 17:28:30 +02:00
|
|
|
} else {
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[4][b->filter][1],
|
|
|
|
td->dst[1], td->dst[2], ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref2->data[1], ref2->linesize[1],
|
|
|
|
ref2->data[2], ref2->linesize[2], tref2,
|
|
|
|
row << (3 - s->ss_v), col << 3,
|
2015-05-16 14:36:19 +02:00
|
|
|
&b->mv[0][1],,,,, 4, 8 >> s->ss_v, w2, h2, 1);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[4][b->filter][1],
|
|
|
|
td->dst[1] + 4 * bytesperpixel,
|
|
|
|
td->dst[2] + 4 * bytesperpixel, ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref2->data[1], ref2->linesize[1],
|
|
|
|
ref2->data[2], ref2->linesize[2], tref2,
|
|
|
|
row << (3 - s->ss_v), (col << 3) + 4,
|
2015-05-16 14:36:19 +02:00
|
|
|
&b->mv[1][1],,,,, 4, 8 >> s->ss_v, w2, h2, 1);
|
2015-04-24 17:28:30 +02:00
|
|
|
}
|
2015-04-22 02:54:51 +02:00
|
|
|
}
|
2015-05-14 22:38:53 +02:00
|
|
|
} else
|
|
|
|
#endif
|
|
|
|
{
|
2016-11-13 00:45:52 +02:00
|
|
|
#if SCALED == 0
|
2015-04-22 02:54:51 +02:00
|
|
|
av_assert2(b->bs == BS_4x4);
|
2016-11-13 00:45:52 +02:00
|
|
|
#endif
|
2015-04-22 02:54:51 +02:00
|
|
|
|
|
|
|
// FIXME if two horizontally adjacent blocks have the same MV,
|
|
|
|
// do a w8 instead of a w4 call
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_luma_dir(td, mc[4][b->filter][0], td->dst[0], ls_y,
|
2015-04-22 02:54:51 +02:00
|
|
|
ref1->data[0], ref1->linesize[0], tref1,
|
2015-05-16 14:36:19 +02:00
|
|
|
row << 3, col << 3, &b->mv[0][0],
|
|
|
|
0, 0, 8, 8, 4, 4, w1, h1, 0);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_luma_dir(td, mc[4][b->filter][0], td->dst[0] + 4 * bytesperpixel, ls_y,
|
2015-04-22 02:54:51 +02:00
|
|
|
ref1->data[0], ref1->linesize[0], tref1,
|
2015-05-16 14:36:19 +02:00
|
|
|
row << 3, (col << 3) + 4, &b->mv[1][0],
|
|
|
|
4, 0, 8, 8, 4, 4, w1, h1, 0);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_luma_dir(td, mc[4][b->filter][0],
|
|
|
|
td->dst[0] + 4 * ls_y, ls_y,
|
2015-04-22 02:54:51 +02:00
|
|
|
ref1->data[0], ref1->linesize[0], tref1,
|
2015-05-16 14:36:19 +02:00
|
|
|
(row << 3) + 4, col << 3, &b->mv[2][0],
|
|
|
|
0, 4, 8, 8, 4, 4, w1, h1, 0);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_luma_dir(td, mc[4][b->filter][0],
|
|
|
|
td->dst[0] + 4 * ls_y + 4 * bytesperpixel, ls_y,
|
2015-04-22 02:54:51 +02:00
|
|
|
ref1->data[0], ref1->linesize[0], tref1,
|
2015-05-16 14:36:19 +02:00
|
|
|
(row << 3) + 4, (col << 3) + 4, &b->mv[3][0],
|
|
|
|
4, 4, 8, 8, 4, 4, w1, h1, 0);
|
2015-04-24 17:28:30 +02:00
|
|
|
if (s->ss_v) {
|
|
|
|
h1 = (h1 + 1) >> 1;
|
|
|
|
if (s->ss_h) {
|
|
|
|
w1 = (w1 + 1) >> 1;
|
|
|
|
uvmv = ROUNDED_DIV_MVx4(b->mv[0][0], b->mv[1][0],
|
|
|
|
b->mv[2][0], b->mv[3][0]);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[4][b->filter][0],
|
|
|
|
td->dst[1], td->dst[2], ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref1->data[1], ref1->linesize[1],
|
|
|
|
ref1->data[2], ref1->linesize[2], tref1,
|
|
|
|
row << 2, col << 2,
|
2015-05-16 14:36:19 +02:00
|
|
|
&uvmv, 0, 0, 4, 4, 4, 4, w1, h1, 0);
|
2015-04-24 17:28:30 +02:00
|
|
|
} else {
|
|
|
|
uvmv = ROUNDED_DIV_MVx2(b->mv[0][0], b->mv[2][0]);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[4][b->filter][0],
|
|
|
|
td->dst[1], td->dst[2], ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref1->data[1], ref1->linesize[1],
|
|
|
|
ref1->data[2], ref1->linesize[2], tref1,
|
|
|
|
row << 2, col << 3,
|
2015-05-16 14:36:19 +02:00
|
|
|
&uvmv, 0, 0, 8, 4, 4, 4, w1, h1, 0);
|
2015-04-24 17:28:30 +02:00
|
|
|
uvmv = ROUNDED_DIV_MVx2(b->mv[1][0], b->mv[3][0]);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[4][b->filter][0],
|
|
|
|
td->dst[1] + 4 * bytesperpixel,
|
|
|
|
td->dst[2] + 4 * bytesperpixel, ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref1->data[1], ref1->linesize[1],
|
|
|
|
ref1->data[2], ref1->linesize[2], tref1,
|
|
|
|
row << 2, (col << 3) + 4,
|
2015-05-16 14:36:19 +02:00
|
|
|
&uvmv, 4, 0, 8, 4, 4, 4, w1, h1, 0);
|
2015-04-24 17:28:30 +02:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (s->ss_h) {
|
|
|
|
w1 = (w1 + 1) >> 1;
|
|
|
|
uvmv = ROUNDED_DIV_MVx2(b->mv[0][0], b->mv[1][0]);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[4][b->filter][0],
|
|
|
|
td->dst[1], td->dst[2], ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref1->data[1], ref1->linesize[1],
|
|
|
|
ref1->data[2], ref1->linesize[2], tref1,
|
|
|
|
row << 3, col << 2,
|
2015-05-16 14:36:19 +02:00
|
|
|
&uvmv, 0, 0, 4, 8, 4, 4, w1, h1, 0);
|
2015-04-30 17:44:12 +02:00
|
|
|
// BUG libvpx uses wrong block index for 4:2:2 bs=4x4
|
|
|
|
// bottom block
|
|
|
|
// https://code.google.com/p/webm/issues/detail?id=993
|
|
|
|
uvmv = ROUNDED_DIV_MVx2(b->mv[1][0], b->mv[2][0]);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[4][b->filter][0],
|
|
|
|
td->dst[1] + 4 * ls_uv, td->dst[2] + 4 * ls_uv, ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref1->data[1], ref1->linesize[1],
|
|
|
|
ref1->data[2], ref1->linesize[2], tref1,
|
|
|
|
(row << 3) + 4, col << 2,
|
2015-05-16 14:36:19 +02:00
|
|
|
&uvmv, 0, 4, 4, 8, 4, 4, w1, h1, 0);
|
2015-04-24 17:28:30 +02:00
|
|
|
} else {
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[4][b->filter][0],
|
|
|
|
td->dst[1], td->dst[2], ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref1->data[1], ref1->linesize[1],
|
|
|
|
ref1->data[2], ref1->linesize[2], tref1,
|
|
|
|
row << 3, col << 3,
|
2015-05-16 14:36:19 +02:00
|
|
|
&b->mv[0][0], 0, 0, 8, 8, 4, 4, w1, h1, 0);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[4][b->filter][0],
|
|
|
|
td->dst[1] + 4 * bytesperpixel,
|
|
|
|
td->dst[2] + 4 * bytesperpixel, ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref1->data[1], ref1->linesize[1],
|
|
|
|
ref1->data[2], ref1->linesize[2], tref1,
|
|
|
|
row << 3, (col << 3) + 4,
|
2015-05-16 14:36:19 +02:00
|
|
|
&b->mv[1][0], 4, 0, 8, 8, 4, 4, w1, h1, 0);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[4][b->filter][0],
|
|
|
|
td->dst[1] + 4 * ls_uv, td->dst[2] + 4 * ls_uv, ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref1->data[1], ref1->linesize[1],
|
|
|
|
ref1->data[2], ref1->linesize[2], tref1,
|
|
|
|
(row << 3) + 4, col << 3,
|
2015-05-16 14:36:19 +02:00
|
|
|
&b->mv[2][0], 0, 4, 8, 8, 4, 4, w1, h1, 0);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[4][b->filter][0],
|
|
|
|
td->dst[1] + 4 * ls_uv + 4 * bytesperpixel,
|
|
|
|
td->dst[2] + 4 * ls_uv + 4 * bytesperpixel, ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref1->data[1], ref1->linesize[1],
|
|
|
|
ref1->data[2], ref1->linesize[2], tref1,
|
|
|
|
(row << 3) + 4, (col << 3) + 4,
|
2015-05-16 14:36:19 +02:00
|
|
|
&b->mv[3][0], 4, 4, 8, 8, 4, 4, w1, h1, 0);
|
2015-04-24 17:28:30 +02:00
|
|
|
}
|
|
|
|
}
|
2015-04-22 02:54:51 +02:00
|
|
|
|
|
|
|
if (b->comp) {
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_luma_dir(td, mc[4][b->filter][1], td->dst[0], ls_y,
|
2015-04-22 02:54:51 +02:00
|
|
|
ref2->data[0], ref2->linesize[0], tref2,
|
2015-05-16 14:36:19 +02:00
|
|
|
row << 3, col << 3, &b->mv[0][1], 0, 0, 8, 8, 4, 4, w2, h2, 1);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_luma_dir(td, mc[4][b->filter][1], td->dst[0] + 4 * bytesperpixel, ls_y,
|
2015-04-22 02:54:51 +02:00
|
|
|
ref2->data[0], ref2->linesize[0], tref2,
|
2015-05-16 14:36:19 +02:00
|
|
|
row << 3, (col << 3) + 4, &b->mv[1][1], 4, 0, 8, 8, 4, 4, w2, h2, 1);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_luma_dir(td, mc[4][b->filter][1],
|
|
|
|
td->dst[0] + 4 * ls_y, ls_y,
|
2015-04-22 02:54:51 +02:00
|
|
|
ref2->data[0], ref2->linesize[0], tref2,
|
2015-05-16 14:36:19 +02:00
|
|
|
(row << 3) + 4, col << 3, &b->mv[2][1], 0, 4, 8, 8, 4, 4, w2, h2, 1);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_luma_dir(td, mc[4][b->filter][1],
|
|
|
|
td->dst[0] + 4 * ls_y + 4 * bytesperpixel, ls_y,
|
2015-04-22 02:54:51 +02:00
|
|
|
ref2->data[0], ref2->linesize[0], tref2,
|
2015-05-16 14:36:19 +02:00
|
|
|
(row << 3) + 4, (col << 3) + 4, &b->mv[3][1], 4, 4, 8, 8, 4, 4, w2, h2, 1);
|
2015-04-24 17:28:30 +02:00
|
|
|
if (s->ss_v) {
|
|
|
|
h2 = (h2 + 1) >> 1;
|
|
|
|
if (s->ss_h) {
|
|
|
|
w2 = (w2 + 1) >> 1;
|
|
|
|
uvmv = ROUNDED_DIV_MVx4(b->mv[0][1], b->mv[1][1],
|
|
|
|
b->mv[2][1], b->mv[3][1]);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[4][b->filter][1],
|
|
|
|
td->dst[1], td->dst[2], ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref2->data[1], ref2->linesize[1],
|
|
|
|
ref2->data[2], ref2->linesize[2], tref2,
|
|
|
|
row << 2, col << 2,
|
2015-05-16 14:36:19 +02:00
|
|
|
&uvmv, 0, 0, 4, 4, 4, 4, w2, h2, 1);
|
2015-04-24 17:28:30 +02:00
|
|
|
} else {
|
|
|
|
uvmv = ROUNDED_DIV_MVx2(b->mv[0][1], b->mv[2][1]);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[4][b->filter][1],
|
|
|
|
td->dst[1], td->dst[2], ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref2->data[1], ref2->linesize[1],
|
|
|
|
ref2->data[2], ref2->linesize[2], tref2,
|
|
|
|
row << 2, col << 3,
|
2015-05-16 14:36:19 +02:00
|
|
|
&uvmv, 0, 0, 8, 4, 4, 4, w2, h2, 1);
|
2015-04-24 17:28:30 +02:00
|
|
|
uvmv = ROUNDED_DIV_MVx2(b->mv[1][1], b->mv[3][1]);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[4][b->filter][1],
|
|
|
|
td->dst[1] + 4 * bytesperpixel,
|
|
|
|
td->dst[2] + 4 * bytesperpixel, ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref2->data[1], ref2->linesize[1],
|
|
|
|
ref2->data[2], ref2->linesize[2], tref2,
|
|
|
|
row << 2, (col << 3) + 4,
|
2015-05-16 14:36:19 +02:00
|
|
|
&uvmv, 4, 0, 8, 4, 4, 4, w2, h2, 1);
|
2015-04-24 17:28:30 +02:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (s->ss_h) {
|
|
|
|
w2 = (w2 + 1) >> 1;
|
|
|
|
uvmv = ROUNDED_DIV_MVx2(b->mv[0][1], b->mv[1][1]);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[4][b->filter][1],
|
|
|
|
td->dst[1], td->dst[2], ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref2->data[1], ref2->linesize[1],
|
|
|
|
ref2->data[2], ref2->linesize[2], tref2,
|
|
|
|
row << 3, col << 2,
|
2015-05-16 14:36:19 +02:00
|
|
|
&uvmv, 0, 0, 4, 8, 4, 4, w2, h2, 1);
|
2015-04-30 17:44:12 +02:00
|
|
|
// BUG libvpx uses wrong block index for 4:2:2 bs=4x4
|
|
|
|
// bottom block
|
|
|
|
// https://code.google.com/p/webm/issues/detail?id=993
|
|
|
|
uvmv = ROUNDED_DIV_MVx2(b->mv[1][1], b->mv[2][1]);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[4][b->filter][1],
|
|
|
|
td->dst[1] + 4 * ls_uv, td->dst[2] + 4 * ls_uv, ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref2->data[1], ref2->linesize[1],
|
|
|
|
ref2->data[2], ref2->linesize[2], tref2,
|
|
|
|
(row << 3) + 4, col << 2,
|
2015-05-16 14:36:19 +02:00
|
|
|
&uvmv, 0, 4, 4, 8, 4, 4, w2, h2, 1);
|
2015-04-24 17:28:30 +02:00
|
|
|
} else {
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[4][b->filter][1],
|
|
|
|
td->dst[1], td->dst[2], ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref2->data[1], ref2->linesize[1],
|
|
|
|
ref2->data[2], ref2->linesize[2], tref2,
|
|
|
|
row << 3, col << 3,
|
2015-05-16 14:36:19 +02:00
|
|
|
&b->mv[0][1], 0, 0, 8, 8, 4, 4, w2, h2, 1);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[4][b->filter][1],
|
|
|
|
td->dst[1] + 4 * bytesperpixel,
|
|
|
|
td->dst[2] + 4 * bytesperpixel, ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref2->data[1], ref2->linesize[1],
|
|
|
|
ref2->data[2], ref2->linesize[2], tref2,
|
|
|
|
row << 3, (col << 3) + 4,
|
2015-05-16 14:36:19 +02:00
|
|
|
&b->mv[1][1], 4, 0, 8, 8, 4, 4, w2, h2, 1);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[4][b->filter][1],
|
|
|
|
td->dst[1] + 4 * ls_uv, td->dst[2] + 4 * ls_uv, ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref2->data[1], ref2->linesize[1],
|
|
|
|
ref2->data[2], ref2->linesize[2], tref2,
|
|
|
|
(row << 3) + 4, col << 3,
|
2015-05-16 14:36:19 +02:00
|
|
|
&b->mv[2][1], 0, 4, 8, 8, 4, 4, w2, h2, 1);
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[4][b->filter][1],
|
|
|
|
td->dst[1] + 4 * ls_uv + 4 * bytesperpixel,
|
|
|
|
td->dst[2] + 4 * ls_uv + 4 * bytesperpixel, ls_uv,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref2->data[1], ref2->linesize[1],
|
|
|
|
ref2->data[2], ref2->linesize[2], tref2,
|
|
|
|
(row << 3) + 4, (col << 3) + 4,
|
2015-05-16 14:36:19 +02:00
|
|
|
&b->mv[3][1], 4, 4, 8, 8, 4, 4, w2, h2, 1);
|
2015-04-24 17:28:30 +02:00
|
|
|
}
|
|
|
|
}
|
2015-04-22 02:54:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
int bwl = bwlog_tab[0][b->bs];
|
2017-03-27 23:32:20 +02:00
|
|
|
int bw = ff_vp9_bwh_tab[0][b->bs][0] * 4;
|
|
|
|
int bh = ff_vp9_bwh_tab[0][b->bs][1] * 4;
|
|
|
|
int uvbw = ff_vp9_bwh_tab[s->ss_h][b->bs][0] * 4;
|
|
|
|
int uvbh = ff_vp9_bwh_tab[s->ss_v][b->bs][1] * 4;
|
2015-04-22 02:54:51 +02:00
|
|
|
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_luma_dir(td, mc[bwl][b->filter][0], td->dst[0], ls_y,
|
2015-04-22 02:54:51 +02:00
|
|
|
ref1->data[0], ref1->linesize[0], tref1,
|
2015-05-16 14:36:19 +02:00
|
|
|
row << 3, col << 3, &b->mv[0][0], 0, 0, bw, bh, bw, bh, w1, h1, 0);
|
2015-04-24 17:28:30 +02:00
|
|
|
w1 = (w1 + s->ss_h) >> s->ss_h;
|
|
|
|
h1 = (h1 + s->ss_v) >> s->ss_v;
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[bwl + s->ss_h][b->filter][0],
|
|
|
|
td->dst[1], td->dst[2], ls_uv,
|
2015-04-22 02:54:51 +02:00
|
|
|
ref1->data[1], ref1->linesize[1],
|
|
|
|
ref1->data[2], ref1->linesize[2], tref1,
|
2015-04-24 17:28:30 +02:00
|
|
|
row << (3 - s->ss_v), col << (3 - s->ss_h),
|
2015-05-16 14:36:19 +02:00
|
|
|
&b->mv[0][0], 0, 0, uvbw, uvbh, uvbw, uvbh, w1, h1, 0);
|
2015-04-22 02:54:51 +02:00
|
|
|
|
|
|
|
if (b->comp) {
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_luma_dir(td, mc[bwl][b->filter][1], td->dst[0], ls_y,
|
2015-04-24 17:28:30 +02:00
|
|
|
ref2->data[0], ref2->linesize[0], tref2,
|
2015-05-16 14:36:19 +02:00
|
|
|
row << 3, col << 3, &b->mv[0][1], 0, 0, bw, bh, bw, bh, w2, h2, 1);
|
2015-04-24 17:28:30 +02:00
|
|
|
w2 = (w2 + s->ss_h) >> s->ss_h;
|
|
|
|
h2 = (h2 + s->ss_v) >> s->ss_v;
|
2017-09-07 23:02:49 +02:00
|
|
|
mc_chroma_dir(td, mc[bwl + s->ss_h][b->filter][1],
|
|
|
|
td->dst[1], td->dst[2], ls_uv,
|
2015-04-22 02:54:51 +02:00
|
|
|
ref2->data[1], ref2->linesize[1],
|
|
|
|
ref2->data[2], ref2->linesize[2], tref2,
|
2015-04-24 17:28:30 +02:00
|
|
|
row << (3 - s->ss_v), col << (3 - s->ss_h),
|
2015-05-16 14:36:19 +02:00
|
|
|
&b->mv[0][1], 0, 0, uvbw, uvbh, uvbw, uvbh, w2, h2, 1);
|
2015-04-22 02:54:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|