Skip to content

Commit

Permalink
Merge pull request #180 from K-os/film_grain_refactor
Browse files Browse the repository at this point in the history
Film grain refactoring
  • Loading branch information
adamjw24 authored Jun 3, 2024
2 parents 5d55e85 + d364389 commit b4b8b40
Show file tree
Hide file tree
Showing 9 changed files with 1,349 additions and 1,183 deletions.
769 changes: 769 additions & 0 deletions source/Lib/FilmGrain/FilmGrain.cpp

Large diffs are not rendered by default.

61 changes: 37 additions & 24 deletions source/Lib/vvdec/vfgs_fw.h → source/Lib/FilmGrain/FilmGrain.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,32 +54,45 @@ POSSIBILITY OF SUCH DAMAGE.
* message).
*/

#ifndef _VFGS_FW_H_
#define _VFGS_FW_H_

#ifndef int32
#define int32 signed int
#define uint32 unsigned int
#define int16 signed short
#define uint16 unsigned short
#define int8 signed char
#define uint8 unsigned char
#endif
#pragma once

#define SEI_MAX_MODEL_VALUES 6
#include "FilmGrainImpl.h"

#include <cstring>

typedef struct fgs_sei_s {
uint8 model_id;
uint8 log2_scale_factor;
uint8 comp_model_present_flag[3];
uint16 num_intensity_intervals[3];
uint8 num_model_values[3];
uint8 intensity_interval_lower_bound[3][256];
uint8 intensity_interval_upper_bound[3][256];
int16 comp_model_value[3][256][SEI_MAX_MODEL_VALUES];
} fgs_sei;
#include "vvdec/sei.h"

void vfgs_init_sei(fgs_sei* cfg);
namespace vvdec
{

#endif // _VFGS_FW_H_
#define SEI_MAX_MODEL_VALUES 6

struct fgs_sei
{
fgs_sei() { memset( this, 0, sizeof( *this ) ); }

uint8_t model_id;
uint8_t log2_scale_factor;
uint8_t comp_model_present_flag[3];
uint16_t num_intensity_intervals[3];
uint8_t num_model_values[3];
uint8_t intensity_interval_lower_bound[3][256];
uint8_t intensity_interval_upper_bound[3][256];
int16_t comp_model_value[3][256][SEI_MAX_MODEL_VALUES];
};

class FilmGrain : public FilmGrainImpl
{
public:
FilmGrain( int depth, int chromaSubsampling )
{
set_depth( depth );
set_chroma_subsampling( chromaSubsampling, chromaSubsampling );
}
void updateFGC( vvdecSEIFilmGrainCharacteristics* fgc );

private:
void init_sei( fgs_sei* cfg );
};

} // namespace vvdec
Loading

0 comments on commit b4b8b40

Please sign in to comment.