function decode_rgb(packet){var width=packet[4],height=packet[5],coding=packet[6],rowstride=packet[9],data=packet[7],options=packet[10]||{};if(0<options.zlib?(data=new Zlib.Inflate(data).decompress(),delete options.zlib):0<options.lz4&&(data=lz4.decode(data),delete options.lz4),"rgb24"==coding)return packet[9]=4*width,packet[6]="rgb32",rgb24_to_rgb32(data,width,height,rowstride);if(rowstride==4*width)return new Uint8Array(data);for(var uint=new Uint8Array(width*height*4),i=0,j=0,psrc=0,pdst=0,i=0;i<height;i++)for(psrc=i*rowstride,pdst=i*width*4,j=0;j<4*width;j++)uint[pdst++]=data[psrc++];return uint}function rgb24_to_rgb32(data,width,height,rowstride){var uint=new Uint8Array(width*height*4),i=0,j=0;if(rowstride==3*width)for(var l=data.length;i<l;)uint[j++]=data[i++],uint[j++]=data[i++],uint[j++]=data[i++],uint[j++]=255;else for(var psrc=0,pdst=0,i=0;i<height;i++)for(psrc=i*rowstride,j=0;j<width;j++)uint[pdst++]=data[psrc++],uint[pdst++]=data[psrc++],uint[pdst++]=data[psrc++],uint[pdst++]=255;return uint}