예제 #1
0
/*****************************************************************************
 * PPChangeMode: change the current mode and quality
 *****************************************************************************/
static void PPChangeMode( filter_t *p_filter, const char *psz_name,
                          int i_quality )
{
    filter_sys_t *p_sys = p_filter->p_sys;
    vlc_mutex_lock( &p_sys->lock );
    if( i_quality > 0 )
    {
        pp_mode *pp_mode = pp_get_mode_by_name_and_quality( psz_name ?
                                                              psz_name :
                                                              "default",
                                                              i_quality );
        if( pp_mode )
        {
            pp_free_mode( p_sys->pp_mode );
            p_sys->pp_mode = pp_mode;
        }
        else
            msg_Warn( p_filter, "Error while changing post processing mode. "
                      "Keeping previous mode." );
    }
    else
    {
        pp_free_mode( p_sys->pp_mode );
        p_sys->pp_mode = NULL;
    }
    vlc_mutex_unlock( &p_sys->lock );
}
예제 #2
0
/**
    \fn cleanup
*/
bool ADM_PP::cleanup(void)
{
	 aprintf("Deleting post proc\n");
	 if(ppMode) {pp_free_mode(ppMode);ppMode=NULL;}
	 if(ppContext) {pp_free_context(ppContext);ppContext=NULL;}
     return true;
}
예제 #3
0
void CDVDVideoPPFFmpeg::Dispose()
{
  if (m_pMode)
  {
    pp_free_mode(m_pMode);
    m_pMode = NULL;
  }
  if(m_pContext)
  {
    pp_free_context(m_pContext);
    m_pContext = NULL;
  }

  if( m_FrameBuffer.iFlags & DVP_FLAG_ALLOCATED )
  {
    for( int i = 0; i<4; i++ )
    {
      if( m_FrameBuffer.data[i] )
      {
        _aligned_free(m_FrameBuffer.data[i]);
        m_FrameBuffer.data[i] = NULL;
        m_FrameBuffer.iLineSize[i] = 0;
      }
    }
    m_FrameBuffer.iFlags &= ~DVP_FLAG_ALLOCATED;
  }

  m_iInitWidth = 0;
  m_iInitHeight = 0;
}
예제 #4
0
void FFMS_VideoSource::SetPP(const char *PP) {

#ifdef FFMS_USE_POSTPROC
	if (PPMode)
		pp_free_mode(PPMode);
	PPMode = NULL;

	if (PP != NULL && strcmp(PP, "")) {
		// due to a parsing bug in libpostproc it can read beyond the end of a string
		// adding a ',' prevents the bug from manifesting
		// libav head 2011-08-26
		std::string s = PP;
		s.append(",");
		PPMode = pp_get_mode_by_name_and_quality(s.c_str(), PP_QUALITY_MAX);
		if (!PPMode) {
			ResetPP();
			throw FFMS_Exception(FFMS_ERROR_POSTPROCESSING, FFMS_ERROR_INVALID_ARGUMENT,
				"Invalid postprocesing settings");
		}
		
	}

	ReAdjustPP(CodecContext->pix_fmt, CodecContext->width, CodecContext->height);
	OutputFrame(DecodeFrame);
#else
	throw FFMS_Exception(FFMS_ERROR_POSTPROCESSING, FFMS_ERROR_UNSUPPORTED,
		"FFMS2 was not compiled with postprocessing support");
#endif /* FFMS_USE_POSTPROC */
}
예제 #5
0
void deletePostProc(ADM_PP *pp)
{
	aprintf("Deleting post proc\n");
	 if(pp->ppMode) {pp_free_mode(pp->ppMode);pp->ppMode=NULL;}
	 if(pp->ppContext) {pp_free_context(pp->ppContext);pp->ppContext=NULL;}

}
예제 #6
0
static void uninit(struct vf_instance_s* vf){
    int i;
    for(i=0; i<=PP_QUALITY_MAX; i++){
        if(vf->priv->ppMode[i])
	    pp_free_mode(vf->priv->ppMode[i]);
    }
    if(vf->priv->context) pp_free_context(vf->priv->context);
}
예제 #7
0
파일: vf_pp.c 프로젝트: ALEXGUOQ/FFmpeg
static av_cold void pp_uninit(AVFilterContext *ctx)
{
    int i;
    PPFilterContext *pp = ctx->priv;

    for (i = 0; i <= PP_QUALITY_MAX; i++)
        pp_free_mode(pp->modes[i]);
    if (pp->pp_ctx)
        pp_free_context(pp->pp_ctx);
}
예제 #8
0
파일: ffpp_avx.cpp 프로젝트: 0x09/avxsynth
FFPP::~FFPP() {
	if (PPMode)
		pp_free_mode(PPMode);
	if (PPContext)
		pp_free_context(PPContext);
	if (SWSTo422P)
		sws_freeContext(SWSTo422P);
	if (SWSFrom422P)
		sws_freeContext(SWSFrom422P);
	avpicture_free(&InputPicture);
	avpicture_free(&OutputPicture);
}
예제 #9
0
void FFMS_VideoSource::ResetPP() {
#ifdef FFMS_USE_POSTPROC
	if (PPContext)
		pp_free_context(PPContext);
	PPContext = NULL;

	if (PPMode)
		pp_free_mode(PPMode);
	PPMode = NULL;

#endif /* FFMS_USE_POSTPROC */
	OutputFrame(DecodeFrame);
}
//*************************************************************
void ADMVideoLavPPDeint::cleanup(void)
{
  if(ppcontext)
  {
    pp_free_context(ppcontext);
    ppcontext=NULL;
  }
  if(ppmode)
  {
    pp_free_mode(ppmode);
    ppmode=NULL;
  }
  
} 
예제 #11
0
/**
    \fn cleanup
*/
bool lavDeint::cleanup(void)
{
  if(ppcontext)
  {
    pp_free_context(ppcontext);
    ppcontext=NULL;
  }
  if(ppmode)
  {
    pp_free_mode(ppmode);
    ppmode=NULL;
  }
  return true;
} 
예제 #12
0
/*****************************************************************************
 * ClosePostproc
 *****************************************************************************/
