diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-04-22 04:24:08 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-04-22 04:29:12 +0400 |
commit | de9fbf3dc41abb8eb7a70b8a6bbfce64cee21bc5 (patch) | |
tree | 0042cde101be2ba988febdada6ea417870fd44ba /libavcodec | |
parent | 4ac2da37938354d305178da91d3e3718334de4a5 (diff) |
indeo4: implement haar 8x1 and 1x8 transforms
Fixes Ticket1984
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/indeo4.c | 4 | ||||
-rw-r--r-- | libavcodec/ivi_dsp.c | 54 | ||||
-rw-r--r-- | libavcodec/ivi_dsp.h | 4 |
3 files changed, 60 insertions, 2 deletions
diff --git a/libavcodec/indeo4.c b/libavcodec/indeo4.c index a958b50db5..5b107fb109 100644 --- a/libavcodec/indeo4.c +++ b/libavcodec/indeo4.c @@ -56,8 +56,8 @@ static const struct { int is_2d_trans; } transforms[18] = { { ff_ivi_inverse_haar_8x8, ff_ivi_dc_haar_2d, 1 }, - { NULL, NULL, 0 }, /* inverse Haar 8x1 */ - { NULL, NULL, 0 }, /* inverse Haar 1x8 */ + { ff_ivi_inverse_haar_8x1, ff_ivi_dc_haar_2d, 1 }, + { ff_ivi_inverse_haar_1x8, ff_ivi_dc_haar_2d, 1 }, { ff_ivi_put_pixels_8x8, ff_ivi_put_dc_pixel_8x8, 1 }, { ff_ivi_inverse_slant_8x8, ff_ivi_dc_slant_2d, 1 }, { ff_ivi_row_slant8, ff_ivi_dc_row_slant, 1 }, diff --git a/libavcodec/ivi_dsp.c b/libavcodec/ivi_dsp.c index 84e2436446..9c35aa0357 100644 --- a/libavcodec/ivi_dsp.c +++ b/libavcodec/ivi_dsp.c @@ -320,6 +320,60 @@ void ff_ivi_inverse_haar_8x8(const int32_t *in, int16_t *out, uint32_t pitch, #undef COMPENSATE } +void ff_ivi_inverse_haar_1x8(const int32_t *in, int16_t *out, uint32_t pitch, + const uint8_t *flags) +{ + int i; + const int32_t *src; + int t0, t1, t2, t3, t4, t5, t6, t7, t8; + + /* apply the InvHaar8 to all columns */ +#define COMPENSATE(x) (x) + src = in; + for (i = 0; i < 8; i++) { + if (flags[i]) { + INV_HAAR8(src[ 0], src[ 8], src[16], src[24], + src[32], src[40], src[48], src[56], + out[ 0], out[pitch], out[2*pitch], out[3*pitch], + out[4*pitch], out[5*pitch], out[6*pitch], out[7*pitch], + t0, t1, t2, t3, t4, t5, t6, t7, t8); + } else + out[ 0]= out[ pitch]= out[2*pitch]= out[3*pitch]= + out[4*pitch]= out[5*pitch]= out[6*pitch]= out[7*pitch]= 0; + + src++; + out++; + } +#undef COMPENSATE +} + +void ff_ivi_inverse_haar_8x1(const int32_t *in, int16_t *out, uint32_t pitch, + const uint8_t *flags) +{ + int i; + const int32_t *src; + int t0, t1, t2, t3, t4, t5, t6, t7, t8; + + /* apply the InvHaar8 to all rows */ +#define COMPENSATE(x) (x) + src = in; + for (i = 0; i < 8; i++) { + if ( !src[0] && !src[1] && !src[2] && !src[3] + && !src[4] && !src[5] && !src[6] && !src[7]) { + memset(out, 0, 8 * sizeof(out[0])); + } else { + INV_HAAR8(src[0], src[1], src[2], src[3], + src[4], src[5], src[6], src[7], + out[0], out[1], out[2], out[3], + out[4], out[5], out[6], out[7], + t0, t1, t2, t3, t4, t5, t6, t7, t8); + } + src += 8; + out += pitch; + } +#undef COMPENSATE +} + void ff_ivi_dc_haar_2d(const int32_t *in, int16_t *out, uint32_t pitch, int blk_size) { diff --git a/libavcodec/ivi_dsp.h b/libavcodec/ivi_dsp.h index e95bb117d9..748b3f4f55 100644 --- a/libavcodec/ivi_dsp.h +++ b/libavcodec/ivi_dsp.h @@ -64,6 +64,10 @@ void ff_ivi_recompose_haar(const IVIPlaneDesc *plane, uint8_t *dst, */ void ff_ivi_inverse_haar_8x8(const int32_t *in, int16_t *out, uint32_t pitch, const uint8_t *flags); +void ff_ivi_inverse_haar_8x1(const int32_t *in, int16_t *out, uint32_t pitch, + const uint8_t *flags); +void ff_ivi_inverse_haar_1x8(const int32_t *in, int16_t *out, uint32_t pitch, + const uint8_t *flags); /** * DC-only two-dimensional inverse Haar transform for Indeo 4. |