コード例 #1
0
ファイル: mbbs_io.c プロジェクト: hohonuuli/mb-system
int
mbbs_rdpng(Ping *png, MemType **data, XDR *xdrs, int version)
/*
   User-callable routine.
   Gets ping header and data from the XDR stream
   pointed to by xdrs. It assumes that the stream is positioned
   at the beginning of the header, and does not search (although
   it does some error checking). Memory for the actual sample
   data is allocated. version should be the bs_version value
   from the file header which indicates the version of the file.
   Returns BS_SUCCESS, BS_BADARCH, BS_BADARG, BS_MEMALLOC or BS_READ.
*/
{
	unsigned long ibcsv;

	if (sizeof(int) < 4)
		return BS_BADARCH;

	bs_iobytecnt= 0;

	switch (version) {
	case MR1_VERSION_1_0:
	case MR1_VERSION_2_0:
	case BS_VERSION_1_0:
	case BS_VERSION_1_1:
	case BS_VERSION_1_2:
	case BS_VERSION_1_3:
	case BS_VERSION_1_4:
		break;
	default:
		return BS_BADARG;
	}

	if (mbbs_rdpnghdr(png, xdrs, version) != BS_SUCCESS)
		return BS_READ;

	if ((*data= mbbs_pngmemalloc(png)) == (MemType *) 0)
		return BS_MEMALLOC;

	ibcsv= bs_iobytecnt;
	if (mbbs_rdpngdata(png, *data, xdrs) < 0)
		return BS_READ;
	bs_iobytecnt+= ibcsv;

	return BS_SUCCESS;
}
コード例 #2
0
ファイル: bs2asc.c プロジェクト: davidfinlayson/mbsystem
int
main(int argc, char **argv)
{
	char *cp;
	Ping png, *pngp;
	int err, i, j, side, npts, bsi;
	PingData pd;
	float *bty, *ss;
	AuxBeamInfo *abi;
	void usage();
	void pr_bsfhdr(BSFile *), pr_pnghdr(Ping *);

	if ((progname= strrchr(*argv, (int) '/')) != (char *) NULL)
		progname++;
	else
		progname= *argv;

	skip= 0;
	count= BS_UNDEFINED;
	iomode= BS_FILEIO;
	fp= stdout;
	output= OUTPUT_ALL;
	ignorecnt= 0;
	showivisping= 1;
	showsns= showbty= showss= 1;
	showbtyd= showbtyfl= showabi= 1;
	showssd= showssfl= 1;
	pngcntonly= 0;
	tmmode= TM_JULIAN;

	databuf= (MemType *) 0;
	databufsz= 0;

	for (argc--, argv++; argc > 0; argc--, argv++) {
		if (!strcmp(*argv, "-s")) {
			if (argc < 2)
				usage();
			argc--, argv++;
			skip= (int) strtol(*argv, &cp, 10);
			if ((cp == *argv) || (*cp != '\0')) {
				(void) fprintf(stderr, "%s: invalid skip value\n", progname);
				exit(BS_BADARG);
			}
			if (skip < 0) {
				(void) fprintf(stderr, "%s: skip value may not be less than 0\n", progname);
				exit(BS_BADARG);
			}
		}
		else if (!strcmp(*argv, "-c")) {
			if (argc < 2)
				usage();
			argc--, argv++;
			count= (int) strtol(*argv, &cp, 10);
			if ((cp == *argv) || (*cp != '\0')) {
				(void) fprintf(stderr, "%s: invalid count value\n", progname);
				exit(BS_BADARG);
			}
			if (count < 0) {
				(void) fprintf(stderr, "%s: count value may not be less than 0\n", progname);
				exit(BS_BADARG);
			}
		}
		else if (!strcmp(*argv, "-sm")) {
			if (argc < 2)
				usage();
			iomode= BS_SHAREDMEM;
			argc--, argv++;
			smcid= (int) strtol(*argv, &cp, 10);
			if ((cp == *argv) || (*cp != '\0')) {
				(void) fprintf(stderr, "%s: invalid shared memory control block ID\n", progname);
				exit(BS_BADARG);
			}
		}
		else if (!strcmp(*argv, "-f")) {
			if (argc < 2)
				usage();
			argc--, argv++;
			if ((fp= fopen(*argv, "w")) == (FILE *) NULL) {
				(void) fprintf(stderr, "%s: cannot open file '%s'\n", progname, *argv);
				exit(BS_OPEN);
			}
		}
		else if (!strcmp(*argv, "-h"))
			output= OUTPUT_HDRSONLY;
		else if (!strcmp(*argv, "-d"))
			output= OUTPUT_DATAONLY;
		else if (!strcmp(*argv, "-nip"))
			showivisping= 0;
		else if (!strcmp(*argv, "-nsns"))
			showsns= 0;
		else if (!strcmp(*argv, "-nb"))
			showbty= 0;
		else if (!strcmp(*argv, "-nbd"))
			showbtyd= 0;
		else if (!strcmp(*argv, "-nbf"))
			showbtyfl= 0;
		else if (!strcmp(*argv, "-nabi"))
			showabi= 0;
		else if (!strcmp(*argv, "-ns"))
			showss= 0;
		else if (!strcmp(*argv, "-nsd"))
			showssd= 0;
		else if (!strcmp(*argv, "-nsf"))
			showssfl= 0;
		else if (!strcmp(*argv, "-i"))
			ignorecnt= 1;
		else if (!strcmp(*argv, "-pco"))
			pngcntonly= 1;
		else if (!strcmp(*argv, "-jt"))
			tmmode= TM_JULIAN;
		else if (!strcmp(*argv, "-ct"))
			tmmode= TM_CALENDAR;
		else if (!strcmp(*argv, "-H"))
			usage();

		/* ignored options */
		else if (!strcmp(*argv, "-tv")) {
			if (argc < 3)
				usage();
			argc-= 2, argv+= 2;
		}
		else if (!strcmp(*argv, "-spm"))
			continue;
		else if (!strcmp(*argv, "-ppm"))
			continue;
		else if (!strncmp(*argv, "-pb", 3))
			continue;
		else if (!strncmp(*argv, "-pp", 3))
			continue;
		else if (!strncmp(*argv, "-ps", 3))
			continue;
	}

	switch (iomode) {
	case BS_FILEIO:
		xdrstdio_create(&xdri, stdin, XDR_DECODE);

		if ((err= mbbs_rdbsfhdr(&bsf, &xdri)) != BS_SUCCESS) {
			(void) fprintf(stderr, "%s: cannot read BS file header\n", progname);
			exit(err);
		}
		if (bsf.bsf_flags & BS_SSSLANTRNG)
			slantrng= 1;
		else
			slantrng= 0;
		if (pngcntonly) {
			(void) fprintf(fp, "%1d\n", bsf.bsf_count);
			(void) fflush(fp);
			exit(BS_SUCCESS);
		}
		if (ignorecnt == 1)
			;
		else if (count == BS_UNDEFINED) {
			if ((count= bsf.bsf_count-skip) < 0) {
				(void) fprintf(stderr, "%s: skip request exceeds number of available pings\n", progname);
				exit(BS_BADARG);
			}
		}
		else {
			if (skip+count > bsf.bsf_count) {
				(void) fprintf(stderr, "%s: skip and count requests exceed number of available pings\n", progname);
				exit(BS_BADARG);
			}
		}
		if ((err= mbbs_seekpng(skip, &xdri, bsf.bsf_version)) != BS_SUCCESS) {
			(void) fprintf(stderr, "%s: ping seek error\n", progname);
			exit(err);
		}
		if (output != OUTPUT_DATAONLY)
			pr_bsfhdr(&bsf);

		break;
	case BS_SHAREDMEM:
		if (pngcntonly) {
			(void) fprintf(fp, "%1d\n", smctl->sm_count);
			(void) fflush(fp);
			exit(BS_SUCCESS);
		}
		if (ignorecnt == 1) {
			(void) fprintf(stderr, "%s: count cannot be ignored in shared memory mode\n", progname);
			exit(BS_BADARG);
		}
		if ((smctl= (SMControl *) shmat(smcid, (MemType *) 0, (int) 0)) == (SMControl *) -1) {
			(void) fprintf(stderr, "%s: shared memory attach failure\n", progname);
			exit(BS_SYSVIPC);
		}
		if (smctl->sm_slantrng)
			slantrng= 1;
		else
			slantrng= 0;
		if (count == BS_UNDEFINED) {
			if ((count= smctl->sm_count-skip) < 0) {
				(void) fprintf(stderr, "%s: skip request exceeds number of available pings\n", progname);
				smctl->sm_status= BS_BADARG;
				exit(BS_BADARG);
			}
		}
		else if (skip+count > smctl->sm_count) {
			(void) fprintf(stderr, "%s: skip and count requests exceed number of available pings\n", progname);
			smctl->sm_status= BS_BADARG;
			exit(BS_BADARG);
		}
		if ((smind= (int *) shmat(smctl->sm_shmiid, (MemType *) 0, (int) 0)) == (int *) -1) {
			(void) fprintf(stderr, "%s: shared memory attach failure\n", progname);
			smctl->sm_status= BS_SYSVIPC;
			exit(BS_SYSVIPC);
		}
		if ((smbuf= (void *) shmat(smctl->sm_shmdid, (MemType *) 0, (int) 0)) == (void *) -1) {
			(void) fprintf(stderr, "%s: shared memory attach failure\n", progname);
			smctl->sm_status= BS_SYSVIPC;
			exit(BS_SYSVIPC);
		}
		(void) strcpy(smctl->sm_msg, "ASCII output");
		smctl->sm_msgtype= SMC_MSGALTPCT;
		cp= (char *) smbuf;
		cp+= smind[skip];
		pngp= (Ping *) cp;
		break;
	}

	for (i= 0; (i < count) || ((count == BS_UNDEFINED) && (ignorecnt == 1)); i++) {
		switch (iomode) {
		case BS_FILEIO:
			if ((err= mbbs_rdpnghdr(&png, &xdri, bsf.bsf_version)) != BS_SUCCESS) {
				(void) fprintf(stderr, "%s: cannot read header from ping %1d\n", progname, (int) (skip+i));
				exit(err);
			}
			if ((err= mbbs_pngrealloc(&png, &databuf, &databufsz)) != BS_SUCCESS) {
				(void) fprintf(stderr, "%s: memory allocation error for ping %1d\n", progname, (int) (skip+i));
				exit(err);
			}
			if ((err= mbbs_rdpngdata(&png, databuf, &xdri)) != BS_SUCCESS) {
				(void) fprintf(stderr, "%s: cannot read data from ping %1d\n", progname, (int) (skip+i));
				exit(err);
			}
			pngp= &png;
			break;
		case BS_SHAREDMEM:
			cp= (char *) pngp;
			cp+= sizeof(Ping);
			databuf= (float *) cp;
			break;
		}
		if ((err= mbbs_getpngdataptrs(pngp, databuf, &pd)) != BS_SUCCESS) {
			(void) fprintf(stderr, "%s: cannot get ping data pointers\n", progname);
			exit(err);
		}

		(void) fprintf(fp, "\n\nPing %1d ****\n\n", (int) (i+skip));
		if (output != OUTPUT_DATAONLY)
			pr_pnghdr(pngp);

		if ((output != OUTPUT_HDRSONLY) &&
		    (showivisping || mbbs_pngvisible(pngp->png_flags))) {
			if (showsns) {
				(void) fprintf(fp, "\nCompass Data:\n");
				for (j= 0; j < pngp->png_compass.sns_nsamps; j++) {
					if (mbbs_isnanf(pd.pd_compass[j]))
						(void) fprintf(fp, "   ?\n");
					else
						(void) fprintf(fp, "%4.2f\n", pd.pd_compass[j]);
				}

				(void) fprintf(fp, "\nDepth Data:\n");
				for (j= 0; j < pngp->png_depth.sns_nsamps; j++) {
					if (mbbs_isnanf(pd.pd_depth[j]))
						(void) fprintf(fp, "   ?\n");
					else
						(void) fprintf(fp, "%4.2f\n", pd.pd_depth[j]);
				}

				(void) fprintf(fp, "\nPitch Data:\n");
				for (j= 0; j < pngp->png_pitch.sns_nsamps; j++) {
					if (mbbs_isnanf(pd.pd_pitch[j]))
						(void) fprintf(fp, "   ?\n");
					else
						(void) fprintf(fp, "%4.2f\n", pd.pd_pitch[j]);
				}

				(void) fprintf(fp, "\nRoll Data:\n");
				for (j= 0; j < pngp->png_roll.sns_nsamps; j++) {
					if (mbbs_isnanf(pd.pd_roll[j]))
						(void) fprintf(fp, "   ?\n");
					else
						(void) fprintf(fp, "%4.2f\n", pd.pd_roll[j]);
				}
			}

			if (showbty) {
				if (pngp->png_flags & PNG_XYZ)
					bsi= 3;
				else
					bsi= 2;
				for (side= ACP_PORT; side < ACP_NSIDES; side++) {
					(void) fprintf(fp, "\n%s Bathymetry Data:\n[Index]        X        ", side == ACP_PORT ? "Port" : "Starboard");
					if (bsi == 3)
						(void) fprintf(fp, "Y        ");
					(void) fprintf(fp, "Z    ");
					if (showbtyfl)
						(void) fprintf(fp, "Flag    ");
					if ((pngp->png_flags & PNG_ABI) && showabi)
						(void) fprintf(fp, "Beam    SSAT0    SSAT1 ABIFlag");
					(void) fprintf(fp, "\n");
					if ((npts= pngp->png_sides[side].ps_btycount) == 0)
						continue;
					bty= pd.pd_bty[side];
					for (j= 0; j < npts; j++) {
						if (!showbtyd && pd.pd_btyflags[side][j])
							continue;
						(void) fprintf(fp, "[%5d]   %8.2f ", j, bty[bsi*j]);
						if (bsi == 3)
							(void) fprintf(fp, "%8.2f %8.2f", bty[(bsi*j)+1], bty[(bsi*j)+2]);
						else
							(void) fprintf(fp, "%8.2f", bty[(bsi*j)+1]);
						if (showbtyfl)
							(void) fprintf(fp, "%#6x  ", pd.pd_btyflags[side][j]);
						if ((pngp->png_flags & PNG_ABI) && showabi) {
							abi= &(pd.pd_abi[side][j]);
							(void) fprintf(fp, "%6d ", abi->abi_id);
							if (mbbs_isnanf(abi->abi_ssat0))
								(void) fprintf(fp, "       ? ");
							else
								(void) fprintf(fp, "%8.2f ", abi->abi_ssat0);
							if (mbbs_isnanf(abi->abi_ssat1))
								(void) fprintf(fp, "       ?  ");
							else
								(void) fprintf(fp, "%8.2f  ", abi->abi_ssat1);
							(void) fprintf(fp, "%#6x", abi->abi_flags);
						}
						(void) fprintf(fp, "\n");
					}
				}
			}

			if (showss) {
				for (side= ACP_PORT; side < ACP_NSIDES; side++) {
					(void) fprintf(fp, "\n%s Sidescan Data:\n[Index]      Intensity", side == ACP_PORT ? "Port" : "Starboard");
					if (showssfl)
						(void) fprintf(fp, "     Flag");
					(void) fprintf(fp, "\n");
					npts= pngp->png_sides[side].ps_sscount;
					ss= pd.pd_ss[side];
					for (j= 0; j < npts; j++) {
						if (!showssd && pd.pd_ssflags[side][j])
							continue;
						(void) fprintf(fp, "[%5d]   %12.2f", j, ss[j]);
						if (showssfl)
							(void) fprintf(fp, "   %#6x", (unsigned int) pd.pd_ssflags[side][j]);
						(void) fprintf(fp, "\n");
					}
				}
			}
		}

		(void) fprintf(fp, "\n");

		switch (iomode) {
		case BS_FILEIO:
			break;
		case BS_SHAREDMEM:
			smctl->sm_ping= skip+i;
			if (i < count-1) {
				cp= (char *) smbuf;
				cp+= smind[skip+i+1];
				pngp= (Ping *) cp;
			}
			break;
		}
	}

	switch (iomode) {
	case BS_FILEIO:
		break;
	case BS_SHAREDMEM:
		smctl->sm_status= BS_SUCCESS;
		smctl->sm_redraw= SMC_RDRNONE;
		break;
	}

	exit(BS_SUCCESS);
}
コード例 #3
0
ファイル: mbbs_io.c プロジェクト: hohonuuli/mb-system
int
mbbs_copypng(int count, XDR *xdris, XDR *xdros, int version)
/*
   User-callable routine.
   Copies the next n pings from the XDR input stream
   pointed to by xdris to the XDR output stream pointed
   to by xdros. version should be the bs_version value
   from the file header which indicates the version of the file.
   Note that this routine will set bs_iobytecnt to the count
   of bytes written, not bytes read!
   Returns BS_SUCCESS, BS_BADARCH, BS_BADARG, BS_READ or BS_WRITE.
*/
{
	Ping png;
	int i, j, bsi, side, n, err, ii, rem;
	unsigned int flags, ui;
	u_int ui1;
	float f;
	char *cp;
	unsigned int ibcsv;

	if (sizeof(int) < 4)
		return BS_BADARCH;

	bs_iobytecnt= 0;

	for (i= 0; i < count; i++) {

		/* note that we want bs_iobytecnt to be a count
		   of the bytes written, not the bytes read! */
		ibcsv= bs_iobytecnt;
		if ((err= mbbs_rdpnghdr(&png, xdris, version)) != BS_SUCCESS)
			return err;
		bs_iobytecnt= ibcsv;

		flags= png.png_flags;
		png.png_flags&= ~PNG_BTYSSFLAGSABSENT;
		ibcsv= bs_iobytecnt;
		if ((err= mbbs_wrpnghdr(&png, xdros)) != BS_SUCCESS)
			return err;
		bs_iobytecnt+= ibcsv;

		/* sensor data */
		n= png.png_compass.sns_nsamps+
		   png.png_depth.sns_nsamps+
		   png.png_pitch.sns_nsamps+
		   png.png_roll.sns_nsamps;
		for (j= 0; j < n; j++) {
			if (!xdr_float(xdris, &f))
				return BS_READ;
			if (!xdr_float(xdros, &f))
				return BS_WRITE;
			bs_iobytecnt+= 4;
		}

		if (png.png_flags & PNG_XYZ)
			bsi= 3;
		else
			bsi= 2;

		for (side= ACP_PORT; side < ACP_NSIDES; side++) {

			/* bathymetry samples */
			n= bsi*png.png_sides[side].ps_btycount;
			for (j= 0; j < n; j++) {
				if (!xdr_float(xdris, &f))
					return BS_READ;
				if (!xdr_float(xdros, &f))
					return BS_WRITE;
				bs_iobytecnt+= 4;
			}

			/* bathymetry flags */
			n= png.png_sides[side].ps_btycount;
			for (j= 0; j < n; j++) {
				if (!(flags & PNG_BTYSSFLAGSABSENT)) {
					if (!xdr_u_int(xdris, &ui))
						return BS_READ;
				}
				else
					ui= BTYD_CLEAR;
				if (!xdr_u_int(xdros, &ui))
					return BS_WRITE;
				bs_iobytecnt+= 4;
			}

			if ((n= png.png_sides[side].ps_sscount) > 0) {

				/* sidescan samples */
				for (j= 0; j < n; j++) {
					if (!xdr_float(xdris, &f))
						return BS_READ;
					if (!xdr_float(xdros, &f))
						return BS_WRITE;
					bs_iobytecnt+= 4;
				}

				/* sidescan flags */
				if ((err= mbbs_memalloc((MemType **) &ssflagbuf, &ssflagbufsz, (unsigned int) n, (size_t) 1)) != MEM_SUCCESS) {
					switch (err) {
					case MEM_BADARG:
						return BS_BADARG;
					case MEM_OOB:
						return BS_BADARG;
					case MEM_CALLOC:
						return BS_MEMALLOC;
					default:
						return BS_FAILURE;
					}
				}
				cp= (char *) ssflagbuf;
				ui1= (u_int) n;
				if (!(flags & PNG_BTYSSFLAGSABSENT)) {
					if (!xdr_bytes(xdris, &cp, &ui1, (u_int) n))
						return BS_READ;
				}
				else {
					for (j= 0; j < n; j++)
						ssflagbuf[j]= SSD_CLEAR;
				}
				if (!xdr_bytes(xdros, &cp, &ui1, (u_int) n))
					return BS_READ;
				bs_iobytecnt+= 4+n;
				if ((rem= bs_iobytecnt%4) > 0)
					bs_iobytecnt+= 4-rem;
			}
		}

		/* auxiliary beam info */
		if (png.png_flags & PNG_ABI) {
			for (side= ACP_PORT; side < ACP_NSIDES; side++) {
				n= png.png_sides[side].ps_btycount;
				for (j= 0; j < n; j++) {
					if (!xdr_u_int(xdris, &ui))
						return BS_READ;
					if (!xdr_u_int(xdros, &ui))
						return BS_WRITE;
					bs_iobytecnt+= 4;
					if (!xdr_int(xdris, &ii))
						return BS_READ;
					if (!xdr_int(xdros, &ii))
						return BS_WRITE;
					bs_iobytecnt+= 4;
					if (!xdr_float(xdris, &f))
						return BS_READ;
					if (!xdr_float(xdros, &f))
						return BS_WRITE;
					bs_iobytecnt+= 4;
					if (!xdr_float(xdris, &f))
						return BS_READ;
					if (!xdr_float(xdros, &f))
						return BS_WRITE;
					bs_iobytecnt+= 4;
				}
			}
		}
	}

	return BS_SUCCESS;
}
コード例 #4
0
ファイル: mbbs_io.c プロジェクト: hohonuuli/mb-system
int
mbbs_seekpng(int count, XDR *xdrs, int version)
/*
   User-callable routine.
   Seeks past the next n pings in the XDR stream pointed to by xdrs.
   version should be the bs_version value from the file header which
   indicates the version of the file.
   Returns BS_SUCCESS, BS_BADARCH, BS_BADARG or BS_READ.
*/
{
	Ping png;
	int i, j, err, bsi, side, n, ii, rem;
	unsigned int ui;
	u_int ui1;
	float f;
	char *cp;
	unsigned long ibcsv;

	if (sizeof(int) < 4)
		return BS_BADARCH;

	bs_iobytecnt= 0;

	switch (version) {
	case MR1_VERSION_1_0:
	case MR1_VERSION_2_0:
	case BS_VERSION_1_0:
	case BS_VERSION_1_1:
	case BS_VERSION_1_2:
	case BS_VERSION_1_3:
	case BS_VERSION_1_4:
		break;
	default:
		return BS_BADARG;
	}

	for (i= 0; i < count; i++) {
		ibcsv= bs_iobytecnt;
		if ((err= mbbs_rdpnghdr(&png, xdrs, version)) != BS_SUCCESS)
			return err;
		bs_iobytecnt+= ibcsv;

		/* sensor data */
		n= png.png_compass.sns_nsamps+
		   png.png_depth.sns_nsamps+
		   png.png_pitch.sns_nsamps+
		   png.png_roll.sns_nsamps;
		for (j= 0; j < n; j++) {
			if (!xdr_float(xdrs, &f))
				return BS_READ;
			bs_iobytecnt+= 4;
		}

		if (png.png_flags & PNG_XYZ)
			bsi= 3;
		else
			bsi= 2;

		for (side= ACP_PORT; side < ACP_NSIDES; side++) {

			/* bathymetry samples */
			n= bsi*png.png_sides[side].ps_btycount;
			for (j= 0; j < n; j++) {
				if (!xdr_float(xdrs, &f))
					return BS_READ;
				bs_iobytecnt+= 4;
			}

			/* bathymetry flags */
			if (!(png.png_flags & PNG_BTYSSFLAGSABSENT)) {
				n= png.png_sides[side].ps_btycount;
				for (j= 0; j < n; j++) {
					if (!xdr_u_int(xdrs, &ui))
						return BS_READ;
					bs_iobytecnt+= 4;
				}
			}

			if ((n= png.png_sides[side].ps_sscount) > 0) {

				/* sidescan samples */
				for (j= 0; j < n; j++) {
					if (!xdr_float(xdrs, &f))
						return BS_READ;
					bs_iobytecnt+= 4;
				}

				/* sidescan flags */
				if (!(png.png_flags & PNG_BTYSSFLAGSABSENT)) {
					if ((err= mbbs_memalloc((MemType **) &ssflagbuf, &ssflagbufsz, (unsigned int) n, (size_t) 1)) != MEM_SUCCESS) {
						switch (err) {
						case MEM_BADARG:
							return BS_BADARG;
						case MEM_OOB:
							return BS_BADARG;
						case MEM_CALLOC:
							return BS_MEMALLOC;
						default:
							return BS_FAILURE;
						}
					}
					cp= (char *) ssflagbuf;
					ui1= (u_int) n;
					if (!xdr_bytes(xdrs, &cp, &ui1, (u_int) n))
						return BS_READ;
					bs_iobytecnt+= 4+n;
					if ((rem= bs_iobytecnt%4) > 0)
						bs_iobytecnt+= 4-rem;
				}
			}
		}

		/* auxiliary beam info */
		if (png.png_flags & PNG_ABI) {
			for (side= ACP_PORT; side < ACP_NSIDES; side++) {
				n= png.png_sides[side].ps_btycount;
				for (j= 0; j < n; j++) {
					if (!xdr_u_int(xdrs, &ui))
						return BS_READ;
					bs_iobytecnt+= 4;
					if (!xdr_int(xdrs, &ii))
						return BS_READ;
					bs_iobytecnt+= 4;
					if (!xdr_float(xdrs, &f))
						return BS_READ;
					bs_iobytecnt+= 4;
					if (!xdr_float(xdrs, &f))
						return BS_READ;
					bs_iobytecnt+= 4;
				}
			}
		}
	}

	return BS_SUCCESS;
}