예제 #1
0
파일: lisp184.c 프로젝트: hoelzl/Clicc
void Fget_output_stream_string(CL_FORM *base)
{
	COPY(ARG(0), ARG(1));
	stream_type(ARG(1));
	if(CL_SYMBOLP(ARG(1)) && GET_SYMBOL(ARG(1)) == SYMBOL(Slisp, 102))	/* STRING-OUTPUT */
	{
	}
	else
	{
		LOAD_SMSTR((CL_FORM *)&KClisp[268], ARG(1));	/* string-output-stream expected */
		Ferror(ARG(1), 1);
	}
	stream_extra(ARG(0));
	Ffuncall(ARG(0), 1);
}
예제 #2
0
    void align::align_frames(const rs2::video_frame& aligned, const rs2::video_frame& from, const rs2::video_frame& to)
    {
        auto from_profile = from.get_profile().as<rs2::video_stream_profile>();
        auto to_profile = to.get_profile().as<rs2::video_stream_profile>();

        auto aligned_profile = aligned.get_profile().as<rs2::video_stream_profile>();

        byte* aligned_data = reinterpret_cast<byte*>(const_cast<void*>(aligned.get_data()));
        memset(aligned_data, 0, aligned_profile.height() * aligned_profile.width() * aligned.get_bytes_per_pixel());


        if (to_profile.stream_type() == RS2_STREAM_DEPTH)
        {
            align_other_to_z(aligned_data, to, from, _depth_scale);
        }
        else
        {
            align_z_to_other(aligned_data, from, to_profile, _depth_scale);
        }
    }
예제 #3
0
    bool pointcloud::should_process(const rs2::frame& frame)
    {
        if (!frame)
            return false;

        auto set = frame.as<rs2::frameset>();

        if (set)
        {
            //process composite frame only if it contains both a depth frame and the requested texture frame
            if (_stream_filter.stream == RS2_STREAM_ANY)
                return false;

            auto tex = set.first_or_default(_stream_filter.stream, _stream_filter.format);
            if (!tex)
                return false;
            auto depth = set.first_or_default(RS2_STREAM_DEPTH, RS2_FORMAT_Z16);
            if (!depth)
                return false;
        }
        else
        {
            if (frame.get_profile().stream_type() == RS2_STREAM_DEPTH && frame.get_profile().format() == RS2_FORMAT_Z16)
                return true;

            auto p = frame.get_profile();
            if (p.stream_type() == _stream_filter.stream && p.format() == _stream_filter.format && p.stream_index() == _stream_filter.index)
                return true;
            return false;

            //TODO: switch to this code when map_to api is removed
            //if (_stream_filter != RS2_STREAM_ANY)
            //    return false;
            //process single frame only if it is a depth frame
            //if (frame.get_profile().stream_type() != RS2_STREAM_DEPTH || frame.get_profile().format() != RS2_FORMAT_Z16)
            //    return false;
        }

        return true;
    }
예제 #4
0
    rs2::frame yuy2rgb::process_frame(const rs2::frame_source& source, const rs2::frame& f)
    {
        auto p = f.get_profile();
        if (p.get() != _source_stream_profile.get())
        {
            _source_stream_profile = p;
            _target_stream_profile = p.clone(p.stream_type(), p.stream_index(), RS2_FORMAT_RGB8);
        }
        
        rs2::frame ret;

        auto vf = f.as<rs2::video_frame>();
        ret = source.allocate_video_frame(_target_stream_profile, f, _traget_bpp, 
            vf.get_width(), vf.get_height(), vf.get_width() * _traget_bpp, RS2_EXTENSION_VIDEO_FRAME);

        byte* planes[1];
        planes[0] = (byte*)ret.get_data();

        unpack_yuy2_rgb8(planes, (const byte*)f.get_data(), vf.get_width(), vf.get_height());

        return ret;
    }
예제 #5
0
    bool align::should_process(const rs2::frame& frame)
    {
        if (!frame)
            return false;

        auto set = frame.as<rs2::frameset>();
        if (!set)
            return false;

        auto profile = frame.get_profile();
        rs2_stream stream = profile.stream_type();
        rs2_format format = profile.format();
        int index = profile.stream_index();

        //process composite frame only if it contains both a depth frame and the requested texture frame
        bool has_tex = false, has_depth = false;
        set.foreach([this, &has_tex](const rs2::frame& frame) { if (frame.get_profile().stream_type() == _to_stream_type) has_tex = true; });
        set.foreach([&has_depth](const rs2::frame& frame) 
            { if (frame.get_profile().stream_type() == RS2_STREAM_DEPTH && frame.get_profile().format() == RS2_FORMAT_Z16) has_depth = true; });
        if (!has_tex || !has_depth)
            return false;

        return true;
    }
