mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
Dead code tells no tales
This commit is contained in:
@@ -83,37 +83,6 @@ void VideoStreamPlaybackTheora::video_write(void) {
|
||||
th_ycbcr_buffer yuv;
|
||||
th_decode_ycbcr_out(td, yuv);
|
||||
|
||||
// FIXME: The way stuff is commented out with `//*/` closing comments
|
||||
// sounds very fishy...
|
||||
|
||||
/*
|
||||
int y_offset, uv_offset;
|
||||
y_offset=(ti.pic_x&~1)+yuv[0].stride*(ti.pic_y&~1);
|
||||
|
||||
{
|
||||
int pixels = size.x * size.y;
|
||||
frame_data.resize(pixels * 4);
|
||||
PoolVector<uint8_t>::Write w = frame_data.write();
|
||||
char* dst = (char*)w.ptr();
|
||||
int p = 0;
|
||||
for (int i=0; i<size.y; i++) {
|
||||
|
||||
char *in_y = (char *)yuv[0].data+y_offset+yuv[0].stride*i;
|
||||
char *out = dst + (int)size.x * 4 * i;
|
||||
for (int j=0;j<size.x;j++) {
|
||||
|
||||
dst[p++] = in_y[j];
|
||||
dst[p++] = in_y[j];
|
||||
dst[p++] = in_y[j];
|
||||
dst[p++] = 255;
|
||||
};
|
||||
}
|
||||
format = Image::FORMAT_RGBA8;
|
||||
}
|
||||
//*/
|
||||
|
||||
//*
|
||||
|
||||
int pitch = 4;
|
||||
frame_data.resize(size.x * size.y * pitch);
|
||||
{
|
||||
@@ -142,99 +111,6 @@ void VideoStreamPlaybackTheora::video_write(void) {
|
||||
|
||||
texture->set_data(img); //zero copy send to visual server
|
||||
|
||||
/*
|
||||
|
||||
if (px_fmt == TH_PF_444) {
|
||||
|
||||
int pitch = 3;
|
||||
frame_data.resize(size.x * size.y * pitch);
|
||||
PoolVector<uint8_t>::Write w = frame_data.write();
|
||||
char* dst = (char*)w.ptr();
|
||||
|
||||
for(int i=0;i<size.y;i++) {
|
||||
|
||||
char *in_y = (char *)yuv[0].data+y_offset+yuv[0].stride*i;
|
||||
char *out = dst + (int)size.x * pitch * i;
|
||||
char *in_u = (char *)yuv[1].data+uv_offset+yuv[1].stride*i;
|
||||
char *in_v = (char *)yuv[2].data+uv_offset+yuv[2].stride*i;
|
||||
for (int j=0;j<size.x;j++) {
|
||||
|
||||
out[j*3+0] = in_y[j];
|
||||
out[j*3+1] = in_u[j];
|
||||
out[j*3+2] = in_v[j];
|
||||
};
|
||||
}
|
||||
|
||||
format = Image::FORMAT_YUV_444;
|
||||
|
||||
} else {
|
||||
|
||||
int div;
|
||||
if (px_fmt!=TH_PF_422) {
|
||||
div = 2;
|
||||
}
|
||||
|
||||
bool rgba = true;
|
||||
if (rgba) {
|
||||
|
||||
int pitch = 4;
|
||||
frame_data.resize(size.x * size.y * pitch);
|
||||
PoolVector<uint8_t>::Write w = frame_data.write();
|
||||
char* dst = (char*)w.ptr();
|
||||
|
||||
uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y / div);
|
||||
for(int i=0;i<size.y;i++) {
|
||||
char *in_y = (char *)yuv[0].data+y_offset+yuv[0].stride*i;
|
||||
char *in_u = (char *)yuv[1].data+uv_offset+yuv[1].stride*(i/div);
|
||||
char *in_v = (char *)yuv[2].data+uv_offset+yuv[2].stride*(i/div);
|
||||
uint8_t *out = (uint8_t*)dst + (int)size.x * pitch * i;
|
||||
int ofs = 0;
|
||||
for (int j=0;j<size.x;j++) {
|
||||
|
||||
uint8_t y, u, v;
|
||||
y = in_y[j];
|
||||
u = in_u[j/2];
|
||||
v = in_v[j/2];
|
||||
|
||||
int32_t r = Math::fast_ftoi(1.164 * (y - 16) + 1.596 * (v - 128));
|
||||
int32_t g = Math::fast_ftoi(1.164 * (y - 16) - 0.813 * (v - 128) - 0.391 * (u - 128));
|
||||
int32_t b = Math::fast_ftoi(1.164 * (y - 16) + 2.018 * (u - 128));
|
||||
|
||||
out[ofs++] = CLAMP(r, 0, 255);
|
||||
out[ofs++] = CLAMP(g, 0, 255);
|
||||
out[ofs++] = CLAMP(b, 0, 255);
|
||||
out[ofs++] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
format = Image::FORMAT_RGBA8;
|
||||
|
||||
} else {
|
||||
|
||||
int pitch = 2;
|
||||
frame_data.resize(size.x * size.y * pitch);
|
||||
PoolVector<uint8_t>::Write w = frame_data.write();
|
||||
char* dst = (char*)w.ptr();
|
||||
|
||||
uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y / div);
|
||||
for(int i=0;i<size.y;i++) {
|
||||
char *in_y = (char *)yuv[0].data+y_offset+yuv[0].stride*i;
|
||||
char *out = dst + (int)size.x * pitch * i;
|
||||
for (int j=0;j<size.x;j++)
|
||||
out[j*2] = in_y[j];
|
||||
char *in_u = (char *)yuv[1].data+uv_offset+yuv[1].stride*(i/div);
|
||||
char *in_v = (char *)yuv[2].data+uv_offset+yuv[2].stride*(i/div);
|
||||
for (int j=0;j<(int)size.x>>1;j++) {
|
||||
out[j*4+1] = in_u[j];
|
||||
out[j*4+3] = in_v[j];
|
||||
}
|
||||
}
|
||||
|
||||
format = Image::FORMAT_YUV_422;
|
||||
};
|
||||
};
|
||||
//*/
|
||||
|
||||
frames_pending = 1;
|
||||
}
|
||||
|
||||
@@ -455,15 +331,6 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) {
|
||||
th_decode_ctl(td, TH_DECCTL_SET_PPLEVEL, &pp_level, sizeof(pp_level));
|
||||
pp_inc = 0;
|
||||
|
||||
/*{
|
||||
int arg = 0xffff;
|
||||
th_decode_ctl(td,TH_DECCTL_SET_TELEMETRY_MBMODE,&arg,sizeof(arg));
|
||||
th_decode_ctl(td,TH_DECCTL_SET_TELEMETRY_MV,&arg,sizeof(arg));
|
||||
th_decode_ctl(td,TH_DECCTL_SET_TELEMETRY_QI,&arg,sizeof(arg));
|
||||
arg=10;
|
||||
th_decode_ctl(td,TH_DECCTL_SET_TELEMETRY_BITS,&arg,sizeof(arg));
|
||||
}*/
|
||||
|
||||
int w;
|
||||
int h;
|
||||
w = (ti.pic_x + ti.frame_width + 1 & ~1) - (ti.pic_x & ~1);
|
||||
@@ -502,8 +369,6 @@ void VideoStreamPlaybackTheora::set_file(const String &p_file) {
|
||||
|
||||
float VideoStreamPlaybackTheora::get_time() const {
|
||||
|
||||
//print_line("total: "+itos(get_total())+" todo: "+itos(get_todo()));
|
||||
//return MAX(0,time-((get_total())/(float)vi.rate));
|
||||
return time - AudioServer::get_singleton()->get_output_delay() - delay_compensation; //-((get_total())/(float)vi.rate);
|
||||
};
|
||||
|
||||
@@ -526,8 +391,6 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
|
||||
thread_sem->post();
|
||||
#endif
|
||||
|
||||
//double ctime =AudioServer::get_singleton()->get_mix_time();
|
||||
|
||||
//print_line("play "+rtos(p_delta));
|
||||
time += p_delta;
|
||||
|
||||
@@ -663,8 +526,6 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
|
||||
}
|
||||
}
|
||||
|
||||
//print_line("no theora: "+itos(no_theora)+" theora eos: "+itos(theora_eos)+" frame done "+itos(frame_done));
|
||||
|
||||
#ifdef THEORA_USE_THREAD_STREAMING
|
||||
if (file && thread_eof && no_theora && theora_eos && ring_buffer.data_left() == 0) {
|
||||
#else
|
||||
@@ -674,16 +535,6 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
|
||||
stop();
|
||||
return;
|
||||
};
|
||||
#if 0
|
||||
if (!videobuf_ready || audio_todo > 0){
|
||||
/* no data yet for somebody. Grab another page */
|
||||
|
||||
buffer_data();
|
||||
while(ogg_sync_pageout(&oy,&og)>0){
|
||||
queue_page(&og);
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
if (!frame_done || !audio_done) {
|
||||
//what's the point of waiting for audio to grab a page?
|
||||
@@ -693,7 +544,7 @@ void VideoStreamPlaybackTheora::update(float p_delta) {
|
||||
queue_page(&og);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If playback has begun, top audio buffer off immediately. */
|
||||
//if(stateflag) audio_write_nonblocking();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user