[CinCVS] FFV1 support

2007-01-28 Thread Alberto Mardegan
Hi, if I try to open a file encoded with ffmpeg's FFV1, cinelerra cannot 
load it:

new_vcodec: couldn't find codec for "FFV1"

Since FFV1 is a lossless codec, which I find very useful for applying 
some basic transformations before editing the video in cinelerra (such 
as deinterlacing and scaling), I'd like to add FFV1 support.


I've seen that in the source tree the ffmpeg library is included, and it 
contains the FFV1 codec too. But how can I enable it?


Any hints on how I can hack something?

I'm mostly interested in loading FFV1, saving would be a plus.

Ciao,
  Alberto

___
Cinelerra mailing list
Cinelerra@skolelinux.no
https://init.linpro.no/mailman/skolelinux.no/listinfo/cinelerra


Re: [CinCVS] [PATCH] Load support for FFV1 - crash included :-)

2007-01-28 Thread Alberto Mardegan

Here is some gdb info about the crash.

The error:
Program received signal SIGFPE, Arithmetic exception.
[Switching to Thread -1443935312 (LWP 16044)]
0x08137df0 in AssetPicon::create_objects (this=0x8d040a0) at 
awindowgui.C:149
149 pixmap_w = pixmap_h * 
asset->width / asset->height;



and it's due to the fact that width and height in the asset struct are 
0. And the asset struct looks a bit weird to me:



(gdb) p *asset
$1 = {> = {_vptr.ListItem = 0x8300aa8, previous = 0x0, 
next = 0x0,

owner = 0x853ae30},  = {_vptr.GarbageObject = 0x8300ab8,
users = 1385, deleted = 0, title = 0x8530f10 "Asset"},
  path = "/lacie/Miei/cattura.avi", '\0' , 
"/dev/dsp", '\0' ,
  pipe = '\0' , 
"\020\000\000\000\000\000\000\000?\000\000\000/dev/dv1394", '\0' 
, use_pipe = 0,

  folder = "Media", '\0' , format = 24, audio_data = 1,
  channels = 2, sample_rate = 32000, bits = 16, byte_order = 0, signed_ 
= 0,

  header = 0, dither = 0,
  acodec = "\001\000os", '\0' , "default", '\0' 
,
  audio_length = 15988255, video_data = 1, layers = 0, frame_rate = 
29.970029970029969,
  reel_name = "cin", '\0' , 
"\020\000\000\000\200\000\000\002\000\000\000H,[EMAIL PROTECTED]", 
'\0' , "/dev/dsp", '\0' , 
reel_number = 0,

  tcstart = 0, tcend = 0, tcformat = 0, width = 0, height = 0,
  vcodec = "yuv2", '\0' , "/dev/dsp", '\0' 199 times>,
  video_length = 0, ampeg_bitrate = 256, ampeg_derivative = 3, 
vorbis_min_bitrate = -1,

  vorbis_bitrate = 128000, vorbis_max_bitrate = -1, vorbis_vbr = 0,
  theora_fix_bitrate = 1, theora_bitrate = 86, theora_quality = 16,
  theora_sharpness = 2, theora_keyframe_frequency = 64,
  theora_keyframe_force_frequency = 64, mp3_bitrate = 256000, 
mp4a_bitrate = 256000,

  mp4a_quantqual = 100, aspect_ratio = -1, interlace_autofixoption = 1,
  interlace_mode = 0, interlace_fixmethod = 0, jpeg_quality = 100,
  vmpeg_iframe_distance = 45, vmpeg_progressive = 0, vmpeg_denoise = 1,
  vmpeg_seq_codes = 0, vmpeg_bitrate = 100, vmpeg_derivative = 1,
  vmpeg_quantization = 15, vmpeg_cmodel = 0, vmpeg_fix_bitrate = 0, 
vmpeg_preset = 0,

  vmpeg_field_order = 0, vmpeg_pframe_distance = 0, divx_bitrate = 200,
  divx_rc_period = 50, divx_rc_reaction_ratio = 45, 
divx_rc_reaction_period = 10,
  divx_max_key_interval = 250, divx_max_quantizer = 31, 
divx_min_quantizer = 1,
  divx_quantizer = 5, divx_quality = 5, divx_fix_bitrate = 1, 
h264_bitrate = 200,
  h264_quantizer = 5, h264_fix_bitrate = 0, divx_use_deblocking = 1, 
png_use_alpha = 0,
  exr_use_alpha = 0, exr_compression = 0, tiff_cmodel = 0, 
tiff_compression = 0,

  ms_bitrate = 100, ms_bitrate_tolerance = 50, ms_interlaced = 0,
  ms_quantization = 10, ms_gop_size = 45, ms_fix_bitrate = 1, 
ac3_bitrate = 128,

  use_header = 1, index_status = 0, index_zoom = 128, index_start = 705,
  index_bytes = 606475408, index_end = 0, old_index_end = 0, 
index_offsets = 0x8535c80,

  index_sizes = 0x8cd7e98, index_buffer = 0x0, id = 46}


