Ejemplo n.º 1
0
void cFilterSpatial<T>::kernelSpatialAverage(size_t extend, size_t dim)
{
    const std::string   funcName("void cFilterSpatial<T>::kernelSpatialAverage("
                                    "size_t extend, size_t dim)");

    switch (dim) {
        case 1:
            _kernel.memReAlloc((cSize3(extend,1,1)));

            filter_average(_kernel.getAddrData(), _kernel.getNrow());
            break;
        case 2:
            _kernel.memReAlloc((cSize3(extend,extend,1)));

            filter_average(_kernel.getAddrData(), _kernel.getNrow(),
                                                  _kernel.getNcol());
            break;
        case 3:
            _kernel.memReAlloc((cSize3(extend,extend,extend)));

            filter_average(_kernel.getAddrData(), _kernel.getNrow(),
                                                  _kernel.getNcol(),
                                                  _kernel.getNsec());
            break;
        default:
            ERROR(funcName, "unsupported dimension");
    }
}
/**
  * @brief  measure the tempeature when the semaohore is ready.
  * @param  None
  * @retval None
  */
void temperature_Thread(void const * argument)
{
  float temp;
  
  while (1)
  {
		//Wait for semaphore to be released by timer interrupt
    osSemaphoreWait (tempeature_semaphore, osWaitForever);
		//Measure temperature
    temp = temperature_MeasureValue();
		//Filter measurement
    filter_add((int16_t) round(temp * 100), &temperature_filter_struct);
    sample = filter_average(&temperature_filter_struct);
		//Update PWM alarm
    pwm_alarm_update(sample / 100);
    //printf("%f\n", sample / 100.0);
  }
}
Ejemplo n.º 3
0
mng_retcode filter_a_row (mng_datap pData)
{
  mng_retcode iRetcode;

#ifdef MNG_SUPPORT_TRACE
  MNG_TRACE (pData, MNG_FN_FILTER_A_ROW, MNG_LC_START)
#endif

  switch (*(pData->pWorkrow + pData->iFilterofs))
  {
    case 1  : {
                iRetcode = filter_sub     (pData);
                break;
              }
    case 2  : {
                iRetcode = filter_up      (pData);
                break;
              }
    case 3  : {
                iRetcode = filter_average (pData);
                break;
              }
    case 4  : {
                iRetcode = filter_paeth   (pData);
                break;
              }

    default : iRetcode = MNG_INVALIDFILTER;
  }

#ifdef MNG_SUPPORT_TRACE
  MNG_TRACE (pData, MNG_FN_FILTER_A_ROW, MNG_LC_END)
#endif

  return iRetcode;
}