예제 #6
0
    ClientRequestHandler::stream_type*
    ClientRequestHandler::open_data_connection (const ACE_CString& cmd,
                                                const ACE_CString& arg)
      {
        if (this->use_passive_mode_)
          {
            // get address for passive data connection
            ACE_INET_Addr data_addr;
            if (this->get_passive_address (data_addr))
              {
                // establish data connection

                // copy sync settings from session
                unsigned long f_reactor =
                    this->session ()->is_reactive() ? ACE_Synch_Options::USE_REACTOR : 0;
                ACE_Synch_Options sync_opt (ACE_Synch_Options::USE_TIMEOUT | f_reactor,
                                            this->session ()->timeout ());

                typedef ACE_Connector<SessionHolder::session_type::connection_type,
                                      ACE_SOCK_CONNECTOR> connector_type;
                connector_type connector;

                // create connection object (stream handler)
                SessionHolder::session_type::connection_type* data_connection = 0;
                ACE_NEW_NORETURN (data_connection,
                                SessionHolder::session_type::connection_type(sync_opt));
                if (data_connection == 0)
                  {
                    return 0;
                  }

                // connect to data connection address
                if (connector.connect (data_connection,
                                       data_addr,
                                       ACE_Synch_Options (0,
                                                          this->session ()->timeout ())) == -1)
                  {
                    INET_ERROR (1, (LM_ERROR, DLINFO
                                ACE_TEXT ("(%d) ACE_FTP_ClientRequestHandler::open_data_connection - ")
                                ACE_TEXT ("failed to connect to %C:%d\n"),
                                ACE_OS::last_error (),
                                data_addr.get_host_name (),
                                data_addr.get_port_number ()));
                    // as the connection was dynamically allocated
                    // the connector causes it to be destroyed after
                    // the connection failure
                    return 0;
                  }

                // enable ref counting so we can control when to destroy
                data_connection->reference_counting_policy ().value (
                    ACE_Event_Handler::Reference_Counting_Policy::ENABLED);

                // create io stream for connection
                stream_type* data_stream = 0;
                ACE_NEW_NORETURN (data_stream,
                                  stream_type (data_connection));
                if (data_stream)
                  {
                    if (this->process_command (cmd, arg) == Response::PRELIM_OK)
                      return data_stream;

                    delete data_stream; // decreases ref count on connection
                  }
                // remove last ref count -> delete
                data_connection->remove_reference ();
              }
          }
        else
          {
            // address for active data connection
            ACE_INET_Addr data_addr;
            this->session ()->get_local_addr (data_addr);
            data_addr.set_port_number (this->active_port_);

            // copy sync settings from session
            unsigned long f_reactor =
                this->session ()->is_reactive() ? ACE_Synch_Options::USE_REACTOR : 0;
            ACE_Synch_Options sync_opt (ACE_Synch_Options::USE_TIMEOUT | f_reactor,
                                        this->session ()->timeout ());

            typedef ACE_Oneshot_Acceptor<SessionHolder::session_type::connection_type,
                                         ACE_SOCK_ACCEPTOR> acceptor_type;
            acceptor_type acceptor;

            // start data connection acceptor listening and retrieve actual listening address
            if (acceptor.open (data_addr) == 0 &&
                acceptor.acceptor ().get_local_addr (data_addr) == 0)
              {
                // send listen address to peer followed by data command to execute
                if (this->send_active_address (data_addr) &&
                    this->process_command (cmd, arg) == Response::PRELIM_OK)
                  {
                    // create connection object (stream handler)
                    SessionHolder::session_type::connection_type* data_connection = 0;
                    ACE_NEW_NORETURN (data_connection,
                                    SessionHolder::session_type::connection_type(sync_opt));
                    if (data_connection == 0)
                      {
                        return 0;
                      }

                    // accept data connection from peer
                    if (acceptor.accept (data_connection,
                                         0,
                                         ACE_Synch_Options (ACE_Synch_Options::USE_TIMEOUT,
                                                            this->session ()->timeout ())) == -1)
                      {
                        INET_ERROR (1, (LM_ERROR, DLINFO
                                    ACE_TEXT ("(%d) ACE_FTP_ClientRequestHandler::open_data_connection - ")
                                    ACE_TEXT ("failed to accept connection to %C:%d\n"),
                                    ACE_OS::last_error (),
                                    data_addr.get_host_name (),
                                    data_addr.get_port_number ()));

                        // as the connection was dynamically allocated
                        // the acceptor causes it to be destroyed after
                        // the connection failure
                        return 0;
                      }

                    // enable ref counting so we can control when to destroy
                    data_connection->reference_counting_policy ().value (
                        ACE_Event_Handler::Reference_Counting_Policy::ENABLED);

                    // create io stream for connection
                    stream_type* data_stream = 0;
                    ACE_NEW_NORETURN (data_stream,
                                      stream_type (data_connection));
                    if (data_stream)
                      {
                        return data_stream;
                      }
                    // remove last ref count -> delete
                    data_connection->remove_reference ();
                  }
              }
          }
        return 0;
      }