Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Film grain refactoring #180

Merged
merged 8 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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