diff options
| author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2016-09-12 22:33:14 +0300 | 
|---|---|---|
| committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2016-09-13 00:39:16 +0300 | 
| commit | fad3a8ff8cac2bf92666b0d65e8cbff4b6466efc (patch) | |
| tree | 946255f2908026e8d938524b30edcc0e7a2ae3bd | |
| parent | 11c8254bff29c0da0a41f4d40ca4f0795c52745f (diff) | |
vsp-lib: Fix alpha value handling
Take both the input and output formats into account to compute the alpha
value effectively output by the hardware.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
| -rwxr-xr-x | scripts/vsp-lib.sh | 40 | 
1 files changed, 28 insertions, 12 deletions
| diff --git a/scripts/vsp-lib.sh b/scripts/vsp-lib.sh index d9f0f7d..00278e8 100755 --- a/scripts/vsp-lib.sh +++ b/scripts/vsp-lib.sh @@ -87,29 +87,45 @@ vsp1_set_control() {  reference_frame() {  	local file=$1 -	local format=$2 -	local size=$3 -	shift 3 +	local in_format=$2 +	local out_format=$3 +	local size=$4 +	shift 4  	local alpha=  	local options= -	case $format in +	# Start with the input format to compute the alpha value being used by +	# the RPF after unpacking. Keep in sync with generate_input_frame. +	case $in_format in  	ARGB555) +		# The 1-bit alpha value is expanded to 8 bits by copying the +		# high order bits, resulting in value of 255 after unpacking.  		alpha=255  		;;  	ABGR32 | ARGB32) +		# 8-bit alpha value, hardcoded to 200.  		alpha=200  		;; +	*) +		# In all other cases the alpha value is set through a control +		# whose default value is 255. +		alpha=255 +		;; +	esac + +	# Convert the input alpha value based on the output format. +	case $out_format in +	ARGB555 | ABGR32 | ARGB32) +		# Pass the 8-bit alpha value unchanged to the image generator. +		;;  	XRGB555) -		# XRGB555 has the X bit hardcoded to 0 +		# The format has the X bit hardcoded to 0.  		alpha=0  		;; -	XBGR32 | XRGB32) -		# The X bits are configurable with a default value of 255 -		alpha=255 -		;;  	*) +		# In all other cases the alpha value is set through a control +		# whose default value is 255.  		alpha=255  		;;  	esac @@ -139,9 +155,9 @@ reference_frame() {  	done  	[ x$__vsp_bru_inputs != x ] && options="$options -c $__vsp_bru_inputs" -	$(format_v4l2_is_yuv $format) && options="$options -y" +	$(format_v4l2_is_yuv $out_format) && options="$options -y" -	$genimage -f $format -s $size -a $alpha $options -o $file \ +	$genimage -f $out_format -s $size -a $alpha $options -o $file \  		frames/frame-reference-1024x768.pnm  } @@ -233,7 +249,7 @@ compare_frames() {  		method=fuzzy  	fi -	reference_frame ${frames_dir}ref-frame.bin $out_format $size $args +	reference_frame ${frames_dir}ref-frame.bin $in_format $out_format $size $args  	local result="pass"  	local params=${args// /-} | 
