2010-05-18 17:58:33 +02:00
|
|
|
/*
|
2010-09-09 14:16:39 +02:00
|
|
|
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
|
2010-05-18 17:58:33 +02:00
|
|
|
*
|
2010-06-18 18:39:21 +02:00
|
|
|
* Use of this source code is governed by a BSD-style license
|
2010-06-04 22:19:40 +02:00
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
2010-06-18 18:39:21 +02:00
|
|
|
* in the file PATENTS. All contributing project authors may
|
2010-06-04 22:19:40 +02:00
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
2010-05-18 17:58:33 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __INC_RECON_H
|
|
|
|
#define __INC_RECON_H
|
|
|
|
|
2010-10-26 17:37:23 +02:00
|
|
|
#include "blockd.h"
|
|
|
|
|
2010-05-18 17:58:33 +02:00
|
|
|
#define prototype_copy_block(sym) \
|
|
|
|
void sym(unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch)
|
|
|
|
|
|
|
|
#define prototype_recon_block(sym) \
|
2010-10-28 01:04:02 +02:00
|
|
|
void sym(unsigned char *pred, short *diff, unsigned char *dst, int pitch)
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2010-10-26 17:37:23 +02:00
|
|
|
#define prototype_recon_macroblock(sym) \
|
2010-10-28 01:04:02 +02:00
|
|
|
void sym(const struct vp8_recon_rtcd_vtable *rtcd, MACROBLOCKD *x)
|
2010-10-26 17:37:23 +02:00
|
|
|
|
2011-03-11 17:35:38 +01:00
|
|
|
#define prototype_build_intra_predictors(sym) \
|
|
|
|
void sym(MACROBLOCKD *x)
|
|
|
|
|
2011-04-27 19:05:10 +02:00
|
|
|
#define prototype_intra4x4_predict(sym) \
|
|
|
|
void sym(BLOCKD *x, int b_mode, unsigned char *predictor)
|
|
|
|
|
2010-10-26 17:37:23 +02:00
|
|
|
struct vp8_recon_rtcd_vtable;
|
|
|
|
|
2010-05-18 17:58:33 +02:00
|
|
|
#if ARCH_X86 || ARCH_X86_64
|
|
|
|
#include "x86/recon_x86.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ARCH_ARM
|
|
|
|
#include "arm/recon_arm.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef vp8_recon_copy16x16
|
|
|
|
#define vp8_recon_copy16x16 vp8_copy_mem16x16_c
|
|
|
|
#endif
|
|
|
|
extern prototype_copy_block(vp8_recon_copy16x16);
|
|
|
|
|
|
|
|
#ifndef vp8_recon_copy8x8
|
|
|
|
#define vp8_recon_copy8x8 vp8_copy_mem8x8_c
|
|
|
|
#endif
|
|
|
|
extern prototype_copy_block(vp8_recon_copy8x8);
|
|
|
|
|
Dual 16x16 inter prediction.
This patch introduces the concept of dual inter16x16 prediction. A
16x16 inter-predicted macroblock can use 2 references instead of 1,
where both references use the same mvmode (new, near/est, zero). In the
case of newmv, this means that two MVs are coded instead of one. The
frame can be encoded in 3 ways: all MBs single-prediction, all MBs dual
prediction, or per-MB single/dual prediction selection ("hybrid"), in
which case a single bit is coded per-MB to indicate whether the MB uses
single or dual inter prediction.
In the future, we can (maybe?) get further gains by mixing this with
Adrian's 32x32 work, per-segment dual prediction settings, or adding
support for dual splitmv/8x8mv inter prediction.
Gain (on derf-set, CQ mode) is ~2.8% (SSIM) or ~3.6% (glb PSNR). Most
gain is at medium/high bitrates, but there's minor gains at low bitrates
also. Output was confirmed to match between encoder and decoder.
Note for optimization people: this patch introduces a 2nd version of
16x16/8x8 sixtap/bilin functions, which does an avg instead of a
store. They may want to look and make sure this is implemented to
their satisfaction so we can optimize it best in the future.
Change-ID: I59dc84b07cbb3ccf073ac0f756d03d294cb19281
2011-12-06 20:53:02 +01:00
|
|
|
#if CONFIG_DUALPRED
|
|
|
|
#ifndef vp8_recon_avg16x16
|
|
|
|
#define vp8_recon_avg16x16 vp8_avg_mem16x16_c
|
|
|
|
#endif
|
|
|
|
extern prototype_copy_block(vp8_recon_avg16x16);
|
|
|
|
|
|
|
|
#ifndef vp8_recon_avg8x8
|
|
|
|
#define vp8_recon_avg8x8 vp8_avg_mem8x8_c
|
|
|
|
#endif
|
|
|
|
extern prototype_copy_block(vp8_recon_avg8x8);
|
|
|
|
#endif /* CONFIG_DUALPRED */
|
|
|
|
|
2010-05-18 17:58:33 +02:00
|
|
|
#ifndef vp8_recon_copy8x4
|
|
|
|
#define vp8_recon_copy8x4 vp8_copy_mem8x4_c
|
|
|
|
#endif
|
|
|
|
extern prototype_copy_block(vp8_recon_copy8x4);
|
|
|
|
|
|
|
|
#ifndef vp8_recon_recon
|
|
|
|
#define vp8_recon_recon vp8_recon_b_c
|
|
|
|
#endif
|
|
|
|
extern prototype_recon_block(vp8_recon_recon);
|
|
|
|
|
2011-08-05 01:30:27 +02:00
|
|
|
#ifndef vp8_recon_recon_uv
|
|
|
|
#define vp8_recon_recon_uv vp8_recon_uv_b_c
|
|
|
|
#endif
|
|
|
|
extern prototype_recon_block(vp8_recon_recon_uv);
|
|
|
|
|
|
|
|
extern prototype_recon_block(vp8_recon_recon);
|
2010-05-18 17:58:33 +02:00
|
|
|
#ifndef vp8_recon_recon2
|
|
|
|
#define vp8_recon_recon2 vp8_recon2b_c
|
|
|
|
#endif
|
|
|
|
extern prototype_recon_block(vp8_recon_recon2);
|
|
|
|
|
|
|
|
#ifndef vp8_recon_recon4
|
|
|
|
#define vp8_recon_recon4 vp8_recon4b_c
|
|
|
|
#endif
|
|
|
|
extern prototype_recon_block(vp8_recon_recon4);
|
|
|
|
|
2010-10-26 17:37:23 +02:00
|
|
|
#ifndef vp8_recon_recon_mb
|
|
|
|
#define vp8_recon_recon_mb vp8_recon_mb_c
|
|
|
|
#endif
|
|
|
|
extern prototype_recon_macroblock(vp8_recon_recon_mb);
|
|
|
|
|
|
|
|
#ifndef vp8_recon_recon_mby
|
|
|
|
#define vp8_recon_recon_mby vp8_recon_mby_c
|
|
|
|
#endif
|
|
|
|
extern prototype_recon_macroblock(vp8_recon_recon_mby);
|
|
|
|
|
2011-03-11 17:35:38 +01:00
|
|
|
#ifndef vp8_recon_build_intra_predictors_mby
|
|
|
|
#define vp8_recon_build_intra_predictors_mby vp8_build_intra_predictors_mby
|
|
|
|
#endif
|
|
|
|
extern prototype_build_intra_predictors\
|
|
|
|
(vp8_recon_build_intra_predictors_mby);
|
|
|
|
|
2011-08-05 01:30:27 +02:00
|
|
|
#ifndef vp8_recon_build_intra8x8_predictors_mby
|
|
|
|
#define vp8_recon_build_intra8x8_predictors_mby vp8_build_intra8x8_predictors_mby
|
|
|
|
#endif
|
|
|
|
extern prototype_build_intra_predictors\
|
|
|
|
(vp8_recon_build_intra8x8_predictors_mby);
|
|
|
|
|
2011-03-11 17:35:38 +01:00
|
|
|
#ifndef vp8_recon_build_intra_predictors_mby_s
|
|
|
|
#define vp8_recon_build_intra_predictors_mby_s vp8_build_intra_predictors_mby_s
|
|
|
|
#endif
|
|
|
|
extern prototype_build_intra_predictors\
|
|
|
|
(vp8_recon_build_intra_predictors_mby_s);
|
|
|
|
|
2011-04-27 19:05:10 +02:00
|
|
|
#ifndef vp8_recon_build_intra_predictors_mbuv
|
|
|
|
#define vp8_recon_build_intra_predictors_mbuv vp8_build_intra_predictors_mbuv
|
|
|
|
#endif
|
|
|
|
extern prototype_build_intra_predictors\
|
|
|
|
(vp8_recon_build_intra_predictors_mbuv);
|
|
|
|
|
2011-08-05 01:30:27 +02:00
|
|
|
#ifndef vp8_recon_build_intra8x8_predictors_mbuv
|
|
|
|
#define vp8_recon_build_intra8x8_predictors_mbuv vp8_build_intra8x8_predictors_mbuv
|
|
|
|
#endif
|
|
|
|
extern prototype_build_intra_predictors\
|
|
|
|
(vp8_recon_build_intra8x8_predictors_mbuv);
|
|
|
|
|
2011-04-27 19:05:10 +02:00
|
|
|
#ifndef vp8_recon_build_intra_predictors_mbuv_s
|
|
|
|
#define vp8_recon_build_intra_predictors_mbuv_s vp8_build_intra_predictors_mbuv_s
|
|
|
|
#endif
|
|
|
|
extern prototype_build_intra_predictors\
|
|
|
|
(vp8_recon_build_intra_predictors_mbuv_s);
|
|
|
|
|
|
|
|
#ifndef vp8_recon_intra4x4_predict
|
|
|
|
#define vp8_recon_intra4x4_predict vp8_intra4x4_predict
|
|
|
|
#endif
|
|
|
|
extern prototype_intra4x4_predict\
|
|
|
|
(vp8_recon_intra4x4_predict);
|
|
|
|
|
2011-08-05 01:30:27 +02:00
|
|
|
#ifndef vp8_recon_intra8x8_predict
|
|
|
|
#define vp8_recon_intra8x8_predict vp8_intra8x8_predict
|
|
|
|
#endif
|
|
|
|
extern prototype_intra4x4_predict\
|
|
|
|
(vp8_recon_intra8x8_predict);
|
|
|
|
|
|
|
|
#ifndef vp8_recon_intra_uv4x4_predict
|
|
|
|
#define vp8_recon_intra_uv4x4_predict vp8_intra_uv4x4_predict
|
|
|
|
#endif
|
|
|
|
extern prototype_intra4x4_predict\
|
|
|
|
(vp8_recon_intra_uv4x4_predict);
|
|
|
|
|
2010-05-18 17:58:33 +02:00
|
|
|
typedef prototype_copy_block((*vp8_copy_block_fn_t));
|
|
|
|
typedef prototype_recon_block((*vp8_recon_fn_t));
|
2010-10-26 17:37:23 +02:00
|
|
|
typedef prototype_recon_macroblock((*vp8_recon_mb_fn_t));
|
2011-03-11 17:35:38 +01:00
|
|
|
typedef prototype_build_intra_predictors((*vp8_build_intra_pred_fn_t));
|
2011-04-27 19:05:10 +02:00
|
|
|
typedef prototype_intra4x4_predict((*vp8_intra4x4_pred_fn_t));
|
2010-10-26 17:37:23 +02:00
|
|
|
typedef struct vp8_recon_rtcd_vtable
|
2010-05-18 17:58:33 +02:00
|
|
|
{
|
|
|
|
vp8_copy_block_fn_t copy16x16;
|
|
|
|
vp8_copy_block_fn_t copy8x8;
|
Dual 16x16 inter prediction.
This patch introduces the concept of dual inter16x16 prediction. A
16x16 inter-predicted macroblock can use 2 references instead of 1,
where both references use the same mvmode (new, near/est, zero). In the
case of newmv, this means that two MVs are coded instead of one. The
frame can be encoded in 3 ways: all MBs single-prediction, all MBs dual
prediction, or per-MB single/dual prediction selection ("hybrid"), in
which case a single bit is coded per-MB to indicate whether the MB uses
single or dual inter prediction.
In the future, we can (maybe?) get further gains by mixing this with
Adrian's 32x32 work, per-segment dual prediction settings, or adding
support for dual splitmv/8x8mv inter prediction.
Gain (on derf-set, CQ mode) is ~2.8% (SSIM) or ~3.6% (glb PSNR). Most
gain is at medium/high bitrates, but there's minor gains at low bitrates
also. Output was confirmed to match between encoder and decoder.
Note for optimization people: this patch introduces a 2nd version of
16x16/8x8 sixtap/bilin functions, which does an avg instead of a
store. They may want to look and make sure this is implemented to
their satisfaction so we can optimize it best in the future.
Change-ID: I59dc84b07cbb3ccf073ac0f756d03d294cb19281
2011-12-06 20:53:02 +01:00
|
|
|
#if CONFIG_DUALPRED
|
|
|
|
vp8_copy_block_fn_t avg16x16;
|
|
|
|
vp8_copy_block_fn_t avg8x8;
|
|
|
|
#endif /* CONFIG_DUALPRED */
|
2010-05-18 17:58:33 +02:00
|
|
|
vp8_copy_block_fn_t copy8x4;
|
|
|
|
vp8_recon_fn_t recon;
|
2011-08-05 01:30:27 +02:00
|
|
|
vp8_recon_fn_t recon_uv;
|
2010-05-18 17:58:33 +02:00
|
|
|
vp8_recon_fn_t recon2;
|
|
|
|
vp8_recon_fn_t recon4;
|
2010-10-26 17:37:23 +02:00
|
|
|
vp8_recon_mb_fn_t recon_mb;
|
|
|
|
vp8_recon_mb_fn_t recon_mby;
|
2011-03-11 17:35:38 +01:00
|
|
|
vp8_build_intra_pred_fn_t build_intra_predictors_mby_s;
|
|
|
|
vp8_build_intra_pred_fn_t build_intra_predictors_mby;
|
2011-04-27 19:05:10 +02:00
|
|
|
vp8_build_intra_pred_fn_t build_intra_predictors_mbuv_s;
|
|
|
|
vp8_build_intra_pred_fn_t build_intra_predictors_mbuv;
|
|
|
|
vp8_intra4x4_pred_fn_t intra4x4_predict;
|
2011-08-05 01:30:27 +02:00
|
|
|
vp8_intra4x4_pred_fn_t intra8x8_predict;
|
|
|
|
vp8_intra4x4_pred_fn_t intra_uv4x4_predict;
|
2010-05-18 17:58:33 +02:00
|
|
|
} vp8_recon_rtcd_vtable_t;
|
|
|
|
|
|
|
|
#if CONFIG_RUNTIME_CPU_DETECT
|
|
|
|
#define RECON_INVOKE(ctx,fn) (ctx)->fn
|
|
|
|
#else
|
|
|
|
#define RECON_INVOKE(ctx,fn) vp8_recon_##fn
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void vp8_recon_intra_mbuv(const vp8_recon_rtcd_vtable_t *rtcd, MACROBLOCKD *x);
|
|
|
|
#endif
|