void ScaleSubRegionLayer::forward(PassType passType) {
  Layer::forward(passType);
  auto in0 = getInput(0);
  imgH_ = in0.getFrameHeight();
  imgW_ = in0.getFrameWidth();
  if (imgH_ == 0 || imgW_ == 0) {
    auto& conf = config_.inputs(0).scale_sub_region_conf();
    imgH_ = conf.image_conf().img_size_y();
    imgW_ = conf.image_conf().img_size();
  }
  MatrixPtr imgV = in0.value;
  size_t batchSize = imgV->getHeight();
  size_t spatialSize = imgH_ * imgW_;
  channelsNum_ = imgV->getWidth() / spatialSize;
  shape_ = TensorShape({batchSize, channelsNum_, imgH_, imgW_});

  resetOutput(batchSize, imgV->getWidth());
  auto& out = getOutput();
  out.setFrameHeight(imgH_);
  out.setFrameWidth(imgW_);

  MatrixPtr indicesV = getInputValue(1);
  indicesShape_ = TensorShape({batchSize, 6});

  REGISTER_TIMER_INFO("ScaleSubRegionForward", getName().c_str());
  BufferArgs inArgs;
  BufferArgs outArgs;
  inArgs.addArg(*imgV, shape_);
  inArgs.addArg(*indicesV, indicesShape_);
  outArgs.addArg(*out.value, shape_, ASSIGN_TO);
  forward_[0]->calc(inArgs, outArgs);
}
// Automatically called by the VFM when the parameter of the port are set.
// It returns the minimum sizeof the buffer
OMX_U32 MPEG2Dec_Port::getBufferSize() const
{
    OstTraceInt0(TRACE_FLOW,"Enter MPEG2Dec_Port::getBufferSize");
    OMX_U32 default_return = 256;

    switch (getDirection())
        {
        case OMX_DirInput:
	         //+CR369244
	         if(VFM_SocCapabilityMgt::getMPEG4DecInputBuffSize())
	         {
	             default_return = VFM_SocCapabilityMgt::getMPEG4DecInputBuffSize();
	         }
            break;

        case OMX_DirOutput:
            default_return = (getFrameWidth()*(getFrameHeight() + 16)*3)/2; // Need 16 more pixel in height for some interleaved streams
            break;
        default:
            DBC_ASSERT(0==1);
        }
	#ifdef PACKET_VIDEO_SUPPORT
            if(mSuggestedBufferSize != 0) {
                default_return = mSuggestedBufferSize;
            }
	#endif

    OstTraceInt0(TRACE_FLOW,"Exit MPEG2Dec_Port::getBufferSize");
    return default_return;
}
Beispiel #3
0
    void
    VLC::readFrame(dom::ResizeableRasterPtr theTargetRaster) {
        ScopeLocker myFrameLock(_myFrameLock, true);
        if (_curBuffer == NULL) {
            return;
        }
		if (getFrameWidth() != _myFrameWidth) setFrameWidth(_myFrameWidth);
		if (getFrameHeight() != _myFrameHeight) setFrameHeight(_myFrameHeight);
        theTargetRaster->resize(getFrameWidth(), getFrameHeight());
        std::copy(_curBuffer->begin(), _curBuffer->end(), theTargetRaster->pixels().begin());
        
        libvlc_time_t curTimeCode = libvlc_media_player_get_time(_mediaPlayer);
        AC_TRACE << "-- timestamp from vlc: " << curTimeCode;
        setTimeCode(as_string(curTimeCode));

        // delete the current buffer, marking that we already copied it to the texture
        AC_TRACE << "freeing " << _curBuffer->size() << " bytes after copying to texture.";
        delete _curBuffer;
        _curBuffer = NULL;
    }
Beispiel #4
0
void Animation::Update(sf::RenderWindow &Window)
{
	if(active)
		frameCounter += (int)Window.GetFrameTime();
	else
		frameCounter = 0;
	if (frameCounter >= switchFrame)
	{
		frameCounter = 0;
		currentFrameX += getFrameWidth();
		if(currentFrameX >= spriteImage.GetImage()->GetWidth())
			currentFrameX = 0;
	}
	spriteImage.SetSubRect(sf::IntRect(currentFrameX, currentFrameY * getFrameHeight(), currentFrameX +getFrameWidth(), currentFrameY + getFrameHeight()));
	spriteImage.SetPosition(x, y);
}
Beispiel #5
0
void			Animation::Update(sf::RenderWindow &win) /* unused win /!\ */
{
  if (active)
    frameCounter += clock.GetElapsedTime();
  else
    frameCounter = 0;

  if (frameCounter >= switchFrame)
  {
    frameCounter = 0;
    clock.Reset();
    currentFrameX += getFrameWidth();
    if (currentFrameX >= spriteImage.GetImage()->GetWidth())
      currentFrameX = 0;
  }
  spriteImage.SetSubRect(sf::IntRect(currentFrameX, currentFrameY * getFrameHeight(), currentFrameX + getFrameWidth(), currentFrameY * getFrameHeight() + getFrameHeight()));
  spriteImage.SetPosition(x, y);
}
	void WindowGL33::setFullscreen(bool fullscreen)
	{
		if (isFullscreen() && !fullscreen)
		{
			this->setPos(m_windowedX, m_windowedY);
			this->setSize(m_windowedWidth, m_windowedHeight);
		}
		else if (!isFullscreen() && fullscreen)
		{
			m_windowedWidth = getFrameWidth();
			m_windowedHeight = getFrameHeight();
			m_windowedX = getX();
			m_windowedY = getY();
			this->setPos(0, 0);
			this->setSize(m_fullscreenWidth, m_fullscreenHeight);
		}
		m_isFullscreen = fullscreen;
	}