示例#1
0
文件: vgetQ_lanes8.c 项目: pjump/gcc
void test_vgetQ_lanes8 (void)
{
    int8_t out_int8_t;
    int8x16_t arg0_int8x16_t;

    out_int8_t = vgetq_lane_s8 (arg0_int8x16_t, 1);
}
示例#2
0
int32_t test_vgetq_lane_s8(int8x16_t v1) {
  // CHECK: test_vgetq_lane_s8
  return vgetq_lane_s8(v1, 15)+1;
  // CHECK: smov {{w[0-9]+}}, {{v[0-9]+}}.b[15]
}
示例#3
0
int vp8_denoiser_filter_neon(YV12_BUFFER_CONFIG *mc_running_avg,
                             YV12_BUFFER_CONFIG *running_avg,
                             MACROBLOCK *signal, unsigned int motion_magnitude,
                             int y_offset, int uv_offset) {
    /* If motion_magnitude is small, making the denoiser more aggressive by
     * increasing the adjustment for each level, level1 adjustment is
     * increased, the deltas stay the same.
     */
    const uint8x16_t v_level1_adjustment = vdupq_n_u8(
        (motion_magnitude <= MOTION_MAGNITUDE_THRESHOLD) ? 4 : 3);
    const uint8x16_t v_delta_level_1_and_2 = vdupq_n_u8(1);
    const uint8x16_t v_delta_level_2_and_3 = vdupq_n_u8(2);
    const uint8x16_t v_level1_threshold = vdupq_n_u8(4);
    const uint8x16_t v_level2_threshold = vdupq_n_u8(8);
    const uint8x16_t v_level3_threshold = vdupq_n_u8(16);

    /* Local variables for array pointers and strides. */
    unsigned char *sig = signal->thismb;
    int            sig_stride = 16;
    unsigned char *mc_running_avg_y = mc_running_avg->y_buffer + y_offset;
    int            mc_running_avg_y_stride = mc_running_avg->y_stride;
    unsigned char *running_avg_y = running_avg->y_buffer + y_offset;
    int            running_avg_y_stride = running_avg->y_stride;

    /* Go over lines. */
    int i;
    int sum_diff = 0;
    for (i = 0; i < 16; ++i) {
        int8x16_t v_sum_diff = vdupq_n_s8(0);
        uint8x16_t v_running_avg_y;

        /* Load inputs. */
        const uint8x16_t v_sig = vld1q_u8(sig);
        const uint8x16_t v_mc_running_avg_y = vld1q_u8(mc_running_avg_y);

        /* Calculate absolute difference and sign masks. */
        const uint8x16_t v_abs_diff      = vabdq_u8(v_sig, v_mc_running_avg_y);
        const uint8x16_t v_diff_pos_mask = vcltq_u8(v_sig, v_mc_running_avg_y);
        const uint8x16_t v_diff_neg_mask = vcgtq_u8(v_sig, v_mc_running_avg_y);

        /* Figure out which level that put us in. */
        const uint8x16_t v_level1_mask = vcleq_u8(v_level1_threshold,
                                                  v_abs_diff);
        const uint8x16_t v_level2_mask = vcleq_u8(v_level2_threshold,
                                                  v_abs_diff);
        const uint8x16_t v_level3_mask = vcleq_u8(v_level3_threshold,
                                                  v_abs_diff);

        /* Calculate absolute adjustments for level 1, 2 and 3. */
        const uint8x16_t v_level2_adjustment = vandq_u8(v_level2_mask,
                                                        v_delta_level_1_and_2);
        const uint8x16_t v_level3_adjustment = vandq_u8(v_level3_mask,
                                                        v_delta_level_2_and_3);
        const uint8x16_t v_level1and2_adjustment = vaddq_u8(v_level1_adjustment,
            v_level2_adjustment);
        const uint8x16_t v_level1and2and3_adjustment = vaddq_u8(
            v_level1and2_adjustment, v_level3_adjustment);

        /* Figure adjustment absolute value by selecting between the absolute
         * difference if in level0 or the value for level 1, 2 and 3.
         */
        const uint8x16_t v_abs_adjustment = vbslq_u8(v_level1_mask,
            v_level1and2and3_adjustment, v_abs_diff);

        /* Calculate positive and negative adjustments. Apply them to the signal
         * and accumulate them. Adjustments are less than eight and the maximum
         * sum of them (7 * 16) can fit in a signed char.
         */
        const uint8x16_t v_pos_adjustment = vandq_u8(v_diff_pos_mask,
                                                     v_abs_adjustment);
        const uint8x16_t v_neg_adjustment = vandq_u8(v_diff_neg_mask,
                                                     v_abs_adjustment);
        v_running_avg_y = vqaddq_u8(v_sig, v_pos_adjustment);
        v_running_avg_y = vqsubq_u8(v_running_avg_y, v_neg_adjustment);
        v_sum_diff = vqaddq_s8(v_sum_diff,
                               vreinterpretq_s8_u8(v_pos_adjustment));
        v_sum_diff = vqsubq_s8(v_sum_diff,
                               vreinterpretq_s8_u8(v_neg_adjustment));

        /* Store results. */
        vst1q_u8(running_avg_y, v_running_avg_y);

        /* Sum all the accumulators to have the sum of all pixel differences
         * for this macroblock.
         */
        {
            int s0 = vgetq_lane_s8(v_sum_diff,  0) +
                     vgetq_lane_s8(v_sum_diff,  1) +
                     vgetq_lane_s8(v_sum_diff,  2) +
                     vgetq_lane_s8(v_sum_diff,  3);
            int s1 = vgetq_lane_s8(v_sum_diff,  4) +
                     vgetq_lane_s8(v_sum_diff,  5) +
                     vgetq_lane_s8(v_sum_diff,  6) +
                     vgetq_lane_s8(v_sum_diff,  7);
            int s2 = vgetq_lane_s8(v_sum_diff,  8) +
                     vgetq_lane_s8(v_sum_diff,  9) +
                     vgetq_lane_s8(v_sum_diff, 10) +
                     vgetq_lane_s8(v_sum_diff, 11);
            int s3 = vgetq_lane_s8(v_sum_diff, 12) +
                     vgetq_lane_s8(v_sum_diff, 13) +
                     vgetq_lane_s8(v_sum_diff, 14) +
                     vgetq_lane_s8(v_sum_diff, 15);
            sum_diff += s0 + s1+ s2 + s3;
        }

        /* Update pointers for next iteration. */
        sig += sig_stride;
        mc_running_avg_y += mc_running_avg_y_stride;
        running_avg_y += running_avg_y_stride;
    }

    /* Too much adjustments => copy block. */
    if (abs(sum_diff) > SUM_DIFF_THRESHOLD)
        return COPY_BLOCK;

    /* Tell above level that block was filtered. */
    vp8_copy_mem16x16(running_avg->y_buffer + y_offset, running_avg_y_stride,
                      signal->thismb, sig_stride);
    return FILTER_BLOCK;
}
示例#4
0
int8_t test_vgetq_lane_s8(int8x16_t a) {
  // CHECK-LABEL: test_vgetq_lane_s8:
  // CHECK-NEXT:  umov.b w0, v0[15]
  // CHECK-NEXT:  ret
  return vgetq_lane_s8(a, 15);
}
示例#5
0
/* s8x16 mv mul */
void mw_neon_mv_mul_s8x16(signed char * A, int Row, int T, signed char * B, signed char * C)
{
	int i = 0;
	int k = 0;

	int8x16_t neon_b, neon_c;
	int8x16_t neon_a0, neon_a1, neon_a2, neon_a3, neon_a4, neon_a5, neon_a6, neon_a7;
	int8x16_t neon_a8, neon_a9, neon_a10, neon_a11, neon_a12, neon_a13, neon_a14, neon_a15;
	int8x16_t neon_b0, neon_b1, neon_b2, neon_b3, neon_b4, neon_b5, neon_b6, neon_b7;
	int8x16_t neon_b8, neon_b9, neon_b10, neon_b11, neon_b12, neon_b13, neon_b14, neon_b15;

	for (i = 0; i < Row; i+=16)
	{
		neon_c = vmovq_n_s8(0);

		for (k = 0; k < T; k+=16)
		{
			int j = k * T + i;

			neon_a0 = vld1q_s8(A + j);
			j+=Row;
			neon_a1 = vld1q_s8(A + j);
			j+=Row;
			neon_a2 = vld1q_s8(A + j);
			j+=Row;
			neon_a3 = vld1q_s8(A + j);
			j+=Row;
			neon_a4 = vld1q_s8(A + j);
			j+=Row;
			neon_a5 = vld1q_s8(A + j);
			j+=Row;
			neon_a6 = vld1q_s8(A + j);
			j+=Row;
			neon_a7 = vld1q_s8(A + j);
			j+=Row;
			neon_a8 = vld1q_s8(A + j);
			j+=Row;
			neon_a9 = vld1q_s8(A + j);
			j+=Row;
			neon_a10 = vld1q_s8(A + j);
			j+=Row;
			neon_a11 = vld1q_s8(A + j);
			j+=Row;
			neon_a12 = vld1q_s8(A + j);
			j+=Row;
			neon_a13 = vld1q_s8(A + j);
			j+=Row;
			neon_a14 = vld1q_s8(A + j);
			j+=Row;
			neon_a15 = vld1q_s8(A + j);

			neon_b = vld1q_s8(B + k);
			neon_b0 = vdupq_n_s8(vgetq_lane_s8(neon_b, 0));
			neon_b1 = vdupq_n_s8(vgetq_lane_s8(neon_b, 1));
			neon_b2 = vdupq_n_s8(vgetq_lane_s8(neon_b, 2));
			neon_b3 = vdupq_n_s8(vgetq_lane_s8(neon_b, 3));
			neon_b4 = vdupq_n_s8(vgetq_lane_s8(neon_b, 4));
			neon_b5 = vdupq_n_s8(vgetq_lane_s8(neon_b, 5));
			neon_b6 = vdupq_n_s8(vgetq_lane_s8(neon_b, 6));
			neon_b7 = vdupq_n_s8(vgetq_lane_s8(neon_b, 7));
			neon_b8 = vdupq_n_s8(vgetq_lane_s8(neon_b, 8));
			neon_b9 = vdupq_n_s8(vgetq_lane_s8(neon_b, 9));
			neon_b10 = vdupq_n_s8(vgetq_lane_s8(neon_b, 10));
			neon_b11 = vdupq_n_s8(vgetq_lane_s8(neon_b, 11));
			neon_b12 = vdupq_n_s8(vgetq_lane_s8(neon_b, 12));
			neon_b13 = vdupq_n_s8(vgetq_lane_s8(neon_b, 13));
			neon_b14 = vdupq_n_s8(vgetq_lane_s8(neon_b, 14));
			neon_b15 = vdupq_n_s8(vgetq_lane_s8(neon_b, 15));

			neon_c = vaddq_s8(vmulq_s8(neon_a0, neon_b0), neon_c);
			neon_c = vaddq_s8(vmulq_s8(neon_a1, neon_b1), neon_c);
			neon_c = vaddq_s8(vmulq_s8(neon_a2, neon_b2), neon_c);
			neon_c = vaddq_s8(vmulq_s8(neon_a3, neon_b3), neon_c);
			neon_c = vaddq_s8(vmulq_s8(neon_a4, neon_b4), neon_c);
			neon_c = vaddq_s8(vmulq_s8(neon_a5, neon_b5), neon_c);
			neon_c = vaddq_s8(vmulq_s8(neon_a6, neon_b6), neon_c);
			neon_c = vaddq_s8(vmulq_s8(neon_a7, neon_b7), neon_c);
			neon_c = vaddq_s8(vmulq_s8(neon_a8, neon_b8), neon_c);
			neon_c = vaddq_s8(vmulq_s8(neon_a9, neon_b9), neon_c);
			neon_c = vaddq_s8(vmulq_s8(neon_a10, neon_b10), neon_c);
			neon_c = vaddq_s8(vmulq_s8(neon_a11, neon_b11), neon_c);
			neon_c = vaddq_s8(vmulq_s8(neon_a12, neon_b12), neon_c);
			neon_c = vaddq_s8(vmulq_s8(neon_a13, neon_b13), neon_c);
			neon_c = vaddq_s8(vmulq_s8(neon_a14, neon_b14), neon_c);
			neon_c = vaddq_s8(vmulq_s8(neon_a15, neon_b15), neon_c);

		}

		vst1q_s8(C + i, neon_c);
	}
}
示例#6
0
int8_t
test_vgetq_lane_s8_before (int8x16_t in)
{
  /* { dg-error "lane -1 out of range 0 - 15" "" {target *-*-*} 0 } */
  return vgetq_lane_s8 (in, -1);
}
示例#7
0
int8_t
test_vgetq_lane_s8_beyond (int8x16_t in)
{
  /* { dg-error "lane 16 out of range 0 - 15" "" {target *-*-*} 0 } */
  return vgetq_lane_s8 (in, 16);
}
示例#8
0
// CHECK-LABEL: define i8 @test_vgetq_lane_s8(<16 x i8> %a) #0 {
// CHECK:   [[VGETQ_LANE:%.*]] = extractelement <16 x i8> %a, i32 15
// CHECK:   ret i8 [[VGETQ_LANE]]
int8_t test_vgetq_lane_s8(int8x16_t a) {
  return vgetq_lane_s8(a, 15);
}