00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "libavutil/arm/cpu.h"
00023 #include "libavcodec/dsputil.h"
00024 #include "dsputil_arm.h"
00025
00026 void ff_j_rev_dct_arm(DCTELEM *data);
00027 void ff_simple_idct_arm(DCTELEM *data);
00028
00029
00030 static void (*ff_put_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size);
00031 static void (*ff_add_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size);
00032
00033 void ff_put_pixels8_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
00034 void ff_put_pixels8_x2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
00035 void ff_put_pixels8_y2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
00036 void ff_put_pixels8_xy2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
00037
00038 void ff_put_no_rnd_pixels8_x2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
00039 void ff_put_no_rnd_pixels8_y2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
00040 void ff_put_no_rnd_pixels8_xy2_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
00041
00042 void ff_put_pixels16_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
00043
00044 CALL_2X_PIXELS(ff_put_pixels16_x2_arm, ff_put_pixels8_x2_arm, 8)
00045 CALL_2X_PIXELS(ff_put_pixels16_y2_arm, ff_put_pixels8_y2_arm, 8)
00046 CALL_2X_PIXELS(ff_put_pixels16_xy2_arm, ff_put_pixels8_xy2_arm, 8)
00047 CALL_2X_PIXELS(ff_put_no_rnd_pixels16_x2_arm, ff_put_no_rnd_pixels8_x2_arm, 8)
00048 CALL_2X_PIXELS(ff_put_no_rnd_pixels16_y2_arm, ff_put_no_rnd_pixels8_y2_arm, 8)
00049 CALL_2X_PIXELS(ff_put_no_rnd_pixels16_xy2_arm, ff_put_no_rnd_pixels8_xy2_arm,8)
00050
00051 void ff_add_pixels_clamped_arm(const DCTELEM *block, uint8_t *dest,
00052 int line_size);
00053
00054
00055
00056 static void j_rev_dct_arm_put(uint8_t *dest, int line_size, DCTELEM *block)
00057 {
00058 ff_j_rev_dct_arm (block);
00059 ff_put_pixels_clamped(block, dest, line_size);
00060 }
00061 static void j_rev_dct_arm_add(uint8_t *dest, int line_size, DCTELEM *block)
00062 {
00063 ff_j_rev_dct_arm (block);
00064 ff_add_pixels_clamped(block, dest, line_size);
00065 }
00066 static void simple_idct_arm_put(uint8_t *dest, int line_size, DCTELEM *block)
00067 {
00068 ff_simple_idct_arm (block);
00069 ff_put_pixels_clamped(block, dest, line_size);
00070 }
00071 static void simple_idct_arm_add(uint8_t *dest, int line_size, DCTELEM *block)
00072 {
00073 ff_simple_idct_arm (block);
00074 ff_add_pixels_clamped(block, dest, line_size);
00075 }
00076
00077 void ff_dsputil_init_arm(DSPContext* c, AVCodecContext *avctx)
00078 {
00079 const int high_bit_depth = avctx->bits_per_raw_sample > 8;
00080 int cpu_flags = av_get_cpu_flags();
00081
00082 ff_put_pixels_clamped = c->put_pixels_clamped;
00083 ff_add_pixels_clamped = c->add_pixels_clamped;
00084
00085 if (!avctx->lowres && avctx->bits_per_raw_sample <= 8) {
00086 if(avctx->idct_algo == FF_IDCT_AUTO ||
00087 avctx->idct_algo == FF_IDCT_ARM){
00088 c->idct_put = j_rev_dct_arm_put;
00089 c->idct_add = j_rev_dct_arm_add;
00090 c->idct = ff_j_rev_dct_arm;
00091 c->idct_permutation_type = FF_LIBMPEG2_IDCT_PERM;
00092 } else if (avctx->idct_algo == FF_IDCT_SIMPLEARM){
00093 c->idct_put = simple_idct_arm_put;
00094 c->idct_add = simple_idct_arm_add;
00095 c->idct = ff_simple_idct_arm;
00096 c->idct_permutation_type = FF_NO_IDCT_PERM;
00097 }
00098 }
00099
00100 c->add_pixels_clamped = ff_add_pixels_clamped_arm;
00101
00102 if (!high_bit_depth) {
00103 c->put_pixels_tab[0][0] = ff_put_pixels16_arm;
00104 c->put_pixels_tab[0][1] = ff_put_pixels16_x2_arm;
00105 c->put_pixels_tab[0][2] = ff_put_pixels16_y2_arm;
00106 c->put_pixels_tab[0][3] = ff_put_pixels16_xy2_arm;
00107 c->put_pixels_tab[1][0] = ff_put_pixels8_arm;
00108 c->put_pixels_tab[1][1] = ff_put_pixels8_x2_arm;
00109 c->put_pixels_tab[1][2] = ff_put_pixels8_y2_arm;
00110 c->put_pixels_tab[1][3] = ff_put_pixels8_xy2_arm;
00111
00112 c->put_no_rnd_pixels_tab[0][0] = ff_put_pixels16_arm;
00113 c->put_no_rnd_pixels_tab[0][1] = ff_put_no_rnd_pixels16_x2_arm;
00114 c->put_no_rnd_pixels_tab[0][2] = ff_put_no_rnd_pixels16_y2_arm;
00115 c->put_no_rnd_pixels_tab[0][3] = ff_put_no_rnd_pixels16_xy2_arm;
00116 c->put_no_rnd_pixels_tab[1][0] = ff_put_pixels8_arm;
00117 c->put_no_rnd_pixels_tab[1][1] = ff_put_no_rnd_pixels8_x2_arm;
00118 c->put_no_rnd_pixels_tab[1][2] = ff_put_no_rnd_pixels8_y2_arm;
00119 c->put_no_rnd_pixels_tab[1][3] = ff_put_no_rnd_pixels8_xy2_arm;
00120 }
00121
00122 if (have_armv5te(cpu_flags)) ff_dsputil_init_armv5te(c, avctx);
00123 if (have_armv6(cpu_flags)) ff_dsputil_init_armv6(c, avctx);
00124 if (have_vfp(cpu_flags)) ff_dsputil_init_vfp(c, avctx);
00125 if (have_neon(cpu_flags)) ff_dsputil_init_neon(c, avctx);
00126 }