iio.c
// explicit raw reader (input = a given block of memory)
explicit raw reader (input = a given block of memory)
explicit raw reader ( input = a given block of memory )
static int parse_raw_binary_image_explicit(struct iio_image *x,
		void *data, size_t ndata,
		int w, int h, int pd,
		int header_bytes, int sample_type,
		bool broken_pixels, bool endianness)
{
	(void)broken_pixels;
	size_t nsamples = w*h*pd;
	size_t ss = iio_type_size(sample_type);
	if (ndata < header_bytes + nsamples*ss) {
		fprintf(stderr, "WARNING:bad raw file size (%zu != %d + %zu)",
				ndata, header_bytes, nsamples*ss);
	}
	int sizes[2] = {w, h};
	iio_image_build_independent(x, 2, sizes, sample_type, pd);
	size_t n = nsamples * ss;
	memcpy(x->data, header_bytes + (char*)data, n);
	if (endianness) {
      if (ss == 2)
		   switch_2endianness(x->data, nsamples);
      if (ss >= 4)
		   switch_4endianness(x->data, nsamples);
   }
	return 0;
}
static int parse_raw_binary_image_explicit ( struct iio_image * x , void * data , size_t ndata , int w , int h , int pd , int header_bytes , int sample_type , bool broken_pixels , bool endianness ) { ( void ) broken_pixels ; size_t nsamples = w * h * pd ; size_t ss = iio_type_size ( sample_type ) ; if ( ndata < header_bytes + nsamples * ss ) { fprintf ( stderr , " " , ndata , header_bytes , nsamples * ss ) ; } int sizes [ 2 ] = { w , h } ; iio_image_build_independent ( x , 2 , sizes , sample_type , pd ) ; size_t n = nsamples * ss ; memcpy ( x -> data , header_bytes + ( char * ) data , n ) ; if ( endianness ) { if ( ss == 2 ) switch_2endianness ( x -> data , nsamples ) ; if ( ss >= 4 ) switch_4endianness ( x -> data , nsamples ) ; } return 0 ; }
explicit raw reader (input = a given block of memory)
explicit raw reader ( input = a given block of memory )
//return 1;