I said it looks weird, because while I was debugging the loading of the 
video, it detected the video format correctly: the vcodec was set to 
"FFV1", width to 320 and height to 240. Then I got lost in the debugging 
session, and I let gdb continue, till this error was reached.
So, I wonder where the correct asset object has gone, and where this 
"yuv2" codec comes from.


The backtrace:

(gdb) bt
#0  0x08137df0 in AssetPicon::create_objects (this=0x8d040a0) at 
awindowgui.C:149
#1  0x08138b2b in AWindowGUI::update_asset_list (this=0x89c3070) at 
awindowgui.C:798
#2  0x08138e8b in AWindowGUI::update_assets (this=0x89c3070) at 
awindowgui.C:998
#3  0x081391b8 in AWindowGUI::recieve_custom_xatoms (this=0x0, 
event=0x8da2910)

at awindowgui.C:599
#4  0xb7ad32f4 in BC_WindowBase::dispatch_event (this=0x89c3070) at 
bcwindowbase.C:727
#5  0xb7ad3798 in BC_WindowBase::run_window (this=0x89c3070) at 
bcwindowbase.C:614

#6  0xb7ae5cbf in Thread::entrypoint (parameters=0x89c2c30) at thread.C:48
#7  0xb757dced in start_thread () from /lib/tls/libpthread.so.0
#8  0xb7400dee in clone () from /lib/tls/libc.so.6


Someone can please tell me what happened? :-O

Ciao,
  Alberto


___
Cinelerra mailing list
Cinelerra@skolelinux.no
https://init.linpro.no/mailman/skolelinux.no/listinfo/cinelerra


Re: [CinCVS] [PATCH] Load support for FFV1 - crash included :-)

2007-01-27 Thread Alberto Mardegan

Kevin Brosius wrote:

You'll probably need to use gdb and get a backtrace on a copy of cin
with debugging symbols enabled for the info to be useful.


Yep, we'll try!

Can please someone take a look at it, and tell me what is wrong? I guess 
that the patch is not enough, and much more has to be done.


Well, even without knowing much about the quicktime lib, one question
comes to mind.  Where is the code that decodes your new video codec
type?  You seem to have added something that might recognize the type of
codec, but no actual decoding routine?


It's already in ffmpeg :-)

Ciao,
  Alberto

___
Cinelerra mailing list
Cinelerra@skolelinux.no
https://init.linpro.no/mailman/skolelinux.no/listinfo/cinelerra


[CinCVS] [PATCH] Load support for FFV1 - crash included :-)

2007-01-27 Thread Alberto Mardegan
Hi, I want to add support for video compressed with the FFV1 codec. I 
made the attached patch, but cinelerra crashes immediately after the 
video has been loaded.


Here's some info from the crash:

