#import "1.1/th_dec_ctx.h"
#define CLIP(X) ((X)>0xFF?0xFF:(X)<0?0:X)
// RGB -> YUV
#define RGB2Y(R,G,B) CLIP((( 66*(R)+129*(G)+ 25*(B)+128)>>8)+ 16)
#define RGB2U(R,G,B) CLIP(((-38*(R)- 74*(G)+112*(B)+128)>>8)+128)
#define RGB2V(R,G,B) CLIP(((112*(R)- 94*(G)- 18*(B)+128)>>8)+128)
void th_encode_erase(th_dec_ctx *tcx) {
int fw = tcx->state.info.frame_width;
int fh = tcx->state.info.frame_height;
/*
OC_FRAME_GOLD (0)
OC_FRAME_PREV (1)
OC_FRAME_SELF (2)
OC_FRAME_IO (3)
*/
for(int k=0; k<2; k++) {
int framei = tcx->state.ref_frame_idx[k];
if(tcx->state.ref_frame_bufs[framei][0].width==fw&&tcx->state.ref_frame_bufs[framei][0].height==fh) {
unsigned char *y_row= tcx->state.ref_frame_bufs[framei][0].data;
unsigned char *u_row= tcx->state.ref_frame_bufs[framei][1].data;
unsigned char *v_row= tcx->state.ref_frame_bufs[framei][2].data;
int y_stride= tcx->state.ref_frame_bufs[framei][0].stride;
int u_stride= tcx->state.ref_frame_bufs[framei][1].stride;
int v_stride= tcx->state.ref_frame_bufs[framei][2].stride;
for(int i=0; i<fh; i++) {
int dc;
unsigned char *y=y_row;
unsigned char *u=u_row;
unsigned char *v=v_row;
for(int j=0; j<fw; j++) {
*y=RGB2Y(0,0,0xFF);
*u=RGB2U(0,0,0xFF);
*v=RGB2V(0,0,0xFF);
dc=(y-y_row&1)|(tcx->state.info.pixel_fmt&1);
y++;
u+=dc;
v+=dc;
}
dc=-((i&1)|tcx->state.info.pixel_fmt>>1);
y_row+=y_stride;
u_row+=dc&u_stride;
v_row+=dc&v_stride;
}
}
}
}
th_encode_erase's Introduction
th_encode_erase's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.