<commit_before>/*-
 * Copyright (c) 2006 <NAME> 2006 <<EMAIL>>
 * Copyright (c) 2010 <NAME> <<EMAIL>>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */
#include <unistd.h>
#include <string.h>
#include <IO.h>
#include <sstream>
#include <dc1394/dc1394.h>
#include <dc1394/utils.h>

#include "CameraException.h"
#include "DC1394Camera.h"

#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))

using namespace std;

namespace wcl {

struct DC1394tolibWCLModes
{
    dc1394video_mode_t  dc1394mode;
    Camera::ImageFormat libwclmode;
    unsigned		libwclwidth;
    unsigned		libwclheight;

};

struct DC1394tolibWCLFPS
{
    dc1394framerate_t   dc1394fps;
    unsigned		libwclfps;
};

static DC1394tolibWCLModes formatConversion[] =
{
	{ DC1394_VIDEO_MODE_320x240_YUV422, Camera:: YUYV422, 320, 240},
	{ DC1394_VIDEO_MODE_640x480_YUV411, Camera::YUYV411, 640, 480},
	{ DC1394_VIDEO_MODE_640x480_YUV422, Camera::YUYV422, 640, 480},
	{ DC1394_VIDEO_MODE_640x480_RGB8, Camera::RGB8, 640, 480},
	{ DC1394_VIDEO_MODE_640x480_MONO8, Camera::MONO8, 640, 480},
	{ DC1394_VIDEO_MODE_640x480_MONO16, Camera::MONO16, 640, 480},
	{ DC1394_VIDEO_MODE_800x600_YUV422, Camera::YUYV422, 800, 600},
	{ DC1394_VIDEO_MODE_800x600_RGB8, Camera::RGB8, 800, 600},
	{ DC1394_VIDEO_MODE_800x600_MONO8, Camera::MONO8, 800, 600},
	{ DC1394_VIDEO_MODE_1024x768_YUV422, Camera::YUYV422, 1024, 768},
	{ DC1394_VIDEO_MODE_1024x768_RGB8, Camera::RGB8, 1024, 768},
	{ DC1394_VIDEO_MODE_1024x768_MONO8, Camera:: MONO8, 1024, 768},
	{ DC1394_VIDEO_MODE_800x600_MONO16, Camera::MONO16, 800, 600},
	{ DC1394_VIDEO_MODE_1024x768_MONO16, Camera::MONO16, 1024, 768},
	{ DC1394_VIDEO_MODE_1280x960_YUV422, Camera::YUYV422, 1280, 960},
	{ DC1394_VIDEO_MODE_1280x960_RGB8, Camera::RGB8, 1280, 960},
	{ DC1394_VIDEO_MODE_1280x960_MONO8, Camera::MONO8, 1280, 960},
	{ DC1394_VIDEO_MODE_1600x1200_YUV422, Camera::YUYV422, 1600, 1200},
	{ DC1394_VIDEO_MODE_1600x1200_RGB8, Camera::RGB8, 1600, 1200},
	{ DC1394_VIDEO_MODE_1600x1200_MONO8, Camera::MONO8, 1600, 1200},
	{ DC1394_VIDEO_MODE_1280x960_MONO16, Camera::MONO16, 1280, 960},
	{ DC1394_VIDEO_MODE_1600x1200_MONO16, Camera::MONO16, 1600, 1200}
#if 0
			case DC1394_VIDEO_MODE_EXIF:
			case DC1394_VIDEO_MODE_160x120_YUV444:
			case DC1394_VIDEO_MODE_FORMAT7_0:
			case DC1394_VIDEO_MODE_FORMAT7_1:
			case DC1394_VIDEO_MODE_FORMAT7_2:
			case DC1394_VIDEO_MODE_FORMAT7_3:
			case DC1394_VIDEO_MODE_FORMAT7_4:
			case DC1394_VIDEO_MODE_FORMAT7_5:
			case DC1394_VIDEO_MODE_FORMAT7_6:
			case DC1394_VIDEO_MODE_FORMAT7_7:
#endif
};

static DC1394tolibWCLFPS fpsConversion[] =
{
    { DC1394_FRAMERATE_1_875, 1.875 },
    { DC1394_FRAMERATE_3_75, 3.75 },
    { DC1394_FRAMERATE_7_5, 7.5 },
    { DC1394_FRAMERATE_15, 15.0 },
    { DC1394_FRAMERATE_30, 30.0 },
    { DC1394_FRAMERATE_60, 60.0 },
    { DC1394_FRAMERATE_120, 120.0 },
    { DC1394_FRAMERATE_240, 240.0 },
};<commit_msg>camera: Add YUYV444 to dc1394<commit_after>/*-
 * Copyright (c) 2006 <NAME> 2006 <<EMAIL>>
 * Copyright (c) 2010 <NAME> <<EMAIL>>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */
#include <unistd.h>
#include <string.h>
#include <IO.h>
#include <sstream>
#include <dc1394/dc1394.h>
#include <dc1394/utils.h>

#include "CameraException.h"
#include "DC1394Camera.h"

#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))

using namespace std;

namespace wcl {

struct DC1394tolibWCLModes
{
    dc1394video_mode_t  dc1394mode;
    Camera::ImageFormat libwclmode;
    unsigned		libwclwidth;
    unsigned		libwclheight;

};

struct DC1394tolibWCLFPS
{
    dc1394framerate_t   dc1394fps;
    unsigned		libwclfps;
};

static DC1394tolibWCLModes formatConversion[] =
{
	{ DC1394_VIDEO_MODE_160x120_YUV444, Camera::YUYV444, 160, 120},
	{ DC1394_VIDEO_MODE_320x240_YUV422, Camera:: YUYV422, 320, 240},
	{ DC1394_VIDEO_MODE_640x480_YUV411, Camera::YUYV411, 640, 480},
	{ DC1394_VIDEO_MODE_640x480_YUV422, Camera::YUYV422, 640, 480},
	{ DC1394_VIDEO_MODE_640x480_RGB8, Camera::RGB8, 640, 480},
	{ DC1394_VIDEO_MODE_640x480_MONO8, Camera::MONO8, 640, 480},
	{ DC1394_VIDEO_MODE_640x480_MONO16, Camera::MONO16, 640, 480},
	{ DC1394_VIDEO_MODE_800x600_YUV422, Camera::YUYV422, 800, 600},
	{ DC1394_VIDEO_MODE_800x600_RGB8, Camera::RGB8, 800, 600},
	{ DC1394_VIDEO_MODE_800x600_MONO8, Camera::MONO8, 800, 600},
	{ DC1394_VIDEO_MODE_1024x768_YUV422, Camera::YUYV422, 1024, 768},
	{ DC1394_VIDEO_MODE_1024x768_RGB8, Camera::RGB8, 1024, 768},
	{ DC1394_VIDEO_MODE_1024x768_MONO8, Camera:: MONO8, 1024, 768},
	{ DC1394_VIDEO_MODE_800x600_MONO16, Camera::MONO16, 800, 600},
	{ DC1394_VIDEO_MODE_1024x768_MONO16, Camera::MONO16, 1024, 768},
	{ DC1394_VIDEO_MODE_1280x960_YUV422, Camera::YUYV422, 1280, 960},
	{ DC1394_VIDEO_MODE_1280x960_RGB8, Camera::RGB8, 1280, 960},
	{ DC1394_VIDEO_MODE_1280x960_MONO8, Camera::MONO8, 1280, 960},
	{ DC1394_VIDEO_MODE_1600x1200_YUV422, Camera::YUYV422, 1600, 1200},
	{ DC1394_VIDEO_MODE_1600x1200_RGB8, Camera::RGB8, 1600, 1200},
	{ DC1394_VIDEO_MODE_1600x1200_MONO8, Camera::MONO8, 1600, 1200},
	{ DC1394_VIDEO_MODE_1280x960_MONO16, Camera::MONO16, 1280, 960},
	{ DC1394_VIDEO_MODE_1600x1200_MONO16, Camera::MONO16, 1600, 1200}
#if 0
			case DC1394_VIDEO_MODE_EXIF:
			case DC1394_VIDEO_MODE_FORMAT7_0:
			case DC1394_VIDEO_MODE_FORMAT7_1:
			case DC1394_VIDEO_MODE_FORMAT7_2:
			case DC1394_VIDEO_MODE_FORMAT7_3:
			case DC1394_VIDEO_MODE_FORMAT7_4:
			case DC1394_VIDEO_MODE_FORMAT7_5:
			case DC1394_VIDEO_MODE_FORMAT7_6:
			case DC1394_VIDEO_MODE_FORMAT7_7:
#endif
};

static DC1394tolibWCLFPS fpsConversion[] =
{
    { DC1394_FRAMERATE_1_875, 1.875 },
    { DC1394_FRAMERATE_3_75, 3.75 },
    { DC1394_FRAMERATE_7_5, 7.5 },
    { DC1394_FRAMERATE_15, 15.0 },
    { DC1394_FRAMERATE_30, 30.0 },
    { DC1394_FRAMERATE_60, 60.0 },
    { DC1394_FRAMERATE_120, 120.0 },
    { DC1394_FRAMERATE_240, 240.0 },
};
{'fraction_non_alphanumeric': 0.09388882218753752, 'fraction_numerical': 0.1637651578820987, 'mean_word_length': 5.54874213836478, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3199546', 'n_tokens_mistral': 4158, 'n_tokens_neox': 3213, 'n_words': 752}