/*!\brief Wrapper of data required to represent linear system of eqns and soln.
*/ typedefstruct { double *A; double *b; double *x; int n;
} aom_equation_system_t;
/*!\brief Representation of a piecewise linear curve * *Holdsnpointsas(x,y)pairs,thatstorethecurve.
*/ typedefstruct { double (*points)[2]; int num_points;
} aom_noise_strength_lut_t;
/*!\brief Init the noise strength lut with the given number of points*/ int aom_noise_strength_lut_init(aom_noise_strength_lut_t *lut, int num_points);
/*!\brief Frees the noise strength lut. */ void aom_noise_strength_lut_free(aom_noise_strength_lut_t *lut);
/*!\brief Evaluate the lut at the point x. * *\param[in]lutThelutdata. *\param[in]xThecoordinatetoevaluatethelut.
*/ double aom_noise_strength_lut_eval(const aom_noise_strength_lut_t *lut, double x);
/*!\brief Helper struct to model noise strength as a function of intensity. * *Internally,thisstructureholdsarepresentationofalinearsystem *ofequationsthatmodelsnoisestrength(standarddeviation)asa *functionofintensity.Themappingisinitiallystoredusinga *piecewiserepresentationwithevenlyspacedbinsthatcovertheentire *domainfrom[min_intensity,max_intensity].Eachobservation(x,y)givesa *constraintoftheform: *y_{i}(1-a)+y_{i+1}a=y *wherey_{i}isthevalueofbiniandx_{i}<=x<=x_{i+1}and *a=x/(x_{i+1}-x{i}).Theequationsystemholdsthecorresponding *normalequations. * *Astheremaybemissingdata,thesolutionisregularizedtogeta *completesetofvaluesforthebins.Areducedrepresentationafter *solvingcanbeobtainedbygettingthecorrespondingnoise_strength_lut_t.
*/ typedefstruct {
aom_equation_system_t eqns; double min_intensity; double max_intensity; int num_bins; int num_equations; double total;
} aom_noise_strength_solver_t;
/*!\brief Initializes the noise solver with the given number of bins. * *Returns0ifinitializationfails. * *\param[in]solverThenoisesolvertobeinitialized. *\param[in]num_binsNumberofbinstouseintheinternalrepresentation. *\param[in]bit_depthThebitdepthusedtoderive{min,max}_intensity.
*/ int aom_noise_strength_solver_init(aom_noise_strength_solver_t *solver, int num_bins, int bit_depth); void aom_noise_strength_solver_free(aom_noise_strength_solver_t *solver);
/*!\brief Gets the x coordinate of bin i. * *\param[in]iThebinwhosecoordinatetoquery.
*/ double aom_noise_strength_solver_get_center( const aom_noise_strength_solver_t *solver, int i);
/*!\brief Add an observation of the block mean intensity to its noise strength. * *\param[in]block_meanTheaverageblockintensity, *\param[in]noise_stdTheobservednoisestrength.
*/ void aom_noise_strength_solver_add_measurement(
aom_noise_strength_solver_t *solver, double block_mean, double noise_std);
/*!\brief Solves the current set of equations for the noise strength. */ int aom_noise_strength_solver_solve(aom_noise_strength_solver_t *solver);
/*!\brief Fits a reduced piecewise linear lut to the internal solution * *\param[in]max_num_pointsThemaximumnumberofoutputpoints *\param[out]lutTheoutputpiecewiselinearlut.
*/ int aom_noise_strength_solver_fit_piecewise( const aom_noise_strength_solver_t *solver, int max_num_points,
aom_noise_strength_lut_t *lut);
/*!\brief Helper for holding precomputed data for finding flat blocks. * *Internallyablockismodeledwithalow-orderpolynomialmodel.A *planarmodelwouldbeabunchofequationslike: *<[y_ix_i1],[a_1,a_2,a_3]>=b_i *foreachpointintheblock.ThesystemmatrixAwithrowias[y_ix_i1] *ismaintainedasistheinverse,inv(A'*A),sothattheplaneparameters *canbefitforeachblock.
*/ typedefstruct { double *AtA_inv; double *A; int num_params; // The number of parameters used for internal low-order model int block_size; // The block size the finder was initialized with double normalization; // Normalization factor (1 / (2^(bit_depth) - 1)) int use_highbd; // Whether input data should be interpreted as uint16
} aom_flat_block_finder_t;
/*!\brief Init the block_finder with the given block size, bit_depth */ int aom_flat_block_finder_init(aom_flat_block_finder_t *block_finder, int block_size, int bit_depth, int use_highbd); void aom_flat_block_finder_free(aom_flat_block_finder_t *block_finder);
/*!\brief Helper to extract a block and low order "planar" model. */ void aom_flat_block_finder_extract_block( const aom_flat_block_finder_t *block_finder, const uint8_t *const data, int w, int h, int stride, int offsx, int offsy, double *plane, double *block);
/*!\brief Runs the flat block finder on the input data. * *Findflatblocksintheinputimagedata.Returnsamapof *flat_blocks,wherethevalueofflat_blocksmapwillbenon-zero *whenablockisdeterminedtobeflat.Ahighervalueindicatesabigger *confidenceinthedecision.
*/ int aom_flat_block_finder_run(const aom_flat_block_finder_t *block_finder, const uint8_t *const data, int w, int h, int stride, uint8_t *flat_blocks);
// The noise shape indicates the allowed coefficients in the AR model. enum {
AOM_NOISE_SHAPE_DIAMOND = 0,
AOM_NOISE_SHAPE_SQUARE = 1
} UENUM1BYTE(aom_noise_shape);
// The parameters of the noise model include the shape type, lag, the // bit depth of the input images provided, and whether the input images // will be using uint16 (or uint8) representation. typedefstruct {
aom_noise_shape shape; int lag; int bit_depth; int use_highbd;
} aom_noise_model_params_t;
/*!\brief State of a noise model estimate for a single channel. * *Thiscontainsasystemofequationsthatcanbeusedtosolve *fortheauto-regressivecoefficientsaswellasanoisestrength *solverthatcanbeusedtomodelnoisestrengthasafunctionof *intensity.
*/ typedefstruct {
aom_equation_system_t eqns;
aom_noise_strength_solver_t strength_solver; int num_observations; // The number of observations in the eqn system double ar_gain; // The gain of the current AR filter
} aom_noise_state_t;
/*!\brief Complete model of noise for a planar video * *Thisincludesanoisemodelforthelatestframeandanaggregated *estimateoverallpreviousframesthathadsimilarparameters.
*/ typedefstruct {
aom_noise_model_params_t params;
aom_noise_state_t combined_state[3]; // Combined state per channel
aom_noise_state_t latest_state[3]; // Latest state per channel int (*coords)[2]; // Offsets (x,y) of the coefficient samples int n; // Number of parameters (size of coords) int bit_depth;
} aom_noise_model_t;
/*!\brief Result of a noise model update. */ enum {
AOM_NOISE_STATUS_OK = 0,
AOM_NOISE_STATUS_INVALID_ARGUMENT,
AOM_NOISE_STATUS_INSUFFICIENT_FLAT_BLOCKS,
AOM_NOISE_STATUS_DIFFERENT_NOISE_TYPE,
AOM_NOISE_STATUS_INTERNAL_ERROR,
} UENUM1BYTE(aom_noise_status_t);
/*!\brief Initializes a noise model with the given parameters. * *Returns0onfailure.
*/ int aom_noise_model_init(aom_noise_model_t *model, const aom_noise_model_params_t params); void aom_noise_model_free(aom_noise_model_t *model);
/*!\brief Updates the noise model with a new frame observation. * *Updatesthenoisemodelwithmeasurementsfromthegiveninputframeanda *denoisedvariantofit.Noiseissampledfromflatblocksusingtheflat *blockmap. * *Returnsanoise_statusindicatingiftheupdatewassuccessful.Ifthe *Updatewassuccessful,thecombined_stateisupdatedwithmeasurementsfrom *theprovidedframe.IfstatusisOKorDIFFERENT_NOISE_TYPE,thelatestnoise *statewillbeupdatedwithmeasurementsfromtheprovidedframe. * *\param[in,out]noise_modelThenoisemodeltobeupdated *\param[in]dataRawframedata *\param[in]denoisedDenoisedframedata. *\param[in]wFramewidth *\param[in]hFrameheight *\param[in]stridesStrideoftheplanes *\param[in]chroma_sub_log2Chromasubsamplingforplanes!=0. *\param[in]flat_blocksAmaptoblocksthathavebeendeterminedflat *\param[in]block_sizeThesizeofblocks.
*/
aom_noise_status_t aom_noise_model_update(
aom_noise_model_t *const noise_model, const uint8_t *const data[3], const uint8_t *const denoised[3], int w, int h, int strides[3], int chroma_sub_log2[2], const uint8_t *const flat_blocks, int block_size);
/*\brief Save the "latest" estimate into the "combined" estimate. * *Thisismeanttobecalledwhenthenoisemodelingdetectedachange *inparameters(orforexample,ifauserwantedtoresetestimationat *ashotboundary).
*/ void aom_noise_model_save_latest(aom_noise_model_t *noise_model);
/*!\brief Converts the noise_model parameters to the corresponding *grain_parameters. * *Thenoisestructsinthisfilearesuitableforestimation(e.g.,using *floats),butthegrainparametersinthebitstreamarequantized.This *functiondoestheconversionbyselectingthecorrectquantizationlevels.
*/ int aom_noise_model_get_grain_parameters(aom_noise_model_t *const noise_model,
aom_film_grain_t *film_grain);
/*!\brief Perform a Wiener filter denoising in 2D using the provided noise psd. * *\param[in]dataRawframedata *\param[out]denoisedDenoisedframedata *\param[in]wFramewidth *\param[in]hFrameheight *\param[in]strideStrideoftheplanes *\param[in]chroma_sub_log2Chromasubsamplingforplanes!=0. *\param[in]noise_psdThepowerspectraldensityofthenoise *\param[in]block_sizeThesizeofblocks *\param[in]bit_depthBitdepthoftheimage *\param[in]use_highbdIftrue,uint8pointersareinterpretedas *uint16andstrideismeasuredinuint16. *Thismustbetruewhenbit_depth>=10.
*/ int aom_wiener_denoise_2d(const uint8_t *const data[3], uint8_t *denoised[3], int w, int h, int stride[3], int chroma_sub_log2[2], float *noise_psd[3], int block_size, int bit_depth, int use_highbd);
struct aom_denoise_and_model_t;
/*!\brief Denoise the buffer and model the residual noise. * *Thisismeanttobecalledsequentiallyoninputframes.Theinputbuffer *isdenoisedandtheresidualnoiseismodelled.Thecurrentnoiseestimate *ispopulatedinfilm_grain.Returnstrueonsuccess.Thegrain.apply_grain *parameterwillbetruewhentheinputbufferwassuccessfullydenoisedand *grainwasmodelled.Returnsfalseonerror. * *\param[in]ctxStructallocatedwith *aom_denoise_and_model_allocthatholdssome *buffersfordenoisingandthecurrentnoise *estimate. *\param[in,out]sdTherawinputbuffertobedenoised. *\param[out]grainOutputfilmgrainparameters *\param[in]apply_denoiseWhetherornottoapplythedenoisingtothe *framethatwillbeencoded
*/ int aom_denoise_and_model_run(struct aom_denoise_and_model_t *ctx, const YV12_BUFFER_CONFIG *sd,
aom_film_grain_t *grain, int apply_denoise);
/*!\brief Allocates a context that can be used for denoising and noise modeling. * *\param[in]bit_depthBitdepthofbuffersthiswillberunon. *\param[in]block_sizeBlocksizefornoisemodelingandflatblock *estimation *\param[in]noise_levelThenoise_level(2.5formoderatenoise,and5for *higherlevelsofnoise)
*/ struct aom_denoise_and_model_t *aom_denoise_and_model_alloc(int bit_depth, int block_size, float noise_level);
/*!\brief Frees the denoise context allocated with aom_denoise_and_model_alloc
*/ void aom_denoise_and_model_free(struct aom_denoise_and_model_t *denoise_model);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.