Merge "Add quantisation matrices and selection functions."
This commit is contained in:
Коммит
ebdcd1c594
|
@ -300,6 +300,7 @@ CONFIG_LIST="
|
|||
vpx_highbitdepth
|
||||
experimental
|
||||
size_limit
|
||||
aom_qm
|
||||
${EXPERIMENT_LIST}
|
||||
"
|
||||
CMDLINE_SELECT="
|
||||
|
@ -354,6 +355,7 @@ CMDLINE_SELECT="
|
|||
coefficient_range_checking
|
||||
vpx_highbitdepth
|
||||
experimental
|
||||
aom_qm
|
||||
"
|
||||
|
||||
process_cmdline() {
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
#include "vp10/common/entropy.h"
|
||||
#include "vp10/common/entropymode.h"
|
||||
#include "vp10/common/mv.h"
|
||||
#if CONFIG_AOM_QM
|
||||
#include "vp10/common/quant_common.h"
|
||||
#endif
|
||||
#include "vp10/common/scale.h"
|
||||
#include "vp10/common/seg_common.h"
|
||||
#include "vp10/common/tile_common.h"
|
||||
|
@ -134,8 +137,14 @@ struct macroblockd_plane {
|
|||
// log2 of n4_w, n4_h
|
||||
uint8_t n4_wl, n4_hl;
|
||||
|
||||
#if CONFIG_AOM_QM
|
||||
const qm_val_t *seg_iqmatrix[MAX_SEGMENTS][2][TX_SIZES];
|
||||
#endif
|
||||
// encoder
|
||||
const int16_t *dequant;
|
||||
#if CONFIG_AOM_QM
|
||||
const qm_val_t *seg_qmatrix[MAX_SEGMENTS][2][TX_SIZES];
|
||||
#endif
|
||||
};
|
||||
|
||||
#define BLOCK_OFFSET(x, i) ((x) + (i)*16)
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "vp10/common/entropy.h"
|
||||
#include "vp10/common/entropymode.h"
|
||||
#include "vp10/common/frame_buffers.h"
|
||||
#include "vp10/common/quant_common.h"
|
||||
#include "vp10/common/tile_common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -196,6 +195,20 @@ typedef struct VP10Common {
|
|||
int16_t y_dequant[MAX_SEGMENTS][2];
|
||||
int16_t uv_dequant[MAX_SEGMENTS][2];
|
||||
|
||||
#if CONFIG_AOM_QM
|
||||
// Global quant matrix tables
|
||||
qm_val_t *giqmatrix[NUM_QM_LEVELS][2][2][TX_SIZES];
|
||||
qm_val_t *gqmatrix[NUM_QM_LEVELS][2][2][TX_SIZES];
|
||||
|
||||
// Local quant matrix tables for each frame
|
||||
qm_val_t *y_iqmatrix[MAX_SEGMENTS][2][TX_SIZES];
|
||||
qm_val_t *uv_iqmatrix[MAX_SEGMENTS][2][TX_SIZES];
|
||||
// Encoder
|
||||
qm_val_t *y_qmatrix[MAX_SEGMENTS][2][TX_SIZES];
|
||||
qm_val_t *uv_qmatrix[MAX_SEGMENTS][2][TX_SIZES];
|
||||
|
||||
#endif
|
||||
|
||||
/* We allocate a MODE_INFO struct for each macroblock, together with
|
||||
an extra row on top and column on the left to simplify prediction. */
|
||||
int mi_alloc_size;
|
||||
|
@ -373,8 +386,15 @@ static INLINE void vp10_init_macroblockd(VP10_COMMON *cm, MACROBLOCKD *xd,
|
|||
|
||||
if (xd->plane[i].plane_type == PLANE_TYPE_Y) {
|
||||
memcpy(xd->plane[i].seg_dequant, cm->y_dequant, sizeof(cm->y_dequant));
|
||||
#if CONFIG_AOM_QM
|
||||
memcpy(xd->plane[i].seg_iqmatrix, cm->y_iqmatrix, sizeof(cm->y_iqmatrix));
|
||||
#endif
|
||||
} else {
|
||||
memcpy(xd->plane[i].seg_dequant, cm->uv_dequant, sizeof(cm->uv_dequant));
|
||||
#if CONFIG_AOM_QM
|
||||
memcpy(xd->plane[i].seg_iqmatrix, cm->uv_iqmatrix,
|
||||
sizeof(cm->uv_iqmatrix));
|
||||
#endif
|
||||
}
|
||||
xd->fc = cm->fc;
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include "vpx/vpx_codec.h"
|
||||
#include "vp10/common/seg_common.h"
|
||||
#include "vp10/common/enums.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -22,12 +23,38 @@ extern "C" {
|
|||
#define MAXQ 255
|
||||
#define QINDEX_RANGE (MAXQ - MINQ + 1)
|
||||
#define QINDEX_BITS 8
|
||||
#if CONFIG_AOM_QM
|
||||
// Total number of QM sets stored
|
||||
#define NUM_QM_LEVELS 16
|
||||
/* Offset into the list of QMs. Actual number of levels used is
|
||||
(NUM_QM_LEVELS-AOM_QM_OFFSET)
|
||||
Lower value of AOM_QM_OFFSET implies more heavily weighted matrices.*/
|
||||
#define AOM_QM_FIRST 8
|
||||
#define AOM_QM_LAST NUM_QM_LEVELS
|
||||
#endif
|
||||
|
||||
struct VP10Common;
|
||||
|
||||
int16_t vp10_dc_quant(int qindex, int delta, vpx_bit_depth_t bit_depth);
|
||||
int16_t vp10_ac_quant(int qindex, int delta, vpx_bit_depth_t bit_depth);
|
||||
|
||||
int vp10_get_qindex(const struct segmentation *seg, int segment_id,
|
||||
int base_qindex);
|
||||
#if CONFIG_AOM_QM
|
||||
// Reduce the large number of quantizers to a smaller number of levels for which
|
||||
// different matrices may be defined
|
||||
static inline int aom_get_qmlevel(int qindex) {
|
||||
int qmlevel =
|
||||
(qindex * (AOM_QM_LAST - AOM_QM_FIRST) + QINDEX_RANGE / 2) / QINDEX_RANGE;
|
||||
qmlevel = VPXMIN(qmlevel + AOM_QM_FIRST, NUM_QM_LEVELS - 1);
|
||||
return qmlevel;
|
||||
}
|
||||
void aom_qm_init(struct VP10Common *cm);
|
||||
qm_val_t *aom_iqmatrix(struct VP10Common *cm, int qindex, int comp,
|
||||
int log2sizem2, int is_intra);
|
||||
qm_val_t *aom_qmatrix(struct VP10Common *cm, int qindex, int comp,
|
||||
int log2sizem2, int is_intra);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
|
|
@ -23,6 +23,11 @@ extern "C" {
|
|||
#define VPXMIN(x, y) (((x) < (y)) ? (x) : (y))
|
||||
#define VPXMAX(x, y) (((x) > (y)) ? (x) : (y))
|
||||
|
||||
#if CONFIG_AOM_QM
|
||||
typedef uint16_t qm_val_t;
|
||||
#define AOM_QM_BITS 6
|
||||
#endif
|
||||
|
||||
#if CONFIG_VPX_HIGHBITDEPTH
|
||||
// Note:
|
||||
// tran_low_t is the datatype used for final transform coefficients.
|
||||
|
|
Загрузка…
Ссылка в новой задаче