static void ClosePostproc( vlc_object_t *p_this )
{
    filter_t *p_filter = (filter_t *)p_this;
    filter_sys_t *p_sys = p_filter->p_sys;

    /* delete the callback before destroying the mutex */
    var_DelCallback( p_filter, FILTER_PREFIX "q", PPQCallback, NULL );
    var_DelCallback( p_filter, FILTER_PREFIX "name", PPNameCallback, NULL );

    /* Destroy the resources */
    vlc_mutex_destroy( &p_sys->lock );
    pp_free_context( p_sys->pp_context );
    if( p_sys->pp_mode ) pp_free_mode( p_sys->pp_mode );
    free( p_sys );
}
예제 #13
0
파일: gstpostproc.c 프로젝트: Gioragg1/Test
static void
gst_post_proc_dispose (GObject * object)
{
  GstPostProc *postproc = (GstPostProc *) object;

  if (postproc->mode)
    pp_free_mode (postproc->mode);
  if (postproc->context)
    pp_free_context (postproc->context);

  g_free (postproc->cargs);
  postproc->cargs = NULL;
  g_free (postproc->args);
  postproc->args = NULL;

  G_OBJECT_CLASS (parent_class)->dispose (object);
}
예제 #14
0
FFMS_VideoSource::~FFMS_VideoSource() {
#ifdef FFMS_USE_POSTPROC
	if (PPMode)
		pp_free_mode(PPMode);

	if (PPContext)
		pp_free_context(PPContext);

	avpicture_free(&PPFrame);
#endif // FFMS_USE_POSTPROC

	if (SWS)
		sws_freeContext(SWS);

	avpicture_free(&SWSFrame);
	av_freep(&DecodeFrame);

	Index.Release();
}
예제 #15
0
파일: gstpostproc.c 프로젝트: Gioragg1/Test
static void
change_mode (GstPostProc * postproc)
{
  GstPostProcClass *klass;
  gchar *name;

  klass = (GstPostProcClass *) G_OBJECT_GET_CLASS (G_OBJECT (postproc));

  if (postproc->mode)
    pp_free_mode (postproc->mode);

  name = g_strdup (filterdetails[klass->filterid].shortname);
  append (&name, g_strdup (postproc->cargs));
  append (&name, g_strdup (postproc->args));
  GST_DEBUG_OBJECT (postproc, "requesting pp %s", name);
  postproc->mode = pp_get_mode_by_name_and_quality (name, postproc->quality);
  g_free (name);

  g_assert (postproc->mode);
}
void cleanup(VideoFilter *filter)
{
    pp_free_context(((ThisFilter*)filter)->context);
    pp_free_mode(((ThisFilter*)filter)->mode);
}
예제 #17
0
int tc_filter(frame_list_t *ptr_, char *options)
{
  vframe_list_t *ptr = (vframe_list_t *)ptr_;
  static vob_t *vob=NULL;
  int instance = ptr->filter_id;


  //----------------------------------
  //
  // filter init
  //
  //----------------------------------


  if( (ptr->tag & TC_AUDIO))
	  return 0;

  if(ptr->tag & TC_FRAME_IS_SKIPPED)
	  return 0;

  if(ptr->tag & TC_FILTER_INIT)
  {
    char *c;
    int len=0;

    if((vob = tc_get_vob())==NULL) return(-1);

    if (vob->im_v_codec == CODEC_RGB)
    {
      tc_log_error(MOD_NAME, "filter is not capable for RGB-Mode !");
      return(-1);
    }

    if (!options || !(len=strlen(options)))
    {
      tc_log_error(MOD_NAME, "this filter needs options !");
      return(-1);
    }


    if (!no_optstr(options)) {
	do_optstr(options);
    }

    // if "pre" is found, delete it
    if ( (c=pp_lookup(options, "pre")) ) {
	memmove (c, c+3, &options[len]-c);
	pre[instance] = 1;
    }

    if ( (c=pp_lookup(options, "help")) ) {
	memmove (c, c+4, &options[len]-c);
	optstr_help();
    }

    if (pre[instance]) {
      width[instance] = vob->im_v_width;
      height[instance]= vob->im_v_height;
    } else {
      width[instance] = vob->ex_v_width;
      height[instance]= vob->ex_v_height;
    }

    //tc_log_msg(MOD_NAME, "after pre (%s)", options);

    mode[instance] = pp_get_mode_by_name_and_quality(options, PP_QUALITY_MAX);

    if(mode[instance]==NULL) {
      tc_log_error(MOD_NAME, "internal error (pp_get_mode_by_name_and_quality)");
      return(-1);
    }

    if(tc_accel & AC_MMXEXT)
      context[instance] = pp_get_context(width[instance], height[instance], PP_CPU_CAPS_MMX2);
    else if(tc_accel & AC_3DNOW)
      context[instance] = pp_get_context(width[instance], height[instance], PP_CPU_CAPS_3DNOW);
    else if(tc_accel & AC_MMX)
      context[instance] = pp_get_context(width[instance], height[instance], PP_CPU_CAPS_MMX);
    else
      context[instance] = pp_get_context(width[instance], height[instance], 0);

    if(context[instance]==NULL) {
      tc_log_error(MOD_NAME, "internal error (pp_get_context) (instance=%d)", instance);
      return(-1);
    }

    // filter init ok.
    if(verbose) tc_log_info(MOD_NAME, "%s %s #%d", MOD_VERSION, MOD_CAP, ptr->filter_id);
    return(0);
  }

  //----------------------------------
  //
  // filter configure
  //
  //----------------------------------

  if(ptr->tag & TC_FILTER_GET_CONFIG)
  {
      do_getconfig (options);
      return 0;
  }

  //----------------------------------
  //
  // filter close
  //
  //----------------------------------


  if(ptr->tag & TC_FILTER_CLOSE)
  {
    if (mode[instance])
      pp_free_mode(mode[instance]);
    mode[instance] = NULL;
    if (context[instance])
      pp_free_context(context[instance]);
    context[instance] = NULL;

    return(0);
  }

  //----------------------------------
  //
  // filter frame routine
  //
  //----------------------------------


  // tag variable indicates, if we are called before
  // transcodes internal video/audo frame processing routines
  // or after and determines video/audio context

  if(((ptr->tag & TC_PRE_M_PROCESS  && pre[instance]) ||
	  (ptr->tag & TC_POST_M_PROCESS && !pre[instance])) &&
	  !(ptr->attributes & TC_FRAME_IS_SKIPPED))
  {
    unsigned char *pp_page[3];
    int ppStride[3];

      pp_page[0] = ptr->video_buf;
      pp_page[1] = pp_page[0] + (width[instance] * height[instance]);
      pp_page[2] = pp_page[1] + (width[instance] * height[instance])/4;

      ppStride[0] = width[instance];
      ppStride[1] = ppStride[2] = width[instance]>>1;

      pp_postprocess((void *)pp_page, ppStride,
		     pp_page, ppStride,
		     width[instance], height[instance],
		     NULL, 0, mode[instance], context[instance], 0);
  }