diff options
Diffstat (limited to 'modules/theora')
-rw-r--r-- | modules/theora/register_types.cpp | 2 | ||||
-rw-r--r-- | modules/theora/register_types.h | 2 | ||||
-rw-r--r-- | modules/theora/video_stream_theora.cpp | 153 | ||||
-rw-r--r-- | modules/theora/video_stream_theora.h | 2 |
4 files changed, 5 insertions, 154 deletions
diff --git a/modules/theora/register_types.cpp b/modules/theora/register_types.cpp index 1bea5439a3..ae6961b3da 100644 --- a/modules/theora/register_types.cpp +++ b/modules/theora/register_types.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/modules/theora/register_types.h b/modules/theora/register_types.h index cb9f9d1848..7011ee44d0 100644 --- a/modules/theora/register_types.h +++ b/modules/theora/register_types.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp index a83d3ead0e..2a24f8d4d1 100644 --- a/modules/theora/video_stream_theora.cpp +++ b/modules/theora/video_stream_theora.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -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(); diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h index 84b665382b..f04e49c662 100644 --- a/modules/theora/video_stream_theora.h +++ b/modules/theora/video_stream_theora.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ |