[PATCH 2/8] edid-decode: update Speaker Allocation data block

Hans Verkuil hverkuil at xs4all.nl
Fri Sep 8 10:31:42 UTC 2017


On 09/08/17 10:50, walter harms wrote:
> 
> 
> Am 07.09.2017 20:03, schrieb Hans Verkuil:
>> From: Hans Verkuil <hans.verkuil at cisco.com>
>>
>> More bits are now in use, implement support for those.
>>
>> Signed-off-by: Hans Verkuil <hans.verkuil at cisco.com>
>> ---
>>  edid-decode.c | 38 ++++++++++++++++++++++----------------
>>  1 file changed, 22 insertions(+), 16 deletions(-)
>>
>> diff --git a/edid-decode.c b/edid-decode.c
>> index 26550423..9b6c297e 100644
>> --- a/edid-decode.c
>> +++ b/edid-decode.c
>> @@ -1615,17 +1615,25 @@ static struct field *vcdb_fields[] = {
>>  };
>>  
>>  static const char *sadb_map[] = {
>> -    "FL/FR",
>> -    "LFE",
>> -    "FC",
>> -    "RL/RR",
>> -    "RC",
>> -    "FLC/FRC",
>> -    "RLC/RRC",
>> -    "FLW/FRW",
>> -    "FLH/FRH",
>> -    "TC",
>> -    "FCH",
>> +    "FL/FR - Front Left/Right",
>> +    "LFE - Low Frequency Effects",
>> +    "FC - Front Center",
>> +    "BL/BR - Back Left/Right",
>> +    "BC - Back Center",
>> +    "FLC/FRC - Front Left/Right of Center",
>> +    "RLC/RRC - Rear Left/Right of Center",
>> +    "FLW/FRW - Front Left/Right Wide",
>> +    "TpFL/TpFH - Top Front Left/Right",
>> +    "TpC - Top Center",
>> +    "LS/RS - Left/Right Surround",
>> +    "LFE2 - Low Frequency Effects 2",
>> +    "TpBC - Top Back Center",
>> +    "SiL/SiR - Side Left/Right",
>> +    "TpSiL/TpSiR - Top Side Left/Right",
>> +    "TpBL/TpBR - Top Back Left/Right",
>> +    "BtFC - Bottom Front Center",
>> +    "BtFL/BtBR - Bottom Front Left/Right",
>> +    "TpLS/TpRS - Top Left/Right Surround",
>>  };
>>  
>>  static void
>> @@ -1635,16 +1643,14 @@ cea_sadb(unsigned char *x)
>>      int i;
>>  
>>      if (length >= 3) {
>> -	uint16_t sad = ((x[2] << 8) | x[1]);
>> +	uint32_t sad = ((x[3] << 16) | (x[2] << 8) | x[1]);
>>  
>> -	printf("    Speaker map:");
>> +	printf("    Speaker map:\n");
>>  
>>  	for (i = 0; i < ARRAY_SIZE(sadb_map); i++) {
>>  	    if ((sad >> i) & 1)
>> -		printf(" %s", sadb_map[i]);
>> +		printf("      %s\n", sadb_map[i]);
>>  	}
> 
> just a remark:
>  if (sad & 1)
> 	....
>  sad >>=1 ;
>  if (sad == 0) break;
> 
> to avoid testing empty bits ..

I believe that makes the code harder to read for no real performance
advantage (it wouldn't surprise me if it would actually be slower
in some cases!).

So I leave this as-is.

Regards,

	Hans


More information about the xorg-devel mailing list