Class OptimizationStep

java.lang.Object
org.opencastproject.videosegmenter.ffmpeg.OptimizationStep
All Implemented Interfaces:
Comparable<OptimizationStep>

public class OptimizationStep extends Object implements Comparable<OptimizationStep>
An optimization step is one step in the optimization of the number of segments. This class stores parameters of such an optimization step and calculates error and absolute error of optimization
  • Constructor Details

    • OptimizationStep

      public OptimizationStep(float changesThreshold, int segNum, int prefNum, Mpeg7Catalog mpeg7, LinkedList<Segment> segments)
      creates a new optimization step with given parameters
      Parameters:
      changesThreshold -
      segNum -
      prefNum -
      mpeg7 -
      segments - unfiltered list of segments
    • OptimizationStep

      public OptimizationStep()
      creates a new optimization step with default values
  • Method Details

    • getChangesThreshold

      public float getChangesThreshold()
      get changesThreshold
      Returns:
      changesThreshold
    • getError

      public float getError()
      get error of optimization
      Returns:
      error error of optimization
    • getErrorAbs

      public float getErrorAbs()
      get absolute error
      Returns:
      errorAbs absolute error
    • getSegmentNum

      public int getSegmentNum()
      get number of segments
      Returns:
      segmentNum number of segments
    • setSegmentNumAndRecalcErrors

      public void setSegmentNumAndRecalcErrors(int segNum)
      set number of segments
      Parameters:
      segNum - number of segments
    • getMpeg7

      public Mpeg7Catalog getMpeg7()
      get Mpeg7Catalog with segments
      Returns:
      mpeg7 Mpeg7Catalog with segments
    • getSegments

      public LinkedList<Segment> getSegments()
      get list of segments
      Returns:
      segments list of segments
    • calculateErrorAbs

      public static float calculateErrorAbs(int segmentNum, int prefNum)
      calculates absolute error from given number of segments and preferred number of segments
      Parameters:
      segmentNum - number of segments
      prefNum - preferred number of segments
      Returns:
    • compareTo

      public int compareTo(OptimizationStep o)
      With this method a list of OptimizationSteps can be sorted such that the smallest positive error is the first element of the list and the smallest negative error is the last element of the list
      Specified by:
      compareTo in interface Comparable<OptimizationStep>
      Parameters:
      o - the OptimizationStep to be compared.
      Returns:
      a negative integer or a positive integer as this OptimizationStep should be placed to the left or right of the specified OptimizationStep or zero if their errors are equal.