signal_entry: got SIGFPE my pid=5765 execution table size=16:
mwindowedit.C: paste_edls: 1595
mwindowedit.C: paste_edls: 1606
mwindowedit.C: paste_edls: 1609
bchash.C: copy_from: 255
bchash.C: copy_from: 258
bchash.C: copy_from: 267
mwindow.C: load_filenames: 1134
mwindow.C: load_filenames: 1139
mwindow.C: load_filenames: 1142
mwindow.C: load_filenames: 1144
filemov.C: ~FileMOV: 100
filemov.C: ~FileMOV: 102
filemov.C: ~FileMOV: 104
mwindow.C: load_filenames: 1147
mwindow.C: load_filenames: 1151
mwindow.C: load_filenames: 1153
signal_entry: lock table size=13
0x8b225e8 CWindowTool::input_lock CWindowTool::run
0x8521a18 BC_Synchronous::next_command BC_Synchronous::run
0x8b5e588 BC_WindowBase::event_condition BC_WindowBase::get_event
0x8ab82c8 BC_WindowBase::event_condition BC_WindowBase::get_event
0x8b47528 BC_WindowBase::event_condition BC_WindowBase::get_event
0x8c60e40 BC_WindowBase::event_condition BC_WindowBase::get_event
0x8bd2700 TransportQue::output_lock PlaybackEngine::run
0x8bd2cc8 MainIndexes::input_lock MainIndexes::run 1
0x89a47b8 Cinelerra: Resources BC_WindowBase::dispatch_event 1 *
0x8ce1a48 RenderEngine::interrupt_lock RenderEngine::start_command *
0x8ce1988 RenderEngine::start_lock RenderEngine::start_command 2
0x8bd4a68 BC_WindowBase::event_condition BC_WindowBase::get_event
0x89a47b8 Cinelerra: Resources (null)
BC_Signals::dump_buffers: buffer table size=0
BC_Signals::delete_temps: deleting 0 temp files
SigHandler::signal_handler total files=0
Aborted


Can please someone take a look at it, and tell me what is wrong? I guess 
that the patch is not enough, and much more has to be done.


BTW, why is the ffmpeg directory a subdirectory of quicktime? Puzzles me...

Ciao,
  Alberto
Index: quicktime/quicktime.h
===
--- quicktime/quicktime.h	(revision 985)
+++ quicktime/quicktime.h	(working copy)
@@ -50,6 +50,9 @@
 #define QUICKTIME_DVSD "dvsd"
 #define QUICKTIME_DVCP "dvcp"  // PAL video inside Quicktime
 
+/* FFV1 */
+#define QUICKTIME_FFV1 "FFV1"
+
 /* RGB uncompressed.  Allows alpha */
 #define QUICKTIME_RAW  "raw "
 
Index: quicktime/mpeg4.c
===
--- quicktime/mpeg4.c	(revision 985)
+++ quicktime/mpeg4.c	(working copy)
@@ -1279,8 +1279,17 @@
 	result->ffmpeg_id = CODEC_ID_MPEG4;
 }
 
+void quicktime_init_codec_ffv1(quicktime_video_map_t *vtrack)
+{
+	quicktime_mpeg4_codec_t *result = init_common(vtrack, 
+		QUICKTIME_FFV1,
+		"FF vcodec 1",
+		"FF video codec 1 is an experimental lossless video codec");
+	result->ffmpeg_id = CODEC_ID_FFV1;
+}
 
 
 
 
 
+
Index: quicktime/mpeg4.h
===
--- quicktime/mpeg4.h	(revision 985)
+++ quicktime/mpeg4.h	(working copy)
@@ -16,6 +16,7 @@
 extern void quicktime_init_codec_h263(quicktime_video_map_t *);
 extern void quicktime_init_codec_xvid(quicktime_video_map_t *);
 extern void quicktime_init_codec_div5(quicktime_video_map_t *vtrack);
+extern void quicktime_init_codec_ffv1(quicktime_video_map_t *);
 
 
 #endif
Index: quicktime/plugin.c
===
--- quicktime/plugin.c	(revision 985)
+++ quicktime/plugin.c	(working copy)
@@ -98,6 +98,7 @@
 	register_vcodec(quicktime_init_codec_dv);
 	register_vcodec(quicktime_init_codec_dvsd);
 	register_vcodec(quicktime_init_codec_dvcp);
+	register_vcodec(quicktime_init_codec_ffv1);
 
 	register_vcodec(quicktime_init_codec_jpeg);
 	register_vcodec(quicktime_init_codec_mjpa);