Commit e7a972e1 authored by Mans Rullgard's avatar Mans Rullgard

simple_idct: add 10-bit version

Signed-off-by: 's avatarMans Rullgard <mans@mansr.com>
parent 7b4ee3a2
......@@ -335,7 +335,7 @@ void dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx)
put_pixels_clamped_axp_p = c->put_pixels_clamped;
add_pixels_clamped_axp_p = c->add_pixels_clamped;
if (!avctx->lowres &&
if (!avctx->lowres && avctx->bits_per_raw_sample <= 8 &&
(avctx->idct_algo == FF_IDCT_AUTO ||
avctx->idct_algo == FF_IDCT_SIMPLEALPHA)) {
c->idct_put = ff_simple_idct_put_axp;
......
......@@ -80,7 +80,7 @@ void dsputil_init_arm(DSPContext* c, AVCodecContext *avctx)
ff_put_pixels_clamped = c->put_pixels_clamped;
ff_add_pixels_clamped = c->add_pixels_clamped;
if (!avctx->lowres) {
if (!avctx->lowres && avctx->bits_per_raw_sample <= 8) {
if(avctx->idct_algo == FF_IDCT_AUTO ||
avctx->idct_algo == FF_IDCT_ARM){
c->idct_put = j_rev_dct_arm_put;
......
......@@ -29,8 +29,9 @@ void ff_prefetch_arm(void *mem, int stride, int h);
void av_cold ff_dsputil_init_armv5te(DSPContext* c, AVCodecContext *avctx)
{
if (!avctx->lowres && (avctx->idct_algo == FF_IDCT_AUTO ||
avctx->idct_algo == FF_IDCT_SIMPLEARMV5TE)) {
if (!avctx->lowres && avctx->bits_per_raw_sample <= 8 &&
(avctx->idct_algo == FF_IDCT_AUTO ||
avctx->idct_algo == FF_IDCT_SIMPLEARMV5TE)) {
c->idct_put = ff_simple_idct_put_armv5te;
c->idct_add = ff_simple_idct_add_armv5te;
c->idct = ff_simple_idct_armv5te;
......
......@@ -74,8 +74,9 @@ void av_cold ff_dsputil_init_armv6(DSPContext* c, AVCodecContext *avctx)
{
const int high_bit_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
if (!avctx->lowres && (avctx->idct_algo == FF_IDCT_AUTO ||
avctx->idct_algo == FF_IDCT_SIMPLEARMV6)) {
if (!avctx->lowres && avctx->bits_per_raw_sample <= 8 &&
(avctx->idct_algo == FF_IDCT_AUTO ||
avctx->idct_algo == FF_IDCT_SIMPLEARMV6)) {
c->idct_put = ff_simple_idct_put_armv6;
c->idct_add = ff_simple_idct_add_armv6;
c->idct = ff_simple_idct_armv6;
......
......@@ -177,7 +177,7 @@ void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx)
{
const int high_bit_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
if (!avctx->lowres) {
if (!avctx->lowres && avctx->bits_per_raw_sample <= 8) {
if (avctx->idct_algo == FF_IDCT_AUTO ||
avctx->idct_algo == FF_IDCT_SIMPLENEON) {
c->idct_put = ff_simple_idct_put_neon;
......
......@@ -256,16 +256,18 @@ void dsputil_init_bfin( DSPContext* c, AVCodecContext *avctx )
if (avctx->dct_algo == FF_DCT_AUTO)
c->fdct = ff_bfin_fdct;
if (avctx->idct_algo==FF_IDCT_VP3) {
c->idct_permutation_type = FF_NO_IDCT_PERM;
c->idct = ff_bfin_vp3_idct;
c->idct_add = ff_bfin_vp3_idct_add;
c->idct_put = ff_bfin_vp3_idct_put;
} else if (avctx->idct_algo == FF_IDCT_AUTO) {
c->idct_permutation_type = FF_NO_IDCT_PERM;
c->idct = ff_bfin_idct;
c->idct_add = bfin_idct_add;
c->idct_put = bfin_idct_put;
if (avctx->bits_per_raw_sample <= 8) {
if (avctx->idct_algo == FF_IDCT_VP3) {
c->idct_permutation_type = FF_NO_IDCT_PERM;
c->idct = ff_bfin_vp3_idct;
c->idct_add = ff_bfin_vp3_idct_add;
c->idct_put = ff_bfin_vp3_idct_put;
} else if (avctx->idct_algo == FF_IDCT_AUTO) {
c->idct_permutation_type = FF_NO_IDCT_PERM;
c->idct = ff_bfin_idct;
c->idct_add = bfin_idct_add;
c->idct_put = bfin_idct_put;
}
}
}
......
......@@ -111,7 +111,7 @@ static const struct algo idct_tab[] = {
{ "FAANI", ff_faanidct, NO_PERM },
{ "REF-DBL", ff_ref_idct, NO_PERM },
{ "INT", j_rev_dct, MMX_PERM },
{ "SIMPLE-C", ff_simple_idct, NO_PERM },
{ "SIMPLE-C", ff_simple_idct_8, NO_PERM },
#if HAVE_MMX
#if CONFIG_GPL
......
......@@ -2237,7 +2237,7 @@ static int quant_psnr8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *s
s->block_last_index[0/*FIXME*/]= s->fast_dct_quantize(s, temp, 0/*FIXME*/, s->qscale, &i);
s->dct_unquantize_inter(s, temp, 0, s->qscale);
ff_simple_idct(temp); //FIXME
ff_simple_idct_8(temp); //FIXME
for(i=0; i<64; i++)
sum+= (temp[i]-bak[i])*(temp[i]-bak[i]);
......@@ -2878,6 +2878,12 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
c->idct = j_rev_dct1;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else{
if (avctx->bits_per_raw_sample == 10) {
c->idct_put = ff_simple_idct_put_10;
c->idct_add = ff_simple_idct_add_10;
c->idct = ff_simple_idct_10;
c->idct_permutation_type = FF_NO_IDCT_PERM;
} else {
if(avctx->idct_algo==FF_IDCT_INT){
c->idct_put= ff_jref_idct_put;
c->idct_add= ff_jref_idct_add;
......@@ -2908,11 +2914,12 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
c->idct_put = ff_bink_idct_put_c;
c->idct_permutation_type = FF_NO_IDCT_PERM;
}else{ //accurate/default
c->idct_put= ff_simple_idct_put;
c->idct_add= ff_simple_idct_add;
c->idct = ff_simple_idct;
c->idct_put = ff_simple_idct_put_8;
c->idct_add = ff_simple_idct_add_8;
c->idct = ff_simple_idct_8;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}
}
}
c->get_pixels = get_pixels_c;
......
......@@ -178,7 +178,7 @@ void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx)
}
#endif //CONFIG_ENCODERS
if (avctx->lowres==0) {
if (avctx->lowres == 0 && avctx->bits_per_raw_sample <= 8) {
if ((avctx->idct_algo == FF_IDCT_AUTO) ||
(avctx->idct_algo == FF_IDCT_ALTIVEC)) {
c->idct_put = idct_put_altivec;
......
......@@ -156,7 +156,8 @@ void dsputil_init_mmi(DSPContext* c, AVCodecContext *avctx)
c->get_pixels = get_pixels_mmi;
if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_PS2){
if (avctx->bits_per_raw_sample <= 8 &&
(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_PS2)) {
c->idct_put= ff_mmi_idct_put;
c->idct_add= ff_mmi_idct_add;
c->idct = ff_mmi_idct;
......
......@@ -97,7 +97,8 @@ void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx)
if (!high_bit_depth)
c->clear_blocks = clear_blocks_sh4;
if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_SH4){
if (avctx->bits_per_raw_sample <= 8 &&
(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_SH4)) {
c->idct_put = idct_put;
c->idct_add = idct_add;
c->idct = idct_sh4;
......
This diff is collapsed.
......@@ -31,12 +31,17 @@
#include <stdint.h>
#include "dsputil.h"
void ff_simple_idct_put(uint8_t *dest, int line_size, DCTELEM *block);
void ff_simple_idct_add(uint8_t *dest, int line_size, DCTELEM *block);
void ff_simple_idct_put_8(uint8_t *dest, int line_size, DCTELEM *block);
void ff_simple_idct_add_8(uint8_t *dest, int line_size, DCTELEM *block);
void ff_simple_idct_8(DCTELEM *block);
void ff_simple_idct_put_10(uint8_t *dest, int line_size, DCTELEM *block);
void ff_simple_idct_add_10(uint8_t *dest, int line_size, DCTELEM *block);
void ff_simple_idct_10(DCTELEM *block);
void ff_simple_idct_mmx(int16_t *block);
void ff_simple_idct_add_mmx(uint8_t *dest, int line_size, int16_t *block);
void ff_simple_idct_put_mmx(uint8_t *dest, int line_size, int16_t *block);
void ff_simple_idct(DCTELEM *block);
void ff_simple_idct248_put(uint8_t *dest, int line_size, DCTELEM *block);
......
This diff is collapsed.
......@@ -3956,7 +3956,8 @@ void dsputil_init_vis(DSPContext* c, AVCodecContext *avctx)
const int high_bit_depth = avctx->codec_id == CODEC_ID_H264 && avctx->bits_per_raw_sample > 8;
if (accel & ACCEL_SPARC_VIS) {
if(avctx->idct_algo==FF_IDCT_SIMPLEVIS){
if (avctx->bits_per_raw_sample <= 8 &&
avctx->idct_algo == FF_IDCT_SIMPLEVIS) {
c->idct_put = ff_simple_idct_put_vis;
c->idct_add = ff_simple_idct_add_vis;
c->idct = ff_simple_idct_vis;
......
......@@ -337,11 +337,11 @@ int vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitConte
v->res_fasttx = get_bits1(gb);
if (!v->res_fasttx)
{
v->vc1dsp.vc1_inv_trans_8x8 = ff_simple_idct;
v->vc1dsp.vc1_inv_trans_8x8 = ff_simple_idct_8;
v->vc1dsp.vc1_inv_trans_8x4 = ff_simple_idct84_add;
v->vc1dsp.vc1_inv_trans_4x8 = ff_simple_idct48_add;
v->vc1dsp.vc1_inv_trans_4x4 = ff_simple_idct44_add;
v->vc1dsp.vc1_inv_trans_8x8_dc = ff_simple_idct_add;
v->vc1dsp.vc1_inv_trans_8x8_dc = ff_simple_idct_add_8;
v->vc1dsp.vc1_inv_trans_8x4_dc = ff_simple_idct84_add;
v->vc1dsp.vc1_inv_trans_4x8_dc = ff_simple_idct48_add;
v->vc1dsp.vc1_inv_trans_4x4_dc = ff_simple_idct44_add;
......
......@@ -2465,7 +2465,7 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
if (mm_flags & AV_CPU_FLAG_MMX) {
const int idct_algo= avctx->idct_algo;
if(avctx->lowres==0){
if (avctx->lowres == 0 && avctx->bits_per_raw_sample <= 8) {
if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_SIMPLEMMX){
c->idct_put= ff_simple_idct_put_mmx;
c->idct_add= ff_simple_idct_add_mmx;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment