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
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "vpx_ports/config.h"
|
|
|
|
#include "recon.h"
|
|
|
|
#include "blockd.h"
|
2011-07-20 23:21:24 +02:00
|
|
|
|
2010-05-18 17:58:33 +02:00
|
|
|
void vp8_recon_b_c
|
|
|
|
(
|
|
|
|
unsigned char *pred_ptr,
|
|
|
|
short *diff_ptr,
|
|
|
|
unsigned char *dst_ptr,
|
|
|
|
int stride
|
|
|
|
)
|
|
|
|
{
|
|
|
|
int r, c;
|
|
|
|
|
|
|
|
for (r = 0; r < 4; r++)
|
|
|
|
{
|
|
|
|
for (c = 0; c < 4; c++)
|
|
|
|
{
|
|
|
|
int a = diff_ptr[c] + pred_ptr[c] ;
|
|
|
|
|
|
|
|
if (a < 0)
|
|
|
|
a = 0;
|
|
|
|
|
|
|
|
if (a > 255)
|
|
|
|
a = 255;
|
|
|
|
|
|
|
|
dst_ptr[c] = (unsigned char) a ;
|
|
|
|
}
|
|
|
|
|
|
|
|
dst_ptr += stride;
|
|
|
|
diff_ptr += 16;
|
|
|
|
pred_ptr += 16;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-05 01:30:27 +02:00
|
|
|
void vp8_recon_uv_b_c
|
|
|
|
(
|
|
|
|
unsigned char *pred_ptr,
|
|
|
|
short *diff_ptr,
|
|
|
|
unsigned char *dst_ptr,
|
|
|
|
int stride
|
|
|
|
)
|
|
|
|
{
|
|
|
|
int r, c;
|
|
|
|
|
|
|
|
for (r = 0; r < 4; r++)
|
|
|
|
{
|
|
|
|
for (c = 0; c < 4; c++)
|
|
|
|
{
|
|
|
|
int a = diff_ptr[c] + pred_ptr[c] ;
|
|
|
|
|
|
|
|
if (a < 0)
|
|
|
|
a = 0;
|
|
|
|
|
|
|
|
if (a > 255)
|
|
|
|
a = 255;
|
|
|
|
|
|
|
|
dst_ptr[c] = (unsigned char) a ;
|
|
|
|
}
|
|
|
|
|
|
|
|
dst_ptr += stride;
|
|
|
|
diff_ptr += 8;
|
|
|
|
pred_ptr += 8;
|
|
|
|
}
|
|
|
|
}
|
2010-05-18 17:58:33 +02:00
|
|
|
void vp8_recon4b_c
|
|
|
|
(
|
|
|
|
unsigned char *pred_ptr,
|
|
|
|
short *diff_ptr,
|
|
|
|
unsigned char *dst_ptr,
|
|
|
|
int stride
|
|
|
|
)
|
|
|
|
{
|
|
|
|
int r, c;
|
|
|
|
|
|
|
|
for (r = 0; r < 4; r++)
|
|
|
|
{
|
|
|
|
for (c = 0; c < 16; c++)
|
|
|
|
{
|
|
|
|
int a = diff_ptr[c] + pred_ptr[c] ;
|
|
|
|
|
|
|
|
if (a < 0)
|
|
|
|
a = 0;
|
|
|
|
|
|
|
|
if (a > 255)
|
|
|
|
a = 255;
|
|
|
|
|
|
|
|
dst_ptr[c] = (unsigned char) a ;
|
|
|
|
}
|
|
|
|
|
|
|
|
dst_ptr += stride;
|
|
|
|
diff_ptr += 16;
|
|
|
|
pred_ptr += 16;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void vp8_recon2b_c
|
|
|
|
(
|
|
|
|
unsigned char *pred_ptr,
|
|
|
|
short *diff_ptr,
|
|
|
|
unsigned char *dst_ptr,
|
|
|
|
int stride
|
|
|
|
)
|
|
|
|
{
|
|
|
|
int r, c;
|
|
|
|
|
|
|
|
for (r = 0; r < 4; r++)
|
|
|
|
{
|
|
|
|
for (c = 0; c < 8; c++)
|
|
|
|
{
|
|
|
|
int a = diff_ptr[c] + pred_ptr[c] ;
|
|
|
|
|
|
|
|
if (a < 0)
|
|
|
|
a = 0;
|
|
|
|
|
|
|
|
if (a > 255)
|
|
|
|
a = 255;
|
|
|
|
|
|
|
|
dst_ptr[c] = (unsigned char) a ;
|
|
|
|
}
|
|
|
|
|
|
|
|
dst_ptr += stride;
|
|
|
|
diff_ptr += 8;
|
|
|
|
pred_ptr += 8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-26 17:37:23 +02:00
|
|
|
void vp8_recon_mby_c(const vp8_recon_rtcd_vtable_t *rtcd, MACROBLOCKD *x)
|
2010-05-18 17:58:33 +02:00
|
|
|
{
|
2010-10-26 15:51:35 +02:00
|
|
|
#if ARCH_ARM
|
|
|
|
BLOCKD *b = &x->block[0];
|
|
|
|
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
|
|
|
|
2010-10-28 01:04:02 +02:00
|
|
|
/*b = &x->block[4];*/
|
2010-10-26 15:51:35 +02:00
|
|
|
b += 4;
|
|
|
|
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
|
|
|
|
2010-10-28 01:04:02 +02:00
|
|
|
/*b = &x->block[8];*/
|
2010-10-26 15:51:35 +02:00
|
|
|
b += 4;
|
|
|
|
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
|
|
|
|
2010-10-28 01:04:02 +02:00
|
|
|
/*b = &x->block[12];*/
|
2010-10-26 15:51:35 +02:00
|
|
|
b += 4;
|
|
|
|
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
|
|
|
#else
|
2010-05-18 17:58:33 +02:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 16; i += 4)
|
|
|
|
{
|
|
|
|
BLOCKD *b = &x->block[i];
|
|
|
|
|
|
|
|
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
|
|
|
}
|
2010-10-26 15:51:35 +02:00
|
|
|
#endif
|
2010-05-18 17:58:33 +02:00
|
|
|
}
|
|
|
|
|
2010-10-26 17:37:23 +02:00
|
|
|
void vp8_recon_mb_c(const vp8_recon_rtcd_vtable_t *rtcd, MACROBLOCKD *x)
|
2010-05-18 17:58:33 +02:00
|
|
|
{
|
2010-10-26 15:51:35 +02:00
|
|
|
#if ARCH_ARM
|
|
|
|
BLOCKD *b = &x->block[0];
|
|
|
|
|
|
|
|
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
|
|
|
b += 4;
|
|
|
|
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
|
|
|
b += 4;
|
|
|
|
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
|
|
|
b += 4;
|
|
|
|
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
|
|
|
b += 4;
|
|
|
|
|
2010-10-28 01:04:02 +02:00
|
|
|
/*b = &x->block[16];*/
|
2010-10-26 15:51:35 +02:00
|
|
|
|
|
|
|
RECON_INVOKE(rtcd, recon2)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
|
|
|
b++;
|
|
|
|
b++;
|
|
|
|
RECON_INVOKE(rtcd, recon2)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
|
|
|
b++;
|
|
|
|
b++;
|
|
|
|
RECON_INVOKE(rtcd, recon2)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
|
|
|
b++;
|
|
|
|
b++;
|
|
|
|
RECON_INVOKE(rtcd, recon2)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
|
|
|
#else
|
2010-05-18 17:58:33 +02:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 16; i += 4)
|
|
|
|
{
|
|
|
|
BLOCKD *b = &x->block[i];
|
|
|
|
|
|
|
|
RECON_INVOKE(rtcd, recon4)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 16; i < 24; i += 2)
|
|
|
|
{
|
|
|
|
BLOCKD *b = &x->block[i];
|
|
|
|
|
|
|
|
RECON_INVOKE(rtcd, recon2)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
|
|
|
|
}
|
2010-10-26 15:51:35 +02:00
|
|
|
#endif
|
2010-05-18 17:58:33 +02:00
|
|
|
}
|