2   {d20, d21}, [%[in], :128], %[inc]\n"
				"vabs.s32  q10, q10\n"
				"vld1.32   {d22, d23}, [%[in], :128], %[inc]\n"
				"vabs.s32  q11, q11\n"
				"vmax.s32  q0,  q0,  q8\n"
				"vmax.s32  q1,  q1,  q9\n"
				"vmax.s32  q0,  q0,  q10\n"
				"vmax.s32  q1,  q1,  q11\n"
				"subs      %[blk], %[blk], #4\n"
				"bgt       1b\n"
				"vmax.s32  q0,  q0,  q1\n"
				"vsub.s32  q0,  q0,  q14\n"
				"vclz.s32  q0,  q0\n"
				"vsub.s32  q0,  q15, q0\n"
				"vst1.32   {d0, d1}, [%[out], :128]\n"
			:
			  [blk]    "+r" (blk),
			  [in]     "+r" (in)
			:
			  [inc]     "r" ((char *) &sb_sample_f[1][0][0] -
					 (char *) &sb_sample_f[0][0][0]),
			  [out]     "r" (&scale_factor[ch][sb]),
			  [c1]      "i" (1 << SCALE_OUT_BITS),
			  [c2]      "i" (31 - SCALE_OUT_BITS)
			: "d0", "d1", "d2", "d3", "d16", "d17", "d18", "d19",
			  "d20", "d21", "d22", "d23", "d24", "d25", "d26",
			  "d27", "d28", "d29", "d30", "d31", "cc", "memory");
		}
	}
}

int sbc_calc_scalefactors_j_neon(
	int32_t sb_sample_f[16][2][8],
	uint32_t scale_factor[2][8],
	int blocks, int subbands)
{
	static SBC_ALIGNED int32_t joint_bits_mask[8] = {
		8,   4,  2,  1, 128, 64, 32, 16
	};
	int joint, i;
	int32_t  *in0, *in1;
	int32_t  *in = &sb_sample_f[0][0][0];
	uint32_t *out0, *out1;
	uint32_t *out = &scale_factor[0][0];
	int32_t  *consts = joint_bits_mask;

	i = subbands;

	asm volatile (
		/*
		 * constants: q13 = (31 - SCALE_OUT_BITS), q14 = 1
		 * input:     q0  = ((1 << SCALE_OUT_BITS) + 1)
		 *            %[in0] - samples for channel 0
		 *            %[in1] - samples for shannel 1
		 * output:    q0, q1 - scale factors without joint stereo
		 *            q2, q3 - scale factors with joint stereo
		 *            q15    - joint stereo selection mask
		 */
		".macro calc_scalefactors\n"
			"vmov.s32  q1, q0\n"
			"vmov.s32  q2, q0\n"
			"vmov.s32  q3, q0\n"
			"mov       %[i], %[blocks]\n"
		"1:\n"
			"vld1.32   {d18, d19}, [%[in1], :128], %[inc]\n"
			"vbic.s32  q11, q9,  q14\n"
			"vld1.32   {d16, d17}, [%[in0], :128], %[inc]\n"
			"vhadd.s32 q10