From f9d0d999e813ae19965e07ae2f7da690b4e6fe45 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Mon, 31 Aug 2015 19:45:21 -0600 Subject: [PATCH] remove old quicktime, replaced with current ffmpeg --- cinelerra-5.0/Makefile | 2 - cinelerra-5.0/cinelerra/Makefile | 27 +- cinelerra-5.0/cinelerra/asset.C | 39 +- cinelerra-5.0/cinelerra/assets.C | 1 - cinelerra-5.0/cinelerra/awindowgui.C | 2 +- cinelerra-5.0/cinelerra/bitspopup.C | 3 - cinelerra-5.0/cinelerra/bitspopup.h | 3 +- cinelerra-5.0/cinelerra/compresspopup.C | 1 - cinelerra-5.0/cinelerra/devicev4l2base.C | 1 - cinelerra-5.0/cinelerra/devicev4l2input.C | 1 - cinelerra-5.0/cinelerra/edl.C | 2 +- cinelerra-5.0/cinelerra/edlsession.C | 22 +- cinelerra-5.0/cinelerra/ffmpeg.C | 6 + cinelerra-5.0/cinelerra/file.C | 89 - cinelerra-5.0/cinelerra/file.h | 3 + cinelerra-5.0/cinelerra/file.inc | 17 - cinelerra-5.0/cinelerra/fileavi.C | 1202 -------- cinelerra-5.0/cinelerra/fileavi.h | 219 -- cinelerra-5.0/cinelerra/fileavi.inc | 34 - cinelerra-5.0/cinelerra/filebase.C | 5 +- cinelerra-5.0/cinelerra/filebase.h | 21 +- cinelerra-5.0/cinelerra/filebaseima4.C | 268 -- cinelerra-5.0/cinelerra/filecr2.C | 2 +- cinelerra-5.0/cinelerra/filedv.C | 8 +- cinelerra-5.0/cinelerra/fileexr.C | 4 +- cinelerra-5.0/cinelerra/fileflac.C | 11 +- cinelerra-5.0/cinelerra/filejpeg.C | 6 - cinelerra-5.0/cinelerra/filejpeglist.C | 6 +- cinelerra-5.0/cinelerra/filemov.C | 2240 -------------- cinelerra-5.0/cinelerra/filemov.h | 369 --- cinelerra-5.0/cinelerra/filemov.inc | 27 - cinelerra-5.0/cinelerra/filempeg.C | 11 - cinelerra-5.0/cinelerra/filempeg.h | 3 - cinelerra-5.0/cinelerra/fileogg.C | 2 - cinelerra-5.0/cinelerra/filepng.C | 6 - cinelerra-5.0/cinelerra/filepng.C.orig | 481 --- cinelerra-5.0/cinelerra/filescene.C | 3 +- cinelerra-5.0/cinelerra/formatcheck.C | 9 - cinelerra-5.0/cinelerra/formatpopup.C | 5 +- cinelerra-5.0/cinelerra/formattools.C | 56 +- cinelerra-5.0/cinelerra/formatwindow.C | 32 +- cinelerra-5.0/cinelerra/formatwindow.h | 10 - .../{quicktime/libdv.c => cinelerra/libdv.C} | 16 +- .../{quicktime => cinelerra}/libdv.h | 1 + .../libmjpeg.c => cinelerra/libmjpeg.C} | 139 +- .../{quicktime => cinelerra}/libmjpeg.h | 2 + cinelerra-5.0/cinelerra/menuveffects.C | 30 +- cinelerra-5.0/cinelerra/mwindow.C | 22 +- cinelerra-5.0/cinelerra/playbackprefs.C | 20 - cinelerra-5.0/cinelerra/record.C | 14 +- cinelerra-5.0/cinelerra/recordgui.C | 6 +- cinelerra-5.0/cinelerra/recordvideo.C | 4 +- cinelerra-5.0/cinelerra/render.C | 2 - cinelerra-5.0/cinelerra/resourcepixmap.C | 2 +- cinelerra-5.0/cinelerra/vdevice1394.h | 1 - cinelerra-5.0/cinelerra/vdevicebuz.h | 1 - cinelerra-5.0/cinelerra/vdevicelml.C | 3 - cinelerra-5.0/cinelerra/vdevicelml.h | 2 - cinelerra-5.0/cinelerra/vdevicev4l.C | 1 - cinelerra-5.0/cinelerra/vdevicex11.C | 2 +- cinelerra-5.0/cinelerra/videodevice.C | 49 +- cinelerra-5.0/configure | 8 - cinelerra-5.0/db/s.C | 731 ----- cinelerra-5.0/global_config | 2 - cinelerra-5.0/mpeg2enc/Makefile | 3 +- cinelerra-5.0/mpeg2enc/global.h | 3 - cinelerra-5.0/mpeg2enc/mpeg2enc.c | 49 +- cinelerra-5.0/mpeg2enc/readpic.c | 109 - cinelerra-5.0/mpeg2enc/writepic.c | 17 - cinelerra-5.0/plugins/aging/aging.C | 2 +- cinelerra-5.0/plugins/blurzoom/blurzoom.C | 2 +- cinelerra-5.0/plugins/burn/burn.C | 2 +- cinelerra-5.0/plugins/dot/dot.C | 2 +- cinelerra-5.0/plugins/flip/flip.C | 2 +- cinelerra-5.0/plugins/holo/holo.C | 2 +- .../plugins/interpolate/interpolate.C | 4 +- cinelerra-5.0/plugins/ivtc/ivtc.C | 2 +- cinelerra-5.0/plugins/libeffecttv/effecttv.C | 2 +- cinelerra-5.0/plugins/quark/quark.C | 2 +- cinelerra-5.0/plugins/rgb601/ivtc.C.2 | 2 +- cinelerra-5.0/plugins/rgb601/rgb601.C | 2 +- cinelerra-5.0/plugins/sharpen/sharpen.C | 4 +- cinelerra-5.0/plugins/titler/title.C | 2 +- cinelerra-5.0/plugins/titler/title.C.stroker | 2 +- cinelerra-5.0/quicktime/CHANGELOG | 8 - cinelerra-5.0/quicktime/COPYING | 515 ---- cinelerra-5.0/quicktime/Makefile | 358 --- cinelerra-5.0/quicktime/README | 53 - cinelerra-5.0/quicktime/atom.c | 229 -- cinelerra-5.0/quicktime/avcc.c | 64 - cinelerra-5.0/quicktime/avi_hdrl.c | 216 -- cinelerra-5.0/quicktime/avi_idx1.c | 179 -- cinelerra-5.0/quicktime/avi_indx.c | 170 -- cinelerra-5.0/quicktime/avi_ix.c | 141 - cinelerra-5.0/quicktime/avi_movi.c | 64 - cinelerra-5.0/quicktime/avi_odml.c | 39 - cinelerra-5.0/quicktime/avi_riff.c | 432 --- cinelerra-5.0/quicktime/avi_strl.c | 452 --- cinelerra-5.0/quicktime/cmodel_default.c | 2169 ------------- cinelerra-5.0/quicktime/cmodel_float.c | 894 ------ cinelerra-5.0/quicktime/cmodel_permutation.h | 2705 ----------------- cinelerra-5.0/quicktime/cmodel_yuv420p.c | 1345 -------- cinelerra-5.0/quicktime/cmodel_yuv422.c | 556 ---- cinelerra-5.0/quicktime/codecs.c | 398 --- cinelerra-5.0/quicktime/codecs.h | 4 - cinelerra-5.0/quicktime/colormodels.c | 551 ---- cinelerra-5.0/quicktime/colormodels.h | 156 - cinelerra-5.0/quicktime/configure | 48 - cinelerra-5.0/quicktime/ctab.c | 62 - cinelerra-5.0/quicktime/dechunk.c | 126 - cinelerra-5.0/quicktime/dinf.c | 45 - cinelerra-5.0/quicktime/docs/building.html | 36 - cinelerra-5.0/quicktime/docs/codecs.html | 117 - cinelerra-5.0/quicktime/docs/firewire.html | 175 -- cinelerra-5.0/quicktime/docs/index.html | 88 - cinelerra-5.0/quicktime/docs/license.html | 52 - cinelerra-5.0/quicktime/docs/opening.html | 54 - cinelerra-5.0/quicktime/docs/positioning.html | 34 - cinelerra-5.0/quicktime/docs/reading.html | 323 -- cinelerra-5.0/quicktime/docs/util.html | 18 - cinelerra-5.0/quicktime/docs/writing.html | 215 -- cinelerra-5.0/quicktime/dref.c | 132 - cinelerra-5.0/quicktime/dump.c | 29 - cinelerra-5.0/quicktime/edts.c | 46 - cinelerra-5.0/quicktime/elst.c | 112 - cinelerra-5.0/quicktime/esds.c | 236 -- cinelerra-5.0/quicktime/frma.c | 51 - cinelerra-5.0/quicktime/funcprotos.h | 664 ---- cinelerra-5.0/quicktime/graphics.c | 104 - cinelerra-5.0/quicktime/graphics.h | 22 - cinelerra-5.0/quicktime/hdlr.c | 97 - cinelerra-5.0/quicktime/ima4.c | 556 ---- cinelerra-5.0/quicktime/ima4.h | 7 - cinelerra-5.0/quicktime/jpeg.c | 411 --- cinelerra-5.0/quicktime/jpeg.h | 9 - cinelerra-5.0/quicktime/make_streamable.c | 16 - cinelerra-5.0/quicktime/matrix.c | 43 - cinelerra-5.0/quicktime/mdat.c | 15 - cinelerra-5.0/quicktime/mdhd.c | 79 - cinelerra-5.0/quicktime/mdia.c | 100 - cinelerra-5.0/quicktime/minf.c | 123 - cinelerra-5.0/quicktime/mmx.h | 733 ----- cinelerra-5.0/quicktime/moov.c | 291 -- cinelerra-5.0/quicktime/mp4a.c | 374 --- cinelerra-5.0/quicktime/mp4a.h | 9 - cinelerra-5.0/quicktime/mpeg4.c | 1268 -------- cinelerra-5.0/quicktime/mpeg4.h | 22 - cinelerra-5.0/quicktime/mts2mp4.c | 703 ----- cinelerra-5.0/quicktime/mvhd.c | 106 - cinelerra-5.0/quicktime/plugin.c | 231 -- cinelerra-5.0/quicktime/qdm2.c | 331 -- cinelerra-5.0/quicktime/qdm2.h | 9 - cinelerra-5.0/quicktime/qtasf.c | 261 -- cinelerra-5.0/quicktime/qtasf.h | 100 - cinelerra-5.0/quicktime/qtasf_codes.h | 103 - cinelerra-5.0/quicktime/qtbak.txz | Bin 47100 -> 0 bytes cinelerra-5.0/quicktime/qtcache.c | 208 -- cinelerra-5.0/quicktime/qtdv.c | 448 --- cinelerra-5.0/quicktime/qtdv.h | 9 - cinelerra-5.0/quicktime/qtffmpeg.c | 340 --- cinelerra-5.0/quicktime/qtffmpeg.h | 76 - cinelerra-5.0/quicktime/qth264.c | 393 --- cinelerra-5.0/quicktime/qth264.h | 13 - cinelerra-5.0/quicktime/qtinfo.c | 64 - cinelerra-5.0/quicktime/qtmp3.c | 369 --- cinelerra-5.0/quicktime/qtmp3.h | 14 - cinelerra-5.0/quicktime/qtpng.c | 270 -- cinelerra-5.0/quicktime/qtpng.h | 7 - cinelerra-5.0/quicktime/qtprivate.h | 866 ------ cinelerra-5.0/quicktime/qtvorbis.h | 7 - cinelerra-5.0/quicktime/quicktime.c | 1455 --------- cinelerra-5.0/quicktime/quicktime.h | 450 --- cinelerra-5.0/quicktime/raw.c | 229 -- cinelerra-5.0/quicktime/raw.h | 6 - cinelerra-5.0/quicktime/rawaudio.c | 215 -- cinelerra-5.0/quicktime/rawaudio.h | 7 - cinelerra-5.0/quicktime/rechunk.c | 125 - cinelerra-5.0/quicktime/recover.c | 755 ----- cinelerra-5.0/quicktime/rle.c | 231 -- cinelerra-5.0/quicktime/rle.h | 10 - cinelerra-5.0/quicktime/smhd.c | 47 - cinelerra-5.0/quicktime/stbl.c | 142 - cinelerra-5.0/quicktime/stco.c | 109 - cinelerra-5.0/quicktime/stsc.c | 142 - cinelerra-5.0/quicktime/stsd.c | 127 - cinelerra-5.0/quicktime/stsdtable.c | 489 --- cinelerra-5.0/quicktime/stss.c | 75 - cinelerra-5.0/quicktime/stsz.c | 165 - cinelerra-5.0/quicktime/stts.c | 196 -- cinelerra-5.0/quicktime/test.mp4 | Bin 24260391 -> 0 bytes cinelerra-5.0/quicktime/tkhd.c | 104 - cinelerra-5.0/quicktime/trak.c | 636 ---- cinelerra-5.0/quicktime/twos.c | 367 --- cinelerra-5.0/quicktime/twos.h | 7 - cinelerra-5.0/quicktime/udta.c | 183 -- cinelerra-5.0/quicktime/ulaw.c | 349 --- cinelerra-5.0/quicktime/ulaw.h | 7 - cinelerra-5.0/quicktime/util.c | 753 ----- cinelerra-5.0/quicktime/v308.c | 150 - cinelerra-5.0/quicktime/v308.h | 8 - cinelerra-5.0/quicktime/v408.c | 150 - cinelerra-5.0/quicktime/v408.h | 8 - cinelerra-5.0/quicktime/v410.c | 200 -- cinelerra-5.0/quicktime/v410.h | 8 - cinelerra-5.0/quicktime/vbraudio.c | 223 -- cinelerra-5.0/quicktime/vmhd.c | 61 - cinelerra-5.0/quicktime/vorbis.c | 866 ------ cinelerra-5.0/quicktime/wma.c | 323 -- cinelerra-5.0/quicktime/wma.h | 7 - cinelerra-5.0/quicktime/wmx2.c | 490 --- cinelerra-5.0/quicktime/wmx2.h | 7 - cinelerra-5.0/quicktime/workarounds.c | 17 - cinelerra-5.0/quicktime/workarounds.h | 10 - cinelerra-5.0/quicktime/yuv2.c | 257 -- cinelerra-5.0/quicktime/yuv2.h | 8 - cinelerra-5.0/quicktime/yuv2mov.c | 112 - cinelerra-5.0/quicktime/yuv4.c | 187 -- cinelerra-5.0/quicktime/yuv4.h | 9 - cinelerra-5.0/quicktime/yuv4toyuv.c | 98 - cinelerra-5.0/quicktime/yv12.c | 201 -- cinelerra-5.0/quicktime/yv12.h | 7 - cinelerra-5.0/thirdparty/configure | 2 +- 222 files changed, 236 insertions(+), 40654 deletions(-) delete mode 100644 cinelerra-5.0/cinelerra/fileavi.C delete mode 100644 cinelerra-5.0/cinelerra/fileavi.h delete mode 100644 cinelerra-5.0/cinelerra/fileavi.inc delete mode 100644 cinelerra-5.0/cinelerra/filebaseima4.C delete mode 100644 cinelerra-5.0/cinelerra/filemov.C delete mode 100644 cinelerra-5.0/cinelerra/filemov.h delete mode 100644 cinelerra-5.0/cinelerra/filemov.inc delete mode 100644 cinelerra-5.0/cinelerra/filepng.C.orig rename cinelerra-5.0/{quicktime/libdv.c => cinelerra/libdv.C} (92%) rename cinelerra-5.0/{quicktime => cinelerra}/libdv.h (97%) rename cinelerra-5.0/{quicktime/libmjpeg.c => cinelerra/libmjpeg.C} (92%) rename cinelerra-5.0/{quicktime => cinelerra}/libmjpeg.h (99%) delete mode 100644 cinelerra-5.0/db/s.C delete mode 100644 cinelerra-5.0/quicktime/CHANGELOG delete mode 100644 cinelerra-5.0/quicktime/COPYING delete mode 100644 cinelerra-5.0/quicktime/Makefile delete mode 100644 cinelerra-5.0/quicktime/README delete mode 100644 cinelerra-5.0/quicktime/atom.c delete mode 100644 cinelerra-5.0/quicktime/avcc.c delete mode 100755 cinelerra-5.0/quicktime/avi_hdrl.c delete mode 100755 cinelerra-5.0/quicktime/avi_idx1.c delete mode 100644 cinelerra-5.0/quicktime/avi_indx.c delete mode 100644 cinelerra-5.0/quicktime/avi_ix.c delete mode 100644 cinelerra-5.0/quicktime/avi_movi.c delete mode 100644 cinelerra-5.0/quicktime/avi_odml.c delete mode 100644 cinelerra-5.0/quicktime/avi_riff.c delete mode 100644 cinelerra-5.0/quicktime/avi_strl.c delete mode 100644 cinelerra-5.0/quicktime/cmodel_default.c delete mode 100644 cinelerra-5.0/quicktime/cmodel_float.c delete mode 100644 cinelerra-5.0/quicktime/cmodel_permutation.h delete mode 100644 cinelerra-5.0/quicktime/cmodel_yuv420p.c delete mode 100644 cinelerra-5.0/quicktime/cmodel_yuv422.c delete mode 100644 cinelerra-5.0/quicktime/codecs.c delete mode 100644 cinelerra-5.0/quicktime/codecs.h delete mode 100755 cinelerra-5.0/quicktime/colormodels.c delete mode 100644 cinelerra-5.0/quicktime/colormodels.h delete mode 100755 cinelerra-5.0/quicktime/configure delete mode 100644 cinelerra-5.0/quicktime/ctab.c delete mode 100644 cinelerra-5.0/quicktime/dechunk.c delete mode 100644 cinelerra-5.0/quicktime/dinf.c delete mode 100644 cinelerra-5.0/quicktime/docs/building.html delete mode 100644 cinelerra-5.0/quicktime/docs/codecs.html delete mode 100644 cinelerra-5.0/quicktime/docs/firewire.html delete mode 100644 cinelerra-5.0/quicktime/docs/index.html delete mode 100644 cinelerra-5.0/quicktime/docs/license.html delete mode 100644 cinelerra-5.0/quicktime/docs/opening.html delete mode 100644 cinelerra-5.0/quicktime/docs/positioning.html delete mode 100644 cinelerra-5.0/quicktime/docs/reading.html delete mode 100644 cinelerra-5.0/quicktime/docs/util.html delete mode 100644 cinelerra-5.0/quicktime/docs/writing.html delete mode 100644 cinelerra-5.0/quicktime/dref.c delete mode 100644 cinelerra-5.0/quicktime/dump.c delete mode 100644 cinelerra-5.0/quicktime/edts.c delete mode 100644 cinelerra-5.0/quicktime/elst.c delete mode 100644 cinelerra-5.0/quicktime/esds.c delete mode 100644 cinelerra-5.0/quicktime/frma.c delete mode 100644 cinelerra-5.0/quicktime/funcprotos.h delete mode 100644 cinelerra-5.0/quicktime/graphics.c delete mode 100644 cinelerra-5.0/quicktime/graphics.h delete mode 100644 cinelerra-5.0/quicktime/hdlr.c delete mode 100644 cinelerra-5.0/quicktime/ima4.c delete mode 100644 cinelerra-5.0/quicktime/ima4.h delete mode 100755 cinelerra-5.0/quicktime/jpeg.c delete mode 100644 cinelerra-5.0/quicktime/jpeg.h delete mode 100644 cinelerra-5.0/quicktime/make_streamable.c delete mode 100644 cinelerra-5.0/quicktime/matrix.c delete mode 100644 cinelerra-5.0/quicktime/mdat.c delete mode 100644 cinelerra-5.0/quicktime/mdhd.c delete mode 100644 cinelerra-5.0/quicktime/mdia.c delete mode 100644 cinelerra-5.0/quicktime/minf.c delete mode 100644 cinelerra-5.0/quicktime/mmx.h delete mode 100644 cinelerra-5.0/quicktime/moov.c delete mode 100644 cinelerra-5.0/quicktime/mp4a.c delete mode 100644 cinelerra-5.0/quicktime/mp4a.h delete mode 100644 cinelerra-5.0/quicktime/mpeg4.c delete mode 100644 cinelerra-5.0/quicktime/mpeg4.h delete mode 100644 cinelerra-5.0/quicktime/mts2mp4.c delete mode 100644 cinelerra-5.0/quicktime/mvhd.c delete mode 100644 cinelerra-5.0/quicktime/plugin.c delete mode 100644 cinelerra-5.0/quicktime/qdm2.c delete mode 100644 cinelerra-5.0/quicktime/qdm2.h delete mode 100644 cinelerra-5.0/quicktime/qtasf.c delete mode 100644 cinelerra-5.0/quicktime/qtasf.h delete mode 100644 cinelerra-5.0/quicktime/qtasf_codes.h delete mode 100644 cinelerra-5.0/quicktime/qtbak.txz delete mode 100644 cinelerra-5.0/quicktime/qtcache.c delete mode 100644 cinelerra-5.0/quicktime/qtdv.c delete mode 100644 cinelerra-5.0/quicktime/qtdv.h delete mode 100644 cinelerra-5.0/quicktime/qtffmpeg.c delete mode 100644 cinelerra-5.0/quicktime/qtffmpeg.h delete mode 100644 cinelerra-5.0/quicktime/qth264.c delete mode 100644 cinelerra-5.0/quicktime/qth264.h delete mode 100644 cinelerra-5.0/quicktime/qtinfo.c delete mode 100644 cinelerra-5.0/quicktime/qtmp3.c delete mode 100644 cinelerra-5.0/quicktime/qtmp3.h delete mode 100644 cinelerra-5.0/quicktime/qtpng.c delete mode 100644 cinelerra-5.0/quicktime/qtpng.h delete mode 100755 cinelerra-5.0/quicktime/qtprivate.h delete mode 100644 cinelerra-5.0/quicktime/qtvorbis.h delete mode 100755 cinelerra-5.0/quicktime/quicktime.c delete mode 100644 cinelerra-5.0/quicktime/quicktime.h delete mode 100644 cinelerra-5.0/quicktime/raw.c delete mode 100644 cinelerra-5.0/quicktime/raw.h delete mode 100644 cinelerra-5.0/quicktime/rawaudio.c delete mode 100644 cinelerra-5.0/quicktime/rawaudio.h delete mode 100644 cinelerra-5.0/quicktime/rechunk.c delete mode 100644 cinelerra-5.0/quicktime/recover.c delete mode 100644 cinelerra-5.0/quicktime/rle.c delete mode 100644 cinelerra-5.0/quicktime/rle.h delete mode 100644 cinelerra-5.0/quicktime/smhd.c delete mode 100644 cinelerra-5.0/quicktime/stbl.c delete mode 100644 cinelerra-5.0/quicktime/stco.c delete mode 100644 cinelerra-5.0/quicktime/stsc.c delete mode 100644 cinelerra-5.0/quicktime/stsd.c delete mode 100644 cinelerra-5.0/quicktime/stsdtable.c delete mode 100644 cinelerra-5.0/quicktime/stss.c delete mode 100644 cinelerra-5.0/quicktime/stsz.c delete mode 100644 cinelerra-5.0/quicktime/stts.c delete mode 100644 cinelerra-5.0/quicktime/test.mp4 delete mode 100644 cinelerra-5.0/quicktime/tkhd.c delete mode 100755 cinelerra-5.0/quicktime/trak.c delete mode 100644 cinelerra-5.0/quicktime/twos.c delete mode 100644 cinelerra-5.0/quicktime/twos.h delete mode 100644 cinelerra-5.0/quicktime/udta.c delete mode 100644 cinelerra-5.0/quicktime/ulaw.c delete mode 100644 cinelerra-5.0/quicktime/ulaw.h delete mode 100755 cinelerra-5.0/quicktime/util.c delete mode 100644 cinelerra-5.0/quicktime/v308.c delete mode 100644 cinelerra-5.0/quicktime/v308.h delete mode 100644 cinelerra-5.0/quicktime/v408.c delete mode 100644 cinelerra-5.0/quicktime/v408.h delete mode 100644 cinelerra-5.0/quicktime/v410.c delete mode 100644 cinelerra-5.0/quicktime/v410.h delete mode 100644 cinelerra-5.0/quicktime/vbraudio.c delete mode 100644 cinelerra-5.0/quicktime/vmhd.c delete mode 100755 cinelerra-5.0/quicktime/vorbis.c delete mode 100644 cinelerra-5.0/quicktime/wma.c delete mode 100644 cinelerra-5.0/quicktime/wma.h delete mode 100644 cinelerra-5.0/quicktime/wmx2.c delete mode 100644 cinelerra-5.0/quicktime/wmx2.h delete mode 100644 cinelerra-5.0/quicktime/workarounds.c delete mode 100644 cinelerra-5.0/quicktime/workarounds.h delete mode 100644 cinelerra-5.0/quicktime/yuv2.c delete mode 100644 cinelerra-5.0/quicktime/yuv2.h delete mode 100644 cinelerra-5.0/quicktime/yuv2mov.c delete mode 100644 cinelerra-5.0/quicktime/yuv4.c delete mode 100644 cinelerra-5.0/quicktime/yuv4.h delete mode 100644 cinelerra-5.0/quicktime/yuv4toyuv.c delete mode 100644 cinelerra-5.0/quicktime/yv12.c delete mode 100644 cinelerra-5.0/quicktime/yv12.h diff --git a/cinelerra-5.0/Makefile b/cinelerra-5.0/Makefile index a893e1ee..a1f25e0d 100644 --- a/cinelerra-5.0/Makefile +++ b/cinelerra-5.0/Makefile @@ -19,8 +19,6 @@ rebuild: rebuild_all: $(MAKE) -C libzmpeg3 clean $(MAKE) -C libzmpeg3 - $(MAKE) -C quicktime clean - $(MAKE) -C quicktime $(MAKE) -C db clean $(MAKE) -C db $(MAKE) rebuild diff --git a/cinelerra-5.0/cinelerra/Makefile b/cinelerra-5.0/cinelerra/Makefile index 9d7c8c14..065346f5 100644 --- a/cinelerra-5.0/cinelerra/Makefile +++ b/cinelerra-5.0/cinelerra/Makefile @@ -88,10 +88,8 @@ OBJS = \ $(OBJDIR)/ffmpeg.o \ $(OBJDIR)/file.o \ $(OBJDIR)/fileac3.o \ - $(OBJDIR)/fileavi.o \ $(OBJDIR)/filebase.o \ $(OBJDIR)/filebaseaudio.o \ - $(OBJDIR)/filebaseima4.o \ $(OBJDIR)/filebaseulaw.o \ $(OBJDIR)/filecr2.o \ $(OBJDIR)/fileffmpeg.o \ @@ -103,7 +101,6 @@ OBJS = \ $(OBJDIR)/filegif.o \ $(OBJDIR)/filelist.o \ $(OBJDIR)/filejpeg.o \ - $(OBJDIR)/filemov.o \ $(OBJDIR)/filempeg.o \ $(OBJDIR)/fileogg.o \ $(OBJDIR)/filepng.o \ @@ -145,6 +142,8 @@ OBJS = \ $(OBJDIR)/labels.o \ $(OBJDIR)/levelwindow.o \ $(OBJDIR)/levelwindowgui.o \ + $(OBJDIR)/libdv.o \ + $(OBJDIR)/libmjpeg.o \ $(OBJDIR)/loadbalance.o \ $(OBJDIR)/loadfile.o \ $(OBJDIR)/loadmode.o \ @@ -337,14 +336,7 @@ THEME_DATA := $(OBJDIR)/theme_data.o OUTPUT_G = $(OBJDIR)/cinelerra.debuginfo OUTPUT = ../bin/cinelerra -ifeq ($(HAVE_AVIFILE), y) -AVIFILE_DIR := $(shell cd ../avifile* ; pwd) -endif - - - LIBRARIES := \ - ../quicktime/$(OBJDIR)/libquicktime.a \ ../guicast/$(OBJDIR)/libguicast.a \ ../libzmpeg3/$(OBJDIR)/libzmpeg3.a \ ../mpeg2enc/$(OBJDIR)/hveg2enc.a \ @@ -354,6 +346,7 @@ LIBRARIES := \ LIBS = $(LIBRARIES) LIBS += $(thirdparty_libraries) LIBS += $(thirdparty_libraries) +LIBS += $(thirdparty_libraries) LIBS += \ -lX11 \ -lXext \ @@ -398,7 +391,6 @@ endif CFLAGS += \ -I../guicast \ - -I../quicktime \ -I../libzmpeg3 \ $(static_includes) \ @@ -438,17 +430,6 @@ LINKER = g++ -o $(OUTPUT) endif -# Enable AVIFile support -ifeq ($(HAVE_AVIFILE), y) - -CFLAGS += -DUSE_AVIFILE -I$(AVIFILE_DIR)/include -LIBS += \ - $(AVIFILE_DIR)/libmmxnow/src/.libs/libmmxnow.a \ - $(AVIFILE_DIR)/lib/.libs/libaviplay.a - -endif - - FFMPEG_CFLAGS := \ -include /usr/include/time.h \ @@ -492,7 +473,7 @@ clean: -o -name '*.so' \) -exec rm -f {} \; -prune tags: - ctags -R -h default --langmap=c:+.inc . ../guicast/ ../libzmpeg3 ../quicktime ../plugins + ctags -R -h default --langmap=c:+.inc . ../guicast/ ../libzmpeg3 ../plugins $(OBJDIR)/%.o: %.C diff --git a/cinelerra-5.0/cinelerra/asset.C b/cinelerra-5.0/cinelerra/asset.C index 0128f94e..c7ebcdd2 100644 --- a/cinelerra-5.0/cinelerra/asset.C +++ b/cinelerra-5.0/cinelerra/asset.C @@ -30,7 +30,6 @@ #include "filexml.h" #include "format.inc" #include "indexstate.h" -#include "quicktime.h" #include #include @@ -69,7 +68,6 @@ Asset::~Asset() int Asset::init_values() { path[0] = 0; -// format = FILE_MOV; // Has to be unknown for file probing to succeed format = FILE_UNKNOWN; fformat[0] = 0; @@ -81,8 +79,8 @@ int Asset::init_values() reset_audio(); reset_video(); - strcpy(vcodec, QUICKTIME_YUV2); - strcpy(acodec, QUICKTIME_TWOS); + strcpy(vcodec, ""); + strcpy(acodec, ""); ff_audio_options[0] = 0; ff_video_options[0] = 0; @@ -345,31 +343,18 @@ int64_t Asset::get_index_size(int channel) char* Asset::get_compression_text(int audio, int video) { - if(audio) - { - switch(format) - { - case FILE_MOV: - case FILE_AVI: - if(acodec[0]) - return quicktime_acodec_title(acodec); - else - return 0; - break; + if(audio) { + switch(format) { + case FILE_FFMPEG: + if( acodec[0] ) return acodec; + break; } } - else - if(video) - { - switch(format) - { - case FILE_MOV: - case FILE_AVI: - if(vcodec[0]) - return quicktime_vcodec_title(vcodec); - else - return 0; - break; + if(video) { + switch(format) { + case FILE_FFMPEG: + if( vcodec[0] ) return vcodec; + break; } } return 0; diff --git a/cinelerra-5.0/cinelerra/assets.C b/cinelerra-5.0/cinelerra/assets.C index ab588fa1..27a4b4e3 100644 --- a/cinelerra-5.0/cinelerra/assets.C +++ b/cinelerra-5.0/cinelerra/assets.C @@ -30,7 +30,6 @@ #include "filexml.h" #include "filesystem.h" #include "indexfile.h" -#include "quicktime.h" #include "mainsession.h" #include "threadindexer.h" #include diff --git a/cinelerra-5.0/cinelerra/awindowgui.C b/cinelerra-5.0/cinelerra/awindowgui.C index fdcb4cd3..704d24b2 100644 --- a/cinelerra-5.0/cinelerra/awindowgui.C +++ b/cinelerra-5.0/cinelerra/awindowgui.C @@ -29,7 +29,7 @@ #include "awindowmenu.h" #include "bcsignals.h" #include "cache.h" -#include "colormodels.h" +#include "bccmodels.h" #include "cursors.h" #include "cwindowgui.h" #include "cwindow.h" diff --git a/cinelerra-5.0/cinelerra/bitspopup.C b/cinelerra-5.0/cinelerra/bitspopup.C index 17c51807..b1512ddd 100644 --- a/cinelerra-5.0/cinelerra/bitspopup.C +++ b/cinelerra-5.0/cinelerra/bitspopup.C @@ -28,7 +28,6 @@ BitsPopup::BitsPopup(BC_WindowBase *parent_window, int x, int y, int *output, - int use_ima4, int use_ulaw, int use_adpcm, int use_float, @@ -39,7 +38,6 @@ BitsPopup::BitsPopup(BC_WindowBase *parent_window, this->output = output; this->x = x; this->y = y; - this->use_ima4 = use_ima4; this->use_ulaw = use_ulaw; this->use_adpcm = use_adpcm; this->use_float = use_float; @@ -61,7 +59,6 @@ void BitsPopup::create_objects() bits_items.append(new BC_ListBoxItem(File::bitstostr(BITSLINEAR16))); bits_items.append(new BC_ListBoxItem(File::bitstostr(BITSLINEAR24))); if(use_32linear) bits_items.append(new BC_ListBoxItem(File::bitstostr(BITSLINEAR32))); - if(use_ima4) bits_items.append(new BC_ListBoxItem(File::bitstostr(BITSIMA4))); if(use_ulaw) bits_items.append(new BC_ListBoxItem(File::bitstostr(BITSULAW))); if(use_adpcm) bits_items.append(new BC_ListBoxItem(File::bitstostr(BITS_ADPCM))); if(use_float) bits_items.append(new BC_ListBoxItem(File::bitstostr(BITSFLOAT))); diff --git a/cinelerra-5.0/cinelerra/bitspopup.h b/cinelerra-5.0/cinelerra/bitspopup.h index 7733a561..7c6999fa 100644 --- a/cinelerra-5.0/cinelerra/bitspopup.h +++ b/cinelerra-5.0/cinelerra/bitspopup.h @@ -34,7 +34,6 @@ public: int x, int y, int *output, - int use_ima4, int use_ulaw, int use_adpcm, int use_float, @@ -48,7 +47,7 @@ public: BitsPopupMenu *menu; ArrayList bits_items; BitsPopupText *textbox; - int x, y, use_ima4, use_ulaw, use_float, use_adpcm, *output; + int x, y, use_ulaw, use_float, use_adpcm, *output; int use_32linear; int use_8linear; BC_WindowBase *parent_window; diff --git a/cinelerra-5.0/cinelerra/compresspopup.C b/cinelerra-5.0/cinelerra/compresspopup.C index da8a172d..fe11fb7e 100644 --- a/cinelerra-5.0/cinelerra/compresspopup.C +++ b/cinelerra-5.0/cinelerra/compresspopup.C @@ -22,7 +22,6 @@ #include "compresspopup.h" #include "file.h" #include "language.h" -#include "quicktime.h" #include diff --git a/cinelerra-5.0/cinelerra/devicev4l2base.C b/cinelerra-5.0/cinelerra/devicev4l2base.C index 53c11722..acbac871 100644 --- a/cinelerra-5.0/cinelerra/devicev4l2base.C +++ b/cinelerra-5.0/cinelerra/devicev4l2base.C @@ -31,7 +31,6 @@ #include "mutex.h" #include "picture.h" #include "preferences.h" -#include "quicktime.h" #include "recordconfig.h" #include "videodevice.h" diff --git a/cinelerra-5.0/cinelerra/devicev4l2input.C b/cinelerra-5.0/cinelerra/devicev4l2input.C index 04c609ab..35dce2cc 100644 --- a/cinelerra-5.0/cinelerra/devicev4l2input.C +++ b/cinelerra-5.0/cinelerra/devicev4l2input.C @@ -30,7 +30,6 @@ #include "devicempeginput.h" #include "picture.h" #include "preferences.h" -#include "quicktime.h" #include "recordconfig.h" #include diff --git a/cinelerra-5.0/cinelerra/edl.C b/cinelerra-5.0/cinelerra/edl.C index a22d3f13..05e7618c 100644 --- a/cinelerra-5.0/cinelerra/edl.C +++ b/cinelerra-5.0/cinelerra/edl.C @@ -27,7 +27,7 @@ #include "awindowgui.inc" #include "bcsignals.h" #include "clip.h" -#include "colormodels.h" +#include "bccmodels.h" #include "bchash.h" #include "edits.h" #include "edl.h" diff --git a/cinelerra-5.0/cinelerra/edlsession.C b/cinelerra-5.0/cinelerra/edlsession.C index 57a58afd..94d591fa 100644 --- a/cinelerra-5.0/cinelerra/edlsession.C +++ b/cinelerra-5.0/cinelerra/edlsession.C @@ -22,7 +22,7 @@ #include "asset.h" #include "assets.h" #include "autoconf.h" -#include "colormodels.h" +#include "bccmodels.h" #include "bchash.h" #include "edl.h" #include "edlsession.h" @@ -95,8 +95,7 @@ EDLSession::~EDLSession() int EDLSession::need_rerender(EDLSession *ptr) { - return (playback_preload != ptr->playback_preload) || - (interpolation_type != ptr->interpolation_type) || + return (interpolation_type != ptr->interpolation_type) || (video_every_frame != ptr->video_every_frame) || (video_asynchronous != ptr->video_asynchronous) || (real_time_playback != ptr->real_time_playback) || @@ -165,8 +164,8 @@ int EDLSession::load_defaults(BC_Hash *defaults) auto_conf->load_defaults(defaults); autos_follow_edits = defaults->get("AUTOS_FOLLOW_EDITS", 1); brender_start = defaults->get("BRENDER_START", brender_start); - cmodel_to_text(string, BC_RGBA8888); - color_model = cmodel_from_text(defaults->get("COLOR_MODEL", string)); + BC_CModels::to_text(string, BC_RGBA8888); + color_model = BC_CModels::from_text(defaults->get("COLOR_MODEL", string)); eyedrop_radius = defaults->get("EYEDROP_RADIUS", 0); crop_x1 = defaults->get("CROP_X1", 0); crop_x2 = defaults->get("CROP_X2", 320); @@ -215,7 +214,6 @@ int EDLSession::load_defaults(BC_Hash *defaults) output_w = defaults->get("OUTPUTW", 720); output_h = defaults->get("OUTPUTH", 480); playback_buffer = defaults->get("PLAYBACK_BUFFER", 4096); - playback_preload = defaults->get("PLAYBACK_PRELOAD", 0); playback_software_position = defaults->get("PLAYBACK_SOFTWARE_POSITION", 0); delete playback_config; playback_config = new PlaybackConfig; @@ -298,7 +296,7 @@ int EDLSession::save_defaults(BC_Hash *defaults) defaults->update("ATRACKS", audio_tracks); defaults->update("AUTOS_FOLLOW_EDITS", autos_follow_edits); defaults->update("BRENDER_START", brender_start); - cmodel_to_text(string, color_model); + BC_CModels::to_text(string, color_model); defaults->update("COLOR_MODEL", string); defaults->update("EYEDROP_RADIUS", eyedrop_radius); defaults->update("CROP_X1", crop_x1); @@ -346,7 +344,6 @@ int EDLSession::save_defaults(BC_Hash *defaults) defaults->update("OUTPUTW", output_w); defaults->update("OUTPUTH", output_h); defaults->update("PLAYBACK_BUFFER", playback_buffer); - defaults->update("PLAYBACK_PRELOAD", playback_preload); defaults->update("PLAYBACK_SOFTWARE_POSITION", playback_software_position); playback_config->save_defaults(defaults); defaults->update("PLAYBACK_REALTIME", real_time_playback); @@ -451,8 +448,8 @@ int EDLSession::load_video_config(FileXML *file, int append_mode, uint32_t load_ interpolation_type = file->tag.get_property("INTERPOLATION_TYPE", interpolation_type); interpolate_raw = file->tag.get_property("INTERPOLATE_RAW", interpolate_raw); white_balance_raw = file->tag.get_property("WHITE_BALANCE_RAW", white_balance_raw); - cmodel_to_text(string, color_model); - color_model = cmodel_from_text(file->tag.get_property("COLORMODEL", string)); + BC_CModels::to_text(string, color_model); + color_model = BC_CModels::from_text(file->tag.get_property("COLORMODEL", string)); video_channels = file->tag.get_property("CHANNELS", video_channels); for(int i = 0; i < video_channels; i++) { @@ -539,7 +536,6 @@ int EDLSession::load_xml(FileXML *file, mpeg4_deblock = file->tag.get_property("MPEG4_DEBLOCK", mpeg4_deblock); plugins_follow_edits = file->tag.get_property("PLUGINS_FOLLOW_EDITS", plugins_follow_edits); single_standalone = file->tag.get_property("SINGLE_STANDALONE", single_standalone); - playback_preload = file->tag.get_property("PLAYBACK_PRELOAD", playback_preload); safe_regions = file->tag.get_property("SAFE_REGIONS", safe_regions); show_assets = file->tag.get_property("SHOW_ASSETS", 1); show_titles = file->tag.get_property("SHOW_TITLES", 1); @@ -602,7 +598,6 @@ int EDLSession::save_xml(FileXML *file) file->tag.set_property("MPEG4_DEBLOCK", mpeg4_deblock); file->tag.set_property("PLUGINS_FOLLOW_EDITS", plugins_follow_edits); file->tag.set_property("SINGLE_STANDALONE", single_standalone); - file->tag.set_property("PLAYBACK_PRELOAD", playback_preload); file->tag.set_property("SAFE_REGIONS", safe_regions); file->tag.set_property("SHOW_ASSETS", show_assets); file->tag.set_property("SHOW_TITLES", show_titles); @@ -633,7 +628,7 @@ int EDLSession::save_video_config(FileXML *file) file->tag.set_property("INTERPOLATION_TYPE", interpolation_type); file->tag.set_property("INTERPOLATE_RAW", interpolate_raw); file->tag.set_property("WHITE_BALANCE_RAW", white_balance_raw); - cmodel_to_text(string, color_model); + BC_CModels::to_text(string, color_model); file->tag.set_property("COLORMODEL", string); file->tag.set_property("CHANNELS", video_channels); for(int i = 0; i < video_channels; i++) @@ -747,7 +742,6 @@ int EDLSession::copy(EDLSession *session) playback_config = new PlaybackConfig; playback_config->copy_from(session->playback_config); playback_cursor_visible = session->playback_cursor_visible; - playback_preload = session->playback_preload; playback_software_position = session->playback_software_position; real_time_playback = session->real_time_playback; real_time_record = session->real_time_record; diff --git a/cinelerra-5.0/cinelerra/ffmpeg.C b/cinelerra-5.0/cinelerra/ffmpeg.C index 92a95802..b1272467 100644 --- a/cinelerra-5.0/cinelerra/ffmpeg.C +++ b/cinelerra-5.0/cinelerra/ffmpeg.C @@ -18,6 +18,8 @@ #include "fileffmpeg.h" #include "file.h" #include "ffmpeg.h" +#include "libdv.h" +#include "libmjpeg.h" #include "mainerror.h" #include "mwindow.h" #include "vframe.h" @@ -1440,6 +1442,10 @@ int FFMPEG::open_encoder(const char *type, const char *spec) return 1; } + if( !strcmp(codec_name, CODEC_TAG_DVSD) ) strcpy(codec_name, "dv"); + else if( !strcmp(codec_name, CODEC_TAG_MJPEG) ) strcpy(codec_name, "mjpeg"); + else if( !strcmp(codec_name, CODEC_TAG_JPEG) ) strcpy(codec_name, "jpeg"); + int ret = 0; ff_lock("FFMPEG::open_encoder"); FFStream *fst = 0; diff --git a/cinelerra-5.0/cinelerra/file.C b/cinelerra-5.0/cinelerra/file.C index c5749218..b96f332f 100644 --- a/cinelerra-5.0/cinelerra/file.C +++ b/cinelerra-5.0/cinelerra/file.C @@ -40,7 +40,6 @@ #include "condition.h" #include "errorbox.h" #include "fileac3.h" -#include "fileavi.h" #include "filebase.h" #include "filecr2.h" #include "filedb.h" @@ -52,7 +51,6 @@ #include "filegif.h" #include "file.h" #include "filejpeg.h" -#include "filemov.h" #include "filempeg.h" #undef HAVE_STDLIB_H // automake conflict #include "fileogg.h" @@ -180,7 +178,6 @@ int File::get_options(FormatTools *format, BC_WindowBase *parent_window = format->window; //ArrayList *plugindb = format->plugindb; Asset *asset = format->asset; - const char *locked_compressor = format->locked_compressor; getting_options = 1; format_completion->lock("File::get_options"); @@ -211,14 +208,6 @@ int File::get_options(FormatTools *format, audio_options, video_options); break; - case FILE_MOV: - FileMOV::get_parameters(parent_window, - asset, - format_window, - audio_options, - video_options, - locked_compressor); - break; case FILE_FFMPEG: FileFFMPEG::get_parameters(parent_window, asset, @@ -234,25 +223,6 @@ int File::get_options(FormatTools *format, audio_options, video_options); break; - case FILE_AVI: - FileMOV::get_parameters(parent_window, - asset, - format_window, - audio_options, - video_options, - locked_compressor); - break; - case FILE_AVI_LAVTOOLS: - case FILE_AVI_ARNE2: - case FILE_AVI_ARNE1: - case FILE_AVI_AVIFILE: - FileAVI::get_parameters(parent_window, - asset, - format_window, - audio_options, - video_options, - locked_compressor); - break; case FILE_JPEG: case FILE_JPEG_LIST: FileJPEG::get_parameters(parent_window, @@ -671,13 +641,6 @@ int File::open_file(Preferences *preferences, fclose(stream); return FILE_IS_XML; } // can't load project file - if(FileMOV::check_sig(this->asset)) { -// MOV file -// should be last because quicktime lacks a magic number - fclose(stream); - file = new FileMOV(this->asset, this); - break; - } if( !preferences->ffmpeg_early_probe && FileFFMPEG::check_sig(this->asset) ) { fclose(stream); @@ -754,10 +717,6 @@ int File::open_file(Preferences *preferences, file = new FileDB(this->asset, this); break; - case FILE_MOV: - file = new FileMOV(this->asset, this); - break; - case FILE_MPEG: case FILE_AMPEG: case FILE_VMPEG: @@ -772,17 +731,6 @@ int File::open_file(Preferences *preferences, file = new FileVorbis(this->asset, this); break; - case FILE_AVI: - file = new FileMOV(this->asset, this); - break; - - case FILE_AVI_LAVTOOLS: - case FILE_AVI_ARNE2: - case FILE_AVI_ARNE1: - case FILE_AVI_AVIFILE: - file = new FileAVI(this->asset, this); - break; - case FILE_RAWDV: file = new FileDV(this->asset, this); break; @@ -2176,12 +2124,6 @@ int File::strtoformat(ArrayList *plugindb, const char *format) if(!strcasecmp(format, _(VMPEG_NAME))) return FILE_VMPEG; if(!strcasecmp(format, _(TGA_NAME))) return FILE_TGA; if(!strcasecmp(format, _(TGA_LIST_NAME))) return FILE_TGA_LIST; - if(!strcasecmp(format, _(MOV_NAME))) return FILE_MOV; - if(!strcasecmp(format, _(AVI_NAME))) return FILE_AVI; - if(!strcasecmp(format, _(AVI_LAVTOOLS_NAME))) return FILE_AVI_LAVTOOLS; - if(!strcasecmp(format, _(AVI_ARNE2_NAME))) return FILE_AVI_ARNE2; - if(!strcasecmp(format, _(AVI_ARNE1_NAME))) return FILE_AVI_ARNE1; - if(!strcasecmp(format, _(AVI_AVIFILE_NAME))) return FILE_AVI_AVIFILE; if(!strcasecmp(format, _(OGG_NAME))) return FILE_OGG; if(!strcasecmp(format, _(VORBIS_NAME))) return FILE_VORBIS; if(!strcasecmp(format, _(RAWDV_NAME))) return FILE_RAWDV; @@ -2224,12 +2166,6 @@ const char* File::formattostr(ArrayList *plugindb, int format) case FILE_TGA_LIST: return _(TGA_LIST_NAME); case FILE_TIFF: return _(TIFF_NAME); case FILE_TIFF_LIST: return _(TIFF_LIST_NAME); - case FILE_MOV: return _(MOV_NAME); - case FILE_AVI_LAVTOOLS: return _(AVI_LAVTOOLS_NAME); - case FILE_AVI: return _(AVI_NAME); - case FILE_AVI_ARNE2: return _(AVI_ARNE2_NAME); - case FILE_AVI_ARNE1: return _(AVI_ARNE1_NAME); - case FILE_AVI_AVIFILE: return _(AVI_AVIFILE_NAME); case FILE_OGG: return _(OGG_NAME); case FILE_VORBIS: return _(VORBIS_NAME); case FILE_RAWDV: return _(RAWDV_NAME); @@ -2248,7 +2184,6 @@ int File::strtobits(const char *bits) if(!strcasecmp(bits, _(NAME_ULAW))) return BITSULAW; if(!strcasecmp(bits, _(NAME_ADPCM))) return BITS_ADPCM; if(!strcasecmp(bits, _(NAME_FLOAT))) return BITSFLOAT; - if(!strcasecmp(bits, _(NAME_IMA4))) return BITSIMA4; return BITSLINEAR16; } @@ -2264,7 +2199,6 @@ const char* File::bitstostr(int bits) case BITSULAW: return (NAME_ULAW); case BITS_ADPCM: return (NAME_ADPCM); case BITSFLOAT: return (NAME_FLOAT); - case BITSIMA4: return (NAME_IMA4); } return _("Unknown"); } @@ -2292,7 +2226,6 @@ int File::bytes_per_sample(int bits) case BITSLINEAR24: return 3; case BITSLINEAR32: return 4; case BITSULAW: return 1; - case BITSIMA4: return 1; } return 1; } @@ -2311,8 +2244,6 @@ int File::get_best_colormodel(Asset *asset, int driver) switch(asset->format) { case FILE_RAWDV: return FileDV::get_best_colormodel(asset, driver); - case FILE_MOV: return FileMOV::get_best_colormodel(asset, driver); - case FILE_AVI: return FileMOV::get_best_colormodel(asset, driver); case FILE_MPEG: return FileMPEG::get_best_colormodel(asset, driver); case FILE_JPEG: case FILE_JPEG_LIST: return FileJPEG::get_best_colormodel(asset, driver); @@ -2408,7 +2339,6 @@ int File::supports_video(int format) switch(format) { case FILE_OGG: - case FILE_MOV: case FILE_JPEG: case FILE_JPEG_LIST: case FILE_CR2: @@ -2422,11 +2352,6 @@ int File::supports_video(int format) case FILE_TIFF: case FILE_TIFF_LIST: case FILE_VMPEG: - case FILE_AVI_LAVTOOLS: - case FILE_AVI_ARNE2: - case FILE_AVI: - case FILE_AVI_ARNE1: - case FILE_AVI_AVIFILE: case FILE_FFMPEG: case FILE_RAWDV: return 1; @@ -2442,18 +2367,12 @@ int File::supports_audio(int format) case FILE_FLAC: case FILE_PCM: case FILE_WAV: - case FILE_MOV: case FILE_OGG: case FILE_VORBIS: case FILE_AMPEG: case FILE_AU: case FILE_AIFF: case FILE_SND: - case FILE_AVI: - case FILE_AVI_LAVTOOLS: - case FILE_AVI_ARNE2: - case FILE_AVI_ARNE1: - case FILE_AVI_AVIFILE: case FILE_FFMPEG: return 1; } @@ -2468,7 +2387,6 @@ const char* File::get_tag(int format) case FILE_AIFF: return "aif"; case FILE_AMPEG: return "mp3"; case FILE_AU: return "au"; - case FILE_AVI: return "avi"; case FILE_RAWDV: return "dv"; case FILE_DB: return "db"; case FILE_EXR: return "exr"; @@ -2476,7 +2394,6 @@ const char* File::get_tag(int format) case FILE_FLAC: return "flac"; case FILE_JPEG: return "jpg"; case FILE_JPEG_LIST: return "jpg"; - case FILE_MOV: return "mov/mp4"; case FILE_OGG: return "ogg"; case FILE_PCM: return "pcm"; case FILE_PNG: return "png"; @@ -2498,7 +2415,6 @@ const char* File::get_prefix(int format) switch(format) { case FILE_PCM: return "PCM"; case FILE_WAV: return "WAV"; - case FILE_MOV: return "MOV"; case FILE_PNG: return "PNG"; case FILE_JPEG: return "JPEG"; case FILE_TIFF: return "TIFF"; @@ -2507,19 +2423,14 @@ const char* File::get_prefix(int format) case FILE_AU: return "AU"; case FILE_AIFF: return "AIFF"; case FILE_SND: return "SND"; - case FILE_AVI_LAVTOOLS: return "AVI_LAVTOOLS"; case FILE_TGA_LIST: return "TGA_LIST"; case FILE_TGA: return "TGA"; case FILE_MPEG: return "MPEG"; case FILE_AMPEG: return "AMPEG"; case FILE_VMPEG: return "VMPEG"; case FILE_RAWDV: return "RAWDV"; - case FILE_AVI_ARNE2: return "AVI_ARNE2"; - case FILE_AVI_ARNE1: return "AVI_ARNE1"; - case FILE_AVI_AVIFILE: return "AVI_AVIFILE"; case FILE_TIFF_LIST: return "TIFF_LIST"; case FILE_PNG_LIST: return "PNG_LIST"; - case FILE_AVI: return "AVI"; case FILE_AC3: return "AC3"; case FILE_EXR: return "EXR"; case FILE_EXR_LIST: return "EXR_LIST"; diff --git a/cinelerra-5.0/cinelerra/file.h b/cinelerra-5.0/cinelerra/file.h index 692706a0..16e2327b 100644 --- a/cinelerra-5.0/cinelerra/file.h +++ b/cinelerra-5.0/cinelerra/file.h @@ -237,6 +237,9 @@ public: // Used by read_frame. int colormodel_supported(int colormodel); +// stubs for now + static const char *compressiontostr(const char *codec) { return codec; } + static const char *strtocompression(const char *string) { return string; } // subclass memory usage int64_t file_memory_usage(); // Used by CICache to calculate the total size of the cache. diff --git a/cinelerra-5.0/cinelerra/file.inc b/cinelerra-5.0/cinelerra/file.inc index 3651e74d..cfb063ed 100644 --- a/cinelerra-5.0/cinelerra/file.inc +++ b/cinelerra-5.0/cinelerra/file.inc @@ -39,7 +39,6 @@ // Libzmpeg3 decoding and transport stream capture only #define FILE_PCM 1 #define FILE_WAV 2 -#define FILE_MOV 3 #define FILE_PNG 4 #define FILE_JPEG 5 #define FILE_TIFF 6 @@ -48,19 +47,14 @@ #define FILE_AU 9 #define FILE_AIFF 10 #define FILE_SND 11 -#define FILE_AVI_LAVTOOLS 12 // MJPEG type 1 #define FILE_TGA_LIST 13 #define FILE_TGA 14 #define FILE_MPEG 15 #define FILE_AMPEG 16 // For encoding only #define FILE_VMPEG 17 // For encoding only #define FILE_RAWDV 18 -#define FILE_AVI_ARNE2 19 // DV type 2 -#define FILE_AVI_ARNE1 20 // DV type 1 -#define FILE_AVI_AVIFILE 21 #define FILE_TIFF_LIST 22 #define FILE_PNG_LIST 23 -#define FILE_AVI 24 // Heroine Virtual #define FILE_AC3 25 // AC3 encoding #define FILE_EXR 26 #define FILE_EXR_LIST 27 @@ -90,7 +84,6 @@ N_("FFMPEG") N_("FLAC") N_("JPEG") N_("JPEG Sequence") -N_("Microsoft AVI") N_("Microsoft WAV") N_("MPEG Audio") // For encoding only N_("MPEG") // For decoding only @@ -99,7 +92,6 @@ N_("OGG Theora/Vorbis") N_("OGG Vorbis") // For decoding only N_("PNG") N_("PNG Sequence") -N_("Quicktime for Linux") N_("Raw DV") N_("Raw PCM") N_("Sun/NeXT AU") @@ -118,7 +110,6 @@ N_("Unknown sound") #define AVI_ARNE2_NAME "AVI DV Type 2" #define AVI_AVIFILE_NAME "AVI Avifile" #define AVI_LAVTOOLS_NAME "AVI Lavtools" -#define AVI_NAME "Microsoft AVI" #define CR2_LIST_NAME "CR2 Sequence" #define CR2_NAME "Raw Camera" #define DBASE_NAME "DB" @@ -128,7 +119,6 @@ N_("Unknown sound") #define FLAC_NAME "FLAC" #define JPEG_LIST_NAME "JPEG Sequence" #define JPEG_NAME "JPEG" -#define MOV_NAME "Quicktime for Linux" #define MPEG_NAME "MPEG" // For decoding only #define OGG_NAME "OGG Theora/Vorbis" #define PCM_NAME "Raw PCM" @@ -152,7 +142,6 @@ N_("Unknown sound") #define BITS_ADPCM 252 #define BITSFLOAT 253 #define BITSULAW 254 -#define BITSIMA4 255 #if 0 N_("8 Bit Linear") @@ -164,7 +153,6 @@ N_("IMA 4") N_("ADPCM") N_("Float") -// Video formats not part of Quicktime N_("RGB ALPHA") N_("PNG ALPHA") #endif @@ -174,14 +162,9 @@ N_("PNG ALPHA") #define NAME_24BIT "24 Bit Linear" #define NAME_32BIT "32 Bit Linear" #define NAME_ULAW "u Law" -#define NAME_IMA4 "IMA 4" #define NAME_ADPCM "ADPCM" #define NAME_FLOAT "Float" -// Video formats not part of Quicktime -#define MOV_RGBA "RGB ALPHA" -#define MOV_PNGA "PNG ALPHA" - class File; //result<0: continue skimming, result>=0: exit return code diff --git a/cinelerra-5.0/cinelerra/fileavi.C b/cinelerra-5.0/cinelerra/fileavi.C deleted file mode 100644 index 0b902566..00000000 --- a/cinelerra-5.0/cinelerra/fileavi.C +++ /dev/null @@ -1,1202 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "asset.h" - -#ifdef USE_AVIFILE -#include "avifile.h" -#include "creators.h" -#include "except.h" -#include "fourcc.h" -#include "StreamInfo.h" -#endif - -#include "clip.h" -#include "file.h" -#include "fileavi.h" -#include "fileavi.inc" -#include "language.h" -#include "mwindow.inc" -#include "vframe.h" - - -#include - - - - - -#ifdef USE_AVIFILE -int FileAVI::avifile_initialized = 0; -#endif - - - - -// Status of AVI derivatives: -// Arne2 - depends on Kino, DV only -// Lavtools - 2 gig limited - - - - - - - - - - - - -FileAVI::FileAVI(Asset *asset, File *file) - : FileBase(asset, file) -{ - reset(); -} - -FileAVI::~FileAVI() -{ - close_file(); -} - -int FileAVI::check_sig(Asset *asset) -{ -// Pick whoever gets the most tracks - int score_lavtools = 0; - int score_arne2 = 0; - int score_arne1 = 0; - int score_avifile = 0; - int final = 0; - int result = 0; - - - - - - check_sig_lavtools(asset, score_lavtools); - check_sig_arne2(asset, score_arne2); - check_sig_arne1(asset, score_arne1); - check_sig_avifile(asset, score_avifile); - - if(score_lavtools > final) - { - final = score_lavtools; - result = FILE_AVI_LAVTOOLS; - } - if(score_arne2 > final) - { - final = score_arne2; - result = FILE_AVI_ARNE2; - } - if(score_arne1 > final) - { - final = score_arne1; - result = FILE_AVI_ARNE1; - } - if(score_avifile > final) - { - final = score_avifile; - result = FILE_AVI_AVIFILE; - } - - - - - - - - return result; -} - -int FileAVI::check_sig_arne2(Asset *asset, int &score) -{ - return 0; -} - -int FileAVI::check_sig_arne1(Asset *asset, int &score) -{ - return 0; -} - -int FileAVI::check_sig_lavtools(Asset *asset, int &score) -{ - return 0; -} - -int FileAVI::check_sig_avifile(Asset *asset, int &score) -{ -return 0; -#ifdef USE_AVIFILE - IAviReadFile *in_fd = 0; - - try - { - in_fd = CreateIAviReadFile(asset->path); - } - catch(FatalError& error) - { - if(in_fd) delete in_fd; - return 0; - } - - int vtracks = in_fd->VideoStreamCount(); - int atracks = in_fd->AudioStreamCount(); - - delete in_fd; - - score = vtracks + atracks; - return 1; -#endif - return 0; -} - - -char* FileAVI::vcodec_to_fourcc(const char *input, char *output) -{ -#ifdef USE_AVIFILE - initialize_avifile(); - for(avm::vector::iterator i = video_codecs.begin(); - i < video_codecs.end(); - i++) - { - if(i->direction & CodecInfo::Encode) - { - if(!strcasecmp(i->GetName(), input)) - { - memcpy(output, (char*)&i->fourcc, 4); - output[4] = 0; - return output; - } - } - } -#endif - - output[0] = 0; - return output; -} - -char* FileAVI::fourcc_to_vcodec(char *input, char *output) -{ -#ifdef USE_AVIFILE -// Construct codec item list - initialize_avifile(); - for(avm::vector::iterator i = video_codecs.begin(); - i < video_codecs.end(); - i++) - { - if(i->direction & CodecInfo::Encode) - { - if(!memcmp((char*)&i->fourcc, input, 4)) - { - memcpy(output, (char*)&i->fourcc, 4); - strcpy(output, i->GetName());; - return output; - } - } - } - - output[0] = 0; - return output; -#else - return input; -#endif -} - - -char* FileAVI::acodec_to_fourcc(const char *input, char *output) -{ -#ifdef USE_AVIFILE -// Construct codec item list - initialize_avifile(); - for(avm::vector::iterator i = audio_codecs.begin(); - i < audio_codecs.end(); - i++) - { - if(i->direction & CodecInfo::Encode) - { - if(!strcasecmp(i->GetName(), input)) - { - memcpy(output, (char*)&i->fourcc, 4); - output[4] = 0; - return output; - } - } - } -#endif - - output[0] = 0; - return output; -} - -char* FileAVI::fourcc_to_acodec(char *input, char *output) -{ -#ifdef USE_AVIFILE -// Construct codec item list - initialize_avifile(); - for(avm::vector::iterator i = audio_codecs.begin(); - i < audio_codecs.end(); - i++) - { - if(i->direction & CodecInfo::Encode) - { - if(!memcmp((char*)&i->fourcc, input, 4)) - { - memcpy(output, (char*)&i->fourcc, 4); - strcpy(output, i->GetName()); - return output; - } - } - } - - output[0] = 0; - return output; -#else - return input; -#endif -} - - -void FileAVI::initialize_avifile() -{ -#ifdef USE_AVIFILE - if(!avifile_initialized) - { - BITMAPINFOHEADER bih; - bih.biCompression = 0xffffffff; - Creators::CreateVideoDecoder(bih, 0, 0); - - WAVEFORMATEX wih; - memset(&wih, 0xff, sizeof(WAVEFORMATEX)); - Creators::CreateAudioDecoder(&wih, 0); - avifile_initialized = 1; - } -#endif -} - - -int FileAVI::open_file(int rd, int wr) -{ - if(wr) - { - switch(asset->format) - { - case FILE_AVI_LAVTOOLS: - return open_lavtools_out(asset); - break; - - case FILE_AVI_ARNE2: - return open_arne2_out(asset); - break; - - case FILE_AVI_ARNE1: - return open_arne1_out(asset); - break; - - case FILE_AVI_AVIFILE: - return open_avifile_out(asset); - break; - } - } - else - if(rd) - { - asset->format = check_sig(asset); - - - switch(asset->format) - { - case FILE_AVI_LAVTOOLS: - return open_lavtools_in(asset); - break; - - case FILE_AVI_ARNE2: - return open_arne2_in(asset); - break; - - case FILE_AVI_ARNE1: - return open_arne1_in(asset); - break; - - case FILE_AVI_AVIFILE: - return open_avifile_in(asset); - break; - } - } - - return 0; -} - - - -int FileAVI::open_avifile_out(Asset *asset) -{ -#ifdef USE_AVIFILE - try - { - out_fd = CreateIAviWriteFile(asset->path); - } - catch(FatalError& error) - { - error.Print(); - close_file(); - return 1; - } - - if(asset->video_data) - { - out_color_model = get_best_colormodel(-1, -1); - out_bitmap_info = new BitmapInfo(asset->width, asset->height, - cmodel_bc_to_avi(out_color_model)); - for(int i = 0; i < asset->layers && i < MAX_STREAMS; i++) - { - vstream_out[i] = out_fd->AddVideoStream(*(uint32_t*)asset->vcodec, - out_bitmap_info, - int(1000000.0 / asset->frame_rate)); - } - } - - if(asset->audio_data) - { - WAVEFORMATEX wfm; - wfm.wFormatTag = 1; // PCM - wfm.nChannels = asset->channels; - wfm.nSamplesPerSec = asset->sample_rate; - wfm.nAvgBytesPerSec = 2 * asset->sample_rate * asset->channels; - wfm.nBlockAlign = 2 * asset->channels; - wfm.wBitsPerSample = 16; - wfm.cbSize = 0; - - for(int i = 0; i < asset->channels && i < MAX_STREAMS; i++) - { - astream_out[i] = out_fd->AddStream(AviStream::Audio, - &wfm, - sizeof(wfm), - 1, // uncompressed PCM data - wfm.nAvgBytesPerSec, // bytes/sec - wfm.nBlockAlign); // bytes/sample - } - } - - return 0; -#endif - return 1; -} - -int FileAVI::open_arne2_out(Asset *asset) -{ - - return 0; -} - -int FileAVI::open_arne1_out(Asset *asset) -{ - return 0; -} - -int FileAVI::open_lavtools_out(Asset *asset) -{ - return 0; -} - - - - - - -int FileAVI::open_avifile_in(Asset *asset) -{ -#ifdef USE_AVIFILE - try - { - in_fd = CreateIAviReadFile(asset->path); - } - catch(FatalError& error) - { - error.Print(); - close_file(); - return 1; - } - - asset->layers = in_fd->VideoStreamCount(); - if(asset->layers) - { - for(int i = 0; i < asset->layers && i < MAX_STREAMS; i++) - { - vstream_in[i] = in_fd->GetStream(i, IAviReadStream::Video); - vstream_in[i]->StartStreaming(); - vstream_in[i]->GetDecoder()->SetDestFmt(24); - vstream_in[i]->Seek(0); -//printf("FileAVI::open_file %d %p\n", i, vstream[i]); - } - - StreamInfo *stream_info = vstream_in[0]->GetStreamInfo(); - asset->video_data = 1; - if(!asset->frame_rate) - asset->frame_rate = (double)1 / vstream_in[0]->GetFrameTime(); - asset->video_length = stream_info->GetStreamFrames(); - BITMAPINFOHEADER bh; - vstream_in[0]->GetVideoFormatInfo(&bh, sizeof(bh)); - asset->width = bh.biWidth; - asset->height = bh.biHeight; - - uint32_t fourcc = stream_info->GetFormat(); - asset->vcodec[0] = ((char*)&fourcc)[0]; - asset->vcodec[1] = ((char*)&fourcc)[1]; - asset->vcodec[2] = ((char*)&fourcc)[2]; - asset->vcodec[3] = ((char*)&fourcc)[3]; - source_cmodel = BC_RGB888; - delete stream_info; - } - - asset->audio_data = in_fd->AudioStreamCount(); - - if(asset->audio_data) - { - char *extinfo; - - for(int i = 0; i < 1 && i < MAX_STREAMS; i++) - { - astream_in[i] = in_fd->GetStream(i, IAviReadStream::Audio); - astream_in[i]->StartStreaming(); - } - - StreamInfo *stream_info = astream_in[0]->GetStreamInfo(); - asset->channels = stream_info->GetAudioChannels(); - if(asset->sample_rate == 0) - asset->sample_rate = stream_info->GetAudioSamplesPerSec(); - asset->bits = MAX(16, stream_info->GetAudioBitsPerSample()); - asset->audio_length = stream_info->GetStreamFrames(); - delete stream_info; - } -asset->dump(); - return 0; -#endif - return 1; -} - -int FileAVI::open_arne2_in(Asset *asset) -{ - return 0; -} - -int FileAVI::open_arne1_in(Asset *asset) -{ - return 0; -} - -int FileAVI::open_lavtools_in(Asset *asset) -{ - return 0; -} - - - - - - - - - - - - - - - - - - -int FileAVI::close_file() -{ -#ifdef USE_AVIFILE - if(in_fd) delete in_fd; - if(out_fd) delete out_fd; - if(out_bitmap_info) delete out_bitmap_info; -#endif - if(temp_audio) delete [] temp_audio; - reset(); - return 0; -} - -int FileAVI::cmodel_bc_to_avi(int input) -{ -#ifdef USE_AVIFILE - switch(input) - { - case BC_YUV422: - return fccYUY2; - break; - - case BC_YUV420P: - return fccYV12; - break; - } -#endif - return 24; -} - -void FileAVI::reset() -{ -#ifdef USE_AVIFILE - in_fd = 0; - out_fd = 0; - out_bitmap_info = 0; -#endif - temp_audio = 0; - temp_allocated = 0; -} - -int FileAVI::get_best_colormodel(int driver, int colormodel) -{ - if(colormodel > -1) - { - return colormodel; - } - else - { - - return BC_RGB888; - } -} - - -void FileAVI::get_parameters(BC_WindowBase *parent_window, - Asset *asset, - BC_WindowBase* &format_window, - int audio_options, - int video_options, - const char *locked_compressor) -{ - if(audio_options) - { - AVIConfigAudio *window = new AVIConfigAudio(parent_window, asset); - format_window = window; - window->create_objects(); - window->run_window(); - delete window; - } - else - if(video_options) - { -//printf("FileAVI::get_parameters 1\n"); - AVIConfigVideo *window = new AVIConfigVideo(parent_window, - asset, - locked_compressor); - format_window = window; - window->create_objects(); - window->run_window(); - delete window; - } -} - -int FileAVI::set_audio_position(int64_t x) -{ -#ifdef USE_AVIFILE -// quicktime sets positions for each track seperately so store position in audio_position - if(x >= 0 && x < asset->audio_length) - return astream_in[file->current_layer]->Seek(x); -#endif - return 1; -} - -int FileAVI::set_video_position(int64_t x) -{ -#ifdef USE_AVIFILE - if(x >= 0 && x < asset->video_length) - return vstream_in[file->current_layer]->Seek(x); -#endif - return 1; -} - -int FileAVI::read_samples(double *buffer, int64_t len) -{ -#ifdef USE_AVIFILE - Unsigned samples_read, bytes_read; - -printf("FileAVI::read_samples 1\n"); - if(temp_audio && temp_allocated < len * asset->bits / 8 * asset->channels) - { - delete [] temp_audio; - temp_allocated = 0; - } - if(!temp_allocated) - { - temp_allocated = len * asset->bits / 8 * asset->channels; - temp_audio = new unsigned char[temp_allocated]; - } - - astream_in[0]->ReadFrames((void*)temp_audio, - (unsigned int)temp_allocated, - (unsigned int)len, - samples_read, - bytes_read); - -// Extract single channel - switch(asset->bits) - { - case 16: - { - int16_t *temp_int16 = (int16_t*)temp_audio; - for(int i = 0, j = file->current_channel; - i < len; - i++, j += asset->channels) - { - buffer[i] = (double)temp_int16[j] / 32767; - } - break; - } - } - -#endif - - - return 0; -} - -int FileAVI::read_frame(VFrame *frame) -{ - int result = 0; - -#ifdef USE_AVIFILE - vstream_in[file->current_layer]->ReadFrame(); - CImage *temp_image = vstream_in[file->current_layer]->GetFrame(); -//printf("FileAVI::read_frame 1 %d %d\n", source_cmodel, frame->get_color_model()); - switch(source_cmodel) - { - case BC_RGB888: - if(frame->get_color_model() == BC_RGB888) - bcopy(temp_image->Data(), - frame->get_data(), - VFrame::calculate_data_size(asset->width, - asset->height, - -1, - BC_RGB888)); - break; - } -#endif - return result; -} - -int64_t FileAVI::compressed_frame_size() -{ - int result = 0; - return result; -} - -int FileAVI::read_compressed_frame(VFrame *buffer) -{ - int64_t result = 0; - - return result; -} - -int FileAVI::write_compressed_frame(VFrame *buffer) -{ - int result = 0; - - return result; -} - -int FileAVI::write_frames(VFrame ***frames, int len) -{ - return 0; -} - - -int FileAVI::write_samples(double **buffer, int64_t len) -{ - return 0; -} - - - - - -AVIConfigAudio::AVIConfigAudio(BC_WindowBase *parent_window, Asset *asset) - : BC_Window(_(PROGRAM_NAME ": Audio compression"), - parent_window->get_abs_cursor_x(1), - parent_window->get_abs_cursor_y(1), - calculate_w(asset->format), - calculate_h(asset->format)) -{ - this->parent_window = parent_window; - this->asset = asset; -} - -AVIConfigAudio::~AVIConfigAudio() -{ -} - -int AVIConfigAudio::calculate_w(int format) -{ - switch(format) - { - case FILE_AVI_AVIFILE: return 400; break; - case FILE_AVI_ARNE2: return 250; break; - } - return 0; -} - -int AVIConfigAudio::calculate_h(int format) -{ - switch(format) - { - case FILE_AVI_AVIFILE: return 200; break; - case FILE_AVI_ARNE2: return 100; break; - } - return 0; -} - -void AVIConfigAudio::create_objects() -{ - switch(asset->format) - { -#ifdef USE_AVIFILE - case FILE_AVI_AVIFILE: - { - generate_codeclist(); - - int x = 10, y = 10; - BC_Title *title; - add_subwindow(title = new BC_Title(x, y, _("Codec: "))); - list = new AVIACodecList(this, x, y); - list->create_objects(); - y += list->get_h(); - break; - } -#endif - - case FILE_AVI_ARNE2: - add_subwindow(new BC_Title(10, 10, _("Compressor: 16 bit PCM"))); - break; - } - - add_subwindow(new BC_OKButton(this)); -} - -int AVIConfigAudio::close_event() -{ - return 1; -} - -int AVIConfigAudio::generate_codeclist() -{ - FileAVI::initialize_avifile(); - codec_items.remove_all_objects(); - - switch(asset->format) - { -#ifdef USE_AVIFILE - case FILE_AVI_AVIFILE: - for(avm::vector::iterator i = audio_codecs.begin(); - i < audio_codecs.end(); - i++) - { - if(i->direction & CodecInfo::Encode) - { - codec_items.append(new BC_ListBoxItem((char*)i->GetName())); - } - } - break; -#endif - } - - return 0; -} - -void AVIConfigAudio::update_codecs() -{ - -} - - - - - - - - - -AVIACodecList::AVIACodecList(AVIConfigAudio *gui, int x, int y) - : BC_PopupTextBox(gui, - &gui->codec_items, - FileAVI::fourcc_to_acodec(gui->asset->acodec, gui->string), - x, - y, - 200, - 400) -{ - this->gui = gui; -} - -AVIACodecList::~AVIACodecList() -{ -} - -int AVIACodecList::handle_event() -{ - strcpy(gui->asset->acodec, - FileAVI::acodec_to_fourcc(get_text(), gui->string)); - return 1; -} - - - - - -AVIConfigVideo::AVIConfigVideo(BC_WindowBase *parent_window, - Asset *asset, - const char *locked_compressor) - : BC_Window(_(PROGRAM_NAME ": Video Compression"), - parent_window->get_abs_cursor_x(1), - parent_window->get_abs_cursor_y(1), - calculate_w(asset->format), - calculate_h(asset->format)) -{ - this->parent_window = parent_window; - this->asset = asset; - this->locked_compressor = locked_compressor; - reset(); -} - -AVIConfigVideo::~AVIConfigVideo() -{ - codec_items.remove_all_objects(); - attribute_items[0].remove_all_objects(); - attribute_items[1].remove_all_objects(); -} - -void AVIConfigVideo::reset() -{ - attributes = 0; - attribute = 0; -} - -int AVIConfigVideo::calculate_w(int format) -{ - switch(format) - { - case FILE_AVI_AVIFILE: return 400; - case FILE_AVI_ARNE2: return 250; - } - return 0; -} - -int AVIConfigVideo::calculate_h(int format) -{ - switch(format) - { - case FILE_AVI_AVIFILE: return 320; - case FILE_AVI_ARNE2: return 100; - } - return 0; -} - -void AVIConfigVideo::create_objects() -{ - switch(asset->format) - { -#ifdef USE_AVIFILE - case FILE_AVI_AVIFILE: - { - generate_codeclist(); - generate_attributelist(); - - int x = 10, y = 10, x1 = 90; - BC_Title *title; - add_subwindow(title = new BC_Title(x, y, _("Codec: "))); - list = new AVIVCodecList(this, x1, y); - list->create_objects(); - y += list->get_h() + 5; - - add_subwindow(title = new BC_Title(x, y, _("Attributes:"))); - add_subwindow(attributes = new AVIVAttributeList(this, x1, y)); - y += attributes->get_h() + 5; - - add_subwindow(new BC_Title(x, y, _("Value:"))); - add_subwindow(attribute = new AVIVAttribute(this, x1, y)); - break; - } -#endif - - case FILE_AVI_ARNE2: - add_subwindow(new BC_Title(10, 10, _("Compressor: Consumer DV"))); - break; - } - - add_subwindow(new BC_OKButton(this)); -} - -int AVIConfigVideo::close_event() -{ - return 1; -} - -int AVIConfigVideo::generate_codeclist() -{ - FileAVI::initialize_avifile(); - switch(asset->format) - { - case FILE_AVI_AVIFILE: -#ifdef USE_AVIFILE -// Construct codec item list - for(avm::vector::iterator i = video_codecs.begin(); - i < video_codecs.end(); - i++) - { - if(i->direction & CodecInfo::Encode) - { - codec_items.append(new BC_ListBoxItem((char*)i->GetName())); - } - } -#endif - break; - } - - return 0; -} - -void AVIConfigVideo::generate_attributelist() -{ -#ifdef USE_AVIFILE -// Remember selection number - int selection_number = attributes ? attributes->get_selection_number(0, 0) : -1; - attribute_items[0].remove_all_objects(); - attribute_items[1].remove_all_objects(); - FileAVI::initialize_avifile(); - - for(avm::vector::iterator i = video_codecs.begin(); - i < video_codecs.end(); - i++) - { - if(!memcmp((char*)&i->fourcc, asset->vcodec, 4)) - { - avm::vector& attributes = i->encoder_info; - - for(avm::vector::const_iterator j = attributes.begin(); - j != attributes.end(); - j++) - { - char *name = (char*)j->GetName(); - char value[BCTEXTLEN]; - value[0] = 0; - -//printf("AVIConfigVideo::generate_attributelist %d\n", j->kind); - switch(j->kind) - { - case AttributeInfo::Integer: - { - int temp = 0; - Creators::GetCodecAttr(*i, name, temp); - sprintf(value, "%d", temp); - break; - } - - case AttributeInfo::Select: - { - int temp = 0; - Creators::GetCodecAttr(*i, name, temp); - sprintf(value, "%d ( %s )", temp, j->options[temp].c_str()); - break; - } - - case AttributeInfo::String: - { - const char * temp = 0; - Creators::GetCodecAttr(*i, name, &temp); - if(temp) strncpy(value, temp, BCTEXTLEN); - break; - } - } - - attribute_items[0].append(new BC_ListBoxItem(name)); - attribute_items[1].append(new BC_ListBoxItem(value)); - - int current_number = j - attributes.begin(); - if(current_number == selection_number) - { - attribute_items[0].values[current_number]->set_selected(1); - attribute_items[1].values[current_number]->set_selected(1); - } - } - } - } -#endif -} - -const char* AVIConfigVideo::get_current_attribute_text() -{ - BC_ListBoxItem *item = attributes->get_selection(0, 0); - - if(item) - { - return item->get_text(); - } - else - return ""; -} - -const char* AVIConfigVideo::get_current_attribute_value() -{ - BC_ListBoxItem *item = attributes->get_selection(1, 0); - - if(item) - { - return item->get_text(); - } - else - return ""; -} - -void AVIConfigVideo::set_current_attribute(const char *text) -{ -#ifdef USE_AVIFILE - int number = attributes->get_selection_number(0, 0); - - if(number >= 0) - { - FileAVI::initialize_avifile(); - - for(avm::vector::iterator i = video_codecs.begin(); - i < video_codecs.end(); - i++) - { - if(!memcmp((char*)&i->fourcc, asset->vcodec, 4)) - { - avm::vector& attributes = i->encoder_info; - AttributeInfo& attribute = attributes[number]; - - switch(attribute.kind) - { - case AttributeInfo::Integer: - Creators::SetCodecAttr(*i, attribute.GetName(), atol(text)); - break; - - case AttributeInfo::Select: - Creators::SetCodecAttr(*i, attribute.GetName(), atol(text)); - break; - - case AttributeInfo::String: - Creators::SetCodecAttr(*i, attribute.GetName(), text); - break; - } - } - } - - - update_attribute(1); - } -#endif -} - - - -void AVIConfigVideo::update_attribute(int recursive) -{ - generate_attributelist(); - attributes->update(attribute_items, - 0, - 0, - 2, - attributes->get_xposition(), - attributes->get_yposition(), - 0, - 1); - - if(!recursive) attribute->update(get_current_attribute_value()); -} - - - - - - - - - -AVIVCodecList::AVIVCodecList(AVIConfigVideo *gui, int x, int y) - : BC_PopupTextBox(gui, - &gui->codec_items, - FileAVI::fourcc_to_vcodec(gui->asset->vcodec, gui->string), - x, - y, - 280, - 400) -{ - this->gui = gui; -} - -AVIVCodecList::~AVIVCodecList() -{ -} - -int AVIVCodecList::handle_event() -{ - strcpy(gui->asset->vcodec, FileAVI::vcodec_to_fourcc(get_text(), gui->string)); - gui->update_attribute(0); - return 1; -} - - - -AVIVAttributeList::AVIVAttributeList(AVIConfigVideo *gui, int x, int y) - : BC_ListBox(x, - y, - 300, - 200, - LISTBOX_TEXT, - gui->attribute_items, - 0, - 0, - 2) -{ - this->gui = gui; -} - -int AVIVAttributeList::handle_event() -{ - gui->update_attribute(0); - return 1; -} - -int AVIVAttributeList::selection_changed() -{ - gui->update_attribute(0); - return 1; -} - - - - -AVIVAttribute::AVIVAttribute(AVIConfigVideo *gui, int x, int y) - : BC_TextBox(x, y, 300, 1, gui->get_current_attribute_value()) -{ - this->gui = gui; -} - -int AVIVAttribute::handle_event() -{ - gui->set_current_attribute(get_text()); - return 1; -} - - - diff --git a/cinelerra-5.0/cinelerra/fileavi.h b/cinelerra-5.0/cinelerra/fileavi.h deleted file mode 100644 index 22cc4d94..00000000 --- a/cinelerra-5.0/cinelerra/fileavi.h +++ /dev/null @@ -1,219 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef FILEAVI_H -#define FILEAVI_H - -#include "asset.inc" -#include "assets.inc" -#include "file.inc" -#include "filebase.h" - -#ifdef USE_AVIFILE -#include "avifile.h" -#include -#endif - -//class IAviWriteFile; -//class IAviReadFile; -//class IAviReadStream; - -#define MAX_STREAMS 256 - -class FileAVI : public FileBase -{ -public: - FileAVI(Asset *asset, File *file); - ~FileAVI(); - - static int check_sig(Asset *asset); - static void get_parameters(BC_WindowBase *parent_window, - Asset *asset, - BC_WindowBase* &format_window, - int audio_options, - int video_options, - const char *locked_compressor); - - int get_best_colormodel(int driver, int colormodel); - int open_file(int rd, int wr); - int close_file(); - void reset(); - int set_audio_position(int64_t x); - int set_video_position(int64_t x); - int write_samples(double **buffer, int64_t len); - int write_frames(VFrame ***frames, int len); - int write_compressed_frame(VFrame *buffer); - int read_compressed_frame(VFrame *buffer); - int64_t compressed_frame_size(); - int read_samples(double *buffer, int64_t len); - int read_frame(VFrame *frame); - static char* vcodec_to_fourcc(const char *input, char *output); - static char* fourcc_to_vcodec(char *input, char *output); - static char* acodec_to_fourcc(const char *input, char *output); - static char* fourcc_to_acodec(char *input, char *output); - static int cmodel_bc_to_avi(int input); - - static void initialize_avifile(); - - -private: - static int check_sig_arne2(Asset *asset, int &score); - static int check_sig_arne1(Asset *asset, int &score); - static int check_sig_lavtools(Asset *asset, int &score); - static int check_sig_avifile(Asset *asset, int &score); - - int open_avifile_in(Asset *asset); - int open_arne2_in(Asset *asset); - int open_arne1_in(Asset *asset); - int open_lavtools_in(Asset *asset); - - - int open_avifile_out(Asset *asset); - int open_arne2_out(Asset *asset); - int open_arne1_out(Asset *asset); - int open_lavtools_out(Asset *asset); - -#ifdef USE_AVIFILE - IAviWriteFile *out_fd; - IAviReadFile *in_fd; - - IAviReadStream *astream_in[MAX_STREAMS]; - IAviReadStream *vstream_in[MAX_STREAMS]; - IAviWriteStream *astream_out[MAX_STREAMS]; - IAviVideoWriteStream *vstream_out[MAX_STREAMS]; - int out_color_model; - BitmapInfo *out_bitmap_info; - static int avifile_initialized; - -#endif - - - - - - - - unsigned char *temp_audio; - int64_t temp_allocated; - int source_cmodel; -}; - - -class AVIConfigAudio; - -class AVIACodecList : public BC_PopupTextBox -{ -public: - AVIACodecList(AVIConfigAudio *gui, int x, int y); - ~AVIACodecList(); - - int handle_event(); - - AVIConfigAudio *gui; -}; - -class AVIConfigAudio : public BC_Window -{ -public: - AVIConfigAudio(BC_WindowBase *parent_window, Asset *asset); - ~AVIConfigAudio(); - - static int calculate_w(int format); - static int calculate_h(int format); - void create_objects(); - int close_event(); - int generate_codeclist(); - void update_codecs(); - - AVIACodecList *list; - - ArrayList codec_items; - ArrayList attribute_sliders; - BC_WindowBase *parent_window; - Asset *asset; - char string[BCTEXTLEN]; -}; - -class AVIConfigVideo; - -class AVIVCodecList : public BC_PopupTextBox -{ -public: - AVIVCodecList(AVIConfigVideo *gui, int x, int y); - ~AVIVCodecList(); - - int handle_event(); - - AVIConfigVideo *gui; -}; - -class AVIVAttributeList : public BC_ListBox -{ -public: - AVIVAttributeList(AVIConfigVideo *gui, int x, int y); - int handle_event(); - int selection_changed(); - AVIConfigVideo *gui; -}; - -class AVIVAttribute : public BC_TextBox -{ -public: - AVIVAttribute(AVIConfigVideo *gui, int x, int y); - int handle_event(); - AVIConfigVideo *gui; -}; - -class AVIConfigVideo : public BC_Window -{ -public: - AVIConfigVideo(BC_WindowBase *parent_window, - Asset *asset, - const char *locked_compressor); - ~AVIConfigVideo(); - - static int calculate_w(int format); - static int calculate_h(int format); - void create_objects(); - int close_event(); - int generate_codeclist(); - void generate_attributelist(); - void update_attribute(int recursive); -// Get text associated with current attribute - const char* get_current_attribute_text(); - const char* get_current_attribute_value(); - void set_current_attribute(const char *text); - void reset(); - - AVIVCodecList *list; - AVIVAttributeList *attributes; - AVIVAttribute *attribute; - ArrayList codec_items; - ArrayList attribute_items[2]; - BC_WindowBase *parent_window; - Asset *asset; - const char *locked_compressor; - char string[BCTEXTLEN]; -}; - - - -#endif diff --git a/cinelerra-5.0/cinelerra/fileavi.inc b/cinelerra-5.0/cinelerra/fileavi.inc deleted file mode 100644 index 91200dd9..00000000 --- a/cinelerra-5.0/cinelerra/fileavi.inc +++ /dev/null @@ -1,34 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef FILEAVI_INC -#define FILEAVI_INC - -class FileAVI; - - -// Codec macros - -#define AVI_MJPG "MJPG" -#define AVI_DV "dvsd" -#define AVI_DIVX "divx" - -#endif diff --git a/cinelerra-5.0/cinelerra/filebase.C b/cinelerra-5.0/cinelerra/filebase.C index 6d1b4e94..be2a9b79 100644 --- a/cinelerra-5.0/cinelerra/filebase.C +++ b/cinelerra-5.0/cinelerra/filebase.C @@ -22,7 +22,7 @@ #include "asset.h" #include "assets.h" #include "byteorder.h" -#include "colormodels.h" +#include "bccmodels.h" #include "format.inc" #include "file.h" #include "filebase.h" @@ -37,7 +37,6 @@ FileBase::FileBase(Asset *asset, File *file) this->file = file; this->asset = asset; internal_byte_order = get_byte_order(); - init_ima4(); reset_parameters(); overlayer = new OverlayFrame; } @@ -49,7 +48,6 @@ FileBase::~FileBase() if(row_pointers_out) delete [] row_pointers_out; if(float_buffer) delete [] float_buffer; delete overlayer; - delete_ima4(); } int FileBase::close_file() @@ -69,7 +67,6 @@ int FileBase::close_file() close_file_derived(); reset_parameters(); - delete_ima4(); return 0; } diff --git a/cinelerra-5.0/cinelerra/filebase.h b/cinelerra-5.0/cinelerra/filebase.h index fa3aeb83..31ecf92d 100644 --- a/cinelerra-5.0/cinelerra/filebase.h +++ b/cinelerra-5.0/cinelerra/filebase.h @@ -24,7 +24,7 @@ #include "asset.inc" #include "assets.inc" -#include "colormodels.h" +#include "bccmodels.h" #include "edit.inc" #include "ffmpeg.inc" #include "guicast.h" @@ -188,10 +188,7 @@ protected: // allocate a buffer for translating video to VFrame int get_video_buffer(unsigned char **buffer, int depth); // video int get_row_pointers(unsigned char *buffer, unsigned char ***pointers, int depth); - static int match4(const char *in, const char *out); // match 4 bytes for a quicktime type - - int64_t ima4_samples_to_bytes(int64_t samples, int channels); - int64_t ima4_bytes_to_samples(int64_t bytes, int channels); + static int match4(const char *in, const char *out); // match 4 bytes for a fourcc type float *float_buffer; // for floating point feathering unsigned char **row_pointers_in, **row_pointers_out; @@ -231,20 +228,6 @@ private: float *ulawtofloat_table, *ulawtofloat_ptr; unsigned char *floattoulaw_table, *floattoulaw_ptr; -// IMA4 - int init_ima4(); - int delete_ima4(); - int ima4_decode_block(int16_t *output, unsigned char *input); - int ima4_decode_sample(int *predictor, int nibble, int *index, int *step); - int ima4_encode_block(unsigned char *output, int16_t *input, int step, int channel); - int ima4_encode_sample(int *last_sample, int *last_index, int *nibble, int next_sample); - - static int ima4_step[89]; - static int ima4_index[16]; - int *last_ima4_samples; - int *last_ima4_indexes; - int ima4_block_size; - int ima4_block_samples; OverlayFrame *overlayer; }; diff --git a/cinelerra-5.0/cinelerra/filebaseima4.C b/cinelerra-5.0/cinelerra/filebaseima4.C deleted file mode 100644 index 2d5d2d23..00000000 --- a/cinelerra-5.0/cinelerra/filebaseima4.C +++ /dev/null @@ -1,268 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "asset.h" -#include "byteorder.h" -#include "file.h" -#include "filebase.h" -#include "sizes.h" - -int FileBase::ima4_step[89] = -{ - 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, - 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, - 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, - 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, - 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, - 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, - 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358, - 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, - 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767 -}; - -int FileBase::ima4_index[16] = -{ - -1, -1, -1, -1, 2, 4, 6, 8, - -1, -1, -1, -1, 2, 4, 6, 8 -}; - - - -int FileBase::init_ima4() -{ - ima4_block_samples = 1024; - ima4_block_size = (ima4_block_samples - 1) * asset->channels / 2 + 4; - last_ima4_samples = 0; - last_ima4_indexes = 0; - return 0; -} - -int FileBase::delete_ima4() -{ - if(last_ima4_samples) delete last_ima4_samples; - if(last_ima4_indexes) delete last_ima4_indexes; - last_ima4_samples = 0; - last_ima4_indexes = 0; - return 0; -} - -int FileBase::ima4_decode_block(int16_t *output, unsigned char *input) -{ -return 0; -// int predictor[asset->channels]; -// int index[asset->channels]; -// int step[asset->channels]; -// int i, j, nibble; -// unsigned char *block_ptr; -// unsigned char *input_end = input + ima4_block_size; -// int buffer_advance = asset->channels; -// int16_t *suboutput; -// -// // Get the chunk header -// for(int i = 0; i < asset->channels; i++) -// { -// predictor[i] = *input++; -// predictor[i] |= (int)(*input++) << 8; -// index[i] = *input++; -// if(index[i] > 88) index[i] = 88; -// if(predictor[i] & 0x8000) predictor[i] -= 0x10000; -// step[i] = ima4_step[index[i]]; -// *output++ = predictor[i]; -// input++; -// } -// -// // Read the input buffer sequentially, one nibble at a time -// while(input < input_end) -// { -// for(i = 0; i < asset->channels; i++) -// { -// suboutput = output + i; -// -// for(j = 0; j < 4; j++) -// { -// ima4_decode_sample(&predictor[i], *input & 0x0f, &index[i], &step[i]); -// *suboutput = predictor[i]; -// suboutput += buffer_advance; -// ima4_decode_sample(&predictor[i], (*input++ >> 4) & 0x0f, &index[i], &step[i]); -// *suboutput = predictor[i]; -// suboutput += buffer_advance; -// } -// } -// -// output += 8 * asset->channels; -// } -} - -int FileBase::ima4_decode_sample(int *predictor, int nibble, int *index, int *step) -{ - int difference, sign; - -// Get new index value - *index += ima4_index[nibble]; - - if(*index < 0) *index = 0; - else - if(*index > 88) *index = 88; - -// Get sign and magnitude from nibble - sign = nibble & 8; - nibble = nibble & 7; - -// Get difference - difference = *step >> 3; - if(nibble & 4) difference += *step; - if(nibble & 2) difference += *step >> 1; - if(nibble & 1) difference += *step >> 2; - -// Predict value - if(sign) - *predictor -= difference; - else - *predictor += difference; - - if(*predictor > 32767) *predictor = 32767; - else - if(*predictor < -32768) *predictor = -32768; - -// Update the step value - *step = ima4_step[*index]; - - return 0; -} - - -int FileBase::ima4_encode_block(unsigned char *output, int16_t *input, int step, int channel) -{ - int i, j, nibble; - int16_t *input_end = input + ima4_block_size; - int16_t *subinput; - int buffer_advance = asset->channels; - - if(!last_ima4_samples) - { - last_ima4_samples = new int[asset->channels]; - for(i = 0; i < asset->channels; i++) last_ima4_samples[i] = 0; - } - - if(!last_ima4_indexes) - { - last_ima4_indexes = new int[asset->channels]; - for(i = 0; i < asset->channels; i++) last_ima4_indexes[i] = 0; - } - - for(i = 0; i < asset->channels; i++) - { - *output++ = last_ima4_samples[i] & 0xff; - *output++ = (last_ima4_samples[i] >> 8) & 0xff; - *output++ = last_ima4_indexes[i]; - *output++ = 0; - } - - while(input < input_end) - { - for(i = 0; i < asset->channels; i++) - { - subinput = input + i; - for(j = 0; j < 4; j++) - { - ima4_encode_sample(&(last_ima4_samples[i]), - &(last_ima4_indexes[i]), - &nibble, - *subinput); - - subinput += buffer_advance; - *output = nibble; - - ima4_encode_sample(&(last_ima4_samples[i]), - &(last_ima4_indexes[i]), - &nibble, - *subinput); - - subinput += buffer_advance; - *output++ |= (nibble << 4); - } - } - input += 8 * asset->channels; - } - - return 0; -} - -int FileBase::ima4_encode_sample(int *last_sample, int *last_index, int *nibble, int next_sample) -{ - int difference, new_difference, mask, step; - - difference = next_sample - *last_sample; - *nibble = 0; - step = ima4_step[*last_index]; - new_difference = step >> 3; - - if(difference < 0) - { - *nibble = 8; - difference = -difference; - } - - mask = 4; - while(mask) - { - if(difference >= step) - { - *nibble |= mask; - difference -= step; - new_difference += step; - } - - step >>= 1; - mask >>= 1; - } - - if(*nibble & 8) - *last_sample -= new_difference; - else - *last_sample += new_difference; - - if(*last_sample > 32767) *last_sample = 32767; - else - if(*last_sample < -32767) *last_sample = -32767; - - *last_index += ima4_index[*nibble]; - - if(*last_index < 0) *last_index = 0; - else - if(*last_index > 88) *last_index= 88; - - return 0; -} - -// Convert the number of samples in a chunk into the number of bytes in that -// chunk. The number of samples in a chunk should end on a block boundary. -int64_t FileBase::ima4_samples_to_bytes(int64_t samples, int channels) -{ - int64_t bytes = (int64_t)(samples / ima4_block_samples) * ima4_block_size * channels; - return bytes; -} - -int64_t FileBase::ima4_bytes_to_samples(int64_t bytes, int channels) -{ - int64_t samples = (int64_t)(bytes / channels / ima4_block_size) * ima4_block_samples; - return samples; -} diff --git a/cinelerra-5.0/cinelerra/filecr2.C b/cinelerra-5.0/cinelerra/filecr2.C index ff929f93..22345b7c 100644 --- a/cinelerra-5.0/cinelerra/filecr2.C +++ b/cinelerra-5.0/cinelerra/filecr2.C @@ -22,7 +22,7 @@ #include "asset.h" #include "bchash.h" #include "clip.h" -#include "colormodels.h" +#include "bccmodels.h" #include "format.inc" #include "file.h" #include "filecr2.h" diff --git a/cinelerra-5.0/cinelerra/filedv.C b/cinelerra-5.0/cinelerra/filedv.C index 6e582b85..c3b01532 100644 --- a/cinelerra-5.0/cinelerra/filedv.C +++ b/cinelerra-5.0/cinelerra/filedv.C @@ -30,10 +30,8 @@ #include "language.h" #include "mutex.h" #include "mwindow.inc" -#include "quicktime.h" #include "vframe.h" #include "videodevice.inc" -#include "cmodel_permutation.h" #include "mainerror.h" @@ -913,11 +911,7 @@ int FileDV::colormodel_supported(int colormodel) int FileDV::can_copy_from(Edit *edit, int64_t position) { - if(edit->asset->format == FILE_RAWDV || - (edit->asset->format == FILE_MOV && - (match4(edit->asset->vcodec, QUICKTIME_DV) || - match4(edit->asset->vcodec, QUICKTIME_DVSD) || - match4(edit->asset->vcodec, QUICKTIME_DVCP)))) + if(edit->asset->format == FILE_RAWDV) return 1; return 0; diff --git a/cinelerra-5.0/cinelerra/fileexr.C b/cinelerra-5.0/cinelerra/fileexr.C index d59bbbd3..2059c474 100644 --- a/cinelerra-5.0/cinelerra/fileexr.C +++ b/cinelerra-5.0/cinelerra/fileexr.C @@ -332,7 +332,7 @@ int FileEXR::read_frame(VFrame *frame, VFrame *data) int dy = dw.min.y; Imf::FrameBuffer framebuffer; float **rows = (float**)frame->get_rows(); - int components = cmodel_components(frame->get_color_model()); + int components = BC_CModels::components(frame->get_color_model()); if(is_yuv) { @@ -459,7 +459,7 @@ int FileEXR::write_frame(VFrame *frame, VFrame *data, FrameWriterUnit *unit) int native_cmodel = asset->exr_use_alpha ? BC_RGBA_FLOAT : BC_RGB_FLOAT; - int components = cmodel_components(native_cmodel); + int components = BC_CModels::components(native_cmodel); if(frame->get_color_model() != native_cmodel) { diff --git a/cinelerra-5.0/cinelerra/fileflac.C b/cinelerra-5.0/cinelerra/fileflac.C index ccbcb0fe..3914e71c 100644 --- a/cinelerra-5.0/cinelerra/fileflac.C +++ b/cinelerra-5.0/cinelerra/fileflac.C @@ -383,16 +383,7 @@ void FLACConfigAudio::create_objects() { int x = 10, y = 10; lock_window("FLACConfigAudio::create_objects"); - bits_popup = new BitsPopup(this, - x, - y, - &asset->bits, - 0, - 0, - 0, - 0, - 0, - 0); + bits_popup = new BitsPopup(this, x, y, &asset->bits, 0, 0, 0, 0, 0); bits_popup->create_objects(); add_subwindow(new BC_OKButton(this)); diff --git a/cinelerra-5.0/cinelerra/filejpeg.C b/cinelerra-5.0/cinelerra/filejpeg.C index ec76b229..315757ab 100644 --- a/cinelerra-5.0/cinelerra/filejpeg.C +++ b/cinelerra-5.0/cinelerra/filejpeg.C @@ -28,7 +28,6 @@ #include "language.h" #include "libmjpeg.h" #include "mwindow.inc" -#include "quicktime.h" #include "vframe.h" #include "videodevice.inc" #include "mainerror.h" @@ -101,11 +100,6 @@ void FileJPEG::get_parameters(BC_WindowBase *parent_window, int FileJPEG::can_copy_from(Asset *asset, int64_t position) { //printf("FileJPEG::can_copy_from %d %s\n", asset->format, asset->vcodec); - if(asset->format == FILE_MOV) - { - if(match4(asset->vcodec, QUICKTIME_JPEG)) return 1; - } - else if(asset->format == FILE_JPEG || asset->format == FILE_JPEG_LIST) return 1; diff --git a/cinelerra-5.0/cinelerra/filejpeglist.C b/cinelerra-5.0/cinelerra/filejpeglist.C index 6fc86ae4..bfd801d2 100644 --- a/cinelerra-5.0/cinelerra/filejpeglist.C +++ b/cinelerra-5.0/cinelerra/filejpeglist.C @@ -26,7 +26,6 @@ #include "libmjpeg.h" #include "mwindow.inc" #include "jpegwrapper.h" -#include "quicktime.h" #include "vframe.h" #include @@ -75,10 +74,7 @@ int FileJPEGList::can_copy_from(Asset *asset) { if(asset->format == FILE_JPEG_LIST) return 1; - else - if(asset->format == FILE_MOV && match4(asset->vcodec, QUICKTIME_JPEG)) - return 1; - + return 0; } diff --git a/cinelerra-5.0/cinelerra/filemov.C b/cinelerra-5.0/cinelerra/filemov.C deleted file mode 100644 index 4fd6234b..00000000 --- a/cinelerra-5.0/cinelerra/filemov.C +++ /dev/null @@ -1,2240 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "asset.h" -#include "bcsignals.h" -#include "bitspopup.h" -#include "byteorder.h" -#include "clip.h" -#include "condition.h" -#include "edit.h" -#include "file.h" -#include "filemov.h" -#include "format.inc" -#include "guicast.h" -#include "language.h" -#include "mutex.h" -#include "mwindow.inc" -#include "preferences.h" -#include "vframe.h" -#include "videodevice.inc" -#include "mainerror.h" - -#include -#include -#include - -#if 0 -N_("MPEG-4") -N_("Dual H.264") -N_("Dual MPEG-4") -N_("H.264") -N_("H.263") -N_("Microsoft MPEG-4") -N_("DV") -N_("PNG") -N_("PNG with Alpha") -N_("Uncompressed RGB") -N_("Uncompressed RGBA") -N_("YUV 4:2:0 Planar") -N_("Component Y'CbCr 8-bit 4:2:2 (yuv2)") -N_("Component Y'CbCr 8-bit 4:2:2 (2vuy)") -N_("YUV 4:1:1 Packed") -N_("Component Y'CbCr 8-bit 4:4:4") -N_("Component Y'CbCrA 8-bit 4:4:4:4") -N_("Component Y'CbCr 10-bit 4:4:4") -N_("JPEG Photo") -N_("Motion JPEG A") - - -N_("Twos complement") -N_("Unsigned") -N_("IMA-4") -N_("U-Law") -N_("Vorbis") -N_("MP3") -N_("MPEG-4 Audio") -#endif - -#define DIVX_NAME "MPEG-4" -#define HV64_NAME "Dual H.264" -#define MP4V_NAME "MPEG-4 Video" -#define H264_NAME "H.264" -#define H263_NAME "H.263" -#define HV60_NAME "Dual MPEG-4" -#define DIV3_NAME "Microsoft MPEG-4" -#define DV_NAME "DV" -#define PNG_NAME "PNG" -#define PNGA_NAME "PNG with Alpha" -#define RGB_NAME "Uncompressed RGB" -#define RGBA_NAME "Uncompressed RGBA" -#define YUV420_NAME "YUV 4:2:0 Planar" -#define YUV422_NAME "Component Y'CbCr 8-bit 4:2:2 (yuv2)" -#define TWOVUY_NAME "Component Y'CbCr 8-bit 4:2:2 (2vuy)" -#define YUV411_NAME "YUV 4:1:1 Packed" -#define YUV444_NAME "Component Y'CbCr 8-bit 4:4:4" -#define YUVA4444_NAME "Component Y'CbCrA 8-bit 4:4:4:4" -#define YUV444_10BIT_NAME "Component Y'CbCr 10-bit 4:4:4" -#define QTJPEG_NAME "JPEG Photo" -#define QTMJPEGP_NAME "MJPEG Photo" -#define MJPA_NAME "Motion JPEG A" - -#define TWOS_NAME "Twos complement" -#define RAW_NAME "Unsigned" -#define IMA4_NAME "IMA-4" -#define ULAW_NAME "U-Law" -//#define VORBIS_NAME "Vorbis" -#define MP3_NAME "MP3" -#define MP4A_NAME "MPEG-4 Audio" -#define VORBIS_NAME "OGG Vorbis" - - - - - -FileMOV::FileMOV(Asset *asset, File *file) - : FileBase(asset, file) -{ - reset_parameters(); - if(asset->format == FILE_UNKNOWN) - asset->format = FILE_MOV; - asset->byte_order = 0; - suffix_number = 0; - threadframe_lock = new Mutex("FileMOV::threadframe_lock"); -} - -FileMOV::~FileMOV() -{ - close_file(); - delete threadframe_lock; -} - -void FileMOV::get_parameters(BC_WindowBase *parent_window, - Asset *asset, - BC_WindowBase* &format_window, - int audio_options, - int video_options, - const char *locked_compressor) -{ - fix_codecs(asset); - if(audio_options) - { - MOVConfigAudio *window = new MOVConfigAudio(parent_window, asset); - format_window = window; - window->create_objects(); - window->run_window(); - delete window; - } - else - if(video_options) - { - MOVConfigVideo *window = new MOVConfigVideo(parent_window, - asset, - locked_compressor); - format_window = window; - window->create_objects(); - window->run_window(); - delete window; - } -} - -void FileMOV::fix_codecs(Asset *asset) -{ - if(!strcasecmp(asset->vcodec, QUICKTIME_DV) || - !strcasecmp(asset->vcodec, QUICKTIME_DVSD) || - !strcasecmp(asset->vcodec, QUICKTIME_DVCP)) - { -// printf("AF: %i, AH: %i, VC: %s\n", asset->format, asset->height, asset->vcodec); - if (asset->format == FILE_AVI) - strcpy (asset->vcodec, QUICKTIME_DVSD); - else if (asset->format == FILE_MOV && asset->height == 576) - strcpy (asset->vcodec, QUICKTIME_DVCP); - else if (asset->format == FILE_MOV && asset->height == 480) - strcpy (asset->vcodec, QUICKTIME_DV); - } -} - -int FileMOV::check_codec_params(Asset *asset) -{ - if(!strcasecmp(asset->vcodec, QUICKTIME_DV) || - !strcasecmp(asset->vcodec, QUICKTIME_DVSD) || - !strcasecmp(asset->vcodec, QUICKTIME_DVCP)) - { - if (!(asset->height == 576 && asset->width == 720) && - !(asset->height == 480 && asset->width == 720)) - { - eprintf(_("DV in Quicktime container does not support following resolution: %ix%i\n" - "Allowed resolutions are 720x576 (PAL) and 720x480 (NTSC)\n"), - asset->width, asset->height); - return 1; - } - } - return 0; -} - - -int FileMOV::check_sig(Asset *asset) -{ - int result = quicktime_check_sig(asset->path); - if(result == 2) result = 0; - return result; -} - -int FileMOV::reset_parameters_derived() -{ - fd = 0; - prev_track = 0; - quicktime_atracks = 0; - quicktime_vtracks = 0; - depth = 24; - threads = 0; - frames_correction = 0; - samples_correction = 0; - temp_float = 0; - temp_allocated = 0; - return 0; -} - - -// Just create the Quicktime objects since this routine is also called -// for reopening. -int FileMOV::open_file(int rd, int wr) -{ - - if(suffix_number == 0) strcpy(prefix_path, asset->path); - - if(!(fd = quicktime_open(asset->path, rd, wr))) - { - eprintf(_("Error while opening file \"%s\". \n%m\n"), asset->path); - return 1; - } - - if( !strcmp(asset->vcodec, QUICKTIME_DIV3) ) - file->cpus = 1; - quicktime_set_cpus(fd, file->cpus); - quicktime_set_cache_max(fd, file->preferences->cache_size); -//printf("FileMOV::open_file %d %d\n", __LINE__, file->preferences->cache_size); - - if(rd) format_to_asset(); - - if(wr) - { - asset_to_format(); - if (check_codec_params(asset)) - return 1; - } - -// Set decoding parameter - quicktime_set_parameter(fd, "divx_use_deblocking", &asset->divx_use_deblocking); -// Set timecode offset - quicktime_set_frame_start(fd, 0); - - return 0; -} - -int FileMOV::close_file() -{ -//printf("FileMOV::close_file 1 %s\n", asset->path); - if(fd) - { - if(file->wr) quicktime_set_framerate(fd, asset->frame_rate); - quicktime_close(fd); - } - -//printf("FileMOV::close_file 1\n"); - if(threads) - { - for(int i = 0; i < file->cpus; i++) - { - threads[i]->stop_encoding(); - delete threads[i]; - } - delete [] threads; - threads = 0; - } - -//printf("FileMOV::close_file 1\n"); - threadframes.remove_all_objects(); - - - if(temp_float) - { - for(int i = 0; i < asset->channels; i++) - delete [] temp_float[i]; - delete [] temp_float; - } - -//printf("FileMOV::close_file 1\n"); - reset_parameters(); - FileBase::close_file(); -//printf("FileMOV::close_file 2\n"); - return 0; -} - -void FileMOV::set_frame_start(int64_t offset) -{ - quicktime_set_frame_start(fd, offset); -} - -void FileMOV::asset_to_format() -{ - if(!fd) return; - - fix_codecs(asset); - -// Fix up the Quicktime file. - quicktime_set_copyright(fd, _("Made with Cinelerra for Linux")); - quicktime_set_info(fd, "Quicktime for Linux"); - - if(asset->audio_data) - { - quicktime_atracks = quicktime_set_audio(fd, - asset->channels, - asset->sample_rate, - asset->bits, - asset->acodec); - quicktime_set_parameter(fd, "vorbis_vbr", &asset->vorbis_vbr); - quicktime_set_parameter(fd, "vorbis_min_bitrate", &asset->vorbis_min_bitrate); - quicktime_set_parameter(fd, "vorbis_bitrate", &asset->vorbis_bitrate); - quicktime_set_parameter(fd, "vorbis_max_bitrate", &asset->vorbis_max_bitrate); - quicktime_set_parameter(fd, "mp3_bitrate", &asset->mp3_bitrate); - quicktime_set_parameter(fd, "mp4a_bitrate", &asset->mp4a_bitrate); - } - - if(asset->video_data) - { - char string[16]; -// Set up the alpha channel compressors - if(!strcmp(asset->vcodec, MOV_RGBA)) - { - strcpy(string, QUICKTIME_RAW); - depth = 32; - } - else - if(!strcmp(asset->vcodec, MOV_PNGA)) - { - strcpy(string, QUICKTIME_PNG); - depth = 32; - } - else - if(!strcmp(asset->vcodec, QUICKTIME_YUVA4444)) - { - strcpy(string, asset->vcodec); - depth = 32; - } - else - { - strcpy(string, asset->vcodec); - depth = 24; - } - - - quicktime_vtracks = quicktime_set_video(fd, - asset->layers, - asset->width, - asset->height, - asset->frame_rate, - string); - - - - for(int i = 0; i < asset->layers; i++) - quicktime_set_depth(fd, depth, i); - - quicktime_set_parameter(fd, "jpeg_quality", &asset->jpeg_quality); - -// set the compression parameters if there are any - quicktime_set_parameter(fd, "divx_bitrate", &asset->divx_bitrate); - quicktime_set_parameter(fd, "divx_rc_period", &asset->divx_rc_period); - quicktime_set_parameter(fd, "divx_rc_reaction_ratio", &asset->divx_rc_reaction_ratio); - quicktime_set_parameter(fd, "divx_rc_reaction_period", &asset->divx_rc_reaction_period); - quicktime_set_parameter(fd, "divx_max_key_interval", &asset->divx_max_key_interval); - quicktime_set_parameter(fd, "divx_max_quantizer", &asset->divx_max_quantizer); - quicktime_set_parameter(fd, "divx_min_quantizer", &asset->divx_min_quantizer); - quicktime_set_parameter(fd, "divx_quantizer", &asset->divx_quantizer); - quicktime_set_parameter(fd, "divx_quality", &asset->divx_quality); - quicktime_set_parameter(fd, "divx_fix_bitrate", &asset->divx_fix_bitrate); - -// printf("FileMOV::asset_to_format %d\n", -// __LINE__); -// asset->dump(); - quicktime_set_parameter(fd, "ffmpeg_bitrate", &asset->ms_bitrate); - quicktime_set_parameter(fd, "ffmpeg_bitrate_tolerance", &asset->ms_bitrate_tolerance); - quicktime_set_parameter(fd, "ffmpeg_interlaced", &asset->ms_interlaced); - quicktime_set_parameter(fd, "ffmpeg_quantizer", &asset->ms_quantization); - quicktime_set_parameter(fd, "ffmpeg_gop_size", &asset->ms_gop_size); - quicktime_set_parameter(fd, "ffmpeg_fix_bitrate", &asset->ms_fix_bitrate); - - quicktime_set_parameter(fd, "h264_bitrate", &asset->h264_bitrate); - quicktime_set_parameter(fd, "h264_quantizer", &asset->h264_quantizer); - quicktime_set_parameter(fd, "h264_fix_bitrate", &asset->h264_fix_bitrate); - - - } - - if(file->wr && asset->format == FILE_AVI) - { - quicktime_set_avi(fd, 1); - } -} - - -void FileMOV::format_to_asset() -{ - if(!fd) return; - - if(quicktime_is_avi(fd)) asset->format = FILE_AVI; - asset->audio_data = quicktime_has_audio(fd); - if(asset->audio_data) - { - asset->channels = 0; - int qt_tracks = quicktime_audio_tracks(fd); - for(int i = 0; i < qt_tracks; i++) - asset->channels += quicktime_track_channels(fd, i); - - if(!asset->sample_rate) - asset->sample_rate = quicktime_sample_rate(fd, 0); - asset->bits = quicktime_audio_bits(fd, 0); - asset->audio_length = quicktime_audio_length(fd, 0); - strncpy(asset->acodec, quicktime_audio_compressor(fd, 0), 4); - } - -// determine if the video can be read before declaring video data - if(quicktime_has_video(fd) && quicktime_supported_video(fd, 0)) - asset->video_data = 1; - - if(asset->video_data) - { - depth = quicktime_video_depth(fd, 0); - asset->layers = quicktime_video_tracks(fd); - asset->width = quicktime_video_width(fd, 0); - asset->height = quicktime_video_height(fd, 0); - asset->video_length = quicktime_video_length(fd, 0); -// Don't want a user configured frame rate to get destroyed - if(EQUIV(asset->frame_rate, 0)) - asset->frame_rate = quicktime_frame_rate(fd, 0); - - strncpy(asset->vcodec, quicktime_video_compressor(fd, 0), 4); - - // If DV stream, get the timecode - // This should become part of libquicktime functionality... for all formats - if(match4(asset->vcodec, QUICKTIME_DV)) - { - char tc[12]; - dv_decoder_t *tmp_decoder = dv_decoder_new(0,0,0); - VFrame *frame = new VFrame(0, 0, BC_COMPRESSED); - read_frame(frame); - set_video_position(0); - if(dv_parse_header(tmp_decoder, frame->get_data()) > -1) - { - dv_parse_packs(tmp_decoder, frame->get_data()); - dv_get_timestamp(tmp_decoder, tc); -// printf("Timestamp %s\n", tc); - } - delete frame; - dv_decoder_free(tmp_decoder); - } - } -} - - -int64_t FileMOV::get_memory_usage() -{ - if(file->rd && fd) - { - int64_t result = quicktime_memory_usage(fd); -//printf("FileMOV::get_memory_usage 1 %d\n", result); - return result; - } - return 0; -} - - -int FileMOV::colormodel_supported(int colormodel) -{ - return colormodel; -} - -int FileMOV::get_best_colormodel(Asset *asset, int driver) -{ - switch(driver) - { - case PLAYBACK_X11: - return BC_RGB888; - break; - case PLAYBACK_X11_XV: - case PLAYBACK_ASYNCHRONOUS: - if(match4(asset->vcodec, QUICKTIME_YUV420)) return BC_YUV420P; - if(match4(asset->vcodec, QUICKTIME_YUV422)) return BC_YUV422; - if(match4(asset->vcodec, QUICKTIME_2VUY)) return BC_YUV422; - if(match4(asset->vcodec, QUICKTIME_JPEG)) return BC_YUV420P; - if(match4(asset->vcodec, QUICKTIME_MJPA)) return BC_YUV422P; - if(match4(asset->vcodec, QUICKTIME_MJPG)) return BC_YUV422P; - if(match4(asset->vcodec, QUICKTIME_DV)) return BC_YUV422; - if(match4(asset->vcodec, QUICKTIME_DVSD)) return BC_YUV422; - if(match4(asset->vcodec, QUICKTIME_HV60)) return BC_YUV420P; - if(match4(asset->vcodec, QUICKTIME_DIVX)) return BC_YUV420P; - if(match4(asset->vcodec, QUICKTIME_DVCP)) return BC_YUV422; - if(match4(asset->vcodec, QUICKTIME_DVSD)) return BC_YUV422; - if(match4(asset->vcodec, QUICKTIME_MP4V)) return BC_YUV420P; - if(match4(asset->vcodec, QUICKTIME_H263)) return BC_YUV420P; - if(match4(asset->vcodec, QUICKTIME_H264)) return BC_YUV420P; - if(match4(asset->vcodec, QUICKTIME_HV64)) return BC_YUV420P; - if(match4(asset->vcodec, QUICKTIME_DIV3) || - match4(asset->vcodec, QUICKTIME_SVQ3)) return BC_YUV420P; - break; - case PLAYBACK_X11_GL: - if(match4(asset->vcodec, QUICKTIME_YUV420) || - match4(asset->vcodec, QUICKTIME_YUV422) || - match4(asset->vcodec, QUICKTIME_2VUY) || - match4(asset->vcodec, QUICKTIME_JPEG) || - match4(asset->vcodec, QUICKTIME_MJPA) || - match4(asset->vcodec, QUICKTIME_MJPG) || - match4(asset->vcodec, QUICKTIME_DV) || - match4(asset->vcodec, QUICKTIME_DVCP) || - match4(asset->vcodec, QUICKTIME_DVSD) || - match4(asset->vcodec, QUICKTIME_HV60) || - match4(asset->vcodec, QUICKTIME_DIVX) || - match4(asset->vcodec, QUICKTIME_DVSD) || - match4(asset->vcodec, QUICKTIME_MP4V) || - match4(asset->vcodec, QUICKTIME_H263) || - match4(asset->vcodec, QUICKTIME_H264) || - match4(asset->vcodec, QUICKTIME_HV64) || - match4(asset->vcodec, QUICKTIME_DIV3) || - match4(asset->vcodec, QUICKTIME_DVSD)) return BC_YUV888; - break; - case PLAYBACK_DV1394: - case PLAYBACK_FIREWIRE: - if(match4(asset->vcodec, QUICKTIME_DV) || - match4(asset->vcodec, QUICKTIME_DVSD) || - match4(asset->vcodec, QUICKTIME_DVCP)) return BC_COMPRESSED; - return BC_YUV422P; - break; - case PLAYBACK_LML: - case PLAYBACK_BUZ: - if(match4(asset->vcodec, QUICKTIME_MJPA)) - return BC_COMPRESSED; - else - return BC_YUV422P; - break; - case VIDEO4LINUX: - case VIDEO4LINUX2: - if(!strncasecmp(asset->vcodec, QUICKTIME_YUV420, 4)) return BC_YUV422; - else - if(!strncasecmp(asset->vcodec, QUICKTIME_YUV422, 4)) return BC_YUV422; - else - if(!strncasecmp(asset->vcodec, QUICKTIME_YUV411, 4)) return BC_YUV411P; - else - if(!strncasecmp(asset->vcodec, QUICKTIME_JPEG, 4)) return BC_YUV420P; - else - if(!strncasecmp(asset->vcodec, QUICKTIME_MJPA, 4)) return BC_YUV422P; - else - if(!strncasecmp(asset->vcodec, QUICKTIME_HV60, 4)) return BC_YUV420P; - else - if(!strncasecmp(asset->vcodec, QUICKTIME_DIVX, 4)) return BC_YUV420P; - else - if(!strncasecmp(asset->vcodec, QUICKTIME_H263, 4)) return BC_YUV420P; - else - if(!strncasecmp(asset->vcodec, QUICKTIME_DIV3, 4)) return BC_YUV420P; - else - if(!strncasecmp(asset->vcodec, QUICKTIME_MP4V, 4)) return BC_YUV422P; - break; - - case CAPTURE_BUZ: - case CAPTURE_LML: - case VIDEO4LINUX2JPEG: - if(!strncasecmp(asset->vcodec, QUICKTIME_MJPA, 4)) - return BC_COMPRESSED; - else - return BC_YUV422; - break; - - case CAPTURE_JPEG_WEBCAM: - return BC_COMPRESSED; - break; - - case CAPTURE_YUYV_WEBCAM: - return BC_YUV422; - break; - - case CAPTURE_FIREWIRE: - case CAPTURE_IEC61883: - if(!strncasecmp(asset->vcodec, QUICKTIME_DV, 4) || - !strncasecmp(asset->vcodec, QUICKTIME_DVSD, 4) || - !strncasecmp(asset->vcodec, QUICKTIME_DVCP, 4)) - return BC_COMPRESSED; - else - return BC_YUV422; - break; - case CAPTURE_DVB: - case VIDEO4LINUX2MPEG: - return BC_YUV422P; - break; - } - return BC_RGB888; -} - -int FileMOV::can_copy_from(Edit *edit, int64_t position) -{ - if(!fd) return 0; - Indexable *source = edit->get_source(); - if( !source->is_asset ) return 0; - Asset *asset = (Asset *)source; - -//printf("FileMOV::can_copy_from 1 %d %s %s\n", asset->format, asset->vcodec, this->asset->vcodec); - if(asset->format == FILE_JPEG_LIST && - match4(this->asset->vcodec, QUICKTIME_JPEG)) - return 1; - else - if((asset->format == FILE_MOV || - asset->format == FILE_AVI)) - { -//printf("FileMOV::can_copy_from %s %s\n", asset->vcodec, this->asset->vcodec); - if(match4(asset->vcodec, this->asset->vcodec)) - return 1; -// there are combinations where the same codec has multiple fourcc codes -// check for DV... - int is_edit_dv = 0; - int is_this_dv = 0; - if (match4(asset->vcodec, QUICKTIME_DV) || - match4(asset->vcodec, QUICKTIME_DVSD) || - match4(asset->vcodec, QUICKTIME_DVCP)) - is_edit_dv = 1; - if (match4(this->asset->vcodec, QUICKTIME_DV) || - match4(this->asset->vcodec, QUICKTIME_DVSD) || - match4(this->asset->vcodec, QUICKTIME_DVCP)) - is_this_dv = 1; - if (is_this_dv && is_edit_dv) - return 1; - } - else - if(edit->asset->format == FILE_RAWDV) - { - if(match4(this->asset->vcodec, QUICKTIME_DV) || - match4(this->asset->vcodec, QUICKTIME_DVSD) || - match4(this->asset->vcodec, QUICKTIME_DVCP)) - return 1; - } - - return 0; -} - - -int64_t FileMOV::get_audio_length() -{ - if(!fd) return 0; - int64_t result = quicktime_audio_length(fd, 0) + samples_correction; - - return result; -} - -int FileMOV::set_audio_position(int64_t x) -{ - if(!fd) return 1; -// quicktime sets positions for each track seperately so store position in audio_position - if(x >= 0 && x < asset->audio_length) - return quicktime_set_audio_position(fd, x, 0); - else - return 1; -} - -int FileMOV::set_video_position(int64_t x) -{ - if(!fd) return 1; - if(x >= 0 && x < asset->video_length) - { - int result = quicktime_set_video_position(fd, x, file->current_layer); - return result; - }else - return 1; -} - - -void FileMOV::new_audio_temp(int64_t len) -{ - if(temp_allocated && temp_allocated < len) - { - for(int i = 0; i < asset->channels; i++) - delete [] temp_float[i]; - delete [] temp_float; - temp_allocated = 0; - } - - if(!temp_allocated) - { - temp_allocated = len; - temp_float = new float*[asset->channels]; - for(int i = 0; i < asset->channels; i++) - temp_float[i] = new float[len]; - } -} - - - -int FileMOV::write_samples(double **buffer, int64_t len) -{ - int i, j; - int result = 0; - int chunk_size; - - if(!fd) return 0; - - if(quicktime_supported_audio(fd, 0)) - { -// Use Quicktime's compressor. (Always used) -// Allocate temp buffer - new_audio_temp(len); - -// Copy to float buffer - for(i = 0; i < asset->channels; i++) - { - for(j = 0; j < len; j++) - { - temp_float[i][j] = buffer[i][j]; - } - } - -// Because of the way Quicktime's compressors work we want to limit the chunk -// size to speed up decompression. - float **channel_ptr; - channel_ptr = new float*[asset->channels]; - - for(j = 0; j < len && !result; ) - { - chunk_size = asset->sample_rate; - if(j + chunk_size > len) chunk_size = len - j; - - for(i = 0; i < asset->channels; i++) - { - channel_ptr[i] = &temp_float[i][j]; - } - - result = quicktime_encode_audio(fd, 0, channel_ptr, chunk_size); - j += asset->sample_rate; - } - - delete [] channel_ptr; - } - return result; -} - -int FileMOV::write_frames(VFrame ***frames, int len) -{ - int i, j, result = 0; - int default_compressor = 1; - const int debug = 0; -if(debug) printf("FileMOV::write_frames %d\n", __LINE__); - if(!fd) return 0; -if(debug) printf("FileMOV::write_frames %d layers=%d\n", __LINE__, asset->layers); - - for(i = 0; i < asset->layers && !result; i++) - { - - -if(debug) printf("FileMOV::write_frames %d colormodel=%d size=" _LD "\n", - __LINE__, frames[i][0]->get_color_model(), frames[i][0]->get_compressed_size()); - - - -// Fix direct copy cases for format conversions. - if(frames[i][0]->get_color_model() == BC_COMPRESSED) - { -if(debug) printf("FileMOV::write_frames %d len=%d\n", __LINE__, len); - default_compressor = 0; - for(j = 0; j < len && !result; j++) - { - VFrame *frame = frames[i][j]; - - -if(debug) printf("FileMOV::write_frames %d %d colormodel=%d size=%d %02x %02x %02x %02x %02x %02x %02x %02x\n", -__LINE__, -frame->get_shmid(), -(int)frame->get_color_model(), -(int)frame->get_compressed_size(), -frames[i][j]->get_data()[0], -frames[i][j]->get_data()[1], -frames[i][j]->get_data()[2], -frames[i][j]->get_data()[3], -frames[i][j]->get_data()[4], -frames[i][j]->get_data()[5], -frames[i][j]->get_data()[6], -frames[i][j]->get_data()[7]); - -// Special handling for DIVX -// Determine keyframe status. -// Write VOL header in the first frame if none exists - if(!strcmp(asset->vcodec, QUICKTIME_DIVX) || - !strcmp(asset->vcodec, QUICKTIME_H263) || - !strcmp(asset->vcodec, QUICKTIME_HV60)) - { - if(quicktime_mpeg4_is_key(frame->get_data(), - frame->get_compressed_size(), - asset->vcodec)) - quicktime_insert_keyframe(fd, file->current_frame + j, i); - - -// Write header - if(!(file->current_frame + j) && - !quicktime_mpeg4_has_vol(frame->get_data())) - { - VFrame *temp_frame = new VFrame; - - temp_frame->allocate_compressed_data(frame->get_compressed_size() + - 0xff); - int bytes = quicktime_mpeg4_write_vol(temp_frame->get_data(), - asset->width, - asset->height, - 60000, - asset->frame_rate); - memcpy(temp_frame->get_data() + bytes, - frame->get_data(), - frame->get_compressed_size()); - temp_frame->set_compressed_size(frame->get_compressed_size() + bytes); - - result = quicktime_write_frame(fd, - temp_frame->get_data(), - temp_frame->get_compressed_size(), - i); - - delete temp_frame; - - - } - else - { - result = quicktime_write_frame(fd, - frame->get_data(), - frame->get_compressed_size(), - i); - } - } - else -// Determine keyframe status - if(!strcmp(asset->vcodec, QUICKTIME_H264) || - !strcmp(asset->vcodec, QUICKTIME_HV64) || - !strcmp(asset->vcodec, QUICKTIME_MP4V)) - { - if(frame->get_keyframe() || file->current_frame + j == 0) - quicktime_insert_keyframe(fd, file->current_frame + j, i); - -// Write frame -if(debug) printf("FileMOV::write_frames %d result=%d data=%p size=%ld\n", -__LINE__, -result, -frame->get_data(), -frame->get_compressed_size()); - result = quicktime_write_frame(fd, - frame->get_data(), - frame->get_compressed_size(), - i); - -if(debug) printf("FileMOV::write_frames %d result=%d\n", __LINE__, result); - } - else - if(!strcmp(asset->vcodec, QUICKTIME_DIV3)) - { - if(quicktime_mpeg4_is_key(frame->get_data(), - frame->get_compressed_size(), - asset->vcodec)) - quicktime_insert_keyframe(fd, file->current_frame + j, i); - result = quicktime_write_frame(fd, - frame->get_data(), - frame->get_compressed_size(), - i); - } - else - if(!strcmp(asset->vcodec, QUICKTIME_MJPA)) - { - long field2_offset; - -// Create extra space for markers - if(frame->get_compressed_allocated() - frame->get_compressed_size() < 0x100) - frame->allocate_compressed_data(frame->get_compressed_size() + 0x100); - - unsigned char *data = frame->get_data(); - long data_size = frame->get_compressed_size(); - long data_allocated = frame->get_compressed_allocated(); - -// Sometimes get 0 length frames - if(data_size) - { - if(asset->format == FILE_MOV) - { - mjpeg_insert_quicktime_markers(&data, - &data_size, - &data_allocated, - 2, - &field2_offset); - } - else - { - mjpeg_insert_avi_markers(&data, - &data_size, - &data_allocated, - 2, - &field2_offset); - } - frame->set_compressed_size(data_size); - result = quicktime_write_frame(fd, - frame->get_data(), - frame->get_compressed_size(), - i); - } - else - printf("FileMOV::write_frames data_size=%ld\n", data_size); - } - else - result = quicktime_write_frame(fd, - frame->get_data(), - frame->get_compressed_size(), - i); - } -if(debug) printf("FileMOV::write_frames %d result=%d\n", __LINE__, result); - } - else - if(match4(asset->vcodec, QUICKTIME_YUV420) || - match4(asset->vcodec, QUICKTIME_2VUY) || - match4(asset->vcodec, QUICKTIME_YUV422) || - match4(asset->vcodec, QUICKTIME_RAW)) - { -// Direct copy planes where possible - default_compressor = 0; - for(j = 0; j < len && !result; j++) - { - VFrame *frame = frames[i][j]; -//printf("FileMOV::write_frames 1 %d\n", frame->get_color_model()); - quicktime_set_cmodel(fd, frame->get_color_model()); - if(cmodel_is_planar(frame->get_color_model())) - { - unsigned char *planes[3]; - planes[0] = frame->get_y(); - planes[1] = frame->get_u(); - planes[2] = frame->get_v(); - result = quicktime_encode_video(fd, planes, i); - } - else - { - result = quicktime_encode_video(fd, frame->get_rows(), i); -//printf("FileMOV::write_frames 2 %d\n", result); - } -//printf("FileMOV::write_frames 2\n"); - } - } - else - if(file->cpus > 1 && - (match4(asset->vcodec, QUICKTIME_JPEG) || - match4(asset->vcodec, QUICKTIME_MJPA))) - { - default_compressor = 0; -// Compress symmetrically on an SMP system. - ThreadStruct *threadframe; - int fields = match4(asset->vcodec, QUICKTIME_MJPA) ? 2 : 1; - -// Set up threads for symmetric compression. - if(!threads) - { - threads = new FileMOVThread*[file->cpus]; - for(j = 0; j < file->cpus; j++) - { - threads[j] = new FileMOVThread(this, fields); - threads[j]->start_encoding(); - } - } - -// Set up the frame structures for asynchronous compression. -// The mjpeg object must exist in each threadframe because it is where the output -// is stored. - while(threadframes.total < len) - { - threadframes.append(threadframe = new ThreadStruct); - } - -// Load thread frame structures with new frames. - for(j = 0; j < len; j++) - { - VFrame *frame = frames[i][j]; - threadframes.values[j]->input = frame; - threadframes.values[j]->completion_lock->lock("FileMOV::write_frames 1"); - } - total_threadframes = len; - current_threadframe = 0; - -// Start the threads compressing - for(j = 0; j < file->cpus; j++) - { - threads[j]->encode_buffer(); - } - - -// Write the frames as they're finished - for(j = 0; j < len; j++) - { - threadframes.values[j]->completion_lock->lock("FileMOV::write_frames 1"); - threadframes.values[j]->completion_lock->unlock(); - if(!result) - { - result = quicktime_write_frame(fd, - threadframes.values[j]->output, - threadframes.values[j]->output_size, - i); - } - } - } - - if(default_compressor) - { -//printf("FileMOV::write_frames 3\n"); -// Use the library's built in compressor. - for(j = 0; j < len && !result; j++) - { -//printf("FileMOV::write_frames 4\n"); - VFrame *frame = frames[i][j]; - quicktime_set_cmodel(fd, frame->get_color_model()); -//printf("FileMOV::write_frames 5\n"); - if(cmodel_is_planar(frame->get_color_model())) - { - unsigned char *planes[3]; - planes[0] = frame->get_y(); - planes[1] = frame->get_u(); - planes[2] = frame->get_v(); - result = quicktime_encode_video(fd, planes, i); - } - else - { -if(debug) printf("FileMOV::write_frames 1\n"); - result = quicktime_encode_video(fd, frame->get_rows(), i); -if(debug) printf("FileMOV::write_frames 10\n"); - } - } - } -//printf("FileMOV::write_frames 4\n"); - } - - - return result; -} - - - -int FileMOV::read_frame(VFrame *frame) -{ - if(!fd) return 1; - int result = 0; - const int debug = 0; - -if(debug) printf("FileMOV::read_frame %d frame=" _LD " color_model=%d\n", - __LINE__, file->current_frame, frame->get_color_model()); - switch(frame->get_color_model()) - { - case BC_COMPRESSED: - frame->allocate_compressed_data(quicktime_frame_size(fd, file->current_frame, file->current_layer)); - frame->set_compressed_size(quicktime_frame_size(fd, file->current_frame, file->current_layer)); - frame->set_keyframe((quicktime_get_keyframe_before(fd, - file->current_frame, - file->current_layer) == file->current_frame)); -// printf("FileMOV::read_frame 1 " _LD " %d %p %d\n", -// file->current_frame, -// frame->get_keyframe(), -// frame->get_data(), -// frame->get_compressed_size()); - result = quicktime_read_frame(fd, - frame->get_data(), - file->current_layer); - break; - -// Progressive - case BC_YUV420P: - case BC_YUV422P: - { - unsigned char *row_pointers[3]; - row_pointers[0] = frame->get_y(); - row_pointers[1] = frame->get_u(); - row_pointers[2] = frame->get_v(); - - quicktime_set_cmodel(fd, frame->get_color_model()); - result = quicktime_decode_video(fd, - row_pointers, - file->current_layer); - } - break; - -// Packed - default: - quicktime_set_cmodel(fd, frame->get_color_model()); - result = quicktime_decode_video(fd, - frame->get_rows(), - file->current_layer); - break; - } - - -if(debug) printf("FileMOV::read_frame %d\n", __LINE__); - if (result) - printf("quicktime_read_frame/quicktime_decode_video failed, result:\n"); - - return result; -} - - - -int64_t FileMOV::compressed_frame_size() -{ - if(!fd) return 0; - return quicktime_frame_size(fd, file->current_frame, file->current_layer); -} - -int FileMOV::read_compressed_frame(VFrame *buffer) -{ - int64_t result; - if(!fd) return 0; - - result = quicktime_read_frame(fd, buffer->get_data(), file->current_layer); - buffer->set_compressed_size(result); - buffer->set_keyframe((quicktime_get_keyframe_before(fd, - file->current_frame, - file->current_layer) == file->current_frame)); - result = !result; - return result; -} - -int FileMOV::write_compressed_frame(VFrame *buffer) -{ - int result = 0; - if(!fd) return 0; - - result = quicktime_write_frame(fd, - buffer->get_data(), - buffer->get_compressed_size(), - file->current_layer); - return result; -} - - - -int FileMOV::read_raw(VFrame *frame, - float in_x1, float in_y1, float in_x2, float in_y2, - float out_x1, float out_y1, float out_x2, float out_y2, - int use_float, int interpolate) -{ - int64_t result = 1; - if(!fd) return 1; - - quicktime_set_video_position(fd, file->current_frame, file->current_layer); -// Develop importing strategy - switch(frame->get_color_model()) - { - case BC_RGB888: - result = quicktime_decode_video(fd, frame->get_rows(), file->current_layer); - break; - case BC_RGBA8888: - case BC_RGB161616: - case BC_RGBA16161616: - case BC_YUV888: - case BC_YUVA8888: - case BC_YUV161616: - case BC_YUVA16161616: - case BC_YUV420P: - eprintf("FileMOV::read_raw: unknown colormodel\n"); - break; - } - return result; -} - -// Overlay samples -int FileMOV::read_samples(double *buffer, int64_t len) -{ - if(!fd) return 1; - - if(quicktime_track_channels(fd, 0) > file->current_channel && - quicktime_supported_audio(fd, 0)) - { - -//printf("FileMOV::read_samples 2 " _LD " " _LD "\n", file->current_sample, quicktime_audio_position(fd, 0)); - new_audio_temp(len); - -//printf("FileMOV::read_samples 3 " _LD " " _LD "\n", file->current_sample, quicktime_audio_position(fd, 0)); - if(quicktime_decode_audio(fd, 0, temp_float[0], len, file->current_channel)) - { - printf(_("quicktime_decode_audio failed\n")); - return 1; - } - else - { - for(int i = 0; i < len; i++) buffer[i] = temp_float[0][i]; - } - -// if(file->current_channel == 0) -// for(int i = 0; i < len; i++) -// { -// int16_t value; -// value = (int16_t)(temp_float[0][i] * 32767); -// fwrite(&value, 2, 1, stdout); -// } -//printf("FileMOV::read_samples 4 " _LD " " _LD "\n", file->current_sample, quicktime_audio_position(fd, 0)); - } - - return 0; -} - - -const char* FileMOV::strtocompression(const char *string) -{ - if(!strcasecmp(string, _(DIVX_NAME))) return QUICKTIME_DIVX; - if(!strcasecmp(string, _(H264_NAME))) return QUICKTIME_H264; - if(!strcasecmp(string, _(HV64_NAME))) return QUICKTIME_HV64; - if(!strcasecmp(string, _(MP4V_NAME))) return QUICKTIME_MP4V; - if(!strcasecmp(string, _(H263_NAME))) return QUICKTIME_H263; - if(!strcasecmp(string, _(HV60_NAME))) return QUICKTIME_HV60; - if(!strcasecmp(string, _(DIV3_NAME))) return QUICKTIME_DIV3; -// Students say QUICKTIME_DV is required for compression even though -// QUICKTIME_DVSD is produced by other software -// if(!strcasecmp(string, _(DV_NAME))) return QUICKTIME_DVSD; - if(!strcasecmp(string, _(DV_NAME))) return QUICKTIME_DV; - if(!strcasecmp(string, _(PNG_NAME))) return QUICKTIME_PNG; - if(!strcasecmp(string, _(PNGA_NAME))) return MOV_PNGA; - if(!strcasecmp(string, _(RGB_NAME))) return QUICKTIME_RAW; - if(!strcasecmp(string, _(RGBA_NAME))) return MOV_RGBA; - if(!strcasecmp(string, _(QTJPEG_NAME))) return QUICKTIME_JPEG; - if(!strcasecmp(string, _(QTMJPEGP_NAME))) return QUICKTIME_MJPG; - if(!strcasecmp(string, _(MJPA_NAME))) return QUICKTIME_MJPA; - if(!strcasecmp(string, _(YUV420_NAME))) return QUICKTIME_YUV420; - if(!strcasecmp(string, _(YUV411_NAME))) return QUICKTIME_YUV411; - if(!strcasecmp(string, _(YUV422_NAME))) return QUICKTIME_YUV422; - if(!strcasecmp(string, _(TWOVUY_NAME))) return QUICKTIME_2VUY; - if(!strcasecmp(string, _(YUV444_NAME))) return QUICKTIME_YUV444; - if(!strcasecmp(string, _(YUVA4444_NAME))) return QUICKTIME_YUVA4444; - if(!strcasecmp(string, _(YUV444_10BIT_NAME))) return QUICKTIME_YUV444_10bit; - - if(!strcasecmp(string, _(TWOS_NAME))) return QUICKTIME_TWOS; - if(!strcasecmp(string, _(RAW_NAME))) return QUICKTIME_RAW; - if(!strcasecmp(string, _(IMA4_NAME))) return QUICKTIME_IMA4; - if(!strcasecmp(string, _(ULAW_NAME))) return QUICKTIME_ULAW; - if(!strcasecmp(string, _(MP3_NAME))) return QUICKTIME_MP3; - if(!strcasecmp(string, _(MP4A_NAME))) return QUICKTIME_MP4A; - if(!strcasecmp(string, _(VORBIS_NAME))) return QUICKTIME_VORBIS; - - - - return QUICKTIME_RAW; -} - -const char* FileMOV::compressiontostr(const char *string) -{ - if(match4(string, QUICKTIME_H263)) return _(H263_NAME); - if(match4(string, QUICKTIME_H264)) return _(H264_NAME); - if(match4(string, QUICKTIME_HV64)) return _(HV64_NAME); - if(match4(string, QUICKTIME_DIVX)) return _(DIVX_NAME); - if(match4(string, QUICKTIME_MP4V)) return _(MP4V_NAME); - if(match4(string, QUICKTIME_HV60)) return _(HV60_NAME); - if(match4(string, QUICKTIME_DIV3)) return _(DIV3_NAME); - if(match4(string, QUICKTIME_DV)) return _(DV_NAME); - if(match4(string, QUICKTIME_DVCP)) return _(DV_NAME); - if(match4(string, QUICKTIME_DVSD)) return _(DV_NAME); - if(match4(string, MOV_PNGA)) return _(PNGA_NAME); - if(match4(string, QUICKTIME_RAW)) return _(RGB_NAME); - if(match4(string, MOV_RGBA)) return _(RGBA_NAME); - if(match4(string, QUICKTIME_JPEG)) return _(QTJPEG_NAME); - if(match4(string, QUICKTIME_MJPG)) return _(QTMJPEGP_NAME); - if(match4(string, QUICKTIME_MJPA)) return _(MJPA_NAME); - if(match4(string, QUICKTIME_YUV420)) return _(YUV420_NAME); - if(match4(string, QUICKTIME_YUV411)) return _(YUV411_NAME); - if(match4(string, QUICKTIME_YUV422)) return _(YUV422_NAME); - if(match4(string, QUICKTIME_2VUY)) return _(TWOVUY_NAME); - if(match4(string, QUICKTIME_YUV444)) return _(YUV444_NAME); - if(match4(string, QUICKTIME_YUVA4444)) return _(YUVA4444_NAME); - if(match4(string, QUICKTIME_YUV444_10bit)) return _(YUV444_10BIT_NAME); - - - - - - if(match4(string, QUICKTIME_TWOS)) return _(TWOS_NAME); - if(match4(string, QUICKTIME_RAW)) return _(RAW_NAME); - if(match4(string, QUICKTIME_IMA4)) return _(IMA4_NAME); - if(match4(string, QUICKTIME_ULAW)) return _(ULAW_NAME); - if(match4(string, QUICKTIME_MP3)) return _(MP3_NAME); - if(match4(string, QUICKTIME_MP4A)) return _(MP4A_NAME); - if(match4(string, QUICKTIME_VORBIS)) return _(VORBIS_NAME); - - - - return _("Unknown"); -} - - - - - -ThreadStruct::ThreadStruct() -{ - input = 0; - output = 0; - output_allocated = 0; - output_size = 0; - completion_lock = new Condition(1, "ThreadStruct::completion_lock"); -} - -ThreadStruct::~ThreadStruct() -{ - if(output) delete [] output; - delete completion_lock; -} - -void ThreadStruct::load_output(mjpeg_t *mjpeg) -{ - if(output_allocated < mjpeg_output_size(mjpeg)) - { - delete [] output; - output = 0; - } - if(!output) - { - output_allocated = mjpeg_output_size(mjpeg); - output = new unsigned char[output_allocated]; - } - - output_size = mjpeg_output_size(mjpeg); - memcpy(output, mjpeg_output_buffer(mjpeg), output_size); -} - - -FileMOVThread::FileMOVThread(FileMOV *filemov, int fields) - : Thread(1, 0, 0) -{ - this->filemov = filemov; - this->fields = fields; - mjpeg = 0; - input_lock = new Condition(1, "FileMOVThread::input_lock"); -} - -FileMOVThread::~FileMOVThread() -{ - delete input_lock; -} - -int FileMOVThread::start_encoding() -{ - mjpeg = mjpeg_new(filemov->asset->width, - filemov->asset->height, - fields); - mjpeg_set_quality(mjpeg, filemov->asset->jpeg_quality); - mjpeg_set_float(mjpeg, 0); - done = 0; - set_synchronous(1); - input_lock->lock("FileMOVThread::start_encoding"); - start(); - return 0; -} - -int FileMOVThread::stop_encoding() -{ - done = 1; - input_lock->unlock(); - join(); - if(mjpeg) mjpeg_delete(mjpeg); - return 0; -} - -int FileMOVThread::encode_buffer() -{ - input_lock->unlock(); - return 0; -} - -void FileMOVThread::run() -{ - while(!done) - { - input_lock->lock("FileMOVThread::run"); - - if(!done) - { -// Get a frame to compress. - filemov->threadframe_lock->lock("FileMOVThread::stop_encoding"); - if(filemov->current_threadframe < filemov->total_threadframes) - { -// Frame is available to process. - input_lock->unlock(); - threadframe = filemov->threadframes.values[filemov->current_threadframe]; - VFrame *frame = threadframe->input; - - filemov->current_threadframe++; - filemov->threadframe_lock->unlock(); - - mjpeg_compress(mjpeg, - frame->get_rows(), - frame->get_y(), - frame->get_u(), - frame->get_v(), - frame->get_color_model(), - 1); - - if(fields > 1) - { - unsigned char *data = mjpeg_output_buffer(mjpeg); - long data_size = mjpeg_output_size(mjpeg); - long data_allocated = mjpeg_output_allocated(mjpeg); - long field2_offset; - - if(filemov->asset->format == FILE_MOV) - { - mjpeg_insert_quicktime_markers(&data, - &data_size, - &data_allocated, - 2, - &field2_offset); - } - else - { - mjpeg_insert_avi_markers(&data, - &data_size, - &data_allocated, - 2, - &field2_offset); - } - mjpeg_set_output_size(mjpeg, data_size); - } - threadframe->load_output(mjpeg); - threadframe->completion_lock->unlock(); - } - else - filemov->threadframe_lock->unlock(); - } - } -} - - - - - - -MOVConfigAudio::MOVConfigAudio(BC_WindowBase *parent_window, Asset *asset) - : BC_Window(_(PROGRAM_NAME ": Audio Compression"), - parent_window->get_abs_cursor_x(1), - parent_window->get_abs_cursor_y(1), - 350, - 250) -{ - this->parent_window = parent_window; - this->asset = asset; - compression_popup = 0; - reset(); -} - -MOVConfigAudio::~MOVConfigAudio() -{ - lock_window("MOVConfigAudio::~MOVConfigAudio"); - if(compression_popup) delete compression_popup; - if(bits_popup) delete bits_popup; - compression_items.remove_all_objects(); - unlock_window(); -} - - -void MOVConfigAudio::reset() -{ - bits_popup = 0; - bits_title = 0; - dither = 0; - vorbis_min_bitrate = 0; - vorbis_bitrate = 0; - vorbis_max_bitrate = 0; - vorbis_vbr = 0; - mp3_bitrate = 0; - mp4a_bitrate = 0; - mp4a_quantqual = 0; -} - -void MOVConfigAudio::create_objects() -{ - int x = 10, y = 10; - lock_window("MOVConfigAudio::create_objects"); - - if(asset->format == FILE_MOV) - { - compression_items.append(new BC_ListBoxItem(_(TWOS_NAME))); - compression_items.append(new BC_ListBoxItem(_(RAW_NAME))); - compression_items.append(new BC_ListBoxItem(_(IMA4_NAME))); - compression_items.append(new BC_ListBoxItem(_(MP3_NAME))); - compression_items.append(new BC_ListBoxItem(_(ULAW_NAME))); - compression_items.append(new BC_ListBoxItem(_(VORBIS_NAME))); - compression_items.append(new BC_ListBoxItem(_(MP4A_NAME))); - } - else - { - compression_items.append(new BC_ListBoxItem(_(TWOS_NAME))); - compression_items.append(new BC_ListBoxItem(_(MP3_NAME))); - compression_items.append(new BC_ListBoxItem(_(VORBIS_NAME))); - compression_items.append(new BC_ListBoxItem(_(MP4A_NAME))); - } - - add_tool(new BC_Title(x, y, _("Compression:"))); - y += 25; - compression_popup = new MOVConfigAudioPopup(this, x, y); - compression_popup->create_objects(); - - update_parameters(); - - add_subwindow(new BC_OKButton(this)); - show_window(1); - unlock_window(); -} - -void MOVConfigAudio::update_parameters() -{ - int x = 10, y = 70; - if(bits_title) delete bits_title; - if(bits_popup) delete bits_popup; - if(dither) delete dither; - if(vorbis_min_bitrate) delete vorbis_min_bitrate; - if(vorbis_bitrate) delete vorbis_bitrate; - if(vorbis_max_bitrate) delete vorbis_max_bitrate; - if(vorbis_vbr) delete vorbis_vbr; - if(mp3_bitrate) delete mp3_bitrate; - delete mp4a_bitrate; - delete mp4a_quantqual; - - reset(); - - - - if(!strcasecmp(asset->acodec, QUICKTIME_TWOS) || - !strcasecmp(asset->acodec, QUICKTIME_RAW)) - { - add_subwindow(bits_title = new BC_Title(x, y, _("Bits per channel:"))); - bits_popup = new BitsPopup(this, - x + 150, - y, - &asset->bits, - 0, - 0, - 0, - 0, - 0); - bits_popup->create_objects(); - y += 40; - add_subwindow(dither = new BC_CheckBox(x, y, &asset->dither, _("Dither"))); - } - else - if(!strcasecmp(asset->acodec, QUICKTIME_IMA4)) - { - } - else - if(!strcasecmp(asset->acodec, QUICKTIME_MP3)) - { - mp3_bitrate = new MOVConfigAudioNum(this, - _("Bitrate:"), - x, - y, - &asset->mp3_bitrate); - mp3_bitrate->set_increment(64000); - mp3_bitrate->create_objects(); - } - else - if(!strcasecmp(asset->acodec, QUICKTIME_ULAW)) - { - } - else - if(!strcasecmp(asset->acodec, QUICKTIME_VORBIS)) - { - add_subwindow(vorbis_vbr = new MOVConfigAudioToggle(this, - _("Variable bitrate"), - x, - y, - &asset->vorbis_vbr)); - y += 35; - vorbis_min_bitrate = new MOVConfigAudioNum(this, - _("Min bitrate:"), - x, - y, - &asset->vorbis_min_bitrate); - vorbis_min_bitrate->set_increment(1000); - y += 30; - vorbis_bitrate = new MOVConfigAudioNum(this, - _("Avg bitrate:"), - x, - y, - &asset->vorbis_bitrate); - vorbis_bitrate->set_increment(1000); - y += 30; - vorbis_max_bitrate = new MOVConfigAudioNum(this, - _("Max bitrate:"), - x, - y, - &asset->vorbis_max_bitrate); - vorbis_max_bitrate->set_increment(1000); - - - - vorbis_min_bitrate->create_objects(); - vorbis_bitrate->create_objects(); - vorbis_max_bitrate->create_objects(); - } - else - if(!strcasecmp(asset->acodec, QUICKTIME_MP4A)) - { - mp4a_bitrate = new MOVConfigAudioNum(this, - _("Bitrate:"), - x, - y, - &asset->mp4a_bitrate); - mp4a_bitrate->set_increment(64000); - mp4a_bitrate->create_objects(); - - y += 30; - mp4a_quantqual = new MOVConfigAudioNum(this, - _("Quantization Quality (%):"), - x, - y, - &asset->mp4a_quantqual); - mp4a_quantqual->set_increment(1); - mp4a_quantqual->create_objects(); - } - show_window(1); -} - -int MOVConfigAudio::close_event() -{ - set_done(0); - return 1; -} - - - - - -MOVConfigAudioToggle::MOVConfigAudioToggle(MOVConfigAudio *popup, - char *title_text, - int x, - int y, - int *output) - : BC_CheckBox(x, y, *output, title_text) -{ - this->popup = popup; - this->output = output; -} -int MOVConfigAudioToggle::handle_event() -{ - *output = get_value(); - return 1; -} - - - - - -MOVConfigAudioNum::MOVConfigAudioNum(MOVConfigAudio *popup, char *title_text, int x, int y, int *output) - : BC_TumbleTextBox(popup, - (int64_t)*output, - (int64_t)-1, - (int64_t)25000000, - popup->get_w() - 150, - y, - 100) -{ - this->popup = popup; - this->title_text = title_text; - this->output = output; - this->x = x; - this->y = y; -} - -MOVConfigAudioNum::~MOVConfigAudioNum() -{ - if(!popup->get_deleting()) delete title; -} - -void MOVConfigAudioNum::create_objects() -{ - popup->add_subwindow(title = new BC_Title(x, y, title_text)); - BC_TumbleTextBox::create_objects(); -} - -int MOVConfigAudioNum::handle_event() -{ - *output = atol(get_text()); - return 1; -} - - - - - - - - -MOVConfigAudioPopup::MOVConfigAudioPopup(MOVConfigAudio *popup, int x, int y) - : BC_PopupTextBox(popup, - &popup->compression_items, - FileMOV::compressiontostr(popup->asset->acodec), - x, - y, - 300, - 300) -{ - this->popup = popup; -} - -int MOVConfigAudioPopup::handle_event() -{ - strcpy(popup->asset->acodec, FileMOV::strtocompression(get_text())); - popup->update_parameters(); - return 1; -} - - - - - - - - - - - - - - - - - -MOVConfigVideo::MOVConfigVideo(BC_WindowBase *parent_window, - Asset *asset, - const char *locked_compressor) - : BC_Window(_(PROGRAM_NAME ": Video Compression"), - parent_window->get_abs_cursor_x(1), - parent_window->get_abs_cursor_y(1), - 420, - 420) -{ - this->parent_window = parent_window; - this->asset = asset; - this->locked_compressor = locked_compressor; - compression_popup = 0; - - reset(); -} - -MOVConfigVideo::~MOVConfigVideo() -{ - lock_window("MOVConfigVideo::~MOVConfigVideo"); - if(compression_popup) delete compression_popup; - compression_items.remove_all_objects(); - unlock_window(); -} - -void MOVConfigVideo::create_objects() -{ - int x = 10, y = 10; - lock_window("MOVConfigVideo::create_objects"); - - if(asset->format == FILE_MOV) - { - compression_items.append(new BC_ListBoxItem(_(H264_NAME))); - compression_items.append(new BC_ListBoxItem(_(HV64_NAME))); -// compression_items.append(new BC_ListBoxItem(_(DIVX_NAME))); - compression_items.append(new BC_ListBoxItem(_(MP4V_NAME))); - compression_items.append(new BC_ListBoxItem(_(HV60_NAME))); - compression_items.append(new BC_ListBoxItem(_(DIV3_NAME))); - compression_items.append(new BC_ListBoxItem(_(DV_NAME))); - compression_items.append(new BC_ListBoxItem(_(QTJPEG_NAME))); - compression_items.append(new BC_ListBoxItem(_(QTMJPEGP_NAME))); - compression_items.append(new BC_ListBoxItem(_(MJPA_NAME))); - compression_items.append(new BC_ListBoxItem(_(PNG_NAME))); - compression_items.append(new BC_ListBoxItem(_(PNGA_NAME))); - compression_items.append(new BC_ListBoxItem(_(RGB_NAME))); - compression_items.append(new BC_ListBoxItem(_(RGBA_NAME))); - compression_items.append(new BC_ListBoxItem(_(YUV420_NAME))); - compression_items.append(new BC_ListBoxItem(_(YUV422_NAME))); - compression_items.append(new BC_ListBoxItem(_(TWOVUY_NAME))); - compression_items.append(new BC_ListBoxItem(_(YUV444_NAME))); - compression_items.append(new BC_ListBoxItem(_(YUVA4444_NAME))); - compression_items.append(new BC_ListBoxItem(_(YUV444_10BIT_NAME))); - } - else - { - compression_items.append(new BC_ListBoxItem(_(H264_NAME))); - compression_items.append(new BC_ListBoxItem(_(HV64_NAME))); -// compression_items.append(new BC_ListBoxItem(_(DIVX_NAME))); - compression_items.append(new BC_ListBoxItem(_(MP4V_NAME))); - compression_items.append(new BC_ListBoxItem(_(HV60_NAME))); - compression_items.append(new BC_ListBoxItem(_(DIV3_NAME))); - compression_items.append(new BC_ListBoxItem(_(DV_NAME))); - compression_items.append(new BC_ListBoxItem(_(QTJPEG_NAME))); - compression_items.append(new BC_ListBoxItem(_(MJPA_NAME))); - compression_items.append(new BC_ListBoxItem(_(PNG_NAME))); - } - - add_subwindow(new BC_Title(x, y, _("Compression:"))); - y += 25; - - if(!locked_compressor) - { - compression_popup = new MOVConfigVideoPopup(this, x, y); - compression_popup->create_objects(); - } - else - { - add_subwindow(new BC_Title(x, - y, - FileMOV::compressiontostr(locked_compressor), - MEDIUMFONT, - RED, - 0)); - } - y += 40; - - param_x = x; - param_y = y; - update_parameters(); - - add_subwindow(new BC_OKButton(this)); - show_window(1); - unlock_window(); -} - -int MOVConfigVideo::close_event() -{ - set_done(0); - return 1; -} - - -void MOVConfigVideo::reset() -{ - jpeg_quality = 0; - jpeg_quality_title = 0; - - divx_bitrate = 0; - divx_rc_period = 0; - divx_rc_reaction_ratio = 0; - divx_rc_reaction_period = 0; - divx_max_key_interval = 0; - divx_max_quantizer = 0; - divx_min_quantizer = 0; - divx_quantizer = 0; - divx_quality = 0; - divx_fix_bitrate = 0; - divx_fix_quant = 0; - - h264_bitrate = 0; - h264_quantizer = 0; - h264_fix_bitrate = 0; - h264_fix_quant = 0; - - ms_bitrate = 0; - ms_bitrate_tolerance = 0; - ms_quantization = 0; - ms_interlaced = 0; - ms_gop_size = 0; - ms_fix_bitrate = 0; - ms_fix_quant = 0; -} - -void MOVConfigVideo::update_parameters() -{ - if(jpeg_quality) - { - delete jpeg_quality_title; - delete jpeg_quality; - } - - if(divx_bitrate) delete divx_bitrate; - if(divx_rc_period) delete divx_rc_period; - if(divx_rc_reaction_ratio) delete divx_rc_reaction_ratio; - if(divx_rc_reaction_period) delete divx_rc_reaction_period; - if(divx_max_key_interval) delete divx_max_key_interval; - if(divx_max_quantizer) delete divx_max_quantizer; - if(divx_min_quantizer) delete divx_min_quantizer; - if(divx_quantizer) delete divx_quantizer; - if(divx_quality) delete divx_quality; - if(divx_fix_quant) delete divx_fix_quant; - if(divx_fix_bitrate) delete divx_fix_bitrate; - - if(ms_bitrate) delete ms_bitrate; - if(ms_bitrate_tolerance) delete ms_bitrate_tolerance; - if(ms_interlaced) delete ms_interlaced; - if(ms_quantization) delete ms_quantization; - if(ms_gop_size) delete ms_gop_size; - if(ms_fix_bitrate) delete ms_fix_bitrate; - if(ms_fix_quant) delete ms_fix_quant; - - delete h264_bitrate; - delete h264_quantizer; - delete h264_fix_bitrate; - delete h264_fix_quant; - - reset(); - - - const char *vcodec = asset->vcodec; - if(locked_compressor) vcodec = locked_compressor; - - -// H264 parameters - if(!strcmp(vcodec, QUICKTIME_H264) || - !strcmp(vcodec, QUICKTIME_HV64)) - { - int x = param_x, y = param_y; - h264_bitrate = new MOVConfigVideoNum(this, - _("Bitrate:"), - x, - y, - &asset->h264_bitrate); - h264_bitrate->set_increment(1000000); - h264_bitrate->create_objects(); - add_subwindow(h264_fix_bitrate = new MOVConfigVideoFixBitrate(x + 260, - y, - &asset->h264_fix_bitrate, - 1)); - y += 30; - h264_quantizer = new MOVConfigVideoNum(this, - _("Quantization:"), - x, - y, - 0, - 51, - &asset->h264_quantizer); - h264_quantizer->create_objects(); - add_subwindow(h264_fix_quant = new MOVConfigVideoFixQuant(x + 260, - y, - &asset->h264_fix_bitrate, - 0)); - h264_fix_bitrate->opposite = h264_fix_quant; - h264_fix_quant->opposite = h264_fix_bitrate; - } - else -// ffmpeg parameters - if(!strcmp(vcodec, QUICKTIME_MP4V) || - !strcmp(vcodec, QUICKTIME_DIV3)) - { - int x = param_x, y = param_y; - ms_bitrate = new MOVConfigVideoNum(this, - _("Bitrate:"), - x, - y, - &asset->ms_bitrate); - ms_bitrate->set_increment(1000000); - ms_bitrate->create_objects(); - add_subwindow(ms_fix_bitrate = new MOVConfigVideoFixBitrate(x + 260, - y, - &asset->ms_fix_bitrate, - 1)); - y += 30; - - ms_bitrate_tolerance = new MOVConfigVideoNum(this, - _("Bitrate tolerance:"), - x, - y, - &asset->ms_bitrate_tolerance); - ms_bitrate_tolerance->create_objects(); - y += 30; - - - - ms_quantization = new MOVConfigVideoNum(this, - _("Quantization:"), - x, - y, - &asset->ms_quantization); - ms_quantization->create_objects(); - add_subwindow(ms_fix_quant = new MOVConfigVideoFixQuant(x + 260, - y, - &asset->ms_fix_bitrate, - 0)); - ms_fix_bitrate->opposite = ms_fix_quant; - ms_fix_quant->opposite = ms_fix_bitrate; - - - y += 30; - add_subwindow(ms_interlaced = new MOVConfigVideoCheckBox(_("Interlaced"), - x, - y, - &asset->ms_interlaced)); - y += 30; - ms_gop_size = new MOVConfigVideoNum(this, - _("Keyframe interval:"), - x, - y, - &asset->ms_gop_size); - ms_gop_size->create_objects(); - } - else -// OpenDivx parameters - if(!strcmp(vcodec, QUICKTIME_DIVX) || - !strcmp(vcodec, QUICKTIME_H263) || - !strcmp(vcodec, QUICKTIME_HV60)) - { - int x = param_x, y = param_y; - divx_bitrate = new MOVConfigVideoNum(this, - _("Bitrate:"), - x, - y, - &asset->divx_bitrate); - divx_bitrate->set_increment(1000000); - divx_bitrate->create_objects(); - add_subwindow(divx_fix_bitrate = - new MOVConfigVideoFixBitrate(x + 260, - y, - &asset->divx_fix_bitrate, - 1)); - y += 30; - divx_quantizer = new MOVConfigVideoNum(this, - _("Quantizer:"), - x, - y, - &asset->divx_quantizer); - divx_quantizer->create_objects(); - add_subwindow(divx_fix_quant = - new MOVConfigVideoFixQuant(x + 260, - y, - &asset->divx_fix_bitrate, - 0)); - divx_fix_quant->opposite = divx_fix_bitrate; - divx_fix_bitrate->opposite = divx_fix_quant; - y += 30; - divx_rc_period = new MOVConfigVideoNum(this, - _("RC Period:"), - x, - y, - &asset->divx_rc_period); - divx_rc_period->create_objects(); - y += 30; - divx_rc_reaction_ratio = new MOVConfigVideoNum(this, - _("Reaction Ratio:"), - x, - y, - &asset->divx_rc_reaction_ratio); - divx_rc_reaction_ratio->create_objects(); - y += 30; - divx_rc_reaction_period = new MOVConfigVideoNum(this, - _("Reaction Period:"), - x, - y, - &asset->divx_rc_reaction_period); - divx_rc_reaction_period->create_objects(); - y += 30; - divx_max_key_interval = new MOVConfigVideoNum(this, - _("Max Key Interval:"), - x, - y, - &asset->divx_max_key_interval); - divx_max_key_interval->create_objects(); - y += 30; - divx_max_quantizer = new MOVConfigVideoNum(this, - _("Max Quantizer:"), - x, - y, - &asset->divx_max_quantizer); - divx_max_quantizer->create_objects(); - y += 30; - divx_min_quantizer = new MOVConfigVideoNum(this, - _("Min Quantizer:"), - x, - y, - &asset->divx_min_quantizer); - divx_min_quantizer->create_objects(); - y += 30; - divx_quality = new MOVConfigVideoNum(this, - _("Quality:"), - x, - y, - &asset->divx_quality); - divx_quality->create_objects(); - } - else - if(!strcmp(vcodec, QUICKTIME_JPEG) || - !strcmp(vcodec, QUICKTIME_MJPA)) - { - add_subwindow(jpeg_quality_title = new BC_Title(param_x, param_y, _("Quality:"))); - add_subwindow(jpeg_quality = new BC_ISlider(param_x + 80, - param_y, - 0, - 200, - 200, - 0, - 100, - asset->jpeg_quality, - 0, - 0, - &asset->jpeg_quality)); - } - show_window(1); -} - - - - - -MOVConfigVideoNum::MOVConfigVideoNum(MOVConfigVideo *popup, char *title_text, int x, int y, int *output) - : BC_TumbleTextBox(popup, - (int64_t)*output, - (int64_t)1, - (int64_t)25000000, - x + 130, - y, - 100) -{ - this->popup = popup; - this->title_text = title_text; - this->output = output; - this->x = x; - this->y = y; -} - -MOVConfigVideoNum::MOVConfigVideoNum(MOVConfigVideo *popup, - char *title_text, - int x, - int y, - int min, - int max, - int *output) - : BC_TumbleTextBox(popup, - (int64_t)*output, - (int64_t)min, - (int64_t)max, - x + 130, - y, - 100) -{ - this->popup = popup; - this->title_text = title_text; - this->output = output; - this->x = x; - this->y = y; -} - -MOVConfigVideoNum::~MOVConfigVideoNum() -{ - if(!popup->get_deleting()) delete title; -} - -void MOVConfigVideoNum::create_objects() -{ - popup->add_subwindow(title = new BC_Title(x, y, title_text)); - BC_TumbleTextBox::create_objects(); -} - -int MOVConfigVideoNum::handle_event() -{ - *output = atol(get_text()); - return 1; -} - - - - - - - -MOVConfigVideoCheckBox::MOVConfigVideoCheckBox(char *title_text, int x, int y, int *output) - : BC_CheckBox(x, y, *output, title_text) -{ - this->output = output; -} - -int MOVConfigVideoCheckBox::handle_event() -{ - *output = get_value(); - return 1; -} - - - - - - -MOVConfigVideoFixBitrate::MOVConfigVideoFixBitrate(int x, - int y, - int *output, - int value) - : BC_Radial(x, - y, - *output == value, - _("Fix bitrate")) -{ - this->output = output; - this->value = value; -} - -int MOVConfigVideoFixBitrate::handle_event() -{ - *output = value; - opposite->update(0); - return 1; -} - - - - - - -MOVConfigVideoFixQuant::MOVConfigVideoFixQuant(int x, - int y, - int *output, - int value) - : BC_Radial(x, - y, - *output == value, - _("Fix quantization")) -{ - this->output = output; - this->value = value; -} - -int MOVConfigVideoFixQuant::handle_event() -{ - *output = value; - opposite->update(0); - return 1; -} - - - - - -MOVConfigVideoPopup::MOVConfigVideoPopup(MOVConfigVideo *popup, int x, int y) - : BC_PopupTextBox(popup, - &popup->compression_items, - FileMOV::compressiontostr(popup->asset->vcodec), - x, - y, - 300, - 300) -{ - this->popup = popup; -} - -int MOVConfigVideoPopup::handle_event() -{ - strcpy(popup->asset->vcodec, FileMOV::strtocompression(get_text())); - popup->update_parameters(); - return 1; -} - - - - - - - - - diff --git a/cinelerra-5.0/cinelerra/filemov.h b/cinelerra-5.0/cinelerra/filemov.h deleted file mode 100644 index b0e54efc..00000000 --- a/cinelerra-5.0/cinelerra/filemov.h +++ /dev/null @@ -1,369 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef FILEMOV_H -#define FILEMOV_H - -#include "bitspopup.inc" -#include "condition.inc" -#include "filebase.h" -#include "file.inc" - -#ifdef HAVE_STDLIB_H -#undef HAVE_STDLIB_H -#endif - -#include "libmjpeg.h" -#include "mutex.inc" -#include "quicktime.h" -#include "thread.h" - -class FileMOVThread; - -class ThreadStruct -{ -public: - ThreadStruct(); - ~ThreadStruct(); - - void load_output(mjpeg_t *mjpeg); - - VFrame *input; - unsigned char *output; // Output buffer - int64_t output_size; // Size of output buffer - int64_t output_allocated; // Allocation of output buffer - Condition *completion_lock; -}; - -class FileMOV : public FileBase -{ -public: - FileMOV(Asset *asset, File *file); - ~FileMOV(); - - friend class FileMOVThread; - - static void get_parameters(BC_WindowBase *parent_window, - Asset *asset, - BC_WindowBase* &format_window, - int audio_options, - int video_options, - const char *locked_compressor); - static int check_sig(Asset *asset); - - int open_file(int rd, int wr); - int close_file(); - void asset_to_format(); - void format_to_asset(); - int64_t get_video_length(); - int64_t get_audio_length(); - int set_video_position(int64_t x); - int set_audio_position(int64_t x); - int write_samples(double **buffer, - int64_t len); - int write_frames(VFrame ***frames, int len); - int64_t compressed_frame_size(); - int read_compressed_frame(VFrame *buffer); - int write_compressed_frame(VFrame *buffer); - - int read_frame(VFrame *frame); - int read_samples(double *buffer, int64_t len); - -// Direct copy routines - static int get_best_colormodel(Asset *asset, int driver); - int64_t get_memory_usage(); - int colormodel_supported(int colormodel); - int can_copy_from(Edit *edit, int64_t position); // This file can copy frames directly from the asset - static const char *strtocompression(const char *string); - static const char *compressiontostr(const char *string); - -// Fix codec to what AVI or MOV support - static void fix_codecs(Asset *asset); -// Check if resolutions match the DV codec when used - int check_codec_params(Asset *asset); - -// set programme timecode - void set_frame_start(int64_t offset); - -private: - void new_audio_temp(int64_t len); -// read raw audio data - int read_raw(char *buffer, int64_t samples, int track); -// overlay raw frame from the current layer and position - int read_raw(VFrame *frame, - float in_x1, float in_y1, float in_x2, float in_y2, - float out_x1, float out_y1, float out_x2, float out_y2, - int use_float, int interpolate); - int reset_parameters_derived(); - int quicktime_atracks; - int quicktime_vtracks; -// current positions for when the file descriptor doesn't have the right position - quicktime_t *fd; - int depth; // Depth in bits per pixel - int64_t frames_correction; // Correction after 32bit overflow - int64_t samples_correction; // Correction after 32bit overflow - -// An array of frames for threads to look up and compress on their own. - ArrayList threadframes; - - int total_threadframes; // Number of thread frames in this buffer - int current_threadframe; // Next threadframe to compress - Mutex *threadframe_lock; // Lock threadframe array. - - FileMOVThread **threads; // One thread for every CPU - char prefix_path[1024]; // Prefix for new file when 2G limit is exceeded - int suffix_number; // Number for new file - -// Temp buffers for converting from double to float - float **temp_float; - int64_t temp_allocated; -}; - - -// Encoder thread to parallelize certain compression formats, mainly JPEG. -// Only works when no alpha. - -class FileMOVThread : public Thread -{ -public: - FileMOVThread(FileMOV *filemov, int fields); - ~FileMOVThread(); - - int start_encoding(); - int stop_encoding(); - int encode_buffer(); - void run(); - - ThreadStruct *threadframe; // The frame currently being processed. - int done; - FileMOV *filemov; - Condition *input_lock; // Wait for new array of threads or completion. - mjpeg_t *mjpeg; - int fields; -}; - - -class MOVConfigAudioNum; -class MOVConfigAudioPopup; -class MOVConfigAudioToggle; - -class MOVConfigAudio : public BC_Window -{ -public: - MOVConfigAudio(BC_WindowBase *parent_window, Asset *asset); - ~MOVConfigAudio(); - - void create_objects(); - int close_event(); - void update_parameters(); - void reset(); - - MOVConfigAudioPopup *compression_popup; - ArrayList compression_items; - BC_WindowBase *parent_window; - BitsPopup *bits_popup; - BC_Title *bits_title; - BC_CheckBox *dither; - Asset *asset; - MOVConfigAudioNum *vorbis_min_bitrate; - MOVConfigAudioNum *vorbis_bitrate; - MOVConfigAudioNum *vorbis_max_bitrate; - MOVConfigAudioToggle *vorbis_vbr; - - MOVConfigAudioNum *mp3_bitrate; - MOVConfigAudioNum *mp4a_bitrate; - MOVConfigAudioNum *mp4a_quantqual; -}; - - -class MOVConfigAudioPopup : public BC_PopupTextBox -{ -public: - MOVConfigAudioPopup(MOVConfigAudio *popup, int x, int y); - int handle_event(); - MOVConfigAudio *popup; -}; - - -class MOVConfigAudioToggle : public BC_CheckBox -{ -public: - MOVConfigAudioToggle(MOVConfigAudio *popup, - char *title_text, - int x, - int y, - int *output); - int handle_event(); - int *output; - MOVConfigAudio *popup; -}; - - -class MOVConfigAudioNum : public BC_TumbleTextBox -{ -public: - MOVConfigAudioNum(MOVConfigAudio *popup, - char *title_text, - int x, - int y, - int *output); - ~MOVConfigAudioNum(); - - void create_objects(); - int handle_event(); - int *output; - MOVConfigAudio *popup; - BC_Title *title; - char *title_text; - int x, y; -}; - - -class MOVConfigVideoPopup; -class MOVConfigVideoNum; -class MOVConfigVideoFix; -class MOVConfigVideoFixBitrate; -class MOVConfigVideoFixQuant; -class MOVConfigVideoCheckBox; - - -class MOVConfigVideo : public BC_Window -{ -public: - MOVConfigVideo(BC_WindowBase *parent_window, - Asset *asset, - const char *locked_compressor); - ~MOVConfigVideo(); - - void create_objects(); - int close_event(); - void reset(); - - void update_parameters(); - - ArrayList compression_items; - MOVConfigVideoPopup *compression_popup; - BC_WindowBase *parent_window; - Asset *asset; - int param_x, param_y; - const char *locked_compressor; - - BC_ISlider *jpeg_quality; - BC_Title *jpeg_quality_title; - - MOVConfigVideoNum *ms_bitrate; - MOVConfigVideoNum *ms_bitrate_tolerance; - MOVConfigVideoNum *ms_quantization; - MOVConfigVideoNum *ms_gop_size; - MOVConfigVideoCheckBox *ms_interlaced; - MOVConfigVideoFixBitrate *ms_fix_bitrate; - MOVConfigVideoFixQuant *ms_fix_quant; - - MOVConfigVideoNum *divx_bitrate; - MOVConfigVideoNum *divx_quantizer; - MOVConfigVideoNum *divx_rc_period; - MOVConfigVideoNum *divx_rc_reaction_ratio; - MOVConfigVideoNum *divx_rc_reaction_period; - MOVConfigVideoNum *divx_max_key_interval; - MOVConfigVideoNum *divx_max_quantizer; - MOVConfigVideoNum *divx_min_quantizer; - MOVConfigVideoNum *divx_quality; - MOVConfigVideoFixBitrate *divx_fix_bitrate; - MOVConfigVideoFixQuant *divx_fix_quant; - - MOVConfigVideoNum *h264_bitrate; - MOVConfigVideoNum *h264_quantizer; - MOVConfigVideoFixBitrate *h264_fix_bitrate; - MOVConfigVideoFixQuant *h264_fix_quant; -}; - -class MOVConfigVideoPopup : public BC_PopupTextBox -{ -public: - MOVConfigVideoPopup(MOVConfigVideo *popup, int x, int y); - int handle_event(); - MOVConfigVideo *popup; -}; - -class MOVConfigVideoFixBitrate : public BC_Radial -{ -public: - MOVConfigVideoFixBitrate(int x, - int y, - int *output, - int value); - int handle_event(); - BC_Radial *opposite; - int *output; - int value; -}; - -class MOVConfigVideoFixQuant : public BC_Radial -{ -public: - MOVConfigVideoFixQuant(int x, - int y, - int *output, - int value); - int handle_event(); - BC_Radial *opposite; - int *output; - int value; -}; - -class MOVConfigVideoCheckBox : public BC_CheckBox -{ -public: - MOVConfigVideoCheckBox(char *title_text, - int x, - int y, - int *output); - int handle_event(); - int *output; -}; - -class MOVConfigVideoNum : public BC_TumbleTextBox -{ -public: - MOVConfigVideoNum(MOVConfigVideo *popup, - char *title_text, - int x, - int y, - int *output); - MOVConfigVideoNum(MOVConfigVideo *popup, - char *title_text, - int x, - int y, - int min, - int max, - int *output); - ~MOVConfigVideoNum(); - - void create_objects(); - int handle_event(); - int *output; - MOVConfigVideo *popup; - BC_Title *title; - char *title_text; - int x, y; -}; - -#endif diff --git a/cinelerra-5.0/cinelerra/filemov.inc b/cinelerra-5.0/cinelerra/filemov.inc deleted file mode 100644 index 0cdd8c11..00000000 --- a/cinelerra-5.0/cinelerra/filemov.inc +++ /dev/null @@ -1,27 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef FILEMOV_INC -#define FILEMOV_INC - -class FileMOV; - -#endif diff --git a/cinelerra-5.0/cinelerra/filempeg.C b/cinelerra-5.0/cinelerra/filempeg.C index 033f38c1..584dc189 100644 --- a/cinelerra-5.0/cinelerra/filempeg.C +++ b/cinelerra-5.0/cinelerra/filempeg.C @@ -1681,17 +1681,6 @@ int FileMPEG::read_samples(double *buffer, int64_t len) return 0; } -const char* FileMPEG::strtocompression(char *string) -{ - return ""; -} - -const char* FileMPEG::compressiontostr(char *string) -{ - return ""; -} - - diff --git a/cinelerra-5.0/cinelerra/filempeg.h b/cinelerra-5.0/cinelerra/filempeg.h index 87c5330d..004316b6 100644 --- a/cinelerra-5.0/cinelerra/filempeg.h +++ b/cinelerra-5.0/cinelerra/filempeg.h @@ -109,9 +109,6 @@ public: static const char *zmpeg3_cmdl_name(int cmdl); // This file can copy frames directly from the asset int can_copy_from(Asset *asset, int64_t position); - static const char *strtocompression(char *string); - static const char *compressiontostr(char *string); - private: void to_streamchannel(int channel, int &stream_out, int &channel_out); diff --git a/cinelerra-5.0/cinelerra/fileogg.C b/cinelerra-5.0/cinelerra/fileogg.C index 643c69d5..ebb36c0d 100644 --- a/cinelerra-5.0/cinelerra/fileogg.C +++ b/cinelerra-5.0/cinelerra/fileogg.C @@ -23,7 +23,6 @@ #include "bcsignals.h" #include "byteorder.h" #include "clip.h" -#include "cmodel_permutation.h" #include "edit.h" #include "file.h" #include "fileogg.h" @@ -35,7 +34,6 @@ #include "mwindow.inc" #include "preferences.h" #include "render.h" -#include "quicktime.h" #include "vframe.h" #include "videodevice.inc" diff --git a/cinelerra-5.0/cinelerra/filepng.C b/cinelerra-5.0/cinelerra/filepng.C index 2f09dc53..d8bb6bd1 100644 --- a/cinelerra-5.0/cinelerra/filepng.C +++ b/cinelerra-5.0/cinelerra/filepng.C @@ -25,7 +25,6 @@ #include "filepng.h" #include "language.h" #include "mwindow.inc" -#include "quicktime.h" #include "vframe.h" #include "videodevice.inc" #include "mainerror.h" @@ -96,11 +95,6 @@ void FilePNG::get_parameters(BC_WindowBase *parent_window, int FilePNG::can_copy_from(Asset *asset, int64_t position) { - if(asset->format == FILE_MOV) - { - if(match4(asset->vcodec, QUICKTIME_PNG)) return 1; - } - else if(asset->format == FILE_PNG || asset->format == FILE_PNG_LIST) return 1; diff --git a/cinelerra-5.0/cinelerra/filepng.C.orig b/cinelerra-5.0/cinelerra/filepng.C.orig deleted file mode 100644 index d4645e6b..00000000 --- a/cinelerra-5.0/cinelerra/filepng.C.orig +++ /dev/null @@ -1,481 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "asset.h" -#include "edit.h" -#include "file.h" -#include "filepng.h" -#include "language.h" -#include "mwindow.inc" -#include "quicktime.h" -#include "vframe.h" -#include "videodevice.inc" - -#include - -FilePNG::FilePNG(Asset *asset, File *file) - : FileList(asset, file, "PNGLIST", ".png", FILE_PNG, FILE_PNG_LIST) -{ -} - -FilePNG::~FilePNG() -{ -} - - - -int FilePNG::check_sig(Asset *asset) -{ - FILE *stream = fopen(asset->path, "rb"); - - if(stream) - { - -//printf("FilePNG::check_sig 1\n"); - char test[16]; - int temp = fread(test, 16, 1, stream); - fclose(stream); - - if(png_check_sig((unsigned char*)test, 8)) - { -//printf("FilePNG::check_sig 1\n"); - return 1; - } - else - if(test[0] == 'P' && test[1] == 'N' && test[2] == 'G' && - test[3] == 'L' && test[4] == 'I' && test[5] == 'S' && test[6] == 'T') - { -//printf("FilePNG::check_sig 1\n"); - return 1; - } - } - return 0; -} - - - -void FilePNG::get_parameters(BC_WindowBase *parent_window, - Asset *asset, - BC_WindowBase* &format_window, - int audio_options, - int video_options) -{ - if(video_options) - { - PNGConfigVideo *window = new PNGConfigVideo(parent_window, asset); - format_window = window; - window->create_objects(); - window->run_window(); - delete window; - } -} - - - - -int FilePNG::can_copy_from(Asset *asset, int64_t position) -{ - if(asset->format == FILE_MOV) - { - if(match4(asset->vcodec, QUICKTIME_PNG)) return 1; - } - else - if(asset->format == FILE_PNG || - asset->format == FILE_PNG_LIST) - return 1; - - return 0; -} - - -int FilePNG::colormodel_supported(int colormodel) -{ - if (((colormodel == BC_RGBA8888) && (native_cmodel == BC_RGBA16161616)) - || ((colormodel == BC_RGB161616) && (native_cmodel == BC_RGBA16161616)) - || (colormodel == BC_RGB888)) - { - return colormodel; - } - else if ((colormodel == BC_RGB161616) && (native_cmodel == BC_RGBA8888)) - { - return BC_RGB888; - } - else - { - return native_cmodel; - } -} - - -int FilePNG::get_best_colormodel(Asset *asset, int driver) -{ - if(asset->png_use_alpha) - return BC_RGBA8888; - else - return BC_RGB888; -} - - - - -int FilePNG::read_frame_header(char *path) -{ - int result = 0; - int color_type; - int color_depth; - int num_trans = 0; - - FILE *stream; - - if(!(stream = fopen(path, "rb"))) - { - perror("FilePNG::read_frame_header"); - return 1; - } - - png_structp png_ptr; - png_infop info_ptr; - png_infop end_info = 0; - png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0); - info_ptr = png_create_info_struct(png_ptr); - png_init_io(png_ptr, stream); - - - png_read_info(png_ptr, info_ptr); - - asset->width = png_get_image_width(png_ptr, info_ptr); - asset->height = png_get_image_height(png_ptr, info_ptr); - color_type = png_get_color_type(png_ptr, info_ptr); - color_depth = png_get_bit_depth(png_ptr,info_ptr); - - png_get_tRNS(png_ptr, info_ptr, NULL, &num_trans, NULL); - - if (color_depth == 16) - { - if (color_type & PNG_COLOR_MASK_ALPHA) - { - native_cmodel = BC_RGBA16161616; - } - else - { - native_cmodel = BC_RGB161616; - } - } - else - if ((color_type & PNG_COLOR_MASK_ALPHA) - || (num_trans > 0)) - { - native_cmodel = BC_RGBA8888; - } - else - { - native_cmodel = BC_RGB888; - } - - - png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); - fclose(stream); - - - - return result; -} - - - - -static void read_function(png_structp png_ptr, - png_bytep data, - png_uint_32 length) -{ - VFrame *input = (VFrame*)png_get_io_ptr(png_ptr); - - memcpy(data, input->get_data() + input->get_compressed_size(), length); - input->set_compressed_size(input->get_compressed_size() + length); -} - -static void write_function(png_structp png_ptr, png_bytep data, png_uint_32 length) -{ - VFrame *output = (VFrame*)png_get_io_ptr(png_ptr); - - if(output->get_compressed_allocated() < output->get_compressed_size() + length) - output->allocate_compressed_data((output->get_compressed_allocated() + length) * 2); - memcpy(output->get_data() + output->get_compressed_size(), data, length); - output->set_compressed_size(output->get_compressed_size() + length); -} - -static void flush_function(png_structp png_ptr) -{ - ; -} - - - -int FilePNG::write_frame(VFrame *frame, VFrame *data, FrameWriterUnit *unit) -{ - PNGUnit *png_unit = (PNGUnit*)unit; - int result = 0; - png_structp png_ptr; - png_infop info_ptr; - png_infop end_info = 0; - VFrame *output_frame; - data->set_compressed_size(0); - -//printf("FilePNG::write_frame 1\n"); - png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0); - info_ptr = png_create_info_struct(png_ptr); - png_set_write_fn(png_ptr, - data, - (png_rw_ptr)write_function, - (png_flush_ptr)flush_function); - png_set_compression_level(png_ptr, 9); - - png_set_IHDR(png_ptr, - info_ptr, - asset->width, - asset->height, - 8, - asset->png_use_alpha ? - PNG_COLOR_TYPE_RGB_ALPHA : - PNG_COLOR_TYPE_RGB, - PNG_INTERLACE_NONE, - PNG_COMPRESSION_TYPE_DEFAULT, - PNG_FILTER_TYPE_DEFAULT); - png_write_info(png_ptr, info_ptr); - -//printf("FilePNG::write_frame 1\n"); - native_cmodel = asset->png_use_alpha ? BC_RGBA8888 : BC_RGB888; - if(frame->get_color_model() != native_cmodel) - { - if(!png_unit->temp_frame) png_unit->temp_frame = new VFrame(0, - -1, - asset->width, - asset->height, - native_cmodel, - -1); - - BC_CModels::transfer(png_unit->temp_frame->get_rows(), /* Leave NULL if non existent */ - frame->get_rows(), - png_unit->temp_frame->get_y(), /* Leave NULL if non existent */ - png_unit->temp_frame->get_u(), - png_unit->temp_frame->get_v(), - frame->get_y(), /* Leave NULL if non existent */ - frame->get_u(), - frame->get_v(), - 0, /* Dimensions to capture from input frame */ - 0, - asset->width, - asset->height, - 0, /* Dimensions to project on output frame */ - 0, - asset->width, - asset->height, - frame->get_color_model(), - png_unit->temp_frame->get_color_model(), - 0, /* When transfering BC_RGBA8888 to non-alpha this is the background color in 0xRRGGBB hex */ - asset->width, /* For planar use the luma rowspan */ - asset->height); - - output_frame = png_unit->temp_frame; - } - else - output_frame = frame; - - -//printf("FilePNG::write_frame 2\n"); - png_write_image(png_ptr, output_frame->get_rows()); - png_write_end(png_ptr, info_ptr); - png_destroy_write_struct(&png_ptr, &info_ptr); -//printf("FilePNG::write_frame 3 %d\n", data->get_compressed_size()); - - return result; -} - -int FilePNG::read_frame(VFrame *output, VFrame *input) -{ - png_structp png_ptr; - png_infop info_ptr; - png_infop end_info = 0; - int result = 0; - int color_type; - int color_depth; - int colormodel; - int size = input->get_compressed_size(); - input->set_compressed_size(0); - - - //printf("FilePNG::read_frame 1 %d %d\n", native_cmodel, output->get_color_model()); - png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0); - info_ptr = png_create_info_struct(png_ptr); - png_set_read_fn(png_ptr, input, (png_rw_ptr)read_function); - png_read_info(png_ptr, info_ptr); - - int png_color_type = png_get_color_type(png_ptr, info_ptr); - if (png_color_type == PNG_COLOR_TYPE_GRAY || - png_color_type == PNG_COLOR_TYPE_GRAY_ALPHA) - { - png_set_gray_to_rgb(png_ptr); - } - - colormodel = output->get_color_model(); - color_type = png_get_color_type(png_ptr, info_ptr); - color_depth = png_get_bit_depth(png_ptr,info_ptr); - - if (((native_cmodel == BC_RGBA16161616)||(native_cmodel == BC_RGB161616)) - && ((colormodel == BC_RGBA8888)||(colormodel == BC_RGB888))) - { - png_set_strip_16(png_ptr); - } - - /* If we're dropping the alpha channel, use the background color of the image - otherwise, use black */ - if (((native_cmodel == BC_RGBA16161616)||(native_cmodel == BC_RGBA8888)) - && ((colormodel == BC_RGB161616)||(colormodel == BC_RGB888))) - { - png_color_16 my_background; - png_color_16p image_background; - - memset(&my_background,0,sizeof(png_color_16)); - - if (png_get_bKGD(png_ptr, info_ptr, &image_background)) - { - png_set_background(png_ptr, image_background, PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); - } - else - { - png_set_background(png_ptr, &my_background, PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0); - } - } - - /* Little endian */ - if ((color_depth == 16) - &&((colormodel == BC_RGBA16161616)||(colormodel == BC_RGB161616))) - { - png_set_swap(png_ptr); - } - - if (!(color_type & PNG_COLOR_MASK_COLOR)) - { - png_set_gray_to_rgb(png_ptr); - } - - if (color_type & PNG_COLOR_MASK_PALETTE) - { - png_set_palette_to_rgb(png_ptr); - } - - if (color_depth <= 8) - { - png_set_expand(png_ptr); - } - -/* read the image */ - png_read_image(png_ptr, output->get_rows()); -//printf("FilePNG::read_frame 3\n"); - png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); - - input->set_compressed_size(size); - -//printf("FilePNG::read_frame 4\n"); - return result; -} - -FrameWriterUnit* FilePNG::new_writer_unit(FrameWriter *writer) -{ - return new PNGUnit(this, writer); -} - - - - - - - - - - - - -PNGUnit::PNGUnit(FilePNG *file, FrameWriter *writer) - : FrameWriterUnit(writer) -{ - this->file = file; - temp_frame = 0; -} -PNGUnit::~PNGUnit() -{ - if(temp_frame) delete temp_frame; -} - - - - - - - - - -PNGConfigVideo::PNGConfigVideo(BC_WindowBase *parent_window, Asset *asset) - : BC_Window(PROGRAM_NAME ": Video Compression", - parent_window->get_abs_cursor_x(1), - parent_window->get_abs_cursor_y(1), - 200, - 100) -{ - this->parent_window = parent_window; - this->asset = asset; -} - -PNGConfigVideo::~PNGConfigVideo() -{ -} - -void PNGConfigVideo::create_objects() -{ - int x = 10, y = 10; - lock_window("PNGConfigVideo::create_objects"); - add_subwindow(new PNGUseAlpha(this, x, y)); - add_subwindow(new BC_OKButton(this)); - show_window(1); - unlock_window(); -} - -int PNGConfigVideo::close_event() -{ - set_done(0); - return 1; -} - - -PNGUseAlpha::PNGUseAlpha(PNGConfigVideo *gui, int x, int y) - : BC_CheckBox(x, y, gui->asset->png_use_alpha, _("Use alpha")) -{ - this->gui = gui; -} - -int PNGUseAlpha::handle_event() -{ - gui->asset->png_use_alpha = get_value(); - return 1; -} - - - diff --git a/cinelerra-5.0/cinelerra/filescene.C b/cinelerra-5.0/cinelerra/filescene.C index fd9a6e95..8e0ce29a 100644 --- a/cinelerra-5.0/cinelerra/filescene.C +++ b/cinelerra-5.0/cinelerra/filescene.C @@ -22,6 +22,7 @@ #include "asset.h" #include "bcsignals.h" +#include "clip.h" #include "file.h" #include "filescene.h" #include "filesystem.h" @@ -1856,7 +1857,7 @@ VFrame* SceneTokens::load_image(char *path) delete [] data; - if(!cmodel_has_alpha(result->get_color_model()) ) + if(!BC_CModels::has_alpha(result->get_color_model()) ) printf("SceneTokens::load_image %d: image %s has no alpha channel\n", __LINE__, path); diff --git a/cinelerra-5.0/cinelerra/formatcheck.C b/cinelerra-5.0/cinelerra/formatcheck.C index 0b03ce87..d3469623 100644 --- a/cinelerra-5.0/cinelerra/formatcheck.C +++ b/cinelerra-5.0/cinelerra/formatcheck.C @@ -65,16 +65,7 @@ int FormatCheck::check_format() result = 1; } - if(!result && asset->bits == BITSIMA4 && asset->format != FILE_MOV) - { - ErrorBox errorbox(_(PROGRAM_NAME ": Error")); - errorbox.create_objects(_("IMA4 compression is only available in Quicktime movies.")); - errorbox.run_window(); - result = 1; - } - if(!result && asset->bits == BITSULAW && - asset->format != FILE_MOV && asset->format != FILE_PCM) { ErrorBox errorbox(_(PROGRAM_NAME ": Error")); diff --git a/cinelerra-5.0/cinelerra/formatpopup.C b/cinelerra-5.0/cinelerra/formatpopup.C index 968444bf..dacb76cc 100644 --- a/cinelerra-5.0/cinelerra/formatpopup.C +++ b/cinelerra-5.0/cinelerra/formatpopup.C @@ -40,6 +40,8 @@ FormatPopup::FormatPopup(ArrayList *plugindb, void FormatPopup::create_objects() { + format_items.append(new BC_ListBoxItem(_(FFMPEG_NAME))); + if(!use_brender) { format_items.append(new BC_ListBoxItem(_(AC3_NAME))); @@ -53,12 +55,9 @@ void FormatPopup::create_objects() if(!use_brender) { - format_items.append(new BC_ListBoxItem(_(AVI_NAME))); format_items.append(new BC_ListBoxItem(_(EXR_NAME))); format_items.append(new BC_ListBoxItem(_(EXR_LIST_NAME))); format_items.append(new BC_ListBoxItem(_(WAV_NAME))); - format_items.append(new BC_ListBoxItem(_(MOV_NAME))); - format_items.append(new BC_ListBoxItem(_(FFMPEG_NAME))); format_items.append(new BC_ListBoxItem(_(AMPEG_NAME))); format_items.append(new BC_ListBoxItem(_(VMPEG_NAME))); format_items.append(new BC_ListBoxItem(_(OGG_NAME))); diff --git a/cinelerra-5.0/cinelerra/formattools.C b/cinelerra-5.0/cinelerra/formattools.C index bdc96d4e..f90958e0 100644 --- a/cinelerra-5.0/cinelerra/formattools.C +++ b/cinelerra-5.0/cinelerra/formattools.C @@ -27,10 +27,11 @@ #include "filesystem.h" #include "formattools.h" #include "language.h" +#include "libdv.h" +#include "libmjpeg.h" #include "maxchannels.h" #include "mwindow.h" #include "preferences.h" -#include "quicktime.h" #include "theme.h" #include "videodevice.inc" #include @@ -292,6 +293,7 @@ void FormatTools::update_driver(int driver) { this->video_driver = driver; + locked_compressor = 0; switch(driver) { case CAPTURE_DVB: @@ -304,56 +306,44 @@ void FormatTools::update_driver(int driver) format_text->update(_("MPEG stream")); asset->format = FILE_MPEG; } - locked_compressor = 0; audio_switch->update(1); video_switch->update(1); break; case CAPTURE_IEC61883: case CAPTURE_FIREWIRE: + case CAPTURE_LML: case CAPTURE_BUZ: case VIDEO4LINUX2JPEG: case CAPTURE_JPEG_WEBCAM: - if(asset->format != FILE_AVI && - asset->format != FILE_MOV) - { - format_text->update(MOV_NAME); - asset->format = FILE_MOV; - } - else - format_text->update(File::formattostr(asset->format)); - - switch(driver) - { - case CAPTURE_IEC61883: - case CAPTURE_FIREWIRE: - locked_compressor = (char*)QUICKTIME_DVSD; - strcpy(asset->vcodec, QUICKTIME_DVSD); - break; - - case CAPTURE_BUZ: - case VIDEO4LINUX2JPEG: - locked_compressor = (char*)QUICKTIME_MJPA; - strcpy(asset->vcodec, QUICKTIME_MJPA); - break; + asset->format = FILE_FFMPEG; + format_text->update(File::formattostr(asset->format)); - case CAPTURE_JPEG_WEBCAM: - locked_compressor = (char*)QUICKTIME_JPEG; - strcpy(asset->vcodec, QUICKTIME_JPEG); - break; + switch(driver) { + case CAPTURE_IEC61883: + case CAPTURE_FIREWIRE: + locked_compressor = (char*)CODEC_TAG_DVSD; + break; + + case CAPTURE_BUZ: + case CAPTURE_LML: + case VIDEO4LINUX2JPEG: + locked_compressor = (char*)CODEC_TAG_MJPEG; + break; + + case CAPTURE_JPEG_WEBCAM: + locked_compressor = (char*)CODEC_TAG_JPEG; + break; } + if( locked_compressor ) + strcpy(asset->vcodec, locked_compressor); audio_switch->update(asset->audio_data); video_switch->update(asset->video_data); break; - - - - default: format_text->update(File::formattostr(asset->format)); - locked_compressor = 0; audio_switch->update(asset->audio_data); video_switch->update(asset->video_data); break; diff --git a/cinelerra-5.0/cinelerra/formatwindow.C b/cinelerra-5.0/cinelerra/formatwindow.C index 6cf2ee30..0c67634c 100644 --- a/cinelerra-5.0/cinelerra/formatwindow.C +++ b/cinelerra-5.0/cinelerra/formatwindow.C @@ -27,7 +27,7 @@ FormatAWindow::FormatAWindow(Asset *asset, int *dither) : BC_Window(_(PROGRAM_NAME ": File format"), 410, - (asset->format == FILE_WAV || asset->format == FILE_MOV) ? 115 : 185, + (asset->format == FILE_WAV) ? 115 : 185, 0, 0) { this->asset = asset; this->dither = dither; } @@ -51,7 +51,7 @@ int FormatAWindow::create_objects() x += 100; add_subwindow(new FormatDither(x, y, this->dither)); - if(asset->format == FILE_PCM || asset->format == FILE_MOV) + if(asset->format == FILE_PCM) { x += 90; add_subwindow(new FormatSigned(x, y, asset)); @@ -101,21 +101,6 @@ int FormatVWindow::create_objects() init_x = x = 10; - if(asset->format == FILE_MOV) - { - add_subwindow(new BC_Title(x, y, _("Set parameters for this video format:"))); - y += 30; - add_subwindow(new BC_Title(x, y, _("Compression:"))); - x += 110; - add_subwindow(new FormatCompress(x, y, recording, asset, asset->compression)); - x += 90; - add_subwindow(new BC_Title(x, y, _("Quality:"))); - x += 70; - add_subwindow(new FormatQuality(x, y, asset, asset->quality)); - y += 40; - x = init_x; - } - else if(asset->format == FILE_JPEG_LIST) { add_subwindow(new BC_Title(x, y, _("Set parameters for this video format:"))); @@ -146,19 +131,6 @@ int FormatVWindow::close_event() -FormatCompress::FormatCompress(int x, int y, int recording, Asset *asset, char* default_) - : CompressPopup(x, y, recording, default_) -{ - this->asset = asset; -} -FormatCompress::~FormatCompress() -{ -} -int FormatCompress::handle_event() -{ - strcpy(asset->compression, get_compression()); -} - FormatQuality::FormatQuality(int x, int y, Asset *asset, int default_) : BC_ISlider(x, y, diff --git a/cinelerra-5.0/cinelerra/formatwindow.h b/cinelerra-5.0/cinelerra/formatwindow.h index b9ae0b7e..64a67765 100644 --- a/cinelerra-5.0/cinelerra/formatwindow.h +++ b/cinelerra-5.0/cinelerra/formatwindow.h @@ -61,16 +61,6 @@ public: }; -class FormatCompress : public CompressPopup -{ -public: - FormatCompress(int x, int y, int recording, Asset *asset, char *default_); - ~FormatCompress(); - - int handle_event(); - Asset *asset; -}; - class FormatQuality : public BC_ISlider { public: diff --git a/cinelerra-5.0/quicktime/libdv.c b/cinelerra-5.0/cinelerra/libdv.C similarity index 92% rename from cinelerra-5.0/quicktime/libdv.c rename to cinelerra-5.0/cinelerra/libdv.C index c3ac4907..90c9f6ef 100644 --- a/cinelerra-5.0/quicktime/libdv.c +++ b/cinelerra-5.0/cinelerra/libdv.C @@ -2,7 +2,7 @@ * Grabbing algorithm is from dvgrab */ -#include "colormodels.h" +#include "bccmodels.h" #include "libdv.h" #include @@ -23,7 +23,7 @@ static pthread_mutex_t dv_lock; dv_t* dv_new() { - dv_t *dv = calloc(1, sizeof(dv_t)); + dv_t *dv = (dv_t *)calloc(1, sizeof(dv_t)); if(!dv_initted) { pthread_mutexattr_t attr; @@ -121,7 +121,7 @@ int dv_read_video(dv_t *dv, { unsigned char *temp_rows[DV_HEIGHT]; if(!dv->temp_video) - dv->temp_video = calloc(1, DV_WIDTH * DV_HEIGHT * 2); + dv->temp_video = (unsigned char *)calloc(1, DV_WIDTH * DV_HEIGHT * 2); for(i = 0; i < DV_HEIGHT; i++) { @@ -137,7 +137,7 @@ int dv_read_video(dv_t *dv, pitches); //printf("dv_read_video 4\n"); - cmodel_transfer(output_rows, + BC_CModels::transfer(output_rows, temp_rows, output_rows[0], output_rows[1], @@ -186,7 +186,7 @@ int dv_read_audio(dv_t *dv, if(!dv->temp_audio[0]) { for(i = 0; i < 4; i++) - dv->temp_audio[i] = calloc(1, sizeof(int16_t) * MAX_AUDIO_SAMPLES); + dv->temp_audio[i] = (int16_t*)calloc(1, sizeof(int16_t) * MAX_AUDIO_SAMPLES); } switch(size) { @@ -231,7 +231,7 @@ void dv_write_video(dv_t *dv, int color_model, int norm) { - dv_color_space_t encode_dv_colormodel = 0; + int encode_dv_colormodel = 0; if(!dv->encoder) { @@ -261,7 +261,7 @@ void dv_write_video(dv_t *dv, dv_encode_full_frame( dv->encoder, input_rows, - encode_dv_colormodel, + (dv_color_space_t)encode_dv_colormodel, data ); } @@ -295,7 +295,7 @@ int dv_write_audio(dv_t *dv, if(!dv->temp_audio[0]) { for(i = 0; i < 4; i++) - dv->temp_audio[i] = calloc(1, sizeof(int16_t) * MAX_AUDIO_SAMPLES); + dv->temp_audio[i] = (int16_t*)calloc(1, sizeof(int16_t) * MAX_AUDIO_SAMPLES); } for(i = 0; i < channels; i++) diff --git a/cinelerra-5.0/quicktime/libdv.h b/cinelerra-5.0/cinelerra/libdv.h similarity index 97% rename from cinelerra-5.0/quicktime/libdv.h rename to cinelerra-5.0/cinelerra/libdv.h index 937774ba..9cdec3cd 100644 --- a/cinelerra-5.0/quicktime/libdv.h +++ b/cinelerra-5.0/cinelerra/libdv.h @@ -8,6 +8,7 @@ extern "C" { // Buffer sizes #define DV_NTSC_SIZE 120000 #define DV_PAL_SIZE 144000 +#define CODEC_TAG_DVSD "dvsd" // Norms #define DV_NTSC 0 diff --git a/cinelerra-5.0/quicktime/libmjpeg.c b/cinelerra-5.0/cinelerra/libmjpeg.C similarity index 92% rename from cinelerra-5.0/quicktime/libmjpeg.c rename to cinelerra-5.0/cinelerra/libmjpeg.C index e2bf0706..14937dfb 100644 --- a/cinelerra-5.0/quicktime/libmjpeg.c +++ b/cinelerra-5.0/cinelerra/libmjpeg.C @@ -18,7 +18,7 @@ #include #include #include -#include "colormodels.h" +#include "bccmodels.h" #include "libmjpeg.h" /* JPEG MARKERS */ @@ -118,7 +118,8 @@ METHODDEF(void) init_destination(j_compress_ptr cinfo) /* Set the pointer to the preallocated buffer */ if(!dest->engine->output_buffer) { - dest->engine->output_buffer = calloc(1, 65536); + dest->engine->output_buffer = new unsigned char[65536]; + memset(dest->engine->output_buffer,0,65536); dest->engine->output_allocated = 65536; } dest->buffer = dest->engine->output_buffer; @@ -156,8 +157,10 @@ METHODDEF(boolean) empty_output_buffer(j_compress_ptr cinfo) dest->engine->output_size = dest->engine->output_allocated; dest->engine->output_allocated *= 2; - dest->engine->output_buffer = realloc(dest->engine->output_buffer, - dest->engine->output_allocated); + unsigned char *new_buffer = new unsigned char[dest->engine->output_allocated]; + memcpy(new_buffer, dest->engine->output_buffer, dest->engine->output_size); + delete [] dest->engine->output_buffer; + dest->engine->output_buffer = new_buffer; dest->buffer = dest->engine->output_buffer; dest->pub.next_output_byte = dest->buffer + dest->engine->output_size; dest->pub.free_in_buffer = dest->engine->output_allocated - dest->engine->output_size; @@ -409,7 +412,7 @@ static void delete_buffer(unsigned char **buffer, long *size, long *allocated) { if(*buffer) { - free(*buffer); + delete [] *buffer; *size = 0; *allocated = 0; } @@ -423,7 +426,8 @@ static void append_buffer(unsigned char **buffer, { if(!*buffer) { - *buffer = calloc(1, 65536); + *buffer = new unsigned char[65536]; + memset(*buffer,0,65536); *size = 0; *allocated = 65536; } @@ -431,7 +435,10 @@ static void append_buffer(unsigned char **buffer, if(*size + data_size + 0x100 > *allocated) { *allocated = *size + data_size + 0x100; - *buffer = realloc(*buffer, *allocated); + unsigned char *new_buffer = new unsigned char[*allocated]; + memcpy(new_buffer, *buffer, *size); + delete [] *buffer; + *buffer = new_buffer; } memcpy(*buffer + *size, data, data_size); @@ -448,10 +455,10 @@ static void allocate_temps(mjpeg_t *mjpeg) { case BC_YUV422P: //printf("allocate_temps 1\n"); - mjpeg->temp_data = calloc(1, mjpeg->coded_w * mjpeg->coded_h * 2); - mjpeg->temp_rows[0] = calloc(1, sizeof(unsigned char*) * mjpeg->coded_h); - mjpeg->temp_rows[1] = calloc(1, sizeof(unsigned char*) * mjpeg->coded_h); - mjpeg->temp_rows[2] = calloc(1, sizeof(unsigned char*) * mjpeg->coded_h); + mjpeg->temp_data = new unsigned char[mjpeg->coded_w * mjpeg->coded_h * 2]; + mjpeg->temp_rows[0] = new unsigned char*[mjpeg->coded_h]; + mjpeg->temp_rows[1] = new unsigned char*[mjpeg->coded_h]; + mjpeg->temp_rows[2] = new unsigned char*[mjpeg->coded_h]; for(i = 0; i < mjpeg->coded_h; i++) { mjpeg->temp_rows[0][i] = mjpeg->temp_data + i * mjpeg->coded_w; @@ -461,10 +468,10 @@ static void allocate_temps(mjpeg_t *mjpeg) break; case BC_YUV444P: - mjpeg->temp_data = calloc(1, mjpeg->coded_w * mjpeg->coded_h * 3); - mjpeg->temp_rows[0] = calloc(1, sizeof(unsigned char*) * mjpeg->coded_h); - mjpeg->temp_rows[1] = calloc(1, sizeof(unsigned char*) * mjpeg->coded_h); - mjpeg->temp_rows[2] = calloc(1, sizeof(unsigned char*) * mjpeg->coded_h); + mjpeg->temp_data = new unsigned char[mjpeg->coded_w * mjpeg->coded_h * 3]; + mjpeg->temp_rows[0] = new unsigned char*[mjpeg->coded_h]; + mjpeg->temp_rows[1] = new unsigned char*[mjpeg->coded_h]; + mjpeg->temp_rows[2] = new unsigned char*[mjpeg->coded_h]; if(mjpeg->greyscale) { memset(mjpeg->temp_data + mjpeg->coded_w * mjpeg->coded_h, @@ -480,10 +487,10 @@ static void allocate_temps(mjpeg_t *mjpeg) break; case BC_YUV420P: - mjpeg->temp_data = calloc(1, mjpeg->coded_w * mjpeg->coded_h + mjpeg->coded_w * mjpeg->coded_h / 2); - mjpeg->temp_rows[0] = calloc(1, sizeof(unsigned char*) * mjpeg->coded_h); - mjpeg->temp_rows[1] = calloc(1, sizeof(unsigned char*) * mjpeg->coded_h / 2); - mjpeg->temp_rows[2] = calloc(1, sizeof(unsigned char*) * mjpeg->coded_h / 2); + mjpeg->temp_data = new unsigned char[mjpeg->coded_w * mjpeg->coded_h + mjpeg->coded_w * mjpeg->coded_h / 2]; + mjpeg->temp_rows[0] = new unsigned char*[mjpeg->coded_h]; + mjpeg->temp_rows[1] = new unsigned char*[mjpeg->coded_h / 2]; + mjpeg->temp_rows[2] = new unsigned char*[mjpeg->coded_h / 2]; for(i = 0; i < mjpeg->coded_h; i++) { mjpeg->temp_rows[0][i] = mjpeg->temp_data + i * mjpeg->coded_w; @@ -519,9 +526,9 @@ static void get_rows(mjpeg_t *mjpeg, mjpeg_compressor *compressor) { if(!compressor->rows[0]) { - compressor->rows[0] = calloc(1, sizeof(unsigned char*) * compressor->coded_field_h); - compressor->rows[1] = calloc(1, sizeof(unsigned char*) * compressor->coded_field_h); - compressor->rows[2] = calloc(1, sizeof(unsigned char*) * compressor->coded_field_h); + compressor->rows[0] = new unsigned char*[compressor->coded_field_h]; + compressor->rows[1] = new unsigned char*[compressor->coded_field_h]; + compressor->rows[2] = new unsigned char*[compressor->coded_field_h]; } // User colormodel matches jpeg colormodel @@ -557,9 +564,9 @@ static void get_rows(mjpeg_t *mjpeg, mjpeg_compressor *compressor) { if(!compressor->rows[0]) { - compressor->rows[0] = calloc(1, sizeof(unsigned char*) * compressor->coded_field_h); - compressor->rows[1] = calloc(1, sizeof(unsigned char*) * compressor->coded_field_h); - compressor->rows[2] = calloc(1, sizeof(unsigned char*) * compressor->coded_field_h); + compressor->rows[0] = new unsigned char*[compressor->coded_field_h]; + compressor->rows[1] = new unsigned char*[compressor->coded_field_h]; + compressor->rows[2] = new unsigned char*[compressor->coded_field_h]; } // User colormodel matches jpeg colormodel @@ -595,9 +602,9 @@ static void get_rows(mjpeg_t *mjpeg, mjpeg_compressor *compressor) { if(!compressor->rows[0]) { - compressor->rows[0] = calloc(1, sizeof(unsigned char*) * mjpeg->coded_h); - compressor->rows[1] = calloc(1, sizeof(unsigned char*) * mjpeg->coded_h / 2); - compressor->rows[2] = calloc(1, sizeof(unsigned char*) * mjpeg->coded_h / 2); + compressor->rows[0] = new unsigned char*[mjpeg->coded_h]; + compressor->rows[1] = new unsigned char*[mjpeg->coded_h / 2]; + compressor->rows[2] = new unsigned char*[mjpeg->coded_h / 2]; } // User colormodel matches jpeg colormodel @@ -641,9 +648,9 @@ static void delete_rows(mjpeg_compressor *compressor) { if(compressor->rows[0]) { - free(compressor->rows[0]); - free(compressor->rows[1]); - free(compressor->rows[2]); + delete [] compressor->rows[0]; + delete [] compressor->rows[1]; + delete [] compressor->rows[2]; } } @@ -716,7 +723,7 @@ static void get_mcu_rows(mjpeg_t *mjpeg, static void decompress_field(mjpeg_compressor *engine) { - mjpeg_t *mjpeg = engine->mjpeg; + mjpeg_t *mjpeg = (mjpeg_t *)engine->mjpeg; long buffer_offset = engine->instance * mjpeg->input_field2; unsigned char *buffer = mjpeg->input_data + buffer_offset; long buffer_size; @@ -817,10 +824,10 @@ void mjpeg_decompress_loop(mjpeg_compressor *engine) static void compress_field(mjpeg_compressor *engine) { - mjpeg_t *mjpeg = engine->mjpeg; + mjpeg_t *mjpeg = (mjpeg_t *)engine->mjpeg; //printf("compress_field 1\n"); - get_rows(engine->mjpeg, engine); + get_rows(mjpeg, engine); reset_buffer(&engine->output_buffer, &engine->output_size, &engine->output_allocated); jpeg_buffer_dest(&engine->jpeg_compress, engine); @@ -861,17 +868,18 @@ static void delete_temps(mjpeg_t *mjpeg) { if(mjpeg->temp_data) { - free(mjpeg->temp_data); - free(mjpeg->temp_rows[0]); - free(mjpeg->temp_rows[1]); - free(mjpeg->temp_rows[2]); + delete [] mjpeg->temp_data; + delete [] mjpeg->temp_rows[0]; + delete [] mjpeg->temp_rows[1]; + delete [] mjpeg->temp_rows[2]; mjpeg->temp_data = 0; } } mjpeg_compressor* mjpeg_new_decompressor(mjpeg_t *mjpeg, int instance) { - mjpeg_compressor *result = calloc(1, sizeof(mjpeg_compressor)); + mjpeg_compressor *result = new mjpeg_compressor(); + memset(result, 0, sizeof(mjpeg_compressor)); pthread_attr_t attr; pthread_mutexattr_t mutex_attr; @@ -882,9 +890,9 @@ mjpeg_compressor* mjpeg_new_decompressor(mjpeg_t *mjpeg, int instance) result->coded_field_h = (result->field_h % 16) ? result->field_h + (16 - (result->field_h % 16)) : result->field_h; - result->mcu_rows[0] = malloc(16 * sizeof(unsigned char*)); - result->mcu_rows[1] = malloc(16 * sizeof(unsigned char*)); - result->mcu_rows[2] = malloc(16 * sizeof(unsigned char*)); + result->mcu_rows[0] = new unsigned char *[16]; + result->mcu_rows[1] = new unsigned char *[16]; + result->mcu_rows[2] = new unsigned char *[16]; pthread_mutexattr_init(&mutex_attr); // pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_ADAPTIVE_NP); @@ -894,7 +902,7 @@ mjpeg_compressor* mjpeg_new_decompressor(mjpeg_t *mjpeg, int instance) pthread_mutex_lock(&(result->output_lock)); pthread_attr_init(&attr); - pthread_create(&(result->tid), &attr, (void*)mjpeg_decompress_loop, result); + pthread_create(&(result->tid), &attr, (void*(*)(void*))mjpeg_decompress_loop, result); return result; } @@ -908,17 +916,18 @@ void mjpeg_delete_decompressor(mjpeg_compressor *engine) pthread_mutex_destroy(&(engine->output_lock)); jpeg_destroy_decompress(&(engine->jpeg_decompress)); delete_rows(engine); - free(engine->mcu_rows[0]); - free(engine->mcu_rows[1]); - free(engine->mcu_rows[2]); - free(engine); + delete [] engine->mcu_rows[0]; + delete [] engine->mcu_rows[1]; + delete [] engine->mcu_rows[2]; + delete engine; } mjpeg_compressor* mjpeg_new_compressor(mjpeg_t *mjpeg, int instance) { pthread_attr_t attr; pthread_mutexattr_t mutex_attr; - mjpeg_compressor *result = calloc(1, sizeof(mjpeg_compressor)); + mjpeg_compressor *result = new mjpeg_compressor(); + memset(result, 0, sizeof(mjpeg_compressor)); result->field_h = mjpeg->output_h / mjpeg->fields; result->coded_field_h = (result->field_h % 16) ? @@ -966,9 +975,9 @@ mjpeg_compressor* mjpeg_new_compressor(mjpeg_t *mjpeg, int instance) } allocate_temps(mjpeg); - result->mcu_rows[0] = malloc(16 * sizeof(unsigned char*)); - result->mcu_rows[1] = malloc(16 * sizeof(unsigned char*)); - result->mcu_rows[2] = malloc(16 * sizeof(unsigned char*)); + result->mcu_rows[0] = new unsigned char *[16]; + result->mcu_rows[1] = new unsigned char *[16]; + result->mcu_rows[2] = new unsigned char *[16]; pthread_mutexattr_init(&mutex_attr); // pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_ADAPTIVE_NP); @@ -978,7 +987,7 @@ mjpeg_compressor* mjpeg_new_compressor(mjpeg_t *mjpeg, int instance) pthread_mutex_lock(&(result->output_lock)); pthread_attr_init(&attr); - pthread_create(&(result->tid), &attr, (void*)mjpeg_compress_loop, result); + pthread_create(&(result->tid), &attr, (void*(*)(void*))mjpeg_compress_loop, result); return result; } @@ -991,12 +1000,12 @@ void mjpeg_delete_compressor(mjpeg_compressor *engine) pthread_mutex_destroy(&(engine->input_lock)); pthread_mutex_destroy(&(engine->output_lock)); jpeg_destroy((j_common_ptr)&(engine->jpeg_compress)); - if(engine->output_buffer) free(engine->output_buffer); + if(engine->output_buffer) delete [] engine->output_buffer; delete_rows(engine); - free(engine->mcu_rows[0]); - free(engine->mcu_rows[1]); - free(engine->mcu_rows[2]); - free(engine); + delete [] engine->mcu_rows[0]; + delete [] engine->mcu_rows[1]; + delete [] engine->mcu_rows[2]; + delete engine; } unsigned char* mjpeg_output_buffer(mjpeg_t *mjpeg) @@ -1068,7 +1077,7 @@ int mjpeg_compress(mjpeg_t *mjpeg, * printf("mjpeg_compress %d %d %d %d\n", * mjpeg->output_w, mjpeg->output_h, mjpeg->coded_w, mjpeg->coded_h); */ - cmodel_transfer(0, + BC_CModels::transfer(0, row_pointers, mjpeg->temp_rows[0][0], mjpeg->temp_rows[1][0], @@ -1236,7 +1245,7 @@ int mjpeg_decompress(mjpeg_t *mjpeg, * mjpeg->color_model); */ - cmodel_transfer(row_pointers, + BC_CModels::transfer(row_pointers, 0, y_plane, u_plane, @@ -1298,7 +1307,8 @@ mjpeg_t* mjpeg_new(int w, int h, int fields) { - mjpeg_t *result = calloc(1, sizeof(mjpeg_t)); + mjpeg_t *result = new mjpeg_t(); + memset(result, 0, sizeof(*result)); pthread_mutexattr_t mutex_attr; result->output_w = w; @@ -1350,7 +1360,7 @@ void mjpeg_delete(mjpeg_t *mjpeg) //printf("mjpeg_delete 6\n"); delete_buffer(&mjpeg->output_data, &mjpeg->output_size, &mjpeg->output_allocated); //printf("mjpeg_delete 7\n"); - free(mjpeg); + delete mjpeg; //printf("mjpeg_delete 2\n"); } @@ -1367,7 +1377,10 @@ static void insert_space(unsigned char **buffer, if(*buffer_allocated - *buffer_size < space_len) { *buffer_allocated += space_len; - *buffer = realloc(*buffer, *buffer_allocated); + unsigned char *new_buffer = new unsigned char[*buffer_allocated]; + memcpy(new_buffer, *buffer, *buffer_size); + delete [] *buffer; + *buffer = new_buffer; } // Shift data back @@ -1488,7 +1501,7 @@ static int find_marker(unsigned char *buffer, while(!result && *offset < buffer_size - 1) { - int marker = next_marker(buffer, offset, buffer_size); + unsigned int marker = next_marker(buffer, offset, buffer_size); if(marker == (marker_type & 0xff)) result = 1; } diff --git a/cinelerra-5.0/quicktime/libmjpeg.h b/cinelerra-5.0/cinelerra/libmjpeg.h similarity index 99% rename from cinelerra-5.0/quicktime/libmjpeg.h rename to cinelerra-5.0/cinelerra/libmjpeg.h index 9c600e80..a23b09be 100644 --- a/cinelerra-5.0/quicktime/libmjpeg.h +++ b/cinelerra-5.0/cinelerra/libmjpeg.h @@ -38,6 +38,8 @@ extern "C" { #define MAXFIELDS 2 #define QUICKTIME_MJPA_MARKSIZE 40 #define QUICKTIME_JPEG_TAG 0x6d6a7067 +#define CODEC_TAG_MJPEG "mjpg" +#define CODEC_TAG_JPEG "jpeg" struct mjpeg_error_mgr { diff --git a/cinelerra-5.0/cinelerra/menuveffects.C b/cinelerra-5.0/cinelerra/menuveffects.C index 12a78d04..ab2edf4a 100644 --- a/cinelerra-5.0/cinelerra/menuveffects.C +++ b/cinelerra-5.0/cinelerra/menuveffects.C @@ -30,7 +30,6 @@ #include "mwindowgui.h" #include "menuveffects.h" #include "patchbay.h" -#include "quicktime.h" #include "tracks.h" #include "units.h" #include "vpluginarray.h" @@ -65,38 +64,23 @@ int MenuVEffectThread::get_recordable_tracks(Asset *asset) int MenuVEffectThread::get_derived_attributes(Asset *asset, BC_Hash *defaults) { - asset->load_defaults(defaults, - "VEFFECT_", - 1, - 1, - 1, - 0, - 0); - - - + asset->load_defaults(defaults, "VEFFECT_", 1, 1, 1, 0, 0); // Fix asset for video only - if(!File::supports_video(asset->format)) asset->format = FILE_MOV; + if(!File::supports_video(asset->format)) { + asset->format = FILE_FFMPEG; + strcpy(asset->vcodec, "mp4"); + } + asset->audio_data = 0; asset->video_data = 1; - - return 0; } int MenuVEffectThread::save_derived_attributes(Asset *asset, BC_Hash *defaults) { - asset->save_defaults(defaults, - "VEFFECT_", - 1, - 1, - 1, - 0, - 0); - - + asset->save_defaults(defaults, "VEFFECT_", 1, 1, 1, 0, 0); return 0; } diff --git a/cinelerra-5.0/cinelerra/mwindow.C b/cinelerra-5.0/cinelerra/mwindow.C index 4c3bf0bc..a53bd4c8 100644 --- a/cinelerra-5.0/cinelerra/mwindow.C +++ b/cinelerra-5.0/cinelerra/mwindow.C @@ -34,7 +34,7 @@ #include "channeldb.h" #include "channelinfo.h" #include "clip.h" -#include "colormodels.h" +#include "bccmodels.h" #include "commercials.h" #include "cplayback.h" #include "ctimebar.h" @@ -804,25 +804,25 @@ void MWindow::init_channeldb() void MWindow::init_menus() { char string[BCTEXTLEN]; - cmodel_to_text(string, BC_RGB888); + BC_CModels::to_text(string, BC_RGB888); colormodels.append(new ColormodelItem(string, BC_RGB888)); - cmodel_to_text(string, BC_RGBA8888); + BC_CModels::to_text(string, BC_RGBA8888); colormodels.append(new ColormodelItem(string, BC_RGBA8888)); -// cmodel_to_text(string, BC_RGB161616); +// BC_CModels::to_text(string, BC_RGB161616); // colormodels.append(new ColormodelItem(string, BC_RGB161616)); -// cmodel_to_text(string, BC_RGBA16161616); +// BC_CModels::to_text(string, BC_RGBA16161616); // colormodels.append(new ColormodelItem(string, BC_RGBA16161616)); - cmodel_to_text(string, BC_RGB_FLOAT); + BC_CModels::to_text(string, BC_RGB_FLOAT); colormodels.append(new ColormodelItem(string, BC_RGB_FLOAT)); - cmodel_to_text(string, BC_RGBA_FLOAT); + BC_CModels::to_text(string, BC_RGBA_FLOAT); colormodels.append(new ColormodelItem(string, BC_RGBA_FLOAT)); - cmodel_to_text(string, BC_YUV888); + BC_CModels::to_text(string, BC_YUV888); colormodels.append(new ColormodelItem(string, BC_YUV888)); - cmodel_to_text(string, BC_YUVA8888); + BC_CModels::to_text(string, BC_YUVA8888); colormodels.append(new ColormodelItem(string, BC_YUVA8888)); -// cmodel_to_text(string, BC_YUV161616); +// BC_CModels::to_text(string, BC_YUV161616); // colormodels.append(new ColormodelItem(string, BC_YUV161616)); -// cmodel_to_text(string, BC_YUVA16161616); +// BC_CModels::to_text(string, BC_YUVA16161616); // colormodels.append(new ColormodelItem(string, BC_YUVA16161616)); } diff --git a/cinelerra-5.0/cinelerra/playbackprefs.C b/cinelerra-5.0/cinelerra/playbackprefs.C index b1e8bf66..a363f26f 100644 --- a/cinelerra-5.0/cinelerra/playbackprefs.C +++ b/cinelerra-5.0/cinelerra/playbackprefs.C @@ -172,12 +172,7 @@ SET_TRACE vscaling_equation->create_objects(); SET_TRACE y += 35; - add_subwindow(new BC_Title(x, y, _("Preload buffer for Quicktime:"), MEDIUMFONT)); - sprintf(string, "" _LD "", pwindow->thread->edl->session->playback_preload); - PlaybackPreload *preload; - add_subwindow(preload = new PlaybackPreload(x + 210, y, pwindow, this, string)); - y += preload->get_h() + 5; add_subwindow(title1 = new BC_Title(x, y, _("DVD Subtitle to display:"))); PlaybackSubtitleNumber *subtitle_number; subtitle_number = new PlaybackSubtitleNumber(x + title1->get_w() + 10, @@ -325,21 +320,6 @@ int PlaybackMap51_2::handle_event() } -PlaybackPreload::PlaybackPreload(int x, int y, - PreferencesWindow *pwindow, PlaybackPrefs *playback, char *text) - : BC_TextBox(x, y, 100, 1, text) -{ - this->pwindow = pwindow; - this->playback = playback; -} - -int PlaybackPreload::handle_event() -{ - pwindow->thread->edl->session->playback_preload = atol(get_text()); - return 1; -} - - PlaybackInterpolateRaw::PlaybackInterpolateRaw( int x, int y, PreferencesWindow *pwindow, PlaybackPrefs *playback) : BC_CheckBox(x, diff --git a/cinelerra-5.0/cinelerra/record.C b/cinelerra-5.0/cinelerra/record.C index 42cd9da4..ffa2b282 100644 --- a/cinelerra-5.0/cinelerra/record.C +++ b/cinelerra-5.0/cinelerra/record.C @@ -39,7 +39,6 @@ #include "errorbox.h" #include "file.h" #include "filexml.h" -#include "filemov.h" #include "filesystem.h" #include "filethread.h" #include "format.inc" @@ -48,6 +47,8 @@ #include "keys.h" #include "language.h" #include "localsession.h" +#include "libdv.h" +#include "libmjpeg.h" #include "mainmenu.h" #include "mainundo.h" #include "mwindow.h" @@ -56,7 +57,6 @@ #include "picture.h" #include "playbackengine.h" #include "preferences.h" -#include "quicktime.h" #include "record.h" #include "recordaudio.h" #include "recordconfig.h" @@ -200,23 +200,25 @@ int Record::load_defaults() default_asset->layers = 1; // Fix encoding parameters depending on driver. // These are locked by a specific driver. + const char *vcodec = 0; switch( session->vconfig_in->driver ) { case CAPTURE_LML: case CAPTURE_BUZ: - strncpy(default_asset->vcodec, QUICKTIME_MJPA, 4); + vcodec = CODEC_TAG_MJPEG; break; case CAPTURE_DVB: case VIDEO4LINUX2MPEG: break; case VIDEO4LINUX2JPEG: - if( strncmp(default_asset->vcodec,QUICKTIME_MJPG,4) != 0 ) - strncpy(default_asset->vcodec,QUICKTIME_MJPA,4); + vcodec = CODEC_TAG_MJPEG; break; case CAPTURE_FIREWIRE: case CAPTURE_IEC61883: - strncpy(default_asset->vcodec, QUICKTIME_DVSD, 4); + vcodec = CODEC_TAG_DVSD; break; } + if( vcodec ) + strcpy(default_asset->vcodec, vcodec); record_batches.load_defaults(channeldb, this); diff --git a/cinelerra-5.0/cinelerra/recordgui.C b/cinelerra-5.0/cinelerra/recordgui.C index feb38dfa..bd45c323 100644 --- a/cinelerra-5.0/cinelerra/recordgui.C +++ b/cinelerra-5.0/cinelerra/recordgui.C @@ -31,7 +31,6 @@ #include "edl.h" #include "edlsession.h" #include "file.h" -#include "filemov.h" #include "filesystem.h" #include "keys.h" #include "language.h" @@ -292,9 +291,8 @@ void RecordGUI::create_objects() if(asset->video_data) { add_subwindow(new BC_Title(x, y, - asset->format != FILE_MPEG ? - FileMOV::compressiontostr(asset->vcodec) : - _("File Capture"), + asset->format == FILE_MPEG ? _("File Capture") : + File::compressiontostr(asset->vcodec), MEDIUMFONT, mwindow->theme->recordgui_fixed_color)); diff --git a/cinelerra-5.0/cinelerra/recordvideo.C b/cinelerra-5.0/cinelerra/recordvideo.C index a6d8c200..2abd343a 100644 --- a/cinelerra-5.0/cinelerra/recordvideo.C +++ b/cinelerra-5.0/cinelerra/recordvideo.C @@ -30,11 +30,11 @@ #include "file.h" #include "filethread.h" #include "language.h" +#include "libmjpeg.h" #include "mutex.h" #include "mwindow.h" #include "mwindowgui.h" #include "preferences.h" -#include "quicktime.h" #include "record.h" #include "recordaudio.h" #include "recordgui.h" @@ -261,7 +261,7 @@ int RecordVideo::read_buffer(VFrame *frame) void RecordVideo::decompress_buffer(VFrame *frame) { - if( !strncmp(record->default_asset->vcodec, QUICKTIME_MJPA, 4) && + if( !strcmp(record->default_asset->vcodec, CODEC_TAG_MJPEG) && record->vdevice->is_compressed(0, 1)) { unsigned char *data = frame->get_data(); int64_t size = frame->get_compressed_size(); diff --git a/cinelerra-5.0/cinelerra/render.C b/cinelerra-5.0/cinelerra/render.C index d4dabf3d..5998aa57 100644 --- a/cinelerra-5.0/cinelerra/render.C +++ b/cinelerra-5.0/cinelerra/render.C @@ -63,7 +63,6 @@ #include "playabletracks.h" #include "preferences.h" #include "preferencesthread.h" -#include "quicktime.h" #include "renderfarm.h" #include "render.h" #include "statusbar.h" @@ -430,7 +429,6 @@ int Render::check_asset(EDL *edl, Asset &asset) { asset.audio_data = 1; asset.channels = edl->session->audio_channels; - if(asset.format == FILE_MOV) asset.byte_order = 0; } else { diff --git a/cinelerra-5.0/cinelerra/resourcepixmap.C b/cinelerra-5.0/cinelerra/resourcepixmap.C index a8c0f8a7..679aa6f8 100644 --- a/cinelerra-5.0/cinelerra/resourcepixmap.C +++ b/cinelerra-5.0/cinelerra/resourcepixmap.C @@ -28,7 +28,7 @@ #include "bcsignals.h" #include "cache.h" #include "clip.h" -#include "colormodels.h" +#include "bccmodels.h" #include "datatype.h" #include "edit.h" #include "edits.h" diff --git a/cinelerra-5.0/cinelerra/vdevice1394.h b/cinelerra-5.0/cinelerra/vdevice1394.h index 2a795fee..72f66e29 100644 --- a/cinelerra-5.0/cinelerra/vdevice1394.h +++ b/cinelerra-5.0/cinelerra/vdevice1394.h @@ -28,7 +28,6 @@ #include "iec61883input.inc" #include "iec61883output.inc" #include "libdv.h" -#include "quicktime.h" #include "sema.h" #include "vdevicebase.h" diff --git a/cinelerra-5.0/cinelerra/vdevicebuz.h b/cinelerra-5.0/cinelerra/vdevicebuz.h index 35ed7683..86a8eaaa 100644 --- a/cinelerra-5.0/cinelerra/vdevicebuz.h +++ b/cinelerra-5.0/cinelerra/vdevicebuz.h @@ -105,7 +105,6 @@ private: char *input_buffer, *frame_buffer, *output_buffer; long frame_size, frame_allocated; int input_error; -// quicktime_mjpeg_hdr jpeg_header; long last_frame_no; ArrayList render_strategies; // Temporary frame for compressing output data diff --git a/cinelerra-5.0/cinelerra/vdevicelml.C b/cinelerra-5.0/cinelerra/vdevicelml.C index 84c63f8d..d200b7ba 100644 --- a/cinelerra-5.0/cinelerra/vdevicelml.C +++ b/cinelerra-5.0/cinelerra/vdevicelml.C @@ -238,9 +238,6 @@ retry: // Insert the required information if(!input_error) { -// quicktime_fixmarker_jpeg(&jpeg_header, (char*)frame_buffer, frame1_size, !device->odd_field_first); -// quicktime_fixmarker_jpeg(&jpeg_header, (char*)frame_buffer + frame1_size, frame2_size, device->odd_field_first); - // Store in the VFrame frame->allocate_compressed_data(frame_size); diff --git a/cinelerra-5.0/cinelerra/vdevicelml.h b/cinelerra-5.0/cinelerra/vdevicelml.h index af0e7efb..7f7daf1f 100644 --- a/cinelerra-5.0/cinelerra/vdevicelml.h +++ b/cinelerra-5.0/cinelerra/vdevicelml.h @@ -25,9 +25,7 @@ #include "guicast.h" #include "vdevicebase.h" -// ./quicktime #include "jpeg.h" -#include "quicktime.h" #define INPUT_BUFFER_SIZE 65536 diff --git a/cinelerra-5.0/cinelerra/vdevicev4l.C b/cinelerra-5.0/cinelerra/vdevicev4l.C index 06755526..4fc7a90e 100644 --- a/cinelerra-5.0/cinelerra/vdevicev4l.C +++ b/cinelerra-5.0/cinelerra/vdevicev4l.C @@ -37,7 +37,6 @@ #include "file.h" #include "picture.h" #include "preferences.h" -#include "quicktime.h" #include "recordconfig.h" #include "vdevicev4l.h" #include "vframe.h" diff --git a/cinelerra-5.0/cinelerra/vdevicex11.C b/cinelerra-5.0/cinelerra/vdevicex11.C index 1bdafeed..830a9a04 100644 --- a/cinelerra-5.0/cinelerra/vdevicex11.C +++ b/cinelerra-5.0/cinelerra/vdevicex11.C @@ -23,7 +23,7 @@ #include "bccapture.h" #include "bcsignals.h" #include "canvas.h" -#include "colormodels.h" +#include "bccmodels.h" #include "edl.h" #include "edlsession.h" #include "mwindow.h" diff --git a/cinelerra-5.0/cinelerra/videodevice.C b/cinelerra-5.0/cinelerra/videodevice.C index 104f11fb..e5f78e88 100644 --- a/cinelerra-5.0/cinelerra/videodevice.C +++ b/cinelerra-5.0/cinelerra/videodevice.C @@ -30,6 +30,8 @@ #include "edlsession.h" #include "file.inc" #include "../hvirtual_config.h" +#include "libdv.h" +#include "libmjpeg.h" #include "mainmenu.h" #include "mutex.h" #include "mwindow.h" @@ -375,32 +377,27 @@ int VideoDevice::is_compressed(int use_file, int use_fixed) void VideoDevice::fix_asset(Asset *asset, int driver) { // Fix asset using legacy routine - switch(driver) - { - case CAPTURE_JPEG_WEBCAM: - if(asset->format != FILE_AVI && - asset->format != FILE_MOV) - asset->format = FILE_MOV; - strcpy(asset->vcodec, QUICKTIME_JPEG); - break; - - case CAPTURE_BUZ: - case CAPTURE_LML: - case VIDEO4LINUX2JPEG: - if(asset->format != FILE_AVI && - asset->format != FILE_MOV) - asset->format = FILE_MOV; - if( strncmp(asset->vcodec,QUICKTIME_MJPG,4) != 0 ) - strncpy(asset->vcodec,QUICKTIME_MJPA,4); - return; - - case CAPTURE_FIREWIRE: - case CAPTURE_IEC61883: - if(asset->format != FILE_AVI && - asset->format != FILE_MOV) - asset->format = FILE_MOV; - strcpy(asset->vcodec, QUICKTIME_DVSD); - return; + const char *vcodec = 0; + switch(driver) { + case CAPTURE_IEC61883: + case CAPTURE_FIREWIRE: + vcodec = CODEC_TAG_DVSD; + break; + + case CAPTURE_BUZ: + case CAPTURE_LML: + case VIDEO4LINUX2JPEG: + vcodec = CODEC_TAG_MJPEG; + break; + + case CAPTURE_JPEG_WEBCAM: + vcodec = CODEC_TAG_JPEG; + break; + } + if( vcodec ) { + asset->format = FILE_FFMPEG; + strcpy(asset->vcodec, vcodec); + return; } // Fix asset using inherited routine diff --git a/cinelerra-5.0/configure b/cinelerra-5.0/configure index c9167acf..701faf42 100755 --- a/cinelerra-5.0/configure +++ b/cinelerra-5.0/configure @@ -160,14 +160,6 @@ if [ $? -ne 0 ]; then exit 1 fi -# fix libraries -echo CONFIGURING QUICKTIME -cd quicktime* && ./configure && cd .. -if [ $? -ne 0 ]; then - echo "Error in quicktime configuration." - exit 1 -fi - echo CONFIGURING LIBZMPEG3 cd libzmpeg3* && ./configure && cd .. if [ $? -ne 0 ]; then diff --git a/cinelerra-5.0/db/s.C b/cinelerra-5.0/db/s.C deleted file mode 100644 index efe22a3e..00000000 --- a/cinelerra-5.0/db/s.C +++ /dev/null @@ -1,731 +0,0 @@ -#include "s.h" - - -int Video_frameLoc::ikey_Frame_weight:: -cmpr(char *a, char *b) -{ - ikey_Frame_weight *kp = (ikey_Frame_weight *)a; - int v = *(int*)b; - if( kp->v_id == v ) return 0; - Video_frameLoc vloc(kp->loc.entity); - if( vloc.FindId(v) ) - vloc.err_(Db::errCorrupt); - v = cmpr_double( kp->v_Frame_mean.addr(), kp->v_Frame_mean.size(), - vloc._Frame_mean(), vloc->v_Frame_mean.size()); - if( v != 0 ) return v; - if( kp->v_id >= 0 ) { - v = cmpr_int(&kp->v_id, sizeof(kp->v_id), - vloc._id(), vloc._id_size()); - if( v != 0 ) return v; - } - return 0; -} - -int Video_frameLoc::rkey_Frame_weight:: -cmpr(char *a, char *b) -{ - rkey_Frame_weight *kp = (rkey_Frame_weight *)a; - Video_frameLoc &kloc = (Video_frameLoc&)kp->loc; - int v = kloc->id, b_id = *(int*)b; - if( v == b_id ) return 0; - Video_frameLoc vloc(kloc.entity); - if( vloc.FindId(b_id) ) - kloc.err_(Db::errCorrupt); - v = cmpr_double( kloc._Frame_mean(), kloc->v_Frame_mean.size(), - vloc._Frame_mean(), vloc->v_Frame_mean.size()); - if( v != 0 ) return v; - v = cmpr_int(kloc._id(), kloc._id_size(), - vloc._id(), vloc._id_size()); - if( v != 0 ) return v; - return 0; -} - -int Video_frameLoc::ikey_Frame_center:: -cmpr(char *a, char *b) -{ - ikey_Frame_center *kp = (ikey_Frame_center *)a; - int v = *(int*)b; - if( kp->v_id == v ) return 0; - Video_frameLoc vloc(kp->loc.entity); - if( vloc.FindId(v) ) - vloc.err_(Db::errCorrupt); - v = cmpr_double( kp->v_Frame_moment.addr(), kp->v_Frame_moment.size(), - vloc._Frame_moment(), vloc->v_Frame_moment.size()); - if( v != 0 ) return v; - if( kp->v_id >= 0 ) { - v = cmpr_int(&kp->v_id, sizeof(kp->v_id), - vloc._id(), vloc._id_size()); - if( v != 0 ) return v; - } - return 0; -} - -int Video_frameLoc::rkey_Frame_center:: -cmpr(char *a, char *b) -{ - rkey_Frame_center *kp = (rkey_Frame_center *)a; - Video_frameLoc &kloc = (Video_frameLoc&)kp->loc; - int v = kloc->id, b_id = *(int*)b; - if( v == b_id ) return 0; - Video_frameLoc vloc(kloc.entity); - if( vloc.FindId(b_id) ) - kloc.err_(Db::errCorrupt); - v = cmpr_double( kloc._Frame_moment(), kloc->v_Frame_moment.size(), - vloc._Frame_moment(), vloc->v_Frame_moment.size()); - if( v != 0 ) return v; - v = cmpr_int(kloc._id(), kloc._id_size(), - vloc._id(), vloc._id_size()); - if( v != 0 ) return v; - return 0; -} - -int Video_frameLoc::Allocate() -{ - if_err( allocate() ); - if( !addr_wr() ) return err_(Db::errNoMemory); - v_init(); - return 0; -} - -int Video_frameLoc::Construct() -{ - if_err( insertProhibit() ); - if_err( construct() ); - int id = this->id(); - { rkey_Frame_weight rkey(*this); - if_err( entity->index("Frame_weight")->Insert(rkey,&id) ); } - { rkey_Frame_center rkey(*this); - if_err( entity->index("Frame_center")->Insert(rkey,&id) ); } - if_err( insertCascade() ); - return 0; -} - -int Video_frameLoc::Destruct() -{ - if_err( deleteProhibit() ); - { rkey_Frame_weight rkey(*this); - if_err( entity->index("Frame_weight")->Delete(rkey) ); } - { rkey_Frame_center rkey(*this); - if_err( entity->index("Frame_center")->Delete(rkey) ); } - if_err( destruct() ); - if_err( deleteCascade() ); - return 0; -} - -void Video_frameLoc::Deallocate() -{ - v_del(); - deallocate(); -} - - -int TimelineLoc::ikey_Timelines:: -cmpr(char *a, char *b) -{ - ikey_Timelines *kp = (ikey_Timelines *)a; - int v = *(int*)b; - if( kp->v_id == v ) return 0; - TimelineLoc vloc(kp->loc.entity); - if( vloc.FindId(v) ) - vloc.err_(Db::errCorrupt); - v = cmpr_uint( kp->v_Frame_id.addr(), kp->v_Frame_id.size(), - vloc._Frame_id(), vloc->v_Frame_id.size()); - if( v != 0 ) return v; - if( kp->v_id >= 0 ) { - v = cmpr_int(&kp->v_id, sizeof(kp->v_id), - vloc._id(), vloc._id_size()); - if( v != 0 ) return v; - } - return 0; -} - -int TimelineLoc::rkey_Timelines:: -cmpr(char *a, char *b) -{ - rkey_Timelines *kp = (rkey_Timelines *)a; - TimelineLoc &kloc = (TimelineLoc&)kp->loc; - int v = kloc->id, b_id = *(int*)b; - if( v == b_id ) return 0; - TimelineLoc vloc(kloc.entity); - if( vloc.FindId(b_id) ) - kloc.err_(Db::errCorrupt); - v = cmpr_uint( kloc._Frame_id(), kloc->v_Frame_id.size(), - vloc._Frame_id(), vloc->v_Frame_id.size()); - if( v != 0 ) return v; - v = cmpr_int(kloc._id(), kloc._id_size(), - vloc._id(), vloc._id_size()); - if( v != 0 ) return v; - return 0; -} - -int TimelineLoc::ikey_Sequences:: -cmpr(char *a, char *b) -{ - ikey_Sequences *kp = (ikey_Sequences *)a; - int v = *(int*)b; - TimelineLoc vloc(kp->loc.entity); - if( vloc.FindId(v) ) - vloc.err_(Db::errCorrupt); - v = cmpr_uint( kp->v_Clip_id.addr(), kp->v_Clip_id.size(), - vloc._Clip_id(), vloc->v_Clip_id.size()); - if( v != 0 ) return v; - v = cmpr_uint( kp->v_Sequence_no.addr(), kp->v_Sequence_no.size(), - vloc._Sequence_no(), vloc->v_Sequence_no.size()); - if( v != 0 ) return v; - return 0; -} - -int TimelineLoc::rkey_Sequences:: -cmpr(char *a, char *b) -{ - rkey_Sequences *kp = (rkey_Sequences *)a; - TimelineLoc &kloc = (TimelineLoc&)kp->loc; - int v = kloc->id, b_id = *(int*)b; - if( v == b_id ) return 0; - TimelineLoc vloc(kloc.entity); - if( vloc.FindId(b_id) ) - kloc.err_(Db::errCorrupt); - v = cmpr_uint( kloc._Clip_id(), kloc->v_Clip_id.size(), - vloc._Clip_id(), vloc->v_Clip_id.size()); - if( v != 0 ) return v; - v = cmpr_uint( kloc._Sequence_no(), kloc->v_Sequence_no.size(), - vloc._Sequence_no(), vloc->v_Sequence_no.size()); - if( v != 0 ) return v; - return 0; -} - -int TimelineLoc::Allocate() -{ - if_err( allocate() ); - if( !addr_wr() ) return err_(Db::errNoMemory); - return 0; -} - -int TimelineLoc::Construct() -{ - if_err( insertProhibit() ); - if_err( construct() ); - int id = this->id(); - { rkey_Timelines rkey(*this); - if_err( entity->index("Timelines")->Insert(rkey,&id) ); } - { rkey_Sequences rkey(*this); - if_err( entity->index("Sequences")->Insert(rkey,&id) ); } - if_err( insertCascade() ); - return 0; -} - -int TimelineLoc::Destruct() -{ - if_err( deleteProhibit() ); - { rkey_Timelines rkey(*this); - if_err( entity->index("Timelines")->Delete(rkey) ); } - { rkey_Sequences rkey(*this); - if_err( entity->index("Sequences")->Delete(rkey) ); } - if_err( destruct() ); - if_err( deleteCascade() ); - return 0; -} - -void TimelineLoc::Deallocate() -{ - deallocate(); -} - - -int Clip_setLoc::ikey_Clip_title:: -cmpr(char *a, char *b) -{ - ikey_Clip_title *kp = (ikey_Clip_title *)a; - int v = *(int*)b; - if( kp->v_id == v ) return 0; - Clip_setLoc vloc(kp->loc.entity); - if( vloc.FindId(v) ) - vloc.err_(Db::errCorrupt); - v = cmpr_char( kp->v_Title.addr(), kp->v_Title.size(), - vloc._Title(), vloc->v_Title.size()); - if( v != 0 ) return v; - if( kp->v_id >= 0 ) { - v = cmpr_int(&kp->v_id, sizeof(kp->v_id), - vloc._id(), vloc._id_size()); - if( v != 0 ) return v; - } - return 0; -} - -int Clip_setLoc::rkey_Clip_title:: -cmpr(char *a, char *b) -{ - rkey_Clip_title *kp = (rkey_Clip_title *)a; - Clip_setLoc &kloc = (Clip_setLoc&)kp->loc; - int v = kloc->id, b_id = *(int*)b; - if( v == b_id ) return 0; - Clip_setLoc vloc(kloc.entity); - if( vloc.FindId(b_id) ) - kloc.err_(Db::errCorrupt); - v = cmpr_char( kloc._Title(), kloc->v_Title.size(), - vloc._Title(), vloc->v_Title.size()); - if( v != 0 ) return v; - v = cmpr_int(kloc._id(), kloc._id_size(), - vloc._id(), vloc._id_size()); - if( v != 0 ) return v; - return 0; -} - -int Clip_setLoc::ikey_Clip_system_time:: -cmpr(char *a, char *b) -{ - ikey_Clip_system_time *kp = (ikey_Clip_system_time *)a; - int v = *(int*)b; - if( kp->v_id == v ) return 0; - Clip_setLoc vloc(kp->loc.entity); - if( vloc.FindId(v) ) - vloc.err_(Db::errCorrupt); - v = cmpr_long( kp->v_System_time.addr(), kp->v_System_time.size(), - vloc._System_time(), vloc->v_System_time.size()); - if( v != 0 ) return v; - if( kp->v_id >= 0 ) { - v = cmpr_int(&kp->v_id, sizeof(kp->v_id), - vloc._id(), vloc._id_size()); - if( v != 0 ) return v; - } - return 0; -} - -int Clip_setLoc::rkey_Clip_system_time:: -cmpr(char *a, char *b) -{ - rkey_Clip_system_time *kp = (rkey_Clip_system_time *)a; - Clip_setLoc &kloc = (Clip_setLoc&)kp->loc; - int v = kloc->id, b_id = *(int*)b; - if( v == b_id ) return 0; - Clip_setLoc vloc(kloc.entity); - if( vloc.FindId(b_id) ) - kloc.err_(Db::errCorrupt); - v = cmpr_long( kloc._System_time(), kloc->v_System_time.size(), - vloc._System_time(), vloc->v_System_time.size()); - if( v != 0 ) return v; - v = cmpr_int(kloc._id(), kloc._id_size(), - vloc._id(), vloc._id_size()); - if( v != 0 ) return v; - return 0; -} - -int Clip_setLoc::ikey_Clip_creation_time:: -cmpr(char *a, char *b) -{ - ikey_Clip_creation_time *kp = (ikey_Clip_creation_time *)a; - int v = *(int*)b; - if( kp->v_id == v ) return 0; - Clip_setLoc vloc(kp->loc.entity); - if( vloc.FindId(v) ) - vloc.err_(Db::errCorrupt); - v = cmpr_long( kp->v_Creation_time.addr(), kp->v_Creation_time.size(), - vloc._Creation_time(), vloc->v_Creation_time.size()); - if( v != 0 ) return v; - if( kp->v_id >= 0 ) { - v = cmpr_int(&kp->v_id, sizeof(kp->v_id), - vloc._id(), vloc._id_size()); - if( v != 0 ) return v; - } - return 0; -} - -int Clip_setLoc::rkey_Clip_creation_time:: -cmpr(char *a, char *b) -{ - rkey_Clip_creation_time *kp = (rkey_Clip_creation_time *)a; - Clip_setLoc &kloc = (Clip_setLoc&)kp->loc; - int v = kloc->id, b_id = *(int*)b; - if( v == b_id ) return 0; - Clip_setLoc vloc(kloc.entity); - if( vloc.FindId(b_id) ) - kloc.err_(Db::errCorrupt); - v = cmpr_long( kloc._Creation_time(), kloc->v_Creation_time.size(), - vloc._Creation_time(), vloc->v_Creation_time.size()); - if( v != 0 ) return v; - v = cmpr_int(kloc._id(), kloc._id_size(), - vloc._id(), vloc._id_size()); - if( v != 0 ) return v; - return 0; -} - -int Clip_setLoc::ikey_Clip_path_pos:: -cmpr(char *a, char *b) -{ - ikey_Clip_path_pos *kp = (ikey_Clip_path_pos *)a; - int v = *(int*)b; - if( kp->v_id == v ) return 0; - Clip_setLoc vloc(kp->loc.entity); - if( vloc.FindId(v) ) - vloc.err_(Db::errCorrupt); - v = cmpr_char( kp->v_Asset_path.addr(), kp->v_Asset_path.size(), - vloc._Asset_path(), vloc->v_Asset_path.size()); - if( v != 0 ) return v; - v = cmpr_double( kp->v_Position.addr(), kp->v_Position.size(), - vloc._Position(), vloc->v_Position.size()); - if( v != 0 ) return v; - if( kp->v_id >= 0 ) { - v = cmpr_int(&kp->v_id, sizeof(kp->v_id), - vloc._id(), vloc._id_size()); - if( v != 0 ) return v; - } - return 0; -} - -int Clip_setLoc::rkey_Clip_path_pos:: -cmpr(char *a, char *b) -{ - rkey_Clip_path_pos *kp = (rkey_Clip_path_pos *)a; - Clip_setLoc &kloc = (Clip_setLoc&)kp->loc; - int v = kloc->id, b_id = *(int*)b; - if( v == b_id ) return 0; - Clip_setLoc vloc(kloc.entity); - if( vloc.FindId(b_id) ) - kloc.err_(Db::errCorrupt); - v = cmpr_char( kloc._Asset_path(), kloc->v_Asset_path.size(), - vloc._Asset_path(), vloc->v_Asset_path.size()); - if( v != 0 ) return v; - v = cmpr_double( kloc._Position(), kloc->v_Position.size(), - vloc._Position(), vloc->v_Position.size()); - if( v != 0 ) return v; - v = cmpr_int(kloc._id(), kloc._id_size(), - vloc._id(), vloc._id_size()); - if( v != 0 ) return v; - return 0; -} - -int Clip_setLoc::Allocate() -{ - if_err( allocate() ); - if( !addr_wr() ) return err_(Db::errNoMemory); - v_init(); - Title((char *)"",0); - Asset_path((char *)"",0); - return 0; -} - -int Clip_setLoc::Construct() -{ - if_err( insertProhibit() ); - if_err( construct() ); - int id = this->id(); - { rkey_Clip_title rkey(*this); - if_err( entity->index("Clip_title")->Insert(rkey,&id) ); } - { rkey_Clip_system_time rkey(*this); - if_err( entity->index("Clip_system_time")->Insert(rkey,&id) ); } - { rkey_Clip_creation_time rkey(*this); - if_err( entity->index("Clip_creation_time")->Insert(rkey,&id) ); } - { rkey_Clip_path_pos rkey(*this); - if_err( entity->index("Clip_path_pos")->Insert(rkey,&id) ); } - if_err( insertCascade() ); - return 0; -} - -int Clip_setLoc::Destruct() -{ - if_err( deleteProhibit() ); - { rkey_Clip_title rkey(*this); - if_err( entity->index("Clip_title")->Delete(rkey) ); } - { rkey_Clip_system_time rkey(*this); - if_err( entity->index("Clip_system_time")->Delete(rkey) ); } - { rkey_Clip_creation_time rkey(*this); - if_err( entity->index("Clip_creation_time")->Delete(rkey) ); } - { rkey_Clip_path_pos rkey(*this); - if_err( entity->index("Clip_path_pos")->Delete(rkey) ); } - if_err( destruct() ); - if_err( deleteCascade() ); - return 0; -} - -void Clip_setLoc::Deallocate() -{ - v_del(); - deallocate(); -} - - -int Clip_viewsLoc::ikey_Clip_access:: -cmpr(char *a, char *b) -{ - ikey_Clip_access *kp = (ikey_Clip_access *)a; - int v = *(int*)b; - Clip_viewsLoc vloc(kp->loc.entity); - if( vloc.FindId(v) ) - vloc.err_(Db::errCorrupt); - v = cmpr_uint( kp->v_Access_clip_id.addr(), kp->v_Access_clip_id.size(), - vloc._Access_clip_id(), vloc->v_Access_clip_id.size()); - if( v != 0 ) return v; - return 0; -} - -int Clip_viewsLoc::rkey_Clip_access:: -cmpr(char *a, char *b) -{ - rkey_Clip_access *kp = (rkey_Clip_access *)a; - Clip_viewsLoc &kloc = (Clip_viewsLoc&)kp->loc; - int v = kloc->id, b_id = *(int*)b; - if( v == b_id ) return 0; - Clip_viewsLoc vloc(kloc.entity); - if( vloc.FindId(b_id) ) - kloc.err_(Db::errCorrupt); - v = cmpr_uint( kloc._Access_clip_id(), kloc->v_Access_clip_id.size(), - vloc._Access_clip_id(), vloc->v_Access_clip_id.size()); - if( v != 0 ) return v; - return 0; -} - -int Clip_viewsLoc::ikey_Last_view:: -cmpr(char *a, char *b) -{ - ikey_Last_view *kp = (ikey_Last_view *)a; - int v = *(int*)b; - if( kp->v_id == v ) return 0; - Clip_viewsLoc vloc(kp->loc.entity); - if( vloc.FindId(v) ) - vloc.err_(Db::errCorrupt); - v = cmpr_long( kp->v_Access_time.addr(), kp->v_Access_time.size(), - vloc._Access_time(), vloc->v_Access_time.size()); - if( v != 0 ) return v; - if( kp->v_id >= 0 ) { - v = cmpr_int(&kp->v_id, sizeof(kp->v_id), - vloc._id(), vloc._id_size()); - if( v != 0 ) return v; - } - return 0; -} - -int Clip_viewsLoc::rkey_Last_view:: -cmpr(char *a, char *b) -{ - rkey_Last_view *kp = (rkey_Last_view *)a; - Clip_viewsLoc &kloc = (Clip_viewsLoc&)kp->loc; - int v = kloc->id, b_id = *(int*)b; - if( v == b_id ) return 0; - Clip_viewsLoc vloc(kloc.entity); - if( vloc.FindId(b_id) ) - kloc.err_(Db::errCorrupt); - v = cmpr_long( kloc._Access_time(), kloc->v_Access_time.size(), - vloc._Access_time(), vloc->v_Access_time.size()); - if( v != 0 ) return v; - v = cmpr_int(kloc._id(), kloc._id_size(), - vloc._id(), vloc._id_size()); - if( v != 0 ) return v; - return 0; -} - -int Clip_viewsLoc::ikey_Total_views:: -cmpr(char *a, char *b) -{ - ikey_Total_views *kp = (ikey_Total_views *)a; - int v = *(int*)b; - if( kp->v_id == v ) return 0; - Clip_viewsLoc vloc(kp->loc.entity); - if( vloc.FindId(v) ) - vloc.err_(Db::errCorrupt); - v = cmpr_uint( kp->v_Access_count.addr(), kp->v_Access_count.size(), - vloc._Access_count(), vloc->v_Access_count.size()); - if( v != 0 ) return v; - v = cmpr_uint( kp->v_Access_clip_id.addr(), kp->v_Access_clip_id.size(), - vloc._Access_clip_id(), vloc->v_Access_clip_id.size()); - if( v != 0 ) return v; - if( kp->v_id >= 0 ) { - v = cmpr_int(&kp->v_id, sizeof(kp->v_id), - vloc._id(), vloc._id_size()); - if( v != 0 ) return v; - } - return 0; -} - -int Clip_viewsLoc::rkey_Total_views:: -cmpr(char *a, char *b) -{ - rkey_Total_views *kp = (rkey_Total_views *)a; - Clip_viewsLoc &kloc = (Clip_viewsLoc&)kp->loc; - int v = kloc->id, b_id = *(int*)b; - if( v == b_id ) return 0; - Clip_viewsLoc vloc(kloc.entity); - if( vloc.FindId(b_id) ) - kloc.err_(Db::errCorrupt); - v = cmpr_uint( kloc._Access_count(), kloc->v_Access_count.size(), - vloc._Access_count(), vloc->v_Access_count.size()); - if( v != 0 ) return v; - v = cmpr_uint( kloc._Access_clip_id(), kloc->v_Access_clip_id.size(), - vloc._Access_clip_id(), vloc->v_Access_clip_id.size()); - if( v != 0 ) return v; - v = cmpr_int(kloc._id(), kloc._id_size(), - vloc._id(), vloc._id_size()); - if( v != 0 ) return v; - return 0; -} - -int Clip_viewsLoc::Allocate() -{ - if_err( allocate() ); - if( !addr_wr() ) return err_(Db::errNoMemory); - return 0; -} - -int Clip_viewsLoc::Construct() -{ - if_err( insertProhibit() ); - if_err( construct() ); - int id = this->id(); - { rkey_Clip_access rkey(*this); - if_err( entity->index("Clip_access")->Insert(rkey,&id) ); } - { rkey_Last_view rkey(*this); - if_err( entity->index("Last_view")->Insert(rkey,&id) ); } - { rkey_Total_views rkey(*this); - if_err( entity->index("Total_views")->Insert(rkey,&id) ); } - if_err( insertCascade() ); - return 0; -} - -int Clip_viewsLoc::Destruct() -{ - if_err( deleteProhibit() ); - { rkey_Clip_access rkey(*this); - if_err( entity->index("Clip_access")->Delete(rkey) ); } - { rkey_Last_view rkey(*this); - if_err( entity->index("Last_view")->Delete(rkey) ); } - { rkey_Total_views rkey(*this); - if_err( entity->index("Total_views")->Delete(rkey) ); } - if_err( destruct() ); - if_err( deleteCascade() ); - return 0; -} - -void Clip_viewsLoc::Deallocate() -{ - deallocate(); -} - - -int theDb:: -create(const char *dfn) -{ - dfd = ::open(dfn,O_RDWR+O_CREAT+O_TRUNC+no_atime,0666); - if( dfd < 0 ) { perror(dfn); return -1; } - int ret = db_create(); - close(); - return ret; -} - -int theDb:: -db_create() -{ - if_ret( Db::make(dfd) ); - if_ret( Video_frame.new_entity("Video_frame", sizeof(Video_frameObj)) ); - if_ret( Video_frame.add_kindex("Frame_weight") ); - if_ret( Video_frame.add_kindex("Frame_center") ); - - if_ret( Timeline.new_entity("Timeline", sizeof(TimelineObj)) ); - if_ret( Timeline.add_kindex("Timelines") ); - if_ret( Timeline.add_kindex("Sequences") ); - - if_ret( Clip_set.new_entity("Clip_set", sizeof(Clip_setObj)) ); - if_ret( Clip_set.add_kindex("Clip_title") ); - if_ret( Clip_set.add_kindex("Clip_system_time") ); - if_ret( Clip_set.add_kindex("Clip_creation_time") ); - if_ret( Clip_set.add_kindex("Clip_path_pos") ); - - if_ret( Clip_views.new_entity("Clip_views", sizeof(Clip_viewsObj)) ); - if_ret( Clip_views.add_kindex("Clip_access") ); - if_ret( Clip_views.add_kindex("Last_view") ); - if_ret( Clip_views.add_kindex("Total_views") ); - - if_ret( Db::commit(1) ); - return 0; -} - -theDb:: -theDb() - : dfd(-1), dkey(-1), no_atime(getuid()?0:O_NOATIME), objects(0), - Video_frame(this), video_frame(Video_frame), - Timeline(this), timeline(Timeline), - Clip_set(this), clip_set(Clip_set), - Clip_views(this), clip_views(Clip_views) -{ - objects = new ObjectList(objects, video_frame); - objects = new ObjectList(objects, timeline); - objects = new ObjectList(objects, clip_set); - objects = new ObjectList(objects, clip_views); - Video_frame.add_vref((vRef)&Video_frameObj::v_Frame_data); - Clip_set.add_vref((vRef)&Clip_setObj::v_Title); - Clip_set.add_vref((vRef)&Clip_setObj::v_Asset_path); - Clip_set.add_vref((vRef)&Clip_setObj::v_Weights); -} - -int theDb:: -open(const char *dfn, int key) -{ - dfd = ::open(dfn,O_RDWR+no_atime); - if( dfd < 0 ) { perror(dfn); return errNotFound; } - if( (dkey=key) >= 0 ) Db::use_shm(1); - int ret = Db::open(dfd, dkey); - if( !ret ) ret = db_open(); - if( ret ) close(); - return ret; -} - -int theDb:: -db_open() -{ - if_ret( Video_frame.get_entity("Video_frame") ); - if_ret( Video_frame.key_index("Frame_weight") ); - if_ret( Video_frame.key_index("Frame_center") ); - - if_ret( Timeline.get_entity("Timeline") ); - if_ret( Timeline.key_index("Timelines") ); - if_ret( Timeline.key_index("Sequences") ); - - if_ret( Clip_set.get_entity("Clip_set") ); - if_ret( Clip_set.key_index("Clip_title") ); - if_ret( Clip_set.key_index("Clip_system_time") ); - if_ret( Clip_set.key_index("Clip_creation_time") ); - if_ret( Clip_set.key_index("Clip_path_pos") ); - - if_ret( Clip_views.get_entity("Clip_views") ); - if_ret( Clip_views.key_index("Clip_access") ); - if_ret( Clip_views.key_index("Last_view") ); - if_ret( Clip_views.key_index("Total_views") ); - - if_ret( Db::start_transaction() ); - return 0; -} - -void theDb:: -close() -{ - Db::close(); - if( dfd >= 0 ) { ::close(dfd); dfd = -1; } -} - -int theDb:: -access(const char *dfn, int key, int rw) -{ - if( key < 0 ) return Db::errInvalid; - dfd = ::open(dfn,O_RDWR+no_atime); - if( dfd < 0 ) { perror(dfn); return Db::errNotFound; } - dkey = key; Db::use_shm(1); - int ret = Db::attach(dfd, dkey, rw); - if( !ret ) ret = db_access(); - else if( ret == errNotFound ) { - ret = Db::open(dfd, dkey); - if( !ret ) ret = db_open(); - if( !ret ) ret = Db::attach(rw); - } - if( ret ) close(); - return ret; -} - -int theDb:: -db_access() -{ - if_ret( Video_frame.get_entity("Video_frame") ); - if_ret( Timeline.get_entity("Timeline") ); - if_ret( Clip_set.get_entity("Clip_set") ); - if_ret( Clip_views.get_entity("Clip_views") ); - return 0; -} - - diff --git a/cinelerra-5.0/global_config b/cinelerra-5.0/global_config index 4acf74f9..623a0e33 100644 --- a/cinelerra-5.0/global_config +++ b/cinelerra-5.0/global_config @@ -3,7 +3,6 @@ SHELL := /bin/bash HAVE_ALSA := y HAVE_XFT := y HAVE_ESOUND := y -HAVE_AVIFILE := n HAVE_FIREWIRE := y HAVE_OSS := y STATIC_LIBRARIES := y @@ -68,7 +67,6 @@ endif #CFLAGS += -g CFLAGS += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -#CFLAGS += -I. # Caused fileavi.C to fail # the directory for plugin includes #FREETYPE_DIR := $(shell expr $(THIRDPARTY)/freetype-* ) diff --git a/cinelerra-5.0/mpeg2enc/Makefile b/cinelerra-5.0/mpeg2enc/Makefile index 540920a8..1d210846 100644 --- a/cinelerra-5.0/mpeg2enc/Makefile +++ b/cinelerra-5.0/mpeg2enc/Makefile @@ -2,7 +2,7 @@ include ../global_config include $(THIRDPARTY)/config.mak CC = gcc -CFLAGS += -I../libzmpeg3 -I../quicktime +CFLAGS += -I../libzmpeg3 ifeq ($(OBJDIR), i686) CFLAGS += -DX86_CPU @@ -52,7 +52,6 @@ OBJ = \ $(OBJDIR)/writepic.o LIBS = \ - ../quicktime/$(OBJDIR)/libquicktime.a \ ../libzmpeg3/$(OBJDIR)/libzmpeg3.a \ $(thirdparty_libraries) $(static_libraries) \ -lasound \ diff --git a/cinelerra-5.0/mpeg2enc/global.h b/cinelerra-5.0/mpeg2enc/global.h index d8e76f13..83e1aa3a 100644 --- a/cinelerra-5.0/mpeg2enc/global.h +++ b/cinelerra-5.0/mpeg2enc/global.h @@ -29,7 +29,6 @@ #include "libzmpeg3.h" #include "mpeg2enc.h" -#include "quicktime.h" #include #include @@ -464,7 +463,6 @@ EXTERN_ uint8_t ***frame_buffers; /* These determine what input format to use */ -EXTERN_ quicktime_t *qt_file; EXTERN_ mpeg3_t *mpeg_file; EXTERN_ int do_stdin; EXTERN_ FILE *stdin_fd; @@ -481,7 +479,6 @@ EXTERN_ int input_buffer_end; EXTERN_ int verbose; -EXTERN_ quicktime_t *qt_output; EXTERN_ unsigned char *frame_buffer; EXTERN_ unsigned char **row_pointers; EXTERN_ int fixed_mquant; diff --git a/cinelerra-5.0/mpeg2enc/mpeg2enc.c b/cinelerra-5.0/mpeg2enc/mpeg2enc.c index 1f757dc5..19c1617a 100644 --- a/cinelerra-5.0/mpeg2enc/mpeg2enc.c +++ b/cinelerra-5.0/mpeg2enc/mpeg2enc.c @@ -138,8 +138,6 @@ int mpeg2enc(int argc, char *argv[]) fclose(outfile); fclose(statfile); - if(qt_file) quicktime_close(qt_file); - if(qt_output) quicktime_close(qt_output); if(mpeg_file) mpeg3_close(mpeg_file); if(do_stdin) @@ -433,7 +431,6 @@ static void readcmdline(int argc, char *argv[]) frame_rate = -1; chroma_format = 1; /* chroma_format: 1=4:2:0, 2=4:2:2, 3=4:4:4 LibMPEG3 only does 1 */ mpeg_file = 0; - qt_file = 0; do_stdin = 0; do_buffers = 1; seq_header_every_gop = 0; @@ -681,35 +678,14 @@ INTTOYES(prog_seq)); mpeg_file = mpeg3_open(tplorg, &error_return); inputtype = T_MPEG; } - else - if(quicktime_check_sig(tplorg)) - { - qt_file = quicktime_open(tplorg, 1, 0); - inputtype = T_QUICKTIME; - } //printf("readcmdline 6\n"); - if(!qt_file && !mpeg_file && !do_stdin && !do_buffers) + if(!mpeg_file && !do_stdin && !do_buffers) { fprintf(stderr, "File format not recognized.\n"); exit(1); } -//printf("readcmdline 7\n"); - if(qt_file) - { - if(!quicktime_video_tracks(qt_file)) - { - fprintf(stderr, "No video tracks in file.\n"); - exit(1); - } - - if(!quicktime_supported_video(qt_file, 0)) - { - fprintf(stderr, "Unsupported video codec.\n"); - exit(1); - } - } //printf("readcmdline 8\n"); /************************************************************************ @@ -722,13 +698,6 @@ INTTOYES(prog_seq)); strcpy(niqname, "-"); /* name of non intra quant matrix file ("-": default matrix) */ strcpy(statname, "/dev/null"); /* name of statistics file ("-": stdout ) */ - if(qt_file) - { - nframes = quicktime_video_length(qt_file, 0); /* number of frames */ - horizontal_size = quicktime_video_width(qt_file, 0); - vertical_size = quicktime_video_height(qt_file, 0); - } - else if(mpeg_file) { nframes = 0x7fffffff; /* Use percentage instead */ @@ -809,11 +778,6 @@ INTTOYES(prog_seq)); prog_seq = 1; } - if(qt_file) - { - input_frame_rate = quicktime_frame_rate(qt_file, 0); - } - else if(mpeg_file) { input_frame_rate = mpeg3_frame_rate(mpeg_file, 0); @@ -976,17 +940,6 @@ INTTOYES(prog_seq)); tc0 = 60*tc0 + s; tc0 = (int)(frame_rate+0.5)*tc0 + f; - qt_output = 0; - - - - - - - - - - if (!mpeg1) { profile_and_level_checks(); diff --git a/cinelerra-5.0/mpeg2enc/readpic.c b/cinelerra-5.0/mpeg2enc/readpic.c index a4536111..aa665187 100644 --- a/cinelerra-5.0/mpeg2enc/readpic.c +++ b/cinelerra-5.0/mpeg2enc/readpic.c @@ -30,116 +30,10 @@ #include #include #include -#include "colormodels.h" #include "config.h" #include "global.h" -static void read_quicktime(frame, number) -unsigned char *frame[]; -long number; -{ - int i, j; - int r, g, b; - int y, u, v; - double cr, cg, cb, cu, cv; - char name[128]; - unsigned char *yp, *up, *vp; - static unsigned char *u444, *v444, *u422, *v422; - static double coef[7][3] = { - {0.2125,0.7154,0.0721}, /* ITU-R Rec. 709 (1990) */ - {0.299, 0.587, 0.114}, /* unspecified */ - {0.299, 0.587, 0.114}, /* reserved */ - {0.30, 0.59, 0.11}, /* FCC */ - {0.299, 0.587, 0.114}, /* ITU-R Rec. 624-4 System B, G */ - {0.299, 0.587, 0.114}, /* SMPTE 170M */ - {0.212, 0.701, 0.087}}; /* SMPTE 240M (1987) */ - static long rtoy_tab[256], gtoy_tab[256], btoy_tab[256]; - static long rtou_tab[256], gtou_tab[256], btou_tab[256]; - static long rtov_tab[256], gtov_tab[256], btov_tab[256]; - static int need_tables = 1; // Initialize tables on first read - int colormodel; - long real_number; - - i = matrix_coefficients; - if(i > 8) i = 3; - - cr = coef[i - 1][0]; - cg = coef[i - 1][1]; - cb = coef[i - 1][2]; - cu = 0.5 / (1.0 - cb); - cv = 0.5 / (1.0 - cr); - -// Allocate output buffers - if(chroma_format == CHROMA444) - { -// Not supported by libMPEG3 - u444 = frame[1]; - v444 = frame[2]; - } - else - { - if (!u444) - { - if (!(u444 = (unsigned char *)malloc(width*height))) - error("malloc failed"); - if (!(v444 = (unsigned char *)malloc(width*height))) - error("malloc failed"); - if (chroma_format==CHROMA420) - { - if (!(u422 = (unsigned char *)malloc((width>>1)*height))) - error("malloc failed"); - if (!(v422 = (unsigned char *)malloc((width>>1)*height))) - error("malloc failed"); - } - } - } - -// Initialize YUV tables - if(need_tables) - { - for(i = 0; i < 256; i++) - { - rtoy_tab[i] = (long)( 0.2990 * 65536 * i); - rtou_tab[i] = (long)(-0.1687 * 65536 * i); - rtov_tab[i] = (long)( 0.5000 * 65536 * i); - - gtoy_tab[i] = (long)( 0.5870 * 65536 * i); - gtou_tab[i] = (long)(-0.3320 * 65536 * i); - gtov_tab[i] = (long)(-0.4187 * 65536 * i); - - btoy_tab[i] = (long)( 0.1140 * 65536 * i); - btou_tab[i] = (long)( 0.5000 * 65536 * i); - btov_tab[i] = (long)(-0.0813 * 65536 * i); - } - need_tables = 0; - } - - real_number = (long)((double)quicktime_frame_rate(qt_file, 0) / - frame_rate * - number + - 0.5); - quicktime_set_video_position(qt_file, - real_number, - 0); - -//printf("readframe 1 %d %d\n", width, height); - quicktime_set_row_span(qt_file, width); - quicktime_set_window(qt_file, - 0, - 0, - horizontal_size, - vertical_size, - horizontal_size, - vertical_size); - quicktime_set_cmodel(qt_file, (chroma_format == 1) ? BC_YUV420P : BC_YUV422P); - - quicktime_decode_video(qt_file, - frame, - 0); -//printf("readframe 2\n"); -} - static void read_mpeg(long number, unsigned char *frame[]) { int i; @@ -224,9 +118,6 @@ void readframe(int frame_num, uint8_t *frame[]) switch (inputtype) { - case T_QUICKTIME: - read_quicktime(frame, frame_num); - break; case T_MPEG: read_mpeg(frame_num, frame); break; diff --git a/cinelerra-5.0/mpeg2enc/writepic.c b/cinelerra-5.0/mpeg2enc/writepic.c index d69e6109..e11112ad 100644 --- a/cinelerra-5.0/mpeg2enc/writepic.c +++ b/cinelerra-5.0/mpeg2enc/writepic.c @@ -29,26 +29,9 @@ #include #include -#include "colormodels.h" #include "config.h" #include "global.h" void writeframe(int number, unsigned char *frame[]) { - int chrom_hsize, chrom_vsize; - char name[128]; - FILE *fd; - - if(!qt_output) return; -//printf("writeframe 1\n"); - chrom_hsize = (chroma_format==CHROMA444) ? horizontal_size - : horizontal_size>>1; - - chrom_vsize = (chroma_format!=CHROMA420) ? vertical_size - : vertical_size>>1; - - quicktime_set_cmodel(qt_output, BC_YUV420P); - quicktime_encode_video(qt_output, - frame, - 0); } diff --git a/cinelerra-5.0/plugins/aging/aging.C b/cinelerra-5.0/plugins/aging/aging.C index d5cebf63..ec19086d 100644 --- a/cinelerra-5.0/plugins/aging/aging.C +++ b/cinelerra-5.0/plugins/aging/aging.C @@ -20,7 +20,7 @@ */ #include "clip.h" -#include "colormodels.h" +#include "bccmodels.h" #include "filexml.h" #include "aging.h" #include "agingwindow.h" diff --git a/cinelerra-5.0/plugins/blurzoom/blurzoom.C b/cinelerra-5.0/plugins/blurzoom/blurzoom.C index ac30bf07..0fa5a41f 100644 --- a/cinelerra-5.0/plugins/blurzoom/blurzoom.C +++ b/cinelerra-5.0/plugins/blurzoom/blurzoom.C @@ -20,7 +20,7 @@ */ #include "clip.h" -#include "colormodels.h" +#include "bccmodels.h" #include "filexml.h" #include "language.h" #include "blurzoom.h" diff --git a/cinelerra-5.0/plugins/burn/burn.C b/cinelerra-5.0/plugins/burn/burn.C index ed9b50bf..0adac782 100644 --- a/cinelerra-5.0/plugins/burn/burn.C +++ b/cinelerra-5.0/plugins/burn/burn.C @@ -20,7 +20,7 @@ */ #include "clip.h" -#include "colormodels.h" +#include "bccmodels.h" #include "effecttv.h" #include "filexml.h" #include "language.h" diff --git a/cinelerra-5.0/plugins/dot/dot.C b/cinelerra-5.0/plugins/dot/dot.C index 64c35e96..68cf8c03 100644 --- a/cinelerra-5.0/plugins/dot/dot.C +++ b/cinelerra-5.0/plugins/dot/dot.C @@ -20,7 +20,7 @@ */ #include "clip.h" -#include "colormodels.h" +#include "bccmodels.h" #include "filexml.h" #include "dot.h" #include "dotwindow.h" diff --git a/cinelerra-5.0/plugins/flip/flip.C b/cinelerra-5.0/plugins/flip/flip.C index 74e0c4bc..8fa30581 100644 --- a/cinelerra-5.0/plugins/flip/flip.C +++ b/cinelerra-5.0/plugins/flip/flip.C @@ -20,7 +20,7 @@ */ #include "clip.h" -#include "colormodels.h" +#include "bccmodels.h" #include "bchash.h" #include "filexml.h" #include "flip.h" diff --git a/cinelerra-5.0/plugins/holo/holo.C b/cinelerra-5.0/plugins/holo/holo.C index 7c46cc2f..48c68474 100644 --- a/cinelerra-5.0/plugins/holo/holo.C +++ b/cinelerra-5.0/plugins/holo/holo.C @@ -20,7 +20,7 @@ */ #include "clip.h" -#include "colormodels.h" +#include "bccmodels.h" #include "effecttv.h" #include "filexml.h" #include "holo.h" diff --git a/cinelerra-5.0/plugins/interpolate/interpolate.C b/cinelerra-5.0/plugins/interpolate/interpolate.C index 85c43201..0c63ad0d 100644 --- a/cinelerra-5.0/plugins/interpolate/interpolate.C +++ b/cinelerra-5.0/plugins/interpolate/interpolate.C @@ -21,7 +21,7 @@ #include "bcdisplayinfo.h" #include "clip.h" -#include "colormodels.h" +#include "bccmodels.h" #include "filexml.h" #include "aggregated.h" #include "language.h" @@ -393,7 +393,7 @@ void InterpolatePixelsUnit::process_package(LoadPackage *package) int pattern_offset_y = plugin->config.y; int y1 = pkg->y1; int y2 = pkg->y2; - int components = cmodel_components(plugin->out_frame->get_color_model()); + int components = BC_CModels::components(plugin->out_frame->get_color_model()); float color_matrix[9]; memcpy(color_matrix, server->color_matrix, sizeof(color_matrix)); diff --git a/cinelerra-5.0/plugins/ivtc/ivtc.C b/cinelerra-5.0/plugins/ivtc/ivtc.C index 3600388e..830a1721 100644 --- a/cinelerra-5.0/plugins/ivtc/ivtc.C +++ b/cinelerra-5.0/plugins/ivtc/ivtc.C @@ -20,7 +20,7 @@ */ #include "clip.h" -#include "colormodels.h" +#include "bccmodels.h" #include "filexml.h" #include "ivtc.h" #include "ivtcwindow.h" diff --git a/cinelerra-5.0/plugins/libeffecttv/effecttv.C b/cinelerra-5.0/plugins/libeffecttv/effecttv.C index 90b80bf3..7e084794 100644 --- a/cinelerra-5.0/plugins/libeffecttv/effecttv.C +++ b/cinelerra-5.0/plugins/libeffecttv/effecttv.C @@ -19,7 +19,7 @@ * */ -#include "colormodels.h" +#include "bccmodels.h" #include "effecttv.h" #include "cicolors.h" #include "vframe.h" diff --git a/cinelerra-5.0/plugins/quark/quark.C b/cinelerra-5.0/plugins/quark/quark.C index d76921e3..d976609f 100644 --- a/cinelerra-5.0/plugins/quark/quark.C +++ b/cinelerra-5.0/plugins/quark/quark.C @@ -19,7 +19,7 @@ * */ -#include "colormodels.h" +#include "bccmodels.h" #include "filexml.h" #include "language.h" #include "sharpen.h" diff --git a/cinelerra-5.0/plugins/rgb601/ivtc.C.2 b/cinelerra-5.0/plugins/rgb601/ivtc.C.2 index 33b5bc36..3da4aa68 100644 --- a/cinelerra-5.0/plugins/rgb601/ivtc.C.2 +++ b/cinelerra-5.0/plugins/rgb601/ivtc.C.2 @@ -1,4 +1,4 @@ -#include "colormodels.h" +#include "bccmodels.h" #include "filexml.h" #include "rgb601.h" #include "rgb601window.h" diff --git a/cinelerra-5.0/plugins/rgb601/rgb601.C b/cinelerra-5.0/plugins/rgb601/rgb601.C index 10b0a03b..1de2e00b 100644 --- a/cinelerra-5.0/plugins/rgb601/rgb601.C +++ b/cinelerra-5.0/plugins/rgb601/rgb601.C @@ -20,7 +20,7 @@ */ #include "clip.h" -#include "colormodels.h" +#include "bccmodels.h" #include "filexml.h" #include "language.h" #include "rgb601.h" diff --git a/cinelerra-5.0/plugins/sharpen/sharpen.C b/cinelerra-5.0/plugins/sharpen/sharpen.C index 15e1a7e2..11324252 100644 --- a/cinelerra-5.0/plugins/sharpen/sharpen.C +++ b/cinelerra-5.0/plugins/sharpen/sharpen.C @@ -20,7 +20,7 @@ */ #include "clip.h" -#include "colormodels.h" +#include "bccmodels.h" #include "condition.h" #include "filexml.h" #include "language.h" @@ -184,7 +184,7 @@ int SharpenMain::get_luts(int *pos_lut, int *neg_lut, int color_model) { int i, inv_sharpness, vmax; - vmax = cmodel_calculate_max(color_model); + vmax = BC_CModels::calculate_max(color_model); inv_sharpness = (int)(100 - config.sharpness); if(config.horizontal) inv_sharpness /= 2; diff --git a/cinelerra-5.0/plugins/titler/title.C b/cinelerra-5.0/plugins/titler/title.C index 6155d20b..9974c91a 100644 --- a/cinelerra-5.0/plugins/titler/title.C +++ b/cinelerra-5.0/plugins/titler/title.C @@ -30,7 +30,7 @@ #include "bcsignals.h" #include "clip.h" -#include "colormodels.h" +#include "bccmodels.h" #include "filexml.h" #include "filesystem.h" #include "transportque.inc" diff --git a/cinelerra-5.0/plugins/titler/title.C.stroker b/cinelerra-5.0/plugins/titler/title.C.stroker index 66427202..41ad7f1a 100644 --- a/cinelerra-5.0/plugins/titler/title.C.stroker +++ b/cinelerra-5.0/plugins/titler/title.C.stroker @@ -4,7 +4,7 @@ #include "clip.h" -#include "colormodels.h" +#include "bccmodels.h" #include "filexml.h" #include "filesystem.h" #include "freetype/ftbbox.h" diff --git a/cinelerra-5.0/quicktime/CHANGELOG b/cinelerra-5.0/quicktime/CHANGELOG deleted file mode 100644 index eac80349..00000000 --- a/cinelerra-5.0/quicktime/CHANGELOG +++ /dev/null @@ -1,8 +0,0 @@ -2.0.0 - -More McRoweSoft support. -Access to more libdv and lavtools AVI files than before. -quicktime_decode_scaled replaced with quicktime_decode_video and friends. -Raw audio routines are obsolete, but raw video routines are here to stay. -Integrated firewire support removed. -Documentation update. diff --git a/cinelerra-5.0/quicktime/COPYING b/cinelerra-5.0/quicktime/COPYING deleted file mode 100644 index c4792dd2..00000000 --- a/cinelerra-5.0/quicktime/COPYING +++ /dev/null @@ -1,515 +0,0 @@ - - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations -below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. -^L - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it -becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. -^L - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control -compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. -^L - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. -^L - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. -^L - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. -^L - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply, and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License -may add an explicit geographical distribution limitation excluding those -countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. -^L - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS -^L - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms -of the ordinary General Public License). - - To apply these terms, attach the following notices to the library. -It is safest to attach them to the start of each source file to most -effectively convey the exclusion of warranty; and each file should -have at least the "copyright" line and a pointer to where the full -notice is found. - - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper -mail. - -You should also get your employer (if you work as a programmer) or -your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James -Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/cinelerra-5.0/quicktime/Makefile b/cinelerra-5.0/quicktime/Makefile deleted file mode 100644 index 62fcfef7..00000000 --- a/cinelerra-5.0/quicktime/Makefile +++ /dev/null @@ -1,358 +0,0 @@ --include ../global_config -include $(THIRDPARTY)/config.mak - -OBJDIR := $(shell uname --machine) -USE_MMX = 0 -CC = gcc -OBJS := -INCS := - -ifndef HAVE_CFLAGS -ifeq ($(origin CFLAGS), environment) -HAVE_CFLAGS := y -else -HAVE_CFLAGS := n -endif -endif - -MJPEG_DIR = $(shell cd $(THIRDPARTY)/mjpegtools*; pwd) -MPEG3_DIR = $(shell cd ../libzmpeg3*; pwd) - -ifeq ($(call firstword,$(encore)),static) -ENCORE_DIR = $(shell cd $(THIRDPARTY)/encore*; pwd) -ENCORE_LIB = $(OBJDIR)/encore -INCS += -DENCORE_INCLUDE=\"$(ENCORE_DIR)/encore.h\" -endif - -ifeq ($(call firstword,$(ffmpeg)),static) -FFMPEG_DIR = $(shell cd $(THIRDPARTY)/ffmpeg*; pwd) -FFMPEG_LIB = $(OBJDIR)/ffmpeg/ -INCS += -I$(FFMPEG_DIR) -endif - -ifeq ($(call firstword,$(faad2)),static) -FAAD_DIR = $(shell cd $(THIRDPARTY)/faad*; pwd) -FAAD_LIB = $(OBJDIR)/faad/ -INCS += -I$(FAAD_DIR)/include/ -endif - -ifeq ($(call firstword,$(faac)),static) -FAAC_DIR = $(shell cd $(THIRDPARTY)/faac*; pwd) -FAAC_LIB = $(OBJDIR)/faac/ -INCS += -I$(FAAC_DIR)/include/ -endif - -ifeq ($(call firstword,$(lame)),static) -LAME_DIR = $(shell cd $(THIRDPARTY)/lame*; pwd) -LAME_LIB = $(OBJDIR)/lame -INCS += -I$(LAME_DIR)/include/ -else -INCS += -I/usr/include/lame -endif - -ifeq ($(call firstword,$(openjpeg)),static) -OPENJPEG_DIR = $(shell cd $(THIRDPARTY)/openjpeg*; pwd) -OPENJPEG_LIB = $(OBJDIR)/openjpeg -INCS += -I$(OPENJPEG_DIR)/src/lib/openmj2 -endif - -ifeq ($(call firstword,$(x264)),static) -X264_DIR = $(shell cd $(THIRDPARTY)/x264*; pwd) -X264_LIB = $(OBJDIR)/x264 -INCS += -I$(X264_DIR) -endif - -ifeq ($(call firstword,$(libdv)),static) -DV_DIR = $(shell cd $(THIRDPARTY)/libdv*; pwd) -DV_LIB = $(OBJDIR)/libdv -INCS += -I$(DV_DIR)/ -endif - -ifeq ($(call firstword,$(libogg)),static) -OGG_DIR = $(shell cd $(THIRDPARTY)/libogg*; pwd) -INCS += -I$(OBJDIR)/ogg -endif - -ifeq ($(call firstword,$(libvorbis)),static) -VORBIS_DIR = $(shell cd $(THIRDPARTY)/libvorbis*; pwd) -VORBIS_LIB = $(OBJDIR)/vorbis -INCS += -I$(VORBIS_DIR)/include -I$(VORBIS_DIR) -endif - -ifeq ($(call firstword,$(libjpeg)),static) -JPEG_DIR = $(shell cd $(THIRDPARTY)/libjpeg*; pwd) -JPEG_LIB = $(OBJDIR)/libjpeg -INCS += -I$(JPEG_DIR) -endif - -ifneq ($(HAVE_CFLAGS), y) -ifeq ($(OBJDIR), alpha) - CFLAGS += -O4 -arch ev67 -ieee -accept c99_keywords -gcc_messages -endif - -ifeq ($(OBJDIR), i686) - CFLAGS += -O3 -fmessage-length=0 -funroll-all-loops -fomit-frame-pointer -falign-loops=2 -falign-jumps=2 -falign-functions=2 -I/usr/local/include -endif - -ifeq ($(OBJDIR), x86_64) - CFLAGS += -O2 -funroll-all-loops -fomit-frame-pointer -I/usr/local/include -endif -endif - -CFLAGS += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -CFLAGS += -DHAVE_FIREWIRE - -OBJS += \ - $(OBJDIR)/atom.o \ - $(OBJDIR)/avcc.o \ - $(OBJDIR)/avi_hdrl.o \ - $(OBJDIR)/avi_ix.o \ - $(OBJDIR)/avi_idx1.o \ - $(OBJDIR)/avi_indx.o \ - $(OBJDIR)/avi_movi.o \ - $(OBJDIR)/avi_odml.o \ - $(OBJDIR)/avi_riff.o \ - $(OBJDIR)/avi_strl.o \ - $(OBJDIR)/cmodel_default.o \ - $(OBJDIR)/cmodel_float.o \ - $(OBJDIR)/cmodel_yuv420p.o \ - $(OBJDIR)/cmodel_yuv422.o \ - $(OBJDIR)/codecs.o \ - $(OBJDIR)/colormodels.o \ - $(OBJDIR)/ctab.o \ - $(OBJDIR)/dinf.o \ - $(OBJDIR)/dref.o \ - $(OBJDIR)/edts.o \ - $(OBJDIR)/elst.o \ - $(OBJDIR)/esds.o \ - $(OBJDIR)/frma.o \ - $(OBJDIR)/graphics.o \ - $(OBJDIR)/hdlr.o \ - $(OBJDIR)/ima4.o \ - $(OBJDIR)/jpeg.o \ - $(OBJDIR)/libdv.o \ - $(OBJDIR)/libmjpeg.o \ - $(OBJDIR)/matrix.o \ - $(OBJDIR)/mdat.o \ - $(OBJDIR)/mdhd.o \ - $(OBJDIR)/mdia.o \ - $(OBJDIR)/minf.o \ - $(OBJDIR)/moov.o \ - $(OBJDIR)/mp4a.o \ - $(OBJDIR)/mvhd.o \ - $(OBJDIR)/plugin.o \ - $(OBJDIR)/qtasf.o \ - $(OBJDIR)/qtcache.o \ - $(OBJDIR)/qtdv.o \ - $(OBJDIR)/qtpng.o \ - $(OBJDIR)/qtmp3.o \ - $(OBJDIR)/quicktime.o \ - $(OBJDIR)/raw.o \ - $(OBJDIR)/rawaudio.o \ - $(OBJDIR)/rle.o \ - $(OBJDIR)/smhd.o \ - $(OBJDIR)/stbl.o \ - $(OBJDIR)/stco.o \ - $(OBJDIR)/stsc.o \ - $(OBJDIR)/stsd.o \ - $(OBJDIR)/stsdtable.o \ - $(OBJDIR)/stss.o \ - $(OBJDIR)/stsz.o \ - $(OBJDIR)/stts.o \ - $(OBJDIR)/tkhd.o \ - $(OBJDIR)/trak.o \ - $(OBJDIR)/twos.o \ - $(OBJDIR)/udta.o \ - $(OBJDIR)/ulaw.o \ - $(OBJDIR)/util.o \ - $(OBJDIR)/v308.o \ - $(OBJDIR)/v408.o \ - $(OBJDIR)/v410.o \ - $(OBJDIR)/vbraudio.o \ - $(OBJDIR)/vmhd.o \ - $(OBJDIR)/vorbis.o \ - $(OBJDIR)/wmx2.o \ - $(OBJDIR)/workarounds.o \ - $(OBJDIR)/yuv2.o \ - $(OBJDIR)/yuv4.o \ - $(OBJDIR)/yv12.o - -FFMPEG_OBJS := \ - $(OBJDIR)/mpeg4.o \ - $(OBJDIR)/qdm2.o \ - $(OBJDIR)/qtffmpeg.o \ - $(OBJDIR)/qth264.o \ - $(OBJDIR)/wma.o - - -UTILS := \ - $(OBJDIR)/qtdump \ - $(OBJDIR)/make_streamable \ - $(OBJDIR)/qtinfo \ - $(OBJDIR)/dechunk \ - $(OBJDIR)/yuv2mov \ - $(OBJDIR)/yuv4toyuv \ - $(OBJDIR)/recover \ - $(OBJDIR)/rechunk \ - -# $(OBJDIR)/mts2mp4 - - -OUTPUT = $(OBJDIR)/libquicktime.a -SHAREDOUTPUT = $(OBJDIR)/libquicktime.so - -CFLAGS += -I. \ - -I$(MJPEG_DIR) -I$(MJPEG_DIR)/utils -I$(MJPEG_DIR)/lavtools \ - -I$(MPEG3_DIR) $(INCS) -ffast-math -mno-ieee-fp - -FFMPEG_CFLAGS := $(CFLAGS) $(FFMPEG_INCLUDE) - -LIBS := $(OUTPUT) $(thirdparty_libraries) $(MPEG3_DIR)/$(OBJDIR)/libzmpeg3.a \ - $(static_libraries) -lpng -lz -lbz2 -llzma -lasound \ - -lX11 -lpthread -ldl -lm -lstdc++ - - -$(shell mkdir -p $(OBJDIR) ) -$(shell echo $(CFLAGS) > $(OBJDIR)/c_flags) -$(shell echo $(LAME_CFLAGS) > $(OBJDIR)/lame_flags) -$(shell echo > $(OBJDIR)/objs $(OBJS) $(FFMPEG_OBJS) \ - $(foreach lib,$(JPEG_LIB) $(DV_LIB) $(FAAD_LIB) $(FAAC_LIB) $(X264_LIB) \ - $(OGG_LIB) $(VORBIS_LIB) $(LAME_LIB) $(ENCORE_LIB), $(lib)/*.o)) -$(shell echo $(FFMPEG_CFLAGS) > $(OBJDIR)/ffmpeg_cflags) - -all: $(OBJDIR) $(THIRDPARTY) $(OUTPUT) - -$(OUTPUT): $(OBJS) $(FFMPEG_OBJS) \ - $(FAAD_LIB) $(FAAC_LIB) $(FFMPEG_LIB) $(X264_LIB) $(DV_LIB) \ - $(JPEG_LIB) $(OGG_LIB) $(VORBIS_LIB) $(LAME_LIB) $(ENCORE_LIB) - find $(FFMPEG_DIR)/libavcodec/ -name *.o >> $(OBJDIR)/objs - find $(FFMPEG_DIR)/libavformat/ -name *.o >> $(OBJDIR)/objs - find $(FFMPEG_DIR)/libavutil/ -name *.o >> $(OBJDIR)/objs - ar rcs $(OUTPUT) `cat $(OBJDIR)/objs` - -# this is the only way we figured out to merge .a files -$(FFMPEG_LIB): - mkdir -p $(FFMPEG_LIB)/avcodec \ - $(FFMPEG_LIB)/avformat \ - $(FFMPEG_LIB)/avutil - [ -d $(FFMPEG_DIR) ] && cd $(FFMPEG_LIB)/avcodec && \ - ar x $(FFMPEG_DIR)/libavcodec/libavcodec.a && \ - cd ../avformat && \ - ar x $(FFMPEG_DIR)/libavformat/libavformat.a && \ - cd ../avutil && \ - ar x $(FFMPEG_DIR)/libavutil/libavutil.a - -$(FAAD_LIB): - mkdir -p $(FAAD_LIB) && \ - [ -d $(FAAD_DIR) ] && cd $(FAAD_LIB) && \ - ar x $(FAAD_DIR)/libfaad/.libs/libfaad.a - -$(FAAC_LIB): - mkdir -p $(FAAC_LIB) && \ - [ -d $(FAAC_DIR) ] && cd $(FAAC_LIB) && \ - ar x $(FAAC_DIR)/libfaac/.libs/libfaac.a - -$(DV_LIB): - mkdir -p $(DV_LIB) && \ - [ -d $(DV_DIR) ] && cd $(DV_LIB) && \ - ar x $(DV_DIR)/libdv/.libs/libdv.a - -$(JPEG_LIB): - mkdir -p $(JPEG_LIB) && \ - [ -d $(JPEB_DIR) ] && cd $(JPEG_LIB) && \ - ar x $(JPEG_DIR)/.libs/libjpeg.a - -# need some trickery to get the duplicated filenames out -$(X264_LIB): - mkdir -p $(X264_LIB) && \ - [ -d $(X264_DIR) ] && cd $(X264_LIB) && \ - ar x $(X264_DIR)/libx264.a && \ - mv predict.o predict2.o && \ - mv cabac.o cabac2.o && \ - mv macroblock.o macroblock2.o && \ - mv set.o set2.o && \ - ar xN 1 $(X264_DIR)/libx264.a predict.o cabac.o macroblock.o set.o - -$(OGG_LIB): - mkdir -p $(OGG_LIB) && \ - cd $(OGG_LIB) && \ - ar x $(OGG_DIR)/src/.libs/libogg.a - -$(VORBIS_LIB): - mkdir -p $(VORBIS_LIB) && \ - [ -d $(VORBIS_DIR) ] && cd $(VORBIS_LIB) && \ - ar x $(VORBIS_DIR)/lib/.libs/libvorbis.a && \ - ar x $(VORBIS_DIR)/lib/.libs/libvorbisenc.a && \ - ar x $(VORBIS_DIR)/lib/.libs/libvorbisfile.a - -$(LAME_LIB): - mkdir -p $(LAME_LIB) && \ - [ -d $(LAME_DIR) ] && cd $(LAME_LIB) && \ - ar x $(LAME_DIR)/libmp3lame/.libs/libmp3lame.a - -$(ENCORE_LIB): - mkdir -p $(ENCORE_LIB) && \ - [ -d $(ENCORE_DIR) ] && cd $(ENCORE_LIB) && \ - ar x $(ENCORE_DIR)/$(OBJDIR)/libencore.a - -# broken -$(OPENJPEG_LIB): - mkdir -p $(OPENJPEG_LIB) && \ - [ -d $(OPENJPEG_DIR) ] && cd $(OPENJPEG_LIB) && \ - ar x $(OPENJPEG_DIR)/bin/libopenjpip.a && \ - ar x $(OPENJPEG_DIR)/bin/libopenjp3d.a && \ - ar x $(OPENJPEG_DIR)/bin/libopenjp2.a - -$(OBJDIR)/mts2mp4: $(OBJDIR)/mts2mp4.o $(OUTPUT) - $(CC) -o $(OBJDIR)/mts2mp4 $(OBJDIR)/mts2mp4.o $(LIBS) - -$(OBJDIR)/qtdump: $(OBJDIR)/dump.o $(OUTPUT) - $(CC) -o $(OBJDIR)/qtdump $(OBJDIR)/dump.o $(LIBS) - -$(OBJDIR)/make_streamable: $(OBJDIR)/make_streamable.o $(OUTPUT) - $(CC) -o $(OBJDIR)/make_streamable $(OBJDIR)/make_streamable.o $(LIBS) - -$(OBJDIR)/dechunk: $(OBJDIR)/dechunk.o $(OUTPUT) - $(CC) -o $(OBJDIR)/dechunk $(OBJDIR)/dechunk.o $(LIBS) - -$(OBJDIR)/rechunk: $(OBJDIR)/rechunk.o $(OUTPUT) - $(CC) -o $(OBJDIR)/rechunk $(OBJDIR)/rechunk.o $(LIBS) - -$(OBJDIR)/recover: $(OBJDIR)/recover.o $(OUTPUT) - $(CC) -o $(OBJDIR)/recover $(OBJDIR)/recover.o $(LIBS) - -$(OBJDIR)/yuv4toyuv: $(OBJDIR)/yuv4toyuv.o $(OUTPUT) - $(CC) -o $(OBJDIR)/yuv4toyuv $(OBJDIR)/yuv4toyuv.o $(LIBS) - -$(OBJDIR)/yuv2mov: $(OBJDIR)/yuv2mov.o $(OUTPUT) - $(CC) -o $(OBJDIR)/yuv2mov $(OBJDIR)/yuv2mov.o $(LIBS) - -$(OBJDIR)/qtinfo: $(OBJDIR)/qtinfo.o - $(CC) -o $(OBJDIR)/qtinfo $(OBJDIR)/qtinfo.o $(LIBS) - -utils: $(UTILS) - - -clean: - rm -rf $(OBJDIR) - find \( -name 'core*' -o -name '*.plugin' \ - -o -name '*.lo' -o -name '*.o' \ - -o -name '*.la' -o -name '*.a' \ - -o -name '*.so' \) -exec rm -f {} \; -prune - -backup: clean - cd .. && \ - tar zcvf quicktime.tar.gz quicktime - -install: - cp $(UTILS) /usr/bin - -$(OBJDIR)/%.o: %.c - $(CC) -c `cat $(OBJDIR)/c_flags` $^ -o $@ - -$(OBJDIR)/mts2mp4.o: - $(CC) -c `cat $(OBJDIR)/c_flags` $(FFMPEG_INCLUDE) $(subst $(OBJDIR)/,, $*.c) -o $*.o - -$(FFMPEG_OBJS): $(OBJDIR)/%.o: %.c - $(CC) `cat $(OBJDIR)/ffmpeg_cflags` -c $< -o $@ - diff --git a/cinelerra-5.0/quicktime/README b/cinelerra-5.0/quicktime/README deleted file mode 100644 index 64b13286..00000000 --- a/cinelerra-5.0/quicktime/README +++ /dev/null @@ -1,53 +0,0 @@ -Quicktime for Linux - -by - -Heroine Virtual Ltd. (Motion picture solutions for Linux) -Send harrassment to: broadcast@earthling.net -Homepage: heroinewarrior.com/quicktime -Requires libzmpeg3 from heroinewarrior.com ------------------------------------------------------------------------- - -This is a Quicktime front end for UNIX in a library. - - - -Building: -Quicktime for Linux requires a built copy of of libzmpeg3 in a directory next to itself. -This is used for the mp3 interface. - -Your directory structure should thus be: -/my_directory -/my_directory/libzmpeg3-*.*.* -/my_directory/quicktime4linux-*.*.* - - -type "make" in the libzmpeg3 directory. -type "make" in the quicktime directory. -type "make util" to get quicktime to build some utilities. - - -The makefiles automatically configure themselves. The library is in -i686/libquicktime.a. You should manually set the CFLAGS environment -variable with the optimum optimization parameters for your i686 -derivative. - - - -/******************************************************* - * References: - *********************************/ - -Apple's quicktime file format information: - -http://developer.apple.com/techpubs/quicktime/qtdevdocs/REF/refQTFileFormat.htm - -Color space conversions: - -http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html - - - - - - diff --git a/cinelerra-5.0/quicktime/atom.c b/cinelerra-5.0/quicktime/atom.c deleted file mode 100644 index 41687ba6..00000000 --- a/cinelerra-5.0/quicktime/atom.c +++ /dev/null @@ -1,229 +0,0 @@ -#include -#include -#include "funcprotos.h" -#include "quicktime.h" -#include "workarounds.h" - - - -static int read_type(char *data, unsigned char *type) -{ - type[0] = data[4]; - type[1] = data[5]; - type[2] = data[6]; - type[3] = data[7]; - type[4] = 0; - -/*printf("%c%c%c%c ", type[0], type[1], type[2], type[3]); */ -/* need this for quicktime_check_sig */ - if(isalpha(type[0]) && isalpha(type[1]) && isalpha(type[2]) && isalpha(type[3])) - return 0; - else - return 1; -} - - -static unsigned long read_size(char *data) -{ - unsigned long result; - unsigned long a, b, c, d; - - a = (unsigned char)data[0]; - b = (unsigned char)data[1]; - c = (unsigned char)data[2]; - d = (unsigned char)data[3]; - - result = (a << 24) | (b << 16) | (c << 8) | d; - -// extended header is size 1 -// if(result < HEADER_LENGTH) result = HEADER_LENGTH; - return result; -} - -static int64_t read_size64(char *data) -{ - uint64_t result, a, b, c, d, e, f, g, h; - - a = (unsigned char)data[0]; - b = (unsigned char)data[1]; - c = (unsigned char)data[2]; - d = (unsigned char)data[3]; - e = (unsigned char)data[4]; - f = (unsigned char)data[5]; - g = (unsigned char)data[6]; - h = (unsigned char)data[7]; - - result = (a << 56) | - (b << 48) | - (c << 40) | - (d << 32) | - (e << 24) | - (f << 16) | - (g << 8) | - h; - - if(result < HEADER_LENGTH) result = HEADER_LENGTH; - return (int64_t)result; -} - -static int reset(quicktime_atom_t *atom) -{ - atom->end = 0; - atom->type[0] = atom->type[1] = atom->type[2] = atom->type[3] = atom->type[4] = 0; - return 0; -} - -int quicktime_atom_read_header(quicktime_t *file, quicktime_atom_t *atom) -{ - int result = 0; - char header[10]; - int debug = 0; - - if(file->use_avi) - { - reset(atom); - atom->start = quicktime_position(file); - if(!quicktime_read_data(file, header, HEADER_LENGTH)) return 1; - atom->type[0] = header[0]; - atom->type[1] = header[1]; - atom->type[2] = header[2]; - atom->type[3] = header[3]; - atom->type[4] = 0; - atom->size = - (((unsigned char)header[4]) ) | - (((unsigned char)header[5]) << 8 ) | - (((unsigned char)header[6]) << 16) | - (((unsigned char)header[7]) << 24); - atom->end = quicktime_add3(atom->start, atom->size, 8); - } - else - { - reset(atom); - - atom->start = quicktime_position(file); - - if(!quicktime_read_data(file, header, HEADER_LENGTH)) return 1; - result = read_type(header, atom->type); - atom->size = read_size(header); - atom->end = atom->start + atom->size; - if(debug) - printf("quicktime_atom_read_header 1 %c%c%c%c start=0x%jx" - " size=0x%jx end=0x%jx ftell %jx %jx\n", - atom->type[0], atom->type[1], atom->type[2], atom->type[3], - atom->start, atom->size, atom->end, - file->file_position, - (int64_t)FTELL(file->stream)); - -/* Skip placeholder atom */ - if(quicktime_match_32((char*)atom->type, "wide")) - { - atom->start = quicktime_position(file); - reset(atom); - if(!quicktime_read_data(file, header, HEADER_LENGTH)) return 1; - result = read_type(header, atom->type); - atom->size -= 8; - if(atom->size <= 0) - { -/* Wrapper ended. Get new atom size */ - atom->size = read_size(header); - } - atom->end = atom->start + atom->size; - } - else -/* Get extended size */ - if(atom->size == 1) - { - if(!quicktime_read_data(file, header, HEADER_LENGTH)) return 1; - atom->size = read_size64(header); - atom->end = atom->start + atom->size; -/* - * printf("quicktime_atom_read_header 2 %c%c%c%c start %llx size %llx end %llx ftell %llx\n", - * atom->type[0], atom->type[1], atom->type[2], atom->type[3], - * atom->start, atom->size, atom->end, - * file->file_position); - */ - } - } - - - return result; -} - -int quicktime_atom_write_header64(quicktime_t *file, quicktime_atom_t *atom, char *text) -{ - int result = 0; - atom->start = quicktime_position(file); - - result = !quicktime_write_int32(file, 1); - if(!result) result = !quicktime_write_char32(file, text); - if(!result) result = !quicktime_write_int64(file, 0); - - atom->use_64 = 1; - return result; -} - -int quicktime_atom_write_header(quicktime_t *file, - quicktime_atom_t *atom, - char *text) -{ - int result = 0; - - if(file->use_avi) - { - reset(atom); - atom->start = quicktime_position(file) + 8; - result = !quicktime_write_char32(file, text); - if(!result) result = !quicktime_write_int32_le(file, 0); - atom->use_64 = 0; - } - else - { - atom->start = quicktime_position(file); - result = !quicktime_write_int32(file, 0); - if(!result) result = !quicktime_write_char32(file, text); - atom->use_64 = 0; - } - - return result; -} - -void quicktime_atom_write_footer(quicktime_t *file, quicktime_atom_t *atom) -{ - atom->end = quicktime_position(file); - if(file->use_avi) - { - quicktime_set_position(file, atom->start - 4); - quicktime_write_int32_le(file, atom->end - atom->start); - atom->size = atom->end - atom->start; - } - else - { - // We should calculate atom->size here also... it is used in trak.c FIXME - // I don't know internals of the quicktime to know what is proper calculation - with or wirhout header? - if(atom->use_64) - { - quicktime_set_position(file, atom->start + 8); -//printf("quicktime_atom_write_footer %llx %llx %llx %llx\n", file->total_length, file->file_position, atom->start, atom->end); - quicktime_write_int64(file, atom->end - atom->start); - } - else - { - quicktime_set_position(file, atom->start); - quicktime_write_int32(file, atom->end - atom->start); - } - } - quicktime_set_position(file, atom->end); -} - -int quicktime_atom_is(quicktime_atom_t *atom, char *typ) -{ - unsigned char *type = (unsigned char *)typ; - return atom->type[0] == type[0] && atom->type[1] == type[1] && - atom->type[2] == type[2] && atom->type[3] == type[3] ? 1 : 0; -} - -int quicktime_atom_skip(quicktime_t *file, quicktime_atom_t *atom) -{ - if(atom->start == atom->end) atom->end++; - return quicktime_set_position(file, atom->end); -} diff --git a/cinelerra-5.0/quicktime/avcc.c b/cinelerra-5.0/quicktime/avcc.c deleted file mode 100644 index f361f8ec..00000000 --- a/cinelerra-5.0/quicktime/avcc.c +++ /dev/null @@ -1,64 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" -#include - - -void quicktime_delete_avcc(quicktime_avcc_t *avcc) -{ - if(avcc->data) free(avcc->data); -} - -// Set esds header to a copy of the argument -void quicktime_set_avcc_header(quicktime_avcc_t *avcc, - unsigned char *data, - int size) -{ - if(avcc->data) - { - free(avcc->data); - } - - avcc->data = calloc(1, size); - memcpy(avcc->data, data, size); - avcc->data_size = size; -} - -void quicktime_write_avcc(quicktime_t *file, - quicktime_avcc_t *avcc) -{ - quicktime_atom_t atom; - quicktime_atom_write_header(file, &atom, "avcC"); - quicktime_write_data(file, avcc->data, avcc->data_size); - quicktime_atom_write_footer(file, &atom); -} - - - -int quicktime_read_avcc(quicktime_t *file, - quicktime_atom_t *parent_atom, - quicktime_avcc_t *avcc) -{ - avcc->data_size = parent_atom->size - 8; - avcc->data = calloc(1, avcc->data_size + 1024); - quicktime_read_data(file, - avcc->data, - avcc->data_size); - quicktime_atom_skip(file, parent_atom); - return 0; -} - -void quicktime_avcc_dump(quicktime_avcc_t *avcc) -{ - if(avcc->data_size) - { - int i; - printf(" h264 description\n"); - printf(" data_size=0x%x\n", avcc->data_size); - printf(" data="); - for(i = 0; i < avcc->data_size; i++) - { - printf("0x%02x ", (unsigned char)avcc->data[i]); - } - printf("\n"); - } -} diff --git a/cinelerra-5.0/quicktime/avi_hdrl.c b/cinelerra-5.0/quicktime/avi_hdrl.c deleted file mode 100755 index 856025bc..00000000 --- a/cinelerra-5.0/quicktime/avi_hdrl.c +++ /dev/null @@ -1,216 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" - - - -void quicktime_delete_hdrl(quicktime_t *file, quicktime_hdrl_t *hdrl) -{ - int i; - for(i = 0; i < file->moov.total_tracks; i++) - { - quicktime_delete_strl(hdrl->strl[i]); - } -} - - -void quicktime_read_hdrl(quicktime_t *file, - quicktime_hdrl_t *hdrl, - quicktime_atom_t *parent_atom) -{ - quicktime_atom_t leaf_atom; - char data[4]; - int current_track = 0; - -//printf("quicktime_read_hdrl 1\n"); - do - { - quicktime_atom_read_header(file, &leaf_atom); - -/* Got LIST */ - if(quicktime_atom_is(&leaf_atom, "LIST")) - { - data[0] = data[1] = data[2] = data[3] = 0; - quicktime_read_data(file, data, 4); - -/* Got strl */ - if(quicktime_match_32(data, "strl")) - { - quicktime_strl_t *strl = - hdrl->strl[current_track++] = - quicktime_new_strl(); - quicktime_read_strl(file, strl, &leaf_atom); - } - } - - quicktime_atom_skip(file, &leaf_atom); - }while(quicktime_position(file) < parent_atom->end); - - quicktime_atom_skip(file, &leaf_atom); -} - -void quicktime_init_hdrl(quicktime_t *file, quicktime_hdrl_t *hdrl) -{ - int i; - quicktime_atom_t avih_atom; - int current_track; - -// LIST 'hdrl' - quicktime_atom_write_header(file, &hdrl->atom, "LIST"); - quicktime_write_char32(file, "hdrl"); - - -// avih - quicktime_atom_write_header(file, &avih_atom, "avih"); - - if(file->total_vtracks) { - int d = quicktime_frame_rate_d(file, 0); - int n = quicktime_frame_rate_n(file, 0); - quicktime_write_int32_le(file, (uint32_t)(1000000. * d / n)); - } - else - quicktime_write_int32_le(file, 0); - - hdrl->bitrate_offset = quicktime_position(file); - quicktime_write_int32_le(file, 0); /* bitrate in bytes */ - quicktime_write_int32_le(file, 0); /* padding */ - quicktime_write_int32_le(file, - AVI_TRUSTCKTYPE | - AVI_HASINDEX | - AVI_MUSTUSEINDEX | - AVI_ISINTERLEAVED); /* flags */ - hdrl->frames_offset = quicktime_position(file); - quicktime_write_int32_le(file, 0); /* nb frames, filled later */ - quicktime_write_int32_le(file, 0); /* initial frame */ - quicktime_write_int32_le(file, file->moov.total_tracks); /* nb streams */ - quicktime_write_int32_le(file, 0); /* suggested buffer size */ - - if(file->total_vtracks) - { - quicktime_write_int32_le(file, file->vtracks[0].track->tkhd.track_width); - quicktime_write_int32_le(file, file->vtracks[0].track->tkhd.track_height); - } - else - { - quicktime_write_int32_le(file, 0); - quicktime_write_int32_le(file, 0); - } - quicktime_write_int32_le(file, 0); /* reserved */ - quicktime_write_int32_le(file, 0); /* reserved */ - quicktime_write_int32_le(file, 0); /* reserved */ - quicktime_write_int32_le(file, 0); /* reserved */ - - quicktime_atom_write_footer(file, &avih_atom); - - -/* Write stream lists. */ -/* Need the track maps to get the WAV ID for audio. */ - current_track = 0; - for(i = 0; i < file->total_vtracks; i++) - { - quicktime_video_map_t *video_map = &file->vtracks[i]; - quicktime_trak_t *trak = video_map->track; - quicktime_strl_t *strl = - hdrl->strl[current_track++] = - quicktime_new_strl(); - quicktime_init_strl(file, - 0, - video_map, - trak, - strl); - } - - for(i = 0; i < file->total_atracks; i++) - { - quicktime_audio_map_t *audio_map = &file->atracks[i]; - quicktime_trak_t *trak = audio_map->track; - quicktime_strl_t *strl = - hdrl->strl[current_track++] = - quicktime_new_strl(); - quicktime_init_strl(file, - audio_map, - 0, - trak, - strl); - } - -/* - * for(i = 0; i < file->moov.total_tracks; i++) - * { - * printf("quicktime_init_hdrl 10 %d %p\n", i, file->riff[0]->hdrl.strl[i]->tag); - * } - */ - -/* ODML header */ - quicktime_init_odml(file, hdrl); - quicktime_atom_write_footer(file, &hdrl->atom); -} - - -void quicktime_finalize_hdrl(quicktime_t *file, quicktime_hdrl_t *hdrl) -{ - int i; - int64_t position = quicktime_position(file); - int64_t total_frames = 0; - double frame_rate = 0; - - for(i = 0; i < file->moov.total_tracks; i++) - { - quicktime_trak_t *trak = file->moov.trak[i]; - quicktime_strl_t *strl = hdrl->strl[i]; - - if(trak->mdia.minf.is_video) - { - int length; - quicktime_set_position(file, strl->length_offset); - total_frames = length = quicktime_track_samples(file, trak); - quicktime_write_int32_le(file, length); - frame_rate = (double)trak->mdia.mdhd.time_scale / - trak->mdia.minf.stbl.stts.table[0].sample_duration; - } - else - if(trak->mdia.minf.is_audio) - { - int length, samples_per_chunk, wav_id, sample_size, sample_rate; - quicktime_set_position(file, strl->length_offset); - length = quicktime_track_samples(file, trak); - quicktime_write_int32_le(file, length); - -// dwScale and dwRate as per MSDN - // http://msdn.microsoft.com/library/default.asp? -// url=/library/en-us/wcemultimedia5/html/wce50conAVIStreamHeaders.asp - quicktime_set_position(file, strl->samples_per_chunk_offset); - wav_id = ((quicktime_codec_t*)(file->atracks[0].codec))->wav_id; - samples_per_chunk = wav_id == 1 ? 1 : - quicktime_avg_chunk_samples(file, trak); - quicktime_write_int32_le(file, samples_per_chunk); - sample_rate = trak->mdia.minf.stbl.stsd.table[0].sample_rate; - quicktime_write_int32_le(file, sample_rate); - quicktime_set_position(file, strl->sample_size_offset); - -// dwSampleSize as per MSDN -// as per http://www.virtualdub.org/blog/pivot/entry.php?id=27, many programs ignore this value -// sample_size in quicktime is in bits... so we must divide by 8 -// FIXME: This has to be zero for _all_ VBR encodings, and other values are used for specific encodings - sample_size = trak->mdia.minf.stbl.stsd.table[0].sample_size; - quicktime_write_int32_le(file, wav_id != 1 ? sample_size : - trak->mdia.minf.stbl.stsd.table[0].channels * sample_size / 8); - } - } - - if(total_frames) - { - quicktime_set_position(file, hdrl->bitrate_offset); - quicktime_write_int32_le(file, - file->total_length / (total_frames / frame_rate)); - quicktime_set_position(file, hdrl->frames_offset); - quicktime_write_int32_le(file, total_frames); - } - - quicktime_set_position(file, position); -} - - - - - - - diff --git a/cinelerra-5.0/quicktime/avi_idx1.c b/cinelerra-5.0/quicktime/avi_idx1.c deleted file mode 100755 index bb3fc0cc..00000000 --- a/cinelerra-5.0/quicktime/avi_idx1.c +++ /dev/null @@ -1,179 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" -#include - - - -typedef struct -{ - char tag[4]; - int32_t flags; - int32_t offset; - int32_t size; -} avi_tag_t; - - -#if 0 -static int is_keyframe(quicktime_trak_t *trak, int frame) -{ - int i; - quicktime_stss_t *stss = &trak->mdia.minf.stbl.stss; - frame++; - for(i = 0; i < stss->total_entries; i++) - { - if(stss->table[i].sample == frame) return 1; - } - return 0; -} -#endif - -void quicktime_delete_idx1(quicktime_idx1_t *idx1) -{ - if(idx1->table) free(idx1->table); -} - -void quicktime_read_idx1(quicktime_t *file, - quicktime_riff_t *riff, - quicktime_atom_t *parent_atom) -{ - int i; - quicktime_idx1_t *idx1 = &riff->idx1; - -//printf("quicktime_read_idx1 1 %llx\n", quicktime_position(file)); - -// Allocate table. - idx1->table_size = (parent_atom->end - quicktime_position(file)) / 16; - idx1->table_allocation = idx1->table_size; - idx1->table = calloc(sizeof(quicktime_idx1table_t), idx1->table_size); -//printf("quicktime_read_idx1 10\n"); - -// Store it in idx1 table now. -// Wait for full ix table discovery before converting to stco. - for(i = 0; i < idx1->table_size; i++) - { - quicktime_idx1table_t *idx1table = idx1->table + i; - - quicktime_read_data(file, idx1table->tag, 4); - idx1table->flags = quicktime_read_int32_le(file); - idx1table->offset = quicktime_read_int32_le(file); - idx1table->size = quicktime_read_int32_le(file); - } - -//printf("quicktime_read_idx1 100\n"); -} - -void quicktime_write_idx1(quicktime_t *file, - quicktime_idx1_t *idx1) -{ - int i; - quicktime_idx1table_t *table = idx1->table; - int table_size = idx1->table_size; - - - -// Write table - quicktime_atom_write_header(file, &idx1->atom, "idx1"); - - for(i = 0; i < table_size; i++) - { - quicktime_idx1table_t *entry = &table[i]; - quicktime_write_char32(file, entry->tag); - quicktime_write_int32_le(file, entry->flags); - quicktime_write_int32_le(file, entry->offset); - quicktime_write_int32_le(file, entry->size); - } - - - quicktime_atom_write_footer(file, &idx1->atom); -} - -void quicktime_set_idx1_keyframe(quicktime_t *file, - quicktime_trak_t *trak, - int new_keyframe) -{ - quicktime_riff_t *riff = file->riff[0]; - quicktime_hdrl_t *hdrl = &riff->hdrl; - quicktime_strl_t *strl = hdrl->strl[trak->tkhd.track_id - 1]; - char *tag = strl->tag; - quicktime_idx1_t *idx1 = &riff->idx1; - int i; - int counter = -1; - -// Search through entire index for right numbered tag. -// Since all the tracks are combined in the same index, this is unavoidable. - for(i = 0; i < idx1->table_size; i++) - { - quicktime_idx1table_t *idx1_table = &idx1->table[i]; - if(!memcmp(idx1_table->tag, tag, 4)) - { - counter++; - if(counter == new_keyframe) - { - idx1_table->flags |= AVI_KEYFRAME; - break; - } - } - } -} - -void quicktime_update_idx1table(quicktime_t *file, - quicktime_trak_t *trak, - int offset, - int size) -{ - quicktime_riff_t *riff = file->riff[0]; - quicktime_hdrl_t *hdrl = &riff->hdrl; - quicktime_strl_t *strl = hdrl->strl[trak->tkhd.track_id - 1]; - char *tag = strl->tag; - quicktime_idx1_t *idx1 = &riff->idx1; - quicktime_movi_t *movi = &riff->movi; - quicktime_idx1table_t *idx1_table; - quicktime_stss_t *stss = &trak->mdia.minf.stbl.stss; - uint32_t flags = 0; - int i; - int keyframe_frame = idx1->table_size + 1; - -// Set flag for keyframe - for(i = stss->total_entries - 1; i >= 0; i--) - { - if(stss->table[i].sample == keyframe_frame) - { - flags |= AVI_KEYFRAME; - break; - } - else - if(stss->table[i].sample < keyframe_frame) - { - break; - } - } - - -// Allocation - if(idx1->table_size >= idx1->table_allocation) - { - quicktime_idx1table_t *old_table = idx1->table; - int new_allocation = idx1->table_allocation * 2; - if(new_allocation < 1) new_allocation = 1; - idx1->table = calloc(1, sizeof(quicktime_idx1table_t) * new_allocation); - if(old_table) - { - memcpy(idx1->table, old_table, sizeof(quicktime_idx1table_t) * idx1->table_size); - free(old_table); - } - idx1->table_allocation = new_allocation; - } - - -// Appendage - idx1_table = &idx1->table[idx1->table_size]; - memcpy(idx1_table->tag, tag, 4); - idx1_table->flags = flags; - idx1_table->offset = offset - 8 - movi->atom.start; - idx1_table->size = size; - idx1->table_size++; -} - - - - diff --git a/cinelerra-5.0/quicktime/avi_indx.c b/cinelerra-5.0/quicktime/avi_indx.c deleted file mode 100644 index 20ef0dc9..00000000 --- a/cinelerra-5.0/quicktime/avi_indx.c +++ /dev/null @@ -1,170 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" -#include - - -void quicktime_delete_indx(quicktime_indx_t *indx) -{ - int i; - if(indx->table) - { - for(i = 0; i < indx->table_size; i++) - { - quicktime_indxtable_t *indx_table = &indx->table[i]; - if(indx_table->ix) quicktime_delete_ix(indx_table->ix); - } - free(indx->table); - } -} - -void quicktime_init_indx(quicktime_t *file, - quicktime_indx_t *indx, - quicktime_strl_t *strl) -{ - indx->longs_per_entry = 4; - indx->index_subtype = 0; - indx->index_type = AVI_INDEX_OF_INDEXES; - memcpy(indx->chunk_id, strl->tag, 4); -} - -void quicktime_update_indx(quicktime_t *file, - quicktime_indx_t *indx, - quicktime_ix_t *ix) -{ - quicktime_indxtable_t *indx_table; - -/* Allocate */ - if(indx->table_size >= indx->table_allocation) - { - quicktime_indxtable_t *old_table = indx->table; - int new_allocation = indx->table_allocation * 2; - if(new_allocation < 1) new_allocation = 1; - indx->table = calloc(1, sizeof(quicktime_indxtable_t) * new_allocation); - if(old_table) - { - memcpy(indx->table, old_table, sizeof(quicktime_indxtable_t) * indx->table_size); - free(old_table); - } - indx->table_allocation = new_allocation; - } - -/* Append */ - indx_table = &indx->table[indx->table_size++]; - indx_table->index_offset = ix->atom.start - 8; - indx_table->index_size = ix->atom.size; - indx_table->duration = ix->table_size; -} - - - -void quicktime_finalize_indx(quicktime_t *file) -{ - int i, j; - quicktime_riff_t *riff = file->riff[0]; - quicktime_hdrl_t *hdrl = &riff->hdrl; - quicktime_strl_t *strl; - quicktime_indx_t *indx; - quicktime_atom_t junk_atom; - int junk_size; - - - for(i = 0; i < file->moov.total_tracks; i++) - { - strl = hdrl->strl[i]; - indx = &strl->indx; - -/* Write indx */ - quicktime_set_position(file, strl->indx_offset); - quicktime_atom_write_header(file, &indx->atom, "indx"); -/* longs per entry */ - quicktime_write_int16_le(file, indx->longs_per_entry); -/* index sub type */ - quicktime_write_char(file, indx->index_subtype); -/* index type */ - quicktime_write_char(file, indx->index_type); -/* entries in use */ - quicktime_write_int32_le(file, indx->table_size); -/* chunk ID */ - quicktime_write_char32(file, indx->chunk_id); -/* reserved */ - quicktime_write_int32_le(file, 0); - quicktime_write_int32_le(file, 0); - quicktime_write_int32_le(file, 0); - -/* table */ - for(j = 0; j < indx->table_size; j++) - { - quicktime_indxtable_t *indx_table = &indx->table[j]; - quicktime_write_int64_le(file, indx_table->index_offset); - quicktime_write_int32_le(file, indx_table->index_size); - quicktime_write_int32_le(file, indx_table->duration); - } - - quicktime_atom_write_footer(file, &indx->atom); - - - -/* Rewrite JUNK less indx size and indx header size */ - junk_size = strl->padding_size - indx->atom.size - 8; - quicktime_atom_write_header(file, &junk_atom, "JUNK"); - for(j = 0; j < junk_size; j += 4) - quicktime_write_int32_le(file, 0); - quicktime_atom_write_footer(file, &junk_atom); - - } -} - - - - - - - - - -void quicktime_read_indx(quicktime_t *file, - quicktime_strl_t *strl, - quicktime_atom_t *parent_atom) -{ - quicktime_indx_t *indx = &strl->indx; - quicktime_indxtable_t *indx_table; - quicktime_ix_t *ix; - int i; - int64_t offset; - - indx->longs_per_entry = quicktime_read_int16_le(file); - indx->index_subtype = quicktime_read_char(file); - indx->index_type = quicktime_read_char(file); - indx->table_size = quicktime_read_int32_le(file); - quicktime_read_char32(file, indx->chunk_id); - quicktime_read_int32_le(file); - quicktime_read_int32_le(file); - quicktime_read_int32_le(file); - - -//printf("quicktime_read_indx 1\n"); -/* Read indx entries */ - indx->table = calloc(indx->table_size, sizeof(quicktime_indxtable_t)); - for(i = 0; i < indx->table_size; i++) - { - indx_table = &indx->table[i]; - indx_table->index_offset = quicktime_read_int64_le(file); - indx_table->index_size = quicktime_read_int32_le(file); - indx_table->duration = quicktime_read_int32_le(file); - offset = quicktime_position(file); - - indx_table->ix = calloc(indx->table_size, sizeof(quicktime_ix_t*)); - -/* Now read the partial index */ - ix = indx_table->ix = calloc(1, sizeof(quicktime_ix_t)); - quicktime_set_position(file, indx_table->index_offset); - quicktime_read_ix(file, ix); - quicktime_set_position(file, offset); - } -//printf("quicktime_read_indx 100\n"); - -} - - - - diff --git a/cinelerra-5.0/quicktime/avi_ix.c b/cinelerra-5.0/quicktime/avi_ix.c deleted file mode 100644 index b43535d8..00000000 --- a/cinelerra-5.0/quicktime/avi_ix.c +++ /dev/null @@ -1,141 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" -#include - - -static char* make_tag(int number, char *tag) -{ - tag[0] = 'i'; - tag[1] = 'x'; - tag[2] = '0' + (number / 10); - tag[3] = '0' + (number % 10); - return tag; -} - -quicktime_ix_t* quicktime_new_ix(quicktime_t *file, - quicktime_trak_t *trak, - quicktime_strl_t *strl) -{ - quicktime_ix_t *ix = calloc(1, sizeof(quicktime_ix_t)); - ix->base_offset = quicktime_position(file); - make_tag(trak->tkhd.track_id - 1, ix->tag); - ix->longs_per_entry = 2; - ix->index_type = AVI_INDEX_OF_CHUNKS; - memcpy(ix->chunk_id, strl->tag, 4); - return ix; -} - - -void quicktime_delete_ix(quicktime_ix_t *ix) -{ - if(ix->table) free(ix->table); - free(ix); -} - -void quicktime_update_ixtable(quicktime_t *file, - quicktime_trak_t *trak, - int64_t offset, - int size) -{ - quicktime_riff_t *riff = file->riff[file->total_riffs - 1]; - quicktime_movi_t *movi = &riff->movi; - quicktime_ix_t *ix = movi->ix[trak->tkhd.track_id - 1]; - quicktime_ixtable_t *ix_table; - -/* Allocation */ - if(ix->table_size >= ix->table_allocation) - { - quicktime_ixtable_t *old_table = ix->table; - int new_allocation = ix->table_allocation * 2; - if(new_allocation < 1) new_allocation = 1; - ix->table = calloc(1, sizeof(quicktime_ixtable_t) * new_allocation); - if(old_table) - { - memcpy(ix->table, old_table, sizeof(quicktime_ixtable_t) * ix->table_size); - free(old_table); - } - ix->table_allocation = new_allocation; - } - -/* Appendage */ - ix_table = &ix->table[ix->table_size++]; - ix_table->relative_offset = offset - ix->base_offset; - ix_table->size = size; -} - - -void quicktime_write_ix(quicktime_t *file, - quicktime_ix_t *ix, - int track) -{ - int i; - quicktime_atom_write_header(file, &ix->atom, ix->tag); - -/* longs per entry */ - quicktime_write_int16_le(file, ix->longs_per_entry); -/* index sub type */ - quicktime_write_char(file, 0); -/* index type */ - quicktime_write_char(file, ix->index_type); -/* entries in use */ - quicktime_write_int32_le(file, ix->table_size); -/* chunk ID */ - quicktime_write_char32(file, ix->chunk_id); -/* base offset */ - quicktime_write_int64_le(file, ix->base_offset); -/* reserved */ - quicktime_write_int32_le(file, 0); - -/* table */ - for(i = 0; i < ix->table_size; i++) - { - quicktime_ixtable_t *table = &ix->table[i]; - quicktime_write_int32_le(file, table->relative_offset); - quicktime_write_int32_le(file, table->size); - } - - quicktime_atom_write_footer(file, &ix->atom); - - -/* Update super index */ - quicktime_riff_t *riff = file->riff[0]; - quicktime_hdrl_t *hdrl = &riff->hdrl; - quicktime_strl_t *strl = hdrl->strl[track]; - quicktime_indx_t *indx = &strl->indx; - - quicktime_update_indx(file, indx, ix); -} - -void quicktime_read_ix(quicktime_t *file, - quicktime_ix_t *ix) -{ - int i; - quicktime_atom_t leaf_atom; - quicktime_atom_read_header(file, &leaf_atom); - - ix->longs_per_entry = quicktime_read_int16_le(file); -/* sub type */ - quicktime_read_char(file); - ix->index_type = quicktime_read_char(file); - ix->table_size = quicktime_read_int32_le(file); - quicktime_read_char32(file, ix->chunk_id); - ix->base_offset = quicktime_read_int64_le(file); -/* reserved */ - quicktime_read_int32_le(file); - - ix->table = calloc(ix->table_size, sizeof(quicktime_ixtable_t)); - - for(i = 0; i < ix->table_size; i++) - { - quicktime_ixtable_t *ixtable = &ix->table[i]; - ixtable->relative_offset = quicktime_read_int32_le(file); - ixtable->size = quicktime_read_int32_le(file); - } -} - - - - - - - diff --git a/cinelerra-5.0/quicktime/avi_movi.c b/cinelerra-5.0/quicktime/avi_movi.c deleted file mode 100644 index ec09cfa1..00000000 --- a/cinelerra-5.0/quicktime/avi_movi.c +++ /dev/null @@ -1,64 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" - -void quicktime_delete_movi(quicktime_t *file, quicktime_movi_t *movi) -{ - int i; - for(i = 0; i < file->moov.total_tracks; i++) - { - if(movi->ix[i]) quicktime_delete_ix(movi->ix[i]); - } -} - -void quicktime_init_movi(quicktime_t *file, quicktime_riff_t *riff) -{ - int i; - quicktime_riff_t *first_riff = file->riff[0]; - quicktime_movi_t *movi = &riff->movi; - - quicktime_atom_write_header(file, &movi->atom, "LIST"); - quicktime_write_char32(file, "movi"); - -// Initialize partial indexes and relative positions for ix entries - for(i = 0; i < file->moov.total_tracks; i++) - { - quicktime_strl_t *strl = first_riff->hdrl.strl[i]; - quicktime_trak_t *trak = file->moov.trak[i]; - movi->ix[i] = quicktime_new_ix(file, trak, strl); - } -} - -void quicktime_read_movi(quicktime_t *file, - quicktime_atom_t *parent_atom, - quicktime_movi_t *movi) -{ - movi->atom.size = parent_atom->size; -// Relative to start of the movi string - movi->atom.start = parent_atom->start + 8; - quicktime_atom_skip(file, parent_atom); -} - -void quicktime_finalize_movi(quicktime_t *file, quicktime_movi_t *movi) -{ - int i; -// Pad movi to get an even number of bytes - char temp[2] = { 0, 0 }; - quicktime_write_data(file, - temp, - (quicktime_position(file) - movi->atom.start) % 2); - - for(i = 0; i < file->moov.total_tracks; i++) - { - quicktime_ix_t *ix = movi->ix[i]; -// Write partial indexes and update super index - quicktime_write_ix(file, ix, i); - } - - quicktime_atom_write_footer(file, &movi->atom); -} - - - - - - diff --git a/cinelerra-5.0/quicktime/avi_odml.c b/cinelerra-5.0/quicktime/avi_odml.c deleted file mode 100644 index 4159bc3e..00000000 --- a/cinelerra-5.0/quicktime/avi_odml.c +++ /dev/null @@ -1,39 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" - - - -void quicktime_read_odml(quicktime_t *file, quicktime_atom_t *parent_atom) -{ -} - - -void quicktime_init_odml(quicktime_t *file, quicktime_hdrl_t *hdrl) -{ - quicktime_atom_t list_atom, dmlh_atom; - - -// LIST 'odml' - quicktime_atom_write_header(file, &list_atom, "LIST"); - quicktime_write_char32(file, "odml"); -// 'dmlh' - quicktime_atom_write_header(file, &dmlh_atom, "dmlh"); - -// Placeholder for total frames in all RIFF objects - hdrl->total_frames_offset = quicktime_position(file); - quicktime_write_int32_le(file, 0); - - quicktime_atom_write_footer(file, &dmlh_atom); - quicktime_atom_write_footer(file, &list_atom); -} - -void quicktime_finalize_odml(quicktime_t *file, quicktime_hdrl_t *hdrl) -{ -// Get length in frames - quicktime_set_position(file, hdrl->total_frames_offset); -// quicktime_write_int32_le(file, ); -} - - - - diff --git a/cinelerra-5.0/quicktime/avi_riff.c b/cinelerra-5.0/quicktime/avi_riff.c deleted file mode 100644 index 4338a5cd..00000000 --- a/cinelerra-5.0/quicktime/avi_riff.c +++ /dev/null @@ -1,432 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" - - -// This is the main file that converts the AVI tables to Quicktime tables. - - -void quicktime_read_riff(quicktime_t *file, quicktime_atom_t *parent_atom) -{ - quicktime_riff_t *riff = quicktime_new_riff(file); - quicktime_atom_t leaf_atom; - int result = 0; - char data[5]; - - riff->atom = *parent_atom; - -// AVI - quicktime_read_data(file, data, 4); -//printf("quicktime_read_riff 1 %llx\n", quicktime_position(file)); - -// Certain AVI parameters must be copied over to quicktime objects: -// hdrl -> moov -// movi -> mdat -// idx1 -> moov - do - { - result = quicktime_atom_read_header(file, &leaf_atom); - -/* - * printf("quicktime_read_riff 1 %llx %llx %c%c%c%c\n", - * leaf_atom.start, - * leaf_atom.size, - * leaf_atom.type[0], - * leaf_atom.type[1], - * leaf_atom.type[2], - * leaf_atom.type[3]); - */ - if(!result) - { - if(quicktime_atom_is(&leaf_atom, "LIST")) - { - data[4] = 0; - - - result = !quicktime_read_data(file, data, 4); - - - if(!result) - { -// Got LIST 'hdrl' - if(quicktime_match_32(data, "hdrl")) - { - -// No size here. -//printf("quicktime_read_riff 10 %llx\n", quicktime_position(file)); - quicktime_read_hdrl(file, &riff->hdrl, &leaf_atom); -//printf("quicktime_read_riff 20 %llx\n", quicktime_position(file)); - } - else -// Got LIST 'movi' - if(quicktime_match_32(data, "movi")) - { -//printf("quicktime_read_riff 30 %llx\n", quicktime_position(file)); - quicktime_read_movi(file, &leaf_atom, &riff->movi); -//printf("quicktime_read_riff 40 %llx\n", quicktime_position(file)); - } - } - -// Skip it - quicktime_atom_skip(file, &leaf_atom); - - } - else -// Got 'movi' - if(quicktime_atom_is(&leaf_atom, "movi")) - { - quicktime_read_movi(file, &leaf_atom, &riff->movi); - - } - else -// Got 'idx1' original index - if(quicktime_atom_is(&leaf_atom, "idx1")) - { - -//printf("quicktime_read_riff 50 %llx\n", quicktime_position(file)); -// Preload idx1 here - int64_t start_position = quicktime_position(file); - long temp_size = leaf_atom.end - start_position; - char *temp = malloc(temp_size); - quicktime_set_preload(file, - (temp_size < 0x100000) ? 0x100000 : temp_size); - quicktime_read_data(file, temp, temp_size); - quicktime_set_position(file, start_position); - free(temp); - -// Read idx1 - quicktime_read_idx1(file, riff, &leaf_atom); -//printf("quicktime_read_riff 60 %llx\n", quicktime_position(file)); - - } - else -/* Skip it */ - { - - quicktime_atom_skip(file, &leaf_atom); - - } - } - }while(!result && quicktime_position(file) < parent_atom->end); - -//printf("quicktime_read_riff 10\n"); - - -} - - -quicktime_riff_t* quicktime_new_riff(quicktime_t *file) -{ - if(file->total_riffs >= MAX_RIFFS) - { - fprintf(stderr, "quicktime_new_riff file->total_riffs >= MAX_RIFFS\n"); - return 0; - } - else - { - quicktime_riff_t *riff = calloc(1, sizeof(quicktime_riff_t)); - file->riff[file->total_riffs++] = riff; - return riff; - } -} - - - -void quicktime_delete_riff(quicktime_t *file, quicktime_riff_t *riff) -{ - quicktime_delete_hdrl(file, &riff->hdrl); - quicktime_delete_movi(file, &riff->movi); - quicktime_delete_idx1(&riff->idx1); - free(riff); -} - -void quicktime_init_riff(quicktime_t *file) -{ - -// Create new RIFF - quicktime_riff_t *riff = quicktime_new_riff(file); - -// Write riff header -// RIFF 'AVI ' - quicktime_atom_write_header(file, &riff->atom, "RIFF"); - quicktime_write_char32(file, "AVI "); - -// Write header list in first RIFF only - if(file->total_riffs < 2) - { - quicktime_init_hdrl(file, &riff->hdrl); - riff->have_hdrl = 1; - } - - quicktime_init_movi(file, riff); -} - -void quicktime_finalize_riff(quicktime_t *file, quicktime_riff_t *riff) -{ -// Write partial indexes - quicktime_finalize_movi(file, &riff->movi); - if(riff->have_hdrl) - { -//printf("quicktime_finalize_riff 1\n"); - quicktime_finalize_hdrl(file, &riff->hdrl); -//printf("quicktime_finalize_riff 10\n"); -// Write original index for first RIFF - quicktime_write_idx1(file, &riff->idx1); -//printf("quicktime_finalize_riff 100\n"); - } - quicktime_atom_write_footer(file, &riff->atom); -} - - - - -void quicktime_import_avi(quicktime_t *file) -{ - int i, j, k; - quicktime_riff_t *first_riff = file->riff[0]; - quicktime_idx1_t *idx1 = &first_riff->idx1; - - -/* Determine whether to use idx1 or indx indexes for offsets. */ -/* idx1 must always be used for keyframes but it also must be */ -/* ignored for offsets if indx exists. */ - - -//printf("quicktime_import_avi 1\n"); -/* Convert idx1 to keyframes and load offsets and sizes */ - - -// This is a check from mplayer that gives us the right strategy -// for calculating real offset. -// is_odml is not currently set anywhere, but when we will support -// odml, this will be ready... - - int index_format = 0; - - if(idx1->table_size > 1) - { - - if((idx1->table[0].offset < first_riff->movi.atom.start + 4 || - idx1->table[1].offset < first_riff->movi.atom.start + 4) && - !file->is_odml) - index_format = 1; - else - index_format = 0; - } - - for(i = 0; i < idx1->table_size; i++) - { - quicktime_idx1table_t *idx1table = idx1->table + i; - char *tag = idx1table->tag; - int track_number = (tag[0] - '0') * 10 + (tag[1] - '0'); - if(track_number < file->moov.total_tracks) - { - quicktime_trak_t *trak = file->moov.trak[track_number]; - quicktime_strl_t *strl = first_riff->hdrl.strl[track_number]; - int is_audio = trak->mdia.minf.is_audio; - int is_video = trak->mdia.minf.is_video; - - -/* Chunk offset */ - quicktime_stco_t *stco = &trak->mdia.minf.stbl.stco; -/* Sample size */ - quicktime_stsz_t *stsz = &trak->mdia.minf.stbl.stsz; -/* Samples per chunk */ - quicktime_stsc_t *stsc = &trak->mdia.minf.stbl.stsc; -/* Sample description */ - quicktime_stsd_t *stsd = &trak->mdia.minf.stbl.stsd; - - - - -/* Enter the offset and size no matter what so the sample counts */ -/* can be used to set keyframes */ - if (index_format == 1) - quicktime_update_stco(stco, - stco->total_entries + 1, - idx1table->offset + first_riff->movi.atom.start); - else - quicktime_update_stco(stco, - stco->total_entries + 1, - idx1table->offset); - - if(is_video) - { -/* Just get the keyframe flag. don't call quicktime_insert_keyframe because */ -/* that updates idx1 and we don't have a track map. */ - int is_keyframe = (idx1table->flags & AVI_KEYFRAME) == AVI_KEYFRAME; - if(is_keyframe) - { - quicktime_stss_t *stss = &trak->mdia.minf.stbl.stss; -/* This is done before the image size table so this value is right */ - int frame = stsz->total_entries; - -/* Expand table */ - if(stss->entries_allocated <= stss->total_entries) - { - stss->entries_allocated *= 2; - stss->table = realloc(stss->table, - sizeof(quicktime_stss_table_t) * stss->entries_allocated); - } - stss->table[stss->total_entries++].sample = frame; - } - -/* Set image size */ - quicktime_update_stsz(stsz, - stsz->total_entries, - idx1table->size); - } - else - if(is_audio) - { - strl->total_bytes += idx1table->size; -/* Set samples per chunk if PCM */ - if(stsd->table[0].sample_size > 0) - { - quicktime_update_stsc(stsc, - stsc->total_entries + 1, - idx1table->size * - 8 / - stsd->table[0].sample_size / - stsd->table[0].channels); - } - } - } - } - -//printf("quicktime_import_avi 10\n"); - - -/* Convert super indexes into Quicktime indexes. */ -/* Append to existing entries if idx1 exists. */ -/* No keyframes here. */ - for(i = 0; i < file->moov.total_tracks; i++) - { - quicktime_strl_t *strl = first_riff->hdrl.strl[i]; - - if(strl->have_indx) - { - quicktime_indx_t *indx = &strl->indx; - quicktime_trak_t *trak = file->moov.trak[i]; - quicktime_stco_t *stco = &trak->mdia.minf.stbl.stco; - quicktime_stsz_t *stsz = &trak->mdia.minf.stbl.stsz; - quicktime_stsc_t *stsc = &trak->mdia.minf.stbl.stsc; - quicktime_stsd_t *stsd = &trak->mdia.minf.stbl.stsd; -/* Get existing chunk count from the idx1 */ - int existing_chunks = stco->total_entries; - -/* Read each indx entry */ - for(j = 0; j < indx->table_size; j++) - { - quicktime_indxtable_t *indx_table = &indx->table[j]; - quicktime_ix_t *ix = indx_table->ix; - - for(k = 0; k < ix->table_size; k++) - { -/* Copy from existing chunk count to end of ix table */ - if(existing_chunks <= 0) - { - quicktime_ixtable_t *ixtable = &ix->table[k]; - -/* Do the same things that idx1 did to the chunk tables */ -/* Subtract the super indexes by size of the header. McRoweSoft seems to */ -/* want the header before the ix offset but after the idx1 offset. */ - quicktime_update_stco(stco, - stco->total_entries + 1, - ixtable->relative_offset + ix->base_offset - 8); - if(strl->is_video) - { - quicktime_update_stsz(stsz, - stsz->total_entries, - ixtable->size); - } - else - if(strl->is_audio) - { - strl->total_bytes += ixtable->size; - if(stsd->table[0].sample_size > 0) - { - quicktime_update_stsc(stsc, - stsc->total_entries + 1, - ixtable->size * - 8 / - stsd->table[0].sample_size / - stsd->table[0].channels); - } - } - } - else - existing_chunks--; - } - } - } - } - - -//printf("quicktime_import_avi 20\n"); - - - - -/* Set total samples, time to sample, for audio */ - for(i = 0; i < file->moov.total_tracks; i++) - { - quicktime_trak_t *trak = file->moov.trak[i]; - quicktime_stsz_t *stsz = &trak->mdia.minf.stbl.stsz; - quicktime_stsc_t *stsc = &trak->mdia.minf.stbl.stsc; - quicktime_stco_t *stco = &trak->mdia.minf.stbl.stco; - quicktime_stts_t *stts = &trak->mdia.minf.stbl.stts; - quicktime_stsd_t *stsd = &trak->mdia.minf.stbl.stsd; - - if(trak->mdia.minf.is_audio) - { - quicktime_stsc_table_t *stsc_table = stsc->table; - quicktime_strl_t *strl = first_riff->hdrl.strl[i]; - int64_t total_entries = stsc->total_entries; - int64_t chunk = stco->total_entries; - int64_t sample = 0; - -//printf("quicktime_import_avi %lld %lld %lld\n", -//strl->total_bytes, strl->bytes_per_second, (int)stsd->table[0].sample_rate); -// Derive stsc from bitrate for some MP3 files - if(!total_entries) - { - quicktime_update_stsc(stsc, - ++total_entries, - strl->total_bytes / - strl->bytes_per_second * - (int)stsd->table[0].sample_rate); - } - - -// Derive total samples from samples per chunk table - if(chunk > 0) - { - sample = quicktime_sample_of_chunk(trak, chunk) + - stsc_table[total_entries - 1].samples; - } - - stsz->sample_size = 1; - stsz->total_entries = sample; - stts->table[0].sample_count = sample; - } - else - if(trak->mdia.minf.is_video) - { - stsc->total_entries = 1; -/* stts has 1 allocation by default */ - stts->table[0].sample_count = stco->total_entries; - } - } - -//printf("quicktime_import_avi 30\n"); - -} - - - - - - - - - diff --git a/cinelerra-5.0/quicktime/avi_strl.c b/cinelerra-5.0/quicktime/avi_strl.c deleted file mode 100644 index 5e4d85c5..00000000 --- a/cinelerra-5.0/quicktime/avi_strl.c +++ /dev/null @@ -1,452 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" -#include - - -// Update during close: -// length -// samples per chunk -#define JUNK_SIZE 0x1018 - - - -quicktime_strl_t* quicktime_new_strl() -{ - quicktime_strl_t *strl = calloc(1, sizeof(quicktime_strl_t)); - return strl; -} - - -void quicktime_init_strl(quicktime_t *file, - quicktime_audio_map_t *atrack, - quicktime_video_map_t *vtrack, - quicktime_trak_t *trak, - quicktime_strl_t *strl) -{ - quicktime_atom_t list_atom, strh_atom, strf_atom; - quicktime_atom_t junk_atom; - int i; - -/* Construct tag */ - if(vtrack) - { - strl->tag[0] = '0' + (trak->tkhd.track_id - 1) / 10; - strl->tag[1] = '0' + (trak->tkhd.track_id - 1) % 10; - strl->tag[2] = 'd'; - strl->tag[3] = 'c'; - } - else - if(atrack) - { - strl->tag[0] = '0' + (trak->tkhd.track_id - 1) / 10; - strl->tag[1] = '0' + (trak->tkhd.track_id - 1) % 10; - strl->tag[2] = 'w'; - strl->tag[3] = 'b'; - } - - -/* LIST 'strl' */ - quicktime_atom_write_header(file, &list_atom, "LIST"); - quicktime_write_char32(file, "strl"); - -/* 'strh' */ - quicktime_atom_write_header(file, &strh_atom, "strh"); - - - -/* vids */ - if(vtrack) - { - quicktime_write_char32(file, "vids"); - quicktime_write_char32(file, - trak->mdia.minf.stbl.stsd.table[0].format); -/* flags */ - quicktime_write_int32_le(file, 0); -/* priority */ - quicktime_write_int16_le(file, 0); -/* language */ - quicktime_write_int16_le(file, 0); -/* initial frame */ - quicktime_write_int32_le(file, 0); - -/* framerate denominator */ - quicktime_write_int32_le(file, - trak->mdia.minf.stbl.stts.table[0].sample_duration); -/* framerate numerator */ - quicktime_write_int32_le(file, - trak->mdia.mdhd.time_scale); - -/* start */ - quicktime_write_int32_le(file, 0); - strl->length_offset = quicktime_position(file); -/* length: fill later */ - quicktime_write_int32_le(file, 0); -/* suggested buffer size */ - quicktime_write_int32_le(file, 0); -/* quality */ - quicktime_write_int32_le(file, -1); -/* sample size */ - quicktime_write_int32_le(file, 0); - quicktime_write_int16_le(file, 0); - quicktime_write_int16_le(file, 0); - quicktime_write_int16_le(file, trak->tkhd.track_width); - quicktime_write_int16_le(file, trak->tkhd.track_height); - } - else -/* auds */ - if(atrack) - { - quicktime_write_char32(file, "auds"); - quicktime_write_int32_le(file, 0); -/* flags */ - quicktime_write_int32_le(file, 0); -/* priority */ - quicktime_write_int16_le(file, 0); -/* language */ - quicktime_write_int16_le(file, 0); -/* initial frame */ - quicktime_write_int32_le(file, 0); - strl->samples_per_chunk_offset = quicktime_position(file); -/* samples per chunk */ - quicktime_write_int32_le(file, 0); -/* sample rate * samples per chunk if uncompressed */ -/* sample rate if compressed */ - quicktime_write_int32_le(file, 0); -/* start */ - quicktime_write_int32_le(file, 0); - strl->length_offset = quicktime_position(file); -/* length, XXX: filled later */ - quicktime_write_int32_le(file, 0); -/* suggested buffer size */ - quicktime_write_int32_le(file, 0); -/* quality */ - quicktime_write_int32_le(file, -1); -/* sample size: 0 for compressed and number of bytes for uncompressed */ - strl->sample_size_offset = quicktime_position(file); - quicktime_write_int32_le(file, 0); - quicktime_write_int32_le(file, 0); - quicktime_write_int32_le(file, 0); - } - quicktime_atom_write_footer(file, &strh_atom); - - - - - - - -/* strf */ - quicktime_atom_write_header(file, &strf_atom, "strf"); - - if(vtrack) - { -/* atom size repeated */ - quicktime_write_int32_le(file, 40); - quicktime_write_int32_le(file, trak->tkhd.track_width); - quicktime_write_int32_le(file, trak->tkhd.track_height); -/* planes */ - quicktime_write_int16_le(file, 1); -/* depth */ - quicktime_write_int16_le(file, 24); - quicktime_write_char32(file, - trak->mdia.minf.stbl.stsd.table[0].format); - quicktime_write_int32_le(file, - trak->tkhd.track_width * trak->tkhd.track_height * 3); - quicktime_write_int32_le(file, 0); - quicktime_write_int32_le(file, 0); - quicktime_write_int32_le(file, 0); - quicktime_write_int32_le(file, 0); - } - else - if(atrack) - { -/* By now the codec is instantiated so the WAV ID is available. */ - quicktime_codec_t *codec_base = atrack->codec; - int wav_id = codec_base->wav_id; - - quicktime_write_int16_le(file, - wav_id); - quicktime_write_int16_le(file, - trak->mdia.minf.stbl.stsd.table[0].channels); -/* nSamplesPerSec as per MSDN */ - quicktime_write_int32_le(file, - trak->mdia.minf.stbl.stsd.table[0].sample_rate); - if (wav_id == 0x01) // PCM - { -/* nAvgBytesPerSec as per MSDN*/ - quicktime_write_int32_le(file, trak->mdia.minf.stbl.stsd.table[0].sample_rate * trak->mdia.minf.stbl.stsd.table[0].sample_size * trak->mdia.minf.stbl.stsd.table[0].channels / 8); -/* nBlockAlign as per MSDN, very important value */ -/* nBlockAlign have to be the same is used in many players instead of dwSampleSize - so they should be the same */ -/* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcemultimedia5/html/wce50conAVIStreamHeaders.asp */ -/* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcemultimedia5/html/wce50lrfwaveformatex91.asp */ - quicktime_write_int16_le(file, trak->mdia.minf.stbl.stsd.table[0].sample_size * trak->mdia.minf.stbl.stsd.table[0].channels / 8); - } - else - { -/* FIXME: These two are complete rubbish, according to my knowledge, they depend on the codec */ - quicktime_write_int32_le(file, 256000 / 8); // nAvgBytesPerSec - quicktime_write_int16_le(file, 1); // nBlockAling - } - -/* bits per sample */ - quicktime_write_int16_le(file, - trak->mdia.minf.stbl.stsd.table[0].sample_size); - quicktime_write_int16_le(file, 0); - } - - quicktime_atom_write_footer(file, &strf_atom); - - - - -/* Junk is required in Windows. */ -/* In Heroine Kernel it's padding for the super index */ - strl->indx_offset = quicktime_position(file); - strl->padding_size = JUNK_SIZE; - - - - quicktime_atom_write_header(file, &junk_atom, "JUNK"); - for(i = 0; i < strl->padding_size; i += 4) - quicktime_write_int32_le(file, 0); - quicktime_atom_write_footer(file, &junk_atom); - - -/* Initialize super index */ - quicktime_init_indx(file, &strl->indx, strl); - - - quicktime_atom_write_footer(file, &list_atom); -} - - - -void quicktime_delete_strl(quicktime_strl_t *strl) -{ - quicktime_delete_indx(&strl->indx); - free(strl); -} - -void quicktime_read_strl(quicktime_t *file, - quicktime_strl_t *strl, - quicktime_atom_t *parent_atom) -{ -// These are 0 if no track is currently being processed. -// Set to 1 if audio or video track is being processed. - char data[4], codec[4]; - int denominator = 0; - int numerator = 0; - double frame_rate = 0; - int width = 0; - int height = 0; - int depth = 0; - int frames = 0; - int bytes_per_sample = 0; - int sample_size = 0; - int samples_per_chunk = 0; - int channels = 0; - int sample_rate = 0; - int compression_id = 0; - quicktime_trak_t *trak = 0; - - codec[0] = codec[1] = codec[2] = codec[3] = 0; - -/* AVI translation: */ -/* vids -> trak */ -/* auds -> trak */ -/* Only one track is in each strl object */ - do - { - quicktime_atom_t leaf_atom; - quicktime_atom_read_header(file, &leaf_atom); - -// strh - if(quicktime_atom_is(&leaf_atom, "strh")) - { -// stream type - quicktime_read_data(file, data, 4); - - if(quicktime_match_32(data, "vids")) - { - trak = quicktime_add_trak(file); - width = 0; - height = 0; - depth = 24; - frames = 0; - strl->is_video = 1; - - - trak->tkhd.track_id = file->moov.mvhd.next_track_id; - file->moov.mvhd.next_track_id++; - - -/* Codec */ - quicktime_read_data(file, - codec, - 4); -/* Blank */ - quicktime_set_position(file, quicktime_position(file) + 12); - denominator = quicktime_read_int32_le(file); - numerator = quicktime_read_int32_le(file); -/* - * printf("quicktime_read_strl 1 %c%c%c%c %d %d\n", - * codec[0], - * codec[1], - * codec[2], - * codec[3], - * numerator, - * denominator); - */ - if(denominator != 0) - frame_rate = (double)numerator / denominator; - else - frame_rate = numerator; - -// Canon TX1 - if(numerator == 1000000 && - denominator == 33333) - frame_rate = 30.00; - -/* Blank */ - quicktime_set_position(file, quicktime_position(file) + 4); - frames = quicktime_read_int32_le(file); - } - else -/* AVI auds */ - if(quicktime_match_32(data, "auds")) - { - trak = quicktime_add_trak(file); - sample_size = 16; - channels = 2; - sample_rate = 0; - compression_id = 0; - strl->is_audio = 1; - - trak->tkhd.track_id = file->moov.mvhd.next_track_id; - file->moov.mvhd.next_track_id++; -// codec tag - quicktime_read_data(file, - codec, - 4); -//printf("quicktime_read_strl 2 %c%c%c%c\n", codec[0], codec[1], codec[2], codec[3]); -// flags 32, priority 16, language 16, initial frame 32 - quicktime_set_position(file, quicktime_position(file) + 12); - - samples_per_chunk = quicktime_read_int32_le(file); - strl->bytes_per_second = quicktime_read_int32_le(file); - quicktime_set_position(file, quicktime_position(file) + 4); -/* length of track */ - strl->samples = quicktime_read_int32_le(file); -/* suggested buffer size, quality */ - quicktime_set_position(file, quicktime_position(file) + 8); - -// If this is 0 use constant samples_per_chunk to guess locations. -// If it isn't 0 synthesize samples per chunk table to get locations. -// McRowesoft doesn't really obey this rule so we may need to base it on codec ID. - bytes_per_sample = quicktime_read_int32_le(file); -//printf("quicktime_read_strl 20 %d\n", samples_per_chunk); - } - } -// strf - else - if(quicktime_atom_is(&leaf_atom, "strf")) - { - if(strl->is_video) - { -/* atom size repeated */ - quicktime_read_int32_le(file); - width = quicktime_read_int32_le(file); - height = quicktime_read_int32_le(file); -/* Panes */ - quicktime_read_int16_le(file); -/* Depth in bits */ - depth = quicktime_read_int16_le(file); - quicktime_read_data(file, - codec, - 4); - } - else - if(strl->is_audio) - { - compression_id = quicktime_read_int16_le(file); - channels = quicktime_read_int16_le(file); - sample_rate = quicktime_read_int32_le(file); - quicktime_set_position(file, quicktime_position(file) + 6); - sample_size = quicktime_read_int16_le(file); -//printf("quicktime_read_strl 40 %d %d %d\n", channels, sample_rate, sample_size); - } - } - else -// Super index. -// Read the super index + all the partial indexes now - if(quicktime_atom_is(&leaf_atom, "indx")) - { -//printf("quicktime_read_strl 50\n"); - quicktime_read_indx(file, strl, &leaf_atom); - strl->have_indx = 1; - } - -//printf("quicktime_read_strl 60\n"); - - -// Next object - quicktime_atom_skip(file, &leaf_atom); - }while(quicktime_position(file) < parent_atom->end); -//printf("quicktime_read_strl 70 %d %d\n", strl->is_audio, strl->is_video); - - - if(strl->is_video) - { -/* Generate quicktime structures */ - quicktime_trak_init_video(file, - trak, - width, - height, - frame_rate, - codec); - quicktime_mhvd_init_video(file, - &file->moov.mvhd, - frame_rate); - trak->mdia.mdhd.duration = frames; -// trak->mdia.mdhd.time_scale = 1; - memcpy(trak->mdia.minf.stbl.stsd.table[0].format, codec, 4); - trak->mdia.minf.stbl.stsd.table[0].depth = depth; - } - else - if(strl->is_audio) - { -/* Generate quicktime structures */ -//printf("quicktime_read_strl 70 %d\n", sample_size); - quicktime_trak_init_audio(file, - trak, - channels, - sample_rate, - sample_size, - codec); - - -// We store a constant samples per chunk based on the -// packet size if sample_size zero -// and calculate the samples per chunk based on the chunk size if sample_size -// is nonzero. -// trak->mdia.minf.stbl.stsd.table[0].sample_size = bytes_per_sample; - trak->mdia.minf.stbl.stsd.table[0].compression_id = compression_id; - -/* Synthesize stsc table for constant samples per chunk */ - if(!bytes_per_sample) - { -/* Should be enough entries allocated in quicktime_stsc_init_table */ - trak->mdia.minf.stbl.stsc.table[0].samples = samples_per_chunk; - trak->mdia.minf.stbl.stsc.total_entries = 1; - } -//printf("quicktime_read_strl samples=%d samples_per_chunk=%d bytes_per_sample=%d bytes_per_second=%d\n", -//strl->samples, samples_per_chunk, bytes_per_sample, strl->bytes_per_second); - } - - -//printf("quicktime_read_strl 100\n"); -} - - - - diff --git a/cinelerra-5.0/quicktime/cmodel_default.c b/cinelerra-5.0/quicktime/cmodel_default.c deleted file mode 100644 index 30269770..00000000 --- a/cinelerra-5.0/quicktime/cmodel_default.c +++ /dev/null @@ -1,2169 +0,0 @@ -/* - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ -#include "cmodel_permutation.h" - - - - - - - - - -// ********************************* YUV101010 -> ***************************** - -#define READ_YUV101010 \ - uint64_t y, u, v; \ - uint32_t input_i = input[0] | \ - (input[1] << 8) | \ - (input[2] << 16) | \ - (input[3] << 24); \ - \ - y = ((input_i & 0xffc00000) >> 16) | 0x3f; \ - u = ((input_i & 0x3ff000) >> 6) | 0x3f; \ - v = ((input_i & 0xffc) << 4) | 0x3f; - - - - - - -static inline void transfer_YUV101010_to_RGB8(unsigned char *(*output), unsigned char *input) -{ - int r, g, b; - - READ_YUV101010 - - y = (y << 8) | (y >> 8); - - YUV_TO_RGB16(y, u, v, r, g, b); - - *(*output)++ = (unsigned char)(((input[0] & 0xc000) >> 8) + - ((input[1] & 0xe000) >> 10) + - ((input[2] & 0xe000) >> 13)); -} - -static inline void transfer_YUV101010_to_BGR565(unsigned char *(*output), unsigned char *input) -{ - int r, g, b; - - READ_YUV101010 - - y = (y << 8) | (y >> 8); - - YUV_TO_RGB16(y, u, v, r, g, b); - - *(uint16_t*)(*output) = (b & 0xf800) | - ((g & 0xfc00) >> 5) | - ((r & 0xf800) >> 11); - (*output) += 2; -} - -static inline void transfer_YUV101010_to_RGB565(unsigned char *(*output), unsigned char *input) -{ - int r, g, b; - - READ_YUV101010 - - y = (y << 8) | (y >> 8); - - YUV_TO_RGB16(y, u, v, r, g, b); - - *(uint16_t*)(*output) = (r & 0xf800) | - ((g & 0xfc00) >> 5) | - ((b & 0xf800) >> 11); - (*output) += 2; -} - -static inline void transfer_YUV101010_to_BGR888(unsigned char *(*output), unsigned char *input) -{ - int r, g, b; - - READ_YUV101010 - - y = (y << 8) | (y >> 8); - - YUV_TO_RGB16(y, u, v, r, g, b); - - *(*output)++ = b >> 8; - *(*output)++ = g >> 8; - *(*output)++ = r >> 8; -} - -static inline void transfer_YUV101010_to_BGR8888(unsigned char *(*output), unsigned char *input) -{ - int r, g, b; - - READ_YUV101010 - - y = (y << 8) | (y >> 8); - - YUV_TO_RGB16(y, u, v, r, g, b); - - *(*output)++ = b >> 8; - *(*output)++ = g >> 8; - *(*output)++ = r >> 8; - (*output)++; -} - -static inline void transfer_YUV101010_to_YUV888(unsigned char *(*output), unsigned char *input) -{ - READ_YUV101010 - - *(*output)++ = y >> 8; - *(*output)++ = u >> 8; - *(*output)++ = v >> 8; -} - -static inline void transfer_YUV101010_to_YUVA8888(unsigned char *(*output), unsigned char *input) -{ - READ_YUV101010 - - *(*output)++ = y >> 8; - *(*output)++ = u >> 8; - *(*output)++ = v >> 8; - *(*output)++ = 0xff; -} - -static inline void transfer_YUV101010_to_YUV161616(uint16_t *(*output), unsigned char *input) -{ - READ_YUV101010 - - *(*output)++ = y; - *(*output)++ = u; - *(*output)++ = v; -} - -static inline void transfer_YUV101010_to_YUVA16161616(uint16_t *(*output), unsigned char *input) -{ - READ_YUV101010 - - *(*output)++ = y; - *(*output)++ = u; - *(*output)++ = v; - *(*output)++ = 0xffff; -} - -static inline void transfer_YUV101010_to_RGB888(unsigned char *(*output), unsigned char *input) -{ - int r, g, b; - - READ_YUV101010 - - y = (y << 8) | (y >> 8); - - YUV_TO_RGB16(y, u, v, r, g, b); - - *(*output)++ = r >> 8; - *(*output)++ = g >> 8; - *(*output)++ = b >> 8; -} - -static inline void transfer_YUV101010_to_RGBA8888(unsigned char *(*output), unsigned char *input) -{ - int r, g, b; - - READ_YUV101010 - - y = (y << 8) | (y >> 8); - - YUV_TO_RGB16(y, u, v, r, g, b); - - *(*output)++ = r >> 8; - *(*output)++ = g >> 8; - *(*output)++ = b >> 8; - *(*output)++ = 0xff; -} - -static inline void transfer_YUV101010_to_RGB161616(uint16_t *(*output), unsigned char *input) -{ - int r, g, b; - - READ_YUV101010 - - y = (y << 8) | (y >> 8); - - YUV_TO_RGB16(y, u, v, r, g, b); - - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; -} - -static inline void transfer_YUV101010_to_RGBA16161616(uint16_t *(*output), unsigned char *input) -{ - int r, g, b; - - READ_YUV101010 - - y = (y << 8) | (y >> 8); - - YUV_TO_RGB16(y, u, v, r, g, b); - - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; - *(*output)++ = 0xffff; -} - - - - -static inline void transfer_YUV101010_to_RGB_FLOAT(float *(*output), - unsigned char *input) -{ - float r, g, b; - float y_f; - - READ_YUV101010 - - y_f = (float)y / 0xffff; - - YUV16_TO_RGB_FLOAT(y_f, u, v, r, g, b); - - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; -} - -static inline void transfer_YUV101010_to_RGBA_FLOAT(float *(*output), - unsigned char *input) -{ - float r, g, b; - float y_f; - - READ_YUV101010 - - y_f = (float)y / 0xffff; - - YUV16_TO_RGB_FLOAT(y_f, u, v, r, g, b); - - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; - *(*output)++ = 1.0; -} - - - - - - - - - - - - - - - - - - - -// ******************************** VYU888 -> ********************************* - - -static inline void transfer_VYU888_to_RGB8(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = ((int)input[1]) << 16; - u = input[2]; - v = input[0]; - YUV_TO_RGB(y, u, v, r, g, b); - - *(*output) = (unsigned char)((r & 0xc0) + - ((g & 0xe0) >> 2) + - ((b & 0xe0) >> 5)); - (*output)++; -} - -static inline void transfer_VYU888_to_BGR565(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = ((int)input[1]) << 16; - u = input[2]; - v = input[0]; - YUV_TO_RGB(y, u, v, r, g, b); - *(uint16_t*)(*output) = ((b & 0xf8) << 8) - + ((g & 0xfc) << 3) - + ((r & 0xf8) >> 3); - (*output) += 2; -} - -static inline void transfer_VYU888_to_RGB565(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = ((int)input[1]) << 16; - u = input[2]; - v = input[0]; - YUV_TO_RGB(y, u, v, r, g, b); - *(uint16_t*)(*output) = ((r & 0xf8) << 8) - + ((g & 0xfc) << 3) - + ((b & 0xf8) >> 3); - (*output) += 2; -} - -static inline void transfer_VYU888_to_BGR888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = ((int)input[1]) << 16; - u = input[2]; - v = input[0]; - YUV_TO_RGB(y, u, v, r, g, b); - - (*output)[2] = r; - (*output)[1] = g; - (*output)[0] = b; - (*output) += 3; -} - -static inline void transfer_VYU888_to_BGR8888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = ((int)input[1]) << 16; - u = input[2]; - v = input[0]; - YUV_TO_RGB(y, u, v, r, g, b); - (*output)[2] = r; - (*output)[1] = g; - (*output)[0] = b; - (*output) += 4; -} - - -static inline void transfer_VYU888_to_RGB888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = ((int)input[1]) << 16; - u = input[2]; - v = input[0]; - YUV_TO_RGB(y, u, v, r, g, b); - - (*output)[0] = r; - (*output)[1] = g; - (*output)[2] = b; - (*output) += 3; -} - -static inline void transfer_VYU888_to_RGBA8888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = ((int)input[1]) << 16; - u = input[2]; - v = input[0]; - YUV_TO_RGB(y, u, v, r, g, b); - - (*output)[0] = r; - (*output)[1] = g; - (*output)[2] = b; - (*output)[3] = 0xff; - (*output) += 4; -} - - -static inline void transfer_VYU888_to_RGB161616(uint16_t *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = (input[1] << 16) | (input[1] << 8) | input[1]; - u = (input[2] << 8) | input[2]; - v = (input[0] << 8) | input[0]; - YUV_TO_RGB16(y, u, v, r, g, b); - - (*output)[0] = r; - (*output)[1] = g; - (*output)[2] = b; - (*output) += 3; -} - -static inline void transfer_VYU888_to_RGBA16161616(uint16_t *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = (input[1] << 16) | (input[1] << 8) | input[1]; - u = (input[2] << 8) | input[2]; - v = (input[0] << 8) | input[0]; - YUV_TO_RGB16(y, u, v, r, g, b); - - (*output)[0] = r; - (*output)[1] = g; - (*output)[2] = b; - (*output)[3] = 0xffff; - (*output) += 3; -} - - -static inline void transfer_VYU888_to_RGB_FLOAT(float *(*output), unsigned char *input) -{ - float y; - int u, v; - float r, g, b; - - v = *input++; - y = (float)*input++ / 0xff; - u = *input; - YUV_TO_FLOAT(y, u, v, r, g, b); - -//printf("transfer_VYU888_to_RGB_FLOAT %d (*output)=%p\n", __LINE__, *output); - - (*output)[0] = r; - (*output)[1] = g; - (*output)[2] = b; - (*output) += 3; -} - -static inline void transfer_VYU888_to_RGBA_FLOAT(float *(*output), unsigned char *input) -{ - float y; - int u, v; - float r, g, b; - - v = *input++; - y = (float)*input++ / 0xff; - u = *input; - YUV_TO_FLOAT(y, u, v, r, g, b); - - (*output)[0] = r; - (*output)[1] = g; - (*output)[2] = b; - (*output)[3] = 1.0; - (*output) += 4; -} - - -static inline void transfer_VYU888_to_YUV888(unsigned char *(*output), unsigned char *input) -{ - (*output)[0] = input[1]; - (*output)[1] = input[2]; - (*output)[2] = input[0]; - (*output) += 3; -} - -static inline void transfer_VYU888_to_YUVA8888(unsigned char *(*output), unsigned char *input) -{ - (*output)[0] = input[1]; - (*output)[1] = input[2]; - (*output)[2] = input[0]; - (*output)[3] = 0xff; - (*output) += 4; -} - - -static inline void transfer_VYU888_to_YUV161616(uint16_t *(*output), unsigned char *input) -{ - (*output)[0] = ((int)input[1]) << 8; - (*output)[1] = ((int)input[2]) << 8; - (*output)[2] = ((int)input[0]) << 8; - (*output) += 3; -} - -static inline void transfer_VYU888_to_YUVA16161616(uint16_t *(*output), unsigned char *input) -{ - (*output)[0] = ((int)input[1]) << 8; - (*output)[1] = ((int)input[2]) << 8; - (*output)[2] = ((int)input[0]) << 8; - (*output)[3] = 0xff; - (*output) += 4; -} - - - - - - - - - - - - -// ******************************** UYVA8888 -> ********************************* - - -static inline void transfer_UYVA8888_to_RGB8(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = ((int)input[1]) << 16; - u = input[0]; - v = input[2]; - YUV_TO_RGB(y, u, v, r, g, b); - - r = r * input[3] / 0xff; - g = g * input[3] / 0xff; - b = b * input[3] / 0xff; - *(*output) = (unsigned char)((r & 0xc0) + - ((g & 0xe0) >> 2) + - ((b & 0xe0) >> 5)); - (*output)++; -} - -static inline void transfer_UYVA8888_to_BGR565(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = ((int)input[1]) << 16; - u = input[0]; - v = input[2]; - YUV_TO_RGB(y, u, v, r, g, b); - r = r * input[3] / 0xff; - g = g * input[3] / 0xff; - b = b * input[3] / 0xff; - *(uint16_t*)(*output) = ((b & 0xf8) << 8) - + ((g & 0xfc) << 3) - + ((r & 0xf8) >> 3); - (*output) += 2; -} - -static inline void transfer_UYVA8888_to_RGB565(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = ((int)input[1]) << 16; - u = input[0]; - v = input[2]; - YUV_TO_RGB(y, u, v, r, g, b); - r = r * input[3] / 0xff; - g = g * input[3] / 0xff; - b = b * input[3] / 0xff; - *(uint16_t*)(*output) = ((r & 0xf8) << 8) - + ((g & 0xfc) << 3) - + ((b & 0xf8) >> 3); - (*output) += 2; -} - -static inline void transfer_UYVA8888_to_BGR888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = ((int)input[1]) << 16; - u = input[0]; - v = input[2]; - YUV_TO_RGB(y, u, v, r, g, b); - r = r * input[3] / 0xff; - g = g * input[3] / 0xff; - b = b * input[3] / 0xff; - - (*output)[2] = r; - (*output)[1] = g; - (*output)[0] = b; - (*output) += 3; -} - -static inline void transfer_UYVA8888_to_BGR8888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = ((int)input[1]) << 16; - u = input[0]; - v = input[2]; - YUV_TO_RGB(y, u, v, r, g, b); - r = r * input[3] / 0xff; - g = g * input[3] / 0xff; - b = b * input[3] / 0xff; - - (*output)[2] = r; - (*output)[1] = g; - (*output)[0] = b; - (*output) += 4; -} - - -static inline void transfer_UYVA8888_to_RGB888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = ((int)input[1]) << 16; - u = input[0]; - v = input[2]; - YUV_TO_RGB(y, u, v, r, g, b); - r = r * input[3] / 0xff; - g = g * input[3] / 0xff; - b = b * input[3] / 0xff; - - (*output)[0] = r; - (*output)[1] = g; - (*output)[2] = b; - (*output) += 3; -} - -static inline void transfer_UYVA8888_to_RGBA8888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = ((int)input[1]) << 16; - u = input[0]; - v = input[2]; - YUV_TO_RGB(y, u, v, r, g, b); - - (*output)[0] = r; - (*output)[1] = g; - (*output)[2] = b; - (*output)[3] = input[3]; - (*output) += 4; -} - - -static inline void transfer_UYVA8888_to_RGB161616(uint16_t *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = ((int)input[1]) << 16; - u = (input[0] << 8) | input[0]; - v = (input[2] << 8) | input[2]; - YUV_TO_RGB16(y, u, v, r, g, b); - r = r * input[3] / 0xff; - g = g * input[3] / 0xff; - b = b * input[3] / 0xff; - - (*output)[0] = r; - (*output)[1] = g; - (*output)[2] = b; - (*output) += 3; -} - -static inline void transfer_UYVA8888_to_RGBA16161616(uint16_t *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = ((int)input[1]) << 16; - u = (input[0] << 8) | input[0]; - v = (input[2] << 8) | input[2]; - YUV_TO_RGB16(y, u, v, r, g, b); - - (*output)[0] = r; - (*output)[1] = g; - (*output)[2] = b; - (*output)[3] = input[3] << 8; - (*output) += 4; -} - -static inline void transfer_UYVA8888_to_RGB_FLOAT(float *(*output), unsigned char *input) -{ - float y, a; - int u, v; - float r, g, b; - - u = *input++; - y = (float)*input++ / 0xff; - v = *input++; - a = (float)*input / 0xff; - YUV_TO_FLOAT(y, u, v, r, g, b); - - r = r * a; - g = g * a; - b = b * a; - - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; -} - -static inline void transfer_UYVA8888_to_RGBA_FLOAT(float *(*output), unsigned char *input) -{ - float y, a; - int u, v; - float r, g, b; - - u = *input++; - y = (float)*input++ / 0xff; - v = *input++; - a = (float)*input / 0xff; - YUV_TO_FLOAT(y, u, v, r, g, b); - - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; - *(*output)++ = a; -} - - -static inline void transfer_UYVA8888_to_YUV888(unsigned char *(*output), unsigned char *input) -{ - int a, anti_a; - a = input[3]; - anti_a = 0xff - a; - - (*output)[0] = (a * input[1]) / 0xff; - (*output)[1] = (a * input[0] + anti_a * 0x80) / 0xff; - (*output)[2] = (a * input[2] + anti_a * 0x80) / 0xff; - (*output) += 3; -} - -static inline void transfer_UYVA8888_to_YUVA8888(unsigned char *(*output), unsigned char *input) -{ - (*output)[0] = input[1]; - (*output)[1] = input[0]; - (*output)[2] = input[2]; - (*output)[3] = input[3]; - (*output) += 4; -} - - -static inline void transfer_UYVA8888_to_YUV161616(uint16_t *(*output), unsigned char *input) -{ - int a, anti_a; - a = input[3]; - anti_a = 0xff - a; - - (*output)[0] = a * input[1]; - (*output)[1] = a * input[0] + anti_a * 0x80; - (*output)[2] = a * input[2] + anti_a * 0x80; - (*output) += 3; -} - -static inline void transfer_UYVA8888_to_YUVA16161616(uint16_t *(*output), unsigned char *input) -{ - (*output)[0] = input[1] << 8; - (*output)[1] = input[0] << 8; - (*output)[2] = input[2] << 8; - (*output)[3] = input[3] << 8; - (*output) += 4; -} - - - - - - - - - - -#define TRANSFER_FRAME_DEFAULT(output, \ - input, \ - y_in_offset, \ - u_in_offset, \ - v_in_offset, \ - input_column) \ -{ \ - register int i, j; \ - \ - switch(in_colormodel) \ - { \ - case BC_YUV888: \ - switch(out_colormodel) \ - { \ - case BC_RGB8: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV888_to_RGB8((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR565: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV888_to_BGR565((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB565: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV888_to_RGB565((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV888_to_BGR888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV888_to_BGR8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV888_to_RGB888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV888_to_RGBA8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_ARGB8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV888_to_ARGB8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV888_to_RGB_FLOAT((float**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV888_to_RGBA_FLOAT((float**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV101010: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV888_to_YUV101010((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV420P: \ - TRANSFER_YUV420P_OUT_HEAD \ - transfer_YUV888_to_YUV420P_YUV422P(output_y, \ - output_u, \ - output_v, \ - (input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV422P: \ - TRANSFER_YUV422P_OUT_HEAD \ - transfer_YUV888_to_YUV420P_YUV422P(output_y, \ - output_u, \ - output_v, \ - (input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV444P: \ - TRANSFER_YUV444P_OUT_HEAD \ - transfer_YUV888_to_YUV444P(output_y, \ - output_u, \ - output_v, \ - (input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV422: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV888_to_YUV422((output), \ - (input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV888_to_YUV888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV888_to_YUVA8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_VYU888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV888_to_VYU888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_UYVA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV888_to_UYVA8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - } \ - break; \ - \ - case BC_YUVA8888: \ - switch(out_colormodel) \ - { \ - case BC_RGB8: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA8888_to_RGB8((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR565: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA8888_to_BGR565((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB565: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA8888_to_RGB565((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA8888_to_BGR888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA8888_to_BGR8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA8888_to_RGB888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA8888_to_RGBA8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_ARGB8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA8888_to_ARGB8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA8888_to_RGB_FLOAT((float**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA8888_to_RGBA_FLOAT((float**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_VYU888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA8888_to_VYU888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA8888_to_YUV888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA8888_to_YUVA8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_UYVA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA8888_to_UYVA8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV101010: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA8888_to_YUV101010((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV420P: \ - TRANSFER_YUV420P_OUT_HEAD \ - transfer_YUVA8888_to_YUV420P_YUV422P(output_y, \ - output_u, \ - output_v, \ - (input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV422P: \ - TRANSFER_YUV422P_OUT_HEAD \ - transfer_YUVA8888_to_YUV420P_YUV422P(output_y, \ - output_u, \ - output_v, \ - (input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV444P: \ - TRANSFER_YUV444P_OUT_HEAD \ - transfer_YUVA8888_to_YUV444P(output_y, \ - output_u, \ - output_v, \ - (input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV422: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA8888_to_YUV422((output), \ - (input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - } \ - break; \ - \ - case BC_YUV161616: \ - switch(out_colormodel) \ - { \ - case BC_RGB8: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV161616_to_RGB8((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR565: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV161616_to_BGR565((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB565: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV161616_to_RGB565((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV161616_to_BGR888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV161616_to_BGR8888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV161616_to_RGB888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV161616_to_RGBA8888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_ARGB8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV161616_to_ARGB8888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV161616_to_RGB_FLOAT((float**)(output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV161616_to_RGBA_FLOAT((float**)(output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV420P: \ - TRANSFER_YUV420P_OUT_HEAD \ - transfer_YUV161616_to_YUV420P_YUV422P(output_y, \ - output_u, \ - output_v, \ - (uint16_t*)(input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV422P: \ - TRANSFER_YUV422P_OUT_HEAD \ - transfer_YUV161616_to_YUV420P_YUV422P(output_y, \ - output_u, \ - output_v, \ - (uint16_t*)(input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV444P: \ - TRANSFER_YUV444P_OUT_HEAD \ - transfer_YUV161616_to_YUV444P(output_y, \ - output_u, \ - output_v, \ - (uint16_t*)(input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV422: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV161616_to_YUV422((output), \ - (uint16_t*)(input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV101010: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV161616_to_YUV101010((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV161616_to_YUVA8888((output), \ - (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_VYU888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV161616_to_VYU888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_UYVA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV161616_to_UYVA8888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV161616: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV161616_to_YUV161616((uint16_t**)(output), \ - (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - } \ - break; \ - \ - case BC_YUVA16161616: \ - switch(out_colormodel) \ - { \ - case BC_RGB8: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA16161616_to_RGB8((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR565: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA16161616_to_BGR565((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB565: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA16161616_to_RGB565((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA16161616_to_BGR888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA16161616_to_BGR8888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA16161616_to_RGB888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA16161616_to_RGBA8888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_ARGB8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA16161616_to_ARGB8888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA16161616_to_RGB_FLOAT((float**)(output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA16161616_to_RGBA_FLOAT((float**)(output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV101010: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA16161616_to_YUV101010((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_VYU888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA16161616_to_VYU888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_UYVA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA16161616_to_UYVA8888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA16161616: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA16161616_to_YUVA16161616((uint16_t**)(output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV420P: \ - TRANSFER_YUV420P_OUT_HEAD \ - transfer_YUVA16161616_to_YUV420P_YUV422P(output_y, \ - output_u, \ - output_v, \ - (uint16_t*)(input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV422P: \ - TRANSFER_YUV422P_OUT_HEAD \ - transfer_YUVA16161616_to_YUV420P_YUV422P(output_y, \ - output_u, \ - output_v, \ - (uint16_t*)(input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV444P: \ - TRANSFER_YUV444P_OUT_HEAD \ - transfer_YUVA16161616_to_YUV444P(output_y, \ - output_u, \ - output_v, \ - (uint16_t*)(input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV422: \ - TRANSFER_FRAME_HEAD \ - transfer_YUVA16161616_to_YUV422((output), \ - (uint16_t*)(input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - } \ - break; \ - \ - case BC_YUV101010: \ - switch(out_colormodel) \ - { \ - case BC_RGB8: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV101010_to_RGB8((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR565: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV101010_to_BGR565((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB565: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV101010_to_RGB565((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV101010_to_BGR888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV101010_to_BGR8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV101010_to_RGB888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV101010_to_RGBA8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV101010_to_YUV888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV101010_to_YUVA8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB161616: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV101010_to_RGB161616((uint16_t**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA16161616: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV101010_to_RGBA16161616((uint16_t**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV101010_to_RGB_FLOAT((float**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV101010_to_RGBA_FLOAT((float**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV161616: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV101010_to_YUV161616((uint16_t**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA16161616: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV101010_to_YUVA16161616((uint16_t**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - } \ - break; \ - \ - case BC_VYU888: \ - switch(out_colormodel) \ - { \ - case BC_RGB8: \ - TRANSFER_FRAME_HEAD \ - transfer_VYU888_to_RGB8((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR565: \ - TRANSFER_FRAME_HEAD \ - transfer_VYU888_to_BGR565((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB565: \ - TRANSFER_FRAME_HEAD \ - transfer_VYU888_to_RGB565((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR888: \ - TRANSFER_FRAME_HEAD \ - transfer_VYU888_to_BGR888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR8888: \ - TRANSFER_FRAME_HEAD \ - transfer_VYU888_to_BGR8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB888: \ - TRANSFER_FRAME_HEAD \ - transfer_VYU888_to_RGB888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_VYU888_to_RGBA8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV888: \ - TRANSFER_FRAME_HEAD \ - transfer_VYU888_to_YUV888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_VYU888_to_YUVA8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB161616: \ - TRANSFER_FRAME_HEAD \ - transfer_VYU888_to_RGB161616((uint16_t**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA16161616: \ - TRANSFER_FRAME_HEAD \ - transfer_VYU888_to_RGBA16161616((uint16_t**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB_FLOAT: \ -/* printf("%s %d %d %d\n", __FUNCTION__, __LINE__, out_w, out_pixelsize); */ \ - TRANSFER_FRAME_HEAD \ - transfer_VYU888_to_RGB_FLOAT((float**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_VYU888_to_RGBA_FLOAT((float**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV161616: \ - TRANSFER_FRAME_HEAD \ - transfer_VYU888_to_YUV161616((uint16_t**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA16161616: \ - TRANSFER_FRAME_HEAD \ - transfer_VYU888_to_YUVA16161616((uint16_t**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - } \ - break; \ - \ - case BC_UYVA8888: \ - switch(out_colormodel) \ - { \ - case BC_RGB8: \ - TRANSFER_FRAME_HEAD \ - transfer_UYVA8888_to_RGB8((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR565: \ - TRANSFER_FRAME_HEAD \ - transfer_UYVA8888_to_BGR565((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB565: \ - TRANSFER_FRAME_HEAD \ - transfer_UYVA8888_to_RGB565((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR888: \ - TRANSFER_FRAME_HEAD \ - transfer_UYVA8888_to_BGR888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR8888: \ - TRANSFER_FRAME_HEAD \ - transfer_UYVA8888_to_BGR8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB888: \ - TRANSFER_FRAME_HEAD \ - transfer_UYVA8888_to_RGB888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_UYVA8888_to_RGBA8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV888: \ - TRANSFER_FRAME_HEAD \ - transfer_UYVA8888_to_YUV888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_UYVA8888_to_YUVA8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB161616: \ - TRANSFER_FRAME_HEAD \ - transfer_UYVA8888_to_RGB161616((uint16_t**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA16161616: \ - TRANSFER_FRAME_HEAD \ - transfer_UYVA8888_to_RGBA16161616((uint16_t**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_UYVA8888_to_RGB_FLOAT((float**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_UYVA8888_to_RGBA_FLOAT((float**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV161616: \ - TRANSFER_FRAME_HEAD \ - transfer_UYVA8888_to_YUV161616((uint16_t**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA16161616: \ - TRANSFER_FRAME_HEAD \ - transfer_UYVA8888_to_YUVA16161616((uint16_t**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - } \ - break; \ - \ - case BC_ARGB8888: \ - case BC_ABGR8888: \ - switch(out_colormodel) \ - { \ - case BC_ARGB8888: \ - case BC_ABGR8888: \ - TRANSFER_FRAME_HEAD \ - transfer_ARGB8888_to_ARGB8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_ARGB8888_to_RGBA8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB888: \ - TRANSFER_FRAME_HEAD \ - transfer_ARGB8888_to_RGB888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR8888: \ - TRANSFER_FRAME_HEAD \ - transfer_ARGB8888_to_BGR8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - } \ - break; \ - \ - case BC_RGB888: \ - switch(out_colormodel) \ - { \ - case BC_RGB8: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB888_to_RGB8((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR565: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB888_to_BGR565((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB565: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB888_to_RGB565((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB888_to_BGR888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB888_to_RGB888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB888_to_RGBA8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_ARGB8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB888_to_ARGB8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB161616: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB888_to_RGB161616((uint16_t**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA16161616: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB888_to_RGBA16161616((uint16_t**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB888_to_RGB_FLOAT((float**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB888_to_RGBA_FLOAT((float**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_ABGR8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB888_to_ABGR8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB888_to_BGR8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB888_to_YUV888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB888_to_YUVA8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV161616: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB888_to_YUV161616((uint16_t**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA16161616: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB888_to_YUVA16161616((uint16_t**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV101010: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB888_to_YUV101010((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV420P: \ - TRANSFER_YUV420P_OUT_HEAD \ - transfer_RGB888_to_YUV420P_YUV422P(output_y, \ - output_u, \ - output_v, \ - (input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV422: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB888_to_YUV422((output), (input), j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV422P: \ - TRANSFER_YUV422P_OUT_HEAD \ - transfer_RGB888_to_YUV420P_YUV422P(output_y, \ - output_u, \ - output_v, \ - (input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV444P: \ - TRANSFER_YUV444P_OUT_HEAD \ - transfer_RGB888_to_YUV444P(output_y, \ - output_u, \ - output_v, \ - (input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_VYU888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB888_to_VYU888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_UYVA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB888_to_UYVA8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - } \ - break; \ - \ - case BC_RGBA8888: \ - switch(out_colormodel) \ - { \ - case BC_TRANSPARENCY: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_TRANSPARENCY((output), (input), &bit_counter); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB8: \ - if(bg_color > 0) \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_RGB8bg((output), (input), bg_r, bg_g, bg_b); \ - TRANSFER_FRAME_TAIL \ - else \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_RGB8((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR565: \ - if(bg_color > 0) \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_BGR565bg((output), (input), bg_r, bg_g, bg_b); \ - TRANSFER_FRAME_TAIL \ - else \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_BGR565((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB565: \ - if(bg_color > 0) \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_RGB565bg((output), (input), bg_r, bg_g, bg_b); \ - TRANSFER_FRAME_TAIL \ - else \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_RGB565((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR888: \ - if(bg_color > 0) \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_BGR888bg((output), (input), bg_r, bg_g, bg_b); \ - TRANSFER_FRAME_TAIL \ - else \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_BGR888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB888: \ - if(bg_color > 0) \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_RGB888bg((output), (input), bg_r, bg_g, bg_b); \ - TRANSFER_FRAME_TAIL \ - else \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_RGB888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_RGBA8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_ARGB8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_ARGB8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB161616: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_RGB161616((uint16_t**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA16161616: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_RGBA16161616((uint16_t**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_RGB_FLOAT((float**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_RGBA_FLOAT((float**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR8888: \ - if(bg_color > 0) \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_BGR8888bg((output), (input), bg_r, bg_g, bg_b); \ - TRANSFER_FRAME_TAIL \ - else \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_BGR8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_YUV888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_YUVA8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV161616: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_YUV161616((uint16_t**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA16161616: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_YUVA16161616((uint16_t**)(output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV101010: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_YUV101010((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV420P: \ - TRANSFER_YUV420P_OUT_HEAD \ - transfer_RGBA888_to_YUV420P_YUV422P(output_y, \ - output_u, \ - output_v, \ - (input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV422: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA888_to_YUV422((output), (input), j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV422P: \ - TRANSFER_YUV422P_OUT_HEAD \ - transfer_RGBA888_to_YUV420P_YUV422P(output_y, \ - output_u, \ - output_v, \ - (input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_VYU888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_VYU888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_UYVA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA8888_to_UYVA8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV444P: \ - TRANSFER_YUV444P_OUT_HEAD \ - transfer_RGBA888_to_YUV444P(output_y, \ - output_u, \ - output_v, \ - (input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - } \ - break; \ - \ - case BC_RGB161616: \ - switch(out_colormodel) \ - { \ - case BC_RGB8: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB161616_to_RGB8((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR565: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB161616_to_BGR565((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB565: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB161616_to_RGB565((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB161616_to_BGR888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB161616_to_BGR8888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB161616_to_RGB888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB161616_to_RGBA8888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB161616_to_RGB_FLOAT((float**)(output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB161616_to_RGBA_FLOAT((float**)(output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB161616_to_YUV888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB161616_to_YUVA8888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV161616: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB161616_to_YUV161616((uint16_t**)(output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA16161616: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB161616_to_YUVA16161616((uint16_t**)(output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV101010: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB161616_to_YUV101010((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV420P: \ - TRANSFER_YUV420P_OUT_HEAD \ - transfer_RGB161616_to_YUV420P_YUV422P(output_y, \ - output_u, \ - output_v, \ - (uint16_t*)(input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV422P: \ - TRANSFER_YUV422P_OUT_HEAD \ - transfer_RGB161616_to_YUV420P_YUV422P(output_y, \ - output_u, \ - output_v, \ - (uint16_t*)(input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV444P: \ - TRANSFER_YUV444P_OUT_HEAD \ - transfer_RGB161616_to_YUV444P(output_y, \ - output_u, \ - output_v, \ - (uint16_t*)(input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - } \ - break; \ - \ - case BC_RGBA16161616: \ - switch(out_colormodel) \ - { \ - case BC_RGB8: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA16161616_to_RGB8((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR565: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA16161616_to_BGR565((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB565: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA16161616_to_RGB565((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA16161616_to_BGR888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA16161616_to_BGR8888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA16161616_to_RGB888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA16161616_to_RGBA8888((output),(uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA16161616_to_RGB_FLOAT((float**)(output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA16161616_to_RGBA_FLOAT((float**)(output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA16161616_to_YUV888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA16161616_to_YUVA8888((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV161616: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA16161616_to_YUV161616(((uint16_t**)output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA16161616: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA16161616_to_YUVA16161616((uint16_t**)(output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV101010: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA16161616_to_YUV101010((output), (uint16_t*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV420P: \ - TRANSFER_YUV420P_OUT_HEAD \ - transfer_RGBA16161616_to_YUV420P_YUV422P(output_y, \ - output_u, \ - output_v, \ - (uint16_t*)(input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV422P: \ - TRANSFER_YUV422P_OUT_HEAD \ - transfer_RGBA16161616_to_YUV420P_YUV422P(output_y, \ - output_u, \ - output_v, \ - (uint16_t*)(input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV444P: \ - TRANSFER_YUV444P_OUT_HEAD \ - transfer_RGBA16161616_to_YUV444P(output_y, \ - output_u, \ - output_v, \ - (uint16_t*)(input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - } \ - break; \ - \ - case BC_BGR8888: \ - switch(out_colormodel) \ - { \ - case BC_RGB888: \ - TRANSFER_FRAME_HEAD \ - transfer_BGR8888_to_RGB888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR8888: \ - TRANSFER_FRAME_HEAD \ - transfer_BGR8888_to_BGR8888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - } \ - break; \ - \ - case BC_BGR888: \ - switch(out_colormodel) \ - { \ - case BC_RGB888: \ - TRANSFER_FRAME_HEAD \ - transfer_BGR888_to_RGB888((output), (input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - } \ - break; \ - } \ -} - -#if 0 -#include -#include - -static int64_t get_difference(struct timeval *start_time) -{ - struct timeval new_time; - - gettimeofday(&new_time, 0); - - new_time.tv_usec -= start_time->tv_usec; - new_time.tv_sec -= start_time->tv_sec; - if(new_time.tv_usec < 0) - { - new_time.tv_usec += 1000000; - new_time.tv_sec--; - } - - return (int64_t)new_time.tv_sec * 1000000 + - (int64_t)new_time.tv_usec; - -} -#endif - - - - -void cmodel_default(PERMUTATION_ARGS) -{ - if(scale) - { - int done = 0; - switch (in_colormodel) { - case BC_YUVA8888: - switch (out_colormodel) { - case BC_BGR8888: - { -// struct timeval start_time; -// gettimeofday(&start_time, 0); - - short int *utog_tab = yuv_table->utog_tab8; - short int *vtog_tab = yuv_table->vtog_tab8; - short int *vtor_tab = yuv_table->vtor_tab8; - short int *utob_tab = yuv_table->utob_tab8; - - short int i ; - for(i = 0; i < out_h; i++) - { - unsigned char *input_row = input_rows[row_table[i]]; - unsigned char *output_row = output_rows[i + out_y] + out_x * out_pixelsize; - unsigned char *input_data = input_row + (column_table[0] << 2); - __builtin_prefetch (input_data, 0, 0); - - short int j; - for(j = 0; j < out_w; j++) - { - unsigned char y = input_data[0]; - unsigned char u = input_data[1]; - unsigned char v = input_data[2]; - unsigned char a = input_data[3]; - - /* the secret of the speedup ... delayed index calculation */ - /* we do not overflow at the end since column table holds + 1 element */ - input_data = input_row + (column_table[j + 1] << 2); - - short int r = y + vtor_tab[v]; - short int g = y + utog_tab[u] + vtog_tab[v]; - short int b = y + utob_tab[u]; - - r = (r < 0 ? 0 : (r > 0xff ? 0xff : r)); - g = (g < 0 ? 0 : (g > 0xff ? 0xff : g)); - b = (b < 0 ? 0 : (b > 0xff ? 0xff : b)); - - r *= a; - g *= a; - b *= a; - - output_row[0] = ((b) >> 8); - output_row[1] = ((g) >> 8); - output_row[2] = ((r) >> 8); - - output_row += 4; - } - - } -// long long dif= get_difference(&start_time); -// printf("diff_inside: %lli\n", dif); - - done = 1; - } - break; - } - break; - - } - if (!done) - { - TRANSFER_FRAME_DEFAULT(&output_row, - input_row + column_table[j] * in_pixelsize, - 0, - 0, - 0, - 0); - } - } - else - { - TRANSFER_FRAME_DEFAULT(&output_row, - input_row + j * in_pixelsize, - 0, - 0, - 0, - 0); - } -} diff --git a/cinelerra-5.0/quicktime/cmodel_float.c b/cinelerra-5.0/quicktime/cmodel_float.c deleted file mode 100644 index 9cb68c7a..00000000 --- a/cinelerra-5.0/quicktime/cmodel_float.c +++ /dev/null @@ -1,894 +0,0 @@ -#include "cmodel_permutation.h" -#include "colormodels.h" -#include "workarounds.h" -// ********************************** RGB FLOAT -> ******************************* - - - -static inline void transfer_RGB_FLOAT_to_RGB8(unsigned char *(*output), float *input) -{ - unsigned char r, g, b; - r = (unsigned char)(CLIP(input[0], 0, 1) * 0x3); - g = (unsigned char)(CLIP(input[1], 0, 1) * 0x7); - b = (unsigned char)(CLIP(input[2], 0, 1) * 0x3); - - *(*output) = (r << 6) + - (g << 2) + - b; - (*output)++; -} - -static inline void transfer_RGB_FLOAT_to_BGR565(unsigned char *(*output), float *input) -{ - unsigned char r, g, b; - r = (unsigned char)(CLIP(input[0], 0, 1) * 0x1f); - g = (unsigned char)(CLIP(input[1], 0, 1) * 0x3f); - b = (unsigned char)(CLIP(input[2], 0, 1) * 0x1f); - - *(uint16_t*)(*output) = (b << 11) | - (g << 5) | - r; - (*output) += 2; -} - -static inline void transfer_RGB_FLOAT_to_RGB565(unsigned char *(*output), float *input) -{ - unsigned char r, g, b; - r = (unsigned char)(CLIP(input[0], 0, 1) * 0x1f); - g = (unsigned char)(CLIP(input[1], 0, 1) * 0x3f); - b = (unsigned char)(CLIP(input[2], 0, 1) * 0x1f); - - *(uint16_t*)(*output) = (r << 11) | - (g << 5) | - b; - (*output) += 2; -} - -static inline void transfer_RGB_FLOAT_to_BGR888(unsigned char *(*output), - float *input) -{ - unsigned char r = (unsigned char)(CLIP(input[0], 0, 1) * 0xff); - unsigned char g = (unsigned char)(CLIP(input[1], 0, 1) * 0xff); - unsigned char b = (unsigned char)(CLIP(input[2], 0, 1) * 0xff); - *(*output)++ = b; - *(*output)++ = g; - *(*output)++ = r; -} - -static inline void transfer_RGB_FLOAT_to_RGB888(unsigned char *(*output), - float *input) -{ - unsigned char r = (unsigned char)(CLIP(input[0], 0, 1) * 0xff); - unsigned char g = (unsigned char)(CLIP(input[1], 0, 1) * 0xff); - unsigned char b = (unsigned char)(CLIP(input[2], 0, 1) * 0xff); - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; -} - -static inline void transfer_RGB_FLOAT_to_RGBA8888(unsigned char *(*output), - float *input) -{ - unsigned char r = (unsigned char)(CLIP(input[0], 0, 1) * 0xff); - unsigned char g = (unsigned char)(CLIP(input[1], 0, 1) * 0xff); - unsigned char b = (unsigned char)(CLIP(input[2], 0, 1) * 0xff); - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; - *(*output)++ = 0xff; -} - -static inline void transfer_RGB_FLOAT_to_ARGB8888(unsigned char *(*output), - float *input) -{ - unsigned char r = (unsigned char)(CLIP(input[0], 0, 1) * 0xff); - unsigned char g = (unsigned char)(CLIP(input[1], 0, 1) * 0xff); - unsigned char b = (unsigned char)(CLIP(input[2], 0, 1) * 0xff); - *(*output)++ = 0xff; - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; -} - -static inline void transfer_RGB_FLOAT_to_RGBA_FLOAT(float *(*output), - float *input) -{ - *(*output)++ = input[0]; - *(*output)++ = input[1]; - *(*output)++ = input[2]; - *(*output)++ = 1.0; -} - -static inline void transfer_RGB_FLOAT_to_BGR8888(unsigned char *(*output), - float *input) -{ - unsigned char r = (unsigned char)(CLIP(input[0], 0, 1) * 0xff); - unsigned char g = (unsigned char)(CLIP(input[1], 0, 1) * 0xff); - unsigned char b = (unsigned char)(CLIP(input[2], 0, 1) * 0xff); - *(*output)++ = b; - *(*output)++ = g; - *(*output)++ = r; - *(*output)++ = 0xff; -} - -static inline void transfer_RGB_FLOAT_to_YUV888(unsigned char *(*output), - float *input) -{ - int y, u, v, r, g, b; - r = (int)(CLIP(input[0], 0, 1) * 0xffff); - g = (int)(CLIP(input[1], 0, 1) * 0xffff); - b = (int)(CLIP(input[2], 0, 1) * 0xffff); - - RGB_TO_YUV16(y, u, v, r, g, b); - - *(*output)++ = y >> 8; - *(*output)++ = u >> 8; - *(*output)++ = v >> 8; -} - -static inline void transfer_RGB_FLOAT_to_YUVA8888(unsigned char *(*output), - float *input) -{ - int y, u, v, r, g, b; - - r = (int)(CLIP(input[0], 0, 1) * 0xffff); - g = (int)(CLIP(input[1], 0, 1) * 0xffff); - b = (int)(CLIP(input[2], 0, 1) * 0xffff); - - RGB_TO_YUV16(y, u, v, r, g, b); - - *(*output)++ = y >> 8; - *(*output)++ = u >> 8; - *(*output)++ = v >> 8; - *(*output)++ = 255; -} - -static inline void transfer_RGB_FLOAT_to_YUV161616(uint16_t *(*output), - float *input) -{ - int y, u, v, r, g, b; - r = (int)(CLIP(input[0], 0, 1) * 0xffff); - g = (int)(CLIP(input[1], 0, 1) * 0xffff); - b = (int)(CLIP(input[2], 0, 1) * 0xffff); - - RGB_TO_YUV16(y, u, v, r, g, b); - - *(*output)++ = quicktime_copy(y); - *(*output)++ = quicktime_copy(u); - *(*output)++ = quicktime_copy(v); -} - -static inline void transfer_RGB_FLOAT_to_YUVA16161616(uint16_t *(*output), - float *input) -{ - int y, u, v, r, g, b; - - r = (int)(CLIP(input[0], 0, 1) * 0xffff); - g = (int)(CLIP(input[1], 0, 1) * 0xffff); - b = (int)(CLIP(input[2], 0, 1) * 0xffff); - - RGB_TO_YUV16(y, u, v, r, g, b); - - *(*output)++ = quicktime_copy(y); - *(*output)++ = quicktime_copy(u); - *(*output)++ = quicktime_copy(v); - *(*output)++ = 0xffff; -} - - -static inline void transfer_RGB_FLOAT_to_YUV101010(unsigned char *(*output), - float *input) -{ - int r, g, b; - int y, u, v; - - r = (int)(CLIP(input[0], 0, 1) * 0xffff); - g = (int)(CLIP(input[1], 0, 1) * 0xffff); - b = (int)(CLIP(input[2], 0, 1) * 0xffff); - RGB_TO_YUV16(y, u, v, r, g, b); - WRITE_YUV101010(y, u, v); -} - -static inline void transfer_RGB_FLOAT_to_VYU888(unsigned char *(*output), - float *input) -{ - int y, u, v, r, g, b; - r = (int)(CLIP(input[0], 0, 1) * 0xffff); - g = (int)(CLIP(input[1], 0, 1) * 0xffff); - b = (int)(CLIP(input[2], 0, 1) * 0xffff); - - RGB_TO_YUV16(y, u, v, r, g, b); - - *(*output)++ = v >> 8; - *(*output)++ = y >> 8; - *(*output)++ = u >> 8; -} - -static inline void transfer_RGB_FLOAT_to_UYVA8888(unsigned char *(*output), - float *input) -{ - int y, u, v, r, g, b; - - r = (int)(CLIP(input[0], 0, 1) * 0xffff); - g = (int)(CLIP(input[1], 0, 1) * 0xffff); - b = (int)(CLIP(input[2], 0, 1) * 0xffff); - - RGB_TO_YUV16(y, u, v, r, g, b); - - *(*output)++ = u >> 8; - *(*output)++ = y >> 8; - *(*output)++ = v >> 8; - *(*output)++ = 0xff; -} - - -static inline void transfer_RGB_FLOAT_to_YUV420P_YUV422P(unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - float *input, - int output_column) -{ - int y, u, v, r, g, b; - r = (int)(CLIP(input[0], 0, 1) * 0xffff); - g = (int)(CLIP(input[1], 0, 1) * 0xffff); - b = (int)(CLIP(input[2], 0, 1) * 0xffff); - - RGB_TO_YUV16(y, u, v, r, g, b); - - output_y[output_column] = y >> 8; - output_u[output_column / 2] = u >> 8; - output_v[output_column / 2] = v >> 8; -} - -static inline void transfer_RGB_FLOAT_to_YUV422(unsigned char *(*output), - float *input, - int j) -{ - int y, u, v, r, g, b; - r = (int)(CLIP(input[0], 0, 1) * 0xffff); - g = (int)(CLIP(input[1], 0, 1) * 0xffff); - b = (int)(CLIP(input[2], 0, 1) * 0xffff); - - RGB_TO_YUV16(y, u, v, r, g, b); - if(!(j & 1)) - { -// Store U and V for even pixels only - (*output)[1] = u >> 8; - (*output)[3] = v >> 8; - (*output)[0] = y >> 8; - } - else - { -// Store Y and advance output for odd pixels only - (*output)[2] = y >> 8; - (*output) += 4; - } -} - -static inline void transfer_RGB_FLOAT_to_YUV444P(unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - float *input, - int output_column) -{ - int y, u, v, r, g, b; - r = (int)(CLIP(input[0], 0, 1) * 0xffff); - g = (int)(CLIP(input[1], 0, 1) * 0xffff); - b = (int)(CLIP(input[2], 0, 1) * 0xffff); - - RGB_TO_YUV16(y, u, v, r, g, b); - - output_y[output_column] = y >> 8; - output_u[output_column] = u >> 8; - output_v[output_column] = v >> 8; -} - - - - - - - - - - -// ****************************** RGBA FLOAT -> ********************************* - -static inline void transfer_RGBA_FLOAT_to_RGB8(unsigned char *(*output), - float *input) -{ - uint32_t r, g, b, a; - a = (uint32_t)(CLIP(input[3], 0, 1) * 0x10000); - r = (uint32_t)(CLIP(input[0], 0, 1) * 0xff * a); - g = (uint32_t)(CLIP(input[1], 0, 1) * 0xff * a); - b = (uint32_t)(CLIP(input[2], 0, 1) * 0xff * a); - - *(*output) = (unsigned char)(((r & 0xc00000) >> 16) + - ((g & 0xe00000) >> 18) + - ((b & 0xe00000) >> 21)); - (*output)++; -} - -static inline void transfer_RGBA_FLOAT_to_BGR565(unsigned char *(*output), - float *input) -{ - uint32_t r, g, b, a; - a = (uint32_t)(CLIP(input[3], 0, 1) * 0x10000); - r = (uint32_t)(CLIP(input[0], 0, 1) * 0xff * a); - g = (uint32_t)(CLIP(input[1], 0, 1) * 0xff * a); - b = (uint32_t)(CLIP(input[2], 0, 1) * 0xff * a); - - *(uint16_t*)(*output) = (uint16_t)(((b & 0xf80000) >> 8) + - ((g & 0xfc0000) >> 13) + - ((r & 0xf80000) >> 19)); - (*output) += 2; -} - -static inline void transfer_RGBA_FLOAT_to_RGB565(unsigned char *(*output), - float *input) -{ - uint32_t r, g, b, a; - a = (uint32_t)(CLIP(input[3], 0, 1) * 0x10000); - r = (uint32_t)(CLIP(input[0], 0, 1) * 0xff * a); - g = (uint32_t)(CLIP(input[1], 0, 1) * 0xff * a); - b = (uint32_t)(CLIP(input[2], 0, 1) * 0xff * a); - - *(uint16_t*)(*output) = (uint16_t)(((r & 0xf80000) >> 8) + - ((g & 0xfc0000) >> 13) + - ((b & 0xf80000) >> 19)); - (*output) += 2; -} - -static inline void transfer_RGBA_FLOAT_to_BGR888(unsigned char *(*output), - float *input) -{ - uint32_t r, g, b, a; - a = (uint32_t)(CLIP(input[3], 0, 1) * 0xff); - r = (uint32_t)(CLIP(input[0], 0, 1) * a); - g = (uint32_t)(CLIP(input[1], 0, 1) * a); - b = (uint32_t)(CLIP(input[2], 0, 1) * a); - - *(*output)++ = (unsigned char)b; - *(*output)++ = (unsigned char)g; - *(*output)++ = (unsigned char)r; -} - -static inline void transfer_RGBA_FLOAT_to_RGB888(unsigned char *(*output), - float *input) -{ - uint32_t r, g, b, a; - a = (uint32_t)(CLIP(input[3], 0, 1) * 0xff); - r = (uint32_t)(CLIP(input[0], 0, 1) * a); - g = (uint32_t)(CLIP(input[1], 0, 1) * a); - b = (uint32_t)(CLIP(input[2], 0, 1) * a); - - *(*output)++ = (unsigned char)r; - *(*output)++ = (unsigned char)g; - *(*output)++ = (unsigned char)b; -} - -static inline void transfer_RGBA_FLOAT_to_RGB_FLOAT(float *(*output), - float *input) -{ - float a; - a = input[3]; - - *(*output)++ = input[0] * a; - *(*output)++ = input[1] * a; - *(*output)++ = input[2] * a; -} - - -static inline void transfer_RGBA_FLOAT_to_RGBA8888(unsigned char *(*output), - float *input) -{ - *(*output)++ = (unsigned char)(CLIP(input[0], 0, 1) * 0xff); - *(*output)++ = (unsigned char)(CLIP(input[1], 0, 1) * 0xff); - *(*output)++ = (unsigned char)(CLIP(input[2], 0, 1) * 0xff); - *(*output)++ = (unsigned char)(CLIP(input[3], 0, 1) * 0xff); -} - -static inline void transfer_RGBA_FLOAT_to_ARGB8888(unsigned char *(*output), - float *input) -{ - *(*output)++ = (unsigned char)(CLIP(input[3], 0, 1) * 0xff); - *(*output)++ = (unsigned char)(CLIP(input[0], 0, 1) * 0xff); - *(*output)++ = (unsigned char)(CLIP(input[1], 0, 1) * 0xff); - *(*output)++ = (unsigned char)(CLIP(input[2], 0, 1) * 0xff); -} - - -static inline void transfer_RGBA_FLOAT_to_BGR8888(unsigned char *(*output), - float *input) -{ - uint32_t r, g, b, a; - a = (uint32_t)(CLIP(input[3], 0, 1) * 0xff); - r = (uint32_t)(CLIP(input[0], 0, 1) * a); - g = (uint32_t)(CLIP(input[1], 0, 1) * a); - b = (uint32_t)(CLIP(input[2], 0, 1) * a); - - *(*output)++ = (unsigned char)(b); - *(*output)++ = (unsigned char)(g); - *(*output)++ = (unsigned char)(r); - ++(*output); -} - -static inline void transfer_RGBA_FLOAT_to_YUV888(unsigned char *(*output), - float *input) -{ - int y, u, v, r, g, b, a; - a = (int)(CLIP(input[3], 0, 1) * 0x101); - r = (int)(CLIP(input[0], 0, 1) * 0xff * a); - g = (int)(CLIP(input[1], 0, 1) * 0xff * a); - b = (int)(CLIP(input[2], 0, 1) * 0xff * a); - - RGB_TO_YUV16(y, u, v, r, g, b); - - *(*output)++ = y >> 8; - *(*output)++ = u >> 8; - *(*output)++ = v >> 8; -} - -static inline void transfer_RGBA_FLOAT_to_YUVA8888(unsigned char *(*output), - float *input) -{ - int y, u, v, r, g, b, a; - - a = (int)(CLIP(input[3], 0, 1) * 0xff); - r = (int)(CLIP(input[0], 0, 1) * 0xffff); - g = (int)(CLIP(input[1], 0, 1) * 0xffff); - b = (int)(CLIP(input[2], 0, 1) * 0xffff); - - RGB_TO_YUV16(y, u, v, r, g, b); - - *(*output)++ = y >> 8; - *(*output)++ = u >> 8; - *(*output)++ = v >> 8; - *(*output)++ = a; -} - -static inline void transfer_RGBA_FLOAT_to_YUV161616(uint16_t *(*output), - float *input) -{ - int y, u, v, r, g, b, a; - - a = (int)(CLIP(input[3], 0, 1) * 0x101); - r = (int)(CLIP(input[0], 0, 1) * 0xff * a); - g = (int)(CLIP(input[1], 0, 1) * 0xff * a); - b = (int)(CLIP(input[2], 0, 1) * 0xff * a); - - RGB_TO_YUV16(y, u, v, r, g, b); - -// GCC 3.3 optimization error - *(*output)++ = quicktime_copy(y); - *(*output)++ = quicktime_copy(u); - *(*output)++ = quicktime_copy(v); -} - -static inline void transfer_RGBA_FLOAT_to_YUVA16161616(uint16_t *(*output), - float *input) -{ - int y, u, v, r, g, b, a; - - r = (int)(CLIP(input[0], 0, 1) * 0xffff); - g = (int)(CLIP(input[1], 0, 1) * 0xffff); - b = (int)(CLIP(input[2], 0, 1) * 0xffff); - a = (int)(CLIP(input[3], 0, 1) * 0xffff); - - RGB_TO_YUV16(y, u, v, r, g, b); - -// GCC 3.3 optimization error - *(*output)++ = quicktime_copy(y); - *(*output)++ = quicktime_copy(u); - *(*output)++ = quicktime_copy(v); - *(*output)++ = quicktime_copy(a); -} - -static inline void transfer_RGBA_FLOAT_to_YUV101010(unsigned char *(*output), - float *input) -{ - int y, u, v, r, g, b, a; - - a = (int)(CLIP(input[3], 0, 1) * 0x101); - r = (int)(CLIP(input[0], 0, 1) * 0xff * a); - g = (int)(CLIP(input[1], 0, 1) * 0xff * a); - b = (int)(CLIP(input[2], 0, 1) * 0xff * a); - - RGB_TO_YUV16(y, u, v, r, g, b); - WRITE_YUV101010(y, u, v); -} - - -static inline void transfer_RGBA_FLOAT_to_YUV420P_YUV422P(unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - float *input, - int output_column) -{ - int y, u, v, r, g, b, a; - a = (int)(CLIP(input[3], 0, 1) * 0x101); - r = (int)(CLIP(input[0], 0, 1) * 0xff * a); - g = (int)(CLIP(input[1], 0, 1) * 0xff * a); - b = (int)(CLIP(input[2], 0, 1) * 0xff * a); - - RGB_TO_YUV16(y, u, v, r, g, b); - - output_y[output_column] = y >> 8; - output_u[output_column / 2] = u >> 8; - output_v[output_column / 2] = v >> 8; -} - -static inline void transfer_RGBA_FLOAT_to_YUV422(unsigned char *(*output), - float *input, - int j) -{ - int y, u, v, r, g, b; - float a = CLIP(input[3], 0, 1); - r = (int)(CLIP(input[0], 0, 1) * a * 0xffff); - g = (int)(CLIP(input[1], 0, 1) * a * 0xffff); - b = (int)(CLIP(input[2], 0, 1) * a * 0xffff); - - RGB_TO_YUV16(y, u, v, r, g, b); - if(!(j & 1)) - { -// Store U and V for even pixels only - (*output)[1] = u >> 8; - (*output)[3] = v >> 8; - (*output)[0] = y >> 8; - } - else - { -// Store Y and advance output for odd pixels only - (*output)[2] = y >> 8; - (*output) += 4; - } -} - - -static inline void transfer_RGBA_FLOAT_to_YUV444P(unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - float *input, - int output_column) -{ - int y, u, v, r, g, b, a; - a = (int)(CLIP(input[3], 0, 1) * 0x101); - r = (int)(CLIP(input[0], 0, 1) * 0xff * a); - g = (int)(CLIP(input[1], 0, 1) * 0xff * a); - b = (int)(CLIP(input[2], 0, 1) * 0xff * a); - - RGB_TO_YUV16(y, u, v, r, g, b); - - output_y[output_column] = y >> 8; - output_u[output_column] = u >> 8; - output_v[output_column] = v >> 8; -} - -static inline void transfer_RGBA_FLOAT_to_VYU888(unsigned char *(*output), - float *input) -{ - int y, u, v, r, g, b; - float a = CLIP(input[3], 0, 1); - r = (int)(CLIP(input[0], 0, 1) * a * 0xffff); - g = (int)(CLIP(input[1], 0, 1) * a * 0xffff); - b = (int)(CLIP(input[2], 0, 1) * a * 0xffff); - - RGB_TO_YUV16(y, u, v, r, g, b); - - *(*output)++ = v >> 8; - *(*output)++ = y >> 8; - *(*output)++ = u >> 8; -} - -static inline void transfer_RGBA_FLOAT_to_UYVA8888(unsigned char *(*output), - float *input) -{ - int y, u, v, r, g, b; - float a = CLIP(input[3], 0, 1); - r = (int)(CLIP(input[0], 0, 1) * a * 0xffff); - g = (int)(CLIP(input[1], 0, 1) * a * 0xffff); - b = (int)(CLIP(input[2], 0, 1) * a * 0xffff); - - RGB_TO_YUV16(y, u, v, r, g, b); - - *(*output)++ = u >> 8; - *(*output)++ = y >> 8; - *(*output)++ = v >> 8; - *(*output)++ = 0xff; -} - - - - - - - - - - - - - - - -#define TRANSFER_DEFAULT(output, \ - input, \ - y_in_offset, \ - u_in_offset, \ - v_in_offset, \ - input_column) \ -{ \ - register int i, j; \ - \ - switch(in_colormodel) \ - { \ - case BC_RGB_FLOAT: \ - switch(out_colormodel) \ - { \ - case BC_RGB8: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB_FLOAT_to_RGB8((output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR565: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB_FLOAT_to_BGR565((output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB565: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB_FLOAT_to_RGB565((output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB_FLOAT_to_BGR888((output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB_FLOAT_to_BGR8888((output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB_FLOAT_to_RGB888((output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB_FLOAT_to_RGBA8888((output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_ARGB8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB_FLOAT_to_ARGB8888((output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB_FLOAT_to_RGBA_FLOAT((float**)(output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB_FLOAT_to_YUV888((output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB_FLOAT_to_YUVA8888((output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV161616: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB_FLOAT_to_YUV161616((uint16_t**)(output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA16161616: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB_FLOAT_to_YUVA16161616((uint16_t**)(output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV101010: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB_FLOAT_to_YUV101010((output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV420P: \ - TRANSFER_YUV420P_OUT_HEAD \ - transfer_RGB_FLOAT_to_YUV420P_YUV422P(output_y, \ - output_u, \ - output_v, \ - (float*)(input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV422P: \ - TRANSFER_YUV422P_OUT_HEAD \ - transfer_RGB_FLOAT_to_YUV420P_YUV422P(output_y, \ - output_u, \ - output_v, \ - (float*)(input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV422: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB_FLOAT_to_YUV422((output), \ - (float*)(input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV444P: \ - TRANSFER_YUV444P_OUT_HEAD \ - transfer_RGB_FLOAT_to_YUV444P(output_y, \ - output_u, \ - output_v, \ - (float*)(input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_VYU888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB_FLOAT_to_VYU888((output), \ - (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_UYVA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGB_FLOAT_to_UYVA8888((output), \ - (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - } \ - break; \ - \ - case BC_RGBA_FLOAT: \ - switch(out_colormodel) \ - { \ - case BC_RGB8: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA_FLOAT_to_RGB8((output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR565: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA_FLOAT_to_BGR565((output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB565: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA_FLOAT_to_RGB565((output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA_FLOAT_to_BGR888((output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA_FLOAT_to_BGR8888((output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA_FLOAT_to_RGB888((output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA_FLOAT_to_RGB_FLOAT((float**)(output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA_FLOAT_to_RGBA8888((output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_ARGB8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA_FLOAT_to_ARGB8888((output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA_FLOAT_to_YUV888((output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA_FLOAT_to_YUVA8888((output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV161616: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA_FLOAT_to_YUV161616((uint16_t**)(output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA16161616: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA_FLOAT_to_YUVA16161616((uint16_t**)(output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV101010: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA_FLOAT_to_YUV101010((output), (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV420P: \ - TRANSFER_YUV420P_OUT_HEAD \ - transfer_RGBA_FLOAT_to_YUV420P_YUV422P(output_y, \ - output_u, \ - output_v, \ - (float*)(input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV422P: \ - TRANSFER_YUV422P_OUT_HEAD \ - transfer_RGBA_FLOAT_to_YUV420P_YUV422P(output_y, \ - output_u, \ - output_v, \ - (float*)(input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV422: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA_FLOAT_to_YUV422((output), \ - (float*)(input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV444P: \ - TRANSFER_YUV444P_OUT_HEAD \ - transfer_RGBA_FLOAT_to_YUV444P(output_y, \ - output_u, \ - output_v, \ - (float*)(input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_VYU888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA_FLOAT_to_VYU888((output), \ - (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_UYVA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_RGBA_FLOAT_to_UYVA8888((output), \ - (float*)(input)); \ - TRANSFER_FRAME_TAIL \ - break; \ - } \ - break; \ - } \ -} - - - -void cmodel_float(PERMUTATION_ARGS) -{ - if(scale) - { - TRANSFER_DEFAULT(&output_row, - input_row + column_table[j] * in_pixelsize, - 0, - 0, - 0, - 0); - } - else - { - TRANSFER_DEFAULT(&output_row, - input_row + j * in_pixelsize, - 0, - 0, - 0, - 0); - } -} - diff --git a/cinelerra-5.0/quicktime/cmodel_permutation.h b/cinelerra-5.0/quicktime/cmodel_permutation.h deleted file mode 100644 index a89f748f..00000000 --- a/cinelerra-5.0/quicktime/cmodel_permutation.h +++ /dev/null @@ -1,2705 +0,0 @@ -/* - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ -#include "colormodels.h" -#include - -// All variables are unsigned -// y -> 24 bits u, v, -> 8 bits r, g, b -> 8 bits -#define YUV_TO_RGB(y, u, v, r, g, b) \ -{ \ - (r) = ((y + yuv_table->vtor_tab[v]) >> 16); \ - (g) = ((y + yuv_table->utog_tab[u] + yuv_table->vtog_tab[v]) >> 16); \ - (b) = ((y + yuv_table->utob_tab[u]) >> 16); \ - CLAMP(r, 0, 0xff); \ - CLAMP(g, 0, 0xff); \ - CLAMP(b, 0, 0xff); \ -} - -// y -> 0 - 1 float -// u, v, -> 8 bits -// r, g, b -> float -#define YUV_TO_FLOAT(y, u, v, r, g, b) \ -{ \ - (r) = y + yuv_table->vtor_float_tab[v]; \ - (g) = y + yuv_table->utog_float_tab[u] + yuv_table->vtog_float_tab[v]; \ - (b) = y + yuv_table->utob_float_tab[u]; \ -} - -// y -> 0 - 1 float -// u, v, -> 16 bits -// r, g, b -> float -#define YUV16_TO_RGB_FLOAT(y, u, v, r, g, b) \ -{ \ - (r) = y + yuv_table->v16tor_float_tab[v]; \ - (g) = y + yuv_table->u16tog_float_tab[u] + yuv_table->v16tog_float_tab[v]; \ - (b) = y + yuv_table->u16tob_float_tab[u]; \ -} - -// y -> 24 bits u, v-> 16 bits -#define YUV_TO_RGB16(y, u, v, r, g, b) \ -{ \ - (r) = ((y + yuv_table->vtor_tab16[v]) >> 8); \ - (g) = ((y + yuv_table->utog_tab16[u] + yuv_table->vtog_tab16[v]) >> 8); \ - (b) = ((y + yuv_table->utob_tab16[u]) >> 8); \ - CLAMP(r, 0, 0xffff); \ - CLAMP(g, 0, 0xffff); \ - CLAMP(b, 0, 0xffff); \ -} - - - - -#define RGB_TO_YUV(y, u, v, r, g, b) \ -{ \ - y = ((yuv_table->rtoy_tab[r] + yuv_table->gtoy_tab[g] + yuv_table->btoy_tab[b]) >> 16); \ - u = ((yuv_table->rtou_tab[r] + yuv_table->gtou_tab[g] + yuv_table->btou_tab[b]) >> 16); \ - v = ((yuv_table->rtov_tab[r] + yuv_table->gtov_tab[g] + yuv_table->btov_tab[b]) >> 16); \ - CLAMP(y, 0, 0xff); \ - CLAMP(u, 0, 0xff); \ - CLAMP(v, 0, 0xff); \ -} - -// r, g, b -> 16 bits -#define RGB_TO_YUV16(y, u, v, r, g, b) \ -{ \ - y = ((yuv_table->rtoy_tab16[r] + yuv_table->gtoy_tab16[g] + yuv_table->btoy_tab16[b]) >> 8); \ - u = ((yuv_table->rtou_tab16[r] + yuv_table->gtou_tab16[g] + yuv_table->btou_tab16[b]) >> 8); \ - v = ((yuv_table->rtov_tab16[r] + yuv_table->gtov_tab16[g] + yuv_table->btov_tab16[b]) >> 8); \ - CLAMP(y, 0, 0xffff); \ - CLAMP(u, 0, 0xffff); \ - CLAMP(v, 0, 0xffff); \ -} - -#define WRITE_YUV101010(y, u, v) \ -{ \ - uint32_t output_i = ((y & 0xffc0) << 16) | \ - ((u & 0xffc0) << 6) | \ - ((v & 0xffc0) >> 4); \ - *(*output)++ = output_i; \ - *(*output)++ = output_i >> 8; \ - *(*output)++ = output_i >> 16; \ - *(*output)++ = output_i >> 24; \ -} - - -// ****************************** Pixel transfers ***************************** - - - - - - -// ****************************** ARGB8888 -> ********************************* - -static inline void transfer_ARGB8888_to_ARGB8888(unsigned char *(*output), unsigned char *input) -{ - (*output)[0] = input[0]; - (*output)[1] = input[1]; - (*output)[2] = input[2]; - (*output)[3] = input[3]; - (*output) += 4; -} - -static inline void transfer_ARGB8888_to_RGBA8888(unsigned char *(*output), unsigned char *input) -{ - (*output)[0] = input[1]; - (*output)[1] = input[2]; - (*output)[2] = input[3]; - (*output)[3] = input[0]; - (*output) += 4; -} - - -static inline void transfer_ARGB8888_to_RGB888(unsigned char *(*output), unsigned char *input) -{ - int a = input[0]; - (*output)[0] = input[1] * a / 0xff; - (*output)[1] = input[2] * a / 0xff; - (*output)[2] = input[3] * a / 0xff; - (*output) += 3; -} - -static inline void transfer_ARGB8888_to_BGR8888(unsigned char *(*output), unsigned char *input) -{ - int a = input[0]; - (*output)[0] = input[3] * a / 0xff; - (*output)[1] = input[2] * a / 0xff; - (*output)[2] = input[1] * a / 0xff; - (*output) += 3; -} - - - - - - - - - - - - - - - -// ******************************** RGB888 -> ********************************* - -static inline void transfer_RGB888_to_RGB8(unsigned char *(*output), unsigned char *input) -{ - *(*output) = (unsigned char)((input[0] & 0xc0) + - ((input[1] & 0xe0) >> 2) + - ((input[2] & 0xe0) >> 5)); - (*output)++; -} - -static inline void transfer_RGB888_to_BGR565(unsigned char *(*output), unsigned char *input) -{ - uint16_t r, g, b; - uint16_t r_s, g_s, b_s; - r = *input++; - g = *input++; - b = *input; - - r_s = (r & 0x01) << 7; - r_s |= (r & 0x02) << 5; - r_s |= (r & 0x04) << 3; - r_s |= (r & 0x08) << 1; - r_s |= (r & 0x10) >> 1; - r_s |= (r & 0x20) >> 3; - r_s |= (r & 0x40) >> 5; - r_s |= (r & 0x80) >> 7; - - g_s = (g & 0x01) << 7; - g_s |= (g & 0x02) << 5; - g_s |= (g & 0x04) << 3; - g_s |= (g & 0x08) << 1; - g_s |= (g & 0x10) >> 1; - g_s |= (g & 0x20) >> 3; - g_s |= (g & 0x40) >> 5; - g_s |= (g & 0x80) >> 7; - - b_s = (b & 0x01) << 7; - b_s |= (b & 0x02) << 5; - b_s |= (b & 0x04) << 3; - b_s |= (b & 0x08) << 1; - b_s |= (b & 0x10) >> 1; - b_s |= (b & 0x20) >> 3; - b_s |= (b & 0x40) >> 5; - b_s |= (b & 0x80) >> 7; - - *(uint16_t*)(*output) = ((b_s & 0xf8) << 8) - + ((g_s & 0xfc) << 3) - + ((r_s & 0xf8) >> 3); - (*output) += 2; -} - -static inline void transfer_RGB888_to_RGB565(unsigned char *(*output), unsigned char *input) -{ - uint16_t r, g, b; - r = *input++; - g = *input++; - b = *input; - *(uint16_t*)(*output) = ((r & 0xf8) << 8) - + ((g & 0xfc) << 3) - + ((b & 0xf8) >> 3); - (*output) += 2; -} - -static inline void transfer_RGB888_to_BGR888(unsigned char *(*output), unsigned char *input) -{ - *(*output)++ = input[2]; - *(*output)++ = input[1]; - *(*output)++ = input[0]; -} - -static inline void transfer_RGB888_to_RGB888(unsigned char *(*output), unsigned char *input) -{ - *(*output)++ = *input++; - *(*output)++ = *input++; - *(*output)++ = *input; -} - -static inline void transfer_RGB888_to_RGBA8888(unsigned char *(*output), unsigned char *input) -{ - *(*output)++ = *input++; - *(*output)++ = *input++; - *(*output)++ = *input; - *(*output)++ = 0xff; -} - -static inline void transfer_RGB888_to_ARGB8888(unsigned char *(*output), unsigned char *input) -{ - *(*output)++ = 0xff; - *(*output)++ = *input++; - *(*output)++ = *input++; - *(*output)++ = *input; -} - -static inline void transfer_RGB888_to_RGB161616(uint16_t *(*output), unsigned char *input) -{ - (*output)[0] = (input[0] << 8) | input[0]; - (*output)[1] = (input[1] << 8) | input[1]; - (*output)[2] = (input[2] << 8) | input[2]; - (*output) += 3; -} - -static inline void transfer_RGB888_to_RGBA16161616(uint16_t *(*output), unsigned char *input) -{ - (*output)[0] = (input[0] << 8) | input[0]; - (*output)[1] = (input[1] << 8) | input[1]; - (*output)[2] = (input[2] << 8) | input[2]; - (*output)[3] = 0xffff; - (*output) += 4; -} - -static inline void transfer_RGB888_to_RGB_FLOAT(float *(*output), unsigned char *input) -{ - *(*output)++ = (float)*input++ / 0xff; - *(*output)++ = (float)*input++ / 0xff; - *(*output)++ = (float)*input / 0xff; -} - -static inline void transfer_RGB888_to_RGBA_FLOAT(float *(*output), unsigned char *input) -{ - *(*output)++ = (float)*input++ / 0xff; - *(*output)++ = (float)*input++ / 0xff; - *(*output)++ = (float)*input / 0xff; - *(*output)++ = 1.0; -} - -static inline void transfer_RGB888_to_ABGR8888(unsigned char *(*output), unsigned char *input) -{ - *(*output)++ = 0xff; - *(*output)++ = input[2]; - *(*output)++ = input[1]; - *(*output)++ = input[0]; -} - -static inline void transfer_RGB888_to_BGR8888(unsigned char *(*output), unsigned char *input) -{ - *(*output)++ = input[2]; - *(*output)++ = input[1]; - *(*output)++ = input[0]; - (*output)++; -} - -static inline void transfer_RGB888_to_YUV888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - - RGB_TO_YUV(y, u, v, input[0], input[1], input[2]); - - *(*output)++ = y; - *(*output)++ = u; - *(*output)++ = v; -} - - -static inline void transfer_RGB888_to_YUV101010(unsigned char *(*output), unsigned char *input) -{ - int r, g, b; - int y, u, v; - - r = ((uint16_t)input[0]) << 8; - g = ((uint16_t)input[1]) << 8; - b = ((uint16_t)input[2]) << 8; - RGB_TO_YUV16(y, u, v, r, g, b); - WRITE_YUV101010(y, u, v); -} - -static inline void transfer_RGB888_to_VYU888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - - RGB_TO_YUV(y, u, v, input[0], input[1], input[2]); - - *(*output)++ = v; - *(*output)++ = y; - *(*output)++ = u; -} - -static inline void transfer_RGB888_to_UYVA8888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - - RGB_TO_YUV(y, u, v, input[0], input[1], input[2]); - - *(*output)++ = u; - *(*output)++ = y; - *(*output)++ = v; - *(*output)++ = 0xff; -} - - - -static inline void transfer_RGB888_to_YUVA8888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - - RGB_TO_YUV(y, u, v, input[0], input[1], input[2]); - - *(*output)++ = y; - *(*output)++ = u; - *(*output)++ = v; - *(*output)++ = 255; -} - -static inline void transfer_RGB888_to_YUV161616(uint16_t *(*output), unsigned char *input) -{ - int y, u, v, r, g, b; - - r = ((int)input[0] << 8) | input[0]; - g = ((int)input[1] << 8) | input[1]; - b = ((int)input[2] << 8) | input[2]; - - RGB_TO_YUV16(y, u, v, r, g, b); - - *(*output)++ = y; - *(*output)++ = u; - *(*output)++ = v; -} - -static inline void transfer_RGB888_to_YUVA16161616(uint16_t *(*output), unsigned char *input) -{ - int y, u, v, r, g, b; - - r = (((int)input[0]) << 8) | input[0]; - g = (((int)input[1]) << 8) | input[1]; - b = (((int)input[2]) << 8) | input[2]; - RGB_TO_YUV16(y, u, v, r, g, b); - - *(*output)++ = y; - *(*output)++ = u; - *(*output)++ = v; - *(*output)++ = 0xffff; -} - -static inline void transfer_RGB888_to_YUV420P_YUV422P(unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - unsigned char *input, - int output_column) -{ - int y, u, v; - - RGB_TO_YUV(y, u, v, input[0], input[1], input[2]); - - output_y[output_column] = y; - output_u[output_column / 2] = u; - output_v[output_column / 2] = v; -} - -static inline void transfer_RGB888_to_YUV444P(unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - unsigned char *input, - int output_column) -{ - int y, u, v; - - RGB_TO_YUV(y, u, v, input[0], input[1], input[2]); - - output_y[output_column] = y; - output_u[output_column] = u; - output_v[output_column] = v; -} - -static inline void transfer_RGB888_to_YUV422(unsigned char *(*output), - unsigned char *input, - int j) -{ - int y, u, v; - - RGB_TO_YUV(y, u, v, input[0], input[1], input[2]); - - if(!(j & 1)) - { -// Store U and V for even pixels only - (*output)[1] = u; - (*output)[3] = v; - (*output)[0] = y; - } - else - { -// Store Y and advance output for odd pixels only - (*output)[2] = y; - (*output) += 4; - } - -} - - - - - - - -// *************************** RGBA8888 -> ************************************ - -static inline void transfer_RGBA8888_to_TRANSPARENCY(unsigned char *(*output), unsigned char *input, int (*bit_counter)) -{ - if((*bit_counter) == 7) *(*output) = 0; - - if(input[3] < 127) - { - *(*output) |= (unsigned char)1 << (7 - (*bit_counter)); - } - - if((*bit_counter) == 0) - { - (*output)++; - (*bit_counter) = 7; - } - else - (*bit_counter)--; -} - -// These routines blend in a background color since they should be -// exclusively used for widgets. - -static inline void transfer_RGBA8888_to_RGB8bg(unsigned char *(*output), unsigned char *input, int bg_r, int bg_g, int bg_b) -{ - unsigned int r, g, b, a, anti_a; - a = input[3]; - anti_a = 255 - a; - r = ((unsigned int)input[0] * a + bg_r * anti_a) / 0xff; - g = ((unsigned int)input[1] * a + bg_g * anti_a) / 0xff; - b = ((unsigned int)input[2] * a + bg_b * anti_a) / 0xff; - *(*output) = (unsigned char)((r & 0xc0) + - ((g & 0xe0) >> 2) + - ((b & 0xe0) >> 5)); - (*output)++; -} - -static inline void transfer_RGBA8888_to_BGR565bg(unsigned char *(*output), unsigned char *input, int bg_r, int bg_g, int bg_b) -{ - unsigned int r, g, b, a, anti_a; - a = input[3]; - anti_a = 255 - a; - r = ((unsigned int)input[0] * a + bg_r * anti_a) / 0xff; - g = ((unsigned int)input[1] * a + bg_g * anti_a) / 0xff; - b = ((unsigned int)input[2] * a + bg_b * anti_a) / 0xff; - *(uint16_t*)(*output) = (uint16_t)(((b & 0xf8) << 8) + - ((g & 0xfc) << 3) + - ((r & 0xf8) >> 3)); - (*output) += 2; -} - -static inline void transfer_RGBA8888_to_RGB565bg(unsigned char *(*output), unsigned char *input, int bg_r, int bg_g, int bg_b) -{ - unsigned int r, g, b, a, anti_a; - a = input[3]; - anti_a = 255 - a; - r = ((unsigned int)input[0] * a + bg_r * anti_a) / 0xff; - g = ((unsigned int)input[1] * a + bg_g * anti_a) / 0xff; - b = ((unsigned int)input[2] * a + bg_b * anti_a) / 0xff; - *(uint16_t*)(*output) = (uint16_t)(((r & 0xf8) << 8)+ - ((g & 0xfc) << 3) + - ((b & 0xf8) >> 3)); - (*output) += 2; -} - -static inline void transfer_RGBA8888_to_BGR888bg(unsigned char *(*output), unsigned char *input, int bg_r, int bg_g, int bg_b) -{ - unsigned int r, g, b, a, anti_a; - a = input[3]; - anti_a = 255 - a; - r = ((unsigned int)input[0] * a + bg_r * anti_a) / 0xff; - g = ((unsigned int)input[1] * a + bg_g * anti_a) / 0xff; - b = ((unsigned int)input[2] * a + bg_b * anti_a) / 0xff; - *(*output)++ = b; - *(*output)++ = g; - *(*output)++ = r; -} - -static inline void transfer_RGBA8888_to_RGB888bg(unsigned char *(*output), unsigned char *input, int bg_r, int bg_g, int bg_b) -{ - unsigned int r, g, b, a, anti_a; - a = input[3]; - anti_a = 255 - a; - r = ((unsigned int)input[0] * a + bg_r * anti_a) / 0xff; - g = ((unsigned int)input[1] * a + bg_g * anti_a) / 0xff; - b = ((unsigned int)input[2] * a + bg_b * anti_a) / 0xff; - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; -} - -static inline void transfer_RGBA8888_to_BGR8888bg(unsigned char *(*output), unsigned char *input, int bg_r, int bg_g, int bg_b) -{ - unsigned int r, g, b, a, anti_a; - a = input[3]; - anti_a = 255 - a; - - r = ((unsigned int)input[0] * a + bg_r * anti_a) / 0xff; - g = ((unsigned int)input[1] * a + bg_g * anti_a) / 0xff; - b = ((unsigned int)input[2] * a + bg_b * anti_a) / 0xff; - - *(*output)++ = b; - *(*output)++ = g; - *(*output)++ = r; - (*output)++; -} - - - - - - - -// These routines blend in a black background - -static inline void transfer_RGBA8888_to_RGB8(unsigned char *(*output), unsigned char *input) -{ - unsigned int r, g, b, a; - a = input[3]; - r = (unsigned int)input[0] * a; - g = (unsigned int)input[1] * a; - b = (unsigned int)input[2] * a; - *(*output) = (unsigned char)(((r & 0xc000) >> 8) + - ((g & 0xe000) >> 10) + - ((b & 0xe000) >> 13)); - (*output)++; -} - -static inline void transfer_RGBA8888_to_BGR565(unsigned char *(*output), unsigned char *input) -{ - unsigned int r, g, b, a; - a = input[3]; - r = ((unsigned int)input[0] * a) / 0xff; - g = ((unsigned int)input[1] * a) / 0xff; - b = ((unsigned int)input[2] * a) / 0xff; - *(uint16_t*)(*output) = (uint16_t)(((b & 0xf8) << 8) + - ((g & 0xfc) << 3) + - ((r & 0xf8) >> 3)); - (*output) += 2; -} - -static inline void transfer_RGBA8888_to_RGB565(unsigned char *(*output), unsigned char *input) -{ - unsigned int r, g, b, a; - a = input[3]; - r = ((unsigned int)input[0] * a) / 0xff; - g = ((unsigned int)input[1] * a) / 0xff; - b = ((unsigned int)input[2] * a) / 0xff; - - - *(uint16_t*)(*output) = (uint16_t)(((r & 0xf8) << 8) + - ((g & 0xfc) << 3) + - ((b & 0xf8) >> 3)); - (*output) += 2; -} - -static inline void transfer_RGBA8888_to_BGR888(unsigned char *(*output), unsigned char *input) -{ - unsigned int r, g, b, a; - a = input[3]; - r = ((unsigned int)input[0] * a) / 0xff; - g = ((unsigned int)input[1] * a) / 0xff; - b = ((unsigned int)input[2] * a) / 0xff; - *(*output)++ = b; - *(*output)++ = g; - *(*output)++ = r; -} - -static inline void transfer_RGBA8888_to_RGB888(unsigned char *(*output), unsigned char *input) -{ - unsigned int r, g, b, a; - a = input[3]; - r = ((unsigned int)input[0] * a) / 0xff; - g = ((unsigned int)input[1] * a) / 0xff; - b = ((unsigned int)input[2] * a) / 0xff; - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; -} - -static inline void transfer_RGBA8888_to_RGBA8888(unsigned char *(*output), unsigned char *input) -{ - (*output)[0] = input[0]; - (*output)[1] = input[1]; - (*output)[2] = input[2]; - (*output)[3] = input[3]; - (*output) += 4; -} - -static inline void transfer_RGBA8888_to_ARGB8888(unsigned char *(*output), unsigned char *input) -{ - (*output)[0] = input[3]; - (*output)[1] = input[0]; - (*output)[2] = input[1]; - (*output)[3] = input[2]; - (*output) += 4; -} - -static inline void transfer_RGBA8888_to_RGB161616(uint16_t *(*output), unsigned char *input) -{ - int opacity = input[3]; - (*output)[0] = (((int)input[0] << 8) | input[0]) * opacity / 0xff; - (*output)[1] = (((int)input[1] << 8) | input[1]) * opacity / 0xff; - (*output)[2] = (((int)input[2] << 8) | input[2]) * opacity / 0xff; - (*output) += 3; -} - -static inline void transfer_RGBA8888_to_RGBA16161616(uint16_t *(*output), unsigned char *input) -{ - (*output)[0] = (((int)input[0]) << 8) | input[0]; - (*output)[1] = (((int)input[1]) << 8) | input[1]; - (*output)[2] = (((int)input[2]) << 8) | input[2]; - (*output)[3] = (((int)input[3]) << 8) | input[3]; - (*output) += 4; -} - -static inline void transfer_RGBA8888_to_RGB_FLOAT(float *(*output), unsigned char *input) -{ - float opacity = (float)input[3]; - *(*output)++ = (float)*input++ * opacity / 0xff / 0xff; - *(*output)++ = (float)*input++ * opacity / 0xff / 0xff; - *(*output)++ = (float)*input * opacity / 0xff / 0xff; -} - -static inline void transfer_RGBA8888_to_RGBA_FLOAT(float *(*output), unsigned char *input) -{ - *(*output)++ = (float)*input++ / 0xff; - *(*output)++ = (float)*input++ / 0xff; - *(*output)++ = (float)*input++ / 0xff; - *(*output)++ = (float)*input / 0xff; -} - -static inline void transfer_RGBA8888_to_BGR8888(unsigned char *(*output), unsigned char *input) -{ - unsigned int r, g, b, a; - a = input[3]; - r = ((unsigned int)input[0] * a) / 0xff; - g = ((unsigned int)input[1] * a) / 0xff; - b = ((unsigned int)input[2] * a) / 0xff; - *(*output)++ = b; - *(*output)++ = g; - *(*output)++ = r; - (*output)++; -} - -static inline void transfer_RGBA8888_to_YUV888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v, a, r, g, b; - - a = input[3]; - r = (input[0] * a) / 0xff; - g = (input[1] * a) / 0xff; - b = (input[2] * a) / 0xff; - - RGB_TO_YUV(y, u, v, r, g, b); - - *(*output)++ = y; - *(*output)++ = u; - *(*output)++ = v; -} - -static inline void transfer_RGBA8888_to_YUVA8888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - - RGB_TO_YUV(y, u, v, input[0], input[1], input[2]); - - *(*output)++ = y; - *(*output)++ = u; - *(*output)++ = v; - *(*output)++ = input[3]; -} - -static inline void transfer_RGBA8888_to_YUV161616(uint16_t *(*output), unsigned char *input) -{ - int y, u, v, opacity, r, g, b; - - opacity = input[3]; - r = (((int)input[0] << 8) | input[0]) * opacity / 0xff; - g = (((int)input[1] << 8) | input[1]) * opacity / 0xff; - b = (((int)input[2] << 8) | input[2]) * opacity / 0xff; - - RGB_TO_YUV16(y, u, v, r, g, b); - - *(*output)++ = y; - *(*output)++ = u; - *(*output)++ = v; -} - -static inline void transfer_RGBA8888_to_YUVA16161616(uint16_t *(*output), unsigned char *input) -{ - int y, u, v, r, g, b; - - r = (((int)input[0]) << 8) | input[0]; - g = (((int)input[1]) << 8) | input[1]; - b = (((int)input[2]) << 8) | input[2]; - RGB_TO_YUV16(y, u, v, r, g, b); - - *(*output)++ = y; - *(*output)++ = u; - *(*output)++ = v; - *(*output)++ = (((int)input[3]) << 8) | input[3]; -} - -static inline void transfer_RGBA8888_to_YUV101010(unsigned char *(*output), unsigned char *input) -{ - int r, g, b; - int y, u, v; - - r = ((uint16_t)input[0] * input[3]) + 0x1fe; - g = ((uint16_t)input[1] * input[3]) + 0x1fe; - b = ((uint16_t)input[2] * input[3]) + 0x1fe; - RGB_TO_YUV16(y, u, v, r, g, b); - WRITE_YUV101010(y, u, v); -} - -static inline void transfer_RGBA8888_to_VYU888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v, a, r, g, b; - - a = input[3]; - r = ((input[0] * a) >> 8) + 1; - g = ((input[1] * a) >> 8) + 1; - b = ((input[2] * a) >> 8) + 1; - - RGB_TO_YUV(y, u, v, r, g, b); - - *(*output)++ = v; - *(*output)++ = y; - *(*output)++ = u; -} - -static inline void transfer_RGBA8888_to_UYVA8888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - - RGB_TO_YUV(y, u, v, input[0], input[1], input[2]); - - *(*output)++ = u; - *(*output)++ = y; - *(*output)++ = v; - *(*output)++ = input[3]; -} - -static inline void transfer_RGBA888_to_YUV420P_YUV422P(unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - unsigned char *input, - int output_column) -{ - int y, u, v, a, r, g, b; - - a = input[3]; - r = (input[0] * a) / 0xff; - g = (input[1] * a) / 0xff; - b = (input[2] * a) / 0xff; - - RGB_TO_YUV(y, u, v, r, g, b); - - output_y[output_column] = y; - output_u[output_column / 2] = u; - output_v[output_column / 2] = v; -} - -static inline void transfer_RGBA888_to_YUV444P(unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - unsigned char *input, - int output_column) -{ - int y, u, v, a, r, g, b; - - a = input[3]; - r = (input[0] * a) / 0xff; - g = (input[1] * a) / 0xff; - b = (input[2] * a) / 0xff; - - RGB_TO_YUV(y, u, v, r, g, b); - - output_y[output_column] = y; - output_u[output_column] = u; - output_v[output_column] = v; -} - -static inline void transfer_RGBA888_to_YUV422(unsigned char *(*output), - unsigned char *input, - int j) -{ - int y, u, v, a, r, g, b; - - a = input[3]; - r = (input[0] * a) / 0xff; - g = (input[1] * a) / 0xff; - b = (input[2] * a) / 0xff; - - RGB_TO_YUV(y, u, v, r, g, b); - - if(!(j & 1)) - { -// Store U and V for even pixels only - (*output)[1] = u; - (*output)[3] = v; - (*output)[0] = y; - } - else - { -// Store Y and advance output for odd pixels only - (*output)[2] = y; - (*output) += 4; - } - -} - - - - - - - - - - - - - -// ******************************** RGB161616 -> ********************************* - -static inline void transfer_RGB161616_to_RGB8(unsigned char *(*output), uint16_t *input) -{ - *(*output) = (unsigned char)(((input[0] & 0xc000) >> 8) + - ((input[1] & 0xe000) >> 10) + - ((input[2] & 0xe000) >> 13)); - (*output)++; -} - -static inline void transfer_RGB161616_to_BGR565(unsigned char *(*output), uint16_t *input) -{ - uint16_t r, g, b; - r = *input++; - g = *input++; - b = *input; - *(uint16_t*)(*output) = (b & 0xf800) | - ((g & 0xfc00) >> 5) | - ((r & 0xf800) >> 11); - (*output) += 2; -} - -static inline void transfer_RGB161616_to_RGB565(unsigned char *(*output), uint16_t *input) -{ - uint16_t r, g, b; - r = *input++; - g = *input++; - b = *input; - *(uint16_t*)(*output) = (r & 0xf800) | - ((g & 0xfc00) >> 5) | - ((b & 0xf800) >> 11); - (*output) += 2; -} - -static inline void transfer_RGB161616_to_BGR888(unsigned char *(*output), uint16_t *input) -{ - (*output)[0] = input[2] >> 8; - (*output)[1] = input[1] >> 8; - (*output)[2] = input[0] >> 8; - (*output) += 3; -} - -static inline void transfer_RGB161616_to_RGB888(unsigned char *(*output), uint16_t *input) -{ - (*output)[0] = input[0] >> 8; - (*output)[1] = input[1] >> 8; - (*output)[2] = input[2] >> 8; - (*output) += 3; -} - -static inline void transfer_RGB161616_to_RGBA8888(unsigned char *(*output), uint16_t *input) -{ - (*output)[0] = input[0] >> 8; - (*output)[1] = input[1] >> 8; - (*output)[2] = input[2] >> 8; - (*output)[3] = 0xff; - (*output) += 4; -} - -static inline void transfer_RGB161616_to_BGR8888(unsigned char *(*output), uint16_t *input) -{ - (*output)[0] = input[2] >> 8; - (*output)[1] = input[1] >> 8; - (*output)[2] = input[0] >> 8; - (*output) += 4; -} - -static inline void transfer_RGB161616_to_RGB_FLOAT(float *(*output), uint16_t *input) -{ - *(*output)++ = (float)*input++ / 0xffff; - *(*output)++ = (float)*input++ / 0xffff; - *(*output)++ = (float)*input / 0xffff; -} - -static inline void transfer_RGB161616_to_RGBA_FLOAT(float *(*output), uint16_t *input) -{ - *(*output)++ = (float)*input++ / 0xffff; - *(*output)++ = (float)*input++ / 0xffff; - *(*output)++ = (float)*input / 0xffff; - *(*output)++ = 1.0; -} - -static inline void transfer_RGB161616_to_YUV888(unsigned char *(*output), uint16_t *input) -{ - int y, u, v, r, g, b; - r = input[0] >> 8; - g = input[1] >> 8; - b = input[2] >> 8; - - RGB_TO_YUV(y, u, v, r, g, b); - - (*output)[0] = y; - (*output)[1] = u; - (*output)[2] = v; - (*output) += 3; -} - -static inline void transfer_RGB161616_to_YUVA8888(unsigned char *(*output), uint16_t *input) -{ - int y, u, v, r, g, b; - - r = input[0] >> 8; - g = input[1] >> 8; - b = input[2] >> 8; - - RGB_TO_YUV(y, u, v, r, g, b); - - (*output)[0] = y; - (*output)[1] = u; - (*output)[2] = v; - (*output)[3] = 255; - (*output) += 4; -} - -static inline void transfer_RGB161616_to_YUV161616(uint16_t *(*output), uint16_t *input) -{ - uint32_t y, u, v, r, g, b; - - r = (uint32_t)input[0]; - g = (uint32_t)input[1]; - b = (uint32_t)input[2]; - - RGB_TO_YUV16(y, u, v, r, g, b); - - (*output)[0] = y; - (*output)[1] = u; - (*output)[2] = v; - (*output) += 3; -} - -static inline void transfer_RGB161616_to_YUVA16161616(uint16_t *(*output), uint16_t *input) -{ - uint32_t y, u, v, r, g, b; - - r = (uint32_t)input[0]; - g = (uint32_t)input[1]; - b = (uint32_t)input[2]; - - RGB_TO_YUV16(y, u, v, r, g, b); - - (*output)[0] = y; - (*output)[1] = u; - (*output)[2] = v; - (*output)[3] = 0xffff; - (*output) += 4; -} - -static inline void transfer_RGB161616_to_YUV101010(unsigned char *(*output), uint16_t *input) -{ - int r, g, b; - int y, u, v; - - r = input[0]; - g = input[1]; - b = input[2]; - RGB_TO_YUV16(y, u, v, r, g, b); - WRITE_YUV101010(y, u, v); -} - -static inline void transfer_RGB161616_to_VYU888(unsigned char *(*output), uint16_t *input) -{ - int y, u, v, r, g, b; - r = input[0] >> 8; - g = input[1] >> 8; - b = input[2] >> 8; - - RGB_TO_YUV(y, u, v, r, g, b); - - (*output)[0] = v; - (*output)[1] = y; - (*output)[2] = u; - (*output) += 3; -} - -static inline void transfer_RGB161616_to_UYVA8888(unsigned char *(*output), uint16_t *input) -{ - int y, u, v, r, g, b; - - r = input[0] >> 8; - g = input[1] >> 8; - b = input[2] >> 8; - - RGB_TO_YUV(y, u, v, r, g, b); - - (*output)[0] = u; - (*output)[1] = y; - (*output)[2] = v; - (*output)[3] = 0xff; - (*output) += 4; -} - - -static inline void transfer_RGB161616_to_YUV420P_YUV422P(unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - uint16_t *input, - int output_column) -{ - int y, u, v, r, g, b; - r = input[0] >> 8; - g = input[1] >> 8; - b = input[2] >> 8; - - RGB_TO_YUV(y, u, v, r, g, b); - - output_y[output_column] = y; - output_u[output_column / 2] = u; - output_v[output_column / 2] = v; -} - -static inline void transfer_RGB161616_to_YUV444P(unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - uint16_t *input, - int output_column) -{ - int y, u, v, r, g, b; - r = input[0] >> 8; - g = input[1] >> 8; - b = input[2] >> 8; - - RGB_TO_YUV(y, u, v, r, g, b); - - output_y[output_column] = y; - output_u[output_column] = u; - output_v[output_column] = v; -} - - -// ****************************** RGBA16161616 -> ***************************** - -static inline void transfer_RGBA16161616_to_RGB8(unsigned char *(*output), uint16_t *input) -{ - unsigned int r, g, b, a; - a = (input)[3] >> 8; - r = (unsigned int)(input)[0] * a; - g = (unsigned int)(input)[1] * a; - b = (unsigned int)(input)[2] * a; - - *(*output) = (unsigned char)(((r & 0xc00000) >> 16) + - ((g & 0xe00000) >> 18) + - ((b & 0xe00000) >> 21)); - (*output)++; -} - -static inline void transfer_RGBA16161616_to_BGR565(unsigned char *(*output), uint16_t *input) -{ - unsigned int r, g, b, a; - a = (input)[3] >> 8; - r = (unsigned int)(input)[0] * a; - g = (unsigned int)(input)[1] * a; - b = (unsigned int)(input)[2] * a; - - *(uint16_t*)(*output) = (uint16_t)(((b & 0xf80000) >> 8) + - ((g & 0xfc0000) >> 13) + - ((r & 0xf80000) >> 19)); - (*output) += 2; -} - -static inline void transfer_RGBA16161616_to_RGB565(unsigned char *(*output), uint16_t *input) -{ - unsigned int r, g, b, a; - a = (input)[3] >> 8; - r = (unsigned int)(input)[0] * a; - g = (unsigned int)(input)[1] * a; - b = (unsigned int)(input)[2] * a; - - *(uint16_t*)(*output) = (uint16_t)(((r & 0xf80000) >> 8) + - ((g & 0xfc0000) >> 13) + - ((b & 0xf80000) >> 19)); - (*output) += 2; -} - -static inline void transfer_RGBA16161616_to_BGR888(unsigned char *(*output), uint16_t *input) -{ - uint32_t r, g, b, a; - a = input[3]; - r = (uint32_t)(input)[0] * a; - g = (uint32_t)(input)[1] * a; - b = (uint32_t)(input)[2] * a; - -// For display only - (*output)[0] = (unsigned char)(b >> 24); - (*output)[1] = (unsigned char)(g >> 24); - (*output)[2] = (unsigned char)(r >> 24); - (*output) += 3; -} - -static inline void transfer_RGBA16161616_to_RGB888(unsigned char *(*output), uint16_t *input) -{ - uint32_t r, g, b, a; - a = input[3]; - r = (unsigned int)(input)[0] * a; - g = (unsigned int)(input)[1] * a; - b = (unsigned int)(input)[2] * a; - - (*output)[0] = (unsigned char)(r / 0xffffff); - (*output)[1] = (unsigned char)(g / 0xffffff); - (*output)[2] = (unsigned char)(b / 0xffffff); - (*output) += 3; -} - - -static inline void transfer_RGBA16161616_to_RGBA8888(unsigned char *(*output), uint16_t *input) -{ - (*output)[0] = input[0] >> 8; - (*output)[1] = input[1] >> 8; - (*output)[2] = input[2] >> 8; - (*output)[3] = input[3] >> 8; - (*output) += 4; -} - - -static inline void transfer_RGBA16161616_to_BGR8888(unsigned char *(*output), uint16_t *input) -{ - uint32_t r, g, b, a; - a = input[3]; - r = (input)[0] * a; - g = (input)[1] * a; - b = (input)[2] * a; - -// For display only - (*output)[0] = (unsigned char)(b >> 24); - (*output)[1] = (unsigned char)(g >> 24); - (*output)[2] = (unsigned char)(r >> 24); - (*output) += 4; -} - -static inline void transfer_RGBA16161616_to_RGB_FLOAT(float *(*output), uint16_t *input) -{ - float opacity = (float)input[3]; - *(*output)++ = (float)*input++ * opacity / 0xffff / 0xffff; - *(*output)++ = (float)*input++ * opacity / 0xffff / 0xffff; - *(*output)++ = (float)*input * opacity / 0xffff / 0xffff; -} - -static inline void transfer_RGBA16161616_to_RGBA_FLOAT(float *(*output), uint16_t *input) -{ - *(*output)++ = (float)*input++ / 0xffff; - *(*output)++ = (float)*input++ / 0xffff; - *(*output)++ = (float)*input++ / 0xffff; - *(*output)++ = (float)*input / 0xffff; -} - -static inline void transfer_RGBA16161616_to_YUV888(unsigned char *(*output), uint16_t *input) -{ - uint32_t y, u, v, r, g, b, a; - - a = input[3]; - r = (uint32_t)input[0] * a / 0xffffff; - g = (uint32_t)input[1] * a / 0xffffff; - b = (uint32_t)input[2] * a / 0xffffff; - - RGB_TO_YUV(y, u, v, r, g, b); - - (*output)[0] = y; - (*output)[1] = u; - (*output)[2] = v; - (*output) += 3; -} - -static inline void transfer_RGBA16161616_to_YUVA8888(unsigned char *(*output), uint16_t *input) -{ - int y, u, v, r, g, b; - - r = input[0] >> 8; - g = input[1] >> 8; - b = input[2] >> 8; - - RGB_TO_YUV(y, u, v, r, g, b); - - (*output)[0] = y; - (*output)[1] = u; - (*output)[2] = v; - (*output)[3] = input[3] >> 8; - (*output) += 4; -} - -static inline void transfer_RGBA16161616_to_YUV161616(uint16_t *(*output), uint16_t *input) -{ - uint32_t y, u, v, r, g, b, a; - - a = input[3]; - r = (uint32_t)input[0] * a / 0xffff; - g = (uint32_t)input[1] * a / 0xffff; - b = (uint32_t)input[2] * a / 0xffff; - - RGB_TO_YUV16(y, u, v, r, g, b); - - (*output)[0] = y; - (*output)[1] = u; - (*output)[2] = v; - (*output) += 3; -} - -static inline void transfer_RGBA16161616_to_YUVA16161616(uint16_t *(*output), uint16_t *input) -{ - uint32_t y, u, v, r, g, b; - - r = (uint32_t)input[0]; - g = (uint32_t)input[1]; - b = (uint32_t)input[2]; - - RGB_TO_YUV16(y, u, v, r, g, b); - - (*output)[0] = y; - (*output)[1] = u; - (*output)[2] = v; - (*output)[3] = input[3]; - (*output) += 4; -} - - -static inline void transfer_RGBA16161616_to_YUV101010(unsigned char *(*output), uint16_t *input) -{ - uint32_t r, g, b, a, y, u, v; - - a = input[3]; - r = (uint32_t)input[0] * a / 0xffff; - g = (uint32_t)input[1] * a / 0xffff; - b = (uint32_t)input[2] * a / 0xffff; - RGB_TO_YUV16(y, u, v, r, g, b); - WRITE_YUV101010(y, u, v); -} - - -static inline void transfer_RGBA16161616_to_YUV420P_YUV422P(unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - uint16_t *input, - int output_column) -{ - uint32_t y, u, v, r, g, b, a; - a = input[3]; - r = (int32_t)input[0] * a / 0xffffff; - g = (int32_t)input[1] * a / 0xffffff; - b = (int32_t)input[2] * a / 0xffffff; - - RGB_TO_YUV(y, u, v, r, g, b); - - output_y[output_column] = y; - output_u[output_column / 2] = u; - output_v[output_column / 2] = v; -} - -static inline void transfer_RGBA16161616_to_YUV444P(unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - uint16_t *input, - int output_column) -{ - uint32_t y, u, v, r, g, b, a; - a = input[3]; - r = (int32_t)input[0] * a / 0xffffff; - g = (int32_t)input[1] * a / 0xffffff; - b = (int32_t)input[2] * a / 0xffffff; - - RGB_TO_YUV(y, u, v, r, g, b); - - output_y[output_column] = y; - output_u[output_column] = u; - output_v[output_column] = v; -} - - - - - - - - - - - - - - - - - - - - - - - -// ********************************** screen capture ***************************** - -static inline void transfer_BGR8888_to_RGB888(unsigned char *(*output), unsigned char *input) -{ - *(*output)++ = input[2]; - *(*output)++ = input[1]; - *(*output)++ = input[0]; -} - -static inline void transfer_BGR8888_to_BGR8888(unsigned char *(*output), unsigned char *input) -{ - *(*output)++ = input[0]; - *(*output)++ = input[1]; - *(*output)++ = input[2]; - (*output)++; -} - -static inline void transfer_BGR888_to_RGB888(unsigned char *(*output), unsigned char *input) -{ - *(*output)++ = input[2]; - *(*output)++ = input[1]; - *(*output)++ = input[0]; -} - - - - - - - -// ******************************** YUV888 -> ********************************* - - -static inline void transfer_YUV888_to_RGB8(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = (input[0] << 16) | (input[0] << 8) | input[0]; - u = input[1]; - v = input[2]; - YUV_TO_RGB(y, u, v, r, g, b); - - *(*output) = (unsigned char)((r & 0xc0) + - ((g & 0xe0) >> 2) + - ((b & 0xe0) >> 5)); - (*output)++; -} - -static inline void transfer_YUV888_to_BGR565(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = (input[0] << 16) | (input[0] << 8) | input[0]; - u = input[1]; - v = input[2]; - YUV_TO_RGB(y, u, v, r, g, b); - *(uint16_t*)(*output) = ((b & 0xf8) << 8) - + ((g & 0xfc) << 3) - + ((r & 0xf8) >> 3); - (*output) += 2; -} - -static inline void transfer_YUV888_to_RGB565(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = (input[0] << 16) | (input[0] << 8) | input[0]; - u = input[1]; - v = input[2]; - YUV_TO_RGB(y, u, v, r, g, b); - *(uint16_t*)(*output) = ((r & 0xf8) << 8) - + ((g & 0xfc) << 3) - + ((b & 0xf8) >> 3); - (*output) += 2; -} - -static inline void transfer_YUV888_to_BGR888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = (input[0] << 16) | (input[0] << 8) | input[0]; - u = input[1]; - v = input[2]; - YUV_TO_RGB(y, u, v, r, g, b); - - *(*output)++ = b; - *(*output)++ = g; - *(*output)++ = r; -} - -static inline void transfer_YUV888_to_BGR8888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = (input[0] << 16) | (input[0] << 8) | input[0]; - u = input[1]; - v = input[2]; - YUV_TO_RGB(y, u, v, r, g, b); - *(*output)++ = b; - *(*output)++ = g; - *(*output)++ = r; - (*output)++; -} - -static inline void transfer_YUV888_to_RGB888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = (input[0] << 16) | (input[0] << 8) | input[0]; - u = (int)input[1]; - v = (int)input[2]; - YUV_TO_RGB(y, u, v, r, g, b); - - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; -} - -static inline void transfer_YUV888_to_RGBA8888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = (input[0] << 16) | (input[0] << 8) | input[0]; - u = input[1]; - v = input[2]; - YUV_TO_RGB(y, u, v, r, g, b); - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; - *(*output)++ = 0xff; -} - -static inline void transfer_YUV888_to_ARGB8888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v; - int r, g, b; - - y = (input[0] << 16) | (input[0] << 8) | input[0]; - u = input[1]; - v = input[2]; - YUV_TO_RGB(y, u, v, r, g, b); - *(*output)++ = 0xff; - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; -} - -static inline void transfer_YUV888_to_RGB_FLOAT(float *(*output), unsigned char *input) -{ - float y = (float)input[0] / 0xff; - int u = input[1]; - int v = input[2]; - float r, g, b; - - YUV_TO_FLOAT(y, u, v, r, g, b); - - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; -} - -static inline void transfer_YUV888_to_RGBA_FLOAT(float *(*output), unsigned char *input) -{ - float y = (float)input[0] / 0xff; - int u = input[1]; - int v = input[2]; - float r, g, b; - - YUV_TO_FLOAT(y, u, v, r, g, b); - - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; - *(*output)++ = 1.0; -} - -static inline void transfer_YUV888_to_YUVA8888(unsigned char *(*output), unsigned char *input) -{ - *(*output)++ = (int)input[0]; - *(*output)++ = input[1]; - *(*output)++ = input[2]; - *(*output)++ = 0xff; -} - -static inline void transfer_YUV888_to_YUV888(unsigned char *(*output), unsigned char *input) -{ - (*output)[0] = (int)input[0]; - (*output)[1] = input[1]; - (*output)[2] = input[2]; - (*output) += 3; -} - - -static inline void transfer_YUV888_to_VYU888(unsigned char *(*output), unsigned char *input) -{ - (*output)[0] = input[2]; - (*output)[1] = input[0]; - (*output)[2] = input[1]; - (*output) += 3; -} - - -static inline void transfer_YUV888_to_UYVA8888(unsigned char *(*output), unsigned char *input) -{ - (*output)[0] = input[1]; - (*output)[1] = input[0]; - (*output)[2] = input[2]; - (*output)[3] = 0xff; - (*output) += 4; -} - - -static inline void transfer_YUV888_to_YUV101010(unsigned char *(*output), unsigned char *input) -{ - uint16_t y_i = ((uint16_t)input[0]) << 8; - uint16_t u_i = ((uint16_t)input[1]) << 8; - uint16_t v_i = ((uint16_t)input[2]) << 8; - WRITE_YUV101010(y_i, u_i, v_i); -} - -static inline void transfer_YUV888_to_YUV420P_YUV422P(unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - unsigned char *input, - int output_column) -{ - output_y[output_column] = input[0]; - output_u[output_column / 2] = input[1]; - output_v[output_column / 2] = input[2]; -} - -static inline void transfer_YUV888_to_YUV444P(unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - unsigned char *input, - int output_column) -{ - output_y[output_column] = input[0]; - output_u[output_column] = input[1]; - output_v[output_column] = input[2]; -} - -static inline void transfer_YUV888_to_YUV422(unsigned char *(*output), - unsigned char *input, - int j) -{ -// Store U and V for even pixels only - if(!(j & 1)) - { - (*output)[1] = input[1]; - (*output)[3] = input[2]; - (*output)[0] = input[0]; - } - else -// Store Y and advance output for odd pixels only - { - (*output)[2] = input[0]; - (*output) += 4; - } -} - - - - - - -// ******************************** YUVA8888 -> ******************************* - - - - -static inline void transfer_YUVA8888_to_RGB8(unsigned char *(*output), unsigned char *input) -{ - int y, u, v, a; - int r, g, b; - - a = input[3]; - y = (input[0] << 16) | (input[0] << 8) | input[0]; - u = input[1]; - v = input[2]; - YUV_TO_RGB(y, u, v, r, g, b); - - r *= a; - g *= a; - b *= a; - - *(*output) = (unsigned char)(((r & 0xc000) >> 8) + - ((g & 0xe000) >> 10) + - ((b & 0xe000) >> 13)); - (*output)++; -} - -static inline void transfer_YUVA8888_to_BGR565(unsigned char *(*output), unsigned char *input) -{ - int y, u, v, a; - int r, g, b; - - a = input[3]; - y = (input[0] << 16) | (input[0] << 8) | input[0]; - u = input[1]; - v = input[2]; - YUV_TO_RGB(y, u, v, r, g, b); - - r *= a; - g *= a; - b *= a; - - *(uint16_t*)(*output) = (uint16_t)((b & 0xf800) + - ((g & 0xfc00) >> 5) + - ((r & 0xf800) >> 11)); - (*output) += 2; -} - -static inline void transfer_YUVA8888_to_RGB565(unsigned char *(*output), unsigned char *input) -{ - int y, u, v, a; - int r, g, b; - - a = input[3]; - y = (input[0] << 16) | (input[0] << 8) | input[0]; - u = input[1]; - v = input[2]; - YUV_TO_RGB(y, u, v, r, g, b); - - r *= a; - g *= a; - b *= a; - - *(uint16_t*)(*output) = (uint16_t)((r & 0xf800) + - ((g & 0xfc00) >> 5) + - ((b & 0xf800) >> 11)); - (*output) += 2; -} - -static inline void transfer_YUVA8888_to_BGR888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v, a; - int r, g, b; - - a = input[3]; - y = (input[0] << 16) | (input[0] << 8) | input[0]; - u = input[1]; - v = input[2]; - - YUV_TO_RGB(y, u, v, r, g, b); - - r *= a; - g *= a; - b *= a; - - *(*output)++ = b / 0xff; - *(*output)++ = g / 0xff; - *(*output)++ = r / 0xff; -} - - -static inline void transfer_YUVA8888_to_BGR8888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v, a; - int r, g, b; - - a = input[3]; - y = (input[0] << 16) | (input[0] << 8) | input[0]; - u = input[1]; - v = input[2]; - - YUV_TO_RGB(y, u, v, r, g, b); - - r *= a; - g *= a; - b *= a; - *(*output)++ = b / 0xff; - *(*output)++ = g / 0xff; - *(*output)++ = r / 0xff; - (*output)++; -} - -static inline void transfer_YUVA8888_to_RGB888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v, a; - int r, g, b; - - a = input[3]; - y = (input[0] << 16) | (input[0] << 8) | input[0]; - u = input[1]; - v = input[2]; - - YUV_TO_RGB(y, u, v, r, g, b); - - r *= a; - g *= a; - b *= a; - - *(*output)++ = r / 0xff; - *(*output)++ = g / 0xff; - *(*output)++ = b / 0xff; -} - -static inline void transfer_YUVA8888_to_RGBA8888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v, a; - int r, g, b; - - a = input[3]; - y = (input[0] << 16) | (input[0] << 8) | input[0]; - u = input[1]; - v = input[2]; - - YUV_TO_RGB(y, u, v, r, g, b); - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; - *(*output)++ = a; -} - -static inline void transfer_YUVA8888_to_ARGB8888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v, a; - int r, g, b; - - a = input[3]; - y = (input[0] << 16) | (input[0] << 8) | input[0]; - u = input[1]; - v = input[2]; - - YUV_TO_RGB(y, u, v, r, g, b); - *(*output)++ = a; - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; -} - -static inline void transfer_YUVA8888_to_RGB_FLOAT(float *(*output), unsigned char *input) -{ - float y, a; - int u, v; - float r, g, b; - - a = (float)input[3] / 0xff; - y = (float)input[0] / 0xff; - u = input[1]; - v = input[2]; - - YUV_TO_FLOAT(y, u, v, r, g, b); - - r *= a; - g *= a; - b *= a; - - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; -} - -static inline void transfer_YUVA8888_to_RGBA_FLOAT(float *(*output), unsigned char *input) -{ - float y = (float)input[0] / 0xff; - int u, v; - float r, g, b, a; - - a = (float)input[3] / 0xff; - u = input[1]; - v = input[2]; - - YUV_TO_FLOAT(y, u, v, r, g, b); - - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; - *(*output)++ = a; -} - -static inline void transfer_YUVA8888_to_YUV888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v, a, anti_a; - a = input[3]; - anti_a = 0xff - a; - y = ((uint32_t)input[0] * a) / 0xff; - u = ((uint32_t)input[1] * a + 0x80 * anti_a) / 0xff; - v = ((uint32_t)input[2] * a + 0x80 * anti_a) / 0xff; - - *(*output)++ = y; - *(*output)++ = u; - *(*output)++ = v; -} - - - -static inline void transfer_YUVA8888_to_VYU888(unsigned char *(*output), unsigned char *input) -{ - int y, u, v, a, anti_a; - a = input[3]; - anti_a = 0xff - a; - y = ((uint32_t)input[0] * a) / 0xff; - u = ((uint32_t)input[1] * a + 0x80 * anti_a) / 0xff; - v = ((uint32_t)input[2] * a + 0x80 * anti_a) / 0xff; - - *(*output)++ = v; - *(*output)++ = y; - *(*output)++ = u; -} - - -static inline void transfer_YUVA8888_to_YUVA8888(unsigned char *(*output), unsigned char *input) -{ - *(*output)++ = input[0]; - *(*output)++ = input[1]; - *(*output)++ = input[2]; - *(*output)++ = input[3]; -} - -static inline void transfer_YUVA8888_to_UYVA8888(unsigned char *(*output), unsigned char *input) -{ - *(*output)++ = input[1]; - *(*output)++ = input[0]; - *(*output)++ = input[2]; - *(*output)++ = input[3]; -} - -static inline void transfer_YUVA8888_to_YUV101010(unsigned char *(*output), unsigned char *input) -{ - uint16_t y_i = ((uint16_t)input[0] * input[3]) + 0x1fe; - uint16_t u_i = ((uint16_t)input[1] * input[3]) + 0x1fe; - uint16_t v_i = ((uint16_t)input[2] * input[3]) + 0x1fe; - WRITE_YUV101010(y_i, u_i, v_i); -} - - -static inline void transfer_YUVA8888_to_YUV420P_YUV422P(unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - unsigned char *input, - int output_column) -{ - int opacity = input[3]; - int transparency = 0xff - opacity; - - output_y[output_column] = ((input[0] * opacity) >> 8) + 1; - output_u[output_column / 2] = ((input[1] * opacity + 0x80 * transparency) >> 8) + 1; - output_v[output_column / 2] = ((input[2] * opacity + 0x80 * transparency) >> 8) + 1; -} - -static inline void transfer_YUVA8888_to_YUV444P(unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - unsigned char *input, - int output_column) -{ - int opacity = input[3]; - int transparency = 0xff - opacity; - - output_y[output_column] = ((input[0] * opacity) >> 8) + 1; - output_u[output_column] = ((input[1] * opacity + 0x80 * transparency) >> 8) + 1; - output_v[output_column] = ((input[2] * opacity + 0x80 * transparency) >> 8) + 1; -} - -static inline void transfer_YUVA8888_to_YUV422(unsigned char *(*output), - unsigned char *input, - int j) -{ - int opacity = input[3]; - int transparency = 0xff - opacity; -// Store U and V for even pixels only - if(!(j & 1)) - { - (*output)[0] = ((input[0] * opacity) >> 8) + 1; - (*output)[1] = ((input[1] * opacity + 0x80 * transparency) >> 8) + 1; - (*output)[3] = ((input[2] * opacity + 0x80 * transparency) >> 8) + 1; - } - else -// Store Y and advance output for odd pixels only - { - (*output)[2] = ((input[0] * opacity) >> 8) + 1; - (*output) += 4; - } -} - - - - - - - - - - -// ******************************** YUV161616 -> ****************************** - - -static inline void transfer_YUV161616_to_RGB8(unsigned char *(*output), uint16_t *input) -{ - int y, u, v; - int r, g, b; - - y = (((int)input[0]) << 8) | (input[0] >> 8); - u = input[1] >> 8; - v = input[2] >> 8; - YUV_TO_RGB(y, u, v, r, g, b); - - *(*output) = (unsigned char)((r & 0xc0) + - ((g & 0xe0) >> 2) + - ((b & 0xe0) >> 5)); - (*output)++; -} - -static inline void transfer_YUV161616_to_BGR565(unsigned char *(*output), uint16_t *input) -{ - int y, u, v; - int r, g, b; - - y = (((int)input[0]) << 8) | (input[0] >> 8); - u = input[1] >> 8; - v = input[2] >> 8; - YUV_TO_RGB(y, u, v, r, g, b); - *(uint16_t*)(*output) = ((b & 0xf8) << 8) - + ((g & 0xfc) << 3) - + ((r & 0xf8) >> 3); - (*output) += 2; -} - -static inline void transfer_YUV161616_to_RGB565(unsigned char *(*output), uint16_t *input) -{ - int y, u, v; - int r, g, b; - - y = (((int)input[0]) << 8) | (input[0] >> 8); - u = input[1] >> 8; - v = input[2] >> 8; - YUV_TO_RGB(y, u, v, r, g, b); - *(uint16_t*)(*output) = ((r & 0xf8) << 8) - + ((g & 0xfc) << 3) - + ((b & 0xf8) >> 3); - (*output) += 2; -} - -static inline void transfer_YUV161616_to_BGR888(unsigned char *(*output), uint16_t *input) -{ - int y, u, v; - int r, g, b; - - y = (((int)input[0]) << 8) | (input[0] >> 8); - u = input[1]; - v = input[2]; - YUV_TO_RGB16(y, u, v, r, g, b); - - *(*output)++ = b >> 8; - *(*output)++ = g >> 8; - *(*output)++ = r >> 8; -} - -static inline void transfer_YUV161616_to_RGB888(unsigned char *(*output), uint16_t *input) -{ - int y, u, v; - int r, g, b; - - y = (((int)input[0]) << 8) | (input[0] >> 8); - u = input[1]; - v = input[2]; - YUV_TO_RGB16(y, u, v, r, g, b); - - *(*output)++ = r >> 8; - *(*output)++ = g >> 8; - *(*output)++ = b >> 8; -} - -static inline void transfer_YUV161616_to_RGBA8888(unsigned char *(*output), uint16_t *input) -{ - int y, u, v; - int r, g, b; - - y = (((int)input[0]) << 8) | (input[0] >> 8); - u = input[1]; - v = input[2]; - YUV_TO_RGB16(y, u, v, r, g, b); - - *(*output)++ = r >> 8; - *(*output)++ = g >> 8; - *(*output)++ = b >> 8; - *(*output)++ = 0xff; -} - -static inline void transfer_YUV161616_to_ARGB8888(unsigned char *(*output), uint16_t *input) -{ - int y, u, v; - int r, g, b; - - y = (((int)input[0]) << 8) | (input[0] >> 8); - u = input[1]; - v = input[2]; - YUV_TO_RGB16(y, u, v, r, g, b); - - *(*output)++ = 0xff; - *(*output)++ = r >> 8; - *(*output)++ = g >> 8; - *(*output)++ = b >> 8; -} - -static inline void transfer_YUV161616_to_RGB_FLOAT(float *(*output), uint16_t *input) -{ - float y = (float)input[0] / 0xffff; - int u, v; - float r, g, b; - - u = input[1]; - v = input[2]; - YUV16_TO_RGB_FLOAT(y, u, v, r, g, b); - - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; -} - -static inline void transfer_YUV161616_to_RGBA_FLOAT(float *(*output), uint16_t *input) -{ - float y = (float)input[0] / 0xffff; - int u, v; - float r, g, b; - - u = input[1]; - v = input[2]; - YUV16_TO_RGB_FLOAT(y, u, v, r, g, b); - - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; - *(*output)++ = 1.0; -} - -static inline void transfer_YUV161616_to_BGR8888(unsigned char *(*output), uint16_t *input) -{ - int y, u, v; - int r, g, b; - - y = (((int)input[0]) << 8) | (input[0] >> 8); - u = input[1] >> 8; - v = input[2] >> 8; - YUV_TO_RGB(y, u, v, r, g, b); - *(*output)++ = b; - *(*output)++ = g; - *(*output)++ = r; - (*output)++; -} - -static inline void transfer_YUV161616_to_YUV161616(uint16_t *(*output), uint16_t *input) -{ - (*output)[0] = input[0]; - (*output)[1] = input[1]; - (*output)[2] = input[2]; - (*output) += 3; -} - -static inline void transfer_YUV161616_to_YUVA8888(unsigned char *(*output), uint16_t *input) -{ - (*output)[0] = input[0] >> 8; - (*output)[1] = input[1] >> 8; - (*output)[2] = input[2] >> 8; - (*output)[3] = 255; - (*output) += 4; -} - - -static inline void transfer_YUV161616_to_VYU888(unsigned char *(*output), uint16_t *input) -{ - (*output)[0] = input[2] >> 8; - (*output)[1] = input[0] >> 8; - (*output)[2] = input[1] >> 8; - (*output) += 3; -} - - -static inline void transfer_YUV161616_to_UYVA8888(unsigned char *(*output), uint16_t *input) -{ - (*output)[0] = input[1] >> 8; - (*output)[1] = input[0] >> 8; - (*output)[2] = input[2] >> 8; - (*output)[3] = input[3] >> 8; - (*output) += 4; -} - -static inline void transfer_YUV161616_to_YUV101010(unsigned char *(*output), uint16_t *input) -{ - uint16_t y_i = input[0]; - uint16_t u_i = input[1]; - uint16_t v_i = input[2]; - WRITE_YUV101010(y_i, u_i, v_i); -} - -static inline void transfer_YUV161616_to_YUV420P_YUV422P(unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - uint16_t *input, - int output_column) -{ - output_y[output_column] = input[0] >> 8; - output_u[output_column / 2] = input[1] >> 8; - output_v[output_column / 2] = input[2] >> 8; -} - -static inline void transfer_YUV161616_to_YUV444P(unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - uint16_t *input, - int output_column) -{ - output_y[output_column] = input[0] >> 8; - output_u[output_column] = input[1] >> 8; - output_v[output_column] = input[2] >> 8; -} - -static inline void transfer_YUV161616_to_YUV422(unsigned char *(*output), - uint16_t *input, - int j) -{ -// Store U and V for even pixels only - if(!(j & 1)) - { - (*output)[1] = input[1] >> 8; - (*output)[3] = input[2] >> 8; - (*output)[0] = input[0] >> 8; - } - else -// Store Y and advance output for odd pixels only - { - (*output)[2] = input[0] >> 8; - (*output) += 4; - } -} - - - - - - - - - - - -// ******************************** YUVA16161616 -> *************************** - - - - -static inline void transfer_YUVA16161616_to_RGB8(unsigned char *(*output), uint16_t *input) -{ - int y, u, v, a; - int r, g, b; - - a = input[3]; - y = (((int)input[0]) << 8) | (input[0] >> 8); - u = input[1] >> 8; - v = input[2] >> 8; - YUV_TO_RGB(y, u, v, r, g, b); - - r *= a; - g *= a; - b *= a; - - *(*output) = (unsigned char)(((r & 0xc000) >> 8) + - ((g & 0xe000) >> 10) + - ((b & 0xe000) >> 13)); - (*output)++; -} - -static inline void transfer_YUVA16161616_to_BGR565(unsigned char *(*output), uint16_t *input) -{ - int y, u, v, a; - int r, g, b; - - a = input[3] >> 8; - y = (((int)input[0]) << 8) | (input[0] >> 8); - u = input[1] >> 8; - v = input[2] >> 8; - YUV_TO_RGB(y, u, v, r, g, b); - - r *= a; - g *= a; - b *= a; - - *(uint16_t*)(*output) = (uint16_t)((b & 0xf800) + - ((g & 0xfc00) >> 5) + - ((r & 0xf800) >> 11)); - (*output) += 2; -} - -static inline void transfer_YUVA16161616_to_RGB565(unsigned char *(*output), uint16_t *input) -{ - int y, u, v, a; - int r, g, b; - - a = input[3] >> 8; - y = (((int)input[0]) << 8) | (input[0] >> 8); - u = input[1] >> 8; - v = input[2] >> 8; - YUV_TO_RGB(y, u, v, r, g, b); - - r *= a; - g *= a; - b *= a; - - *(uint16_t*)(*output) = (uint16_t)((r & 0xf800) + - ((g & 0xfc00) >> 5) + - ((b & 0xf800) >> 11)); - (*output) += 2; -} - -static inline void transfer_YUVA16161616_to_BGR888(unsigned char *(*output), uint16_t *input) -{ - int y, u, v, a; - int r, g, b; - - a = input[3]; - y = (((int)input[0]) << 8) | (input[0] >> 8); - u = input[1]; - v = input[2]; - - YUV_TO_RGB16(y, u, v, r, g, b); - - r *= a; - g *= a; - b *= a; - - *(*output)++ = b / 0xffff00; - *(*output)++ = g / 0xffff00; - *(*output)++ = r / 0xffff00; -} - -static inline void transfer_YUVA16161616_to_RGB888(unsigned char *(*output), uint16_t *input) -{ - unsigned int y, u, v, a; - unsigned int r, g, b; - - a = input[3]; - y = (((int)input[0]) << 8) | (input[0] >> 8); - u = input[1]; - v = input[2]; - - YUV_TO_RGB16(y, u, v, r, g, b); - - r *= a; - g *= a; - b *= a; - r /= 0xffff00; - g /= 0xffff00; - b /= 0xffff00; - - CLAMP(r, 0, 0xff); - CLAMP(g, 0, 0xff); - CLAMP(b, 0, 0xff); - - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; -} - -static inline void transfer_YUVA16161616_to_RGBA8888(unsigned char *(*output), uint16_t *input) -{ - unsigned int y, u, v; - unsigned int r, g, b; - - y = (((int)input[0]) << 8) | (input[0] >> 8); - u = input[1]; - v = input[2]; - - YUV_TO_RGB16(y, u, v, r, g, b); - - *(*output)++ = (r >> 8); - *(*output)++ = (g >> 8); - *(*output)++ = (b >> 8); - *(*output)++ = input[3] >> 8; -} - -static inline void transfer_YUVA16161616_to_ARGB8888(unsigned char *(*output), uint16_t *input) -{ - unsigned int y, u, v; - unsigned int r, g, b; - - y = (((int)input[0]) << 8) | (input[0] >> 8); - u = input[1]; - v = input[2]; - - YUV_TO_RGB16(y, u, v, r, g, b); - - *(*output)++ = input[3] >> 8; - *(*output)++ = (r >> 8); - *(*output)++ = (g >> 8); - *(*output)++ = (b >> 8); -} - -static inline void transfer_YUVA16161616_to_RGB_FLOAT(float *(*output), - uint16_t *input) -{ - float y; - int u, v; - float r, g, b, a; - - y = (float)input[0] / 0xffff; - u = input[1]; - v = input[2]; - a = (float)input[3] / 0xffff; - - YUV16_TO_RGB_FLOAT(y, u, v, r, g, b); - - r *= a; - g *= a; - b *= a; - - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; -} - -static inline void transfer_YUVA16161616_to_RGBA_FLOAT(float *(*output), - uint16_t *input) -{ - float y; - int u, v; - float r, g, b, a; - - y = (float)input[0] / 0xffff; - u = input[1]; - v = input[2]; - a = (float)input[3] / 0xffff; - - YUV16_TO_RGB_FLOAT(y, u, v, r, g, b); - - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; - *(*output)++ = a; -} - -static inline void transfer_YUVA16161616_to_BGR8888(unsigned char *(*output), - uint16_t *input) -{ - int y, u, v, a; - int64_t r, g, b; - - a = input[3]; - y = (((int)input[0]) << 8) | (input[0] >> 8); - u = input[1] >> 8; - v = input[2] >> 8; - - YUV_TO_RGB(y, u, v, r, g, b); - - r *= a; - g *= a; - b *= a; - b /= 0xffff; - g /= 0xffff; - r /= 0xffff; - - *(*output)++ = b; - *(*output)++ = g; - *(*output)++ = r; - (*output)++; -} - - -static inline void transfer_YUVA16161616_to_VYU888(unsigned char *(*output), uint16_t *input) -{ - int y, u, v, a, anti_a; - a = input[3]; - anti_a = 0xffff - a; - y = ((uint32_t)input[0] * a) / 0xffff00; - u = ((uint32_t)input[1] * a + 0x8000 * anti_a) / 0xffff00; - v = ((uint32_t)input[2] * a + 0x8000 * anti_a) / 0xffff00; - - *(*output)++ = v; - *(*output)++ = y; - *(*output)++ = u; -} - - -static inline void transfer_YUVA16161616_to_YUVA16161616(uint16_t *(*output), uint16_t *input) -{ - (*output)[0] = input[0]; - (*output)[1] = input[1]; - (*output)[2] = input[2]; - (*output)[3] = input[3]; - (*output) += 4; -} - -static inline void transfer_YUVA16161616_to_UYVA8888(unsigned char *(*output), uint16_t *input) -{ - (*output)[0] = input[1] >> 8; - (*output)[1] = input[0] >> 8; - (*output)[2] = input[2] >> 8; - (*output)[3] = input[3] >> 8; - (*output) += 4; -} - - -static inline void transfer_YUVA16161616_to_YUV101010(unsigned char *(*output), uint16_t *input) -{ - int64_t opacity = input[3]; - int64_t transparency = 0xffff - opacity; - uint16_t y_i = ((int64_t)input[0] * opacity + (int64_t)0x8000 * transparency) / 0xffff; - uint16_t u_i = ((int64_t)input[1] * opacity + (int64_t)0x8000 * transparency) / 0xffff; - uint16_t v_i = ((int64_t)input[2] * opacity + (int64_t)0x8000 * transparency) / 0xffff; - WRITE_YUV101010(y_i, u_i, v_i); -} - -static inline void transfer_YUVA16161616_to_YUV420P_YUV422P(unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - uint16_t *input, - int output_column) -{ - int64_t opacity = input[3]; - int64_t transparency = 0xffff - opacity; - - output_y[output_column] = ((int64_t)input[0] * opacity) / 0xffff00; - output_u[output_column / 2] = ((int64_t)input[1] * opacity + 0x8000 * transparency) / 0xffff00; - output_v[output_column / 2] = ((int64_t)input[2] * opacity + 0x8000 * transparency) / 0xffff00; -} - -static inline void transfer_YUVA16161616_to_YUV444P(unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - uint16_t *input, - int output_column) -{ - int64_t opacity = input[3]; - int64_t transparency = 0xffff - opacity; - - output_y[output_column] = ((int64_t)input[0] * opacity) / 0xffff00; - output_u[output_column] = ((int64_t)input[1] * opacity + 0x8000 * transparency) / 0xffff00; - output_v[output_column] = ((int64_t)input[2] * opacity + 0x8000 * transparency) / 0xffff00; -} - -static inline void transfer_YUVA16161616_to_YUV422(unsigned char *(*output), - uint16_t *input, - int j) -{ - int64_t opacity = input[3]; - int64_t transparency = 0xffff - opacity; - -// Store U and V for even pixels only - if(!(j & 1)) - { - (*output)[0] = ((int64_t)input[0] * opacity) / 0xffff00; - (*output)[1] = ((int64_t)input[1] * opacity + 0x8000 * transparency) / 0xffff00; - (*output)[3] = ((int64_t)input[2] * opacity + 0x8000 * transparency) / 0xffff00; - } - else -// Store Y and advance output for odd pixels only - { - (*output)[2] = (input[0] * opacity) / 0xffff00; - (*output) += 4; - } -} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -#define ZTYP(ty) typedef ty z_##ty __attribute__ ((__unused__)) -ZTYP(int); - - -// ******************************** Loops ************************************* - -#define TRANSFER_FRAME_HEAD \ - for(i = 0; i < out_h; i++) \ - { \ - unsigned char *output_row = output_rows[i + out_y] + out_x * out_pixelsize; \ - unsigned char *input_row = input_rows[row_table[i]]; \ - z_int bit_counter = 7; \ - for(j = 0; j < out_w; j++) \ - { - -#define TRANSFER_FRAME_TAIL \ - } \ - } - -#define TRANSFER_YUV420P_OUT_HEAD \ - for(i = 0; i < out_h; i++) \ - { \ - unsigned char *input_row = input_rows[row_table[i]]; \ - unsigned char *output_y = out_y_plane + i * total_out_w + out_x; \ - unsigned char *output_u = out_u_plane + i / 2 * total_out_w / 2 + out_x / 2; \ - unsigned char *output_v = out_v_plane + i / 2 * total_out_w / 2 + out_x / 2; \ - for(j = 0; j < out_w; j++) \ - { - -#define TRANSFER_YUV422P_OUT_HEAD \ - for(i = 0; i < out_h; i++) \ - { \ - unsigned char *input_row = input_rows[row_table[i]]; \ - unsigned char *output_y = out_y_plane + i * total_out_w + out_x; \ - unsigned char *output_u = out_u_plane + i * total_out_w / 2 + out_x / 2; \ - unsigned char *output_v = out_v_plane + i * total_out_w / 2 + out_x / 2; \ - for(j = 0; j < out_w; j++) \ - { - -#define TRANSFER_YUV444P_OUT_HEAD \ - for(i = 0; i < out_h; i++) \ - { \ - unsigned char *input_row = input_rows[row_table[i]]; \ - unsigned char *output_y = out_y_plane + i * total_out_w + out_x; \ - unsigned char *output_u = out_u_plane + i * total_out_w + out_x; \ - unsigned char *output_v = out_v_plane + i * total_out_w + out_x; \ - for(j = 0; j < out_w; j++) \ - { - -#define TRANSFER_YUV420P_IN_HEAD \ - for(i = 0; i < out_h; i++) \ - { \ - unsigned char *output_row = output_rows[i + out_y] + out_x * out_pixelsize; \ - unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \ - unsigned char *input_u = in_u_plane + (row_table[i] / 2) * (total_in_w / 2); \ - unsigned char *input_v = in_v_plane + (row_table[i] / 2) * (total_in_w / 2); \ - for(j = 0; j < out_w; j++) \ - { - -#define TRANSFER_YUV9P_IN_HEAD \ - for(i = 0; i < out_h; i++) \ - { \ - unsigned char *output_row = output_rows[i + out_y] + out_x * out_pixelsize; \ - unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \ - unsigned char *input_u = in_u_plane + (row_table[i] / 4) * (total_in_w / 4); \ - unsigned char *input_v = in_v_plane + (row_table[i] / 4) * (total_in_w / 4); \ - for(j = 0; j < out_w; j++) \ - { - - -#define TRANSFER_YUV422P_IN_HEAD \ - for(i = 0; i < out_h; i++) \ - { \ - unsigned char *output_row = output_rows[i + out_y] + out_x * out_pixelsize; \ - unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \ - unsigned char *input_u = in_u_plane + row_table[i] * (total_in_w / 2); \ - unsigned char *input_v = in_v_plane + row_table[i] * (total_in_w / 2); \ - for(j = 0; j < out_w; j++) \ - { - -#define TRANSFER_YUV444P_IN_HEAD \ - for(i = 0; i < out_h; i++) \ - { \ - unsigned char *output_row = output_rows[i + out_y] + out_x * out_pixelsize; \ - unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \ - unsigned char *input_u = in_u_plane + row_table[i] * total_in_w; \ - unsigned char *input_v = in_v_plane + row_table[i] * total_in_w; \ - for(j = 0; j < out_w; j++) \ - { - - -#define TRANSFER_YUV422_IN_HEAD \ - for(i = 0; i < out_h; i++) \ - { \ - unsigned char *output_row = output_rows[i + out_y] + ((out_x * out_pixelsize) & 0xfffffffc); \ - unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \ - unsigned char *input_u = in_u_plane + row_table[i] * (total_in_w / 2); \ - unsigned char *input_v = in_v_plane + row_table[i] * (total_in_w / 2); \ - for(j = 0; j < out_w; j++) \ - { - - - - - -// ******************************** Permutation ******************************* - - - -#define PERMUTATION_ARGS \ - unsigned char **output_rows, \ - unsigned char **input_rows, \ - unsigned char *out_y_plane, \ - unsigned char *out_u_plane, \ - unsigned char *out_v_plane, \ - unsigned char *in_y_plane, \ - unsigned char *in_u_plane, \ - unsigned char *in_v_plane, \ - int in_x, \ - int in_y, \ - int in_w, \ - int in_h, \ - int out_x, \ - int out_y, \ - int out_w, \ - int out_h, \ - int in_colormodel, \ - int out_colormodel, \ - int bg_color, \ - int total_in_w, \ - int total_out_w, \ - int scale, \ - int out_pixelsize, \ - int in_pixelsize, \ - int *row_table, \ - int *column_table, \ - int bg_r, \ - int bg_g, \ - int bg_b - -void cmodel_float(PERMUTATION_ARGS); -void cmodel_yuv420p(PERMUTATION_ARGS); -void cmodel_yuv9p(PERMUTATION_ARGS); -void cmodel_yuv444p(PERMUTATION_ARGS); -void cmodel_yuv422(PERMUTATION_ARGS); -void cmodel_default(PERMUTATION_ARGS); - diff --git a/cinelerra-5.0/quicktime/cmodel_yuv420p.c b/cinelerra-5.0/quicktime/cmodel_yuv420p.c deleted file mode 100644 index fe6a494d..00000000 --- a/cinelerra-5.0/quicktime/cmodel_yuv420p.c +++ /dev/null @@ -1,1345 +0,0 @@ -/* - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - - - -#include "cmodel_permutation.h" - - - - -static inline void transfer_YUV_PLANAR_to_RGB8(unsigned char *(*output), - unsigned char *input_y, - unsigned char *input_u, - unsigned char *input_v) -{ - int y, u, v, r, g, b; - - y = (*input_y << 16) | (*input_y << 8) | *input_y; - u = *input_u; - v = *input_v; - YUV_TO_RGB(y, u, v, r, g, b) - - *(*output) = (unsigned char)((r & 0xc0) + - ((g & 0xe0) >> 2) + - ((b & 0xe0) >> 5)); - (*output)++; -} - -static inline void transfer_YUV_PLANAR_to_BGR565(unsigned char *(*output), - unsigned char *input_y, - unsigned char *input_u, - unsigned char *input_v) -{ - int y, u, v; - int r, g, b; - - y = (*input_y << 16) | (*input_y << 8) | *input_y; - u = *input_u; - v = *input_v; - YUV_TO_RGB(y, u, v, r, g, b) - - *(uint16_t*)(*output) = ((b & 0xf8) << 8) - + ((g & 0xfc) << 3) - + ((r & 0xf8) >> 3); - (*output) += 2; -} - -static inline void transfer_YUV_PLANAR_to_RGB565(unsigned char *(*output), - unsigned char *input_y, - unsigned char *input_u, - unsigned char *input_v) -{ - int y, u, v; - int r, g, b; - - y = (*input_y << 16) | (*input_y << 8) | *input_y; - u = *input_u; - v = *input_v; - YUV_TO_RGB(y, u, v, r, g, b) - - *(uint16_t*)(*output) = ((r & 0xf8) << 8) - + ((g & 0xfc) << 3) - + ((b & 0xf8) >> 3); - (*output) += 2; -} - -static inline void transfer_YUV_PLANAR_to_BGR888(unsigned char *(*output), - unsigned char *input_y, - unsigned char *input_u, - unsigned char *input_v) -{ - int y, u, v; - int r, g, b; - - y = (*input_y << 16) | (*input_y << 8) | *input_y; - u = *input_u; - v = *input_v; - YUV_TO_RGB(y, u, v, r, g, b) - - (*output)[0] = b; - (*output)[1] = g; - (*output)[2] = r; - (*output) += 3; -} - -static inline void transfer_YUV_PLANAR_to_BGR8888(unsigned char *(*output), - unsigned char *input_y, - unsigned char *input_u, - unsigned char *input_v) -{ - int y, u, v; - int r, g, b; - - y = (*input_y << 16) | (*input_y << 8) | *input_y; - u = *input_u; - v = *input_v; - YUV_TO_RGB(y, u, v, r, g, b) - - (*output)[0] = b; - (*output)[1] = g; - (*output)[2] = r; - (*output) += 4; -} - -static inline void transfer_YUV_PLANAR_to_RGB888(unsigned char *(*output), - unsigned char *input_y, - unsigned char *input_u, - unsigned char *input_v) -{ -// Signedness is important - int y, u, v, r, g, b; - - y = (*input_y << 16) | (*input_y << 8) | *input_y; - u = *input_u; - v = *input_v; - YUV_TO_RGB(y, u, v, r, g, b) - - (*output)[0] = r; - (*output)[1] = g; - (*output)[2] = b; - (*output) += 3; -} - -static inline void transfer_YUV_PLANAR_to_ARGB8888(unsigned char *(*output), - unsigned char *input_y, - unsigned char *input_u, - unsigned char *input_v) -{ -// Signedness is important - int y, u, v, r, g, b; - - y = (*input_y << 16) | (*input_y << 8) | *input_y; - u = *input_u; - v = *input_v; - YUV_TO_RGB(y, u, v, r, g, b) - - (*output)[0] = 0xff; - (*output)[1] = r; - (*output)[2] = g; - (*output)[3] = b; - (*output) += 4; -} - -static inline void transfer_YUV_PLANAR_to_ABGR8888(unsigned char *(*output), - unsigned char *input_y, - unsigned char *input_u, - unsigned char *input_v) -{ -// Signedness is important - int y, u, v, r, g, b; - - y = (*input_y << 16) | (*input_y << 8) | *input_y; - u = *input_u; - v = *input_v; - YUV_TO_RGB(y, u, v, r, g, b) - - (*output)[0] = 0xff; - (*output)[3] = r; - (*output)[2] = g; - (*output)[1] = b; - (*output) += 4; -} - -static inline void transfer_YUV_PLANAR_to_RGBA8888(unsigned char *(*output), - unsigned char *input_y, - unsigned char *input_u, - unsigned char *input_v) -{ -// Signedness is important - int y, u, v; - int r, g, b; - - y = (*input_y << 16) | (*input_y << 8) | *input_y; - u = *input_u; - v = *input_v; - YUV_TO_RGB(y, u, v, r, g, b) - - (*output)[0] = r; - (*output)[1] = g; - (*output)[2] = b; - (*output)[3] = 0xff; - (*output) += 4; -} - -static inline void transfer_YUV_PLANAR_to_RGB161616(uint16_t *(*output), - unsigned char *input_y, - unsigned char *input_u, - unsigned char *input_v) -{ -// Signedness is important - int y, u, v; - int r, g, b; - y = (*input_y << 16) | (*input_y << 8) | *input_y; - u = (*input_u << 8) | *input_u; - v = (*input_v << 8) | *input_v; - YUV_TO_RGB16(y, u, v, r, g, b) - (*output)[0] = r; - (*output)[1] = g; - (*output)[2] = b; - - (*output) += 3; -} - - -static inline void transfer_YUV_PLANAR_to_RGBA16161616(uint16_t *(*output), - unsigned char *input_y, - unsigned char *input_u, - unsigned char *input_v) -{ -// Signedness is important - int y, u, v; - int r, g, b; - y = (*input_y << 16) | (*input_y << 8) | *input_y; - u = (*input_u << 8) | *input_u; - v = (*input_v << 8) | *input_v; - YUV_TO_RGB16(y, u, v, r, g, b) - - (*output)[0] = r; - (*output)[1] = g; - (*output)[2] = b; - (*output)[3] = 0xffff; - - (*output) += 4; -} - - -static inline void transfer_YUV_PLANAR_to_RGB_FLOAT(float* *output, - unsigned char *input_y, - unsigned char *input_u, - unsigned char *input_v) -{ -// Signedness is important - float y = (float)*input_y / 0xff; - int u, v; - float r, g, b; - u = *input_u; - v = *input_v; - YUV_TO_FLOAT(y, u, v, r, g, b) -// optimization error here - - (*output)[0] = r; - (*output)[1] = g; - (*output)[2] = b; - (*output) += 3; -} - - -static inline void transfer_YUV_PLANAR_to_RGBA_FLOAT(float* *output, - unsigned char *input_y, - unsigned char *input_u, - unsigned char *input_v) -{ -// Signedness is important - float y = (float)*input_y / 0xff; - int u, v; - float r, g, b; - u = *input_u; - v = *input_v; - YUV_TO_FLOAT(y, u, v, r, g, b) - -// optimization error here - (*output)[0] = r; - (*output)[1] = g; - (*output)[2] = b; - (*output)[3] = 1.0; - (*output) += 4; -} - - - -static inline void transfer_YUV_PLANAR_to_YUV888(unsigned char *(*output), - unsigned char *input_y, - unsigned char *input_u, - unsigned char *input_v) -{ - (*output)[0] = *input_y; - (*output)[1] = *input_u; - (*output)[2] = *input_v; - (*output) += 3; -} - -static inline void transfer_YUV_PLANAR_to_YUV161616(uint16_t *(*output), - unsigned char *input_y, - unsigned char *input_u, - unsigned char *input_v) -{ - (*output)[0] = (*input_y << 8) | *input_y; - (*output)[1] = (*input_u << 8) | *input_u; - (*output)[2] = (*input_v << 8) | *input_v; - (*output) += 3; -} - -static inline void transfer_YUV_PLANAR_to_YUVA8888(unsigned char *(*output), - unsigned char *input_y, - unsigned char *input_u, - unsigned char *input_v) -{ - (*output)[0] = *input_y; - (*output)[1] = *input_u; - (*output)[2] = *input_v; - (*output)[3] = 0xff; - (*output) += 4; -} - -static inline void transfer_YUV_PLANAR_to_YUVA16161616(uint16_t *(*output), - unsigned char *input_y, - unsigned char *input_u, - unsigned char *input_v) -{ - (*output)[0] = (((uint16_t)*input_y) << 8) | *input_y; - (*output)[1] = (((uint16_t)*input_u) << 8) | *input_u; - (*output)[2] = (((uint16_t)*input_v) << 8) | *input_v; - - (*output)[3] = 0xffff; - (*output) += 4; -} - -static inline void transfer_YUV_PLANAR_to_YUV420P(unsigned char *input_y, - unsigned char *input_u, - unsigned char *input_v, - unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - int j) -{ - output_y[j] = *input_y; - output_u[j / 2] = *input_u; - output_v[j / 2] = *input_v; -} - -static inline void transfer_YUV_PLANAR_to_YUV444P(unsigned char *input_y, - unsigned char *input_u, - unsigned char *input_v, - unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - int j) -{ - output_y[j] = *input_y; - output_u[j] = *input_u; - output_v[j] = *input_v; -} - -static inline void transfer_YUV_PLANAR_to_YUV422(unsigned char *(*output), - unsigned char *input_y, - unsigned char *input_u, - unsigned char *input_v, - int j) -{ -// Store U and V for even pixels only - if(!(j & 1)) - { - (*output)[1] = *input_u; - (*output)[3] = *input_v; - (*output)[0] = *input_y; - } - else -// Store Y and advance output for odd pixels only - { - (*output)[2] = *input_y; - (*output) += 4; - } -} - - - - - - - - - - - - - - - -// ******************************** YUV444P -> ******************************** - -static inline void transfer_YUV444P_to_YUV444P(unsigned char *input_y, - unsigned char *input_u, - unsigned char *input_v, - unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - int j) -{ - output_y[j] = *input_y; - output_u[j] = *input_u; - output_v[j] = *input_v; -} - - - - -#define TRANSFER_FRAME_DEFAULT(output, \ - input, \ - y_in_offset, \ - u_in_offset, \ - v_in_offset, \ - input_column) \ -{ \ - register int i, j; \ - \ - switch(in_colormodel) \ - { \ - case BC_YUV420P: \ - switch(out_colormodel) \ - { \ - case BC_RGB8: \ - TRANSFER_YUV420P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGB8((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR565: \ - TRANSFER_YUV420P_IN_HEAD \ - transfer_YUV_PLANAR_to_BGR565((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB565: \ - TRANSFER_YUV420P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGB565((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR888: \ - TRANSFER_YUV420P_IN_HEAD \ - transfer_YUV_PLANAR_to_BGR888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR8888: \ - TRANSFER_YUV420P_IN_HEAD \ - transfer_YUV_PLANAR_to_BGR8888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV420P: \ - for(i = 0; i < out_h; i++) \ - { \ - unsigned char *output_y = out_y_plane + i * total_out_w; \ - unsigned char *output_u = out_u_plane + i / 2 * total_out_w / 2; \ - unsigned char *output_v = out_v_plane + i / 2 * total_out_w / 2; \ - unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \ - unsigned char *input_u = in_u_plane + row_table[i] / 2 * total_in_w / 2; \ - unsigned char *input_v = in_v_plane + row_table[i] / 2 * total_in_w / 2; \ - for(j = 0; j < out_w; j++) \ - { \ - transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset), \ - output_y, \ - output_u, \ - output_v, \ - j); \ - } \ - } \ - break; \ - case BC_YUV422: \ - TRANSFER_YUV420P_IN_HEAD \ - transfer_YUV_PLANAR_to_YUV422((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV422P: \ - for(i = 0; i < out_h; i++) \ - { \ - unsigned char *output_y = out_y_plane + i * total_out_w; \ - unsigned char *output_u = out_u_plane + i * total_out_w / 2; \ - unsigned char *output_v = out_v_plane + i * total_out_w / 2; \ - unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \ - unsigned char *input_u = in_u_plane + row_table[i] / 2 * total_in_w / 2; \ - unsigned char *input_v = in_v_plane + row_table[i] / 2 * total_in_w / 2; \ - for(j = 0; j < out_w; j++) \ - { \ - transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset), \ - output_y, \ - output_u, \ - output_v, \ - j); \ - } \ - } \ - break; \ - case BC_YUV444P: \ - for(i = 0; i < out_h; i++) \ - { \ - unsigned char *output_y = out_y_plane + i * total_out_w; \ - unsigned char *output_u = out_u_plane + i * total_out_w; \ - unsigned char *output_v = out_v_plane + i * total_out_w; \ - unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \ - unsigned char *input_u = in_u_plane + row_table[i] / 2 * total_in_w / 2; \ - unsigned char *input_v = in_v_plane + row_table[i] / 2 * total_in_w / 2; \ - for(j = 0; j < out_w; j++) \ - { \ - transfer_YUV_PLANAR_to_YUV444P(input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset), \ - output_y, \ - output_u, \ - output_v, \ - j); \ - } \ - } \ - break; \ - case BC_RGB888: \ - TRANSFER_YUV420P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGB888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_ARGB8888: \ - TRANSFER_YUV420P_IN_HEAD \ - transfer_YUV_PLANAR_to_ARGB8888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_ABGR8888: \ - TRANSFER_YUV420P_IN_HEAD \ - transfer_YUV_PLANAR_to_ABGR8888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA8888: \ - TRANSFER_YUV420P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGBA8888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB161616: \ - TRANSFER_YUV420P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGB161616((uint16_t**)(output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA16161616: \ - TRANSFER_YUV420P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGBA16161616((uint16_t**)(output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB_FLOAT: \ - TRANSFER_YUV420P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGB_FLOAT((float**)(output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA_FLOAT: \ - TRANSFER_YUV420P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGBA_FLOAT((float**)(output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV888: \ - TRANSFER_YUV420P_IN_HEAD \ - transfer_YUV_PLANAR_to_YUV888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA8888: \ - TRANSFER_YUV420P_IN_HEAD \ - transfer_YUV_PLANAR_to_YUVA8888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV161616: \ - TRANSFER_YUV420P_IN_HEAD \ - transfer_YUV_PLANAR_to_YUV161616((uint16_t**)(output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA16161616: \ - TRANSFER_YUV420P_IN_HEAD \ - transfer_YUV_PLANAR_to_YUVA16161616((uint16_t**)(output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - } \ - break; \ - \ - case BC_YUV9P: \ - switch(out_colormodel) \ - { \ - case BC_RGB8: \ - TRANSFER_YUV9P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGB8((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR565: \ - TRANSFER_YUV9P_IN_HEAD \ - transfer_YUV_PLANAR_to_BGR565((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB565: \ - TRANSFER_YUV9P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGB565((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR888: \ - TRANSFER_YUV9P_IN_HEAD \ - transfer_YUV_PLANAR_to_BGR888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR8888: \ - TRANSFER_YUV9P_IN_HEAD \ - transfer_YUV_PLANAR_to_BGR8888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV420P: \ - for(i = 0; i < out_h; i++) \ - { \ - unsigned char *output_y = out_y_plane + i * total_out_w; \ - unsigned char *output_u = out_u_plane + i / 2 * total_out_w / 2; \ - unsigned char *output_v = out_v_plane + i / 2 * total_out_w / 2; \ - unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \ - unsigned char *input_u = in_u_plane + row_table[i] / 2 * total_in_w / 2; \ - unsigned char *input_v = in_v_plane + row_table[i] / 2 * total_in_w / 2; \ - for(j = 0; j < out_w; j++) \ - { \ - transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset), \ - output_y, \ - output_u, \ - output_v, \ - j); \ - } \ - } \ - break; \ - case BC_YUV422: \ - TRANSFER_YUV9P_IN_HEAD \ - transfer_YUV_PLANAR_to_YUV422((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV422P: \ - for(i = 0; i < out_h; i++) \ - { \ - unsigned char *output_y = out_y_plane + i * total_out_w; \ - unsigned char *output_u = out_u_plane + i * total_out_w / 2; \ - unsigned char *output_v = out_v_plane + i * total_out_w / 2; \ - unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \ - unsigned char *input_u = in_u_plane + row_table[i] / 2 * total_in_w / 2; \ - unsigned char *input_v = in_v_plane + row_table[i] / 2 * total_in_w / 2; \ - for(j = 0; j < out_w; j++) \ - { \ - transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset), \ - output_y, \ - output_u, \ - output_v, \ - j); \ - } \ - } \ - break; \ - case BC_YUV444P: \ - for(i = 0; i < out_h; i++) \ - { \ - unsigned char *output_y = out_y_plane + i * total_out_w; \ - unsigned char *output_u = out_u_plane + i * total_out_w; \ - unsigned char *output_v = out_v_plane + i * total_out_w; \ - unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \ - unsigned char *input_u = in_u_plane + row_table[i] / 2 * total_in_w / 2; \ - unsigned char *input_v = in_v_plane + row_table[i] / 2 * total_in_w / 2; \ - for(j = 0; j < out_w; j++) \ - { \ - transfer_YUV_PLANAR_to_YUV444P(input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset), \ - output_y, \ - output_u, \ - output_v, \ - j); \ - } \ - } \ - break; \ - case BC_RGB888: \ - TRANSFER_YUV9P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGB888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_ARGB8888: \ - TRANSFER_YUV9P_IN_HEAD \ - transfer_YUV_PLANAR_to_ARGB8888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_ABGR8888: \ - TRANSFER_YUV9P_IN_HEAD \ - transfer_YUV_PLANAR_to_ABGR8888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA8888: \ - TRANSFER_YUV9P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGBA8888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB161616: \ - TRANSFER_YUV9P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGB161616((uint16_t**)(output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA16161616: \ - TRANSFER_YUV9P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGBA16161616((uint16_t**)(output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB_FLOAT: \ - TRANSFER_YUV9P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGB_FLOAT((float**)(output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA_FLOAT: \ - TRANSFER_YUV9P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGBA_FLOAT((float**)(output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV888: \ - TRANSFER_YUV9P_IN_HEAD \ - transfer_YUV_PLANAR_to_YUV888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA8888: \ - TRANSFER_YUV9P_IN_HEAD \ - transfer_YUV_PLANAR_to_YUVA8888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV161616: \ - TRANSFER_YUV9P_IN_HEAD \ - transfer_YUV_PLANAR_to_YUV161616((uint16_t**)(output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA16161616: \ - TRANSFER_YUV9P_IN_HEAD \ - transfer_YUV_PLANAR_to_YUVA16161616((uint16_t**)(output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - } \ - break; \ - \ - case BC_YUV422P: \ - switch(out_colormodel) \ - { \ - case BC_RGB8: \ - TRANSFER_YUV422P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGB8((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR565: \ - TRANSFER_YUV422P_IN_HEAD \ - transfer_YUV_PLANAR_to_BGR565((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB565: \ - TRANSFER_YUV422P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGB565((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR888: \ - TRANSFER_YUV422P_IN_HEAD \ - transfer_YUV_PLANAR_to_BGR888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR8888: \ - TRANSFER_YUV422P_IN_HEAD \ - transfer_YUV_PLANAR_to_BGR8888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB888: \ - TRANSFER_YUV422P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGB888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_ARGB8888: \ - TRANSFER_YUV422P_IN_HEAD \ - transfer_YUV_PLANAR_to_ARGB8888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_ABGR8888: \ - TRANSFER_YUV422P_IN_HEAD \ - transfer_YUV_PLANAR_to_ABGR8888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA8888: \ - TRANSFER_YUV422P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGBA8888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB161616: \ - TRANSFER_YUV422P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGB161616((uint16_t**)(output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA16161616: \ - TRANSFER_YUV422P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGBA16161616((uint16_t**)(output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB_FLOAT: \ - TRANSFER_YUV422P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGB_FLOAT((float**)(output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA_FLOAT: \ - TRANSFER_YUV422P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGBA_FLOAT((float**)(output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV888: \ - TRANSFER_YUV422P_IN_HEAD \ - transfer_YUV_PLANAR_to_YUV888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA8888: \ - TRANSFER_YUV422P_IN_HEAD \ - transfer_YUV_PLANAR_to_YUVA8888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV161616: \ - TRANSFER_YUV422P_IN_HEAD \ - transfer_YUV_PLANAR_to_YUV161616((uint16_t**)(output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA16161616: \ - TRANSFER_YUV422P_IN_HEAD \ - transfer_YUV_PLANAR_to_YUVA16161616((uint16_t**)(output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV420P: \ - for(i = 0; i < out_h; i++) \ - { \ - unsigned char *output_y = out_y_plane + i * total_out_w; \ - unsigned char *output_u = out_u_plane + i / 2 * total_out_w / 2; \ - unsigned char *output_v = out_v_plane + i / 2 * total_out_w / 2; \ - unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \ - unsigned char *input_u = in_u_plane + row_table[i] * total_in_w / 2; \ - unsigned char *input_v = in_v_plane + row_table[i] * total_in_w / 2; \ - for(j = 0; j < out_w; j++) \ - { \ - transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset), \ - output_y, \ - output_u, \ - output_v, \ - j); \ - } \ - } \ - break; \ - case BC_YUV422: \ - TRANSFER_YUV422_IN_HEAD \ - transfer_YUV_PLANAR_to_YUV422((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV422P: \ - for(i = 0; i < out_h; i++) \ - { \ - unsigned char *output_y = out_y_plane + i * total_out_w; \ - unsigned char *output_u = out_u_plane + i * total_out_w / 2; \ - unsigned char *output_v = out_v_plane + i * total_out_w / 2; \ - unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \ - unsigned char *input_u = in_u_plane + row_table[i] * total_in_w / 2; \ - unsigned char *input_v = in_v_plane + row_table[i] * total_in_w / 2; \ - for(j = 0; j < out_w; j++) \ - { \ - transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset), \ - output_y, \ - output_u, \ - output_v, \ - j); \ - } \ - } \ - break; \ - case BC_YUV444P: \ - for(i = 0; i < out_h; i++) \ - { \ - unsigned char *output_y = out_y_plane + i * total_out_w; \ - unsigned char *output_u = out_u_plane + i * total_out_w; \ - unsigned char *output_v = out_v_plane + i * total_out_w; \ - unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \ - unsigned char *input_u = in_u_plane + row_table[i] * total_in_w / 2; \ - unsigned char *input_v = in_v_plane + row_table[i] * total_in_w / 2; \ - for(j = 0; j < out_w; j++) \ - { \ - transfer_YUV_PLANAR_to_YUV444P(input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset), \ - output_y, \ - output_u, \ - output_v, \ - j); \ - } \ - } \ - break; \ - } \ - break; \ - \ - \ - case BC_YUV444P: \ - switch(out_colormodel) \ - { \ - case BC_RGB8: \ - TRANSFER_YUV444P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGB8((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR565: \ - TRANSFER_YUV444P_IN_HEAD \ - transfer_YUV_PLANAR_to_BGR565((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB565: \ - TRANSFER_YUV444P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGB565((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR888: \ - TRANSFER_YUV444P_IN_HEAD \ - transfer_YUV_PLANAR_to_BGR888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR8888: \ - TRANSFER_YUV444P_IN_HEAD \ - transfer_YUV_PLANAR_to_BGR8888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB888: \ - TRANSFER_YUV444P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGB888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_ARGB8888: \ - TRANSFER_YUV444P_IN_HEAD \ - transfer_YUV_PLANAR_to_ARGB8888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_ABGR8888: \ - TRANSFER_YUV444P_IN_HEAD \ - transfer_YUV_PLANAR_to_ABGR8888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA8888: \ - TRANSFER_YUV444P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGBA8888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB161616: \ - TRANSFER_YUV444P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGB161616((uint16_t**)(output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA16161616: \ - TRANSFER_YUV444P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGBA16161616((uint16_t**)(output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB_FLOAT: \ - TRANSFER_YUV444P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGB_FLOAT((float**)(output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA_FLOAT: \ - TRANSFER_YUV444P_IN_HEAD \ - transfer_YUV_PLANAR_to_RGBA_FLOAT((float**)(output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV888: \ - TRANSFER_YUV444P_IN_HEAD \ - transfer_YUV_PLANAR_to_YUV888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA8888: \ - TRANSFER_YUV444P_IN_HEAD \ - transfer_YUV_PLANAR_to_YUVA8888((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV161616: \ - TRANSFER_YUV444P_IN_HEAD \ - transfer_YUV_PLANAR_to_YUV161616((uint16_t**)(output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA16161616: \ - TRANSFER_YUV444P_IN_HEAD \ - transfer_YUV_PLANAR_to_YUVA16161616((uint16_t**)(output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV420P: \ - for(i = 0; i < out_h; i++) \ - { \ - unsigned char *output_y = out_y_plane + i * total_out_w; \ - unsigned char *output_u = out_u_plane + i / 2 * total_out_w / 2; \ - unsigned char *output_v = out_v_plane + i / 2 * total_out_w / 2; \ - unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \ - unsigned char *input_u = in_u_plane + row_table[i] * total_in_w; \ - unsigned char *input_v = in_v_plane + row_table[i] * total_in_w; \ - for(j = 0; j < out_w; j++) \ - { \ - transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset), \ - output_y, \ - output_u, \ - output_v, \ - j); \ - } \ - } \ - break; \ - case BC_YUV422: \ - TRANSFER_YUV444P_IN_HEAD \ - transfer_YUV_PLANAR_to_YUV422((output), \ - input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV422P: \ - for(i = 0; i < out_h; i++) \ - { \ - unsigned char *output_y = out_y_plane + i * total_out_w; \ - unsigned char *output_u = out_u_plane + i * total_out_w / 2; \ - unsigned char *output_v = out_v_plane + i * total_out_w / 2; \ - unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \ - unsigned char *input_u = in_u_plane + row_table[i] * total_in_w; \ - unsigned char *input_v = in_v_plane + row_table[i] * total_in_w; \ - for(j = 0; j < out_w; j++) \ - { \ - transfer_YUV_PLANAR_to_YUV420P(input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset), \ - output_y, \ - output_u, \ - output_v, \ - j); \ - } \ - } \ - break; \ - case BC_YUV444P: \ - for(i = 0; i < out_h; i++) \ - { \ - unsigned char *output_y = out_y_plane + i * total_out_w; \ - unsigned char *output_u = out_u_plane + i * total_out_w; \ - unsigned char *output_v = out_v_plane + i * total_out_w; \ - unsigned char *input_y = in_y_plane + row_table[i] * total_in_w; \ - unsigned char *input_u = in_u_plane + row_table[i] * total_in_w; \ - unsigned char *input_v = in_v_plane + row_table[i] * total_in_w; \ - for(j = 0; j < out_w; j++) \ - { \ - transfer_YUV444P_to_YUV444P(input_y + (y_in_offset), \ - input_u + (u_in_offset), \ - input_v + (v_in_offset), \ - output_y, \ - output_u, \ - output_v, \ - j); \ - } \ - } \ - break; \ - } \ - break; \ - } \ -} - -void cmodel_yuv420p(PERMUTATION_ARGS) -{ - if(scale) - { - TRANSFER_FRAME_DEFAULT(&output_row, - input_row + column_table[j] * in_pixelsize, - column_table[j], - column_table[j] / 2, - column_table[j] / 2, - 0); - } - else - { - TRANSFER_FRAME_DEFAULT(&output_row, - input_row + j * in_pixelsize, - j, - j / 2, - j / 2, - 0); - } -} - -void cmodel_yuv9p(PERMUTATION_ARGS) -{ - if(scale) - { - TRANSFER_FRAME_DEFAULT(&output_row, - input_row + column_table[j] * in_pixelsize, - column_table[j], - column_table[j] / 4, - column_table[j] / 4, - 0); - } - else - { - TRANSFER_FRAME_DEFAULT(&output_row, - input_row + j * in_pixelsize, - j, - j / 4, - j / 4, - 0); - } -} - -void cmodel_yuv444p(PERMUTATION_ARGS) -{ - if(scale) - { - TRANSFER_FRAME_DEFAULT(&output_row, - input_row + column_table[j] * in_pixelsize, - column_table[j], - column_table[j], - column_table[j], - 0); - } - else - { - TRANSFER_FRAME_DEFAULT(&output_row, - input_row + j * in_pixelsize, - j, - j, - j, - 0); - } -} diff --git a/cinelerra-5.0/quicktime/cmodel_yuv422.c b/cinelerra-5.0/quicktime/cmodel_yuv422.c deleted file mode 100644 index d2404f64..00000000 --- a/cinelerra-5.0/quicktime/cmodel_yuv422.c +++ /dev/null @@ -1,556 +0,0 @@ -/* - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - - -#include "cmodel_permutation.h" - - - -static inline void transfer_YUV422_to_RGB8(unsigned char *(*output), - unsigned char *input, - int column) -{ - int y, u, v; - int r, g, b; - -// Even pixel - if(!(column & 1)) - y = (int)(input[0]) << 16; - else -// Odd pixel - y = (int)(input[2]) << 16; - - u = input[1]; - v = input[3]; - YUV_TO_RGB(y, u, v, r, g, b) - - *(*output) = (unsigned char)((r & 0xc0) + - ((g & 0xe0) >> 2) + - ((b & 0xe0) >> 5)); - (*output)++; -} - -static inline void transfer_YUV422_to_BGR565(unsigned char *(*output), - unsigned char *input, - int column) -{ - int y, u, v; - int r, g, b; - -// Even pixel - if(!(column & 1)) - y = (int)(input[0]) << 16; - else -// Odd pixel - y = (int)(input[2]) << 16; - u = input[1]; - v = input[3]; - YUV_TO_RGB(y, u, v, r, g, b) - - *(uint16_t*)(*output) = ((b & 0xf8) << 8) - + ((g & 0xfc) << 3) - + ((r & 0xf8) >> 3); - (*output) += 2; -} - -static inline void transfer_YUV422_to_RGB565(unsigned char *(*output), - unsigned char *input, - int column) -{ - int y, u, v; - int r, g, b; - -// Even pixel - if(!(column & 1)) - y = (int)(input[0]) << 16; - else -// Odd pixel - y = (int)(input[2]) << 16; - u = input[1]; - v = input[3]; - YUV_TO_RGB(y, u, v, r, g, b) - - *(uint16_t*)(*output) = ((r & 0xf8) << 8) - + ((g & 0xfc) << 3) - + ((b & 0xf8) >> 3); - (*output) += 2; -} - -static inline void transfer_YUV422_to_BGR888(unsigned char *(*output), - unsigned char *input, - int column) -{ - int y, u, v; - int r, g, b; - -// Even pixel - if(!(column & 1)) - y = (int)(input[0]) << 16; - else -// Odd pixel - y = (int)(input[2]) << 16; - u = input[1]; - v = input[3]; - YUV_TO_RGB(y, u, v, r, g, b) - - (*output)[0] = b; - (*output)[1] = g; - (*output)[2] = r; - (*output) += 3; -} - -static inline void transfer_YUV422_to_RGB888(unsigned char *(*output), - unsigned char *input, - int column) -{ - int y, u, v; - int r, g, b; - -// Even pixel - if(!(column & 1)) - y = (input[0] << 16) | (input[0] << 8) | input[0]; - else -// Odd pixel - y = (input[2] << 16) | (input[2] << 8) | input[2]; - u = input[1]; - v = input[3]; - YUV_TO_RGB(y, u, v, r, g, b) - - (*output)[0] = r; - (*output)[1] = g; - (*output)[2] = b; - (*output) += 3; -} - -static inline void transfer_YUV422_to_RGBA8888(unsigned char *(*output), - unsigned char *input, - int column) -{ - int y, u, v; - int r, g, b; - -// Even pixel - if(!(column & 1)) - y = (input[0] << 16) | (input[0] << 8) | input[0]; - else -// Odd pixel - y = (input[2] << 16) | (input[2] << 8) | input[2]; - u = input[1]; - v = input[3]; - YUV_TO_RGB(y, u, v, r, g, b) - - (*output)[0] = r; - (*output)[1] = g; - (*output)[2] = b; - (*output)[3] = 0xff; - (*output) += 4; -} - -static inline void transfer_YUV422_to_RGB161616(uint16_t *(*output), - unsigned char *input, - int column) -{ - int y, u, v; - int r, g, b; - -// Even pixel - if(!(column & 1)) - y = (input[0] << 16) | (input[0] << 8) | input[0]; - else -// Odd pixel - y = (input[2] << 16) | (input[2] << 8) | input[2]; - u = (input[1] << 8) | input[1]; - v = (input[3] << 8) | input[3]; - YUV_TO_RGB16(y, u, v, r, g, b) - - (*output)[0] = r; - (*output)[1] = g; - (*output)[2] = b; - (*output) += 3; -} - -static inline void transfer_YUV422_to_RGBA16161616(uint16_t *(*output), - unsigned char *input, - int column) -{ - int y, u, v; - int r, g, b; - -// Even pixel - if(!(column & 1)) - y = (input[0] << 16) | (input[0] << 8) | input[0]; - else -// Odd pixel - y = (input[2] << 16) | (input[2] << 8) | input[2]; - u = (input[1] << 8) | input[1]; - v = (input[3] << 8) | input[3]; - YUV_TO_RGB16(y, u, v, r, g, b) - - (*output)[0] = r; - (*output)[1] = g; - (*output)[2] = b; - (*output)[3] = 0xffff; - (*output) += 4; -} - -static inline void transfer_YUV422_to_RGB_FLOAT(float* *output, - unsigned char *input, - int column) -{ - float y; -// Signedness is important - int u, v; - float r, g, b; - -// Even pixel - if(!(column & 1)) - y = (float)input[0] / 0xff; - else -// Odd pixel - y = (float)input[2] / 0xff; - u = input[1]; - v = input[3]; - YUV_TO_FLOAT(y, u, v, r, g, b) - - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; -} - -static inline void transfer_YUV422_to_RGBA_FLOAT(float* *output, - unsigned char *input, - int column) -{ - float y; -// Signedness is important - int u, v; - float r, g, b; - -// Even pixel - if(!(column & 1)) - y = (float)input[0] / 0xff; - else -// Odd pixel - y = (float)input[2] / 0xff; - u = input[1]; - v = input[3]; - YUV_TO_FLOAT(y, u, v, r, g, b) - - *(*output)++ = r; - *(*output)++ = g; - *(*output)++ = b; - *(*output)++ = 1.0; -} - -static inline void transfer_YUV422_to_YUV888(unsigned char *(*output), - unsigned char *input, - int column) -{ -// Even pixel - if(!(column & 1)) - (*output)[0] = input[0]; - else -// Odd pixel - (*output)[0] = input[2]; - - (*output)[1] = input[1]; - (*output)[2] = input[3]; - (*output) += 3; -} - -static inline void transfer_YUV422_to_YUVA8888(unsigned char *(*output), - unsigned char *input, - int column) -{ -// Even pixel - if(!(column & 1)) - (*output)[0] = input[0]; - else -// Odd pixel - (*output)[0] = input[2]; - - (*output)[1] = input[1]; - (*output)[2] = input[3]; - (*output)[3] = 255; - (*output) += 4; -} - -static inline void transfer_YUV422_to_YUV161616(uint16_t *(*output), - unsigned char *input, - int column) -{ -// Even pixel - if(!(column & 1)) - (*output)[0] = (input[0] << 8) | input[0]; - else -// Odd pixel - (*output)[0] = (input[2] << 8) | input[2]; - - (*output)[1] = (input[1] << 8) | input[1]; - (*output)[2] = (input[3] << 8) | input[3]; - (*output) += 3; -} - -static inline void transfer_YUV422_to_YUVA16161616(uint16_t *(*output), - unsigned char *input, - int column) -{ -// Even pixel - if(!(column & 1)) - (*output)[0] = (input[0] << 8) | input[0]; - else -// Odd pixel - (*output)[0] = (input[2] << 8) | input[2]; - - (*output)[1] = (input[1] << 8) | input[1]; - (*output)[2] = (input[3] << 8) | input[3]; - (*output)[3] = 0xffff; - (*output) += 4; -} - -static inline void transfer_YUV422_to_BGR8888(unsigned char *(*output), - unsigned char *input, - int column) -{ - int y, u, v; - int r, g, b; - -// Even pixel - if(!(column & 1)) - y = (int)(input[0]) << 16; - else -// Odd pixel - y = (int)(input[2]) << 16; - u = input[1]; - v = input[3]; - - YUV_TO_RGB(y, u, v, r, g, b) - - (*output)[0] = b; - (*output)[1] = g; - (*output)[2] = r; - (*output) += 4; -} - - -static inline void transfer_YUV422_to_YUV422P(unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - unsigned char *input, - int output_column) -{ -// Store U and V for even pixels only - if(!(output_column & 1)) - { - output_y[output_column] = input[0]; - output_u[output_column / 2] = input[1]; - output_v[output_column / 2] = input[3]; - } - else -// Store Y and advance output for odd pixels only - { - output_y[output_column] = input[2]; - } -} - -static inline void transfer_YUV422_to_YUV420P(unsigned char *output_y, - unsigned char *output_u, - unsigned char *output_v, - unsigned char *input, - int output_column, - int output_row) -{ -// Even column - if(!(output_column & 1)) - { - output_y[output_column] = input[0]; -// Store U and V for even columns and even rows only - if(!(output_row & 1)) - { - output_u[output_column / 2] = input[1]; - output_v[output_column / 2] = input[3]; - } - } - else -// Odd column - { - output_y[output_column] = input[2]; - } -} - -static inline void transfer_YUV422_to_YUV422(unsigned char *(*output), - unsigned char *input, - int j) -{ -// Store U and V for even pixels only - if(!(j & 1)) - { - (*output)[0] = input[0]; - (*output)[1] = input[1]; - (*output)[3] = input[3]; - } - else -// Store Y and advance output for odd pixels only - { - (*output)[2] = input[2]; - (*output) += 4; - } -} - - - - - - -#define TRANSFER_FRAME_DEFAULT(output, \ - input, \ - y_in_offset, \ - u_in_offset, \ - v_in_offset, \ - input_column) \ -{ \ - register int i, j; \ - \ - switch(out_colormodel) \ - { \ - case BC_RGB8: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV422_to_RGB8((output), (input), (input_column)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR565: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV422_to_BGR565((output), \ - (input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB565: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV422_to_RGB565((output), (input), (input_column)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV422_to_RGB888((output), (input), (input_column)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV422_to_RGBA8888((output), (input), (input_column)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV422_to_YUV888((output), (input), (input_column)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV422_to_YUVA8888((output), (input), (input_column)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB161616: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV422_to_RGB161616((uint16_t**)(output), (input), (input_column)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA16161616: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV422_to_RGBA16161616((uint16_t**)(output), (input), (input_column)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGB_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV422_to_RGB_FLOAT((float**)(output), (input), (input_column)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_RGBA_FLOAT: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV422_to_RGBA_FLOAT((float**)(output), (input), (input_column)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV161616: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV422_to_YUV161616((uint16_t**)(output), (input), (input_column)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUVA16161616: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV422_to_YUVA16161616((uint16_t**)(output), (input), (input_column)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV422_to_BGR888((output), (input), (input_column)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_BGR8888: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV422_to_BGR8888((output), (input), (input_column)); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV422P: \ - TRANSFER_YUV422P_OUT_HEAD \ - transfer_YUV422_to_YUV422P(output_y, \ - output_u, \ - output_v, \ - (input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV422: \ - TRANSFER_FRAME_HEAD \ - transfer_YUV422_to_YUV422((output), \ - (input), \ - j); \ - TRANSFER_FRAME_TAIL \ - break; \ - case BC_YUV420P: \ - TRANSFER_YUV420P_OUT_HEAD \ - transfer_YUV422_to_YUV420P(output_y, \ - output_u, \ - output_v, \ - (input), \ - j, \ - i); \ - TRANSFER_FRAME_TAIL \ - break; \ - } \ -} - -void cmodel_yuv422(PERMUTATION_ARGS) -{ - if(scale) - { - TRANSFER_FRAME_DEFAULT(&output_row, - input_row + ((column_table[j] * in_pixelsize) & 0xfffffffc), - 0, - 0, - 0, - column_table[j]); - } - else - { - TRANSFER_FRAME_DEFAULT(&output_row, - input_row + ((j * in_pixelsize) & 0xfffffffc), - 0, - 0, - 0, - j); - } -} diff --git a/cinelerra-5.0/quicktime/codecs.c b/cinelerra-5.0/quicktime/codecs.c deleted file mode 100644 index c249225e..00000000 --- a/cinelerra-5.0/quicktime/codecs.c +++ /dev/null @@ -1,398 +0,0 @@ -#include "colormodels.h" -#include "funcprotos.h" -#include "quicktime.h" -#include - -static void delete_vcodec_stub(quicktime_video_map_t *vtrack) -{ - printf("delete_vcodec_stub called\n"); -} - -static void delete_acodec_stub(quicktime_audio_map_t *atrack) -{ - printf("delete_acodec_stub called\n"); -} - -static int decode_video_stub(quicktime_t *file, - unsigned char **row_pointers, - int track) -{ - printf("decode_video_stub called\n"); - return 1; -} - -static int encode_video_stub(quicktime_t *file, - unsigned char **row_pointers, - int track) -{ - printf("encode_video_stub called\n"); - return 1; -} - -static int decode_audio_stub(quicktime_t *file, - int16_t *output_i, - float *output_f, - long samples, - int track, - int channel) -{ - printf("decode_audio_stub called\n"); - return 1; -} - -static int encode_audio_stub(quicktime_t *file, - int16_t **input_i, - float **input_f, - int track, - long samples) -{ - printf("encode_audio_stub called\n"); - return 1; -} - - -static int reads_colormodel_stub(quicktime_t *file, - int colormodel, - int track) -{ - return (colormodel == BC_RGB888); -} - -static int writes_colormodel_stub(quicktime_t *file, - int colormodel, - int track) -{ - return (colormodel == BC_RGB888); -} - -static void flush_codec_stub(quicktime_t *file, int track) -{ -} - -/* Convert Microsoft audio id to codec */ -void quicktime_id_to_codec(char *result, int id) -{ - switch(id) - { - case 0x55: - memcpy(result, QUICKTIME_MP3, 4); - break; - case 0x161: - memcpy(result, QUICKTIME_WMA, 4); - break; - default: - printf("quicktime_id_to_codec: unknown audio id: 0x%06x\n", id); - break; - } -} - -int quicktime_codec_to_id(char *codec) -{ - if(quicktime_match_32(codec, QUICKTIME_MP3)) - return 0x55; - else - if(quicktime_match_32(codec, QUICKTIME_WMA)) - return 0x161; - else - printf("quicktime_codec_to_id: unknown codec %c%c%c%c\n", - codec[0], codec[1], codec[2], codec[3]); - return 0; -} - - -quicktime_codec_t* quicktime_new_codec() -{ - quicktime_codec_t *codec = malloc(sizeof(*codec)); - if( !codec ) return 0; - memset(codec, 0, sizeof(*codec)); - codec->delete_vcodec = delete_vcodec_stub; - codec->delete_acodec = delete_acodec_stub; - codec->decode_video = decode_video_stub; - codec->encode_video = encode_video_stub; - codec->decode_audio = decode_audio_stub; - codec->encode_audio = encode_audio_stub; - codec->reads_colormodel = reads_colormodel_stub; - codec->writes_colormodel = writes_colormodel_stub; - codec->flush = flush_codec_stub; - return codec; -} - -void quicktime_del_codec(quicktime_codec_t *codec) -{ - if( codec ) free(codec); -} - -int new_vcodec(quicktime_video_map_t *vtrack) -{ - int result = quicktime_find_vcodec(vtrack); - if(result) { - char *compressor = vtrack->track->mdia.minf.stbl.stsd.table[0].format; - fprintf(stderr, - "new_vcodec: couldn't find codec for \"%c%c%c%c\"\n", - compressor[0], compressor[1], compressor[2], compressor[3]); - vtrack->codec = 0; - return 1; - } - return 0; -} - -int new_acodec(quicktime_audio_map_t *atrack) -{ - int result = quicktime_find_acodec(atrack); - if(result) { - char *compressor = atrack->track->mdia.minf.stbl.stsd.table[0].format; - fprintf(stderr, - "new_acodec: couldn't find codec for \"%c%c%c%c\"\n", - compressor[0], compressor[1], compressor[2], compressor[3]); - atrack->codec = 0; - return 1; - } - return 0; -} - -int quicktime_init_vcodec(quicktime_video_map_t *vtrack) -{ - int result = new_vcodec(vtrack); - return result; -} - -int quicktime_init_acodec(quicktime_audio_map_t *atrack) -{ - int result = new_acodec(atrack); - return result; -} - - -int quicktime_delete_vcodec(quicktime_video_map_t *vtrack) -{ - if(vtrack->codec) - { - quicktime_codec_t *codec_base = vtrack->codec; - if(codec_base->priv) - codec_base->delete_vcodec(vtrack); - free(vtrack->codec); - } - vtrack->codec = 0; - return 0; -} - -int quicktime_delete_acodec(quicktime_audio_map_t *atrack) -{ - if(atrack->codec) - { - quicktime_codec_t *codec_base = atrack->codec; - if(codec_base->priv) - codec_base->delete_acodec(atrack); - free(atrack->codec); - } - atrack->codec = 0; - return 0; -} - -int quicktime_supported_video(quicktime_t *file, int track) -{ - if(track < file->total_vtracks) - { - quicktime_video_map_t *video_map = &file->vtracks[track]; - - if(video_map->codec) - return 1; - else - return 0; - } - return 0; -} - -int quicktime_supported_audio(quicktime_t *file, int track) -{ - if(track < file->total_atracks) - { - quicktime_audio_map_t *audio_map = &file->atracks[track]; - if(audio_map->codec) - return 1; - else - return 0; - } - return 0; - -} - - -long quicktime_decode_video(quicktime_t *file, - unsigned char **row_pointers, - int track) -{ - int result; - - if(track < 0 || track >= file->total_vtracks) - { - fprintf(stderr, "quicktime_decode_video: track %d out of range %d - %d\n", - track, - 0, - file->total_vtracks); - return 1; - } - -/* Get dimensions from first video track */ - if(!file->do_scaling) - { - quicktime_video_map_t *video_map = &file->vtracks[track]; - quicktime_trak_t *trak = video_map->track; - int track_width = trak->tkhd.track_width; - int track_height = trak->tkhd.track_height; - - file->in_x = 0; - file->in_y = 0; - file->in_w = track_width; - file->in_h = track_height; - file->out_w = track_width; - file->out_h = track_height; - } - - result = ((quicktime_codec_t*)file->vtracks[track].codec)->decode_video(file, - row_pointers, - track); - file->vtracks[track].current_position++; - return result; -} - -void quicktime_set_parameter(quicktime_t *file, const char *key, void *value) -{ - int i; - for(i = 0; i < file->total_vtracks; i++) - { - quicktime_codec_t *codec = (quicktime_codec_t*)file->vtracks[i].codec; - if(codec) - if(codec->set_parameter) codec->set_parameter(file, i,(char*)key, value); - } - - for(i = 0; i < file->total_atracks; i++) - { - quicktime_codec_t *codec = (quicktime_codec_t*)file->atracks[i].codec; - if(codec) - if(codec->set_parameter) codec->set_parameter(file, i,(char*)key, value); - } -} - -int quicktime_encode_video(quicktime_t *file, - unsigned char **row_pointers, - int track) -{ - int result; - result = ((quicktime_codec_t*)file->vtracks[track].codec)->encode_video(file, row_pointers, track); - file->vtracks[track].current_position++; - return result; -} - - -int quicktime_decode_audio(quicktime_t *file, - int16_t *output_i, - float *output_f, - long samples, - int channel) -{ - int quicktime_track, quicktime_channel; - int result = 1; - - quicktime_channel_location(file, &quicktime_track, &quicktime_channel, channel); - result = ((quicktime_codec_t*)file->atracks[quicktime_track].codec)->decode_audio(file, - output_i, - output_f, - samples, - quicktime_track, - quicktime_channel); - file->atracks[quicktime_track].current_position += samples; - - return result; -} - -/* Since all channels are written at the same time: */ -/* Encode using the compressor for the first audio track. */ -/* Which means all the audio channels must be on the same track. */ - -int quicktime_encode_audio(quicktime_t *file, int16_t **input_i, float **input_f, long samples) -{ - int result = 1; - //char *compressor = quicktime_audio_compressor(file, 0); - - result = ((quicktime_codec_t*)file->atracks[0].codec)->encode_audio(file, - input_i, - input_f, - 0, - samples); - file->atracks[0].current_position += samples; - - return result; -} - -int quicktime_reads_cmodel(quicktime_t *file, - int colormodel, - int track) -{ - int result = ((quicktime_codec_t*)file->vtracks[track].codec)->reads_colormodel(file, colormodel, track); - return result; -} - -int quicktime_writes_cmodel(quicktime_t *file, - int colormodel, - int track) -{ - return ((quicktime_codec_t*)file->vtracks[track].codec)->writes_colormodel(file, colormodel, track); -} - -/* Compressors that can only encode a window at a time */ -/* need to flush extra data here. */ - -int quicktime_flush_acodec(quicktime_t *file, int track) -{ - ((quicktime_codec_t*)file->atracks[track].codec)->flush(file, track); - return 0; -}; - -void quicktime_flush_vcodec(quicktime_t *file, int track) -{ - ((quicktime_codec_t*)file->vtracks[track].codec)->flush(file, track); -} - -int64_t quicktime_samples_to_bytes(quicktime_trak_t *track, long samples) -{ - char *compressor = track->mdia.minf.stbl.stsd.table[0].format; - int channels = track->mdia.minf.stbl.stsd.table[0].channels; - - if(quicktime_match_32(compressor, QUICKTIME_DV)) - return (int64_t)samples * track->mdia.minf.stbl.stsz.sample_size; - - if(quicktime_match_32(compressor, QUICKTIME_IMA4)) - return samples * channels; - - if(quicktime_match_32(compressor, QUICKTIME_ULAW)) - return samples * channels; - -/* Default use the sample size specification for TWOS and RAW */ - return samples * channels * track->mdia.minf.stbl.stsd.table[0].sample_size / 8; -} - -int quicktime_codecs_flush(quicktime_t *file) -{ - int result = 0; - int i; - if(!file->wr) return result; - - if(file->total_atracks) - { - for(i = 0; i < file->total_atracks && !result; i++) - { - quicktime_flush_acodec(file, i); - } - } - - if(file->total_vtracks) - { - for(i = 0; i < file->total_vtracks && !result; i++) - { - quicktime_flush_vcodec(file, i); - } - } - return result; -} - diff --git a/cinelerra-5.0/quicktime/codecs.h b/cinelerra-5.0/quicktime/codecs.h deleted file mode 100644 index 559565bd..00000000 --- a/cinelerra-5.0/quicktime/codecs.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef CODECS_H -#define CODECS_H - -#endif diff --git a/cinelerra-5.0/quicktime/colormodels.c b/cinelerra-5.0/quicktime/colormodels.c deleted file mode 100755 index d5022812..00000000 --- a/cinelerra-5.0/quicktime/colormodels.c +++ /dev/null @@ -1,551 +0,0 @@ -/* - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - - - -#include "colormodels.h" -#include "cmodel_permutation.h" -#include -#include - - -cmodel_yuv_t *yuv_table = 0; - -// Compression coefficients straight out of jpeglib -#define R_TO_Y 0.29900 -#define G_TO_Y 0.58700 -#define B_TO_Y 0.11400 - -#define R_TO_U -0.16874 -#define G_TO_U -0.33126 -#define B_TO_U 0.50000 - -#define R_TO_V 0.50000 -#define G_TO_V -0.41869 -#define B_TO_V -0.08131 - -// Decompression coefficients straight out of jpeglib -#define V_TO_R 1.40200 -#define V_TO_G -0.71414 - -#define U_TO_G -0.34414 -#define U_TO_B 1.77200 - - - - - - -void cmodel_init_yuv(cmodel_yuv_t *yuv_table) -{ - int i; - -/* compression */ - for(i = 0; i < 0x100; i++) - { - yuv_table->rtoy_tab[i] = (int)(R_TO_Y * 0x10000 * i); - yuv_table->rtou_tab[i] = (int)(R_TO_U * 0x10000 * i); - yuv_table->rtov_tab[i] = (int)(R_TO_V * 0x10000 * i); - - yuv_table->gtoy_tab[i] = (int)(G_TO_Y * 0x10000 * i); - yuv_table->gtou_tab[i] = (int)(G_TO_U * 0x10000 * i); - yuv_table->gtov_tab[i] = (int)(G_TO_V * 0x10000 * i); - - yuv_table->btoy_tab[i] = (int)(B_TO_Y * 0x10000 * i); - yuv_table->btou_tab[i] = (int)(B_TO_U * 0x10000 * i) + 0x800000; - yuv_table->btov_tab[i] = (int)(B_TO_V * 0x10000 * i) + 0x800000; - } - -/* compression */ - for(i = 0; i < 0x10000; i++) - { - yuv_table->rtoy_tab16[i] = (int)(R_TO_Y * 0x100 * i); - yuv_table->rtou_tab16[i] = (int)(R_TO_U * 0x100 * i); - yuv_table->rtov_tab16[i] = (int)(R_TO_V * 0x100 * i); - - yuv_table->gtoy_tab16[i] = (int)(G_TO_Y * 0x100 * i); - yuv_table->gtou_tab16[i] = (int)(G_TO_U * 0x100 * i); - yuv_table->gtov_tab16[i] = (int)(G_TO_V * 0x100 * i); - - yuv_table->btoy_tab16[i] = (int)(B_TO_Y * 0x100 * i); - yuv_table->btou_tab16[i] = (int)(B_TO_U * 0x100 * i) + 0x800000; - yuv_table->btov_tab16[i] = (int)(B_TO_V * 0x100 * i) + 0x800000; - } - - - - -/* decompression */ - yuv_table->vtor = &(yuv_table->vtor_tab[0x80]); - yuv_table->vtog = &(yuv_table->vtog_tab[0x80]); - yuv_table->utog = &(yuv_table->utog_tab[0x80]); - yuv_table->utob = &(yuv_table->utob_tab[0x80]); - yuv_table->vtor8 = &(yuv_table->vtor_tab8[0x80]); - yuv_table->vtog8 = &(yuv_table->vtog_tab8[0x80]); - yuv_table->utog8 = &(yuv_table->utog_tab8[0x80]); - yuv_table->utob8 = &(yuv_table->utob_tab8[0x80]); - for(i = -0x80; i < 0x80; i++) - { - yuv_table->vtor[i] = (int)(V_TO_R * 0x10000 * i); - yuv_table->vtog[i] = (int)(V_TO_G * 0x10000 * i); - - yuv_table->utog[i] = (int)(U_TO_G * 0x10000 * i); - yuv_table->utob[i] = (int)(U_TO_B * 0x10000 * i); - - yuv_table->vtor8[i] = (int)(V_TO_R * i); - yuv_table->vtog8[i] = (int)(V_TO_G * i); - - yuv_table->utog8[i] = (int)(U_TO_G * i); - yuv_table->utob8[i] = (int)(U_TO_B * i); - } - - -/* decompression */ - yuv_table->vtor_float = &(yuv_table->vtor_float_tab[0x80]); - yuv_table->vtog_float = &(yuv_table->vtog_float_tab[0x80]); - yuv_table->utog_float = &(yuv_table->utog_float_tab[0x80]); - yuv_table->utob_float = &(yuv_table->utob_float_tab[0x80]); - for(i = -0x80; i < 0x80; i++) - { - yuv_table->vtor_float[i] = V_TO_R * i / 0xff; - yuv_table->vtog_float[i] = V_TO_G * i / 0xff; - - yuv_table->utog_float[i] = U_TO_G * i / 0xff; - yuv_table->utob_float[i] = U_TO_B * i / 0xff; - } - - -/* decompression */ - yuv_table->vtor16 = &(yuv_table->vtor_tab16[0x8000]); - yuv_table->vtog16 = &(yuv_table->vtog_tab16[0x8000]); - yuv_table->utog16 = &(yuv_table->utog_tab16[0x8000]); - yuv_table->utob16 = &(yuv_table->utob_tab16[0x8000]); - for(i = -0x8000; i < 0x8000; i++) - { - yuv_table->vtor16[i] = (int)(V_TO_R * 0x100 * i); - yuv_table->vtog16[i] = (int)(V_TO_G * 0x100 * i); - - yuv_table->utog16[i] = (int)(U_TO_G * 0x100 * i); - yuv_table->utob16[i] = (int)(U_TO_B * 0x100 * i); - } - - -/* decompression */ - yuv_table->v16tor_float = &(yuv_table->v16tor_float_tab[0x8000]); - yuv_table->v16tog_float = &(yuv_table->v16tog_float_tab[0x8000]); - yuv_table->u16tog_float = &(yuv_table->u16tog_float_tab[0x8000]); - yuv_table->u16tob_float = &(yuv_table->u16tob_float_tab[0x8000]); - for(i = -0x8000; i < 0x8000; i++) - { - yuv_table->v16tor_float[i] = V_TO_R * i / 0xffff; - yuv_table->v16tog_float[i] = V_TO_G * i / 0xffff; - - yuv_table->u16tog_float[i] = U_TO_G * i / 0xffff; - yuv_table->u16tob_float[i] = U_TO_B * i / 0xffff; - } -} - - -void cmodel_delete_yuv(cmodel_yuv_t *yuv_table) -{ -} - -int cmodel_is_planar(int colormodel) -{ - switch(colormodel) - { - case BC_YUV420P: return 1; break; - case BC_YUV422P: return 1; break; - case BC_YUV444P: return 1; break; -// case BC_YUV411P: return 1; break; - } - return 0; -} - -int cmodel_components(int colormodel) -{ - switch(colormodel) - { - case BC_A8: return 1; break; - case BC_A16: return 1; break; - case BC_A_FLOAT: return 1; break; - case BC_RGBA8888: return 4; break; - case BC_RGBA16161616: return 4; break; - case BC_YUVA8888: return 4; break; - case BC_YUVA16161616: return 4; break; - case BC_RGBA_FLOAT: return 4; break; - } - return 3; -} - -int cmodel_calculate_pixelsize(int colormodel) -{ - switch(colormodel) - { - case BC_A8: return 1; break; - case BC_A16: return 2; break; - case BC_A_FLOAT: return 4; break; - case BC_TRANSPARENCY: return 1; break; - case BC_COMPRESSED: return 1; break; - case BC_RGB8: return 1; break; - case BC_RGB565: return 2; break; - case BC_BGR565: return 2; break; - case BC_BGR888: return 3; break; - case BC_BGR8888: return 4; break; -// Working bitmaps are packed to simplify processing - case BC_RGB888: return 3; break; - case BC_ARGB8888: return 4; break; - case BC_ABGR8888: return 4; break; - case BC_RGBA8888: return 4; break; - case BC_RGB161616: return 6; break; - case BC_RGBA16161616: return 8; break; - case BC_YUV888: return 3; break; - case BC_YUVA8888: return 4; break; - case BC_YUV161616: return 6; break; - case BC_YUVA16161616: return 8; break; - case BC_YUV101010: return 4; break; - case BC_VYU888: return 3; break; - case BC_UYVA8888: return 4; break; - case BC_RGB_FLOAT: return 12; break; - case BC_RGBA_FLOAT: return 16; break; -// Planar - case BC_YUV420P: return 1; break; - case BC_YUV422P: return 1; break; - case BC_YUV444P: return 1; break; - case BC_YUV422: return 2; break; -// case BC_YUV411P: return 1; break; - case BC_YUV9P: return 1; break; - } - return 0; -} - -int cmodel_calculate_max(int colormodel) -{ - switch(colormodel) - { -// Working bitmaps are packed to simplify processing - case BC_A8: return 0xff; break; - case BC_A16: return 0xffff; break; - case BC_A_FLOAT: return 1; break; - case BC_RGB888: return 0xff; break; - case BC_RGBA8888: return 0xff; break; - case BC_RGB161616: return 0xffff; break; - case BC_RGBA16161616: return 0xffff; break; - case BC_YUV888: return 0xff; break; - case BC_YUVA8888: return 0xff; break; - case BC_YUV161616: return 0xffff; break; - case BC_YUVA16161616: return 0xffff; break; - case BC_RGB_FLOAT: return 1; break; - case BC_RGBA_FLOAT: return 1; break; - } - return 0; -} - -int cmodel_calculate_datasize(int w, int h, int bytes_per_line, int color_model) -{ - if(bytes_per_line < 0) bytes_per_line = w * - cmodel_calculate_pixelsize(color_model); - switch(color_model) - { - case BC_YUV420P: -// case BC_YUV411P: - return w * h + w * h / 2 + 4; - break; - - case BC_YUV422P: - return w * h * 2 + 4; - break; - - case BC_YUV444P: - return w * h * 3 + 4; - break; - - default: - return h * bytes_per_line + 4; - break; - } - return 0; -} - - -static void get_scale_tables(int **column_table, - int **row_table, - int in_x1, - int in_y1, - int in_x2, - int in_y2, - int out_x1, - int out_y1, - int out_x2, - int out_y2) -{ - int i; - float w_in = in_x2 - in_x1; - float h_in = in_y2 - in_y1; - int w_out = out_x2 - out_x1; - int h_out = out_y2 - out_y1; - - float hscale = w_in / w_out; - float vscale = h_in / h_out; - -/* + 1 so we don't overflow when calculating in advance */ - (*column_table) = malloc(sizeof(int) * (w_out + 1)); - (*row_table) = malloc(sizeof(int) * h_out); - for(i = 0; i < w_out; i++) - { - (*column_table)[i] = (int)(hscale * i) + in_x1; - } - - for(i = 0; i < h_out; i++) - { - (*row_table)[i] = (int)(vscale * i) + in_y1; -//printf("get_scale_tables %d %d\n", (*row_table)[i], i); - } -} - - -void cmodel_transfer(unsigned char **output_rows, - unsigned char **input_rows, - unsigned char *out_y_plane, - unsigned char *out_u_plane, - unsigned char *out_v_plane, - unsigned char *in_y_plane, - unsigned char *in_u_plane, - unsigned char *in_v_plane, - int in_x, - int in_y, - int in_w, - int in_h, - int out_x, - int out_y, - int out_w, - int out_h, - int in_colormodel, - int out_colormodel, - int bg_color, - int in_rowspan, - int out_rowspan) -{ - int *column_table; - int *row_table; - int scale; - int bg_r, bg_g, bg_b; - int in_pixelsize = cmodel_calculate_pixelsize(in_colormodel); - int out_pixelsize = cmodel_calculate_pixelsize(out_colormodel); - - bg_r = (bg_color & 0xff0000) >> 16; - bg_g = (bg_color & 0xff00) >> 8; - bg_b = (bg_color & 0xff); - -// Initialize tables - if(yuv_table == 0) - { - yuv_table = calloc(1, sizeof(cmodel_yuv_t)); - cmodel_init_yuv(yuv_table); - } - -// Get scaling - scale = (out_w != in_w) || (in_x != 0); - get_scale_tables(&column_table, &row_table, - in_x, in_y, in_x + in_w, in_y + in_h, - out_x, out_y, out_x + out_w, out_y + out_h); - -/* - * printf("cmodel_transfer %d %d %d %d,%d %d,%d %d,%d %d,%d\n", - * __LINE__, - * in_colormodel, - * out_colormodel, - * out_x, - * out_y, - * out_w, - * out_h, - * in_x, - * in_y, - * in_w, - * in_h); - */ - - -#define PERMUTATION_VALUES \ - output_rows, \ - input_rows, \ - out_y_plane, \ - out_u_plane, \ - out_v_plane, \ - in_y_plane, \ - in_u_plane, \ - in_v_plane, \ - in_x, \ - in_y, \ - in_w, \ - in_h, \ - out_x, \ - out_y, \ - out_w, \ - out_h, \ - in_colormodel, \ - out_colormodel, \ - bg_color, \ - in_rowspan, \ - out_rowspan, \ - scale, \ - out_pixelsize, \ - in_pixelsize, \ - row_table, \ - column_table, \ - bg_r, \ - bg_g, \ - bg_b - -// Handle planar cmodels separately - switch(in_colormodel) - { - case BC_RGB_FLOAT: - case BC_RGBA_FLOAT: - cmodel_float(PERMUTATION_VALUES); - break; - - case BC_YUV420P: - case BC_YUV422P: - cmodel_yuv420p(PERMUTATION_VALUES); - break; - - case BC_YUV9P: - cmodel_yuv9p(PERMUTATION_VALUES); - break; - - case BC_YUV444P: - cmodel_yuv444p(PERMUTATION_VALUES); - break; - - case BC_YUV422: - cmodel_yuv422(PERMUTATION_VALUES); - break; - - default: - cmodel_default(PERMUTATION_VALUES); - break; - } - -/* - * printf("cmodel_transfer 100 %d %d\n", - * in_colormodel, - * out_colormodel); - */ - - free(column_table); - free(row_table); -} - -int cmodel_bc_to_x(int color_model) -{ - switch(color_model) - { - case BC_YUV420P: - return FOURCC_YV12; - break; - case BC_YUV422: - return FOURCC_YUV2; - break; - } - return -1; -} - -void cmodel_to_text(char *string, int cmodel) -{ - switch(cmodel) - { - case BC_RGB888: strcpy(string, "RGB-8 Bit"); break; - case BC_RGBA8888: strcpy(string, "RGBA-8 Bit"); break; - case BC_RGB161616: strcpy(string, "RGB-16 Bit"); break; - case BC_RGBA16161616: strcpy(string, "RGBA-16 Bit"); break; - case BC_YUV888: strcpy(string, "YUV-8 Bit"); break; - case BC_YUVA8888: strcpy(string, "YUVA-8 Bit"); break; - case BC_YUV161616: strcpy(string, "YUV-16 Bit"); break; - case BC_YUVA16161616: strcpy(string, "YUVA-16 Bit"); break; - case BC_RGB_FLOAT: strcpy(string, "RGB-FLOAT"); break; - case BC_RGBA_FLOAT: strcpy(string, "RGBA-FLOAT"); break; - default: strcpy(string, "RGB-8 Bit"); break; - } -} - -int cmodel_from_text(const char *text) -{ - if(!strcasecmp(text, "RGB-8 Bit")) return BC_RGB888; - if(!strcasecmp(text, "RGBA-8 Bit")) return BC_RGBA8888; - if(!strcasecmp(text, "RGB-16 Bit")) return BC_RGB161616; - if(!strcasecmp(text, "RGBA-16 Bit")) return BC_RGBA16161616; - if(!strcasecmp(text, "RGB-FLOAT")) return BC_RGB_FLOAT; - if(!strcasecmp(text, "RGBA-FLOAT")) return BC_RGBA_FLOAT; - if(!strcasecmp(text, "YUV-8 Bit")) return BC_YUV888; - if(!strcasecmp(text, "YUVA-8 Bit")) return BC_YUVA8888; - if(!strcasecmp(text, "YUV-16 Bit")) return BC_YUV161616; - if(!strcasecmp(text, "YUVA-16 Bit")) return BC_YUVA16161616; - return BC_RGB888; -} - -int cmodel_has_alpha(int colormodel) -{ - switch(colormodel) - { - case BC_YUVA8888: - case BC_RGBA8888: - case BC_RGBA16161616: - case BC_YUVA16161616: - case BC_RGBA_FLOAT: - return 1; - } - return 0; -} - -int cmodel_is_float(int colormodel) -{ - switch(colormodel) - { - case BC_RGB_FLOAT: - case BC_RGBA_FLOAT: - return 1; - } - return 0; -} - -int cmodel_is_yuv(int colormodel) -{ - switch(colormodel) - { - case BC_YUV888: - case BC_YUVA8888: - case BC_YUV161616: - case BC_YUVA16161616: - case BC_YUV422: - case BC_YUV420P: - case BC_YUV422P: - case BC_YUV444P: -// case BC_YUV411P: - return 1; - break; - - default: - return 0; - break; - } -} - - - - - diff --git a/cinelerra-5.0/quicktime/colormodels.h b/cinelerra-5.0/quicktime/colormodels.h deleted file mode 100644 index 88060e3c..00000000 --- a/cinelerra-5.0/quicktime/colormodels.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - - -#ifndef COLORMODELS_H -#define COLORMODELS_H - -// Colormodels -#define BC_TRANSPARENCY 0 -#define BC_COMPRESSED 1 -#define BC_RGB8 2 -#define BC_RGB565 3 -#define BC_BGR565 4 -#define BC_BGR888 5 -#define BC_BGR8888 6 -// Working bitmaps are packed to simplify processing -#define BC_RGB888 9 -#define BC_RGBA8888 10 -#define BC_ARGB8888 20 -#define BC_ABGR8888 21 -#define BC_RGB161616 11 -#define BC_RGBA16161616 12 -#define BC_YUV888 13 -#define BC_YUVA8888 14 -#define BC_YUV161616 15 -#define BC_YUVA16161616 16 -#define BC_UVY422 18 -#define BC_YUV422 19 -#define BC_A8 22 -#define BC_A16 23 -#define BC_A_FLOAT 31 -#define BC_YUV101010 24 -#define BC_VYU888 25 -#define BC_UYVA8888 26 -#define BC_RGB_FLOAT 29 -#define BC_RGBA_FLOAT 30 -// Planar -#define BC_YUV420P 7 -#define BC_YUV422P 8 -//#define BC_YUV411P 17 // broken -#define BC_YUV444P 27 -#define BC_YUV9P 28 // Disasterous cmodel from Sorenson - -// Colormodels purely used by Quicktime are done in Quicktime. - -// For communication with the X Server -#define FOURCC_YV12 0x32315659 /* YV12 YUV420P */ -#define FOURCC_YUV2 0x32595559 /* YUV2 YUV422 */ -#define FOURCC_UYVY 0x59565955 /* UYVY UVY422 */ -#define FOURCC_I420 0x30323449 /* I420 Intel Indeo 4 */ - -#undef CLAMP -#define CLAMP(x, y, z) ((x) = ((x) < (y) ? (y) : ((x) > (z) ? (z) : (x)))) - -#undef CLIP -#define CLIP(x, y, z) ((x) < (y) ? (y) : ((x) > (z) ? (z) : (x))) - - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct -{ - int rtoy_tab[0x100], gtoy_tab[0x100], btoy_tab[0x100]; - int rtou_tab[0x100], gtou_tab[0x100], btou_tab[0x100]; - int rtov_tab[0x100], gtov_tab[0x100], btov_tab[0x100]; - - int vtor_tab[0x100], vtog_tab[0x100]; - int utog_tab[0x100], utob_tab[0x100]; -// Used by init_yuv only - int *vtor, *vtog, *utog, *utob; - - short int vtor_tab8[0x100], vtog_tab8[0x100]; - short int utog_tab8[0x100], utob_tab8[0x100]; - short int *vtor8, *vtog8, *utog8, *utob8; - - float vtor_float_tab[0x100], vtog_float_tab[0x100]; - float utog_float_tab[0x100], utob_float_tab[0x100]; - float *vtor_float, *vtog_float, *utog_float, *utob_float; - - int rtoy_tab16[0x10000], gtoy_tab16[0x10000], btoy_tab16[0x10000]; - int rtou_tab16[0x10000], gtou_tab16[0x10000], btou_tab16[0x10000]; - int rtov_tab16[0x10000], gtov_tab16[0x10000], btov_tab16[0x10000]; - - int vtor_tab16[0x10000], vtog_tab16[0x10000]; - int utog_tab16[0x10000], utob_tab16[0x10000]; - int *vtor16, *vtog16, *utog16, *utob16; - - float v16tor_float_tab[0x10000], v16tog_float_tab[0x10000]; - float u16tog_float_tab[0x10000], u16tob_float_tab[0x10000]; - float *v16tor_float, *v16tog_float, *u16tog_float, *u16tob_float; -} cmodel_yuv_t; - -extern cmodel_yuv_t *yuv_table; - -int cmodel_calculate_pixelsize(int colormodel); -int cmodel_calculate_datasize(int w, int h, int bytes_per_line, int color_model); -int cmodel_calculate_max(int colormodel); -int cmodel_components(int colormodel); -int cmodel_is_yuv(int colormodel); -int cmodel_has_alpha(int colormodel); -int cmodel_is_float(int colormodel); - -// Tell when to use plane arguments or row pointer arguments to functions -int cmodel_is_planar(int color_model); -void cmodel_to_text(char *string, int cmodel); -int cmodel_from_text(const char *text); - - - -void cmodel_transfer(unsigned char **output_rows, /* Leave NULL if non existent */ - unsigned char **input_rows, - unsigned char *out_y_plane, /* Leave NULL if non existent */ - unsigned char *out_u_plane, - unsigned char *out_v_plane, - unsigned char *in_y_plane, /* Leave NULL if non existent */ - unsigned char *in_u_plane, - unsigned char *in_v_plane, - int in_x, /* Dimensions to capture from input frame */ - int in_y, - int in_w, - int in_h, - int out_x, /* Dimensions to project on output frame */ - int out_y, - int out_w, - int out_h, - int in_colormodel, - int out_colormodel, - int bg_color, /* When transfering BC_RGBA8888 to non-alpha this is the background color in 0xRRGGBB hex */ - int in_rowspan, /* For planar use the luma rowspan */ - int out_rowspan); /* For planar use the luma rowspan */ - -void cmodel_init_yuv(cmodel_yuv_t *yuv_table); -void cmodel_delete_yuv(cmodel_yuv_t *yuv_table); -int cmodel_bc_to_x(int color_model); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/cinelerra-5.0/quicktime/configure b/cinelerra-5.0/quicktime/configure deleted file mode 100755 index fd794c6a..00000000 --- a/cinelerra-5.0/quicktime/configure +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh - -ERROR=0 -TOPDIR=`pwd` - -# test for nasm -if [ -x /usr/bin/nasm -o -x /usr/local/bin/nasm ]; then HAVE_NASM=y; else HAVE_NASM=n; fi - -# test for yasm -if [ -x /usr/bin/yasm -o -x /usr/local/bin/yasm ]; then HAVE_YASM=y; else HAVE_YASM=n; fi - -if [ `uname -m` = i686 ]; then - if [ $HAVE_NASM = n ]; then - echo " *** Nasm is required. Download it from nasm.sourceforge.net"; - ERROR=1 - fi -fi - -if [ $HAVE_YASM = n ]; then - echo " *** Yasm is required. Download it from www.tortall.net/projects/yasm/"; - ERROR=1 -fi - -# test for -msse support - -rm -f a.out -cat > conftest.c << EOF -int main() -{ - return 0; -} -EOF - -gcc -msse conftest.c > /dev/null 2>&1 - -if [ -x a.out ]; then HAVE_GCC=y; else HAVE_GCC=n; fi - -rm -f a.out conftest.c - -if [ $HAVE_GCC = n ]; then - echo " *** GCC 3.2.2 or greater is required. Download it from gcc.gnu.org"; - ERROR=1 -fi - -if [ $ERROR -ne 0 ]; then - exit 1 -fi - diff --git a/cinelerra-5.0/quicktime/ctab.c b/cinelerra-5.0/quicktime/ctab.c deleted file mode 100644 index f9d458f1..00000000 --- a/cinelerra-5.0/quicktime/ctab.c +++ /dev/null @@ -1,62 +0,0 @@ -#include -#include "funcprotos.h" -#include "quicktime.h" - -int quicktime_ctab_init(quicktime_ctab_t *ctab) -{ - ctab->seed = 0; - ctab->flags = 0; - ctab->size = 0; - ctab->alpha = 0; - ctab->red = 0; - ctab->green = 0; - ctab->blue = 0; - return 0; -} - -int quicktime_ctab_delete(quicktime_ctab_t *ctab) -{ - if(ctab->alpha) free(ctab->alpha); - if(ctab->red) free(ctab->red); - if(ctab->green) free(ctab->green); - if(ctab->blue) free(ctab->blue); - return 0; -} - -void quicktime_ctab_dump(quicktime_ctab_t *ctab) -{ - int i; - printf(" color table\n"); - printf(" seed %ld\n", ctab->seed); - printf(" flags %ld\n", ctab->flags); - printf(" size %ld\n", ctab->size); - printf(" colors "); - for(i = 0; i < ctab->size; i++) - { - printf("[%d %d %d %d]", ctab->red[i], ctab->green[i], ctab->blue[i], ctab->alpha[i]); - } - printf("\n"); -} - -int quicktime_read_ctab(quicktime_t *file, quicktime_ctab_t *ctab) -{ - int i; - - ctab->seed = quicktime_read_int32(file); - ctab->flags = quicktime_read_int16(file); - ctab->size = quicktime_read_int16(file) + 1; - ctab->alpha = malloc(sizeof(int16_t) * ctab->size); - ctab->red = malloc(sizeof(int16_t) * ctab->size); - ctab->green = malloc(sizeof(int16_t) * ctab->size); - ctab->blue = malloc(sizeof(int16_t) * ctab->size); - - for(i = 0; i < ctab->size; i++) - { - ctab->alpha[i] = quicktime_read_int16(file); - ctab->red[i] = quicktime_read_int16(file); - ctab->green[i] = quicktime_read_int16(file); - ctab->blue[i] = quicktime_read_int16(file); - } - - return 0; -} diff --git a/cinelerra-5.0/quicktime/dechunk.c b/cinelerra-5.0/quicktime/dechunk.c deleted file mode 100644 index 963ef36d..00000000 --- a/cinelerra-5.0/quicktime/dechunk.c +++ /dev/null @@ -1,126 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" - -int usage(void) -{ - printf("usage: dechunk [-f framerate] \n"); - printf(" Movies containing rgb frames are written as ppm images.\n"); - exit(1); - return 0; -} - -int main(int argc, char *argv[]) -{ - quicktime_t *file; - FILE *output; - int result = 0; - int i, j; - int64_t length; - char string[1024], *prefix = 0, *input = 0; - char *data = 0; - int bytes = 0, old_bytes = 0; - float output_rate = 0; - float input_rate; - int64_t input_frame; - int64_t new_length; - int width, height; - int rgb_to_ppm = 0; - - if(argc < 3) - { - usage(); - } - - for(i = 1, j = 0; i < argc; i++) - { - if(!strcmp(argv[i], "-f")) - { - if(i + 1 < argc) - { - output_rate = atof(argv[++i]); - } - else - usage(); - } - else - if(j == 0) - { - input = argv[i]; - j++; - } - else - if(j == 1) - { - prefix = argv[i]; - j++; - } - } - - if(!prefix || !input) usage(); - - if(!(file = quicktime_open(input, 1, 0))) - { - printf("Open failed\n"); - exit(1); - } - - if(!quicktime_video_tracks(file)) - { - printf("No video tracks.\n"); - exit(1); - } - - if(quicktime_match_32(quicktime_video_compressor(file, 0), QUICKTIME_RAW)) - { - printf("Converting to ppm.\n"); - rgb_to_ppm = 1; - } - - length = quicktime_video_length(file, 0); - input_rate = quicktime_frame_rate(file, 0); - if(!output_rate) output_rate = input_rate; - new_length = output_rate / input_rate * length; - width = quicktime_video_width(file, 0); - height = quicktime_video_height(file, 0); - - for(i = 0; i < new_length; i++) - { -/* Get output file */ - sprintf(string, "%s%06d", prefix, i); - if(!(output = fopen(string, "wb"))) - { - perror("Open failed"); - exit(1); - } - -/* Get input frame */ - input_frame = (int64_t)(input_rate / output_rate * i); - bytes = quicktime_frame_size(file, input_frame, 0); - - if(data) - { - if(bytes > old_bytes) { free(data); data = 0; } - } - - if(!data) - { - old_bytes = bytes; - data = malloc(bytes); - } - - quicktime_set_video_position(file, input_frame, 0); - quicktime_read_data(file, data, bytes); - if(rgb_to_ppm) - { - fprintf(output, "P6\n%d %d\n%d\n", width, height, 0xff); - } - - if(!fwrite(data, bytes, 1, output)) - { - perror("write failed"); - } - fclose(output); - } - - quicktime_close(file); -} diff --git a/cinelerra-5.0/quicktime/dinf.c b/cinelerra-5.0/quicktime/dinf.c deleted file mode 100644 index 160b832e..00000000 --- a/cinelerra-5.0/quicktime/dinf.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" - -void quicktime_dinf_init(quicktime_dinf_t *dinf) -{ - quicktime_dref_init(&(dinf->dref)); -} - -void quicktime_dinf_delete(quicktime_dinf_t *dinf) -{ - quicktime_dref_delete(&(dinf->dref)); -} - -void quicktime_dinf_init_all(quicktime_dinf_t *dinf) -{ - quicktime_dref_init_all(&(dinf->dref)); -} - -void quicktime_dinf_dump(quicktime_dinf_t *dinf) -{ - printf(" data information (dinf)\n"); - quicktime_dref_dump(&(dinf->dref)); -} - -void quicktime_read_dinf(quicktime_t *file, quicktime_dinf_t *dinf, quicktime_atom_t *dinf_atom) -{ - quicktime_atom_t leaf_atom; - - do - { - quicktime_atom_read_header(file, &leaf_atom); - if(quicktime_atom_is(&leaf_atom, "dref")) - { quicktime_read_dref(file, &(dinf->dref)); } - else - quicktime_atom_skip(file, &leaf_atom); - }while(quicktime_position(file) < dinf_atom->end); -} - -void quicktime_write_dinf(quicktime_t *file, quicktime_dinf_t *dinf) -{ - quicktime_atom_t atom; - quicktime_atom_write_header(file, &atom, "dinf"); - quicktime_write_dref(file, &(dinf->dref)); - quicktime_atom_write_footer(file, &atom); -} diff --git a/cinelerra-5.0/quicktime/docs/building.html b/cinelerra-5.0/quicktime/docs/building.html deleted file mode 100644 index 0a047ad9..00000000 --- a/cinelerra-5.0/quicktime/docs/building.html +++ /dev/null @@ -1,36 +0,0 @@ -Building - - -

Step 1: Build the library

- - -Quicktime for Linux requires a copy of of libzmpeg3 in a directory next to itself. -This provides the mp3 interface.

- -Your directory structure should thus be:

-


-/my_directory
-/my_directory/libzmpeg3-*.*.*
-/my_directory/quicktime4linux-*.*.*
-
- -type "make" in the libzmpeg3 directory.
-Type "configure" in the quicktime directory.
-type "make" in the quicktime directory.
-type "make util" to get quicktime to build some utilities.

- -The makefiles automatically configure themselves. The library is in -i686/libquicktime.a. You should manually set the CFLAGS environment -variable with the optimum optimization parameters for your i686 -derivative.

- -The entire source code tree should be positioned in a location where -every application that needs it can access it. There is no provision -for standard include files and normally it's much to difficult for -users to match versions to use it as a shared library. Those of you -who were born before 1997 may remember QT doing this.

- - -

-

- diff --git a/cinelerra-5.0/quicktime/docs/codecs.html b/cinelerra-5.0/quicktime/docs/codecs.html deleted file mode 100644 index 0955462c..00000000 --- a/cinelerra-5.0/quicktime/docs/codecs.html +++ /dev/null @@ -1,117 +0,0 @@ -Quicktime for Linux - -

Codec information

- -The following concerns all the codecs built into the library.

- - -

DIVX

- -This encodes video in MPEG-4 using the OpenDivx codec. This is the -preferred compressed format although it probably won't be supported by -Microsoft or Apple any time soon. It takes the following -parameters:

- - - -divx_bitrate (int)
-divx_rc_period (int)
-divx_rc_reaction_ratio (int)
-divx_rc_reaction_period (int)
-divx_max_key_interval (int)
-divx_max_quantizer (int)
-divx_min_quantizer (int)
-divx_quantizer (int)
-divx_quality (int)
-divx_fix_bitrate (int)
-

- - -

DV

- -DV is supported for full decoding but only for black and white encoding -on IA-32 platforms/architectures. Secondly, only NTSC 25 Mbit/sec -4:1:1 DV data has ever been tested. There are two derivatives of DV: -DVC and DVCP. Only DVC is currently supported.

- -

IMA4

- -The IMA4 compressor reduces 16 bit audio data to 1/4 size, with very -good quality. For many years IMA4 was the best compressed audio format -in Quicktime. The first Starwars trailer in 1998 was encoded using -IMA4 audio.

- -

JPEG

- -JPEG is preferred for compressed video. This format writes a seperate -JPEG photo for every frame in YUV 4:2:0.

- -JPEG supports the following parameters, which can be set after -quicktime_set_video.

- - -jpeg_quality (int)
-jpeg_usefloat (int)
-

- -These take a quality factor from 1 - 100 and a booleen flag to -determine whether floating point operations should be used to slow it -down.

- -

MJPA

- -MJPA stores each frame as two JPEGs interlaced and in YUV 4:2:2. The -real advantage is that it can split compression and decompression -across 2 processors and it supports higher color sampling than JPEG -Photo. To enable dualized MJPA processing call:

- - -quicktime_set_cpus(quicktime_t *file, int cpus);

- - -immediately after the quicktime_init call. Cpus should contain -the number of CPUs to devote to compression.

- -After specifying MJPA in quicktime_set_video you need to call -quicktime_set_jpeg as described previously.

- -

PNG

- -This consists of one PNG image for every frame. Like RAW this -codec supports 32 bit depths.

- -

RAW

- -RAW identifies both a video and an audio codec. When you specify RAW -for an audio track you invoke unsigned 8 bit encoding so you'll probably -never use it.

- -When you specify RAW for a video track you get RGB packed -frames. RAW video supports alpha channels. To get RGBA packed frames -you can then issue

- - -int quicktime_set_depth(quicktime_t *file, int depth, int track); -

- -specifying a depth of 32.

- -

TWOS

- -Twos is the preferred encoding for uncompressed audio. It stores 8, -16, and 24 bit audio, interleaved for multiple channels. The 8 bit -mode is signed. The 16 and 24 bit modes are big endian signed. - -

Vorbis

- -This is the preferred encoding for compressed audio although it -probably won't be supported by Microsoft or Apple any time soon. It -takes the following parameters:

- - -vorbis_bitrate (int)
-vorbis_max_bitrate (int)
-vorbis_min_bitrate (int)
-

- -Units are bits per second. diff --git a/cinelerra-5.0/quicktime/docs/firewire.html b/cinelerra-5.0/quicktime/docs/firewire.html deleted file mode 100644 index f50c2c89..00000000 --- a/cinelerra-5.0/quicktime/docs/firewire.html +++ /dev/null @@ -1,175 +0,0 @@ -Quicktime for Linux - -

DV INFORMATION

- -Since Quicktime supports DV, the DV library was integrated. Originally -the DV library had no front end so an abstraction to the DV library -which uses Quicktime 4 Linux semantics was also written. The front end -to the integrated DV support is in libdv.h

- -

THE DV_T OBJECT

- -It allows you to

- -1) Decode and encode video data from a DV frame
-2) Decode and encode audio data from a DV frame

- -DV stores audio and video in each frame. Function calls in libdv.h -handle each separately.

- -

DECODING

- -STEP 1:

- -#include "libdv.h" and create a new dv decoder.

- - - dv_t *dv = dv_new();

- - -STEP 2:

- -Read a video frame from a buffer containing one frame of DV.

- - - dv_read_video(dv, output_rows, data, bytes, color_model);

- - -dv is the dv decoding object.

- -output_rows is an array of pointers, one pointer to each row of an -output frame. Each row must have enough memory allocated to store a -row of the specified color model. If the colormodel is planar, the -first three output_rows are the planes and the rest is ignored. -The dimensions of the frame must be determined by whatever procedure -grabs the data from the device.

- -data is the compressed data.

- -bytes is the size of the compressed data. This can be a #define from libdv.h.

- -color_model is the color model to generate. It can be almost anything -from colormodels.h but not all the outputs have been tested.

- -STEP 3:

- -Read an audio frame. This procedure only works for 2 channel 16 bit -encoding in the DV frame. Call dv_read_audio for each frame to extract -the audio from.

- - - dv_read_audio(dv, samples, data, size, channels, bits);

- - -dv is the dv pointer.

- -samples is a preallocated buffer of 4096 bytes * channels * -bytes per sample, an arbitrary fraction of which are going to be -filled.

- -data is the compressed DV frame.

- -size is the number of bytes in the DV frame.

- -channels is the number of channels libdv should store in the -samples buffer. The DV format allows up to 4 audio channels. -If the DV frame itself has more channels than the user has allocated, -they are ignored.

- -This function returns the number of 16 bit, twos complement, native -byte order samples deposited in *samples.

- - - - -STEP 4:

- -Delete the dv object when finished reading frames.

- - - dv_delete(dv);

- - - - - - - - - -

ENCODING

- -Creating and deleting the dv object is the same as in decoding. This -involves dv_new and dv_delete.

- -ENCODING VIDEO

- -

-void dv_write_video(dv_t *dv,
-		unsigned char *data,
-		unsigned char **input_rows,
-		int color_model,
-		int norm);
-

- -Compresses the uncompressed frame in input_rows to the -preallocated buffer pointed to by data. The size of the buffer -is either DV_NTSC_SIZE or DV_PAL_SIZE depending on the -norm.

- -The color_model can only be BC_YUV422 or -BC_RGB888.

- -The norm can be DV_NTSC or DV_PAL. The norm -determines the size of the frame that must be passed to -input_rows. DV_NTSC requires a 720x480 frame. DV_PAL requires -a 720x576 frame.

- -ENCODING AUDIO

- -After and only after encoding video into the frame, audio may be -encoded.

- -

-int dv_write_audio(dv_t *dv,
-		unsigned char *data,
-		unsigned char *input_samples,
-		int max_samples,
-		int channels,
-		int bits,
-		int rate,
-		int norm);
-

- -data is the same buffer previously used in the video encoding.

- -input_samples is interleaved, 16 bit, twos complement, native -byte order, audio in the number of channels specified by -channels.

- -max_samples is the number of samples in the input_samples -buffer. There should be at least 4096 samples in the buffer.

- -channels specifies the number of channels in the interleaved -buffer. This matches the number of channels encoded in the DV frame. -The DV standard allows 2 to 4 channels, depending on bits and -rate.

- -bits, rate specify the encoding of the audio in the DV frame.

- -The norm can be DV_NTSC or DV_PAL.

- -This function returns the number of samples actually encoded in the -frame. This is usually less than the max_samples argument but -is not constant. It is up to the user to reuse the remaining samples -in the next frame.

- - - - - - - - - - diff --git a/cinelerra-5.0/quicktime/docs/index.html b/cinelerra-5.0/quicktime/docs/index.html deleted file mode 100644 index a0445eca..00000000 --- a/cinelerra-5.0/quicktime/docs/index.html +++ /dev/null @@ -1,88 +0,0 @@ -Quicktime for Linux - -

Quicktime for Linux

-

- -by

- -HEROINE VIRTUAL LTD.

- - -Homepage: heroinewarrior.com
-Harassment address: broadcast at earthling dot net
-

- - -Quicktime movies are first and foremost a very sophisticated wrapper -for 3rd party compression schemes. While not an officially sanctioned -Microsoft standard, it is well documented and pretty consistent. Once -a codec works in Quicktime, you can be sure it'll always work. With -Microsoft standards, the codec usage constantly changes over time.

- -Quicktime for Linux hides the structure of a Quicktime movie and gives -the programmer a set of audio and video streams with some compression -ability. The audio tracks are presented as sequential streams of PCM -audio data and video tracks are a sequential streams of frames.

- -Before you quit your day job and write up your dream program on this be -aware of some limitations. Quicktime for Linux is slowly increasing in -functionality but is always going to be better at uncompressed streams -than anything else.

- -This library doesn't give you the official Quicktime API. That was way -too complicated and covered more than we needed. Instead it uses a -proprietary C interface.

- -The library doesn't include any commercial codecs or compressed header -support. Compressed header support may come in a later version.

- -There is growing support for McRosoft AVI. This format is lousy at -uncompressed streams and not consistent so the AVI support is mainly -for karma.

- -What you can do is create and read any Quicktime movie using certain -compression formats. You can still access raw data if you want to -write your own compression routines.

- -Quicktime for Linux doesn't use plugins to achieve -functionality. The library is always updated more frequently than the -codecs. Plugins are more convenient when the library is only available -on hard media or requires upgrade licenses for every download, which it -doesn't.

- -

Contents

- -Here we cover the usage for accessing Quicktime files.

- -License

- -Step 1: Building the library

- -Opening a file

- -Reading a file - -

-Decoding Video
-Reading raw video
-Reading keyframes
-Reading raw audio
-
-

- -Positioning in a file

- -Writing a file

-

-Encoding Video
-Encoding Audio
-Writing raw video
-Writing keyframes
-Writing raw audio
-
- -Information about specific codecs

- -Integrated DV support

- -Using the utilities

diff --git a/cinelerra-5.0/quicktime/docs/license.html b/cinelerra-5.0/quicktime/docs/license.html deleted file mode 100644 index d4e4a9aa..00000000 --- a/cinelerra-5.0/quicktime/docs/license.html +++ /dev/null @@ -1,52 +0,0 @@ -Quicktime for Linux - - - - - -

GNU Lesser General Public License

-

- - -The terms of the GNU Lesser General Public License apply to everything -except libdv and libraw. You can statically link the -rest in a program and charge money for the program. The only condition -is that if you use it in a program, you must put the author's name and -email somewhere. If you improve the library itself or add a free codec -to it, you should release your improvements. If you redistribute the -code, you must also redistribute the author information and -documentation. You are free to include this library in a derived work -and license the derived work under GPL.

- - - -In addition to the LGPL's warranty stipulation, quicktime4linux is -distributed WITHOUT GUARANTEED SUPPORT; without even the guarantee of -ADDITIONAL LABOR. Support that is not guaranteed includes technical -support, compiler troubleshooting, debugging, version matching, -updating, among other additional labor which may or may not be required -to meet a user's requirements.

- - - - - - -

-
-
-This library is free software; you can redistribute it and/or modify it
-under the terms of the GNU Lesser General Public License as published
-by the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This library is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 
-USA
-
diff --git a/cinelerra-5.0/quicktime/docs/opening.html b/cinelerra-5.0/quicktime/docs/opening.html
deleted file mode 100644
index 3d2c4005..00000000
--- a/cinelerra-5.0/quicktime/docs/opening.html
+++ /dev/null
@@ -1,54 +0,0 @@
-Opening
-
-
-

Step 1: Open the file

- - -The first step in any Quicktime operation is to open the file. Include -the Quicktime header:

- - -#include <quicktime.h> -

- -create a quicktime pointer:

- - -quicktime_t *file;

- - -and open the file in read or write mode. The following code opens -a file in read only:

- - -file = quicktime_open("test.mov", 1, 0));

-

- -Argument 1 is the path to a file. Argument 2 is a flag for read -access. Argument 3 is a flag for write access. You can specify read -or write access by setting these flags. Never specify read and -write.

- -quicktime_open returns a NULL if the file couldn't be opened or the -format couldn't be recognized. Now you can do all sorts of operations -on the file.

- - -When you're done using the file, call

- - -quicktime_close(quicktime_t *file);
-
- - -

NOTE FOR AVI FILES:

- - -In read mode call quicktime_is_avi to see if the file is -AVI.

- -The procedure for writing an AVI file is described in writing.

-

-

- diff --git a/cinelerra-5.0/quicktime/docs/positioning.html b/cinelerra-5.0/quicktime/docs/positioning.html deleted file mode 100644 index c5ab359d..00000000 --- a/cinelerra-5.0/quicktime/docs/positioning.html +++ /dev/null @@ -1,34 +0,0 @@ -Positioning - -

Positioning yourself in a file

- -The library stores a seperate position identifier for each video track -and each audio track in a file. The position identifiers are -independant of each other and advance independantly when you read -data. Video tracks advance independantly, but audio tracks are -tricky. When you read audio data, the channel positions are not -independant. Since all the channels are on track 0, reading audio data -advances all the channel positions. You need to manually set the audio -position every time you want to read a different audio channel.

- -There is no positioning support while writing because this is write-only.

- -The positioning routines are as follows:

- - -int quicktime_seek_end(quicktime_t *file);
-int quicktime_seek_start(quicktime_t *file);
-int quicktime_set_audio_position(quicktime_t *file, long sample, int track);
-int quicktime_set_video_position(quicktime_t *file, long frame, int track);
-
-

- -The seek_end and seek_start seek all tracks to their ends or starts. -The set_position commands seek one track to the desired position. The -track parameter for audio is always going to be 0.

- - - - - - diff --git a/cinelerra-5.0/quicktime/docs/reading.html b/cinelerra-5.0/quicktime/docs/reading.html deleted file mode 100644 index 55906731..00000000 --- a/cinelerra-5.0/quicktime/docs/reading.html +++ /dev/null @@ -1,323 +0,0 @@ -Reading - -

Reading a file

- -Most users simply want read access for a player toy or something. A -good place to start is before opening the file, making sure it is -Quicktime with quicktime_check_sig().

- - -quicktime_check_sig("path");

- - -This returns 1 if it looks like a Quicktime file or 0 if it doesn't. -Then you can open the file as described in opening.html.

- -Next get the number of tracks for each media type in the file:

- - -int quicktime_video_tracks(quicktime_t *file);
-int quicktime_audio_tracks(quicktime_t *file); -
-

- - -While Quicktime can store multiple video tracks, the audio track count -is a bit more complicated. Usually you'll only encounter a single -audio track. Inside the audio track is a variable number of channels. -To get the channel count call:

- - -int quicktime_track_channels(quicktime_t *file, int track); - -

- -With the track parameter set to track 0. Many routines require a -track parameter to specify the track to operate on. Tracks are -always numbered from 0 to the total number of tracks - 1 for the -particular media type.

- -Audio tracks are numbered from 0 to the total number of audio tracks - -1. But like I said, you'll probably never encounter an audio track -higher than 0. Other routines you might find useful for getting audio -information are:

- - -long quicktime_sample_rate(quicktime_t *file, int track);
-long quicktime_audio_length(quicktime_t *file, int track);
-
-

- -quicktime_audio_length gives you the total number of samples. The -sample rate is samples per second.

- -Routines you'll never use unless you want to write a codec are:

- - -char* quicktime_audio_compressor(quicktime_t *file, int track);
-int quicktime_audio_bits(quicktime_t *file, int track);
-
-

- -The audio compressor call returns a 4 byte array identifying the data -compression of the track. These identifiers are 4 alphanumeric -characters which go along with one of the #defines in quicktime.h. The -bits function returns the number of bits in a sample, usually -meaningless.

- -The most interesting contents of a Quicktime file are of course the -video tracks. Quicktime stores multiple video tracks.

- -The available queries for each video track are:

- - - -long quicktime_video_length(quicktime_t *file, int track);
-int quicktime_video_width(quicktime_t *file, int track);
-int quicktime_video_height(quicktime_t *file, int track);
-float quicktime_frame_rate(quicktime_t *file, int track);
-long quicktime_frame_size(quicktime_t *file, long frame, int track);
-int quicktime_video_depth(quicktime_t *file, int track);
-quicktime_reads_cmodel(quicktime_t *file, - int colormodel, - int track);
-
-

- - - -Tracks are numbered 0 to the total number of tracks - 1. The video -length is in frames. The width and height are in pixels. The frame -rate is in frames per second. Depth returns the total number of bits -per pixel. The only two values Quicktime for Linux returns are 24 and -32 and the 32 bit depth is only returned when the format has an alpha -channel. There's no reason to use 16 or 8.

- -quicktime_reads_cmodel allows you to determine the optimum -color model for decompression output. It requires a colormodel #define -from colormodels.h. If the codec can generate the desired colormodel -without downsampling it returns 1. If downsampling is required it -returns 0. You can assume all colormodels in colormodels.h are -supported, whether they require downsampling or not.

- -To get the four byte compressor type for the track issue:

- - -char* quicktime_video_compressor(quicktime_t *file, int track);
-
-

- -Unless you get a really nihilistic file for reading, you can safely -assume the encoding scheme for track 0 of audio or video is the same -for all tracks.

- - -

Decoding video

- -The library decodes compressed video frames into a buffer in whatever -colormodel you desire but before then you should issue

- - -int quicktime_supported_video(quicktime_t *file, int track);
-
-

- -to find out if the data for the track can be decoded by the library. -This returns 1 if it is and 0 if it isn't supported.

- -Then use

- - -

-long quicktime_decode_video(quicktime_t *file, 
-	unsigned char **row_pointers, 
-	int track);
-
- -

- -to decompress a frame at the current position of the track into -**row_pointers and advance the current position. The -array of rows must have enough space allocated for the entire frame, -depending on the colormodel. Planar colormodels use only the first 3 -row pointers, each pointing to one of the planes.

- -Several parameters determine the decoder output. They may be set -before the call to quicktime_decode_video.

- - -

-void quicktime_set_cmodel(quicktime_t *file, int colormodel);
-
- -

- -Set the colormodel of the output frame to a value in colormodels.h. -The default is BC_RGB888.

- - -

-void quicktime_set_row_span(quicktime_t *file, int row_span);
-
- -

- -Set the number of bytes in a row. The default is the row width * bytes -per pixel.

- - -

-void quicktime_set_window(quicktime_t *file,
-	int in_x,                    /* Location of input frame to take picture */
-	int in_y,
-	int in_w,
-	int in_h,
-	int out_w,                   /* Dimensions of output frame */
-	int out_h);
-
- -

- - - -The decoder "sees" a region of the movie screen defined by in_x, -in_y, in_w, in_h and transfers it to the frame buffer defined by -**row_pointers. The size of the frame buffer is defined -by out_w, out_h. The default is a 1:1 transfer from the -codec to the output frame.

- - -For more about the track's current position go to positioning

- - - - - - - -

RAW ACCESS

- - -There are other routines for reading compressed data and chunks without -a codec. These allow you to perform direct copying of video data from -one movie to the other after editing it, without recompressing it.

- - -

Decoding audio

- -For reading audio, first use:

- - -int quicktime_supported_audio(quicktime_t *file, int track);
-
-

- -To determine if the audio can be decompressed by the library. This -returns 1 if it is and 0 if it isn't supported. Then use

- - -int quicktime_decode_audio(quicktime_t *file, int16_t *output_i, float *output_f, long samples, int channel);
-
-

- - -To read a buffer's worth of samples for a single channel starting at -the current position in the track. Notice this command takes a channel -argument not a track argument. The channel argument is automatically -converted into a track and channel. Positioning information is -automatically taken from the appropriate track and advanced for all the -channels in the track.

- -Notice the int16_t* and float* parameters. This call can -either return a buffer of int16 samples or float samples. The argument -for the data format you want should be passed a preallocated buffer big -enough to contain the sample range while the undesired format should be -passed NULL. For a buffer of float samples you would say

- - -result = quicktime_decode_audio(file, NULL, output_f, samples, channel);
-
-

- -For a buffer of signed int16 samples you would say

- - -result = quicktime_decode_audio(file, output_i, NULL, samples, channel);
-
-

- -The data format you don't want should be passed a NULL. The decoder -automatically fills the appropriate buffer. Floating point samples are -from -1 to 0 to 1.

- - - -

Reading raw video

- - -long quicktime_read_frame(quicktime_t *file, unsigned char *video_buffer, int track); - -

- -quicktime_read_frame reads one frame worth of raw data from your -current position on the specified video track and returns the number of -bytes in the frame. You have to make sure the buffer is big enough for -the frame. A return value of 0 means error.

- - -long quicktime_frame_size(quicktime_t *file, long frame, int track); - -

- -gives up the number of bytes in the specified frame in the specified -track even if you haven't read the frame yet. Frame numbers start on -0.

- - -

Accessing Keyframes

- -Quicktime offers very simple support for keyframes: a table of all the -keyframe numbers in a track. There are two things you can do with the -keyframe table: insert keyframe numbers and retrieve keyframe -numbers.

- - -long quicktime_get_keyframe_before(quicktime_t *file, long frame, int track) - -

- -Gets the keyframe number before the frame argument. The frames -start on 0.

- - -long quicktime_get_keyframe_after(quicktime_t *file, long frame, int track); - -

- -Gets the keyframe number after the frame argument. The frames -start on 0.

- - - -void quicktime_insert_keyframe(quicktime_t *file, long frame, int track) - -

- -Inserts a keyframe into the table. The frame argument starts on 0.

- - -int quicktime_has_keyframes(quicktime_t *file, int track); - -

- -Returns TRUE if the track has keyframes. The track starts on 0.

- - - -

Reading raw audio

- -There is no simple read or write access to raw audio. Due to vagaries -in the audio indexing and the lack of benefit in direct audio copying, -you're better off using a codec.

diff --git a/cinelerra-5.0/quicktime/docs/util.html b/cinelerra-5.0/quicktime/docs/util.html deleted file mode 100644 index 08946b9d..00000000 --- a/cinelerra-5.0/quicktime/docs/util.html +++ /dev/null @@ -1,18 +0,0 @@ -Quicktime for Linux - -

Utilities

- -Doing make util builds several small utilities.

- - -dump loads a quicktime movie and dumps the contents of Quicktime -for Linux's tables, including the fields which aren't used.

- -qtinfo dumps some formatted information about a movie.

- -make_streamable copies a movie to a new movie which can be -played before it is completely downloaded.

- -dechunk If a video track is present, this dumps every frame into -a separate file. If the video uses RAW compression, every frame is -dumped into a ppm file.

diff --git a/cinelerra-5.0/quicktime/docs/writing.html b/cinelerra-5.0/quicktime/docs/writing.html deleted file mode 100644 index d3ae035d..00000000 --- a/cinelerra-5.0/quicktime/docs/writing.html +++ /dev/null @@ -1,215 +0,0 @@ -Quicktime for Linux - -

Writing a file

- - -The following commands are good for writing to a file.

- -Immediately after opening the file, set up some tracks to write with -these commands:

- - - quicktime_set_audio(quicktime_t *file, int channels, long sample_rate, int bits, char *compressor);
- quicktime_set_video(quicktime_t *file, int tracks, int frame_w, int frame_h, float frame_rate, char *compressor); -

- -Don't call the audio command if you don't intend to store any audio -data. Likewise, don't call the video command if you're just going to -save audio.

- -Notice the channels argument for audio channels but there is no -argument for total audio tracks. Currently the library only supports -writing one audio track of any number of channels.

- -If you intend to use the library's built-in compression routines -specify a compressor #define from quicktime.h as the compressor -argument. If you want to write your own compression routine, specify -any 4 byte identifier you want but don't expect the library to handle -compression. The compressor applies to all tracks of the same media -type, for sanity reasons.

- -Once these routines are called you can optionally call

- - - -void quicktime_set_parameter(quicktime_t *file, char *key, void *value);

-

- -to set compression parameters for the codecs. Each parameter for a -codec consists of a unique string and a pointer to a value. The string -is unique to the codec and the parameter. The value is in a specific -data type recognized by the parameter.

- -To set a jpeg compression quality of 80, for example, do the following:

- - -int quality = 80;
-quicktime_set_parameter(file, "jpeg_quality", &quality);
-

- -The data type of the value depends on the parameter. Currently the -best way to determine what parameters and value data types a particular -codec supports is to look at the codec's source code. A better way may -become available in the future.

- -If you don't call quicktime_set_parameter the codecs will use default -parameters.

- - -

NOTE FOR AVI FILES

- -After the above sequence and only after it, call -quicktime_set_avi to make the library generate an AVI -file.

- - - - - - - -

Encoding video

- -The library generates compressed video frames from a frame buffer of -any colormodel in colormodels.h. First use

- - -int quicktime_supported_video(quicktime_t *file, int track); -

- -to find out if the codec for the track is in the library. This returns -1 if it is and 0 if it isn't supported. Then use

- - -int quicktime_writes_cmodel(quicktime_t *file, - int colormodel, - int track); -

- -To query the library for a colormodel which doesn't require -downsampling to drive the codec. colormodels.h contains a set -of colormodel #defines which supply the colormodel argument. The -function returns True or False depending on whether the colormodel -argument is optimum. When a colormodel doesn't require downsampling it -returns 1. Then call

- -quicktime_set_cmodel(quicktime_t *file, int colormodel);

- -to set the colormodel your frame buffer is in. Finally call - -

- int quicktime_encode_video(quicktime_t *file, unsigned char **row_pointers, int track); -

- - -to compress the frame pointed to by **row_pointers, write it at the -current position of the track and advance the current position. The -return value is always 1 for failure and 0 for success. The row -pointers must point to rows stored in the colormodel. Planar -colormodels use only the first 3 row pointers, each pointing to one of -the planes.

- - - - - - - - - - -

Encoding audio

- -The library also supports encoding certain audio codecs. Before -writing a buffer of samples, try

- - -int quicktime_supported_audio(quicktime_t *file, int track); - -

- -The track argument is really hypothetical here, since you should only -pass 0 for it. If you get a TRUE return value, you are free to use - -

-int quicktime_encode_audio(quicktime_t *file, int16_t **input_i, float **input_f, long samples); -

- -to encode the sample buffer. Pass an array of buffers to either the -int16_t** or the float** argument, depending on what format your data -is in. Pass a NULL to the undesired format. The array of buffers is -one buffer of samples for each channel. This means all the channels -have to be written simultaneously. The return value is 0 on success. -

- - - -

Writing raw video

- -For writing raw data, you need to supply a buffer of data exactly as -you intend the read operations to see it, with the encoding done, then -call one of these functions to write it. For video, specify the number -of bytes in the frame buffer and the track this frame belongs to. -Video can only be written one frame at a time. - -

-int quicktime_write_frame(quicktime_t *file, unsigned char *video_buffer, long bytes, int track); -

- - - -Now some of you are going to want to write frames directly to a file -descriptor using another library like libjpeg or something. For every -frame start by calling quicktime_write_frame_init to initialize the -output.

- - -int quicktime_write_frame_init(quicktime_t *file, int track); -

- -Then write your raw, compressed data to the file descriptor given by -quicktime_get_fd.

- - -FILE* quicktime_get_fd(quicktime_t *file); -

- -End the frame by calling quicktime_write_frame_end.

- - -int quicktime_write_frame_end(quicktime_t *file, int track); -

- -Repeat starting at quicktime_write_frame_init for every frame. - - -

Writing Keyframes

- -Quicktime offers very simple support for keyframes: a table of all the -keyframe numbers in a track. Many students think there's a massive -keyframe programming language in Quicktime. Really all there is is a -table.

- -There are two things you can with the keyframe table: insert keyframe -numbers and retrieve keyframe numbers.

- - -void quicktime_insert_keyframe(quicktime_t *file, long frame, int track) - -

- -Inserts a keyframe number corresponding to the frame argument in -the table.

- - -

Writing raw audio data

- -This functionality is obsolete due to the idiosyncracies in compressed -audio handling. If you want to write uncompressed audio, use the -twos codec.

- -When you're done, call quicktime_close to close the file.

- - -int quicktime_close(file); - diff --git a/cinelerra-5.0/quicktime/dref.c b/cinelerra-5.0/quicktime/dref.c deleted file mode 100644 index 674b08ac..00000000 --- a/cinelerra-5.0/quicktime/dref.c +++ /dev/null @@ -1,132 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" -#include - -void quicktime_dref_table_init(quicktime_dref_table_t *table) -{ - table->size = 0; - table->type[0] = 'a'; - table->type[1] = 'l'; - table->type[2] = 'i'; - table->type[3] = 's'; - table->version = 0; - table->flags = 0x0001; - table->data_reference = malloc(256); - table->data_reference[0] = 0; -} - -void quicktime_dref_table_delete(quicktime_dref_table_t *table) -{ - if(table->data_reference) free(table->data_reference); - table->data_reference = 0; -} - -void quicktime_read_dref_table(quicktime_t *file, quicktime_dref_table_t *table) -{ - table->size = quicktime_read_int32(file); - quicktime_read_char32(file, table->type); - table->version = quicktime_read_char(file); - table->flags = quicktime_read_int24(file); - if(table->data_reference) free(table->data_reference); - - table->data_reference = malloc(table->size); - if(table->size > 12) - quicktime_read_data(file, table->data_reference, table->size - 12); - table->data_reference[table->size - 12] = 0; -} - -void quicktime_write_dref_table(quicktime_t *file, quicktime_dref_table_t *table) -{ - int len = strlen(table->data_reference); - quicktime_write_int32(file, 12 + len); - quicktime_write_char32(file, table->type); - quicktime_write_char(file, table->version); - quicktime_write_int24(file, table->flags); - if(len) - quicktime_write_data(file, table->data_reference, len); -} - -void quicktime_dref_table_dump(quicktime_dref_table_t *table) -{ - printf(" data reference table (dref)\n"); - printf(" type %c%c%c%c\n", table->type[0], table->type[1], table->type[2], table->type[3]); - printf(" version %d\n", table->version); - printf(" flags %ld\n", table->flags); - printf(" data %s\n", table->data_reference); -} - - -void quicktime_dref_init(quicktime_dref_t *dref) -{ - dref->version = 0; - dref->flags = 0; - dref->total_entries = 0; - dref->table = 0; -} - -void quicktime_dref_init_all(quicktime_dref_t *dref) -{ - if(!dref->total_entries) - { - dref->total_entries = 1; - dref->table = (quicktime_dref_table_t *)malloc(sizeof(quicktime_dref_table_t) * dref->total_entries); - quicktime_dref_table_init(&(dref->table[0])); - } -} - -void quicktime_dref_delete(quicktime_dref_t *dref) -{ - if(dref->table) - { - int i; - for(i = 0; i < dref->total_entries; i++) - quicktime_dref_table_delete(&(dref->table[i])); - free(dref->table); - } - dref->total_entries = 0; -} - -void quicktime_dref_dump(quicktime_dref_t *dref) -{ - int i; - - printf(" data reference (dref)\n"); - printf(" version %d\n", dref->version); - printf(" flags %ld\n", dref->flags); - for(i = 0; i < dref->total_entries; i++) - { - quicktime_dref_table_dump(&(dref->table[i])); - } -} - -void quicktime_read_dref(quicktime_t *file, quicktime_dref_t *dref) -{ - int i; - - dref->version = quicktime_read_char(file); - dref->flags = quicktime_read_int24(file); - dref->total_entries = quicktime_read_int32(file); - dref->table = (quicktime_dref_table_t*)malloc(sizeof(quicktime_dref_table_t) * dref->total_entries); - for(i = 0; i < dref->total_entries; i++) - { - quicktime_dref_table_init(&(dref->table[i])); - quicktime_read_dref_table(file, &(dref->table[i])); - } -} - -void quicktime_write_dref(quicktime_t *file, quicktime_dref_t *dref) -{ - int i; - quicktime_atom_t atom; - quicktime_atom_write_header(file, &atom, "dref"); - - quicktime_write_char(file, dref->version); - quicktime_write_int24(file, dref->flags); - quicktime_write_int32(file, dref->total_entries); - - for(i = 0; i < dref->total_entries; i++) - { - quicktime_write_dref_table(file, &(dref->table[i])); - } - quicktime_atom_write_footer(file, &atom); -} diff --git a/cinelerra-5.0/quicktime/dump.c b/cinelerra-5.0/quicktime/dump.c deleted file mode 100644 index 09e84e6f..00000000 --- a/cinelerra-5.0/quicktime/dump.c +++ /dev/null @@ -1,29 +0,0 @@ -#include "quicktime.h" - - - - - - - -main(int argc, char *argv[]) -{ - quicktime_t *file; - int result = 0; - - if(argc < 2) - { - printf("Dump all tables in movie.\n"); - exit(1); - } - - if(!(file = quicktime_open(argv[1], 1, 0))) - { - printf("Open failed\n"); - exit(1); - } - - quicktime_dump(file); - - quicktime_close(file); -} diff --git a/cinelerra-5.0/quicktime/edts.c b/cinelerra-5.0/quicktime/edts.c deleted file mode 100644 index 206eab40..00000000 --- a/cinelerra-5.0/quicktime/edts.c +++ /dev/null @@ -1,46 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" - -void quicktime_edts_init(quicktime_edts_t *edts) -{ - quicktime_elst_init(&(edts->elst)); -} - -void quicktime_edts_delete(quicktime_edts_t *edts) -{ - quicktime_elst_delete(&(edts->elst)); -} - -void quicktime_edts_init_table(quicktime_edts_t *edts) -{ - quicktime_elst_init_all(&(edts->elst)); -} - -void quicktime_read_edts(quicktime_t *file, quicktime_edts_t *edts, quicktime_atom_t *edts_atom) -{ - quicktime_atom_t leaf_atom; - - do - { - quicktime_atom_read_header(file, &leaf_atom); -//printf("quicktime_read_edts %llx %llx\n", quicktime_position(file), leaf_atom.end); - if(quicktime_atom_is(&leaf_atom, "elst")) - { quicktime_read_elst(file, &(edts->elst)); } - else - quicktime_atom_skip(file, &leaf_atom); - }while(quicktime_position(file) < edts_atom->end); -} - -void quicktime_edts_dump(quicktime_edts_t *edts) -{ - printf(" edit atom (edts)\n"); - quicktime_elst_dump(&(edts->elst)); -} - -void quicktime_write_edts(quicktime_t *file, quicktime_edts_t *edts, long duration) -{ - quicktime_atom_t atom; - quicktime_atom_write_header(file, &atom, "edts"); - quicktime_write_elst(file, &(edts->elst), duration); - quicktime_atom_write_footer(file, &atom); -} diff --git a/cinelerra-5.0/quicktime/elst.c b/cinelerra-5.0/quicktime/elst.c deleted file mode 100644 index 51610e2d..00000000 --- a/cinelerra-5.0/quicktime/elst.c +++ /dev/null @@ -1,112 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" - - -void quicktime_elst_table_init(quicktime_elst_table_t *table) -{ - table->duration = 0; - table->time = 0; - table->rate = 1; -} - -void quicktime_elst_table_delete(quicktime_elst_table_t *table) -{ -} - -void quicktime_read_elst_table(quicktime_t *file, quicktime_elst_table_t *table) -{ - table->duration = quicktime_read_int32(file); - table->time = quicktime_read_int32(file); - table->rate = quicktime_read_fixed32(file); -} - -void quicktime_write_elst_table(quicktime_t *file, quicktime_elst_table_t *table, long duration) -{ - table->duration = duration; - quicktime_write_int32(file, table->duration); - quicktime_write_int32(file, table->time); - quicktime_write_fixed32(file, table->rate); -} - -void quicktime_elst_table_dump(quicktime_elst_table_t *table) -{ - printf(" edit list table\n"); - printf(" duration %ld\n", table->duration); - printf(" time %ld\n", table->time); - printf(" rate %f\n", table->rate); -} - -void quicktime_elst_init(quicktime_elst_t *elst) -{ - elst->version = 0; - elst->flags = 0; - elst->total_entries = 0; - elst->table = 0; -} - -void quicktime_elst_init_all(quicktime_elst_t *elst) -{ - if(!elst->total_entries) - { - elst->total_entries = 1; - elst->table = (quicktime_elst_table_t*)calloc(1, sizeof(quicktime_elst_table_t) * elst->total_entries); - quicktime_elst_table_init(&(elst->table[0])); - } -} - -void quicktime_elst_delete(quicktime_elst_t *elst) -{ - int i; - if(elst->total_entries) - { - for(i = 0; i < elst->total_entries; i++) - quicktime_elst_table_delete(&(elst->table[i])); - free(elst->table); - } - elst->total_entries = 0; -} - -void quicktime_elst_dump(quicktime_elst_t *elst) -{ - int i; - printf(" edit list (elst)\n"); - printf(" version %d\n", elst->version); - printf(" flags %ld\n", elst->flags); - printf(" total_entries %ld\n", elst->total_entries); - - for(i = 0; i < elst->total_entries; i++) - { - quicktime_elst_table_dump(&(elst->table[i])); - } -} - -void quicktime_read_elst(quicktime_t *file, quicktime_elst_t *elst) -{ - int i; - elst->version = quicktime_read_char(file); - elst->flags = quicktime_read_int24(file); - elst->total_entries = quicktime_read_int32(file); - elst->table = (quicktime_elst_table_t*)calloc(1, sizeof(quicktime_elst_table_t) * elst->total_entries); - for(i = 0; i < elst->total_entries; i++) - { - quicktime_elst_table_init(&(elst->table[i])); - quicktime_read_elst_table(file, &(elst->table[i])); - } -} - -void quicktime_write_elst(quicktime_t *file, quicktime_elst_t *elst, long duration) -{ - quicktime_atom_t atom; - int i; - quicktime_atom_write_header(file, &atom, "elst"); - - quicktime_write_char(file, elst->version); - quicktime_write_int24(file, elst->flags); - quicktime_write_int32(file, elst->total_entries); - for(i = 0; i < elst->total_entries; i++) - { - quicktime_write_elst_table(file, elst->table, duration); - } - - quicktime_atom_write_footer(file, &atom); -} diff --git a/cinelerra-5.0/quicktime/esds.c b/cinelerra-5.0/quicktime/esds.c deleted file mode 100644 index c9528183..00000000 --- a/cinelerra-5.0/quicktime/esds.c +++ /dev/null @@ -1,236 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" - - -static int decode_length(quicktime_t *file) -{ - int bytes = 0; - int result = 0; - int byte; - do - { - byte = quicktime_read_char(file); - result = (result << 7) + (byte & 0x7f); - bytes++; - }while((byte & 0x80) && bytes < 4); - return result; -} - -void quicktime_delete_esds(quicktime_esds_t *esds) -{ - if(esds->mpeg4_header) free(esds->mpeg4_header); -} - -void quicktime_esds_samplerate(quicktime_stsd_table_t *table, - quicktime_esds_t *esds) -{ -// Straight out of ffmpeg - if(esds->mpeg4_header_size > 1 && - quicktime_match_32(table->format, QUICKTIME_MP4A)) - { - static int samplerate_table[] = - { - 96000, 88200, 64000, 48000, 44100, 32000, - 24000, 22050, 16000, 12000, 11025, 8000, - 7350, 0, 0, 0 - }; - - unsigned char *ptr = (unsigned char *)esds->mpeg4_header; - int samplerate_index = ((ptr[0] & 7) << 1) + ((ptr[1] >> 7) & 1); - table->channels = (ptr[1] >> 3) & 0xf; - table->sample_rate = - samplerate_table[samplerate_index]; -// Faad decodes 1/2 the requested samplerate if the samplerate is <= 22050. - } -} - -void quicktime_read_esds(quicktime_t *file, - quicktime_atom_t *parent_atom, - quicktime_esds_t *esds) -{ - -// version - quicktime_read_char(file); -// flags - quicktime_read_int24(file); -// elementary stream descriptor tag - - if(quicktime_read_char(file) == 0x3) - { - decode_length(file); - quicktime_read_int16(file); // elementary stream id - quicktime_read_char(file); // stream priority -// decoder configuration descripton tab - if(quicktime_read_char(file) == 0x4) - { - decode_length(file); - quicktime_read_char(file); // object type id - quicktime_read_char(file); // stream type - quicktime_read_int24(file); // buffer size - quicktime_read_int32(file); // max bitrate - quicktime_read_int32(file); // average bitrate - -// decoder specific description tag - if(quicktime_read_char(file) == 0x5) - { - esds->mpeg4_header_size = decode_length(file); - if(!esds->mpeg4_header_size) return; - -// Need padding for FFMPEG - esds->mpeg4_header = calloc(1, - esds->mpeg4_header_size + 1024); -// Get extra data for decoder - quicktime_read_data(file, - esds->mpeg4_header, - esds->mpeg4_header_size); - -// skip rest - quicktime_atom_skip(file, parent_atom); - return; - } - else - { -// error - quicktime_atom_skip(file, parent_atom); - return; - } - } - else - { -// error - quicktime_atom_skip(file, parent_atom); - return; - } - } - else - { -// error - quicktime_atom_skip(file, parent_atom); - return; - } -} - - - -void quicktime_write_esds(quicktime_t *file, - quicktime_esds_t *esds, - int do_video, - int do_audio) -{ - quicktime_atom_t atom; - quicktime_atom_write_header(file, &atom, "esds"); -// version - quicktime_write_char(file, 0); -// flags - quicktime_write_int24(file, 0); - -// elementary stream descriptor tag - quicktime_write_char(file, 0x3); - -// length placeholder - int64_t length1 = quicktime_position(file); -// quicktime_write_int32(file, 0x80808080); - quicktime_write_char(file, 0x00); - -// elementary stream id - quicktime_write_int16(file, 0x1); - -// stream priority -/* - * if(do_video) - * quicktime_write_char(file, 0x1f); - * else - */ - quicktime_write_char(file, 0); - - -// decoder configuration description tab - quicktime_write_char(file, 0x4); -// length placeholder - int64_t length2 = quicktime_position(file); -// quicktime_write_int32(file, 0x80808080); - quicktime_write_char(file, 0x00); - -// video - if(do_video) - { -// object type id - quicktime_write_char(file, 0x20); -// stream type - quicktime_write_char(file, 0x11); -// buffer size -// quicktime_write_int24(file, 0x007b00); - quicktime_write_int24(file, 0x000000); -// max bitrate -// quicktime_write_int32(file, 0x00014800); - quicktime_write_int32(file, 0x000030d40); -// average bitrate -// quicktime_write_int32(file, 0x00014800); - quicktime_write_int32(file, 0x00000000); - } - else - { -// object type id - quicktime_write_char(file, 0x40); -// stream type - quicktime_write_char(file, 0x15); -// buffer size - quicktime_write_int24(file, 0x001800); -// max bitrate - quicktime_write_int32(file, 0x00004e20); -// average bitrate - quicktime_write_int32(file, 0x00003e80); - } - -// decoder specific description tag - quicktime_write_char(file, 0x05); -// length placeholder - int64_t length3 = quicktime_position(file); -// quicktime_write_int32(file, 0x80808080); - quicktime_write_char(file, 0x00); - -// mpeg4 sequence header - quicktime_write_data(file, esds->mpeg4_header, esds->mpeg4_header_size); - - - int64_t current_length2 = quicktime_position(file) - length2 - 1; - int64_t current_length3 = quicktime_position(file) - length3 - 1; - -// unknown tag, length and data - quicktime_write_char(file, 0x06); -// quicktime_write_int32(file, 0x80808001); - quicktime_write_char(file, 0x01); - quicktime_write_char(file, 0x02); - - -// write lengths - int64_t current_length1 = quicktime_position(file) - length1 - 1; - quicktime_atom_write_footer(file, &atom); - int64_t current_position = quicktime_position(file); -// quicktime_set_position(file, length1 + 3); - quicktime_set_position(file, length1); - quicktime_write_char(file, current_length1); -// quicktime_set_position(file, length2 + 3); - quicktime_set_position(file, length2); - quicktime_write_char(file, current_length2); -// quicktime_set_position(file, length3 + 3); - quicktime_set_position(file, length3); - quicktime_write_char(file, current_length3); - quicktime_set_position(file, current_position); -} - -void quicktime_esds_dump(quicktime_esds_t *esds) -{ - if(esds->mpeg4_header_size) - { - printf(" elementary stream description\n"); - printf(" mpeg4_header_size=0x%x\n", esds->mpeg4_header_size); - printf(" mpeg4_header="); - int i; - for(i = 0; i < esds->mpeg4_header_size; i++) - printf("%02x ", (unsigned char)esds->mpeg4_header[i]); - printf("\n"); - } -} - - diff --git a/cinelerra-5.0/quicktime/frma.c b/cinelerra-5.0/quicktime/frma.c deleted file mode 100644 index 4d6c4530..00000000 --- a/cinelerra-5.0/quicktime/frma.c +++ /dev/null @@ -1,51 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" - - -void quicktime_delete_frma(quicktime_frma_t *frma) -{ - if(frma->data) free(frma->data); -} - -int quicktime_read_frma(quicktime_t *file, - quicktime_atom_t *parent_atom, - quicktime_atom_t *leaf_atom, - quicktime_frma_t *frma) -{ - frma->data_size = parent_atom->size - 12; - frma->data = calloc(1, frma->data_size + 1024); - quicktime_set_position(file, parent_atom->start + 12); - quicktime_read_data(file, - frma->data, - frma->data_size); -/* - * printf("quicktime_read_frma %02x %02x %02x %02x %02x %02x %02x %02x\n", - * frma->data[0], - * frma->data[1], - * frma->data[2], - * frma->data[3], - * frma->data[4], - * frma->data[5], - * frma->data[6], - * frma->data[7]); - */ - quicktime_atom_skip(file, parent_atom); - return 0; -} - -void quicktime_frma_dump(quicktime_frma_t *frma) -{ - int i; - if(frma->data_size) - { - printf(" QDM2 description\n"); - printf(" data_size=0x%x\n", frma->data_size); - printf(" data="); - for(i = 0; i < frma->data_size; i++) - { - printf("0x%02x ", (unsigned char)frma->data[i]); - } - printf("\n"); - } -} - diff --git a/cinelerra-5.0/quicktime/funcprotos.h b/cinelerra-5.0/quicktime/funcprotos.h deleted file mode 100644 index b8cbcdb2..00000000 --- a/cinelerra-5.0/quicktime/funcprotos.h +++ /dev/null @@ -1,664 +0,0 @@ -#ifndef FUNCPROTOS_H -#define FUNCPROTOS_H - -#include "graphics.h" -#include "qtprivate.h" - -// Used internally to replace ftello values -int64_t quicktime_byte_position(quicktime_t *file); -int64_t quicktime_ftell(quicktime_t *file); -int quicktime_fseek(quicktime_t *file,int64_t offset); - -quicktime_trak_t* quicktime_add_track(quicktime_t *file); - - - -int quicktime_file_open(quicktime_t *file, char *path, int rd, int wr); -int quicktime_file_close(quicktime_t *file); -int64_t quicktime_get_file_length(char *path); - -/* Initialize audio_map_t and video_map_t objects after loading headers */ -/* Called by quicktime_read_info */ -void quicktime_init_maps(quicktime_t *file); - -int quicktime_read_char(quicktime_t *file); -float quicktime_read_fixed32(quicktime_t *file); -float quicktime_read_fixed16(quicktime_t *file); -int64_t quicktime_read_int64(quicktime_t *file); -int64_t quicktime_read_int64_le(quicktime_t *file); -unsigned long quicktime_read_uint32(quicktime_t *file); -long quicktime_read_int32(quicktime_t *file); -long quicktime_read_int32_le(quicktime_t *file); -long quicktime_read_int24(quicktime_t *file); -int64_t quicktime_position(quicktime_t *file); -int quicktime_set_position(quicktime_t *file, int64_t position); -int quicktime_write_fixed32(quicktime_t *file, float number); -int quicktime_write_char(quicktime_t *file, char x); -int quicktime_write_int16(quicktime_t *file, int number); -int quicktime_write_int16_le(quicktime_t *file, int number); -int quicktime_write_int24(quicktime_t *file, long number); -int quicktime_write_int32(quicktime_t *file, long value); -int quicktime_write_int32_le(quicktime_t *file, long value); -int quicktime_write_int64(quicktime_t *file, int64_t value); -int quicktime_write_int64_le(quicktime_t *file, int64_t value); -int quicktime_write_char32(quicktime_t *file, char *string); -int quicktime_write_fixed16(quicktime_t *file, float number); -int quicktime_read_int16(quicktime_t *file); -int quicktime_read_int16_le(quicktime_t *file); -void quicktime_copy_char32(char *output,char *input); -void quicktime_read_char32(quicktime_t *file,char *string); - -/* Returns number of bytes written */ -int quicktime_write_data(quicktime_t *file, char *data, int size); -/* Enable or disable presave */ -void quicktime_set_presave(quicktime_t *file, int value); -/* Returns 1 if equal or 0 if different */ -int quicktime_match_32(char *input, char *output); -int quicktime_match_24(char *input, char *output); -void quicktime_print_chars(char *desc,char *input,int len); -void quicktime_write_pascal(quicktime_t *file, char *data); -void quicktime_read_pascal(quicktime_t *file,char *data); -int quicktime_read_data(quicktime_t *file, char *data, int64_t size); -/* Quantize the number to the nearest multiple of 16 */ -/* Used by ffmpeg codecs */ -int quicktime_quantize2(int number); -int quicktime_quantize8(int number); -int quicktime_quantize16(int number); -int quicktime_quantize32(int number); - - - -/* Convert Microsoft audio id to codec */ -void quicktime_id_to_codec(char *result, int id); - -int quicktime_find_vcodec(quicktime_video_map_t *vtrack); -int quicktime_find_acodec(quicktime_audio_map_t *atrack); - - - - -/* Track functions */ - - -/* Most codecs don't specify the actual number of bits on disk in the stbl. */ -/* Convert the samples to the number of bytes for reading depending on the codec. */ -int64_t quicktime_samples_to_bytes(quicktime_trak_t *track, long samples); - -char* quicktime_compressor(quicktime_trak_t *trak); - -/* Get median duration of video frames for calculating frame rate. */ -int quicktime_sample_duration(quicktime_trak_t *trak); - -/* Graphics */ -quicktime_scaletable_t* quicktime_new_scaletable(int input_w, int input_h, int output_w, int output_h); - - - -/* chunks always start on 1 */ -/* samples start on 0 */ - -/* update the position pointers in all the tracks after a set_position */ -int quicktime_update_positions(quicktime_t *file); - - - - - - - -/* AVI section */ -void quicktime_read_strh(quicktime_t *file, quicktime_atom_t *parent_atom); -void quicktime_write_strh(quicktime_t *file, int track); - - - - -/* Create new strl object for reading or writing */ -quicktime_strl_t* quicktime_new_strl(); -/* Initialize new strl object for writing */ -void quicktime_init_strl(quicktime_t *file, - quicktime_audio_map_t *atrack, - quicktime_video_map_t *vtrack, - quicktime_trak_t *trak, - quicktime_strl_t *strl); -void quicktime_delete_strl(quicktime_strl_t *strl); -/* Read strl object */ -void quicktime_read_strl(quicktime_t *file, - quicktime_strl_t *strl, - quicktime_atom_t *parent_atom); - - -void quicktime_delete_indx(quicktime_indx_t *indx); -void quicktime_init_indx(quicktime_t *file, - quicktime_indx_t *indx, - quicktime_strl_t *strl); -void quicktime_update_indx(quicktime_t *file, - quicktime_indx_t *indx, - quicktime_ix_t *ix); -void quicktime_finalize_indx(quicktime_t *file); -/* Called by quicktime_read_strl */ -void quicktime_read_indx(quicktime_t *file, - quicktime_strl_t *strl, - quicktime_atom_t *parent_atom); - - - -void quicktime_delete_hdrl(quicktime_t *file, quicktime_hdrl_t *hdrl); -void quicktime_read_hdrl(quicktime_t *file, - quicktime_hdrl_t *hdrl, - quicktime_atom_t *parent_atom); -void quicktime_init_hdrl(quicktime_t *file, quicktime_hdrl_t *hdrl); -void quicktime_finalize_hdrl(quicktime_t *file, quicktime_hdrl_t *hdrl); - - -/* Read movi and create objects */ -void quicktime_delete_movi(quicktime_t *file, quicktime_movi_t *movi); -void quicktime_read_movi(quicktime_t *file, - quicktime_atom_t *parent_atom, - quicktime_movi_t *movi); -/* Write preliminary movi data and create objects */ -void quicktime_init_movi(quicktime_t *file, quicktime_riff_t *riff); -void quicktime_finalize_movi(quicktime_t *file, quicktime_movi_t *movi); - - - - - - -void quicktime_delete_idx1(quicktime_idx1_t *idx1); -void quicktime_read_idx1(quicktime_t *file, - quicktime_riff_t *riff, - quicktime_atom_t *parent_atom); -void quicktime_write_idx1(quicktime_t *file, - quicktime_idx1_t *idx1); -/* Set the keyframe flag in the right IDX1 entry. new_keyframes starts on 0 */ -/* Used by quicktime_insert_keyframe */ -void quicktime_set_idx1_keyframe(quicktime_t *file, - quicktime_trak_t *trak, - int new_keyframe); -/* Create new IDX1 entry. Used by quicktime_write_chunk_footer */ -void quicktime_update_idx1table(quicktime_t *file, - quicktime_trak_t *trak, - int offset, - int size); - - - - -void quicktime_read_odml(quicktime_t *file, quicktime_atom_t *parent_atom); -void quicktime_finalize_odml(quicktime_t *file, quicktime_hdrl_t *hdrl); -void quicktime_init_odml(quicktime_t *file, quicktime_hdrl_t *hdrl); - - - - - - - - -/* Create new riff and put on riff table */ -quicktime_riff_t* quicktime_new_riff(quicktime_t *file); -void quicktime_delete_riff(quicktime_t *file, quicktime_riff_t *riff); -void quicktime_read_riff(quicktime_t *file,quicktime_atom_t *parent_atom); - -/* Write riff header and initialize structures */ -/* Only the first riff has a hdrl object */ -void quicktime_init_riff(quicktime_t *file); -void quicktime_finalize_riff(quicktime_t *file, quicktime_riff_t *riff); -void quicktime_import_avi(quicktime_t *file); - - -/* Create ix object for writing only */ -quicktime_ix_t* quicktime_new_ix(quicktime_t *file, - quicktime_trak_t *trak, - quicktime_strl_t *strl); -void quicktime_delete_ix(quicktime_ix_t *ix); -void quicktime_update_ixtable(quicktime_t *file, - quicktime_trak_t *trak, - int64_t offset, - int size); -void quicktime_write_ix(quicktime_t *file, - quicktime_ix_t *ix, - int track); -/* Read entire ix atom from current position in file */ -/* Called by quicktime_read_indx. */ -void quicktime_read_ix(quicktime_t *file, - quicktime_ix_t *ix); - -/* the byte offset from mdat start of the chunk. Chunk is numbered from 1 */ -int64_t quicktime_chunk_to_offset(quicktime_t *file, quicktime_trak_t *trak, long chunk); - - -/* the chunk of any offset from mdat start */ -long quicktime_offset_to_chunk(int64_t *chunk_offset, - quicktime_trak_t *trak, int64_t offset); - -/* Bytes in the chunk. Chunk is numbered from 1 */ -/* Only available in AVI. */ -/* Reads the chunk header to get the size. */ -/* Stores the chunk offset in chunk_offset. */ -/* Returns the bytes in the chunk less the 8 byte header size */ -int quicktime_chunk_bytes(quicktime_t *file, - int64_t *chunk_offset, int chunk, quicktime_trak_t *trak); - -/* total bytes between the two samples */ -int64_t quicktime_sample_range_size(quicktime_trak_t *trak, - int64_t chunk_sample, int64_t sample); - -/* converting between mdat offsets to samples */ -int64_t quicktime_sample_to_offset(quicktime_t *file, quicktime_trak_t *trak, int64_t sample); -long quicktime_offset_to_sample(quicktime_trak_t *trak, int64_t offset); - - -void quicktime_write_chunk_header(quicktime_t *file, - quicktime_trak_t *trak, quicktime_atom_t *chunk); -void quicktime_write_chunk_footer(quicktime_t *file, - quicktime_trak_t *trak, int current_chunk, - quicktime_atom_t *chunk, int samples); - -/* Write VBR frame */ -int quicktime_write_vbr_frame(quicktime_t *file, int track, - char *data, int data_size, int samples); -/* update all the tables after writing a buffer */ -/* set sample_size to 0 if no sample size should be set */ -int quicktime_trak_duration(quicktime_trak_t *trak, long *duration, long *timescale); -int quicktime_trak_fix_counts(quicktime_t *file, quicktime_trak_t *trak); -int quicktime_sample_size(quicktime_trak_t *trak, int sample); - -/* number of samples in the chunk */ -long quicktime_chunk_samples(quicktime_trak_t *trak, long chunk); -int quicktime_trak_shift_offsets(quicktime_trak_t *trak, int64_t offset); - -int quicktime_get_timescale(double frame_rate); -unsigned long quicktime_current_time(void); - - -// Utility functions for decoding vbr audio codecs - -// init/delete buffers -void quicktime_init_vbr(quicktime_vbr_t *vbr,int channels); -void quicktime_clear_vbr(quicktime_vbr_t *vbr); -// next sample time at end of input/output buffer -int64_t quicktime_vbr_input_end(quicktime_vbr_t *vbr); -int64_t quicktime_vbr_output_end(quicktime_vbr_t *vbr); -// next input byte at input_buffer[inp_ptr] -unsigned char *quicktime_vbr_input(quicktime_vbr_t *vbr); -// bytes in quicktime_vbr_input data -int quicktime_vbr_input_size(quicktime_vbr_t *vbr); -// check max xfer size bounds -int quicktime_limit_samples(int samples); -// seek frame of sample_time, then backup offset frames -int quicktime_seek_vbr(quicktime_audio_map_t *atrack, int64_t start_time, int offset); -// shift input buffer down inp_ptr bytes -int quicktime_align_vbr(quicktime_audio_map_t *atrack, int64_t start_position); -// Append the next sample/frame of compressed data to the input buffer -int quicktime_read_vbr(quicktime_t *file,quicktime_audio_map_t *atrack); -// Shift the input buffer by adjusting inp_ptr += bytes -void quicktime_shift_vbr(quicktime_audio_map_t *atrack, int bytes); -// Put the frame of sample data in output and advance the counters -void quicktime_store_vbr_float(quicktime_audio_map_t *atrack, - float *samples, int sample_count); -void quicktime_store_vbr_floatp(quicktime_audio_map_t *atrack, - float **samples, int sample_count); -void quicktime_store_vbr_int16(quicktime_audio_map_t *atrack, - int16_t *samples, int sample_count); -// get the frame of sample data from output ring buffer -void quicktime_copy_vbr_float(quicktime_vbr_t *vbr, - int64_t start_position, int sample_count,float *output,int channel); -void quicktime_copy_vbr_int16(quicktime_vbr_t *vbr, - int64_t start_position, int samples,int16_t *output,int channel); - -// Frame caching for keyframed video. -quicktime_cache_t* quicktime_new_cache(); -void quicktime_cache_max(quicktime_cache_t *ptr, int bytes); -void quicktime_delete_cache(quicktime_cache_t *ptr); -void quicktime_reset_cache(quicktime_cache_t *ptr); -void quicktime_put_frame(quicktime_cache_t *ptr, int64_t frame_number, - unsigned char *y, unsigned char *u, unsigned char *v, - int y_size, int u_size, int v_size); -// Return 1 if the frame was found. -int quicktime_get_frame(quicktime_cache_t *ptr, int64_t frame_number, - unsigned char **y, unsigned char **u, unsigned char **v); -int quicktime_has_frame(quicktime_cache_t *ptr, - int64_t frame_number); -int64_t quicktime_cache_usage(quicktime_cache_t *ptr); - -/* matrix.c */ -void quicktime_matrix_init(quicktime_matrix_t *matrix); -void quicktime_matrix_delete(quicktime_matrix_t *matrix); -void quicktime_read_matrix(quicktime_t *file,quicktime_matrix_t *matrix); -void quicktime_matrix_dump(quicktime_matrix_t *matrix); -void quicktime_write_matrix(quicktime_t *file,quicktime_matrix_t *matrix); - -/* atom.c */ -int quicktime_atom_read_header(quicktime_t *file,quicktime_atom_t *atom); -int quicktime_atom_write_header64(quicktime_t *file,quicktime_atom_t *atom, - char *text); -int quicktime_atom_write_header(quicktime_t *file,quicktime_atom_t *atom, - char *text); -void quicktime_atom_write_footer(quicktime_t *file, quicktime_atom_t *atom); -int quicktime_atom_is(quicktime_atom_t *atom, char *type); -int quicktime_atom_skip(quicktime_t *file, quicktime_atom_t *atom); - -/* ctab.c */ -int quicktime_ctab_init(quicktime_ctab_t *ctab); -int quicktime_ctab_delete(quicktime_ctab_t *ctab); -void quicktime_ctab_dump(quicktime_ctab_t *ctab); -int quicktime_read_ctab(quicktime_t *file,quicktime_ctab_t *ctab); - -/* dref.c */ -void quicktime_dref_table_init(quicktime_dref_table_t *table); -void quicktime_dref_table_delete(quicktime_dref_table_t *table); -void quicktime_read_dref_table(quicktime_t *file,quicktime_dref_table_t *table); -void quicktime_write_dref_table(quicktime_t *file,quicktime_dref_table_t *table); -void quicktime_dref_table_dump(quicktime_dref_table_t *table); -void quicktime_dref_init(quicktime_dref_t *dref); -void quicktime_dref_init_all(quicktime_dref_t *dref); -void quicktime_dref_delete(quicktime_dref_t *dref); -void quicktime_dref_dump(quicktime_dref_t *dref); -void quicktime_read_dref(quicktime_t *file,quicktime_dref_t *dref); -void quicktime_write_dref(quicktime_t *file,quicktime_dref_t *dref); - -/* avcc.c */ -void quicktime_delete_avcc(quicktime_avcc_t *avcc); -void quicktime_set_avcc_header(quicktime_avcc_t *avcc,unsigned char *data,int size); -void quicktime_write_avcc(quicktime_t *file,quicktime_avcc_t *avcc); -int quicktime_read_avcc(quicktime_t *file,quicktime_atom_t *parent_atom, - quicktime_avcc_t *avcc); -void quicktime_avcc_dump(quicktime_avcc_t *avcc); - -/* esds.c */ -void quicktime_delete_esds(quicktime_esds_t *esds); -/* Get alternative mpeg4 parameters from esds table */ -void quicktime_esds_samplerate(quicktime_stsd_table_t *table, - quicktime_esds_t *esds); -void quicktime_read_esds(quicktime_t *file,quicktime_atom_t *parent_atom, - quicktime_esds_t *esds); -void quicktime_write_esds(quicktime_t *file,quicktime_esds_t *esds,int do_video - ,int do_audio); -void quicktime_esds_dump(quicktime_esds_t *esds); - -/* frma.c */ -void quicktime_delete_frma(quicktime_frma_t *frma); -int quicktime_read_frma(quicktime_t *file,quicktime_atom_t *parent_atom, - quicktime_atom_t *leaf_atom,quicktime_frma_t *frma); -void quicktime_frma_dump(quicktime_frma_t *frma); - -/* hdlr.c */ -void quicktime_hdlr_init(quicktime_hdlr_t *hdlr); -void quicktime_hdlr_init_video(quicktime_hdlr_t *hdlr); -void quicktime_hdlr_init_audio(quicktime_hdlr_t *hdlr); -void quicktime_hdlr_init_data(quicktime_hdlr_t *hdlr); -void quicktime_hdlr_delete(quicktime_hdlr_t *hdlr); -void quicktime_hdlr_dump(quicktime_hdlr_t *hdlr); -void quicktime_read_hdlr(quicktime_t *file,quicktime_hdlr_t *hdlr); -void quicktime_write_hdlr(quicktime_t *file,quicktime_hdlr_t *hdlr); - -/* avi_hdrl.c */ -void quicktime_delete_hdrl(quicktime_t *file,quicktime_hdrl_t *hdrl); -void quicktime_read_hdrl(quicktime_t *file,quicktime_hdrl_t *hdrl, - quicktime_atom_t *parent_atom); -void quicktime_init_hdrl(quicktime_t *file,quicktime_hdrl_t *hdrl); -void quicktime_finalize_hdrl(quicktime_t *file,quicktime_hdrl_t *hdrl); -/* elst.c */ -void quicktime_elst_table_init(quicktime_elst_table_t *table); -void quicktime_elst_table_delete(quicktime_elst_table_t *table); -void quicktime_read_elst_table(quicktime_t *file,quicktime_elst_table_t *table); -void quicktime_write_elst_table(quicktime_t *file,quicktime_elst_table_t *table, - long duration); -void quicktime_elst_table_dump(quicktime_elst_table_t *table); -void quicktime_elst_init(quicktime_elst_t *elst); -void quicktime_elst_init_all(quicktime_elst_t *elst); -void quicktime_elst_delete(quicktime_elst_t *elst); -void quicktime_elst_dump(quicktime_elst_t *elst); -void quicktime_read_elst(quicktime_t *file,quicktime_elst_t *elst); -void quicktime_write_elst(quicktime_t *file,quicktime_elst_t *elst, - long duration); - -/* mdhd.c */ -void quicktime_mdhd_init(quicktime_mdhd_t *mdhd); -void quicktime_mdhd_init_video(quicktime_t *file,quicktime_mdhd_t *mdhd, - int frame_w,int frame_h,float frame_rate); -void quicktime_mdhd_init_audio(quicktime_mdhd_t *mdhd,int sample_rate); -void quicktime_mdhd_delete(quicktime_mdhd_t *mdhd); -void quicktime_read_mdhd(quicktime_t *file,quicktime_mdhd_t *mdhd); -void quicktime_mdhd_dump(quicktime_mdhd_t *mdhd); -void quicktime_write_mdhd(quicktime_t *file,quicktime_mdhd_t *mdhd); - -/* minf.c */ -void quicktime_minf_init(quicktime_minf_t *minf); -void quicktime_minf_init_video(quicktime_t *file,quicktime_minf_t *minf, - int frame_w,int frame_h,int time_scale,float frame_rate,char *compressor); -void quicktime_minf_init_audio(quicktime_t *file,quicktime_minf_t *minf, - int channels,int sample_rate,int bits,char *compressor); -void quicktime_minf_delete(quicktime_minf_t *minf); -void quicktime_minf_dump(quicktime_minf_t *minf); -int quicktime_read_minf(quicktime_t *file,quicktime_minf_t *minf, - quicktime_atom_t *parent_atom); -void quicktime_write_minf(quicktime_t *file,quicktime_minf_t *minf); - -/* stsd.c */ -void quicktime_stsd_init(quicktime_stsd_t *stsd); -void quicktime_stsd_init_table(quicktime_stsd_t *stsd); -void quicktime_stsd_init_video(quicktime_t *file,quicktime_stsd_t *stsd, - int frame_w,int frame_h,float frame_rate,char *compression); -void quicktime_stsd_init_audio(quicktime_t *file,quicktime_stsd_t *stsd, - int channels,int sample_rate,int bits,char *compressor); -void quicktime_stsd_delete(quicktime_stsd_t *stsd); -void quicktime_stsd_dump(void *minf_ptr,quicktime_stsd_t *stsd); -void quicktime_read_stsd(quicktime_t *file,quicktime_minf_t *minf, - quicktime_stsd_t *stsd); -void quicktime_write_stsd(quicktime_t *file,quicktime_minf_t *minf, - quicktime_stsd_t *stsd); - -/* stsdtable.c */ -void quicktime_mjqt_init(quicktime_mjqt_t *mjqt); -void quicktime_mjqt_delete(quicktime_mjqt_t *mjqt); -void quicktime_mjqt_dump(quicktime_mjqt_t *mjqt); -void quicktime_mjht_init(quicktime_mjht_t *mjht); -void quicktime_mjht_delete(quicktime_mjht_t *mjht); -void quicktime_mjht_dump(quicktime_mjht_t *mjht); -void quicktime_set_mpeg4_header(quicktime_stsd_table_t *table, - unsigned char *data,int size); -void quicktime_read_stsd_audio(quicktime_t *file,quicktime_stsd_table_t *table, - quicktime_atom_t *parent_atom); -void quicktime_write_stsd_audio(quicktime_t *file,quicktime_stsd_table_t *table); -void quicktime_read_stsd_video(quicktime_t *file,quicktime_stsd_table_t *table, - quicktime_atom_t *parent_atom); -void quicktime_write_stsd_video(quicktime_t *file,quicktime_stsd_table_t *table); -void quicktime_read_stsd_table(quicktime_t *file,quicktime_minf_t *minf, - quicktime_stsd_table_t *table); -void quicktime_stsd_table_init(quicktime_stsd_table_t *table); -void quicktime_stsd_table_delete(quicktime_stsd_table_t *table); -void quicktime_stsd_video_dump(quicktime_stsd_table_t *table); -void quicktime_stsd_audio_dump(quicktime_stsd_table_t *table); -void quicktime_stsd_table_dump(void *minf_ptr,quicktime_stsd_table_t *table); -void quicktime_write_stsd_table(quicktime_t *file,quicktime_minf_t *minf, - quicktime_stsd_table_t *table); - -/* stts.c */ -void quicktime_stts_init(quicktime_stts_t *stts); -void quicktime_stts_init_table(quicktime_stts_t *stts); -void quicktime_stts_init_video(quicktime_t *file,quicktime_stts_t *stts, - int time_scale,float frame_rate); -void quicktime_stts_init_audio(quicktime_t *file,quicktime_stts_t *stts, - int sample_rate); -void quicktime_stts_append_audio(quicktime_t *file,quicktime_stts_t *stts, - int sample_duration); -int64_t quicktime_stts_total_samples(quicktime_t *file,quicktime_stts_t *stts); -void quicktime_stts_delete(quicktime_stts_t *stts); -void quicktime_stts_dump(quicktime_stts_t *stts); -void quicktime_read_stts(quicktime_t *file,quicktime_stts_t *stts); -void quicktime_write_stts(quicktime_t *file,quicktime_stts_t *stts); -int quicktime_time_to_sample(quicktime_stts_t *stts,int64_t *start_time); -int64_t quicktime_chunk_to_samples(quicktime_stts_t *stts, long chunk); - -/* stbl.c */ -void quicktime_stbl_init(quicktime_stbl_t *stbl); -void quicktime_stbl_init_video(quicktime_t *file,quicktime_stbl_t *stbl, - int frame_w,int frame_h,int time_scale,float frame_rate,char *compressor); -void quicktime_stbl_init_audio(quicktime_t *file,quicktime_stbl_t *stbl, - int channels,int sample_rate,int bits,char *compressor); -void quicktime_stbl_delete(quicktime_stbl_t *stbl); -void quicktime_stbl_dump(void *minf_ptr,quicktime_stbl_t *stbl); -int quicktime_read_stbl(quicktime_t *file,quicktime_minf_t *minf, - quicktime_stbl_t *stbl,quicktime_atom_t *parent_atom); -void quicktime_write_stbl(quicktime_t *file,quicktime_minf_t *minf, - quicktime_stbl_t *stbl); - -/* tkhd.c */ -int quicktime_tkhd_init(quicktime_tkhd_t *tkhd); -int quicktime_tkhd_delete(quicktime_tkhd_t *tkhd); -void quicktime_tkhd_dump(quicktime_tkhd_t *tkhd); -void quicktime_read_tkhd(quicktime_t *file,quicktime_tkhd_t *tkhd); -void quicktime_write_tkhd(quicktime_t *file,quicktime_tkhd_t *tkhd); -void quicktime_tkhd_init_video(quicktime_t *file,quicktime_tkhd_t *tkhd, - int frame_w,int frame_h); - -/* stco.c */ -void quicktime_stco_init(quicktime_stco_t *stco); -void quicktime_stco_delete(quicktime_stco_t *stco); -void quicktime_stco_init_common(quicktime_t *file,quicktime_stco_t *stco); -void quicktime_stco_dump(quicktime_stco_t *stco); -void quicktime_read_stco(quicktime_t *file,quicktime_stco_t *stco); -void quicktime_read_stco64(quicktime_t *file,quicktime_stco_t *stco); -void quicktime_write_stco(quicktime_t *file,quicktime_stco_t *stco); -void quicktime_update_stco(quicktime_stco_t *stco, long chunk,int64_t offset); - -/* stsz.c */ -void quicktime_stsz_init(quicktime_stsz_t *stsz); -void quicktime_stsz_init_video(quicktime_t *file,quicktime_stsz_t *stsz); -void quicktime_stsz_init_audio(quicktime_t *file,quicktime_stsz_t *stsz, - int channels,int bits,char *compressor); -void quicktime_stsz_delete(quicktime_stsz_t *stsz); -void quicktime_stsz_dump(quicktime_stsz_t *stsz); -void quicktime_read_stsz(quicktime_t *file,quicktime_stsz_t *stsz); -void quicktime_write_stsz(quicktime_t *file,quicktime_stsz_t *stsz); -void quicktime_update_stsz(quicktime_stsz_t *stsz, long sample,long sample_size); -int quicktime_sample_size(quicktime_trak_t *trak,int sample); - -/* smhd.c */ -void quicktime_smhd_init(quicktime_smhd_t *smhd); -void quicktime_smhd_delete(quicktime_smhd_t *smhd); -void quicktime_smhd_dump(quicktime_smhd_t *smhd); -void quicktime_read_smhd(quicktime_t *file,quicktime_smhd_t *smhd); -void quicktime_write_smhd(quicktime_t *file,quicktime_smhd_t *smhd); - -/* mdat.c */ -void quicktime_mdat_delete(quicktime_mdat_t *mdat); -void quicktime_read_mdat(quicktime_t *file,quicktime_mdat_t *mdat, - quicktime_atom_t *parent_atom); - -/* trak.c */ -int quicktime_trak_init(quicktime_trak_t *trak); -int quicktime_trak_init_video(quicktime_t *file,quicktime_trak_t *trak, - int frame_w,int frame_h,float frame_rate,char *compressor); -int quicktime_trak_init_audio(quicktime_t *file,quicktime_trak_t *trak, - int channels,int sample_rate,int bits,char *compressor); -int quicktime_trak_delete(quicktime_trak_t *trak); -int quicktime_trak_dump(quicktime_trak_t *trak); -quicktime_trak_t *quicktime_add_trak(quicktime_t *file); -int quicktime_delete_trak(quicktime_moov_t *moov); -int quicktime_read_trak(quicktime_t *file,quicktime_trak_t *trak, - quicktime_atom_t *trak_atom); -int quicktime_write_trak(quicktime_t *file,quicktime_trak_t *trak, - long moov_time_scale); -int64_t quicktime_track_end(quicktime_trak_t *trak); -long quicktime_track_samples(quicktime_t *file,quicktime_trak_t *trak); -long quicktime_sample_of_chunk(quicktime_trak_t *trak,long chunk); -int quicktime_avg_chunk_samples(quicktime_t *file, quicktime_trak_t *trak); -int quicktime_chunk_of_sample(int64_t *chunk_sample,int64_t *chunk, - quicktime_trak_t *trak,int64_t sample); - -/* stsc.c */ -void quicktime_stsc_init(quicktime_stsc_t *stsc); -void quicktime_stsc_init_table(quicktime_t *file,quicktime_stsc_t *stsc); -void quicktime_stsc_init_video(quicktime_t *file,quicktime_stsc_t *stsc); -void quicktime_stsc_init_audio(quicktime_t *file,quicktime_stsc_t *stsc, - int sample_rate); -void quicktime_stsc_delete(quicktime_stsc_t *stsc); -void quicktime_stsc_dump(quicktime_stsc_t *stsc); -void quicktime_read_stsc(quicktime_t *file,quicktime_stsc_t *stsc); -void quicktime_write_stsc(quicktime_t *file,quicktime_stsc_t *stsc); -int quicktime_update_stsc(quicktime_stsc_t *stsc,long chunk,long samples); - -/* dinf.c */ -void quicktime_dinf_init(quicktime_dinf_t *dinf); -void quicktime_dinf_delete(quicktime_dinf_t *dinf); -void quicktime_dinf_init_all(quicktime_dinf_t *dinf); -void quicktime_dinf_dump(quicktime_dinf_t *dinf); -void quicktime_read_dinf(quicktime_t *file,quicktime_dinf_t *dinf, - quicktime_atom_t *dinf_atom); -void quicktime_write_dinf(quicktime_t *file,quicktime_dinf_t *dinf); - -/* vmhd.c */ -void quicktime_vmhd_init(quicktime_vmhd_t *vmhd); -void quicktime_vmhd_init_video(quicktime_t *file,quicktime_vmhd_t *vmhd, - int frame_w,int frame_h,float frame_rate); -void quicktime_vmhd_delete(quicktime_vmhd_t *vmhd); -void quicktime_vmhd_dump(quicktime_vmhd_t *vmhd); -void quicktime_read_vmhd(quicktime_t *file,quicktime_vmhd_t *vmhd); -void quicktime_write_vmhd(quicktime_t *file,quicktime_vmhd_t *vmhd); - -/* mvhd.c */ -int quicktime_mvhd_init(quicktime_mvhd_t *mvhd); -int quicktime_mvhd_delete(quicktime_mvhd_t *mvhd); -void quicktime_mvhd_dump(quicktime_mvhd_t *mvhd); -void quicktime_read_mvhd(quicktime_t *file,quicktime_mvhd_t *mvhd, - quicktime_atom_t *parent_atom); -void quicktime_mhvd_init_video(quicktime_t *file,quicktime_mvhd_t *mvhd, - double frame_rate); -void quicktime_write_mvhd(quicktime_t *file,quicktime_mvhd_t *mvhd); - -/* udta.c */ -int quicktime_udta_init(quicktime_udta_t *udta); -int quicktime_udta_delete(quicktime_udta_t *udta); -void quicktime_udta_dump(quicktime_udta_t *udta); -int quicktime_read_udta(quicktime_t *file,quicktime_udta_t *udta, - quicktime_atom_t *udta_atom); -void quicktime_write_udta(quicktime_t *file,quicktime_udta_t *udta); -int quicktime_read_udta_string(quicktime_t *file,char **string,int *size); -int quicktime_write_udta_string(quicktime_t *file,char *string,int size); -int quicktime_set_udta_string(char **string,int *size,char *new_string); - -/* stss.c */ -void quicktime_stss_init(quicktime_stss_t *stss); -void quicktime_stss_delete(quicktime_stss_t *stss); -void quicktime_stss_dump(quicktime_stss_t *stss); -void quicktime_read_stss(quicktime_t *file,quicktime_stss_t *stss); -void quicktime_write_stss(quicktime_t *file,quicktime_stss_t *stss); - -/* mdia.c */ -void quicktime_mdia_init(quicktime_mdia_t *mdia); -void quicktime_mdia_init_video(quicktime_t *file,quicktime_mdia_t *mdia, - int frame_w,int frame_h,float frame_rate,char *compressor); -void quicktime_mdia_init_audio(quicktime_t *file,quicktime_mdia_t *mdia, - int channels,int sample_rate,int bits,char *compressor); -void quicktime_mdia_delete(quicktime_mdia_t *mdia); -void quicktime_mdia_dump(quicktime_mdia_t *mdia); -int quicktime_read_mdia(quicktime_t *file,quicktime_mdia_t *mdia, - quicktime_atom_t *trak_atom); -void quicktime_write_mdia(quicktime_t *file,quicktime_mdia_t *mdia); - -/* edts.c */ -void quicktime_edts_init(quicktime_edts_t *edts); -void quicktime_edts_delete(quicktime_edts_t *edts); -void quicktime_edts_init_table(quicktime_edts_t *edts); -void quicktime_read_edts(quicktime_t *file,quicktime_edts_t *edts, - quicktime_atom_t *edts_atom); -void quicktime_edts_dump(quicktime_edts_t *edts); -void quicktime_write_edts(quicktime_t *file,quicktime_edts_t *edts, - long duration); - -/* moov.c */ -int quicktime_moov_init(quicktime_moov_t *moov); -int quicktime_moov_delete(quicktime_moov_t *moov); -void quicktime_moov_dump(quicktime_moov_t *moov); -int quicktime_read_moov(quicktime_t *file,quicktime_moov_t *moov, - quicktime_atom_t *parent_atom); -void quicktime_write_moov(quicktime_t *file,quicktime_moov_t *moov,int rewind); -void quicktime_update_durations(quicktime_moov_t *moov); -int quicktime_shift_offsets(quicktime_moov_t *moov,int64_t offset); - -#endif - diff --git a/cinelerra-5.0/quicktime/graphics.c b/cinelerra-5.0/quicktime/graphics.c deleted file mode 100644 index 26000493..00000000 --- a/cinelerra-5.0/quicktime/graphics.c +++ /dev/null @@ -1,104 +0,0 @@ -#include "graphics.h" - -#include -#include - -/* Graphics acceleration routines */ - -void quicktime_init_yuv(quicktime_yuv_t *yuv_table) -{ - int i; - for(i = 0; i < 256; i++) - { -/* compression */ - yuv_table->rtoy_tab[i] = (long)( 0.2990 * 65536 * i); - yuv_table->rtou_tab[i] = (long)(-0.1687 * 65536 * i); - yuv_table->rtov_tab[i] = (long)( 0.5000 * 65536 * i); - - yuv_table->gtoy_tab[i] = (long)( 0.5870 * 65536 * i); - yuv_table->gtou_tab[i] = (long)(-0.3320 * 65536 * i); - yuv_table->gtov_tab[i] = (long)(-0.4187 * 65536 * i); - - yuv_table->btoy_tab[i] = (long)( 0.1140 * 65536 * i); - yuv_table->btou_tab[i] = (long)( 0.5000 * 65536 * i); - yuv_table->btov_tab[i] = (long)(-0.0813 * 65536 * i); - } - - yuv_table->vtor = &(yuv_table->vtor_tab[128]); - yuv_table->vtog = &(yuv_table->vtog_tab[128]); - yuv_table->utog = &(yuv_table->utog_tab[128]); - yuv_table->utob = &(yuv_table->utob_tab[128]); - for(i = -128; i < 128; i++) - { -/* decompression */ - yuv_table->vtor[i] = (long)( 1.4020 * 65536 * i); - yuv_table->vtog[i] = (long)(-0.7141 * 65536 * i); - - yuv_table->utog[i] = (long)(-0.3441 * 65536 * i); - yuv_table->utob[i] = (long)( 1.7720 * 65536 * i); - } -} - -void quicktime_delete_yuv(quicktime_yuv_t *yuv_table) -{ -} - - -quicktime_scaletable_t* quicktime_new_scaletable(int input_w, int input_h, int output_w, int output_h) -{ - quicktime_scaletable_t *result = (quicktime_scaletable_t*)malloc(sizeof(quicktime_scaletable_t)); - float i; - float scalex = (float)input_w / output_w, scaley = (float)input_h / output_h; - - result->input_x = (int*)malloc(sizeof(int) * output_w); - result->input_y = (int*)malloc(sizeof(int) * output_h); - - for(i = 0; i < output_w; i++) - { - result->input_x[(int)i] = (int)(scalex * i); - } - - for(i = 0; i < output_h; i++) - { - result->input_y[(int)i] = (int)(scaley * i); - } - - result->in_w = input_w; - result->in_h = input_h; - result->out_w = output_w; - result->out_h = output_h; - return result; -} - -void quicktime_delete_scaletable(quicktime_scaletable_t *scaletable) -{ - free(scaletable->input_x); - free(scaletable->input_y); - free(scaletable); -} - -/* Return 1 if dimensions are different from scaletable */ -int quicktime_compare_scaletable(quicktime_scaletable_t *scaletable, - int in_w, - int in_h, - int out_w, - int out_h) -{ - if(scaletable->in_w != in_w || - scaletable->in_h != in_h || - scaletable->out_w != out_w || - scaletable->out_h != out_h) - return 1; - else - return 0; -} - -/* Return 1 if the scaletable is 1:1 */ -int quicktime_identity_scaletable(quicktime_scaletable_t *scaletable) -{ - if(scaletable->in_w == scaletable->out_w && - scaletable->in_h == scaletable->out_h) - return 1; - else - return 0; -} diff --git a/cinelerra-5.0/quicktime/graphics.h b/cinelerra-5.0/quicktime/graphics.h deleted file mode 100644 index b1e2faf2..00000000 --- a/cinelerra-5.0/quicktime/graphics.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef QUICKTIME_GRAPHICS_H -#define QUICKTIME_GRAPHICS_H - -typedef struct -{ - long rtoy_tab[256], gtoy_tab[256], btoy_tab[256]; - long rtou_tab[256], gtou_tab[256], btou_tab[256]; - long rtov_tab[256], gtov_tab[256], btov_tab[256]; - - long vtor_tab[256], vtog_tab[256]; - long utog_tab[256], utob_tab[256]; - long *vtor, *vtog, *utog, *utob; -} quicktime_yuv_t; - -typedef struct -{ - int *input_x; - int *input_y; - int in_w, in_h, out_w, out_h; -} quicktime_scaletable_t; - -#endif diff --git a/cinelerra-5.0/quicktime/hdlr.c b/cinelerra-5.0/quicktime/hdlr.c deleted file mode 100644 index 99d023ae..00000000 --- a/cinelerra-5.0/quicktime/hdlr.c +++ /dev/null @@ -1,97 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" -#include - - - -void quicktime_hdlr_init(quicktime_hdlr_t *hdlr) -{ - hdlr->version = 0; - hdlr->flags = 0; - hdlr->component_type[0] = 'm'; - hdlr->component_type[1] = 'h'; - hdlr->component_type[2] = 'l'; - hdlr->component_type[3] = 'r'; - hdlr->component_subtype[0] = 'v'; - hdlr->component_subtype[1] = 'i'; - hdlr->component_subtype[2] = 'd'; - hdlr->component_subtype[3] = 'e'; - hdlr->component_manufacturer = 0; - hdlr->component_flags = 0; - hdlr->component_flag_mask = 0; - strcpy(hdlr->component_name, "Linux Media Handler"); -} - -void quicktime_hdlr_init_video(quicktime_hdlr_t *hdlr) -{ - hdlr->component_subtype[0] = 'v'; - hdlr->component_subtype[1] = 'i'; - hdlr->component_subtype[2] = 'd'; - hdlr->component_subtype[3] = 'e'; - strcpy(hdlr->component_name, "Linux Video Media Handler"); -} - -void quicktime_hdlr_init_audio(quicktime_hdlr_t *hdlr) -{ - hdlr->component_subtype[0] = 's'; - hdlr->component_subtype[1] = 'o'; - hdlr->component_subtype[2] = 'u'; - hdlr->component_subtype[3] = 'n'; - strcpy(hdlr->component_name, "Linux Sound Media Handler"); -} - -void quicktime_hdlr_init_data(quicktime_hdlr_t *hdlr) -{ - hdlr->component_type[0] = 'd'; - hdlr->component_type[1] = 'h'; - hdlr->component_type[2] = 'l'; - hdlr->component_type[3] = 'r'; - hdlr->component_subtype[0] = 'a'; - hdlr->component_subtype[1] = 'l'; - hdlr->component_subtype[2] = 'i'; - hdlr->component_subtype[3] = 's'; - strcpy(hdlr->component_name, "Linux Alias Data Handler"); -} - -void quicktime_hdlr_delete(quicktime_hdlr_t *hdlr) -{ -} - -void quicktime_hdlr_dump(quicktime_hdlr_t *hdlr) -{ - printf(" handler reference (hdlr)\n"); - printf(" version %d\n", hdlr->version); - printf(" flags %ld\n", hdlr->flags); - printf(" component_type %c%c%c%c\n", hdlr->component_type[0], hdlr->component_type[1], hdlr->component_type[2], hdlr->component_type[3]); - printf(" component_subtype %c%c%c%c\n", hdlr->component_subtype[0], hdlr->component_subtype[1], hdlr->component_subtype[2], hdlr->component_subtype[3]); - printf(" component_name %s\n", hdlr->component_name); -} - -void quicktime_read_hdlr(quicktime_t *file, quicktime_hdlr_t *hdlr) -{ - hdlr->version = quicktime_read_char(file); - hdlr->flags = quicktime_read_int24(file); - quicktime_read_char32(file, hdlr->component_type); - quicktime_read_char32(file, hdlr->component_subtype); - hdlr->component_manufacturer = quicktime_read_int32(file); - hdlr->component_flags = quicktime_read_int32(file); - hdlr->component_flag_mask = quicktime_read_int32(file); - quicktime_read_pascal(file, hdlr->component_name); -} - -void quicktime_write_hdlr(quicktime_t *file, quicktime_hdlr_t *hdlr) -{ - quicktime_atom_t atom; - quicktime_atom_write_header(file, &atom, "hdlr"); - - quicktime_write_char(file, hdlr->version); - quicktime_write_int24(file, hdlr->flags); - quicktime_write_char32(file, hdlr->component_type); - quicktime_write_char32(file, hdlr->component_subtype); - quicktime_write_int32(file, hdlr->component_manufacturer); - quicktime_write_int32(file, hdlr->component_flags); - quicktime_write_int32(file, hdlr->component_flag_mask); - quicktime_write_pascal(file, hdlr->component_name); - - quicktime_atom_write_footer(file, &atom); -} diff --git a/cinelerra-5.0/quicktime/ima4.c b/cinelerra-5.0/quicktime/ima4.c deleted file mode 100644 index bcde61b6..00000000 --- a/cinelerra-5.0/quicktime/ima4.c +++ /dev/null @@ -1,556 +0,0 @@ -#include "funcprotos.h" -#include "ima4.h" -#include "quicktime.h" - -typedef struct -{ -/* During decoding the work_buffer contains the most recently read chunk. */ -/* During encoding the work_buffer contains interlaced overflow samples */ -/* from the last chunk written. */ - int16_t *work_buffer; - unsigned char *read_buffer; /* Temporary buffer for drive reads. */ - -/* Starting information for all channels during encoding. */ - int *last_samples, *last_indexes; - long chunk; /* Number of chunk in work buffer */ - int buffer_channel; /* Channel of work buffer */ - -/* Number of samples in largest chunk read. */ -/* Number of samples plus overflow in largest chunk write, interlaced. */ - long work_size; - long work_overflow; /* Number of overflow samples from the last chunk written. */ - long read_size; /* Size of read buffer. */ -} quicktime_ima4_codec_t; - -static int ima4_step[89] = -{ - 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, - 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, - 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, - 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, - 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, - 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, - 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358, - 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, - 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767 -}; - -static int ima4_index[16] = -{ - -1, -1, -1, -1, 2, 4, 6, 8, - -1, -1, -1, -1, 2, 4, 6, 8 -}; - -/* Known by divine revelation */ - -#define BLOCK_SIZE 0x22 -#define SAMPLES_PER_BLOCK 0x40 - -/* ================================== private for ima4 */ - - -void ima4_decode_sample(int *predictor, int *nibble, int *index, int *step) -{ - int difference, sign; - -/* Get new index value */ - *index += ima4_index[*nibble]; - - if(*index < 0) *index = 0; - else - if(*index > 88) *index = 88; - -/* Get sign and magnitude from *nibble */ - sign = *nibble & 8; - *nibble = *nibble & 7; - -/* Get difference */ - difference = *step >> 3; - if(*nibble & 4) difference += *step; - if(*nibble & 2) difference += *step >> 1; - if(*nibble & 1) difference += *step >> 2; - -/* Predict value */ - if(sign) - *predictor -= difference; - else - *predictor += difference; - - if(*predictor > 32767) *predictor = 32767; - else - if(*predictor < -32768) *predictor = -32768; - -/* Update the step value */ - *step = ima4_step[*index]; -} - -void ima4_decode_block(quicktime_audio_map_t *atrack, int16_t *output, unsigned char *input) -{ - int predictor, index, step; - int nibble, nibble_count; - unsigned char *input_end = input + BLOCK_SIZE; - -/* Get the chunk header */ - predictor = *input++ << 8; - predictor |= *input++; - - index = predictor & 0x7f; - if(index > 88) index = 88; - - predictor &= 0xff80; - if(predictor & 0x8000) predictor -= 0x10000; - step = ima4_step[index]; - -/* Read the input buffer sequentially, one nibble at a time */ - nibble_count = 0; - while(input < input_end) - { - nibble = nibble_count ? (*input++ >> 4) & 0x0f : *input & 0x0f; - - ima4_decode_sample(&predictor, &nibble, &index, &step); - *output++ = predictor; - - nibble_count ^= 1; - } -} - - -void ima4_encode_sample(int *last_sample, int *last_index, int *nibble, int next_sample) -{ - int difference, new_difference, mask, step; - - difference = next_sample - *last_sample; - *nibble = 0; - step = ima4_step[*last_index]; - new_difference = step >> 3; - - if(difference < 0) - { - *nibble = 8; - difference = -difference; - } - - mask = 4; - while(mask) - { - if(difference >= step) - { - *nibble |= mask; - difference -= step; - new_difference += step; - } - - step >>= 1; - mask >>= 1; - } - - if(*nibble & 8) - *last_sample -= new_difference; - else - *last_sample += new_difference; - - if(*last_sample > 32767) *last_sample = 32767; - else - if(*last_sample < -32767) *last_sample = -32767; - - *last_index += ima4_index[*nibble]; - - if(*last_index < 0) *last_index = 0; - else - if(*last_index > 88) *last_index= 88; -} - -void ima4_encode_block(quicktime_audio_map_t *atrack, unsigned char *output, int16_t *input, int step, int channel) -{ - quicktime_ima4_codec_t *codec = ((quicktime_codec_t*)atrack->codec)->priv; - int i, nibble_count = 0, nibble, header; - -/* Get a fake starting sample */ - header = codec->last_samples[channel]; -/* Force rounding. */ - if(header < 0x7fc0) header += 0x40; - if(header < 0) header += 0x10000; - header &= 0xff80; - *output++ = (header & 0xff00) >> 8; - *output++ = (header & 0x80) + (codec->last_indexes[channel] & 0x7f); - - for(i = 0; i < SAMPLES_PER_BLOCK; i++) - { - ima4_encode_sample(&(codec->last_samples[channel]), - &(codec->last_indexes[channel]), - &nibble, - *input); - - if(nibble_count) - *output++ |= (nibble << 4); - else - *output = nibble; - - input += step; - nibble_count ^= 1; - } -} - -/* Convert the number of samples in a chunk into the number of bytes in that */ -/* chunk. The number of samples in a chunk should end on a block boundary. */ -long ima4_samples_to_bytes(long samples, int channels) -{ - long bytes = samples / SAMPLES_PER_BLOCK * BLOCK_SIZE * channels; - return bytes; -} - -/* Decode the chunk into the work buffer */ -int ima4_decode_chunk(quicktime_t *file, int track, long chunk, int channel) -{ - int result = 0; - int i, j; - long chunk_samples, chunk_bytes; - unsigned char *block_ptr; - quicktime_trak_t *trak = file->atracks[track].track; - quicktime_ima4_codec_t *codec = ((quicktime_codec_t*)file->atracks[track].codec)->priv; - -/* Get the byte count to read. */ - chunk_samples = quicktime_chunk_samples(trak, chunk); - chunk_bytes = ima4_samples_to_bytes(chunk_samples, file->atracks[track].channels); - -/* Get the buffer to read into. */ - if(codec->work_buffer && codec->work_size < chunk_samples) - { - free(codec->work_buffer); - codec->work_buffer = 0; - } - - if(!codec->work_buffer) - { - codec->work_size = chunk_samples; - codec->work_buffer = malloc(sizeof(int16_t) * codec->work_size); - } - - if(codec->read_buffer && codec->read_size < chunk_bytes) - { - free(codec->read_buffer); - codec->read_buffer = 0; - } - - if(!codec->read_buffer) - { - codec->read_size = chunk_bytes; - codec->read_buffer = malloc(codec->read_size); - } - -/* codec->work_size now holds the number of samples in the last chunk */ -/* codec->read_size now holds number of bytes in the last read buffer */ - -/* Read the entire chunk regardless of where the desired sample range starts. */ - result = quicktime_read_chunk(file, (char*)codec->read_buffer, - track, chunk, 0, chunk_bytes); - -/* Now decode the chunk, one block at a time, until the total samples in the chunk */ -/* is reached. */ - - if(!result) - { - block_ptr = codec->read_buffer; - for(i = 0; i < chunk_samples; i += SAMPLES_PER_BLOCK) - { - for(j = 0; j < file->atracks[track].channels; j++) - { - if(j == channel) - ima4_decode_block(&(file->atracks[track]), &(codec->work_buffer[i]), block_ptr); - - block_ptr += BLOCK_SIZE; - } - } - } - codec->buffer_channel = channel; - codec->chunk = chunk; - - return result; -} - - -/* =================================== public for ima4 */ - -static void delete_codec(quicktime_audio_map_t *atrack) -{ - quicktime_ima4_codec_t *codec = ((quicktime_codec_t*)atrack->codec)->priv; - - if(codec->work_buffer) free(codec->work_buffer); - if(codec->read_buffer) free(codec->read_buffer); - if(codec->last_samples) free(codec->last_samples); - if(codec->last_indexes) free(codec->last_indexes); - codec->last_samples = 0; - codec->last_indexes = 0; - codec->read_buffer = 0; - codec->work_buffer = 0; - codec->chunk = 0; - codec->buffer_channel = 0; /* Channel of work buffer */ - codec->work_size = 0; /* Size of work buffer */ - codec->read_size = 0; - free(codec); -} - -static int decode(quicktime_t *file, - int16_t *output_i, - float *output_f, - long samples, - int track, - int channel) -{ - int result = 0; - int64_t chunk, chunk_sample, chunk_samples; - int64_t i, chunk_start, chunk_end; - quicktime_trak_t *trak = file->atracks[track].track; - quicktime_ima4_codec_t *codec = ((quicktime_codec_t*)file->atracks[track].codec)->priv; - -/* Get the first chunk with this routine and then increase the chunk number. */ - quicktime_chunk_of_sample(&chunk_sample, &chunk, trak, file->atracks[track].current_position); - -/* Read chunks and extract ranges of samples until the output is full. */ - for(i = 0; i < samples && !result; ) - { -/* Get chunk we're on. */ - chunk_samples = quicktime_chunk_samples(trak, chunk); - - if(!codec->work_buffer || - codec->chunk != chunk || - codec->buffer_channel != channel) - { -/* read a new chunk if necessary */ - result = ima4_decode_chunk(file, track, chunk, channel); - } - -/* Get boundaries from the chunk */ - chunk_start = 0; - if(chunk_sample < file->atracks[track].current_position) - chunk_start = file->atracks[track].current_position - chunk_sample; - - chunk_end = chunk_samples; - if(chunk_sample + chunk_end > file->atracks[track].current_position + samples) - chunk_end = file->atracks[track].current_position + samples - chunk_sample; - -/* Read from the chunk */ - if(output_i) - { -/*printf("decode_ima4 1 chunk %ld %ld-%ld output %ld\n", chunk, chunk_start + chunk_sample, chunk_end + chunk_sample, i); */ - while(chunk_start < chunk_end) - { - output_i[i++] = codec->work_buffer[chunk_start++]; - } -/*printf("decode_ima4 2\n"); */ - } - else - if(output_f) - { - while(chunk_start < chunk_end) - { - output_f[i++] = (float)codec->work_buffer[chunk_start++] / 32767; - } - } - - chunk++; - chunk_sample += chunk_samples; - } - - return result; -} - -static int encode(quicktime_t *file, - int16_t **input_i, - float **input_f, - int track, - long samples) -{ - int result = 0; - int64_t i, j, step; - int64_t chunk_bytes; - int64_t overflow_start; - int64_t chunk_samples; /* Samples in the current chunk to be written */ - quicktime_audio_map_t *track_map = &(file->atracks[track]); - quicktime_ima4_codec_t *codec = ((quicktime_codec_t*)track_map->codec)->priv; - quicktime_trak_t *trak = track_map->track; - int16_t *input_ptr; - unsigned char *output_ptr; - quicktime_atom_t chunk_atom; - -/* Get buffer sizes */ - if(codec->work_buffer && codec->work_size < (samples + codec->work_overflow + 1) * track_map->channels) - { -/* Create new buffer */ - int64_t new_size = (samples + codec->work_overflow + 1) * track_map->channels; - int16_t *new_buffer = malloc(sizeof(int16_t) * new_size); - -/* Copy overflow */ - for(i = 0; i < codec->work_overflow * track_map->channels; i++) - new_buffer[i] = codec->work_buffer[i]; - -/* Swap pointers. */ - free(codec->work_buffer); - codec->work_buffer = new_buffer; - codec->work_size = new_size; - } - else - if(!codec->work_buffer) - { -/* No buffer in the first place. */ - codec->work_size = (samples + codec->work_overflow) * track_map->channels; -/* Make the allocation enough for at least the flush routine. */ - if(codec->work_size < SAMPLES_PER_BLOCK * track_map->channels) - codec->work_size = SAMPLES_PER_BLOCK * track_map->channels; - codec->work_buffer = malloc(sizeof(int16_t) * codec->work_size); - } - -/* Get output size */ - chunk_bytes = ima4_samples_to_bytes(samples + codec->work_overflow, track_map->channels); - if(codec->read_buffer && codec->read_size < chunk_bytes) - { - free(codec->read_buffer); - codec->read_buffer = 0; - } - - if(!codec->read_buffer) - { - codec->read_buffer = malloc(chunk_bytes); - codec->read_size = chunk_bytes; - } - - if(!codec->last_samples) - { - codec->last_samples = malloc(sizeof(int) * track_map->channels); - for(i = 0; i < track_map->channels; i++) - { - codec->last_samples[i] = 0; - } - } - - if(!codec->last_indexes) - { - codec->last_indexes = malloc(sizeof(int) * track_map->channels); - for(i = 0; i < track_map->channels; i++) - { - codec->last_indexes[i] = 0; - } - } - -/* Arm the input buffer after the last overflow */ - step = track_map->channels; - for(j = 0; j < track_map->channels; j++) - { - input_ptr = codec->work_buffer + codec->work_overflow * track_map->channels + j; - - if(input_i) - { - for(i = 0; i < samples; i++) - { - *input_ptr = input_i[j][i]; - input_ptr += step; - } - } - else - if(input_f) - { - for(i = 0; i < samples; i++) - { - *input_ptr = (int16_t)(input_f[j][i] * 32767); - input_ptr += step; - } - } - } - -/* Encode from the input buffer to the read_buffer up to a multiple of */ -/* blocks. */ - input_ptr = codec->work_buffer; - output_ptr = codec->read_buffer; - - for(i = 0; - i + SAMPLES_PER_BLOCK <= samples + codec->work_overflow; - i += SAMPLES_PER_BLOCK) - { - for(j = 0; j < track_map->channels; j++) - { - ima4_encode_block(track_map, output_ptr, input_ptr + j, track_map->channels, j); - - output_ptr += BLOCK_SIZE; - } - input_ptr += SAMPLES_PER_BLOCK * track_map->channels; - } - -/* Write to disk */ - chunk_samples = (int64_t)((samples + codec->work_overflow) / SAMPLES_PER_BLOCK) * SAMPLES_PER_BLOCK; - -/*printf("quicktime_encode_ima4 1 %ld\n", chunk_samples); */ -/* The block division may result in 0 samples getting encoded. */ -/* Don't write 0 samples. */ - if(chunk_samples) - { - quicktime_write_chunk_header(file, trak, &chunk_atom); - result = quicktime_write_data(file, (char*)codec->read_buffer, chunk_bytes); - quicktime_write_chunk_footer(file, - trak, - track_map->current_chunk, - &chunk_atom, - chunk_samples); - - if(result) - result = 0; - else - result = 1; /* defeat fwrite's return */ - - track_map->current_chunk++; - } - -/* Move the last overflow to the front */ - overflow_start = i; - input_ptr = codec->work_buffer; - for(i = overflow_start * track_map->channels ; - i < (samples + codec->work_overflow) * track_map->channels; - i++) - { - *input_ptr++ = codec->work_buffer[i]; - } - codec->work_overflow = samples + codec->work_overflow - overflow_start; - - return result; -} - -void flush(quicktime_t *file, int track) -{ - quicktime_audio_map_t *track_map = &(file->atracks[track]); - quicktime_ima4_codec_t *codec = ((quicktime_codec_t*)track_map->codec)->priv; - int i; - -/*printf("quicktime_flush_ima4 %ld\n", codec->work_overflow); */ - if(codec->work_overflow) - { -/* Zero out enough to get a block */ - i = codec->work_overflow * track_map->channels; - while(i < SAMPLES_PER_BLOCK * track_map->channels) - { - codec->work_buffer[i++] = 0; - } - codec->work_overflow = i / track_map->channels + 1; -/* Write the work_overflow only. */ - encode(file, 0, 0, track, 0); - } -} - -void quicktime_init_codec_ima4(quicktime_audio_map_t *atrack) -{ - quicktime_codec_t *codec_base = (quicktime_codec_t*)atrack->codec; -// quicktime_ima4_codec_t *codec = codec_base->priv; - -/* Init public items */ - codec_base->priv = calloc(1, sizeof(quicktime_ima4_codec_t)); - codec_base->delete_acodec = delete_codec; - codec_base->decode_video = 0; - codec_base->encode_video = 0; - codec_base->decode_audio = decode; - codec_base->encode_audio = encode; - codec_base->flush = flush; - codec_base->fourcc = QUICKTIME_IMA4; - codec_base->title = "IMA 4"; - codec_base->desc = "IMA 4"; - codec_base->wav_id = 0x11; - -/* Init private items */ -} diff --git a/cinelerra-5.0/quicktime/ima4.h b/cinelerra-5.0/quicktime/ima4.h deleted file mode 100644 index 054dc258..00000000 --- a/cinelerra-5.0/quicktime/ima4.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef QUICKTIME_IMA4_H -#define QUICKTIME_IMA4_H - - -extern void quicktime_init_codec_ima4(quicktime_audio_map_t *); - -#endif diff --git a/cinelerra-5.0/quicktime/jpeg.c b/cinelerra-5.0/quicktime/jpeg.c deleted file mode 100755 index def6c853..00000000 --- a/cinelerra-5.0/quicktime/jpeg.c +++ /dev/null @@ -1,411 +0,0 @@ -#include -#include -#include -#include -#include "colormodels.h" -#include "funcprotos.h" -#include "jpeg.h" -#include "libmjpeg.h" -#include "quicktime.h" - -// Jpeg types -#define JPEG_PROGRESSIVE 0 -#define JPEG_MJPA 1 -#define JPEG_MJPB 2 - -typedef struct -{ - unsigned char *buffer; - long buffer_allocated; - long buffer_size; - mjpeg_t *mjpeg; - int jpeg_type; - unsigned char *temp_video; - int initialized; - int quality; - int use_float; -} quicktime_jpeg_codec_t; - -static void delete_codec(quicktime_video_map_t *vtrack) -{ - quicktime_jpeg_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv; - - if(codec->mjpeg) mjpeg_delete(codec->mjpeg); - if(codec->buffer) - free(codec->buffer); - if(codec->temp_video) - free(codec->temp_video); - free(codec); -} - -void quicktime_set_jpeg(quicktime_t *file, int quality, int use_float) -{ - int i; - -printf("1\n"); - for(i = 0; i < file->total_vtracks; i++) - { - if(quicktime_match_32(quicktime_video_compressor(file, i), QUICKTIME_JPEG) || - quicktime_match_32(quicktime_video_compressor(file, i), QUICKTIME_MJPA) || - quicktime_match_32(quicktime_video_compressor(file, i), QUICKTIME_RTJ0)) - { - quicktime_jpeg_codec_t *codec = ((quicktime_codec_t*)file->vtracks[i].codec)->priv; - codec->quality = quality; - codec->use_float = use_float; - } - } -printf("10\n"); -} - - -static void initialize(quicktime_video_map_t *vtrack) -{ - quicktime_jpeg_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv; - if(!codec->initialized) - { -/* Init private items */ - codec->mjpeg = mjpeg_new(vtrack->track->tkhd.track_width, - vtrack->track->tkhd.track_height, - 1 + (codec->jpeg_type == JPEG_MJPA || codec->jpeg_type == JPEG_MJPB)); - -/* This information must be stored in the initialization routine because of */ -/* direct copy rendering. Quicktime for Windows must have this information. */ - if(codec->jpeg_type == JPEG_MJPA && - !vtrack->track->mdia.minf.stbl.stsd.table[0].fields) - { - vtrack->track->mdia.minf.stbl.stsd.table[0].fields = 2; - vtrack->track->mdia.minf.stbl.stsd.table[0].field_dominance = 1; - } - codec->initialized = 1; - } -} - -static int decode(quicktime_t *file, - unsigned char **row_pointers, - int track) -{ - quicktime_video_map_t *vtrack = &(file->vtracks[track]); - initialize(vtrack); - quicktime_jpeg_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv; - quicktime_trak_t *trak = vtrack->track; - mjpeg_t *mjpeg = codec->mjpeg; - long size, field2_offset = 0; - int track_height = trak->tkhd.track_height; - int track_width = trak->tkhd.track_width; - int result = 0; - int field_dominance = trak->mdia.minf.stbl.stsd.table[0].field_dominance; - - mjpeg_set_cpus(codec->mjpeg, file->cpus); - if(file->row_span) - mjpeg_set_rowspan(codec->mjpeg, file->row_span); - else - mjpeg_set_rowspan(codec->mjpeg, 0); - - quicktime_set_video_position(file, vtrack->current_position, track); - size = quicktime_frame_size(file, vtrack->current_position, track); - codec->buffer_size = size; - - if(size > codec->buffer_allocated) - { - codec->buffer_allocated = size; - codec->buffer = realloc(codec->buffer, codec->buffer_allocated); - } - - result = !quicktime_read_data(file, (char*)codec->buffer, size); -/* - * printf("decode 1 %02x %02x %02x %02x %02x %02x %02x %02x\n", - * codec->buffer[0], - * codec->buffer[1], - * codec->buffer[2], - * codec->buffer[3], - * codec->buffer[4], - * codec->buffer[5], - * codec->buffer[6], - * codec->buffer[7] - * ); - */ - - if(!result) - { - if(mjpeg_get_fields(mjpeg) == 2) - { - if(file->use_avi) - { - field2_offset = mjpeg_get_avi_field2(codec->buffer, - size, - &field_dominance); - } - else - { - field2_offset = mjpeg_get_quicktime_field2(codec->buffer, - size); -// Sanity check - if(!field2_offset) - { - printf("decode: FYI field2_offset=0\n"); - field2_offset = mjpeg_get_field2(codec->buffer, size); - } - } - } - else - field2_offset = 0; - - -//printf("decode 2 %d\n", field2_offset); -/* - * printf("decode result=%d field1=%llx field2=%llx size=%d %02x %02x %02x %02x\n", - * result, - * quicktime_position(file) - size, - * quicktime_position(file) - size + field2_offset, - * size, - * codec->buffer[0], - * codec->buffer[1], - * codec->buffer[field2_offset + 0], - * codec->buffer[field2_offset + 1]); - */ - - if(file->in_x == 0 && - file->in_y == 0 && - file->in_w == track_width && - file->in_h == track_height && - file->out_w == track_width && - file->out_h == track_height) - { - mjpeg_decompress(codec->mjpeg, - codec->buffer, - size, - field2_offset, - row_pointers, - row_pointers[0], - row_pointers[1], - row_pointers[2], - file->color_model, - file->cpus); - } - else - { - int i; - unsigned char **temp_rows; - int temp_cmodel = BC_YUV888; - int temp_rowsize = cmodel_calculate_pixelsize(temp_cmodel) * track_width; - - if(!codec->temp_video) - codec->temp_video = malloc(temp_rowsize * track_height); - temp_rows = malloc(sizeof(unsigned char*) * track_height); - for(i = 0; i < track_height; i++) - temp_rows[i] = codec->temp_video + i * temp_rowsize; - -//printf("decode 10\n"); - mjpeg_decompress(codec->mjpeg, - codec->buffer, - size, - field2_offset, - temp_rows, - temp_rows[0], - temp_rows[1], - temp_rows[2], - temp_cmodel, - file->cpus); - - cmodel_transfer(row_pointers, - temp_rows, - row_pointers[0], - row_pointers[1], - row_pointers[2], - temp_rows[0], - temp_rows[1], - temp_rows[2], - file->in_x, - file->in_y, - file->in_w, - file->in_h, - 0, - 0, - file->out_w, - file->out_h, - temp_cmodel, - file->color_model, - 0, - track_width, - file->out_w); - -//printf("decode 30\n"); - free(temp_rows); - -//printf("decode 40\n"); - } - } -//printf("decode 2 %d\n", result); - - return result; -} - -static int encode(quicktime_t *file, unsigned char **row_pointers, int track) -{ - quicktime_video_map_t *vtrack = &(file->vtracks[track]); - initialize(vtrack); - quicktime_jpeg_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv; - quicktime_trak_t *trak = vtrack->track; - mjpeg_set_quality(codec->mjpeg, codec->quality); - mjpeg_set_float(codec->mjpeg, codec->use_float); - //int64_t offset = quicktime_position(file); - int result = 0; - long field2_offset; - quicktime_atom_t chunk_atom; - -//printf("encode 1\n"); - mjpeg_set_cpus(codec->mjpeg, file->cpus); - mjpeg_compress(codec->mjpeg, row_pointers, - row_pointers[0], row_pointers[1], row_pointers[2], - file->color_model, file->cpus); - - if(codec->jpeg_type == JPEG_MJPA) - { - if(file->use_avi) - { - mjpeg_insert_avi_markers(&codec->mjpeg->output_data, - &codec->mjpeg->output_size, - &codec->mjpeg->output_allocated, - 2, - &field2_offset); - } - else - { - mjpeg_insert_quicktime_markers(&codec->mjpeg->output_data, - &codec->mjpeg->output_size, - &codec->mjpeg->output_allocated, - 2, - &field2_offset); - } - } - - quicktime_write_chunk_header(file, trak, &chunk_atom); - result = !quicktime_write_data(file, - (char*)mjpeg_output_buffer(codec->mjpeg), - mjpeg_output_size(codec->mjpeg)); - quicktime_write_chunk_footer(file, - trak, - vtrack->current_chunk, - &chunk_atom, - 1); - - vtrack->current_chunk++; -//printf("encode 100\n"); - return result; -} - -static int reads_colormodel(quicktime_t *file, - int colormodel, - int track) -{ - quicktime_video_map_t *vtrack = &(file->vtracks[track]); - quicktime_jpeg_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv; - -// Some JPEG_PROGRESSIVE is BC_YUV422P - if(codec->jpeg_type == JPEG_PROGRESSIVE) - { - return (colormodel == BC_RGB888 || - colormodel == BC_YUV888 || - colormodel == BC_YUV420P || - colormodel == BC_YUV422P || - colormodel == BC_YUV422); - } - else - { - return (colormodel == BC_RGB888 || - colormodel == BC_YUV888 || -// colormodel == BC_YUV420P || - colormodel == BC_YUV422P || - colormodel == BC_YUV422); -// The BC_YUV420P option was provided only for mpeg2movie use.because some -// interlaced movies were accidentally in YUV4:2:0 - } -} - -static int writes_colormodel(quicktime_t *file, - int colormodel, - int track) -{ - quicktime_video_map_t *vtrack = &(file->vtracks[track]); - quicktime_jpeg_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv; - - if(codec->jpeg_type == JPEG_PROGRESSIVE) - { - return (colormodel == BC_RGB888 || - colormodel == BC_YUV888 || - colormodel == BC_YUV420P); - } - else - { - return (colormodel == BC_RGB888 || - colormodel == BC_YUV888 || - colormodel == BC_YUV422P); - } -} - -static int set_parameter(quicktime_t *file, - int track, - char *key, - void *value) -{ - quicktime_jpeg_codec_t *codec = ((quicktime_codec_t*)file->vtracks[track].codec)->priv; - - if(!strcasecmp(key, "jpeg_quality")) - { - codec->quality = *(int*)value; - } - else - if(!strcasecmp(key, "jpeg_usefloat")) - { - codec->use_float = *(int*)value; - } - return 0; -} - -static void init_codec_common(quicktime_video_map_t *vtrack, char *compressor) -{ - quicktime_codec_t *codec_base = (quicktime_codec_t*)vtrack->codec; - quicktime_jpeg_codec_t *codec; - - codec = codec_base->priv = calloc(1, sizeof(quicktime_jpeg_codec_t)); - if(quicktime_match_32(compressor, QUICKTIME_JPEG)) - codec->jpeg_type = JPEG_PROGRESSIVE; - if(quicktime_match_32(compressor, QUICKTIME_MJPA)) - codec->jpeg_type = JPEG_MJPA; - codec->quality = 80; - codec->use_float = 0; - -/* Init public items */ - codec_base->delete_vcodec = delete_codec; - codec_base->decode_video = decode; - codec_base->encode_video = encode; - codec_base->decode_audio = 0; - codec_base->encode_audio = 0; - codec_base->reads_colormodel = reads_colormodel; - codec_base->writes_colormodel = writes_colormodel; - codec_base->set_parameter = set_parameter; - codec_base->fourcc = compressor; - codec_base->title = (codec->jpeg_type == JPEG_PROGRESSIVE ? "JPEG Photo" : "Motion JPEG A"); - codec_base->desc = codec_base->title; - -} - -void quicktime_init_codec_jpeg(quicktime_video_map_t *vtrack) -{ - init_codec_common(vtrack, QUICKTIME_JPEG); -} - -void quicktime_init_codec_mjpa(quicktime_video_map_t *vtrack) -{ - init_codec_common(vtrack, QUICKTIME_MJPA); -} - -void quicktime_init_codec_mjpg(quicktime_video_map_t *vtrack) -{ - init_codec_common(vtrack, QUICKTIME_MJPG); -} - - - - - diff --git a/cinelerra-5.0/quicktime/jpeg.h b/cinelerra-5.0/quicktime/jpeg.h deleted file mode 100644 index 4ab6db4f..00000000 --- a/cinelerra-5.0/quicktime/jpeg.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef QUICKTIME_JPEG_H -#define QUICKTIME_JPEG_H - - -extern void quicktime_init_codec_jpeg(quicktime_video_map_t *); -extern void quicktime_init_codec_mjpa(quicktime_video_map_t *); -extern void quicktime_init_codec_mjpg(quicktime_video_map_t *); - -#endif diff --git a/cinelerra-5.0/quicktime/make_streamable.c b/cinelerra-5.0/quicktime/make_streamable.c deleted file mode 100644 index 0b47c010..00000000 --- a/cinelerra-5.0/quicktime/make_streamable.c +++ /dev/null @@ -1,16 +0,0 @@ -#include "quicktime.h" - -int main(int argc, char *argv[]) -{ - int i; - if(argc < 3 || argv[1][0] == '-') - { - printf("usage: %s \n", argv[0]); - exit(1); - } - - if(quicktime_make_streamable(argv[1], argv[2])) - exit(1); - - return 0; -} diff --git a/cinelerra-5.0/quicktime/matrix.c b/cinelerra-5.0/quicktime/matrix.c deleted file mode 100644 index 90c01d55..00000000 --- a/cinelerra-5.0/quicktime/matrix.c +++ /dev/null @@ -1,43 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" - - - - -void quicktime_matrix_init(quicktime_matrix_t *matrix) -{ - int i; - for(i = 0; i < 9; i++) matrix->values[i] = 0; - matrix->values[0] = matrix->values[4] = 1; - matrix->values[8] = 16384; -} - -void quicktime_matrix_delete(quicktime_matrix_t *matrix) -{ -} - -void quicktime_read_matrix(quicktime_t *file, quicktime_matrix_t *matrix) -{ - int i = 0; - for(i = 0; i < 9; i++) - { - matrix->values[i] = quicktime_read_fixed32(file); - } -} - -void quicktime_matrix_dump(quicktime_matrix_t *matrix) -{ - int i; - printf(" matrix"); - for(i = 0; i < 9; i++) printf(" %f", matrix->values[i]); - printf("\n"); -} - -void quicktime_write_matrix(quicktime_t *file, quicktime_matrix_t *matrix) -{ - int i; - for(i = 0; i < 9; i++) - { - quicktime_write_fixed32(file, matrix->values[i]); - } -} diff --git a/cinelerra-5.0/quicktime/mdat.c b/cinelerra-5.0/quicktime/mdat.c deleted file mode 100644 index 26dc7147..00000000 --- a/cinelerra-5.0/quicktime/mdat.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include "funcprotos.h" -#include "quicktime.h" - -void quicktime_mdat_delete(quicktime_mdat_t *mdat) -{ -} - -void quicktime_read_mdat(quicktime_t *file, quicktime_mdat_t *mdat, quicktime_atom_t *parent_atom) -{ - mdat->atom.size = parent_atom->size; -// Relative to start of the mdat string - mdat->atom.start = parent_atom->start; - quicktime_atom_skip(file, parent_atom); -} diff --git a/cinelerra-5.0/quicktime/mdhd.c b/cinelerra-5.0/quicktime/mdhd.c deleted file mode 100644 index b1b3f2c1..00000000 --- a/cinelerra-5.0/quicktime/mdhd.c +++ /dev/null @@ -1,79 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" - -void quicktime_mdhd_init(quicktime_mdhd_t *mdhd) -{ - mdhd->version = 0; - mdhd->flags = 0; - mdhd->creation_time = quicktime_current_time(); - mdhd->modification_time = quicktime_current_time(); - mdhd->time_scale = 0; - mdhd->duration = 0; - mdhd->language = 0; - mdhd->quality = 100; -} - -void quicktime_mdhd_init_video(quicktime_t *file, - quicktime_mdhd_t *mdhd, - int frame_w, - int frame_h, - float frame_rate) -{ - mdhd->time_scale = quicktime_get_timescale(frame_rate); -//printf("quicktime_mdhd_init_video %d %f\n", mdhd->time_scale, frame_rate); - mdhd->duration = 0; /* set this when closing */ -} - -void quicktime_mdhd_init_audio(quicktime_mdhd_t *mdhd, - int sample_rate) -{ - mdhd->time_scale = sample_rate; - mdhd->duration = 0; /* set this when closing */ -} - -void quicktime_mdhd_delete(quicktime_mdhd_t *mdhd) -{ -} - -void quicktime_read_mdhd(quicktime_t *file, quicktime_mdhd_t *mdhd) -{ - mdhd->version = quicktime_read_char(file); - mdhd->flags = quicktime_read_int24(file); - mdhd->creation_time = quicktime_read_int32(file); - mdhd->modification_time = quicktime_read_int32(file); - mdhd->time_scale = quicktime_read_int32(file); - mdhd->duration = quicktime_read_int32(file); - mdhd->language = quicktime_read_int16(file); - mdhd->quality = quicktime_read_int16(file); -} - -void quicktime_mdhd_dump(quicktime_mdhd_t *mdhd) -{ - printf(" media header\n"); - printf(" version %d\n", mdhd->version); - printf(" flags %ld\n", mdhd->flags); - printf(" creation_time %lu\n", mdhd->creation_time); - printf(" modification_time %lu\n", mdhd->modification_time); - printf(" time_scale %ld\n", mdhd->time_scale); - printf(" duration %ld\n", mdhd->duration); - printf(" language %d\n", mdhd->language); - printf(" quality %d\n", mdhd->quality); -} - -void quicktime_write_mdhd(quicktime_t *file, quicktime_mdhd_t *mdhd) -{ - quicktime_atom_t atom; - quicktime_atom_write_header(file, &atom, "mdhd"); - - quicktime_write_char(file, mdhd->version); - quicktime_write_int24(file, mdhd->flags); - quicktime_write_int32(file, mdhd->creation_time); - quicktime_write_int32(file, mdhd->modification_time); - quicktime_write_int32(file, mdhd->time_scale); - quicktime_write_int32(file, mdhd->duration); - quicktime_write_int16(file, mdhd->language); - quicktime_write_int16(file, mdhd->quality); - - quicktime_atom_write_footer(file, &atom); -} - diff --git a/cinelerra-5.0/quicktime/mdia.c b/cinelerra-5.0/quicktime/mdia.c deleted file mode 100644 index 68205adf..00000000 --- a/cinelerra-5.0/quicktime/mdia.c +++ /dev/null @@ -1,100 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" - - -void quicktime_mdia_init(quicktime_mdia_t *mdia) -{ - quicktime_mdhd_init(&(mdia->mdhd)); - quicktime_hdlr_init(&(mdia->hdlr)); - quicktime_minf_init(&(mdia->minf)); -} - -void quicktime_mdia_init_video(quicktime_t *file, - quicktime_mdia_t *mdia, - int frame_w, - int frame_h, - float frame_rate, - char *compressor) -{ -//printf("quicktime_mdia_init_video 1\n"); - quicktime_mdhd_init_video(file, &(mdia->mdhd), frame_w, frame_h, frame_rate); -//printf("quicktime_mdia_init_video 1 %d %f\n", mdia->mdhd.time_scale, frame_rate); - quicktime_minf_init_video(file, &(mdia->minf), frame_w, frame_h, mdia->mdhd.time_scale, frame_rate, compressor); -//printf("quicktime_mdia_init_video 1\n"); - quicktime_hdlr_init_video(&(mdia->hdlr)); -//printf("quicktime_mdia_init_video 2\n"); -} - -void quicktime_mdia_init_audio(quicktime_t *file, - quicktime_mdia_t *mdia, - int channels, - int sample_rate, - int bits, - char *compressor) -{ - quicktime_mdhd_init_audio(&(mdia->mdhd), - sample_rate); - quicktime_minf_init_audio(file, - &(mdia->minf), - channels, - sample_rate, - bits, - compressor); - quicktime_hdlr_init_audio(&(mdia->hdlr)); -} - -void quicktime_mdia_delete(quicktime_mdia_t *mdia) -{ - quicktime_mdhd_delete(&(mdia->mdhd)); - quicktime_hdlr_delete(&(mdia->hdlr)); - quicktime_minf_delete(&(mdia->minf)); -} - -void quicktime_mdia_dump(quicktime_mdia_t *mdia) -{ - printf(" media\n"); - quicktime_mdhd_dump(&(mdia->mdhd)); - quicktime_hdlr_dump(&(mdia->hdlr)); - quicktime_minf_dump(&(mdia->minf)); -} - -int quicktime_read_mdia(quicktime_t *file, quicktime_mdia_t *mdia, quicktime_atom_t *trak_atom) -{ - quicktime_atom_t leaf_atom; - - do - { - quicktime_atom_read_header(file, &leaf_atom); -//printf("quicktime_read_mdia %llx\n", quicktime_position(file)); - -/* mandatory */ - if(quicktime_atom_is(&leaf_atom, "mdhd")) - { quicktime_read_mdhd(file, &(mdia->mdhd)); } - else - if(quicktime_atom_is(&leaf_atom, "hdlr")) - { - quicktime_read_hdlr(file, &(mdia->hdlr)); -/* Main Actor doesn't write component name */ - quicktime_atom_skip(file, &leaf_atom); - } - else - if(quicktime_atom_is(&leaf_atom, "minf")) - { quicktime_read_minf(file, &(mdia->minf), &leaf_atom); } - else - quicktime_atom_skip(file, &leaf_atom); - }while(quicktime_position(file) < trak_atom->end); - - return 0; -} - -void quicktime_write_mdia(quicktime_t *file, quicktime_mdia_t *mdia) -{ - quicktime_atom_t atom; - quicktime_atom_write_header(file, &atom, "mdia"); - - quicktime_write_mdhd(file, &(mdia->mdhd)); - quicktime_write_hdlr(file, &(mdia->hdlr)); - quicktime_write_minf(file, &(mdia->minf)); - - quicktime_atom_write_footer(file, &atom); -} diff --git a/cinelerra-5.0/quicktime/minf.c b/cinelerra-5.0/quicktime/minf.c deleted file mode 100644 index 44386322..00000000 --- a/cinelerra-5.0/quicktime/minf.c +++ /dev/null @@ -1,123 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" - - - -void quicktime_minf_init(quicktime_minf_t *minf) -{ - minf->is_video = minf->is_audio = 0; - quicktime_vmhd_init(&(minf->vmhd)); - quicktime_smhd_init(&(minf->smhd)); - quicktime_hdlr_init(&(minf->hdlr)); - quicktime_dinf_init(&(minf->dinf)); - quicktime_stbl_init(&(minf->stbl)); -} - -void quicktime_minf_init_video(quicktime_t *file, - quicktime_minf_t *minf, - int frame_w, - int frame_h, - int time_scale, - float frame_rate, - char *compressor) -{ - minf->is_video = 1; -//printf("quicktime_minf_init_video 1\n"); - quicktime_vmhd_init_video(file, &(minf->vmhd), frame_w, frame_h, frame_rate); -//printf("quicktime_minf_init_video 1 %d %f\n", time_scale, frame_rate); - quicktime_stbl_init_video(file, &(minf->stbl), frame_w, frame_h, time_scale, frame_rate, compressor); -//printf("quicktime_minf_init_video 2\n"); - quicktime_hdlr_init_data(&(minf->hdlr)); -//printf("quicktime_minf_init_video 1\n"); - quicktime_dinf_init_all(&(minf->dinf)); -//printf("quicktime_minf_init_video 2\n"); -} - -void quicktime_minf_init_audio(quicktime_t *file, - quicktime_minf_t *minf, - int channels, - int sample_rate, - int bits, - char *compressor) -{ - minf->is_audio = 1; -/* smhd doesn't store anything worth initializing */ - quicktime_stbl_init_audio(file, - &(minf->stbl), - channels, - sample_rate, - bits, - compressor); - quicktime_hdlr_init_data(&(minf->hdlr)); - quicktime_dinf_init_all(&(minf->dinf)); -} - -void quicktime_minf_delete(quicktime_minf_t *minf) -{ - quicktime_vmhd_delete(&(minf->vmhd)); - quicktime_smhd_delete(&(minf->smhd)); - quicktime_dinf_delete(&(minf->dinf)); - quicktime_stbl_delete(&(minf->stbl)); - quicktime_hdlr_delete(&(minf->hdlr)); -} - -void quicktime_minf_dump(quicktime_minf_t *minf) -{ - printf(" media info\n"); - printf(" is_audio %d\n", minf->is_audio); - printf(" is_video %d\n", minf->is_video); - if(minf->is_audio) quicktime_smhd_dump(&(minf->smhd)); - if(minf->is_video) quicktime_vmhd_dump(&(minf->vmhd)); - quicktime_hdlr_dump(&(minf->hdlr)); - quicktime_dinf_dump(&(minf->dinf)); - quicktime_stbl_dump(minf, &(minf->stbl)); -} - -int quicktime_read_minf(quicktime_t *file, quicktime_minf_t *minf, quicktime_atom_t *parent_atom) -{ - quicktime_atom_t leaf_atom; - - do - { - quicktime_atom_read_header(file, &leaf_atom); -//printf("quicktime_read_minf 1\n"); - -/* mandatory */ - if(quicktime_atom_is(&leaf_atom, "vmhd")) - { minf->is_video = 1; quicktime_read_vmhd(file, &(minf->vmhd)); } - else - if(quicktime_atom_is(&leaf_atom, "smhd")) - { minf->is_audio = 1; quicktime_read_smhd(file, &(minf->smhd)); } - else - if(quicktime_atom_is(&leaf_atom, "hdlr")) - { - quicktime_read_hdlr(file, &(minf->hdlr)); -/* Main Actor doesn't write component name */ - quicktime_atom_skip(file, &leaf_atom); - } - else - if(quicktime_atom_is(&leaf_atom, "dinf")) - { quicktime_read_dinf(file, &(minf->dinf), &leaf_atom); } - else - if(quicktime_atom_is(&leaf_atom, "stbl")) - { quicktime_read_stbl(file, minf, &(minf->stbl), &leaf_atom); } - else - quicktime_atom_skip(file, &leaf_atom); - }while(quicktime_position(file) < parent_atom->end); - - return 0; -} - -void quicktime_write_minf(quicktime_t *file, quicktime_minf_t *minf) -{ - quicktime_atom_t atom; - quicktime_atom_write_header(file, &atom, "minf"); - - if(minf->is_video) quicktime_write_vmhd(file, &(minf->vmhd)); - if(minf->is_audio) quicktime_write_smhd(file, &(minf->smhd)); - quicktime_write_hdlr(file, &(minf->hdlr)); - quicktime_write_dinf(file, &(minf->dinf)); - quicktime_write_stbl(file, minf, &(minf->stbl)); - - quicktime_atom_write_footer(file, &atom); -} diff --git a/cinelerra-5.0/quicktime/mmx.h b/cinelerra-5.0/quicktime/mmx.h deleted file mode 100644 index 2ad87148..00000000 --- a/cinelerra-5.0/quicktime/mmx.h +++ /dev/null @@ -1,733 +0,0 @@ -/* mmx.h - - MultiMedia eXtensions GCC interface library for IA32. - - To use this library, simply include this header file - and compile with GCC. You MUST have inlining enabled - in order for mmx_ok() to work; this can be done by - simply using -O on the GCC command line. - - Compiling with -DMMX_TRACE will cause detailed trace - output to be sent to stderr for each mmx operation. - This adds lots of code, and obviously slows execution to - a crawl, but can be very useful for debugging. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY - EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT - LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR ANY PARTICULAR PURPOSE. - - 1997-98 by H. Dietz and R. Fisher - - History: - 97-98* R.Fisher Early versions - 980501 R.Fisher Original Release - 980611* H.Dietz Rewrite, correctly implementing inlines, and - R.Fisher including direct register accesses. - 980616 R.Fisher Release of 980611 as 980616. - 980714 R.Fisher Minor corrections to Makefile, etc. - 980715 R.Fisher mmx_ok() now prevents optimizer from using - clobbered values. - mmx_ok() now checks if cpuid instruction is - available before trying to use it. - 980726* R.Fisher mm_support() searches for AMD 3DNow, Cyrix - Extended MMX, and standard MMX. It returns a - value which is positive if any of these are - supported, and can be masked with constants to - see which. mmx_ok() is now a call to this - 980726* R.Fisher Added i2r support for shift functions - 980919 R.Fisher Fixed AMD extended feature recognition bug. - 980921 R.Fisher Added definition/check for _MMX_H. - Added "float s[2]" to mmx_t for use with - 3DNow and EMMX. So same mmx_t can be used. - 981013 R.Fisher Fixed cpuid function 1 bug (looked at wrong reg) - Fixed psllq_i2r error in mmxtest.c - - * Unreleased (internal or interim) versions - - Notes: - It appears that the latest gas has the pand problem fixed, therefore - I'll undefine BROKEN_PAND by default. - String compares may be quicker than the multiple test/jumps in vendor - test sequence in mmx_ok(), but I'm not concerned with that right now. - - Acknowledgments: - Jussi Laako for pointing out the errors ultimately found to be - connected to the failure to notify the optimizer of clobbered values. - Roger Hardiman for reminding us that CPUID isn't everywhere, and that - someone may actually try to use this on a machine without CPUID. - Also for suggesting code for checking this. - Robert Dale for pointing out the AMD recognition bug. - Jimmy Mayfield and Carl Witty for pointing out the Intel recognition - bug. - Carl Witty for pointing out the psllq_i2r test bug. -*/ - -#ifndef _MMX_H -#define _MMX_H - -/*#define MMX_TRACE */ - -/* Warning: at this writing, the version of GAS packaged - with most Linux distributions does not handle the - parallel AND operation mnemonic correctly. If the - symbol BROKEN_PAND is defined, a slower alternative - coding will be used. If execution of mmxtest results - in an illegal instruction fault, define this symbol. -*/ -#undef BROKEN_PAND - - -/* The type of an value that fits in an MMX register - (note that long long constant values MUST be suffixed - by LL and unsigned long long values by ULL, lest - they be truncated by the compiler) -*/ -typedef union { - long long q; /* Quadword (64-bit) value */ - unsigned long long uq; /* Unsigned Quadword */ - int d[2]; /* 2 Doubleword (32-bit) values */ - unsigned int ud[2]; /* 2 Unsigned Doubleword */ - short w[4]; /* 4 Word (16-bit) values */ - unsigned short uw[4]; /* 4 Unsigned Word */ - char b[8]; /* 8 Byte (8-bit) values */ - unsigned char ub[8]; /* 8 Unsigned Byte */ - float s[2]; /* Single-precision (32-bit) value */ -} mmx_t; - - - -/* - * Drop mm_support() and mmx_ok() as these do not build with clang and - * are unused by Cinelerra CV. Inspired by change found in - * - */ -#if !defined(__clang__) -/* Function to test if multimedia instructions are supported... -*/ -inline extern int -mm_support(void) -{ - /* Returns 1 if MMX instructions are supported, - 3 if Cyrix MMX and Extended MMX instructions are supported - 5 if AMD MMX and 3DNow! instructions are supported - 0 if hardware does not support any of these - */ - register int rval = 0; - - __asm__ __volatile__ ( - /* See if CPUID instruction is supported ... */ - /* ... Get copies of EFLAGS into eax and ecx */ - "pushf\n\t" - "popl %%eax\n\t" - "movl %%eax, %%ecx\n\t" - - /* ... Toggle the ID bit in one copy and store */ - /* to the EFLAGS reg */ - "xorl $0x200000, %%eax\n\t" - "push %%eax\n\t" - "popf\n\t" - - /* ... Get the (hopefully modified) EFLAGS */ - "pushf\n\t" - "popl %%eax\n\t" - - /* ... Compare and test result */ - "xorl %%eax, %%ecx\n\t" - "testl $0x200000, %%ecx\n\t" - "jz NotSupported1\n\t" /* Nothing supported */ - - - /* Get standard CPUID information, and - go to a specific vendor section */ - "movl $0, %%eax\n\t" - "cpuid\n\t" - - /* Check for Intel */ - "cmpl $0x756e6547, %%ebx\n\t" - "jne TryAMD\n\t" - "cmpl $0x49656e69, %%edx\n\t" - "jne TryAMD\n\t" - "cmpl $0x6c65746e, %%ecx\n" - "jne TryAMD\n\t" - "jmp Intel\n\t" - - /* Check for AMD */ - "\nTryAMD:\n\t" - "cmpl $0x68747541, %%ebx\n\t" - "jne TryCyrix\n\t" - "cmpl $0x69746e65, %%edx\n\t" - "jne TryCyrix\n\t" - "cmpl $0x444d4163, %%ecx\n" - "jne TryCyrix\n\t" - "jmp AMD\n\t" - - /* Check for Cyrix */ - "\nTryCyrix:\n\t" - "cmpl $0x69727943, %%ebx\n\t" - "jne NotSupported2\n\t" - "cmpl $0x736e4978, %%edx\n\t" - "jne NotSupported3\n\t" - "cmpl $0x64616574, %%ecx\n\t" - "jne NotSupported4\n\t" - /* Drop through to Cyrix... */ - - - /* Cyrix Section */ - /* See if extended CPUID is supported */ - "movl $0x80000000, %%eax\n\t" - "cpuid\n\t" - "cmpl $0x80000000, %%eax\n\t" - "jl MMXtest\n\t" /* Try standard CPUID instead */ - - /* Extended CPUID supported, so get extended features */ - "movl $0x80000001, %%eax\n\t" - "cpuid\n\t" - "testl $0x00800000, %%eax\n\t" /* Test for MMX */ - "jz NotSupported5\n\t" /* MMX not supported */ - "testl $0x01000000, %%eax\n\t" /* Test for Ext'd MMX */ - "jnz EMMXSupported\n\t" - "movl $1, %0:\n\n\t" /* MMX Supported */ - "jmp Return\n\n" - "EMMXSupported:\n\t" - "movl $3, %0:\n\n\t" /* EMMX and MMX Supported */ - "jmp Return\n\t" - - - /* AMD Section */ - "AMD:\n\t" - - /* See if extended CPUID is supported */ - "movl $0x80000000, %%eax\n\t" - "cpuid\n\t" - "cmpl $0x80000000, %%eax\n\t" - "jl MMXtest\n\t" /* Try standard CPUID instead */ - - /* Extended CPUID supported, so get extended features */ - "movl $0x80000001, %%eax\n\t" - "cpuid\n\t" - "testl $0x00800000, %%edx\n\t" /* Test for MMX */ - "jz NotSupported6\n\t" /* MMX not supported */ - "testl $0x80000000, %%edx\n\t" /* Test for 3DNow! */ - "jnz ThreeDNowSupported\n\t" - "movl $1, %0:\n\n\t" /* MMX Supported */ - "jmp Return\n\n" - "ThreeDNowSupported:\n\t" - "movl $5, %0:\n\n\t" /* 3DNow! and MMX Supported */ - "jmp Return\n\t" - - - /* Intel Section */ - "Intel:\n\t" - - /* Check for MMX */ - "MMXtest:\n\t" - "movl $1, %%eax\n\t" - "cpuid\n\t" - "testl $0x00800000, %%edx\n\t" /* Test for MMX */ - "jz NotSupported7\n\t" /* MMX Not supported */ - "movl $1, %0:\n\n\t" /* MMX Supported */ - "jmp Return\n\t" - - /* Nothing supported */ - "\nNotSupported1:\n\t" - "#movl $101, %0:\n\n\t" - "\nNotSupported2:\n\t" - "#movl $102, %0:\n\n\t" - "\nNotSupported3:\n\t" - "#movl $103, %0:\n\n\t" - "\nNotSupported4:\n\t" - "#movl $104, %0:\n\n\t" - "\nNotSupported5:\n\t" - "#movl $105, %0:\n\n\t" - "\nNotSupported6:\n\t" - "#movl $106, %0:\n\n\t" - "\nNotSupported7:\n\t" - "#movl $107, %0:\n\n\t" - "movl $0, %0:\n\n\t" - - "Return:\n\t" - : "=a" (rval) - : /* no input */ - : "eax", "ebx", "ecx", "edx" - ); - - /* Return */ - return(rval); -} - -/* Function to test if mmx instructions are supported... -*/ -inline extern int -mmx_ok(void) -{ - /* Returns 1 if MMX instructions are supported, 0 otherwise */ - return ( mm_support() & 0x1 ); -} -#endif /* not __clang__ */ - - -/* Helper functions for the instruction macros that follow... - (note that memory-to-register, m2r, instructions are nearly - as efficient as register-to-register, r2r, instructions; - however, memory-to-memory instructions are really simulated - as a convenience, and are only 1/3 as efficient) -*/ -#ifdef MMX_TRACE - -/* Include the stuff for printing a trace to stderr... -*/ - -#include - -#define mmx_i2r(op, imm, reg) \ - { \ - mmx_t mmx_trace; \ - mmx_trace = (imm); \ - fprintf(stderr, #op "_i2r(" #imm "=0x%016llx, ", mmx_trace.q); \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - fprintf(stderr, #reg "=0x%016llx) => ", mmx_trace.q); \ - __asm__ __volatile__ (#op " %0, %%" #reg \ - : /* nothing */ \ - : "X" (imm)); \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - fprintf(stderr, #reg "=0x%016llx\n", mmx_trace.q); \ - } - -#define mmx_m2r(op, mem, reg) \ - { \ - mmx_t mmx_trace; \ - mmx_trace = (mem); \ - fprintf(stderr, #op "_m2r(" #mem "=0x%016llx, ", mmx_trace.q); \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - fprintf(stderr, #reg "=0x%016llx) => ", mmx_trace.q); \ - __asm__ __volatile__ (#op " %0, %%" #reg \ - : /* nothing */ \ - : "X" (mem)); \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - fprintf(stderr, #reg "=0x%016llx\n", mmx_trace.q); \ - } - -#define mmx_r2m(op, reg, mem) \ - { \ - mmx_t mmx_trace; \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - fprintf(stderr, #op "_r2m(" #reg "=0x%016llx, ", mmx_trace.q); \ - mmx_trace = (mem); \ - fprintf(stderr, #mem "=0x%016llx) => ", mmx_trace.q); \ - __asm__ __volatile__ (#op " %%" #reg ", %0" \ - : "=X" (mem) \ - : /* nothing */ ); \ - mmx_trace = (mem); \ - fprintf(stderr, #mem "=0x%016llx\n", mmx_trace.q); \ - } - -#define mmx_r2r(op, regs, regd) \ - { \ - mmx_t mmx_trace; \ - __asm__ __volatile__ ("movq %%" #regs ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - fprintf(stderr, #op "_r2r(" #regs "=0x%016llx, ", mmx_trace.q); \ - __asm__ __volatile__ ("movq %%" #regd ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - fprintf(stderr, #regd "=0x%016llx) => ", mmx_trace.q); \ - __asm__ __volatile__ (#op " %" #regs ", %" #regd); \ - __asm__ __volatile__ ("movq %%" #regd ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - fprintf(stderr, #regd "=0x%016llx\n", mmx_trace.q); \ - } - -#define mmx_m2m(op, mems, memd) \ - { \ - mmx_t mmx_trace; \ - mmx_trace = (mems); \ - fprintf(stderr, #op "_m2m(" #mems "=0x%016llx, ", mmx_trace.q); \ - mmx_trace = (memd); \ - fprintf(stderr, #memd "=0x%016llx) => ", mmx_trace.q); \ - __asm__ __volatile__ ("movq %0, %%mm0\n\t" \ - #op " %1, %%mm0\n\t" \ - "movq %%mm0, %0" \ - : "=X" (memd) \ - : "X" (mems)); \ - mmx_trace = (memd); \ - fprintf(stderr, #memd "=0x%016llx\n", mmx_trace.q); \ - } - -#else - -/* These macros are a lot simpler without the tracing... -*/ - -#define mmx_i2r(op, imm, reg) \ - __asm__ __volatile__ (#op " $" #imm ", %%" #reg \ - : /* nothing */ \ - : /* nothing */); - -#define mmx_m2r(op, mem, reg) \ - __asm__ __volatile__ (#op " %0, %%" #reg \ - : /* nothing */ \ - : "X" (mem)) - -#define mmx_r2m(op, reg, mem) \ - __asm__ __volatile__ (#op " %%" #reg ", %0" \ - : "=X" (mem) \ - : /* nothing */ ) - -#define mmx_r2r(op, regs, regd) \ - __asm__ __volatile__ (#op " %" #regs ", %" #regd) - -#define mmx_m2m(op, mems, memd) \ - __asm__ __volatile__ ("movq %0, %%mm0\n\t" \ - #op " %1, %%mm0\n\t" \ - "movq %%mm0, %0" \ - : "=X" (memd) \ - : "X" (mems)) - -#endif - - -/* 1x64 MOVe Quadword - (this is both a load and a store... - in fact, it is the only way to store) -*/ -#define movq_m2r(var, reg) mmx_m2r(movq, var, reg) -#define movq_r2m(reg, var) mmx_r2m(movq, reg, var) -#define movq_r2r(regs, regd) mmx_r2r(movq, regs, regd) -#define movq(vars, vard) \ - __asm__ __volatile__ ("movq %1, %%mm0\n\t" \ - "movq %%mm0, %0" \ - : "=X" (vard) \ - : "X" (vars)) - - -/* 1x32 MOVe Doubleword - (like movq, this is both load and store... - but is most useful for moving things between - mmx registers and ordinary registers) -*/ -#define movd_m2r(var, reg) mmx_m2r(movd, var, reg) -#define movd_r2m(reg, var) mmx_r2m(movd, reg, var) -#define movd_r2r(regs, regd) mmx_r2r(movd, regs, regd) -#define movd(vars, vard) \ - __asm__ __volatile__ ("movd %1, %%mm0\n\t" \ - "movd %%mm0, %0" \ - : "=X" (vard) \ - : "X" (vars)) - - -/* 2x32, 4x16, and 8x8 Parallel ADDs -*/ -#define paddd_m2r(var, reg) mmx_m2r(paddd, var, reg) -#define paddd_r2r(regs, regd) mmx_r2r(paddd, regs, regd) -#define paddd(vars, vard) mmx_m2m(paddd, vars, vard) - -#define paddw_m2r(var, reg) mmx_m2r(paddw, var, reg) -#define paddw_r2r(regs, regd) mmx_r2r(paddw, regs, regd) -#define paddw(vars, vard) mmx_m2m(paddw, vars, vard) - -#define paddb_m2r(var, reg) mmx_m2r(paddb, var, reg) -#define paddb_r2r(regs, regd) mmx_r2r(paddb, regs, regd) -#define paddb(vars, vard) mmx_m2m(paddb, vars, vard) - - -/* 4x16 and 8x8 Parallel ADDs using Saturation arithmetic -*/ -#define paddsw_m2r(var, reg) mmx_m2r(paddsw, var, reg) -#define paddsw_r2r(regs, regd) mmx_r2r(paddsw, regs, regd) -#define paddsw(vars, vard) mmx_m2m(paddsw, vars, vard) - -#define paddsb_m2r(var, reg) mmx_m2r(paddsb, var, reg) -#define paddsb_r2r(regs, regd) mmx_r2r(paddsb, regs, regd) -#define paddsb(vars, vard) mmx_m2m(paddsb, vars, vard) - - -/* 4x16 and 8x8 Parallel ADDs using Unsigned Saturation arithmetic -*/ -#define paddusw_m2r(var, reg) mmx_m2r(paddusw, var, reg) -#define paddusw_r2r(regs, regd) mmx_r2r(paddusw, regs, regd) -#define paddusw(vars, vard) mmx_m2m(paddusw, vars, vard) - -#define paddusb_m2r(var, reg) mmx_m2r(paddusb, var, reg) -#define paddusb_r2r(regs, regd) mmx_r2r(paddusb, regs, regd) -#define paddusb(vars, vard) mmx_m2m(paddusb, vars, vard) - - -/* 2x32, 4x16, and 8x8 Parallel SUBs -*/ -#define psubd_m2r(var, reg) mmx_m2r(psubd, var, reg) -#define psubd_r2r(regs, regd) mmx_r2r(psubd, regs, regd) -#define psubd(vars, vard) mmx_m2m(psubd, vars, vard) - -#define psubw_m2r(var, reg) mmx_m2r(psubw, var, reg) -#define psubw_r2r(regs, regd) mmx_r2r(psubw, regs, regd) -#define psubw(vars, vard) mmx_m2m(psubw, vars, vard) - -#define psubb_m2r(var, reg) mmx_m2r(psubb, var, reg) -#define psubb_r2r(regs, regd) mmx_r2r(psubb, regs, regd) -#define psubb(vars, vard) mmx_m2m(psubb, vars, vard) - - -/* 4x16 and 8x8 Parallel SUBs using Saturation arithmetic -*/ -#define psubsw_m2r(var, reg) mmx_m2r(psubsw, var, reg) -#define psubsw_r2r(regs, regd) mmx_r2r(psubsw, regs, regd) -#define psubsw(vars, vard) mmx_m2m(psubsw, vars, vard) - -#define psubsb_m2r(var, reg) mmx_m2r(psubsb, var, reg) -#define psubsb_r2r(regs, regd) mmx_r2r(psubsb, regs, regd) -#define psubsb(vars, vard) mmx_m2m(psubsb, vars, vard) - - -/* 4x16 and 8x8 Parallel SUBs using Unsigned Saturation arithmetic -*/ -#define psubusw_m2r(var, reg) mmx_m2r(psubusw, var, reg) -#define psubusw_r2r(regs, regd) mmx_r2r(psubusw, regs, regd) -#define psubusw(vars, vard) mmx_m2m(psubusw, vars, vard) - -#define psubusb_m2r(var, reg) mmx_m2r(psubusb, var, reg) -#define psubusb_r2r(regs, regd) mmx_r2r(psubusb, regs, regd) -#define psubusb(vars, vard) mmx_m2m(psubusb, vars, vard) - - -/* 4x16 Parallel MULs giving Low 4x16 portions of results -*/ -#define pmullw_m2r(var, reg) mmx_m2r(pmullw, var, reg) -#define pmullw_r2r(regs, regd) mmx_r2r(pmullw, regs, regd) -#define pmullw(vars, vard) mmx_m2m(pmullw, vars, vard) - - -/* 4x16 Parallel MULs giving High 4x16 portions of results -*/ -#define pmulhw_m2r(var, reg) mmx_m2r(pmulhw, var, reg) -#define pmulhw_r2r(regs, regd) mmx_r2r(pmulhw, regs, regd) -#define pmulhw(vars, vard) mmx_m2m(pmulhw, vars, vard) - - -/* 4x16->2x32 Parallel Mul-ADD - (muls like pmullw, then adds adjacent 16-bit fields - in the multiply result to make the final 2x32 result) -*/ -#define pmaddwd_m2r(var, reg) mmx_m2r(pmaddwd, var, reg) -#define pmaddwd_r2r(regs, regd) mmx_r2r(pmaddwd, regs, regd) -#define pmaddwd(vars, vard) mmx_m2m(pmaddwd, vars, vard) - - -/* 1x64 bitwise AND -*/ -#ifdef BROKEN_PAND -#define pand_m2r(var, reg) \ - { \ - mmx_m2r(pandn, (mmx_t) -1LL, reg); \ - mmx_m2r(pandn, var, reg); \ - } -#define pand_r2r(regs, regd) \ - { \ - mmx_m2r(pandn, (mmx_t) -1LL, regd); \ - mmx_r2r(pandn, regs, regd) \ - } -#define pand(vars, vard) \ - { \ - movq_m2r(vard, mm0); \ - mmx_m2r(pandn, (mmx_t) -1LL, mm0); \ - mmx_m2r(pandn, vars, mm0); \ - movq_r2m(mm0, vard); \ - } -#else -#define pand_m2r(var, reg) mmx_m2r(pand, var, reg) -#define pand_r2r(regs, regd) mmx_r2r(pand, regs, regd) -#define pand(vars, vard) mmx_m2m(pand, vars, vard) -#endif - - -/* 1x64 bitwise AND with Not the destination -*/ -#define pandn_m2r(var, reg) mmx_m2r(pandn, var, reg) -#define pandn_r2r(regs, regd) mmx_r2r(pandn, regs, regd) -#define pandn(vars, vard) mmx_m2m(pandn, vars, vard) - - -/* 1x64 bitwise OR -*/ -#define por_m2r(var, reg) mmx_m2r(por, var, reg) -#define por_r2r(regs, regd) mmx_r2r(por, regs, regd) -#define por(vars, vard) mmx_m2m(por, vars, vard) - - -/* 1x64 bitwise eXclusive OR -*/ -#define pxor_m2r(var, reg) mmx_m2r(pxor, var, reg) -#define pxor_r2r(regs, regd) mmx_r2r(pxor, regs, regd) -#define pxor(vars, vard) mmx_m2m(pxor, vars, vard) - - -/* 2x32, 4x16, and 8x8 Parallel CoMPare for EQuality - (resulting fields are either 0 or -1) -*/ -#define pcmpeqd_m2r(var, reg) mmx_m2r(pcmpeqd, var, reg) -#define pcmpeqd_r2r(regs, regd) mmx_r2r(pcmpeqd, regs, regd) -#define pcmpeqd(vars, vard) mmx_m2m(pcmpeqd, vars, vard) - -#define pcmpeqw_m2r(var, reg) mmx_m2r(pcmpeqw, var, reg) -#define pcmpeqw_r2r(regs, regd) mmx_r2r(pcmpeqw, regs, regd) -#define pcmpeqw(vars, vard) mmx_m2m(pcmpeqw, vars, vard) - -#define pcmpeqb_m2r(var, reg) mmx_m2r(pcmpeqb, var, reg) -#define pcmpeqb_r2r(regs, regd) mmx_r2r(pcmpeqb, regs, regd) -#define pcmpeqb(vars, vard) mmx_m2m(pcmpeqb, vars, vard) - - -/* 2x32, 4x16, and 8x8 Parallel CoMPare for Greater Than - (resulting fields are either 0 or -1) -*/ -#define pcmpgtd_m2r(var, reg) mmx_m2r(pcmpgtd, var, reg) -#define pcmpgtd_r2r(regs, regd) mmx_r2r(pcmpgtd, regs, regd) -#define pcmpgtd(vars, vard) mmx_m2m(pcmpgtd, vars, vard) - -#define pcmpgtw_m2r(var, reg) mmx_m2r(pcmpgtw, var, reg) -#define pcmpgtw_r2r(regs, regd) mmx_r2r(pcmpgtw, regs, regd) -#define pcmpgtw(vars, vard) mmx_m2m(pcmpgtw, vars, vard) - -#define pcmpgtb_m2r(var, reg) mmx_m2r(pcmpgtb, var, reg) -#define pcmpgtb_r2r(regs, regd) mmx_r2r(pcmpgtb, regs, regd) -#define pcmpgtb(vars, vard) mmx_m2m(pcmpgtb, vars, vard) - - -/* 1x64, 2x32, and 4x16 Parallel Shift Left Logical -*/ -#define psllq_i2r(imm, reg) mmx_i2r(psllq, imm, reg) -#define psllq_m2r(var, reg) mmx_m2r(psllq, var, reg) -#define psllq_r2r(regs, regd) mmx_r2r(psllq, regs, regd) -#define psllq(vars, vard) mmx_m2m(psllq, vars, vard) - -#define pslld_i2r(imm, reg) mmx_i2r(pslld, imm, reg) -#define pslld_m2r(var, reg) mmx_m2r(pslld, var, reg) -#define pslld_r2r(regs, regd) mmx_r2r(pslld, regs, regd) -#define pslld(vars, vard) mmx_m2m(pslld, vars, vard) - -#define psllw_i2r(imm, reg) mmx_i2r(psllw, imm, reg) -#define psllw_m2r(var, reg) mmx_m2r(psllw, var, reg) -#define psllw_r2r(regs, regd) mmx_r2r(psllw, regs, regd) -#define psllw(vars, vard) mmx_m2m(psllw, vars, vard) - - -/* 1x64, 2x32, and 4x16 Parallel Shift Right Logical -*/ -#define psrlq_i2r(imm, reg) mmx_i2r(psrlq, imm, reg) -#define psrlq_m2r(var, reg) mmx_m2r(psrlq, var, reg) -#define psrlq_r2r(regs, regd) mmx_r2r(psrlq, regs, regd) -#define psrlq(vars, vard) mmx_m2m(psrlq, vars, vard) - -#define psrld_i2r(imm, reg) mmx_i2r(psrld, imm, reg) -#define psrld_m2r(var, reg) mmx_m2r(psrld, var, reg) -#define psrld_r2r(regs, regd) mmx_r2r(psrld, regs, regd) -#define psrld(vars, vard) mmx_m2m(psrld, vars, vard) - -#define psrlw_i2r(imm, reg) mmx_i2r(psrlw, imm, reg) -#define psrlw_m2r(var, reg) mmx_m2r(psrlw, var, reg) -#define psrlw_r2r(regs, regd) mmx_r2r(psrlw, regs, regd) -#define psrlw(vars, vard) mmx_m2m(psrlw, vars, vard) - - -/* 2x32 and 4x16 Parallel Shift Right Arithmetic -*/ -#define psrad_i2r(imm, reg) mmx_i2r(psrad, imm, reg) -#define psrad_m2r(var, reg) mmx_m2r(psrad, var, reg) -#define psrad_r2r(regs, regd) mmx_r2r(psrad, regs, regd) -#define psrad(vars, vard) mmx_m2m(psrad, vars, vard) - -#define psraw_i2r(imm, reg) mmx_i2r(psraw, imm, reg) -#define psraw_m2r(var, reg) mmx_m2r(psraw, var, reg) -#define psraw_r2r(regs, regd) mmx_r2r(psraw, regs, regd) -#define psraw(vars, vard) mmx_m2m(psraw, vars, vard) - - -/* 2x32->4x16 and 4x16->8x8 PACK and Signed Saturate - (packs source and dest fields into dest in that order) -*/ -#define packssdw_m2r(var, reg) mmx_m2r(packssdw, var, reg) -#define packssdw_r2r(regs, regd) mmx_r2r(packssdw, regs, regd) -#define packssdw(vars, vard) mmx_m2m(packssdw, vars, vard) - -#define packsswb_m2r(var, reg) mmx_m2r(packsswb, var, reg) -#define packsswb_r2r(regs, regd) mmx_r2r(packsswb, regs, regd) -#define packsswb(vars, vard) mmx_m2m(packsswb, vars, vard) - - -/* 4x16->8x8 PACK and Unsigned Saturate - (packs source and dest fields into dest in that order) -*/ -#define packuswb_m2r(var, reg) mmx_m2r(packuswb, var, reg) -#define packuswb_r2r(regs, regd) mmx_r2r(packuswb, regs, regd) -#define packuswb(vars, vard) mmx_m2m(packuswb, vars, vard) - - -/* 2x32->1x64, 4x16->2x32, and 8x8->4x16 UNPaCK Low - (interleaves low half of dest with low half of source - as padding in each result field) -*/ -#define punpckldq_m2r(var, reg) mmx_m2r(punpckldq, var, reg) -#define punpckldq_r2r(regs, regd) mmx_r2r(punpckldq, regs, regd) -#define punpckldq(vars, vard) mmx_m2m(punpckldq, vars, vard) - -#define punpcklwd_m2r(var, reg) mmx_m2r(punpcklwd, var, reg) -#define punpcklwd_r2r(regs, regd) mmx_r2r(punpcklwd, regs, regd) -#define punpcklwd(vars, vard) mmx_m2m(punpcklwd, vars, vard) - -#define punpcklbw_m2r(var, reg) mmx_m2r(punpcklbw, var, reg) -#define punpcklbw_r2r(regs, regd) mmx_r2r(punpcklbw, regs, regd) -#define punpcklbw(vars, vard) mmx_m2m(punpcklbw, vars, vard) - - -/* 2x32->1x64, 4x16->2x32, and 8x8->4x16 UNPaCK High - (interleaves high half of dest with high half of source - as padding in each result field) -*/ -#define punpckhdq_m2r(var, reg) mmx_m2r(punpckhdq, var, reg) -#define punpckhdq_r2r(regs, regd) mmx_r2r(punpckhdq, regs, regd) -#define punpckhdq(vars, vard) mmx_m2m(punpckhdq, vars, vard) - -#define punpckhwd_m2r(var, reg) mmx_m2r(punpckhwd, var, reg) -#define punpckhwd_r2r(regs, regd) mmx_r2r(punpckhwd, regs, regd) -#define punpckhwd(vars, vard) mmx_m2m(punpckhwd, vars, vard) - -#define punpckhbw_m2r(var, reg) mmx_m2r(punpckhbw, var, reg) -#define punpckhbw_r2r(regs, regd) mmx_r2r(punpckhbw, regs, regd) -#define punpckhbw(vars, vard) mmx_m2m(punpckhbw, vars, vard) - - -/* Empty MMx State - (used to clean-up when going from mmx to float use - of the registers that are shared by both; note that - there is no float-to-mmx operation needed, because - only the float tag word info is corruptible) -*/ -#ifdef MMX_TRACE - -#define emms() \ - { \ - fprintf(stderr, "emms()\n"); \ - __asm__ __volatile__ ("emms"); \ - } - -#else - -#define emms() __asm__ __volatile__ ("emms") - -#endif - -#endif - - diff --git a/cinelerra-5.0/quicktime/moov.c b/cinelerra-5.0/quicktime/moov.c deleted file mode 100644 index 2c4b703b..00000000 --- a/cinelerra-5.0/quicktime/moov.c +++ /dev/null @@ -1,291 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" -#include "workarounds.h" - -#include -#include - - -int quicktime_moov_init(quicktime_moov_t *moov) -{ - int i; - - moov->total_tracks = 0; - for(i = 0 ; i < MAXTRACKS; i++) moov->trak[i] = 0; - quicktime_mvhd_init(&(moov->mvhd)); - quicktime_udta_init(&(moov->udta)); - quicktime_ctab_init(&(moov->ctab)); - return 0; -} - -int quicktime_moov_delete(quicktime_moov_t *moov) -{ - while(moov->total_tracks) quicktime_delete_trak(moov); - quicktime_mvhd_delete(&(moov->mvhd)); - quicktime_udta_delete(&(moov->udta)); - quicktime_ctab_delete(&(moov->ctab)); - return 0; -} - -void quicktime_moov_dump(quicktime_moov_t *moov) -{ - int i; - printf("movie\n"); - quicktime_mvhd_dump(&(moov->mvhd)); - quicktime_udta_dump(&(moov->udta)); - for(i = 0; i < moov->total_tracks; i++) - quicktime_trak_dump(moov->trak[i]); - quicktime_ctab_dump(&(moov->ctab)); -} - -static void* zalloc(void *opaque, unsigned int items, unsigned int size) -{ - return calloc(items, size); -} - -static void zfree(void *opaque, void *ptr) -{ - free(ptr); -} - -static int read_cmov(quicktime_t *file, - quicktime_atom_t *parent_atom, - quicktime_atom_t *moov_atom) -{ - quicktime_atom_t leaf_atom; - - do - { - quicktime_atom_read_header(file, &leaf_atom); - -/* Algorithm used to compress */ - if(quicktime_atom_is(&leaf_atom, "dcom")) - { - char data[5]; -//printf("read_cmov 1 %lld\n", quicktime_position(file)); - quicktime_read_data(file, data, 4); - data[4] = 0; - if(strcmp(data, "zlib")) - { - fprintf(stderr, - "read_cmov: compression '%c%c%c%c' not zlib. Giving up and going to a movie.\n", - data[0], - data[1], - data[2], - data[3]); - return 1; - } - - quicktime_atom_skip(file, &leaf_atom); - } - else -/* Size of uncompressed data followed by compressed data */ - if(quicktime_atom_is(&leaf_atom, "cmvd")) - { -/* Size of uncompressed data */ - int uncompressed_size = quicktime_read_int32(file); -/* Read compressed data */ - int compressed_size = leaf_atom.end - quicktime_position(file); - if(compressed_size > uncompressed_size) - { - fprintf(stderr, - "read_cmov: FYI compressed_size=%d uncompressed_size=%d\n", - compressed_size, - uncompressed_size); - } - - unsigned char *data_in = calloc(1, compressed_size); - quicktime_read_data(file, (char*)data_in, compressed_size); -/* Decompress to another buffer */ - unsigned char *data_out = calloc(1, uncompressed_size + 0x400); - z_stream zlib; - zlib.zalloc = zalloc; - zlib.zfree = zfree; - zlib.opaque = NULL; - zlib.avail_out = uncompressed_size + 0x400; - zlib.next_out = data_out; - zlib.avail_in = compressed_size; - zlib.next_in = data_in; - inflateInit(&zlib); - inflate(&zlib, Z_PARTIAL_FLUSH); - inflateEnd(&zlib); - free(data_in); - file->moov_data = data_out; - -/* - * FILE *test = fopen("/tmp/test", "w"); - * fwrite(data_out, uncompressed_size, 1, test); - * fclose(test); - * exit(0); - */ - - -/* Trick library into reading temporary buffer for the moov */ - file->moov_end = moov_atom->end; - file->moov_size = moov_atom->size; - moov_atom->end = moov_atom->start + uncompressed_size; - moov_atom->size = uncompressed_size; - file->old_preload_size = file->preload_size; - file->old_preload_buffer = file->preload_buffer; - file->old_preload_start = file->preload_start; - file->old_preload_end = file->preload_end; - file->old_preload_ptr = file->preload_ptr; - file->preload_size = uncompressed_size; - file->preload_buffer = (char *)data_out; - file->preload_start = moov_atom->start; - file->preload_end = file->preload_start + uncompressed_size; - file->preload_ptr = 0; - quicktime_set_position(file, file->preload_start + 8); -/* Try again */ - if(quicktime_read_moov(file, - &file->moov, - moov_atom)) - return 1; -/* Exit the compressed state */ - moov_atom->size = file->moov_size; - moov_atom->end = file->moov_end; - file->preload_size = file->old_preload_size; - file->preload_buffer = file->old_preload_buffer; - file->preload_start = file->old_preload_start; - file->preload_end = file->old_preload_end; - file->preload_ptr = file->old_preload_ptr; - quicktime_set_position(file, moov_atom->end); - } - else - quicktime_atom_skip(file, &leaf_atom); - }while(quicktime_position(file) < parent_atom->end); - return 0; -} - - -int quicktime_read_moov(quicktime_t *file, - quicktime_moov_t *moov, - quicktime_atom_t *parent_atom) -{ -/* mandatory mvhd */ - quicktime_atom_t leaf_atom; - -/* AVI translation: */ -/* strh -> mvhd */ - - do - { -//printf("quicktime_read_moov 1 %llx\n", quicktime_position(file)); - quicktime_atom_read_header(file, &leaf_atom); - -/* - * printf("quicktime_read_moov 2 %c%c%c%c\n", - * leaf_atom.type[0], - * leaf_atom.type[1], - * leaf_atom.type[2], - * leaf_atom.type[3]); - */ - - if(quicktime_atom_is(&leaf_atom, "cmov")) - { - file->compressed_moov = 1; - if(read_cmov(file, &leaf_atom, parent_atom)) return 1; -/* Now were reading the compressed moov atom from the beginning. */ - } - else - if(quicktime_atom_is(&leaf_atom, "mvhd")) - { - quicktime_read_mvhd(file, &(moov->mvhd), &leaf_atom); - } - else - if(quicktime_atom_is(&leaf_atom, "clip")) - { - quicktime_atom_skip(file, &leaf_atom); - } - else - if(quicktime_atom_is(&leaf_atom, "trak")) - { - quicktime_trak_t *trak = quicktime_add_trak(file); - quicktime_read_trak(file, trak, &leaf_atom); - } - else - if(quicktime_atom_is(&leaf_atom, "udta")) - { - quicktime_read_udta(file, &(moov->udta), &leaf_atom); - quicktime_atom_skip(file, &leaf_atom); - } - else - if(quicktime_atom_is(&leaf_atom, "ctab")) - { - quicktime_read_ctab(file, &(moov->ctab)); - } - else - quicktime_atom_skip(file, &leaf_atom); - }while(quicktime_position(file) < parent_atom->end); - - return 0; -} - -void quicktime_write_moov(quicktime_t *file, - quicktime_moov_t *moov, - int rewind) -{ - quicktime_atom_t atom; - int i; - long int64_t_duration = 0; - long duration, timescale; - int result; - - -// Try moov header immediately - file->mdat.atom.end = quicktime_position(file); - result = quicktime_atom_write_header(file, &atom, "moov"); - -// Disk full. Rewind and try again - if(result) - { - quicktime_set_position(file, file->mdat.atom.end - (int64_t)0x100000); - file->mdat.atom.end = quicktime_position(file); - quicktime_atom_write_header(file, &atom, "moov"); - } - -/* get the duration from the int64_t track in the mvhd's timescale */ - for(i = 0; i < moov->total_tracks; i++) - { - quicktime_trak_fix_counts(file, moov->trak[i]); - quicktime_trak_duration(moov->trak[i], &duration, ×cale); - - duration = (long)((float)duration / timescale * moov->mvhd.time_scale); - - if(duration > int64_t_duration) - { - int64_t_duration = duration; - } - } - moov->mvhd.duration = int64_t_duration; - moov->mvhd.selection_duration = int64_t_duration; - - quicktime_write_mvhd(file, &(moov->mvhd)); - quicktime_write_udta(file, &(moov->udta)); - for(i = 0; i < moov->total_tracks; i++) - { - quicktime_write_trak(file, moov->trak[i], moov->mvhd.time_scale); - } - /*quicktime_write_ctab(file, &(moov->ctab)); */ - - quicktime_atom_write_footer(file, &atom); - -// Rewind to end of mdat. Breaks make_streamable -// This probably allows the file to be extended after writing the moov. - if(rewind) quicktime_set_position(file, file->mdat.atom.end); -} - -void quicktime_update_durations(quicktime_moov_t *moov) -{ - -} - -int quicktime_shift_offsets(quicktime_moov_t *moov, int64_t offset) -{ - int i; - for(i = 0; i < moov->total_tracks; i++) - { - quicktime_trak_shift_offsets(moov->trak[i], offset); - } - return 0; -} diff --git a/cinelerra-5.0/quicktime/mp4a.c b/cinelerra-5.0/quicktime/mp4a.c deleted file mode 100644 index af153d06..00000000 --- a/cinelerra-5.0/quicktime/mp4a.c +++ /dev/null @@ -1,374 +0,0 @@ -#include -#include - -#include "faac.h" - -// The FAAD includes redefine the same symbols as if they're not intended to -// be used by the same program. -#undef MAIN -#undef SSR -#undef LTP - - -#include "funcprotos.h" -#include "neaacdec.h" -#include "quicktime.h" - - -// Attempts to read more samples than this will crash -#define OUTPUT_ALLOCATION 0x100000 -#define CLAMP(x, y, z) ((x) = ((x) < (y) ? (y) : ((x) > (z) ? (z) : (x)))) - - -typedef struct -{ -// Decoder objects - NeAACDecHandle decoder_handle; - NeAACDecFrameInfo frame_info; - NeAACDecConfigurationPtr decoder_config; - int decoder_initialized; - - faacEncHandle encoder_handle; - faacEncConfigurationPtr encoder_params; -// Number of first sample in output relative to file - int64_t output_position; -// Number of frames - int frame_size; - int max_frame_bytes; -// Interleaved samples - float *input_buffer; -// Number of frames - int input_size; -// Number of samples allocated - int input_allocated; - unsigned char *compressed_buffer; - -// Encoding objects - int bitrate; - int quantizer_quality; - int encoder_initialized; -} quicktime_mp4a_codec_t; - - - - - - -static void delete_codec(quicktime_audio_map_t *atrack) -{ - quicktime_mp4a_codec_t *codec = - ((quicktime_codec_t*)atrack->codec)->priv; - - if(codec->decoder_initialized) - { - NeAACDecClose(codec->decoder_handle); - } - - if(codec->encoder_initialized) - { - faacEncClose(codec->encoder_handle); - if(codec->compressed_buffer) free(codec->compressed_buffer); - if(codec->input_buffer) free(codec->input_buffer); - } - - free(codec); -} - -static int decode(quicktime_t *file, - int16_t *output_i, float *output_f, - long samples, int track, int channel) -{ - quicktime_audio_map_t *track_map = &(file->atracks[track]); - quicktime_trak_t *trak = track_map->track; - quicktime_mp4a_codec_t *codec = ((quicktime_codec_t*)track_map->codec)->priv; - int64_t current_position = track_map->current_position; - int64_t end_position = current_position + samples; - quicktime_vbr_t *vbr = &track_map->vbr; - if( quicktime_limit_samples(samples) ) return 1; - -// Initialize decoder - if( !codec->decoder_initialized ) { - unsigned long samplerate = trak->mdia.minf.stbl.stsd.table[0].sample_rate; -// FAAD needs unsigned char here - uint8_t channels = track_map->channels; - quicktime_init_vbr(vbr, channels); - codec->decoder_handle = NeAACDecOpen(); - codec->decoder_config = NeAACDecGetCurrentConfiguration(codec->decoder_handle); - codec->decoder_config->outputFormat = FAAD_FMT_FLOAT; -// codec->decoder_config->defSampleRate = -// trak->mdia.minf.stbl.stsd.table[0].sample_rate; - - NeAACDecSetConfiguration(codec->decoder_handle, codec->decoder_config); - - - char *mp4_hdr = trak->mdia.minf.stbl.stsd.table[0].esds.mpeg4_header; - int hdr_len = trak->mdia.minf.stbl.stsd.table[0].esds.mpeg4_header_size; - if( !mp4_hdr || !hdr_len ) { - quicktime_seek_vbr(track_map, 0, 0); - quicktime_read_vbr(file, track_map); - - if( NeAACDecInit(codec->decoder_handle, - quicktime_vbr_input(vbr), quicktime_vbr_input_size(vbr), - &samplerate, &channels) < 0 ) return 1; - } - else { - if( NeAACDecInit2(codec->decoder_handle, - (unsigned char *)mp4_hdr, hdr_len, - &samplerate, &channels) < 0 ) return 1; - } -//printf("decode %d samplerate=%d channels=%d\n", __LINE__, samplerate, channels); - codec->decoder_initialized = 1; - } - - if( quicktime_align_vbr(track_map, current_position) || - codec->output_position != quicktime_vbr_output_end(vbr) ) { - quicktime_seek_vbr(track_map, current_position, 1); - codec->output_position = quicktime_vbr_output_end(vbr); - } - -// Decode until buffer is full - while( quicktime_vbr_output_end(vbr) < end_position ) { - if(quicktime_read_vbr(file, track_map)) break; - - bzero(&codec->frame_info, sizeof(NeAACDecFrameInfo)); - float *sample_buffer = NeAACDecDecode(codec->decoder_handle, &codec->frame_info, - quicktime_vbr_input(vbr), quicktime_vbr_input_size(vbr)); - - quicktime_shift_vbr(track_map, quicktime_vbr_input_size(vbr)); - int result = codec->frame_info.samples / track_map->channels; - quicktime_store_vbr_float(track_map, sample_buffer, result); - codec->output_position += result; - } - -// Transfer from buffer to output - if(output_i) - quicktime_copy_vbr_int16(vbr, current_position, - samples, output_i, channel); - else if(output_f) - quicktime_copy_vbr_float(vbr, current_position, - samples, output_f, channel); - - return 0; -} - - -static int encode(quicktime_t *file, - int16_t **input_i, - float **input_f, - int track, - long samples) -{ - int result = 0; - quicktime_audio_map_t *track_map = &(file->atracks[track]); - quicktime_trak_t *trak = track_map->track; - quicktime_mp4a_codec_t *codec = ((quicktime_codec_t*)track_map->codec)->priv; - int channels = quicktime_track_channels(file, track); - int i, j, k; - - if(!codec->encoder_initialized) - { - unsigned long input_samples; - unsigned long max_output_bytes; - int sample_rate = quicktime_sample_rate(file, track); - codec->encoder_initialized = 1; - codec->encoder_handle = faacEncOpen(quicktime_sample_rate(file, track), - channels, - &input_samples, - &max_output_bytes); - - codec->frame_size = input_samples / channels; - codec->max_frame_bytes = max_output_bytes; - codec->compressed_buffer = calloc(1, max_output_bytes); - codec->encoder_params = faacEncGetCurrentConfiguration(codec->encoder_handle); - -// Parameters from ffmpeg - codec->encoder_params->aacObjectType = LOW; - codec->encoder_params->mpegVersion = MPEG4; - codec->encoder_params->useTns = 0; - codec->encoder_params->allowMidside = 1; - codec->encoder_params->inputFormat = FAAC_INPUT_FLOAT; - codec->encoder_params->outputFormat = 0; - codec->encoder_params->bitRate = codec->bitrate / channels; - codec->encoder_params->quantqual = codec->quantizer_quality; - codec->encoder_params->bandWidth = sample_rate / 2; - - if(!faacEncSetConfiguration(codec->encoder_handle, codec->encoder_params)) - { - fprintf(stderr, "encode: unsupported MPEG-4 Audio configuration!@#!@#\n"); - return 1; - } - - - -// Create esds header - unsigned char *buffer; - unsigned long buffer_size; - faacEncGetDecoderSpecificInfo(codec->encoder_handle, - &buffer, - &buffer_size); - quicktime_set_mpeg4_header(&trak->mdia.minf.stbl.stsd.table[0], - buffer, - buffer_size); -//breaks android player - //trak->mdia.minf.stbl.stsd.table[0].version = 1; -// Quicktime player needs this. - trak->mdia.minf.stbl.stsd.table[0].compression_id = 0xfffe; - } - - -// Stack new audio at end of old audio - int new_allocation = codec->input_size + samples; - if(new_allocation > codec->input_allocated) - { - codec->input_buffer = realloc(codec->input_buffer, - new_allocation * - sizeof(float) * - channels); - codec->input_allocated = new_allocation; - } - - float *output = (float*)codec->input_buffer + codec->input_size * channels; - if(input_f) - { - for(i = 0; i < samples; i++) - { - for(j = 0; j < channels; j++) - { - *output++ = input_f[j][i] * 32767; - } - } - } - else - if(input_i) - { - for(i = 0; i < samples; i++) - { - for(j = 0; j < channels; j++) - { - *output++ = (float)input_i[j][i]; - } - } - } - - codec->input_size += samples; - - - for(i = 0; i + codec->frame_size < codec->input_size; i += codec->frame_size) - { - int bytes = faacEncEncode(codec->encoder_handle, - (int32_t*)(codec->input_buffer + i * channels), - codec->frame_size * channels, - codec->compressed_buffer, - codec->max_frame_bytes); -/* - * printf("encode 1 %lld %d %d\n", - * track_map->current_position, - * codec->frame_size, - * bytes); - */ -// Write out the packet - if(bytes) - { - quicktime_write_vbr_frame(file, track, - (char*)codec->compressed_buffer, bytes, - codec->frame_size); - } - } - - for(j = i * channels, k = 0; j < codec->input_size * channels; j++, k++) - { - codec->input_buffer[k] = codec->input_buffer[j]; - } - codec->input_size -= i; - - return result; -} - - - -static void flush(quicktime_t *file, int track) -{ - quicktime_audio_map_t *track_map = &(file->atracks[track]); - quicktime_mp4a_codec_t *codec = ((quicktime_codec_t*)track_map->codec)->priv; - int channels = quicktime_track_channels(file, track); - int i; - if(codec->encoder_initialized) - { - for(i = 0; - i < codec->input_size && - i + codec->frame_size < codec->input_allocated; - i += codec->frame_size) - { - int bytes = faacEncEncode(codec->encoder_handle, - (int32_t*)(codec->input_buffer + i * channels), - codec->frame_size * channels, - codec->compressed_buffer, - codec->max_frame_bytes); - -/* - * printf("flush 1 %d %d %d\n", - * codec->encoder_params->bitRate, - * bytes, - * codec->max_frame_bytes); - */ -// Write out the packet - if(bytes) - { - quicktime_write_vbr_frame(file, track, - (char*)codec->compressed_buffer, bytes, - codec->frame_size); - } - } - } -} - - -static int set_parameter(quicktime_t *file, - int track, - char *key, - void *value) -{ - quicktime_audio_map_t *atrack = &(file->atracks[track]); - char *compressor = quicktime_compressor(atrack->track); - - if(quicktime_match_32(compressor, QUICKTIME_MP4A)) - { - quicktime_mp4a_codec_t *codec = ((quicktime_codec_t*)atrack->codec)->priv; - if(!strcasecmp(key, "mp4a_bitrate")) - { - codec->bitrate = *(int*)value; - } - else - if(!strcasecmp(key, "mp4a_quantqual")) - { - codec->quantizer_quality = *(int*)value; - } - } - return 0; -} - - - -void quicktime_init_codec_mp4a(quicktime_audio_map_t *atrack) -{ - quicktime_codec_t *codec_base = (quicktime_codec_t*)atrack->codec; - quicktime_mp4a_codec_t *codec; - codec_base->priv = calloc(1, sizeof(quicktime_mp4a_codec_t)); - codec_base->delete_acodec = delete_codec; - codec_base->decode_audio = decode; - codec_base->encode_audio = encode; - codec_base->set_parameter = set_parameter; - codec_base->flush = flush; - codec_base->fourcc = QUICKTIME_MP4A; - codec_base->title = "MPEG4 audio"; - codec_base->desc = "Audio section of MPEG4 standard"; - - codec = (quicktime_mp4a_codec_t*)codec_base->priv; -// Default encoding parameters here - codec->bitrate = 256000; - codec->quantizer_quality = 100; -} - - - - diff --git a/cinelerra-5.0/quicktime/mp4a.h b/cinelerra-5.0/quicktime/mp4a.h deleted file mode 100644 index c5c45ca9..00000000 --- a/cinelerra-5.0/quicktime/mp4a.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef QUICKTIME_MP4A_H -#define QUICKTIME_MP4A_H - - -extern void quicktime_init_codec_mp4a(quicktime_audio_map_t *); - - - -#endif diff --git a/cinelerra-5.0/quicktime/mpeg4.c b/cinelerra-5.0/quicktime/mpeg4.c deleted file mode 100644 index 1eb68162..00000000 --- a/cinelerra-5.0/quicktime/mpeg4.c +++ /dev/null @@ -1,1268 +0,0 @@ -/* General codec for all MPEG-4 derived encoding. */ -/* Uses ffmpeg and encore50. */ -/* Encore50 still seemed to provide better results than ffmpeg for encoding */ -/* so it does all the generic MPEG-4 encoding. */ - - - - - -#include "colormodels.h" -#include "funcprotos.h" -#include "qtffmpeg.h" -#include "quicktime.h" -#include "workarounds.h" -#include ENCORE_INCLUDE -//#include DECORE_INCLUDE - -#include -#include -#include - -#define FRAME_RATE_BASE 10000 -#define FIELDS 2 - - -typedef struct -{ - -// Decoder side - quicktime_ffmpeg_t *decoder; - - - - - - - - - -// Encoding side - int encode_initialized[FIELDS]; -// Information for picking the right library routines. -// ID out of avcodec.h for the codec used. -// Invalid if encore50 is used. - int ffmpeg_id; -// True if encore50 is being used. - int use_encore; - -// FFMpeg internals - AVCodec *encoder[FIELDS]; - AVCodecContext *encoder_context[FIELDS]; - AVFrame picture[FIELDS]; - - -// Encore internals - int encode_handle[FIELDS]; - ENC_PARAM enc_param[FIELDS]; -// Must count pframes in VBR - int p_count[FIELDS]; - - -// Encoding parameters - int bitrate; -// For heroine 60 encoding, we want different streams for each field. - int total_fields; - long rc_period; // the intended rate control averaging period - long rc_reaction_period; // the reation period for rate control - long rc_reaction_ratio; // the ratio for down/up rate control - long max_key_interval; // the maximum interval between key frames - int bitrate_tolerance; - int interlaced; - int gop_size; - int max_quantizer; // the upper limit of the quantizer - int min_quantizer; // the lower limit of the quantizer - int quantizer; // For vbr - int quality; // the forward search range for motion estimation - int fix_bitrate; - int use_deblocking; - - -// Temporary storage for color conversions - char *temp_frame; -// Storage of compressed data - unsigned char *work_buffer; -// Allocation of work_buffer - int buffer_size; -} quicktime_mpeg4_codec_t; - - - -// Decore needs the user to specify handles -static int encode_handle = 0; - - - - - - - - - -// Direct copy routines - - -// Determine of the compressed frame is a keyframe for direct copy -int quicktime_mpeg4_is_key(unsigned char *data, long size, char *codec_id) -{ - int result = 0; - int i; - - if(quicktime_match_32(codec_id, QUICKTIME_DIVX) || - quicktime_match_32(codec_id, QUICKTIME_MP4V) || - quicktime_match_32(codec_id, QUICKTIME_HV60)) - { - for(i = 0; i < size - 5; i++) - { - if( data[i] == 0x00 && - data[i + 1] == 0x00 && - data[i + 2] == 0x01 && - data[i + 3] == 0xb6) - { - if((data[i + 4] & 0xc0) == 0x0) - return 1; - else - return 0; - } - } - } - return result; -} - - -// Test for VOL header in frame -int quicktime_mpeg4_has_vol(unsigned char *data) -{ - if( data[0] == 0x00 && - data[1] == 0x00 && - data[2] == 0x01 && - data[3] == 0x00 && - data[4] == 0x00 && - data[5] == 0x00 && - data[6] == 0x01 && - data[7] == 0x20) - return 1; - else - return 0; -} - - - - -static void putbits(unsigned char **data, - int *bit_pos, - uint64_t *bit_store, - int *total, - int count, - uint64_t value) -{ - value &= 0xffffffffffffffffLL >> (64 - count); - - while(64 - *bit_pos < count) - { - *(*data)++ = (*bit_store) >> 56; - (*bit_store) <<= 8; - (*bit_pos) -= 8; - } - - (*bit_store) |= value << (64 - count - *bit_pos); - (*bit_pos) += count; - (*total) += count; -} - - -static void flushbits(unsigned char **data, - int *bit_pos, - uint64_t *bit_store) -{ -//printf("flushbits %llx\n", (*bit_store)); - while((*bit_pos) > 0) - { - *(*data)++ = (*bit_store) >> 56; - (*bit_store) <<= 8; - (*bit_pos) -= 8; - } -} - - - - -#define VO_START_CODE 0x8 -#define VO_START_CODE_LENGTH 27 -#define VOL_START_CODE 0x12 /* 25-MAR-97 JDL : according to WD2 */ -#define VOL_START_CODE_LENGTH 28 - - - -int quicktime_mpeg4_write_vol(unsigned char *data_start, - int vol_width, - int vol_height, - int time_increment_resolution, - double frame_rate) -{ - int written = 0; - int bits, fixed_vop_time_increment; - unsigned char *data = data_start; - int bit_pos; - uint64_t bit_store; - - bit_store = 0; - bit_pos = 0; - vol_width = quicktime_quantize16(vol_width); - vol_height = quicktime_quantize16(vol_height); - - - putbits(&data, - &bit_pos, - &bit_store, - &written, - VO_START_CODE_LENGTH, VO_START_CODE); - putbits(&data, - &bit_pos, - &bit_store, - &written, - 5, 0); /* vo_id = 0 */ - - putbits(&data, - &bit_pos, - &bit_store, - &written, - VOL_START_CODE_LENGTH, VOL_START_CODE); - - - - putbits(&data, - &bit_pos, - &bit_store, - &written, - 4, 0); /* vol_id = 0 */ - - putbits(&data, - &bit_pos, - &bit_store, - &written, - 1, 0); /* random_accessible_vol = 0 */ - putbits(&data, - &bit_pos, - &bit_store, - &written, - 8, 1); /* video_object_type_indication = 1 video */ - putbits(&data, - &bit_pos, - &bit_store, - &written, - 1, 1); /* is_object_layer_identifier = 1 */ - putbits(&data, - &bit_pos, - &bit_store, - &written, - 4, 2); /* visual_object_layer_ver_id = 2 */ - putbits(&data, - &bit_pos, - &bit_store, - &written, - 3, 1); /* visual_object_layer_priority = 1 */ - putbits(&data, - &bit_pos, - &bit_store, - &written, - 4, 1); /* aspect_ratio_info = 1 */ - - - - - - - - putbits(&data, - &bit_pos, - &bit_store, - &written, - 1, 0); /* vol_control_parameter = 0 */ - putbits(&data, - &bit_pos, - &bit_store, - &written, - 2, 0); /* vol_shape = 0 rectangular */ - putbits(&data, - &bit_pos, - &bit_store, - &written, - 1, 1); /* marker */ - - - - - - - - putbits(&data, - &bit_pos, - &bit_store, - &written, - 16, time_increment_resolution); - putbits(&data, - &bit_pos, - &bit_store, - &written, - 1, 1); /* marker */ - putbits(&data, - &bit_pos, - &bit_store, - &written, - 1, 1); /* fixed_vop_rate = 1 */ - - - bits = 1; - while((1 << bits) < time_increment_resolution) bits++; - -// Log calculation fails for some reason -// bits = (int)ceil(log((double)time_increment_resolution) / log(2.0)); -// if (bits < 1) bits=1; - - fixed_vop_time_increment = - (int)(time_increment_resolution / frame_rate + 0.1); - - putbits(&data, - &bit_pos, - &bit_store, - &written, - bits, fixed_vop_time_increment); - - putbits(&data, - &bit_pos, - &bit_store, - &written, - 1, 1); /* marker */ - - putbits(&data, - &bit_pos, - &bit_store, - &written, - 13, vol_width); - putbits(&data, - &bit_pos, - &bit_store, - &written, - 1, 1); /* marker */ - putbits(&data, - &bit_pos, - &bit_store, - &written, - 13, vol_height); - putbits(&data, - &bit_pos, - &bit_store, - &written, - 1, 1); /* marker */ - - putbits(&data, - &bit_pos, - &bit_store, - &written, - 1, 0); /* interlaced = 0 */ - putbits(&data, - &bit_pos, - &bit_store, - &written, - 1, 1); /* OBMC_disabled = 1 */ - putbits(&data, - &bit_pos, - &bit_store, - &written, - 2, 0); /* vol_sprite_usage = 0 */ - putbits(&data, - &bit_pos, - &bit_store, - &written, - 1, 0); /* not_8_bit = 0 */ - - putbits(&data, - &bit_pos, - &bit_store, - &written, - 1, 0); /* vol_quant_type = 0 */ - putbits(&data, - &bit_pos, - &bit_store, - &written, - 1, 0); /* vol_quarter_pixel = 0 */ - putbits(&data, - &bit_pos, - &bit_store, - &written, - 1, 1); /* complexity_estimation_disabled = 1 */ - putbits(&data, - &bit_pos, - &bit_store, - &written, - 1, 1); /* resync_marker_disabled = 1 */ - putbits(&data, - &bit_pos, - &bit_store, - &written, - 1, 0); /* data_partitioning_enabled = 0 */ - putbits(&data, - &bit_pos, - &bit_store, - &written, - 1, 0); /* scalability = 0 */ - - flushbits(&data, - &bit_pos, - &bit_store); - - -/* - * for(i = 0; i < data - data_start; i++) - * for(j = 0x80; j >= 1; j /= 2) - * printf("%d", (data_start[i] & j) ? 1 : 0); - * printf("\n"); - */ - - - - return data - data_start; -} - - - -// Create the header for the esds block which is used in mp4v. -// Taken from libavcodec -// Returns the size -static int write_mp4v_header(unsigned char *data, - int w, - int h, - double frame_rate) -{ - unsigned char *start = data; - - -/* - * static unsigned char test[] = - * { - * - * 0x00, 0x00, 0x01, 0xb0, 0x01, 0x00, 0x00, 0x01, 0xb5, 0x89, 0x13, - * 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x20, 0x00, 0xc4, 0x8d, - * 0x8a, 0xee, 0x05, 0x28, 0x04, 0x5a, 0x14, 0x63, 0x00, 0x00, 0x01, 0xb2, - * 0x46, 0x46, 0x6d, 0x70, 0x65, 0x67, 0x43, 0x56, 0x53, 0x62, 0x34, 0x37, - * 0x35, 0x38 - * - * }; - * memcpy(data, test, sizeof(test)); - * - * return sizeof(test); - */ - -// From ffmpeg -// Advanced simple level 1 -// int profile_level = 0xf3; - - int profile_level = 0x1; -// int vo_version_id = 5; - int vo_version_id = 1; - - - - - -// VOS startcode - *data++ = 0x00; - *data++ = 0x00; - *data++ = 0x01; - *data++ = 0xb0; - *data++ = profile_level; - -// Visual object startcode - *data++ = 0x00; - *data++ = 0x00; - *data++ = 0x01; - *data++ = 0xb5; - *data++ = ((unsigned char)0x1 << 7) | - ((unsigned char)vo_version_id << 3) | -// Priority - (unsigned char)1; -// visual object type video - *data++ = (0x1 << 4) | -// Video signal type - (0 << 3) | -// Stuffing - 0x3; - -// *data++ = 0x40; -// *data++ = 0xc0; -// *data++ = 0xcf; - -// video object - int vol_size = quicktime_mpeg4_write_vol(data, - w, - h, - 60000, - frame_rate); - data += vol_size; - - return data - start; -} - - - - - - - -// Mpeg-4 interface - -static int reads_colormodel(quicktime_t *file, - int colormodel, - int track) -{ - quicktime_video_map_t *vtrack = &(file->vtracks[track]); - quicktime_codec_t *codec = (quicktime_codec_t*)vtrack->codec; - return (colormodel == BC_YUV420P && - !quicktime_match_32(QUICKTIME_SVQ1, codec->fourcc)); -} - -static int writes_colormodel(quicktime_t *file, - int colormodel, - int track) -{ - return colormodel == BC_YUV420P; -} - - - -static int decode(quicktime_t *file, unsigned char **row_pointers, int track) -{ - quicktime_video_map_t *vtrack = &(file->vtracks[track]); - quicktime_trak_t *trak = vtrack->track; - quicktime_mpeg4_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv; - quicktime_stsd_table_t *stsd_table = &trak->mdia.minf.stbl.stsd.table[0]; - int width = trak->tkhd.track_width; - int height = trak->tkhd.track_height; - int result = 0; - - - if(!codec->decoder) codec->decoder = quicktime_new_ffmpeg( - file->cpus, - codec->total_fields, - codec->ffmpeg_id, - width, - height, - stsd_table); - - if(codec->decoder) result = quicktime_ffmpeg_decode( - codec->decoder, - file, - row_pointers, - track); - - - return result; -} - - -static int encode_video2(AVCodecContext *avctx, uint8_t *buf, int buf_size, - const AVFrame *pict) -{ - AVPacket pkt; - av_init_packet(&pkt); - pkt.data = buf; - pkt.size = buf_size; - - int got_packet = 0; - int ret = avcodec_encode_video2(avctx, &pkt, pict, &got_packet); - if (!ret && got_packet && avctx->coded_frame) { - avctx->coded_frame->pts = pkt.pts; - avctx->coded_frame->key_frame = !!(pkt.flags & AV_PKT_FLAG_KEY); - } - - if( pkt.side_data_elems > 0 ) { - int i = pkt.side_data_elems; - while( --i >= 0 ) av_free(pkt.side_data[i].data); - av_freep(&pkt.side_data); - pkt.side_data_elems = 0; - } - - return ret ? ret : pkt.size; -} - - -static void frame_defaults(AVFrame *frame) -{ - memset(frame, 0, sizeof(AVFrame)); - av_frame_unref(frame); -} - - -static int encode(quicktime_t *file, unsigned char **row_pointers, int track) -{ -// int64_t offset = quicktime_position(file); - quicktime_video_map_t *vtrack = &(file->vtracks[track]); - quicktime_mpeg4_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv; - quicktime_trak_t *trak = vtrack->track; - int width = trak->tkhd.track_width; - int height = trak->tkhd.track_height; - int width_i = quicktime_quantize16(width); - int height_i = quicktime_quantize16(height); - int result = 0; - int i; - int bytes = 0; - int is_keyframe = 0; - int current_field = vtrack->current_position % codec->total_fields; - quicktime_atom_t chunk_atom; - - - - - - pthread_mutex_lock(&ffmpeg_lock); - - - - if(!codec->encode_initialized[current_field]) - { -// Encore section - if(codec->ffmpeg_id == AV_CODEC_ID_MPEG4 && codec->use_encore) - { - codec->encode_initialized[current_field] = 1; - codec->encode_handle[current_field] = encode_handle++; - codec->enc_param[current_field].x_dim = width_i; - codec->enc_param[current_field].y_dim = height_i; - codec->enc_param[current_field].framerate = - quicktime_frame_rate(file, track) / codec->total_fields; - codec->enc_param[current_field].bitrate = - codec->bitrate / codec->total_fields; - codec->enc_param[current_field].rc_period = codec->rc_period; - codec->enc_param[current_field].rc_reaction_period = codec->rc_reaction_period; - codec->enc_param[current_field].rc_reaction_ratio = codec->rc_reaction_ratio; - codec->enc_param[current_field].max_quantizer = codec->max_quantizer; - codec->enc_param[current_field].min_quantizer = codec->min_quantizer; - codec->enc_param[current_field].max_key_interval = codec->max_key_interval; - - codec->enc_param[current_field].search_range = codec->quality * 3; - if(codec->enc_param[current_field].search_range > 15) - codec->enc_param[current_field].search_range = 15; - - encore(codec->encode_handle[current_field], - ENC_OPT_INIT, - &codec->enc_param[current_field], NULL); - - } - else -// ffmpeg section - { - codec->encode_initialized[current_field] = 1; - if(!ffmpeg_initialized) - { - ffmpeg_initialized = 1; - av_register_all(); - } - - AVCodec *av_codec = avcodec_find_encoder(codec->ffmpeg_id); - codec->encoder[current_field] = av_codec; - - if(!codec->encoder[current_field]) - { - printf("encode: avcodec_find_encoder returned NULL.\n"); - pthread_mutex_unlock(&ffmpeg_lock); - return 1; - } - - AVCodecContext *context = avcodec_alloc_context3(av_codec); - codec->encoder_context[current_field] = context; - - context->width = width_i; - context->height = height_i; - context->gop_size = codec->gop_size; - context->pix_fmt = PIX_FMT_YUV420P; - context->bit_rate = codec->bitrate / codec->total_fields; - context->bit_rate_tolerance = codec->bitrate_tolerance; - context->qmin = - (!codec->fix_bitrate ? codec->quantizer : 2); - context->qmax = - (!codec->fix_bitrate ? codec->quantizer : 31); -// It needs the time per frame, not the frame rate. - context->time_base.den = quicktime_frame_rate_n(file, track); - context->time_base.num = quicktime_frame_rate_d(file, track); - - context->profile= FF_PROFILE_UNKNOWN; - context->level= FF_LEVEL_UNKNOWN; -// context->flags |= CODEC_FLAG_H263P_UMV; - context->flags |= CODEC_FLAG_AC_PRED; - - if( codec->ffmpeg_id == AV_CODEC_ID_MPEG4 || - codec->ffmpeg_id == AV_CODEC_ID_H263 || - codec->ffmpeg_id == AV_CODEC_ID_H263P || - codec->ffmpeg_id == AV_CODEC_ID_FLV1 ) - context->flags |= CODEC_FLAG_4MV; - - if( codec->ffmpeg_id == AV_CODEC_ID_MPEG4) - context->flags |= CODEC_FLAG_QPEL; - -// All the forbidden settings can be extracted from libavcodec/mpegvideo.c of ffmpeg... - -// Not compatible with Win -// context->flags |= CODEC_FLAG_QPEL; - - if(file->cpus > 1) - { -// avcodec_thread_init(context, file->cpus); - context->thread_count = file->cpus; - } - - if(!codec->fix_bitrate) - context->flags |= CODEC_FLAG_QSCALE; - - if(codec->interlaced) - { - context->flags |= CODEC_FLAG_INTERLACED_DCT; - context->flags |= CODEC_FLAG_INTERLACED_ME; - } - - -/* - * printf("encode gop_size=%d fix_bitrate=%d quantizer=%d\n", - * codec->gop_size, - * codec->fix_bitrate, - * codec->quantizer); - */ - avcodec_open2(context, codec->encoder[current_field], 0); - frame_defaults(&codec->picture[current_field]); - } - } - - - if(!codec->work_buffer) - { - codec->buffer_size = width_i * height_i; - codec->work_buffer = malloc(codec->buffer_size); - } - - - -// Encore section - if(codec->use_encore) - { -// Encore section - ENC_FRAME encore_input; - ENC_RESULT encore_result; - - -// Assume planes are contiguous. -// Encode directly from function arguments - if(file->color_model == BC_YUV420P && - width == width_i && - height == height_i) - { - encore_input.image = row_pointers[0]; - } -// Convert to YUV420P -// Encode from temporary. - else - { - if(!codec->temp_frame) - { - codec->temp_frame = malloc(width_i * height_i * 3 / 2); - } - unsigned char *utmp_frame = (unsigned char *)codec->temp_frame; - cmodel_transfer(0, /* Leave NULL if non existent */ - row_pointers, - utmp_frame, /* Leave NULL if non existent */ - utmp_frame + width_i * height_i, - utmp_frame + width_i * height_i + width_i * height_i / 4, - row_pointers[0], /* Leave NULL if non existent */ - row_pointers[1], - row_pointers[2], - 0, /* Dimensions to capture from input frame */ - 0, - width, - height, - 0, /* Dimensions to project on output frame */ - 0, - width, - height, - file->color_model, - BC_YUV420P, - 0, /* When transfering BC_RGBA8888 to non-alpha this is the background color in 0xRRGGBB hex */ - width, /* For planar use the luma rowspan */ - width_i); - - - encore_input.image = codec->temp_frame; - } - - - - bzero(codec->work_buffer, codec->buffer_size); - encore_input.bitstream = codec->work_buffer; - encore_input.length = 0; - encore_input.quant = !codec->fix_bitrate ? codec->quantizer : 0; - - if(codec->p_count == 0) - { - codec->p_count[current_field]++; - } - else - { - codec->p_count[current_field]++; - if(codec->p_count[current_field] >= codec->max_key_interval) - codec->p_count[current_field] = 0; - } - - - encore(codec->encode_handle[current_field], - 0, - &encore_input, - &encore_result); - - bytes = encore_input.length; - is_keyframe = encore_result.isKeyFrame; - } - else -// ffmpeg section - { - AVCodecContext *context = codec->encoder_context[current_field]; - AVFrame *picture = &codec->picture[current_field]; - - if(width_i == width && - height_i == height && - file->color_model == BC_YUV420P) - { - picture->data[0] = row_pointers[0]; - picture->data[1] = row_pointers[1]; - picture->data[2] = row_pointers[2]; - picture->linesize[0] = width_i; - picture->linesize[1] = width_i / 2; - picture->linesize[2] = width_i / 2; - } - else - { - if(!codec->temp_frame) - { - codec->temp_frame = malloc(width_i * height_i * 3 / 2); - } - unsigned char *utmp_frame = (unsigned char *)codec->temp_frame; - - cmodel_transfer(0, /* Leave NULL if non existent */ - row_pointers, - utmp_frame, /* Leave NULL if non existent */ - utmp_frame + width_i * height_i, - utmp_frame + width_i * height_i + width_i * height_i / 4, - row_pointers[0], /* Leave NULL if non existent */ - row_pointers[1], - row_pointers[2], - 0, /* Dimensions to capture from input frame */ - 0, - width, - height, - 0, /* Dimensions to project on output frame */ - 0, - width, - height, - file->color_model, - BC_YUV420P, - 0, /* When transfering BC_RGBA8888 to non-alpha this is the background color in 0xRRGGBB hex */ - width, /* For planar use the luma rowspan */ - width_i); - - picture->data[0] = utmp_frame; - picture->data[1] = utmp_frame + width_i * height_i; - picture->data[2] = utmp_frame + width_i * height_i + width_i * height_i / 4; - picture->linesize[0] = width_i; - picture->linesize[1] = width_i / 2; - picture->linesize[2] = width_i / 2; - } - - - picture->pict_type = 0; - picture->quality = 0; - picture->pts = vtrack->current_position * quicktime_frame_rate_d(file, track); - picture->key_frame = 0; - bytes = encode_video2(context, codec->work_buffer, codec->buffer_size, picture); - is_keyframe = context->coded_frame && context->coded_frame->key_frame; -/* - * printf("encode current_position=%d is_keyframe=%d\n", - * vtrack->current_position, - * is_keyframe); - */ - - if(!trak->mdia.minf.stbl.stsd.table[0].esds.mpeg4_header_size && - !strcmp(((quicktime_codec_t*)vtrack->codec)->fourcc, QUICKTIME_MP4V)) - { - unsigned char temp[1024]; - unsigned char *ptr = temp; - for(i = 0; i < bytes - 4; i++) - { - if(!(codec->work_buffer[i] == 0x00 && - codec->work_buffer[i + 1] == 0x00 && - codec->work_buffer[i + 2] == 0x01 && - codec->work_buffer[i + 3] == 0xb3)) - { - *ptr++ = codec->work_buffer[i]; - } - else - break; - } - quicktime_set_mpeg4_header(&trak->mdia.minf.stbl.stsd.table[0], - temp, - ptr - temp); - trak->mdia.minf.stbl.stsd.table[0].version = 0; - } - } - - - - - - - pthread_mutex_unlock(&ffmpeg_lock); - quicktime_write_chunk_header(file, trak, &chunk_atom); - result = !quicktime_write_data(file, (char*)codec->work_buffer, bytes); - quicktime_write_chunk_footer(file, trak, vtrack->current_chunk, &chunk_atom, 1); - if(is_keyframe || vtrack->current_position == 0) - quicktime_insert_keyframe(file, vtrack->current_position, track); - - vtrack->current_chunk++; - return result; -} - - - - - - -static void flush(quicktime_t *file, int track) -{ - quicktime_video_map_t *track_map = &(file->vtracks[track]); - quicktime_trak_t *trak = track_map->track; - -// Create header - if(!trak->mdia.minf.stbl.stsd.table[0].esds.mpeg4_header_size && - !strcmp(((quicktime_codec_t*)track_map->codec)->fourcc, QUICKTIME_MP4V)) - { - int width = trak->tkhd.track_width; - int height = trak->tkhd.track_height; - int width_i = quicktime_quantize16(width); - int height_i = quicktime_quantize16(height); - - unsigned char temp[1024]; - int size = write_mp4v_header(temp, width_i, height_i, - quicktime_frame_rate(file, track)); - quicktime_set_mpeg4_header(&trak->mdia.minf.stbl.stsd.table[0], temp, size); - } - -// Create udta - file->moov.udta.require = strdup("QuickTime 6.0 or greater"); - file->moov.udta.require_len = strlen(file->moov.udta.require); -} - - - - - - - - -static int set_parameter(quicktime_t *file, - int track, - char *key, - void *value) -{ - quicktime_video_map_t *vtrack = &(file->vtracks[track]); - char *compressor = vtrack->track->mdia.minf.stbl.stsd.table[0].format; - - if(quicktime_match_32(compressor, QUICKTIME_DIVX) || - quicktime_match_32(compressor, QUICKTIME_MP42) || - quicktime_match_32(compressor, QUICKTIME_MPG4) || - quicktime_match_32(compressor, QUICKTIME_DX50) || - quicktime_match_32(compressor, QUICKTIME_HV60)) - { - quicktime_mpeg4_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv; - - if(!strcasecmp(key, "divx_bitrate")) - codec->bitrate = *(int*)value; - else - if(!strcasecmp(key, "divx_rc_period")) - codec->rc_period = *(int*)value; - else - if(!strcasecmp(key, "divx_rc_reaction_ratio")) - codec->rc_reaction_ratio = *(int*)value; - else - if(!strcasecmp(key, "divx_rc_reaction_period")) - codec->rc_reaction_period = *(int*)value; - else - if(!strcasecmp(key, "divx_max_key_interval")) - codec->max_key_interval = *(int*)value; - else - if(!strcasecmp(key, "divx_max_quantizer")) - codec->max_quantizer = *(int*)value; - else - if(!strcasecmp(key, "divx_min_quantizer")) - codec->min_quantizer = *(int*)value; - else - if(!strcasecmp(key, "divx_quantizer")) - codec->quantizer = *(int*)value; - else - if(!strcasecmp(key, "divx_quality")) - codec->quality = *(int*)value; - else - if(!strcasecmp(key, "divx_fix_bitrate")) - codec->fix_bitrate = *(int*)value; - else - if(!strcasecmp(key, "divx_use_deblocking")) - codec->use_deblocking = *(int*)value; - } - else - if(quicktime_match_32(compressor, QUICKTIME_DIV3) || - quicktime_match_32(compressor, QUICKTIME_MP4V)) - { - quicktime_mpeg4_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv; - if(!strcasecmp(key, "ffmpeg_bitrate")) - codec->bitrate = *(int*)value; - else - if(!strcasecmp(key, "ffmpeg_bitrate_tolerance")) - codec->bitrate_tolerance = *(int*)value; - else - if(!strcasecmp(key, "ffmpeg_interlaced")) - codec->interlaced = *(int*)value; - else - if(!strcasecmp(key, "ffmpeg_gop_size")) - codec->gop_size = *(int*)value; - else - if(!strcasecmp(key, "ffmpeg_quantizer")) - codec->quantizer = *(int*)value; - else - if(!strcasecmp(key, "ffmpeg_fix_bitrate")) - codec->fix_bitrate = *(int*)value; - } - return 0; -} - - - -static void delete_codec(quicktime_video_map_t *vtrack) -{ - quicktime_mpeg4_codec_t *codec; - int i; - - - codec = ((quicktime_codec_t*)vtrack->codec)->priv; - for(i = 0; i < codec->total_fields; i++) - { - if(codec->encode_initialized[i]) - { - pthread_mutex_lock(&ffmpeg_lock); - if(codec->use_encore) - { - encore(codec->encode_handle[i], - ENC_OPT_RELEASE, - 0, - 0); - } - else - { - avcodec_close(codec->encoder_context[i]); - free(codec->encoder_context[i]); - } - pthread_mutex_unlock(&ffmpeg_lock); - } - } - - - if(codec->temp_frame) free(codec->temp_frame); - if(codec->work_buffer) free(codec->work_buffer); - if(codec->decoder) quicktime_delete_ffmpeg(codec->decoder); - - free(codec); -} - - - - -static quicktime_mpeg4_codec_t* init_common(quicktime_video_map_t *vtrack, - char *compressor, - char *title, - char *description) -{ - quicktime_codec_t *codec_base = (quicktime_codec_t*)vtrack->codec; - quicktime_mpeg4_codec_t *codec; - - codec_base->priv = calloc(1, sizeof(quicktime_mpeg4_codec_t)); - codec_base->delete_vcodec = delete_codec; - codec_base->decode_video = decode; - codec_base->encode_video = encode; - codec_base->flush = flush; - codec_base->reads_colormodel = reads_colormodel; - codec_base->writes_colormodel = writes_colormodel; - codec_base->set_parameter = set_parameter; - codec_base->fourcc = compressor; - codec_base->title = title; - codec_base->desc = description; - - codec = (quicktime_mpeg4_codec_t*)codec_base->priv; - - - -// Set defaults - codec->bitrate = 1000000; - codec->bitrate_tolerance = 1000000; - codec->rc_period = 50; - codec->rc_reaction_ratio = 45; - codec->rc_reaction_period = 10; - codec->max_key_interval = 45; - codec->max_quantizer = 31; - codec->min_quantizer = 1; - codec->quantizer = 10; - codec->quality = 5; - codec->fix_bitrate = 1; - codec->total_fields = 1; - - - - return codec; -} - - - - -// Mike Rowe Soft MPEG-4 -void quicktime_init_codec_div3(quicktime_video_map_t *vtrack) -{ - quicktime_mpeg4_codec_t *result = init_common(vtrack, - QUICKTIME_DIV3, - "DIVX", - "Mike Row Soft MPEG4 Version 3"); - result->ffmpeg_id = AV_CODEC_ID_MSMPEG4V3; -} - -void quicktime_init_codec_div5(quicktime_video_map_t *vtrack) -{ - quicktime_mpeg4_codec_t *result = init_common(vtrack, - QUICKTIME_DX50, - "DIVX", - "Mike Row Soft MPEG4 Version 5"); - result->ffmpeg_id = AV_CODEC_ID_MPEG4; -} - -// Mike Rowe Soft MPEG-4 -void quicktime_init_codec_div3lower(quicktime_video_map_t *vtrack) -{ - quicktime_mpeg4_codec_t *result = init_common(vtrack, - QUICKTIME_DIV3_LOWER, - "DIVX", - "Mike Row Soft MPEG4 Version 3"); - result->ffmpeg_id = AV_CODEC_ID_MSMPEG4V3; -} - -void quicktime_init_codec_div3v2(quicktime_video_map_t *vtrack) -{ - quicktime_mpeg4_codec_t *result = init_common(vtrack, - QUICKTIME_MP42, - "MP42", - "Mike Row Soft MPEG4 Version 2"); - result->ffmpeg_id = AV_CODEC_ID_MSMPEG4V2; -} - -// Generic MPEG-4 -void quicktime_init_codec_divx(quicktime_video_map_t *vtrack) -{ - quicktime_mpeg4_codec_t *result = init_common(vtrack, - QUICKTIME_DIVX, - "MPEG-4", - "Generic MPEG Four"); - result->ffmpeg_id = AV_CODEC_ID_MPEG4; - result->use_encore = 1; -} - -void quicktime_init_codec_mpg4(quicktime_video_map_t *vtrack) -{ - quicktime_mpeg4_codec_t *result = init_common(vtrack, - QUICKTIME_MPG4, - "MPEG-4", - "FFMPEG (msmpeg4)"); - result->ffmpeg_id = AV_CODEC_ID_MSMPEG4V1; -} - -void quicktime_init_codec_dx50(quicktime_video_map_t *vtrack) -{ - quicktime_mpeg4_codec_t *result = init_common(vtrack, - QUICKTIME_DX50, - "MPEG-4", - "FFMPEG (mpeg4)"); - result->ffmpeg_id = AV_CODEC_ID_MPEG4; -} - -// Generic MPEG-4 -void quicktime_init_codec_mp4v(quicktime_video_map_t *vtrack) -{ - quicktime_mpeg4_codec_t *result = init_common(vtrack, - QUICKTIME_MP4V, - "MPEG4", - "Generic MPEG Four"); - result->ffmpeg_id = AV_CODEC_ID_MPEG4; -// result->use_encore = 1; -} - - -// Mormon MPEG-4 -void quicktime_init_codec_svq1(quicktime_video_map_t *vtrack) -{ - quicktime_mpeg4_codec_t *result = init_common(vtrack, - QUICKTIME_SVQ1, - "Sorenson Version 1", - "From the chearch of codecs of yesterday's sights"); - result->ffmpeg_id = AV_CODEC_ID_SVQ1; -} - -void quicktime_init_codec_svq3(quicktime_video_map_t *vtrack) -{ - quicktime_mpeg4_codec_t *result = init_common(vtrack, - QUICKTIME_SVQ3, - "Sorenson Version 3", - "From the chearch of codecs of yesterday's sights"); - result->ffmpeg_id = AV_CODEC_ID_SVQ3; -} - -void quicktime_init_codec_h263(quicktime_video_map_t *vtrack) -{ - quicktime_mpeg4_codec_t *result = init_common(vtrack, - QUICKTIME_H263, - "H.263", - "H.263"); - result->ffmpeg_id = AV_CODEC_ID_H263; -} - -void quicktime_init_codec_xvid(quicktime_video_map_t *vtrack) -{ - quicktime_mpeg4_codec_t *result = init_common(vtrack, - QUICKTIME_XVID, - "XVID", - "FFmpeg MPEG-4"); - result->ffmpeg_id = AV_CODEC_ID_MPEG4; -} - -void quicktime_init_codec_dnxhd(quicktime_video_map_t *vtrack) -{ - quicktime_mpeg4_codec_t *result = init_common(vtrack, - QUICKTIME_DNXHD, - "DNXHD", - "DNXHD"); - result->ffmpeg_id = AV_CODEC_ID_DNXHD; -} - -// field based MPEG-4 -void quicktime_init_codec_hv60(quicktime_video_map_t *vtrack) -{ - quicktime_mpeg4_codec_t *result = init_common(vtrack, - QUICKTIME_HV60, - "Dual MPEG-4", - "MPEG 4 with alternating streams every other frame. (Not standardized)"); - result->total_fields = 2; - result->ffmpeg_id = AV_CODEC_ID_MPEG4; -} - - - - - - diff --git a/cinelerra-5.0/quicktime/mpeg4.h b/cinelerra-5.0/quicktime/mpeg4.h deleted file mode 100644 index 9144ae1c..00000000 --- a/cinelerra-5.0/quicktime/mpeg4.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef QUICKTIME_MPEG4_H -#define QUICKTIME_MPEG4_H - - - -extern void quicktime_init_codec_div3(quicktime_video_map_t *); -extern void quicktime_init_codec_div3lower(quicktime_video_map_t *); -extern void quicktime_init_codec_div3v2(quicktime_video_map_t *); -extern void quicktime_init_codec_divx(quicktime_video_map_t *); -extern void quicktime_init_codec_dx50(quicktime_video_map_t *); -extern void quicktime_init_codec_mpg4(quicktime_video_map_t *); -extern void quicktime_init_codec_hv60(quicktime_video_map_t *); -extern void quicktime_init_codec_mp4v(quicktime_video_map_t *); -extern void quicktime_init_codec_svq1(quicktime_video_map_t *); -extern void quicktime_init_codec_svq3(quicktime_video_map_t *); -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_dnxhd(quicktime_video_map_t *); -extern void quicktime_init_codec_div5(quicktime_video_map_t *vtrack); - - -#endif diff --git a/cinelerra-5.0/quicktime/mts2mp4.c b/cinelerra-5.0/quicktime/mts2mp4.c deleted file mode 100644 index 5bd63537..00000000 --- a/cinelerra-5.0/quicktime/mts2mp4.c +++ /dev/null @@ -1,703 +0,0 @@ -#include -#include -#include -#include -#include -#include - - -#include "libavcodec/avcodec.h" -#include "libzmpeg3.h" -#include "quicktime.h" - -// This converts an AVC-HD transport stream to an mp4 Quicktime movie without -// re-encoding the video but does re-encode the audio. - - - -// Testing the ffmpeg decoder: -// ffmpeg -i ~mov/saved/test.m2ts -an /tmp/test.mp4 - - -// Override the video format -//#define OVERRIDE_FORMAT - -//#define MAX_FRAMES 1000 - -// Use NAL_AUD to denote the start of frame -#define USE_NAL_AUD - -// Encode the audio. Better to use ffmpeg for this. -//#define ENCODE_AUDIO - - -double video_frame_rate = 24000.0 / 1001; -int video_width = 1920; -int video_height = 1080; -int audio_channels = 6; -int audio_samplerate = 48000; -int audio_bitrate = 768000; -int audio_track = 0; - -#define AUDIO_BUFFER_SIZE 0x10000 -#define BUFFER_SIZE 0x100000 -#define MAX_FRAME_SIZE 0x400000 -#define NAL_SLICE 0x01 -#define NAL_DPA 0x02 -#define NAL_DPB 0x03 -#define NAL_DPC 0x04 -#define NAL_IDR_SLICE 0x05 -#define NAL_SEI 0x06 -#define NAL_SPS 0x07 -#define NAL_PPS 0x08 -#define NAL_AUD 0x09 -#define NAL_END_SEQUENCE 0x0a -#define NAL_END_STREAM 0x0b -#define NAL_FILLER_DATA 0x0c -#define NAL_SPS_EXT 0x0d -#define NAL_AUXILIARY_SLICE 0x13 - -#define NAL_CODE_SIZE 4 - - - - -unsigned char *buffer = 0; -unsigned char *video_in_buffer = 0; -unsigned char *frame_buffer = 0; -float **audio_buffer = 0; -int frame_buffer_size = 0; -int buffer_size = 0; -int64_t bytes_written = 0; -int frames_written = 0; -int64_t samples_written = 0; -// Last frame when we wrote audio -int next_audio_frame = 0; -unsigned char *ptr = 0; -unsigned char *end = 0; -unsigned char *frame_end = 0; -// Set to 1 after a sequence header is detected and after the previous frame is written. -int is_keyframe = 0; -// This tells it when it doesn't need to decode sequence headers anymore. -int got_header = 0; -// This tells it to not flush the frame at the next picture header -int got_seq_header = 0; -quicktime_t *quicktime_fd = 0; -// Use 2 libzmpeg3 instances because while video is direct copied, audio must -// be decoded. -zmpeg3_t *mpegv_fd = 0; -zmpeg3_t *mpega_fd = 0; -int video_eof = 0; -int audio_eof = 0; -char *in_path = 0; -char *out_path = 0; -int pass = 0; -AVCodec *decoder = 0; -AVCodecContext *decoder_context = 0; - - - - - - - - - -void write_frame() -{ - int result = 0; - int i; - -// Shift data into frame buffer - frame_buffer_size = frame_end - buffer; - memcpy(frame_buffer, buffer, frame_buffer_size); - - - - - -/* - * if( - * buffer[0] == 0xc2 && - * buffer[1] == 0x5c && - * buffer[2] == 0x43 && - * buffer[3] == 0x49 && - * buffer[4] == 0x95 && - * buffer[5] == 0xc4 && - * buffer[6] == 0xa6 && - * buffer[7] == 0x2b) - * printf("write_frame %d\n", __LINE__); - */ - -// Shift input buffer - buffer_size = end - frame_end; - memcpy(buffer, frame_end, buffer_size); - -// Seek to end of this NAL - ptr -= (frame_end - buffer); - end = buffer + buffer_size; - - if(!frame_buffer_size) return; - - - - -/* - * static int debug_count = 0; - * char string[1024]; - * sprintf(string, "test%06d", debug_count++); - * printf("write_frame %d: %s\n", __LINE__, string); - * FILE *test = fopen(string, "w"); - * fwrite(frame_buffer, frame_buffer_size, 1, test); - * fclose(test); - */ - - - - int got_picture = 0; - AVFrame picture; - - -// Skip frames until first keyframe -/* - * if(!bytes_written && !is_keyframe) - * { - * } - * else - */ - if(pass == 0) - { -// Decode header only - -printf("write_frame %d pass=%d %d\n", __LINE__, pass, frame_buffer_size); - -/* -* static FILE *test = 0; -* if(!test) test = fopen("test", "w"); -* fwrite(buffer, output_size, 1, test); -*/ - - avcodec_get_frame_defaults(&picture); - avcodec_decode_video(decoder_context, - &picture, - &got_picture, - buffer, - frame_buffer_size); - - -printf("write_frame %d %d\n", __LINE__, frame_buffer_size); - - - if(decoder_context->width > 0) - { - video_width = decoder_context->width; - video_height = decoder_context->height; - video_frame_rate = (double)decoder_context->time_base.den / - decoder_context->time_base.num / - 2; - got_header = 1; -printf("%s format:\nwidth=%d\nheight=%d\nframerate=%f\naudio_track=%d\nsamplerate=%d\nchannels=%d\n", -in_path, -video_width, -video_height, -video_frame_rate, -audio_track, -audio_samplerate, -audio_channels); - } - - } - else - { -/* -* printf("write_frame: %s at offset %llx\n", -* is_keyframe ? "Keyframe" : "Frame", -* bytes_written); -*/ - if(!quicktime_fd) - { - quicktime_fd = quicktime_open(out_path, 0, 1); - if(!quicktime_fd) - { - fprintf(stderr, - "write_frame: Failed to open %s for writing\n", - out_path); - exit(1); - } - -#ifdef ENCODE_AUDIO - quicktime_set_audio(quicktime_fd, - audio_channels, - audio_samplerate, - 16, - QUICKTIME_MP4A); - quicktime_set_parameter(quicktime_fd, "mp4a_bitrate", &audio_bitrate); -#endif - - quicktime_set_video(quicktime_fd, - 1, - video_width, - video_height, - video_frame_rate, - QUICKTIME_H264); - } - - - -// Convert NAL codes to AVC format - unsigned char *ptr2 = frame_buffer + NAL_CODE_SIZE; - unsigned char *end2 = frame_buffer + frame_buffer_size; - unsigned char *last_start = frame_buffer; - int nal_size; - int total_nals = 1; - while(ptr2 < end2 + NAL_CODE_SIZE) - { -// Start of next NAL code - if(ptr2[0] == 0x00 && - ptr2[1] == 0x00 && - ptr2[2] == 0x00 && - ptr2[3] == 0x01) - { - nal_size = ptr2 - last_start - 4; - last_start[0] = (nal_size & 0xff000000) >> 24; - last_start[1] = (nal_size & 0xff0000) >> 16; - last_start[2] = (nal_size & 0xff00) >> 8; - last_start[3] = (nal_size & 0xff); - last_start = ptr2; - ptr2 += 4; - total_nals++; - } - else - ptr2++; - } - -//printf("write_frame total_nals=%d\n", total_nals); -// Last NAL in frame - nal_size = end2 - last_start - 4; - last_start[0] = (nal_size & 0xff000000) >> 24; - last_start[1] = (nal_size & 0xff0000) >> 16; - last_start[2] = (nal_size & 0xff00) >> 8; - last_start[3] = (nal_size & 0xff); - - - if(is_keyframe) - quicktime_insert_keyframe(quicktime_fd, frames_written, 0); - - result = quicktime_write_frame(quicktime_fd, - frame_buffer, - frame_buffer_size, - 0); - -//printf("write_frame %d %d\n", __LINE__, frame_buffer_size); - - -// Test decode it -/* - * avcodec_get_frame_defaults(&picture); - * avcodec_decode_video(decoder_context, - * &picture, - * &got_picture, - * frame_buffer, - * frame_buffer_size); - */ - - - - if(result) - { - fprintf(stderr, "Error writing frame\n"); - exit(1); - } - - bytes_written += frame_buffer_size; - frames_written++; - printf("write_frame %d: video_eof=%d frames_written=%d \n", - __LINE__, - video_eof, - frames_written); - fflush(stdout); - } - - frame_buffer_size = 0; - is_keyframe = 0; - -// Write audio up to current frame time -#ifdef ENCODE_AUDIO - if((video_eof || frames_written >= next_audio_frame) && - pass > 0 && - !audio_eof) - { - int64_t next_audio_sample = (int64_t)next_audio_frame * - audio_samplerate / - video_frame_rate; - while((video_eof || samples_written < next_audio_sample) && - !audio_eof && - !mpeg3_end_of_audio(mpega_fd, audio_track)) - { -printf("write_frame %d: video_eof=%d samples_written=%lld\n", -__LINE__, -video_eof, -samples_written); - for(i = 0; i < audio_channels; i++) - { - if(i == 0) - result = mpeg3_read_audio(mpega_fd, - audio_buffer[i], - 0, - i, - AUDIO_BUFFER_SIZE, - audio_track); - else - result = mpeg3_reread_audio(mpega_fd, - audio_buffer[i], /* Pointer to pre-allocated buffer of floats */ - 0, /* Pointer to pre-allocated buffer of int16's */ - i, /* Channel to decode */ - AUDIO_BUFFER_SIZE, /* Number of samples to decode */ - audio_track); - } -//printf("write_frame %d\n", __LINE__); - - if(result || mpeg3_end_of_audio(mpega_fd, audio_track)) audio_eof = 1; - - result = quicktime_encode_audio(quicktime_fd, - 0, - audio_buffer, - AUDIO_BUFFER_SIZE); - samples_written += AUDIO_BUFFER_SIZE; - if(result) - { - fprintf(stderr, "Error writing audio\n"); - exit(1); - } - } - - next_audio_frame = frames_written + (int)video_frame_rate; - } -#endif // ENCODE_AUDIO -} - -// Returns 1 and leaves ptr unchanged if more data needed -int decode_header() -{ - if(got_header) - { - if(ptr < end - NAL_CODE_SIZE) - { - ptr += NAL_CODE_SIZE; - return 0; - } - } - else - { -// Extract encoding information here. - if(ptr < end - NAL_CODE_SIZE) - { - ptr += NAL_CODE_SIZE; - next_audio_frame = (int)video_frame_rate; - return 0; - } - } - - return 1; -} - -// Returns 1 and leaves ptr unchanged if more data needed -int decode_nal() -{ - if(ptr < end - NAL_CODE_SIZE - 2) - { - unsigned char nal_type = ptr[NAL_CODE_SIZE] & 0x1f; - - - -/* - * printf("decode_nal %d type=0x%02x 0x%02x offset=%lld video_eof=%d\n", - * __LINE__, - * nal_type, - * ptr[NAL_CODE_SIZE + 1], - * ptr - buffer, - * video_eof); - */ - - - - switch(nal_type) - { -#ifdef USE_NAL_AUD - case NAL_AUD: -// End of frame is start of current NAL - frame_end = ptr; - write_frame(); - ptr += NAL_CODE_SIZE; - break; - - -// sequence header - case NAL_SPS: -/* - * printf("decode_nal %d type=0x%02x 0x%02x offset=%lld\n", - * __LINE__, - * nal_type, - * ptr[NAL_CODE_SIZE + 1], - * ptr - buffer); - */ -// { -// int j; -// printf("decode_nal %d\n", __LINE__); -// for(j = 0; j < 66; j++) -// printf("%02x ", ptr[j]); -// printf("\n"); -// } - - is_keyframe = 1; - ptr += NAL_CODE_SIZE; - break; - - -// picture header - case NAL_PPS: -// printf("decode_nal %d type=0x%02x 0x%02x offset=%lld\n", -// __LINE__, -// nal_type, -// ptr[NAL_CODE_SIZE + 1], -// ptr - buffer); - ptr += NAL_CODE_SIZE; - break; - - -#endif // USE_NAL_AUD - - - - - - - - - - -#ifndef USE_NAL_AUD -// sequence header - case NAL_SPS: - { -// End of frame is start of sequence header - frame_end = ptr; - -// Decode header NAL - if(decode_header()) return 1; - -printf("decode_nal %d: Got SPS buffer offset=%lld\n", __LINE__, ptr - buffer - 4); - - write_frame(); - -// Set flags for next frame - is_keyframe = 1; - got_seq_header = 1; - break; - } - - case NAL_PPS: -printf("decode_nal %d: Got PPS buffer offset=%lld\n", __LINE__, ptr - buffer - 4); -// Picture - if(got_seq_header) - { -// Skip if preceeded by sequence header - got_seq_header = 0; - ptr += NAL_CODE_SIZE; - } - else - { -// End of frame is start of NAL - frame_end = ptr; - write_frame(); - ptr += NAL_CODE_SIZE; - } - break; -#endif // !USE_NAL_AUD - - - - - -// Unrecognized NAL - default: -// Skip NAL start code - ptr += NAL_CODE_SIZE; - break; - - - - - } - } - else - return 1; - - return 0; -} - -int main(int argc, char *argv[]) -{ - int error = 0; - int i; - - buffer = malloc(BUFFER_SIZE); - frame_buffer = malloc(MAX_FRAME_SIZE); - ptr = buffer; - end = buffer + buffer_size; - next_audio_frame = 30; - - if(argc < 3) - { - printf("Usage: %s \n", argv[0]); - exit(1); - } - - - in_path = argv[1]; - out_path = argv[2]; - -// Use the libzmpeg3 internals to get at the demuxing support - printf("main %d: Opening source %s\n", __LINE__, in_path); - mpegv_fd = mpeg3_open(in_path, 0); - if(!mpegv_fd) - { - fprintf(stderr, "Failed to open input file %s\n", in_path); - exit(1); - } - - if(!mpeg3_total_vstreams(mpegv_fd)) - { - fprintf(stderr, "No video streams in %s\n", in_path); - exit(1); - } - - if(!mpeg3_total_astreams(mpegv_fd)) - { - fprintf(stderr, "No audio streams in %s\n", in_path); - exit(1); - } - - mpega_fd = mpeg3_open_copy(in_path, mpegv_fd, 0); - printf("main %d: Decoding encoding parameters\n", __LINE__); - - -// Get encoding parameters - audio_channels = mpeg3_audio_channels(mpega_fd, audio_track); - audio_samplerate = mpeg3_sample_rate(mpega_fd, audio_track); - audio_bitrate = audio_channels * 128000; - audio_buffer = calloc(sizeof(float*), audio_channels); - for(i = 0; i < audio_channels; i++) - audio_buffer[i] = calloc(sizeof(float), AUDIO_BUFFER_SIZE); - - -// Initialize ffmpeg to decode headers - avcodec_init(); - avcodec_register_all(); - decoder = avcodec_find_decoder(CODEC_ID_H264); -// decoder = avcodec_find_decoder(CODEC_ID_VC1); - decoder_context = avcodec_alloc_context(); - error = avcodec_open(decoder_context, decoder); - long output_size = 0; - - - - -// printf("main %d: %d\n", __LINE__, decoder->id); - -// Decode header on 1st pass. Transcode on 2nd pass. - decoder_context->width = 0; - int64_t total_bytes = 0; - - - - printf("main %d: Transcoding\n", __LINE__); - - -// Audio EOF is handled when audio is written - pass = 0; - -#ifdef OVERRIDE_FORMAT - pass++; - got_header = 1; -#endif - - for( ; pass < 2; pass++) - { -// Rewind streams - mpeg3_seek_byte(mpegv_fd, 0); - while(!video_eof && - (pass > 0 || !got_header) - -#ifdef MAX_FRAMES - && frames_written < MAX_FRAMES -#endif - ) - { -// Fill video input buffer - while(!(error = mpeg3_read_video_chunk(mpegv_fd, - buffer + buffer_size, - &output_size, - BUFFER_SIZE - buffer_size, - 0)) && - output_size >= 4) - { - -/* - * static FILE *test = 0; - * if(!test) test = fopen("test", "w"); - * fwrite(buffer + buffer_size, output_size, 1, test); - */ - - buffer_size += output_size; - if(BUFFER_SIZE - buffer_size < 4) break; - } - - if(error) - { - video_eof = 1; - buffer_size += output_size; - } - - end = buffer + buffer_size; - -//printf("main %d video_eof=%d size=%p\n", __LINE__, video_eof, end - NAL_CODE_SIZE - 2 - ptr); -// Search for start code in buffer - while(ptr < end - NAL_CODE_SIZE - 2 && - (pass > 0 || !got_header)) - { -// Got a NAL - if(ptr[0] == 0x00 && - ptr[1] == 0x00 && - ptr[2] == 0x00 && - ptr[3] == 0x01) - { -// Need more data if it fails - if(decode_nal()) break; - } - else - { - ptr++; - } - } -//printf("main %d\n", __LINE__); - } - -// Rewind video stream - buffer_size = 0; - ptr = buffer; - end = buffer; - } - -// Flush - frame_end = buffer + buffer_size; - write_frame(); - - - if(quicktime_fd) quicktime_close(quicktime_fd); - printf("main %d: Wrote %d frames\n", __LINE__, frames_written); -} - - - - diff --git a/cinelerra-5.0/quicktime/mvhd.c b/cinelerra-5.0/quicktime/mvhd.c deleted file mode 100644 index 8fae626f..00000000 --- a/cinelerra-5.0/quicktime/mvhd.c +++ /dev/null @@ -1,106 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" - - - -int quicktime_mvhd_init(quicktime_mvhd_t *mvhd) -{ - int i; - mvhd->version = 0; - mvhd->flags = 0; - mvhd->creation_time = quicktime_current_time(); - mvhd->modification_time = quicktime_current_time(); - mvhd->time_scale = 600; - mvhd->duration = 0; - mvhd->preferred_rate = 1.0; - mvhd->preferred_volume = 0.996094; - for(i = 0; i < 10; i++) mvhd->reserved[i] = 0; - quicktime_matrix_init(&(mvhd->matrix)); - mvhd->preview_time = 0; - mvhd->preview_duration = 0; - mvhd->poster_time = 0; - mvhd->selection_time = 0; - mvhd->selection_duration = 0; - mvhd->current_time = 0; - mvhd->next_track_id = 1; - return 0; -} - -int quicktime_mvhd_delete(quicktime_mvhd_t *mvhd) -{ - return 0; -} - -void quicktime_mvhd_dump(quicktime_mvhd_t *mvhd) -{ - printf(" movie header\n"); - printf(" version %d\n", mvhd->version); - printf(" flags %ld\n", mvhd->flags); - printf(" creation_time %lu\n", mvhd->creation_time); - printf(" modification_time %lu\n", mvhd->modification_time); - printf(" time_scale %ld\n", mvhd->time_scale); - printf(" duration %ld\n", mvhd->duration); - printf(" preferred_rate %f\n", mvhd->preferred_rate); - printf(" preferred_volume %f\n", mvhd->preferred_volume); - quicktime_print_chars(" reserved ", mvhd->reserved, 10); - quicktime_matrix_dump(&(mvhd->matrix)); - printf(" preview_time %ld\n", mvhd->preview_time); - printf(" preview_duration %ld\n", mvhd->preview_duration); - printf(" poster_time %ld\n", mvhd->poster_time); - printf(" selection_time %ld\n", mvhd->selection_time); - printf(" selection_duration %ld\n", mvhd->selection_duration); - printf(" current_time %ld\n", mvhd->current_time); - printf(" next_track_id %ld\n", mvhd->next_track_id); -} - -void quicktime_read_mvhd(quicktime_t *file, quicktime_mvhd_t *mvhd, quicktime_atom_t *parent_atom) -{ - mvhd->version = quicktime_read_char(file); - mvhd->flags = quicktime_read_int24(file); - mvhd->creation_time = quicktime_read_int32(file); - mvhd->modification_time = quicktime_read_int32(file); - mvhd->time_scale = quicktime_read_int32(file); - mvhd->duration = quicktime_read_int32(file); - mvhd->preferred_rate = quicktime_read_fixed32(file); - mvhd->preferred_volume = quicktime_read_fixed16(file); - quicktime_read_data(file, mvhd->reserved, 10); - quicktime_read_matrix(file, &(mvhd->matrix)); - mvhd->preview_time = quicktime_read_int32(file); - mvhd->preview_duration = quicktime_read_int32(file); - mvhd->poster_time = quicktime_read_int32(file); - mvhd->selection_time = quicktime_read_int32(file); - mvhd->selection_duration = quicktime_read_int32(file); - mvhd->current_time = quicktime_read_int32(file); - mvhd->next_track_id = quicktime_read_int32(file); -} - -void quicktime_mhvd_init_video(quicktime_t *file, quicktime_mvhd_t *mvhd, double frame_rate) -{ - mvhd->time_scale = quicktime_get_timescale(frame_rate); -} - -void quicktime_write_mvhd(quicktime_t *file, quicktime_mvhd_t *mvhd) -{ - quicktime_atom_t atom; - quicktime_atom_write_header(file, &atom, "mvhd"); - - quicktime_write_char(file, mvhd->version); - quicktime_write_int24(file, mvhd->flags); - quicktime_write_int32(file, mvhd->creation_time); - quicktime_write_int32(file, mvhd->modification_time); - quicktime_write_int32(file, mvhd->time_scale); - quicktime_write_int32(file, mvhd->duration); - quicktime_write_fixed32(file, mvhd->preferred_rate); - quicktime_write_fixed16(file, mvhd->preferred_volume); - quicktime_write_data(file, mvhd->reserved, 10); - quicktime_write_matrix(file, &(mvhd->matrix)); - quicktime_write_int32(file, mvhd->preview_time); - quicktime_write_int32(file, mvhd->preview_duration); - quicktime_write_int32(file, mvhd->poster_time); - quicktime_write_int32(file, mvhd->selection_time); - quicktime_write_int32(file, mvhd->selection_duration); - quicktime_write_int32(file, mvhd->current_time); - quicktime_write_int32(file, mvhd->next_track_id); - - quicktime_atom_write_footer(file, &atom); -} diff --git a/cinelerra-5.0/quicktime/plugin.c b/cinelerra-5.0/quicktime/plugin.c deleted file mode 100644 index a3da052b..00000000 --- a/cinelerra-5.0/quicktime/plugin.c +++ /dev/null @@ -1,231 +0,0 @@ -#include -#include -#include -#include "funcprotos.h" -#include "quicktime.h" - - -static int total_vcodecs = 0; -static int total_acodecs = 0; -static quicktime_codectable_t *vcodecs = NULL; -static quicktime_codectable_t *acodecs = NULL; - - - - -static int register_vcodec(void (*init_vcodec)(quicktime_video_map_t *), - const char *fourcc, int vid_id) -{ - int idx = total_vcodecs++; - const uint8_t *bp = (const uint8_t *)fourcc; - vcodecs = (quicktime_codectable_t *)realloc(vcodecs, - total_vcodecs * sizeof(quicktime_codectable_t)); - quicktime_codectable_t *codec = vcodecs + idx; - codec->fourcc = (bp[3]<<24) | (bp[2]<<16) | (bp[1]<<8) | (bp[0]<<0); - codec->id = vid_id; - codec->init_vcodec = init_vcodec; - return idx; -} - -static int register_acodec(void (*init_acodec)(quicktime_audio_map_t *), - const char *fourcc, int wav_id) -{ - int idx = total_acodecs++; - const uint8_t *bp = (const uint8_t *)fourcc; - acodecs = (quicktime_codectable_t *)realloc(acodecs, - total_acodecs * sizeof(quicktime_codectable_t)); - quicktime_codectable_t *codec = acodecs + idx; - codec->fourcc = (bp[3]<<24) | (bp[2]<<16) | (bp[1]<<8) | (bp[0]<<0); - codec->id = wav_id; - codec->init_acodec = init_acodec; - return idx; -} - - - - -#include "ima4.h" -#include "mp4a.h" -#include "qdm2.h" -#include "qtvorbis.h" -#include "qtmp3.h" -#include "rawaudio.h" -#include "twos.h" -#include "ulaw.h" -#include "wma.h" -#include "wmx2.h" - -static void register_acodecs() -{ - register_acodec(quicktime_init_codec_twos, QUICKTIME_TWOS, 0x01); - register_acodec(quicktime_init_codec_sowt, QUICKTIME_SOWT, 0x01); - register_acodec(quicktime_init_codec_rawaudio, QUICKTIME_RAW, 0x01); - register_acodec(quicktime_init_codec_ima4, QUICKTIME_IMA4, 0x11); - register_acodec(quicktime_init_codec_mp4a, QUICKTIME_MP4A, 0); - register_acodec(quicktime_init_codec_qdm2, QUICKTIME_QDM2, 0); - register_acodec(quicktime_init_codec_ulaw, QUICKTIME_ULAW, 0x07); - - register_acodec(quicktime_init_codec_vorbis, QUICKTIME_VORBIS, 0x01); - register_acodec(quicktime_init_codec_mp3, QUICKTIME_MP3, 0x55); - register_acodec(quicktime_init_codec_wmx2, QUICKTIME_WMX2, 0x11); - register_acodec(quicktime_init_codec_wmav1, QUICKTIME_WMA, 0x160); - register_acodec(quicktime_init_codec_wmav2, QUICKTIME_WMA, 0x161); -} - - - - - -#include "qth264.h" -#include "raw.h" -#include "qtdv.h" -#include "jpeg.h" -#include "mpeg4.h" -#include "qtpng.h" -#include "rle.h" -#include "v308.h" -#include "v408.h" -#include "v410.h" -#include "yuv2.h" -#include "yuv4.h" -#include "yv12.h" - -static void register_vcodecs() -{ - - register_vcodec(quicktime_init_codec_raw, QUICKTIME_RAW, 0); - - register_vcodec(quicktime_init_codec_h264, QUICKTIME_H264, 1); - register_vcodec(quicktime_init_codec_hv64, QUICKTIME_HV64, 2); - register_vcodec(quicktime_init_codec_divx, QUICKTIME_DIVX, 0); - register_vcodec(quicktime_init_codec_hv60, QUICKTIME_HV60, 0); - register_vcodec(quicktime_init_codec_div5, QUICKTIME_DX50, 0); - register_vcodec(quicktime_init_codec_div3, QUICKTIME_DIV3, 0); - register_vcodec(quicktime_init_codec_div3v2, QUICKTIME_MP42, 0); - register_vcodec(quicktime_init_codec_div3lower, QUICKTIME_DIV3_LOWER, 0); - register_vcodec(quicktime_init_codec_mp4v, QUICKTIME_MP4V, 0); - register_vcodec(quicktime_init_codec_xvid, QUICKTIME_XVID, 0); - register_vcodec(quicktime_init_codec_dnxhd, QUICKTIME_DNXHD, 0); - register_vcodec(quicktime_init_codec_svq1, QUICKTIME_SVQ1, 0); - register_vcodec(quicktime_init_codec_svq3, QUICKTIME_SVQ3, 0); - register_vcodec(quicktime_init_codec_h263, QUICKTIME_H263, 0); - register_vcodec(quicktime_init_codec_dv, QUICKTIME_DV, 0); - register_vcodec(quicktime_init_codec_dvsd, QUICKTIME_DVSD, 0); - register_vcodec(quicktime_init_codec_dvcp, QUICKTIME_DVCP, 0); - - register_vcodec(quicktime_init_codec_jpeg, QUICKTIME_JPEG, 0); - register_vcodec(quicktime_init_codec_mjpa, QUICKTIME_MJPA, 0); - register_vcodec(quicktime_init_codec_mjpg, QUICKTIME_MJPG, 0); - register_vcodec(quicktime_init_codec_png, QUICKTIME_PNG, 0); - register_vcodec(quicktime_init_codec_rle, QUICKTIME_RLE, 0); - - register_vcodec(quicktime_init_codec_yuv2, QUICKTIME_YUV2, 0); - register_vcodec(quicktime_init_codec_2vuy, QUICKTIME_2VUY, 0); - register_vcodec(quicktime_init_codec_yuv4, QUICKTIME_YUV4, 0); - register_vcodec(quicktime_init_codec_yv12, QUICKTIME_YUV420, 0); - register_vcodec(quicktime_init_codec_v410, QUICKTIME_YUV444_10bit, 0); - register_vcodec(quicktime_init_codec_v308, QUICKTIME_YUV444, 0); - register_vcodec(quicktime_init_codec_v408, QUICKTIME_YUVA4444, 0); -} - - - - -int quicktime_find_vcodec(quicktime_video_map_t *vtrack) -{ - int i; - quicktime_codec_t *codec_base = 0; - char *compressor = vtrack->track->mdia.minf.stbl.stsd.table[0].format; - const uint8_t *bp = (const uint8_t *)compressor; - uint32_t fourcc = (bp[3]<<24) | (bp[2]<<16) | (bp[1]<<8) | (bp[0]<<0); - if(!total_vcodecs) register_vcodecs(); - for(i = 0; i= total_vcodecs ) return -1; - if( !(codec_base = quicktime_new_codec()) ) return -1; - vtrack->codec = codec_base; - vcodecs[i].init_vcodec(vtrack); - return 0; -} - -int quicktime_find_acodec(quicktime_audio_map_t *atrack) -{ - int i; - char *compressor = atrack->track->mdia.minf.stbl.stsd.table[0].format; - int compression_id = atrack->track->mdia.minf.stbl.stsd.table[0].compression_id; - const uint8_t *bp = (const uint8_t *)compressor; - uint32_t fourcc = (bp[3]<<24) | (bp[2]<<16) | (bp[1]<<8) | (bp[0]<<0); - if(!total_acodecs) register_acodecs(); - quicktime_codec_t *codec_base = 0; - - for(i = 0; i= total_acodecs ) return -1; - if( !(codec_base = quicktime_new_codec()) ) return -1; - atrack->codec = codec_base; - acodecs[i].init_acodec(atrack); -// For writing and reading Quicktime - quicktime_copy_char32(compressor, codec_base->fourcc); - return 0; -} - - -char* quicktime_acodec_title(char *fourcc) -{ - int i; - char *result = 0; - quicktime_audio_map_t *atrack = (quicktime_audio_map_t*) - calloc(1, sizeof(quicktime_audio_map_t)); - if(!total_acodecs) register_acodecs(); - quicktime_codec_t *codec_base = 0; - - int done = 0; - for(i = 0; i < total_acodecs && !done; i++) { - if( !(codec_base = quicktime_new_codec()) ) return 0; - atrack->codec = codec_base; - acodecs[i].init_acodec(atrack); - if( quicktime_match_32(fourcc, codec_base->fourcc) ) { - result = codec_base->title; - done = 1; - } - codec_base->delete_acodec(atrack); - quicktime_del_codec(codec_base); - } - - free(atrack); - return result ? result : fourcc; -} - -char* quicktime_vcodec_title(char *fourcc) -{ - int i; - char *result = 0; - - quicktime_video_map_t *vtrack = - (quicktime_video_map_t*)calloc(1, sizeof(quicktime_video_map_t)); - if(!total_vcodecs) register_vcodecs(); - quicktime_codec_t *codec_base = 0; - - int done = 0; - for(i = 0; i < total_vcodecs && !done; i++) { - if( !(codec_base = quicktime_new_codec()) ) return 0; - vtrack->codec = codec_base; - vcodecs[i].init_vcodec(vtrack); - if( quicktime_match_32(fourcc, codec_base->fourcc) ) { - result = codec_base->title; - done = 1; - } - codec_base->delete_vcodec(vtrack); - quicktime_del_codec(codec_base); - } - - free(vtrack); - return result ? result : fourcc; -} - diff --git a/cinelerra-5.0/quicktime/qdm2.c b/cinelerra-5.0/quicktime/qdm2.c deleted file mode 100644 index fcf7727b..00000000 --- a/cinelerra-5.0/quicktime/qdm2.c +++ /dev/null @@ -1,331 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" -#include "qtffmpeg.h" - -#include -#include - -extern int ffmpeg_initialized; -extern pthread_mutex_t ffmpeg_lock; - - -typedef struct -{ - int decoder_initialized; - AVCodec *decoder; - AVCodecContext *decoder_context; - -// Number of frames - int frame_size; - int max_frame_bytes; -// Input samples interleaved - int16_t *input_buffer; -// Number of samples allocated - int input_allocated; -// Last sample decoded in the input buffer + 1 - int64_t input_end; -// Total samples in input buffer - int input_size; -// Current write offset in input buffer - int input_ptr; - - unsigned char *compressed_buffer; - int compressed_size; - int compressed_allocated; - int16_t *temp_buffer; - -// Next chunk to decode sequentially - int64_t current_chunk; -} quicktime_qdm2_codec_t; - -#define MAX(x, y) ((x) > (y) ? (x) : (y)) -// Default number of samples to allocate in work buffer -#define OUTPUT_ALLOCATION 0x100000 - - - - - -static void delete_codec(quicktime_audio_map_t *atrack) -{ - quicktime_qdm2_codec_t *codec = - ((quicktime_codec_t*)atrack->codec)->priv; - - if(codec->decoder_initialized) - { - avcodec_close(codec->decoder_context); - free(codec->decoder_context); - } - - if(codec->input_buffer) free(codec->input_buffer); - if(codec->compressed_buffer) free(codec->compressed_buffer); - if(codec->temp_buffer) free(codec->temp_buffer); - - free(codec); -} - -void allocate_compressed(quicktime_qdm2_codec_t *codec, int size) -{ - if(size > codec->compressed_allocated) - { - codec->compressed_buffer = realloc(codec->compressed_buffer, size); - codec->compressed_allocated = size; - } -} - -static int decode(quicktime_t *file, - int16_t *output_i, - float *output_f, - long samples, - int track, - int channel) -{ - quicktime_audio_map_t *track_map = &(file->atracks[track]); - quicktime_trak_t *trak = track_map->track; - quicktime_qdm2_codec_t *codec = ((quicktime_codec_t*)track_map->codec)->priv; - quicktime_stsd_table_t *stsd_table = &trak->mdia.minf.stbl.stsd.table[0]; - int64_t current_position = track_map->current_position; - int64_t end_position = current_position + samples; - quicktime_frma_t *frma = &stsd_table->frma; - int channels = track_map->channels; - int i, j; - int debug = 0; - int64_t chunk_sample; - - - -// Initialize decoder - if(!codec->decoder_initialized) - { - pthread_mutex_lock(&ffmpeg_lock); - if(!ffmpeg_initialized) - { - ffmpeg_initialized = 1; - av_register_all(); - } - - codec->decoder = avcodec_find_decoder(CODEC_ID_QDM2); - if(!codec->decoder) - { - printf("qdm2.c: decode: no ffmpeg decoder found.\n"); - return 1; - } - -// allocate the codec and fill in header - AVCodecContext *context = avcodec_alloc_context3(codec->decoder); - codec->decoder_context = context; - codec->decoder_context->sample_rate = trak->mdia.minf.stbl.stsd.table[0].sample_rate; - codec->decoder_context->channels = track_map->channels; - - if(frma->data && frma->data_size) - { - context->extradata = (unsigned char *)frma->data; - context->extradata_size = frma->data_size; - } - - if(file->cpus > 1) - { -// avcodec_thread_init(context, file->cpus); - context->thread_count = file->cpus; - } - - if(avcodec_open2(context, codec->decoder, 0) < 0) - { - printf("qdm2.c: decode: avcodec_open failed.\n"); - return 1; - } - pthread_mutex_unlock(&ffmpeg_lock); - - codec->input_buffer = calloc(sizeof(int16_t), - track_map->channels * OUTPUT_ALLOCATION); - codec->input_allocated = OUTPUT_ALLOCATION; - - - codec->decoder_initialized = 1; - } - - - if(samples > OUTPUT_ALLOCATION) - { - printf("qdm2: decode: can't decode more than 0x%x samples at a time.\n", - OUTPUT_ALLOCATION); - return 1; - } - - if(debug) - { - printf("qdm2 decode: current_position=%jd end_position=%jd input_size=%d input_end=%jd\n", - current_position, end_position, codec->input_size, codec->input_end); - } - -// printf("qdm2 decode: current_position=%lld end_position=%lld chunk_sample=%lld chunk=%lld\n", -// current_position, -// end_position, -// chunk_sample, -// chunk); - - - if(current_position < codec->input_end - codec->input_size || - current_position > codec->input_end) - { -// Desired start point is outside existing range. Reposition buffer pointer -// to start time of nearest chunk and start over. - quicktime_chunk_of_sample(&chunk_sample, - &codec->current_chunk, - trak, - current_position); - codec->input_size = 0; - codec->input_ptr = 0; - codec->input_end = chunk_sample; - } - -// Decode complete chunks until samples is reached - int total_chunks = trak->mdia.minf.stbl.stco.total_entries; - while(codec->input_end < end_position) - { - int64_t offset = quicktime_chunk_to_offset(file, - trak, - codec->current_chunk); - int64_t max_offset = quicktime_chunk_to_offset(file, - trak, - codec->current_chunk + 1); - quicktime_set_position(file, offset); - allocate_compressed(codec, 3); - - if(debug) - { - printf("qdm2 decode: input_end=%jd chunk=%jd offset=0x%jx\n", - codec->input_end, codec->current_chunk, offset); - } - -// Read fragments of chunk - while(1) - { -// Hit next chunk of audio - if(max_offset > offset && quicktime_position(file) >= max_offset) break; - if(!quicktime_read_data(file, - (char*)codec->compressed_buffer + codec->compressed_size, - 3)) - break; - if(codec->compressed_buffer[codec->compressed_size] != 0x82) - { -// printf("qdm2: decode: position=0x%llx\n", quicktime_position(file)); - break; - } - int fragment_size = 3 + ((codec->compressed_buffer[codec->compressed_size + 1] << 8) | - codec->compressed_buffer[codec->compressed_size + 2]); -// Sanity check - if(fragment_size > OUTPUT_ALLOCATION) break; -// Expand compressed buffer - allocate_compressed(codec, - codec->compressed_size + fragment_size + 1024); - if(!quicktime_read_data(file, - (char*)codec->compressed_buffer + codec->compressed_size + 3, - fragment_size - 3)) - break; - - codec->compressed_size += fragment_size; - - AVPacket avpkt; - av_init_packet(&avpkt); - avpkt.data = codec->compressed_buffer; - avpkt.size = codec->compressed_size; - - int count = 0; -// Repeat this sequence until ffmpeg stops outputting samples - while(1) - { - if(!codec->temp_buffer) - codec->temp_buffer = calloc(sizeof(int16_t), OUTPUT_ALLOCATION); - int bytes_decoded = OUTPUT_ALLOCATION * sizeof(int16_t); - int result = quicktime_decode_audio3(codec->decoder_context, - codec->temp_buffer, &bytes_decoded, &avpkt); - -// Shift compressed buffer - if(result > 0) - { - avpkt.size -= result; - avpkt.data += result; - count += result; - } - -//printf("avcodec_decode_audio result=%d bytes_decoded=%d fragment_size=%d codec->compressed_size=%d\n", -//result, bytes_decoded, fragment_size, codec->compressed_size); -/* - * static FILE *test = 0; - * if(!test) test = fopen("/tmp/debug", "w"); - * fwrite(codec->temp_buffer, 1, bytes_decoded, test); - * fflush(test); - */ - for(i = 0; i < bytes_decoded / channels / sizeof(int16_t); i++) - { - for(j = 0; j < channels; j++) - codec->input_buffer[codec->input_ptr * channels + j] = - codec->temp_buffer[i * channels + j]; - codec->input_ptr++; - if(codec->input_ptr >= codec->input_allocated) - codec->input_ptr = 0; - } - codec->input_end += bytes_decoded / channels / sizeof(int16_t); - codec->input_size += bytes_decoded / channels / sizeof(int16_t); - - if(bytes_decoded <= 0) break; - } - - if( count > 0 ) { - memcpy(codec->compressed_buffer, - codec->compressed_buffer + count, - codec->compressed_size -= count); - } - } - - codec->current_chunk++; - if(codec->current_chunk >= total_chunks) break; - } - -// Transfer from buffer to output - int input_ptr = codec->input_ptr - (codec->input_end - current_position); - if(input_ptr < 0) input_ptr += codec->input_allocated; - if(output_i) - { - for(i = 0; i < samples; i++) - { - output_i[i] = codec->input_buffer[input_ptr * channels + channel]; - input_ptr++; - if(input_ptr >= codec->input_allocated) input_ptr = 0; - } - } - else - if(output_f) - { - for(i = 0; i < samples; i++) - { - output_f[i] = (float)codec->input_buffer[input_ptr * channels + channel] / 32768.0; - input_ptr++; - if(input_ptr >= codec->input_allocated) input_ptr = 0; - } - } - return 0; -} - - - - - -void quicktime_init_codec_qdm2(quicktime_audio_map_t *atrack) -{ - quicktime_codec_t *codec_base = (quicktime_codec_t*)atrack->codec; - codec_base->priv = calloc(1, sizeof(quicktime_qdm2_codec_t)); - codec_base->delete_acodec = delete_codec; - codec_base->decode_audio = decode; - codec_base->encode_audio = 0; - codec_base->set_parameter = 0; - codec_base->flush = 0; - codec_base->fourcc = "QDM2"; - codec_base->title = "QDesign Music 2"; - codec_base->desc = "QDesign Music 2"; -} - - - - diff --git a/cinelerra-5.0/quicktime/qdm2.h b/cinelerra-5.0/quicktime/qdm2.h deleted file mode 100644 index f62af0f3..00000000 --- a/cinelerra-5.0/quicktime/qdm2.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef QUICKTIME_QDM2_H -#define QUICKTIME_QDM2_H - - -extern void quicktime_init_codec_qdm2(quicktime_audio_map_t *); - - - -#endif diff --git a/cinelerra-5.0/quicktime/qtasf.c b/cinelerra-5.0/quicktime/qtasf.c deleted file mode 100644 index 2c13aa11..00000000 --- a/cinelerra-5.0/quicktime/qtasf.c +++ /dev/null @@ -1,261 +0,0 @@ -#include "funcprotos.h" -#include "qtasf.h" -#include "qtasf_codes.h" - -#include - -/* We have lifted sections of ASF decoding from ffmpeg */ -/* to add direct copy support and seeking to it */ - -int quicktime_read_guid(quicktime_t *file, quicktime_guid_t *guid) -{ - int i; - guid->v1 = quicktime_read_int32_le(file); - guid->v2 = quicktime_read_int16_le(file); - guid->v3 = quicktime_read_int16_le(file); - for(i = 0; i < 8; i++) - guid->v4[i] = quicktime_read_char(file); - return 0; -} - -quicktime_asfstream_t* new_asfstream() -{ - quicktime_asfstream_t *result = calloc(1, sizeof(quicktime_asfstream_t)); - return result; -} - -void delete_asfstream(quicktime_asfstream_t *stream) -{ - if(stream->extradata) - free(stream->extradata); -} - -void quicktime_delete_asf(quicktime_asf_t *asf) -{ - int i; - if(asf) - { - for(i = 0; i < asf->total_streams; i++) - delete_asfstream(asf->streams[i]); - } -} - -int quicktime_read_asf(quicktime_t *file) -{ - quicktime_asf_t *asf = calloc(1, sizeof(quicktime_asf_t)); - int got_header = 0; - int i; - - file->asf = asf; - quicktime_set_position(file, 16 + 14); - - while(1) - { - quicktime_guid_t guid; - int64_t guid_size; - int64_t guid_start = quicktime_position(file); - - bzero(&guid, sizeof(guid)); - quicktime_read_guid(file, &guid); - guid_size = quicktime_read_int64_le(file); - - printf("quicktime_read_asf start=0x%jx size=0x%jx\n", guid_start, guid_size); - -// Glitch - if(guid_size < 24) return 1; - - - if(!memcmp(&guid, &file_header, sizeof(guid))) - { - quicktime_guid_t leaf_guid; - got_header = 1; - quicktime_read_guid(file, &leaf_guid); - asf->header.file_size = quicktime_read_int64_le(file); - asf->header.create_time = quicktime_read_int64_le(file); - asf->header.total_packets = quicktime_read_int64_le(file); - asf->header.send_time = quicktime_read_int64_le(file); - asf->header.play_time = quicktime_read_int64_le(file); - asf->header.preroll = quicktime_read_int32_le(file); - asf->header.ignore = quicktime_read_int32_le(file); - asf->header.flags = quicktime_read_int32_le(file); - asf->header.min_packet = quicktime_read_int32_le(file); - asf->header.max_packet = quicktime_read_int32_le(file); - asf->header.max_bitrate = quicktime_read_int32_le(file); - asf->header.packet_size = asf->header.max_packet; - } - else if(!memcmp(&guid, &index_guid, sizeof(guid))) - { - quicktime_guid_t leaf_guid; -// Leaf Guid - quicktime_read_guid(file, &leaf_guid); -// indexed interval - quicktime_read_int64_le(file); -// max - quicktime_read_int32_le(file); -// count - asf->index_size = quicktime_read_int32_le(file); - asf->index = calloc(sizeof(quicktime_asfpacket_t), asf->index_size); - - for(i = 0; i < asf->index_size; i++) - { - asf->index[i].number = quicktime_read_int32_le(file); - asf->index[i].count = quicktime_read_int16_le(file); - } - } - else if(!memcmp(&guid, &stream_header, sizeof(guid))) - { - quicktime_asfstream_t *stream = - asf->streams[asf->total_streams++] = - new_asfstream(); - quicktime_guid_t leaf_guid; - quicktime_read_guid(file, &leaf_guid); - if(!memcmp(&leaf_guid, &audio_stream, sizeof(leaf_guid))) - stream->is_audio = 1; - else if(!memcmp(&leaf_guid, &video_stream, sizeof(leaf_guid))) - stream->is_video = 1; - else if(!memcmp(&leaf_guid, &ext_stream_embed_stream_header, sizeof(leaf_guid))) - stream->is_ext_audio = 1; - quicktime_read_guid(file, &leaf_guid); - - stream->total_size = quicktime_read_int64_le(file); - stream->type_specific_size = quicktime_read_int32_le(file); - quicktime_read_int32_le(file); - stream->id = quicktime_read_int16_le(file) & 0x7f; - quicktime_read_int32_le(file); - if(stream->is_ext_audio) - { - quicktime_read_guid(file, &leaf_guid); - if (!memcmp(&leaf_guid, &ext_stream_audio_stream, sizeof(leaf_guid))) - { - stream->is_audio = 1; - stream->is_ext_audio = 0; - quicktime_read_guid(file, &leaf_guid); - quicktime_read_int32_le(file); - quicktime_read_int32_le(file); - quicktime_read_int32_le(file); - quicktime_read_guid(file, &leaf_guid); - quicktime_read_int32_le(file); - } - } - - - if(stream->is_audio) - { -// Get WAV header - stream->codec_tag = quicktime_read_int16_le(file); - stream->channels = quicktime_read_int16_le(file); - stream->samplerate = quicktime_read_int32_le(file); - stream->bitrate = quicktime_read_int32_le(file); - stream->block_align = quicktime_read_int16_le(file); - if(stream->type_specific_size == 14) - stream->bits_per_sample = 8; - else - stream->bits_per_sample = quicktime_read_int16_le(file); - if(stream->type_specific_size > 16) - { - stream->extradata_size = quicktime_read_int16_le(file); - if (stream->extradata_size > 0) - { - if (stream->extradata_size > stream->type_specific_size - 18) - stream->extradata_size = stream->type_specific_size - 18; - stream->extradata = calloc(1, stream->extradata_size + 1024); - quicktime_read_data(file, (char*)stream->extradata, stream->extradata_size); - } - else - stream->extradata_size = 0; - - if(stream->type_specific_size - stream->extradata_size - 18 > 0) - quicktime_set_position(file, - quicktime_position(file) + - stream->type_specific_size - - stream->extradata_size - 18); - } - -// Make fourcc from codec_tag and bits_per_sample - } - else if(stream->is_video) - { - int size1; - quicktime_read_int32_le(file); - quicktime_read_int32_le(file); - quicktime_read_char(file); - size1 = quicktime_read_int16_le(file); - quicktime_read_int32_le(file); - stream->width = quicktime_read_int32_le(file); - stream->height = quicktime_read_int32_le(file); - quicktime_read_int16_le(file); - stream->bits_per_sample = quicktime_read_int16_le(file); - stream->codec_tag = quicktime_read_int32_le(file); - quicktime_set_position(file, quicktime_position(file) + 20); - if(size1 > 40) - { - stream->extradata_size = size1 - 40; - stream->extradata = calloc(1, stream->extradata_size + 1024); - quicktime_read_data(file, (char*)stream->extradata, stream->extradata_size); - } - -// Make fourcc from codec_tag - stream->fourcc[0] = (stream->codec_tag & 0xff); - stream->fourcc[1] = (stream->codec_tag & 0xff00) >> 8; - stream->fourcc[2] = (stream->codec_tag & 0xff0000) >> 16; - stream->fourcc[3] = (stream->codec_tag & 0xff000000) >> 24; - } - } - - quicktime_set_position(file, guid_start + guid_size); - if(quicktime_position(file) >= file->total_length) break; - } - - quicktime_dump_asf(asf); - return !got_header; -} - -void quicktime_dump_asf(quicktime_asf_t *asf) -{ - int i; - printf("asf header:\n"); - printf(" total_packets=%jd\n min_packet=%d\n max_packet=%d\n packet_size=%d\n", - asf->header.total_packets, - asf->header.min_packet, - asf->header.max_packet, - asf->header.packet_size); - printf(" total streams=%d\n", asf->total_streams); - - for(i = 0; i < asf->total_streams; i++) - { - quicktime_asfstream_t *stream = asf->streams[i]; - printf(" stream %d\n", i); - printf(" is_audio=%d\n is_video=%d\n", - stream->is_audio, - stream->is_video); - if(stream->is_audio) - { - printf(" codec_tag=0x%04x\n channels=%d\n samplerate=%d\n", - stream->codec_tag, - stream->channels, - stream->samplerate); - } - else - if(stream->is_video) - { - printf(" codec_tag='%s'\n width=%d\n height=%d\n", - stream->fourcc, - stream->width, - stream->height); - } - - printf(" extradata_size=%d\n", stream->extradata_size); - } - - printf(" index size=%d\n", asf->index_size); - - for(i = 0; i < asf->index_size; i++) - { - printf(" packet_number=%d packet_count=%d\n", - asf->index[i].number, - asf->index[i].count); - } -} - - - diff --git a/cinelerra-5.0/quicktime/qtasf.h b/cinelerra-5.0/quicktime/qtasf.h deleted file mode 100644 index dc74f7e6..00000000 --- a/cinelerra-5.0/quicktime/qtasf.h +++ /dev/null @@ -1,100 +0,0 @@ -#ifndef QTASF_H -#define QTASF_H - -#include "quicktime.h" -#include - -/* We have lifted sections of ASF decoding from ffmpeg */ -/* to add direct copy support and seeking to it */ - -#define MAX_ASFSTREAMS 256 - -typedef struct -{ - uint32_t v1; - uint16_t v2; - uint16_t v3; - uint8_t v4[8]; -} quicktime_guid_t; - -typedef struct -{ - int number; - int count; -} quicktime_asfpacket_t; - -typedef struct -{ - int is_audio; - int is_video; - int is_ext_audio; - int total_size; - int type_specific_size; - int start_time; - int duration; - int id; - int need_parsing; - int bits_per_sample; - int extradata_size; - unsigned char *extradata; - unsigned char fourcc[5]; - -/* Audio */ - int ds_span; - int ds_packet_size; - int ds_chunk_size; - int ds_data_size; - int ds_silence_data; - int frame_size; -/* WAV header */ - int codec_tag; - int channels; - int samplerate; - int bitrate; - int block_align; - int signed_; - int littleendian; - -/* Video */ - int width; - int height; -} quicktime_asfstream_t; - -typedef struct -{ - quicktime_guid_t quid; - int64_t file_size; - int64_t create_time; - int64_t total_packets; - int64_t send_time; - int64_t play_time; - int preroll; - int ignore; - int flags; - int min_packet; - int max_packet; - int max_bitrate; - int packet_size; -} quicktime_asfheader_t; - - -typedef struct -{ - quicktime_asfheader_t header; - quicktime_asfstream_t *streams[MAX_ASFSTREAMS]; - int total_streams; - quicktime_asfpacket_t *index; - int index_size; - int index_allocated; -} quicktime_asf_t; - - - -int quicktime_read_guid(quicktime_t *file,quicktime_guid_t *guid); -quicktime_asfstream_t *new_asfstream(void); -void delete_asfstream(quicktime_asfstream_t *stream); -void quicktime_delete_asf(quicktime_asf_t *asf); -int quicktime_read_asf(quicktime_t *file); -void quicktime_dump_asf(quicktime_asf_t *asf); - -#endif diff --git a/cinelerra-5.0/quicktime/qtasf_codes.h b/cinelerra-5.0/quicktime/qtasf_codes.h deleted file mode 100644 index f8f5e0b0..00000000 --- a/cinelerra-5.0/quicktime/qtasf_codes.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef QTASF_CODES_H -#define QTASF_CODES_H - -/* We have lifted sections of ASF decoding from ffmpeg */ -/* to add direct copy support and seeking to it */ - -#include "qtasf.h" -#include "quicktime.h" - -static const quicktime_guid_t index_guid = { - 0x33000890, 0xe5b1, 0x11cf, { 0x89, 0xf4, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xcb }, -}; - - -static const quicktime_guid_t asf_header = { - 0x75B22630, 0x668E, 0x11CF, { 0xA6, 0xD9, 0x00, 0xAA, 0x00, 0x62, 0xCE, 0x6C }, -}; - -static const quicktime_guid_t file_header = { - 0x8CABDCA1, 0xA947, 0x11CF, { 0x8E, 0xE4, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65 }, -}; - -static const quicktime_guid_t stream_header = { - 0xB7DC0791, 0xA9B7, 0x11CF, { 0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65 }, -}; - -static const quicktime_guid_t ext_stream_header = { - 0x14E6A5CB, 0xC672, 0x4332, { 0x83, 0x99, 0xA9, 0x69, 0x52, 0x06, 0x5B, 0x5A }, -}; - -static const quicktime_guid_t audio_stream = { - 0xF8699E40, 0x5B4D, 0x11CF, { 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B }, -}; - -static const quicktime_guid_t audio_conceal_none = { - // 0x49f1a440, 0x4ece, 0x11d0, { 0xa3, 0xac, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6 }, - // New value lifted from avifile - 0x20fb5700, 0x5b55, 0x11cf, { 0xa8, 0xfd, 0x00, 0x80, 0x5f, 0x5c, 0x44, 0x2b }, -}; - -static const quicktime_guid_t audio_conceal_spread = { - 0xBFC3CD50, 0x618F, 0x11CF, { 0x8B, 0xB2, 0x00, 0xAA, 0x00, 0xB4, 0xE2, 0x20 }, -}; - -static const quicktime_guid_t video_stream = { - 0xBC19EFC0, 0x5B4D, 0x11CF, { 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B }, -}; - -static const quicktime_guid_t video_conceal_none = { - 0x20FB5700, 0x5B55, 0x11CF, { 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B }, -}; - -static const quicktime_guid_t command_stream = { - 0x59DACFC0, 0x59E6, 0x11D0, { 0xA3, 0xAC, 0x00, 0xA0, 0xC9, 0x03, 0x48, 0xF6 }, -}; - -static const quicktime_guid_t comment_header = { - 0x75b22633, 0x668e, 0x11cf, { 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c }, -}; - -static const quicktime_guid_t codec_comment_header = { - 0x86D15240, 0x311D, 0x11D0, { 0xA3, 0xA4, 0x00, 0xA0, 0xC9, 0x03, 0x48, 0xF6 }, -}; -static const quicktime_guid_t codec_comment1_header = { - 0x86d15241, 0x311d, 0x11d0, { 0xa3, 0xa4, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6 }, -}; - -static const quicktime_guid_t data_header = { - 0x75b22636, 0x668e, 0x11cf, { 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c }, -}; - -static const quicktime_guid_t head1_guid = { - 0x5fbf03b5, 0xa92e, 0x11cf, { 0x8e, 0xe3, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65 }, -}; - -static const quicktime_guid_t head2_guid = { - 0xabd3d211, 0xa9ba, 0x11cf, { 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65 }, -}; - -static const quicktime_guid_t extended_content_header = { - 0xD2D0A440, 0xE307, 0x11D2, { 0x97, 0xF0, 0x00, 0xA0, 0xC9, 0x5E, 0xA8, 0x50 }, -}; - -static const quicktime_guid_t simple_index_header = { - 0x33000890, 0xE5B1, 0x11CF, { 0x89, 0xF4, 0x00, 0xA0, 0xC9, 0x03, 0x49, 0xCB }, -}; - -static const quicktime_guid_t ext_stream_embed_stream_header = { - 0x3afb65e2, 0x47ef, 0x40f2, { 0xac, 0x2c, 0x70, 0xa9, 0x0d, 0x71, 0xd3, 0x43} -}; - -static const quicktime_guid_t ext_stream_audio_stream = { - 0x31178c9d, 0x03e1, 0x4528, { 0xb5, 0x82, 0x3d, 0xf9, 0xdb, 0x22, 0xf5, 0x03} -}; - -/* I am not a number !!! This quicktime_guid_t is the one found on the PC used to - generate the stream */ -static const quicktime_guid_t my_guid = { - 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, -}; - - -#endif diff --git a/cinelerra-5.0/quicktime/qtbak.txz b/cinelerra-5.0/quicktime/qtbak.txz deleted file mode 100644 index 16916a7eacdbaea98e8465cd085e7c91effbd318..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 47100 zcmV(rK<>Z&H+ooF000E$*0e?f03iVu0001VFXf}=XaBdnT>vQ;|rVK{f( zv>qFC)C0P`KC6cso}FF)~}wf8rwbUn#7f>b&PUSq}7bQH7zCq zqi!}9{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spHiRM&@)vy-zCl&a+ClEwq_d(MQ805bS=gu-;F);y%#YzHgP4V6epPdE;z(J zuu6iHkIQ;QUfJKi?EKiaD#-Jv^P;eYQ=sDFP64!d=0D)osJjh0sn? zEcAh-7qh9EZW%s*o$7e!pm#orlO8GtK@G7)4bGJE^{cKR6$@hGVt5`>|GEK& z8MZ)3@o@etRcN;P#9}-gcOlp8IqANvFLKK>8%!u?Aoe4h8yVowC z_aI>vpXDEk2ukKQKMYqF6@gUs|1}k6BX$(*6dA#GNF-~fwd2Sbr6i*v0-!->R!x_e zU#wEzmtN)~Wk!R7q){y+78(gXXiM3S&7_>y7egnaZ{#i@e>6d6i2Yn@&Wp)7Cdd%F z23LG7IH!u&$@y_-YrgDpfAV_`f*bwU@0fHWIWb6(%c1@M$qG`g%9Yl%2>S|bP|>&cl?SAa?csA!?^5LEkA-)Ed#%v`nY+E^o3&U+ZqtH^haIB*gk`OBHLn!-|d*< z9o+#Bjd>G}o12!zdhZL!UuzIdytA?+aTCu6A>E#&UW_j$jBmvkE){&OMA;+4IlMD4 z>EcNL2dn_Q1amS%5PKMx7f>9fqoV&{Fw}jeF^dTXHckrj_N)0wxq5%@U>_CLK~b6> z&#B2G)dtyNwBjMbs%Xnz@pnw;+F~?RFZ=P&$RT^z8)gi=c#B3IOvys(2~Rr&Z(UFX)Ze2JRdvK@6sS> zQks#9X2dl;CPOSLOxVc*M{DTO8qv@-LL%kf52wv!UF5U*zW#CN5R~C*$bzaiKC9TS zq-IeQPuxJ@WTTX@>d>){0~h^X*n+oG0CApSU{omLfdB#6?*f3(8AYViIkCiN`vL#} I000D8S_O}V!2kdN diff --git a/cinelerra-5.0/quicktime/qtcache.c b/cinelerra-5.0/quicktime/qtcache.c deleted file mode 100644 index 50692a67..00000000 --- a/cinelerra-5.0/quicktime/qtcache.c +++ /dev/null @@ -1,208 +0,0 @@ -#include "funcprotos.h" -#include "qtprivate.h" -#include - - -quicktime_cache_t* quicktime_new_cache() -{ - quicktime_cache_t *result = calloc(1, sizeof(quicktime_cache_t)); - return result; -} - -void quicktime_delete_cache(quicktime_cache_t *ptr) -{ - if(ptr->frames) - { - int i; -//printf("quicktime_delete_cache 1\n"); - for(i = 0; i < ptr->allocation; i++) - { - quicktime_cacheframe_t *frame = &ptr->frames[i]; - if(frame->y) free(frame->y); - if(frame->u) free(frame->u); - if(frame->v) free(frame->v); - } - free(ptr->frames); - free(ptr); - } -} - -void quicktime_reset_cache(quicktime_cache_t *ptr) -{ - ptr->total = 0; -} - -void quicktime_put_frame(quicktime_cache_t *ptr, - int64_t frame_number, - unsigned char *y, - unsigned char *u, - unsigned char *v, - int y_size, - int u_size, - int v_size) -{ - quicktime_cacheframe_t *frame = 0; - int i; - -//printf("quicktime_put_frame %d total=%d allocation=%d\n", __LINE__, ptr->total, ptr->allocation); -// Get existing frame - for(i = 0; i < ptr->total; i++) - { - if(ptr->frames[i].frame_number == frame_number) - { - frame = &ptr->frames[i]; - break; - } - } - - - if(!frame) - { - if(ptr->total >= ptr->allocation) - { - int new_allocation = ptr->allocation * 2; - -// printf("quicktime_put_frame %d ptr->allocation=%d new_allocation=%d\n", -// __LINE__, -// ptr->allocation, -// new_allocation); - - if(!new_allocation) new_allocation = 32; - ptr->frames = realloc(ptr->frames, - sizeof(quicktime_cacheframe_t) * new_allocation); - bzero(ptr->frames + ptr->total, - sizeof(quicktime_cacheframe_t) * (new_allocation - ptr->allocation)); - ptr->allocation = new_allocation; - } - - frame = &ptr->frames[ptr->total]; -//printf("quicktime_put_frame 30 %d %p %p %p\n", ptr->total, frame->y, frame->u, frame->v); - ptr->total++; - -// Memcpy is a lot slower than just dropping the seeking frames. - if(y) - { - frame->y = realloc(frame->y, y_size); - frame->y_size = y_size; - memcpy(frame->y, y, y_size); - } - - if(u) - { - frame->u = realloc(frame->u, u_size); - frame->u_size = u_size; - memcpy(frame->u, u, u_size); - } - - if(v) - { - frame->v = realloc(frame->v, v_size); - frame->v_size = v_size; - memcpy(frame->v, v, v_size); - } - frame->frame_number = frame_number; - } - - -//printf("quicktime_put_frame %d total=%d allocation=%d\n", __LINE__, ptr->total, ptr->allocation); -// Delete oldest frames - if(ptr->max) - { - while(quicktime_cache_usage(ptr) > ptr->max && ptr->total > 0) - { - quicktime_cacheframe_t *frame = &ptr->frames[0]; - - if(frame->y) free(frame->y); - if(frame->u) free(frame->u); - if(frame->v) free(frame->v); - - for(i = 0; i < ptr->total - 1; i++) - { - quicktime_cacheframe_t *frame1 = &ptr->frames[i]; - quicktime_cacheframe_t *frame2 = &ptr->frames[i + 1]; - *frame1 = *frame2; - } - - - frame = &ptr->frames[ptr->total - 1]; - frame->y = 0; - frame->u = 0; - frame->v = 0; - ptr->total--; - ptr->allocation--; - } - } - - -// printf("quicktime_put_frame %d total=%d allocation=%d\n", __LINE__, ptr->total, ptr->allocation); -// printf("quicktime_put_frame %d max=0x%x current=0x%x\n", -// __LINE__, -// ptr->max, -// quicktime_cache_usage(ptr)); - -} - -int quicktime_get_frame(quicktime_cache_t *ptr, - int64_t frame_number, - unsigned char **y, - unsigned char **u, - unsigned char **v) -{ - int i; - - for(i = 0; i < ptr->total; i++) - { - quicktime_cacheframe_t *frame = &ptr->frames[i]; - if(frame->frame_number == frame_number) - { - - *y = frame->y; - *u = frame->u; - *v = frame->v; - return 1; - break; - } - } - - return 0; -} - -int quicktime_has_frame(quicktime_cache_t *ptr, - int64_t frame_number) -{ - int i; - - for(i = 0; i < ptr->total; i++) - { - quicktime_cacheframe_t *frame = &ptr->frames[i]; - if(frame->frame_number == frame_number) - { - return 1; - break; - } - } - - return 0; -} - -int64_t quicktime_cache_usage(quicktime_cache_t *ptr) -{ - int64_t result = 0; - int i; -//printf("quicktime_cache_usage %p %d %lld\n", ptr, ptr->total, result); - for(i = 0; i < ptr->total; i++) - { - quicktime_cacheframe_t *frame = &ptr->frames[i]; - result += frame->y_size + frame->u_size + frame->v_size; - } - return result; -} - -void quicktime_cache_max(quicktime_cache_t *ptr, int bytes) -{ - ptr->max = bytes; -} - - - - diff --git a/cinelerra-5.0/quicktime/qtdv.c b/cinelerra-5.0/quicktime/qtdv.c deleted file mode 100644 index 80fa106b..00000000 --- a/cinelerra-5.0/quicktime/qtdv.c +++ /dev/null @@ -1,448 +0,0 @@ -/* 2002: Refurbished by Arthur Peters amep@softhome.net */ -/* 2000: Original codec by Heroine Virtual */ - - -#include "colormodels.h" -#include "funcprotos.h" -#include "libdv/dv.h" -#include "quicktime.h" - -#include -#include - -// Buffer sizes -#define DV_NTSC_SIZE 120000 -#define DV_PAL_SIZE 144000 - -typedef struct -{ - dv_decoder_t *dv_decoder; - dv_encoder_t *dv_encoder; - unsigned char *data; - unsigned char *temp_frame, **temp_rows; - - /* Parameters */ - int decode_quality; - int anamorphic16x9; - int vlc_encode_passes; - int clamp_luma, clamp_chroma; - - int add_ntsc_setup; - - int rem_ntsc_setup; - - int parameters_changed; -} quicktime_dv_codec_t; - -static pthread_mutex_t libdv_init_mutex = PTHREAD_MUTEX_INITIALIZER; - -static void delete_codec(quicktime_video_map_t *vtrack) -{ - quicktime_dv_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv; - - if(codec->dv_decoder) - { - dv_decoder_free( codec->dv_decoder ); - codec->dv_decoder = NULL; - } - - if(codec->dv_encoder) - { - dv_encoder_free( codec->dv_encoder ); - codec->dv_encoder = NULL; - } - - if(codec->temp_frame) free(codec->temp_frame); - if(codec->temp_rows) free(codec->temp_rows); - free(codec->data); - free(codec); -} - -static int check_sequentiality( unsigned char **row_pointers, - int bytes_per_row, - int height ) -{ - int i = 0; - - for(; i < height-1; i++) - { - if( row_pointers[i+1] - row_pointers[i] != bytes_per_row ) - { - return 0; - } - } - return 1; -} - -static int decode(quicktime_t *file, unsigned char **row_pointers, int track) -{ - long bytes; - quicktime_video_map_t *vtrack = &(file->vtracks[track]); - quicktime_dv_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv; - int width = vtrack->track->tkhd.track_width; - int height = vtrack->track->tkhd.track_height; - int result = 0; - int i; - int decode_colormodel = 0; - int pitches[3] = { 720 * 2, 0, 0 }; - - - quicktime_set_video_position(file, vtrack->current_position, track); - bytes = quicktime_frame_size(file, vtrack->current_position, track); - result = !quicktime_read_data(file, (char*)codec->data, bytes); - - if( codec->dv_decoder && codec->parameters_changed ) - { - dv_decoder_free( codec->dv_decoder ); - codec->dv_decoder = NULL; - codec->parameters_changed = 0; - } - - if( ! codec->dv_decoder ) - { - pthread_mutex_lock( &libdv_init_mutex ); - - - codec->dv_decoder = dv_decoder_new( codec->add_ntsc_setup, - codec->clamp_luma, - codec->clamp_chroma ); - codec->dv_decoder->prev_frame_decoded = 0; - - codec->parameters_changed = 0; - pthread_mutex_unlock( &libdv_init_mutex ); - } - - if(codec->dv_decoder) - { - int is_sequential = - check_sequentiality( row_pointers, - 720 * cmodel_calculate_pixelsize(file->color_model), - file->out_h ); - - codec->dv_decoder->quality = codec->decode_quality; - - dv_parse_header( codec->dv_decoder, codec->data ); - -// Libdv improperly decodes RGB colormodels. - if((file->color_model == BC_YUV422 || - file->color_model == BC_RGB888) && - file->in_x == 0 && - file->in_y == 0 && - file->in_w == width && - file->in_h == height && - file->out_w == width && - file->out_h == height && - is_sequential) - { - if( file->color_model == BC_YUV422 ) - { - pitches[0] = 720 * 2; - dv_decode_full_frame( codec->dv_decoder, codec->data, - e_dv_color_yuv, row_pointers, - pitches ); - } - else - if( file->color_model == BC_RGB888) - { - pitches[0] = 720 * 3; - dv_decode_full_frame( codec->dv_decoder, codec->data, - e_dv_color_rgb, row_pointers, - pitches ); - } - } - else - { - if(!codec->temp_frame) - { - codec->temp_frame = malloc(720 * 576 * 2); - codec->temp_rows = malloc(sizeof(unsigned char*) * 576); - for(i = 0; i < 576; i++) - codec->temp_rows[i] = codec->temp_frame + 720 * 2 * i; - } - - decode_colormodel = BC_YUV422; - pitches[0] = 720 * 2; - dv_decode_full_frame( codec->dv_decoder, codec->data, - e_dv_color_yuv, codec->temp_rows, - pitches ); - - - - - cmodel_transfer(row_pointers, - codec->temp_rows, - row_pointers[0], - row_pointers[1], - row_pointers[2], - codec->temp_rows[0], - codec->temp_rows[1], - codec->temp_rows[2], - file->in_x, - file->in_y, - file->in_w, - file->in_h, - 0, - 0, - file->out_w, - file->out_h, - decode_colormodel, - file->color_model, - 0, - width, - file->out_w); - } - } - -//printf(__FUNCTION__ " 2\n"); - return result; -} - -static int encode(quicktime_t *file, unsigned char **row_pointers, int track) -{ - //int64_t offset = quicktime_position(file); - quicktime_video_map_t *vtrack = &(file->vtracks[track]); - quicktime_dv_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv; - quicktime_trak_t *trak = vtrack->track; - int width = trak->tkhd.track_width; - int height = trak->tkhd.track_height; - int width_i = 720; - int height_i = (height <= 480) ? 480 : 576; - int i; - unsigned char **input_rows; - int is_pal = (height_i == 480) ? 0 : 1; - int data_length = is_pal ? DV_PAL_SIZE : DV_NTSC_SIZE; - int result = 0; - dv_color_space_t encode_dv_colormodel = 0; - quicktime_atom_t chunk_atom; - - if( codec->dv_encoder != NULL && codec->parameters_changed ) - { - dv_encoder_free( codec->dv_encoder ); - codec->dv_encoder = NULL; - codec->parameters_changed = 0; - } - - if( ! codec->dv_encoder ) - { - pthread_mutex_lock( &libdv_init_mutex ); - - //printf( "dv.c encode: Alloc'ing encoder\n" ); - - codec->dv_encoder = dv_encoder_new( codec->rem_ntsc_setup, - codec->clamp_luma, - codec->clamp_chroma ); - - codec->parameters_changed = 0; - pthread_mutex_unlock( &libdv_init_mutex ); - } - - if(codec->dv_encoder) - { - int is_sequential = - check_sequentiality( row_pointers, - width_i * cmodel_calculate_pixelsize(file->color_model), - height ); - - if( ( file->color_model == BC_YUV422 - || file->color_model == BC_RGB888 ) && - width == width_i && - height == height_i && - is_sequential ) - { - input_rows = row_pointers; - switch( file->color_model ) - { - case BC_YUV422: - encode_dv_colormodel = e_dv_color_yuv; -//printf( "dv.c encode: e_dv_color_yuv\n" ); - break; - case BC_RGB888: - encode_dv_colormodel = e_dv_color_rgb; -//printf( "dv.c encode: e_dv_color_rgb\n" ); - break; - default: - return 0; - break; - } - } - else - { -// The best colormodel for encoding is YUV 422 - - if(!codec->temp_frame) - { - codec->temp_frame = malloc(720 * 576 * 2); - codec->temp_rows = malloc(sizeof(unsigned char*) * 576); - for(i = 0; i < 576; i++) - codec->temp_rows[i] = codec->temp_frame + 720 * 2 * i; - } - - cmodel_transfer(codec->temp_rows, /* Leave NULL if non existent */ - row_pointers, - codec->temp_rows[0], /* Leave NULL if non existent */ - codec->temp_rows[1], - codec->temp_rows[2], - row_pointers[0], /* Leave NULL if non existent */ - row_pointers[1], - row_pointers[2], - 0, /* Dimensions to capture from input frame */ - 0, - MIN(width, width_i), - MIN(height, height_i), - 0, /* Dimensions to project on output frame */ - 0, - MIN(width, width_i), - MIN(height, height_i), - file->color_model, - BC_YUV422, - 0, /* When transfering BC_RGBA8888 to non-alpha this is the background color in 0xRRGGBB hex */ - width, /* For planar use the luma rowspan */ - width_i); - - - input_rows = codec->temp_rows; - encode_dv_colormodel = e_dv_color_yuv; - } - -// Setup the encoder - codec->dv_encoder->is16x9 = codec->anamorphic16x9; - codec->dv_encoder->vlc_encode_passes = codec->vlc_encode_passes; - codec->dv_encoder->static_qno = 0; - codec->dv_encoder->force_dct = DV_DCT_AUTO; - codec->dv_encoder->isPAL = is_pal; - - -//printf("dv.c encode: 1 %d %d %d\n", width_i, height_i, encode_dv_colormodel); - dv_encode_full_frame( codec->dv_encoder, - input_rows, encode_dv_colormodel, codec->data ); -//printf("dv.c encode: 2 %d %d\n", width_i, height_i); - - quicktime_write_chunk_header(file, trak, &chunk_atom); - result = !quicktime_write_data(file, (char*)codec->data, data_length); - quicktime_write_chunk_footer(file, - trak, - vtrack->current_chunk, - &chunk_atom, - 1); - vtrack->current_chunk++; -//printf("encode 3\n"); - } - - return result; -} - -// Logic: DV contains a mixture of 420 and 411 so can only -// output/input 444 or 422 and libdv can output/input RGB as well so -// we include that. - -// This function is used as both reads_colormodel and writes_colormodel -static int colormodel_dv(quicktime_t *file, - int colormodel, - int track) -{ - return (colormodel == BC_RGB888 || - colormodel == BC_YUV888 || - colormodel == BC_YUV422); -} - -static int set_parameter(quicktime_t *file, - int track, - char *key, - void *value) -{ - quicktime_dv_codec_t *codec = ((quicktime_codec_t*)file->vtracks[track].codec)->priv; - - if(!strcasecmp(key, "dv_decode_quality")) - { - codec->decode_quality = *(int*)value; - } - else if(!strcasecmp(key, "dv_anamorphic16x9")) - { - codec->anamorphic16x9 = *(int*)value; - } - else if(!strcasecmp(key, "dv_vlc_encode_passes")) - { - codec->vlc_encode_passes = *(int*)value; - } - else if(!strcasecmp(key, "dv_clamp_luma")) - { - codec->clamp_luma = *(int*)value; - } - else if(!strcasecmp(key, "dv_clamp_chroma")) - { - codec->clamp_chroma = *(int*)value; - } - else if(!strcasecmp(key, "dv_add_ntsc_setup")) - { - codec->add_ntsc_setup = *(int*)value; - } - else if(!strcasecmp(key, "dv_rem_ntsc_setup")) - { - codec->rem_ntsc_setup = *(int*)value; - } - else - { - return 0; - } - - codec->parameters_changed = 1; - return 0; -} - -static void init_codec_common(quicktime_video_map_t *vtrack, char *fourcc) -{ - quicktime_codec_t *codec_base = (quicktime_codec_t*)vtrack->codec; - quicktime_dv_codec_t *codec; - -/* Init public items */ - codec_base->priv = calloc(1, sizeof(quicktime_dv_codec_t)); - codec_base->delete_vcodec = delete_codec; - codec_base->decode_video = decode; - codec_base->encode_video = encode; - codec_base->decode_audio = 0; - codec_base->encode_audio = 0; - codec_base->reads_colormodel = colormodel_dv; - codec_base->writes_colormodel = colormodel_dv; - codec_base->set_parameter = set_parameter; - codec_base->fourcc = fourcc; - codec_base->title = "DV"; - codec_base->desc = "DV"; - - - /* Init private items */ - - codec = codec_base->priv; - - codec->dv_decoder = NULL; - codec->dv_encoder = NULL; - codec->decode_quality = DV_QUALITY_BEST; - codec->anamorphic16x9 = 0; - codec->vlc_encode_passes = 3; - codec->clamp_luma = codec->clamp_chroma = 0; - codec->add_ntsc_setup = 0; - codec->parameters_changed = 0; - -// Allocate extra to work around some libdv overrun - codec->data = calloc(1, 144008); -} - -void quicktime_init_codec_dv(quicktime_video_map_t *vtrack) -{ - init_codec_common(vtrack, QUICKTIME_DV); -} - -void quicktime_init_codec_dvcp(quicktime_video_map_t *vtrack) -{ - init_codec_common(vtrack, QUICKTIME_DVCP); -} - - -void quicktime_init_codec_dv25(quicktime_video_map_t *vtrack) -{ - init_codec_common(vtrack, QUICKTIME_DV25); -} - -void quicktime_init_codec_dvsd(quicktime_video_map_t *vtrack) -{ - init_codec_common(vtrack, QUICKTIME_DVSD); -} diff --git a/cinelerra-5.0/quicktime/qtdv.h b/cinelerra-5.0/quicktime/qtdv.h deleted file mode 100644 index fd9c07d7..00000000 --- a/cinelerra-5.0/quicktime/qtdv.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef QUICKTIME_DV_H -#define QUICKTIME_DV_H - -extern void quicktime_init_codec_dv(quicktime_video_map_t *); -extern void quicktime_init_codec_dv25(quicktime_video_map_t *); -extern void quicktime_init_codec_dvsd(quicktime_video_map_t *vtrack); -extern void quicktime_init_codec_dvcp(quicktime_video_map_t *); - -#endif diff --git a/cinelerra-5.0/quicktime/qtffmpeg.c b/cinelerra-5.0/quicktime/qtffmpeg.c deleted file mode 100644 index 68a0aa1e..00000000 --- a/cinelerra-5.0/quicktime/qtffmpeg.c +++ /dev/null @@ -1,340 +0,0 @@ -#include "colormodels.h" -#include "funcprotos.h" -#include "quicktime.h" -#include "qtffmpeg.h" -#include "qtprivate.h" - -#include -// FFMPEG front end for quicktime. - -int ffmpeg_initialized = 0; -pthread_mutex_t ffmpeg_lock = PTHREAD_MUTEX_INITIALIZER; - -quicktime_ffmpeg_t *quicktime_new_ffmpeg(int cpus, - int fields, int ffmpeg_id, int w, int h, - quicktime_stsd_table_t *stsd_table) -{ - quicktime_ffmpeg_t *ptr = calloc(1, sizeof(quicktime_ffmpeg_t)); - quicktime_esds_t *esds = &stsd_table->esds; - quicktime_avcc_t *avcc = &stsd_table->avcc; - int i; - - ptr->fields = fields; - ptr->width = w; - ptr->height = h; - ptr->ffmpeg_id = ffmpeg_id; - - if( ffmpeg_id == CODEC_ID_SVQ1 ) { - ptr->width_i = quicktime_quantize32(ptr->width); - ptr->height_i = quicktime_quantize32(ptr->height); - } - else { - ptr->width_i = quicktime_quantize16(ptr->width); - ptr->height_i = quicktime_quantize16(ptr->height); - } - - pthread_mutex_lock(&ffmpeg_lock); - if( !ffmpeg_initialized ) { - ffmpeg_initialized = 1; - av_register_all(); - } - - for( i=0; idecoder[i] = avcodec_find_decoder(ptr->ffmpeg_id); - if( !ptr->decoder[i] ) { - printf("quicktime_new_ffmpeg: avcodec_find_decoder returned NULL.\n"); - quicktime_delete_ffmpeg(ptr); - return 0; - } - - AVCodecContext *context = avcodec_alloc_context3(ptr->decoder[i]); - ptr->decoder_context[i] = context; - static char fake_data[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -// static unsigned char extra_data[] = { -// 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x20, -// 0x00, 0xc8, 0x88, 0xba, 0x98, 0x60, 0xfa, 0x67, -// 0x80, 0x91, 0x02, 0x83, 0x1f }; - context->width = ptr->width_i; - context->height = ptr->height_i; -// context->width = w; -// context->height = h; - context->extradata = (unsigned char *) fake_data; - context->extradata_size = 0; - if( esds->mpeg4_header && esds->mpeg4_header_size ) { - context->extradata = (unsigned char *) esds->mpeg4_header; - context->extradata_size = esds->mpeg4_header_size; - } - else if( avcc->data && avcc->data_size ) { - context->extradata = (unsigned char *) avcc->data; - context->extradata_size = avcc->data_size; - } - int result = -1; - if( cpus > 1 ) { - context->thread_count = cpus; - result = avcodec_open2(context, ptr->decoder[i], 0); - } - if( result < 0 ) { - context->thread_count = 1; - result = avcodec_open2(context, ptr->decoder[i], 0); - } - if( result < 0 ) { - printf("quicktime_new_ffmpeg: avcodec_open failed.\n"); - quicktime_delete_ffmpeg(ptr); - ptr = NULL; - break; - } - - ptr->last_frame[i] = -1; - } - - pthread_mutex_unlock(&ffmpeg_lock); - return ptr; -} - -void quicktime_delete_ffmpeg(quicktime_ffmpeg_t *ptr) -{ - int i; - if( !ptr ) return; - pthread_mutex_lock(&ffmpeg_lock); - for( i=0; ifields; ++i ) { - if( !ptr->decoder_context[i] ) continue; - avcodec_close(ptr->decoder_context[i]); - free(ptr->decoder_context[i]); - } - pthread_mutex_unlock(&ffmpeg_lock); - - if(ptr->temp_frame) free(ptr->temp_frame); - if(ptr->work_buffer) free(ptr->work_buffer); - free(ptr); -} - -//avcodec_get_frame_defaults -static void frame_defaults(AVFrame *frame) -{ - memset(frame, 0, sizeof(AVFrame)); - av_frame_unref(frame); -} - -static int decode_wrapper(quicktime_t *file, - quicktime_video_map_t *vtrack, quicktime_ffmpeg_t *ffmpeg, - int frame_number, int current_field, int track, int drop_it) -{ - quicktime_trak_t *trak = vtrack->track; - quicktime_stsd_table_t *stsd_table = &trak->mdia.minf.stbl.stsd.table[0]; - int got_picture = 0, result = 0; - int header_bytes = !frame_number ? stsd_table->esds.mpeg4_header_size : 0; - int bytes; char *data; - quicktime_set_video_position(file, frame_number, track); - bytes = quicktime_frame_size(file, frame_number, track) + header_bytes; - - if( ffmpeg->work_buffer && ffmpeg->buffer_size < bytes ) { - free(ffmpeg->work_buffer); ffmpeg->work_buffer = 0; - } - if( !ffmpeg->work_buffer ) { - ffmpeg->buffer_size = bytes; - ffmpeg->work_buffer = calloc(1, ffmpeg->buffer_size + 100); - } - data = (char *)ffmpeg->work_buffer; - if( header_bytes ) { - memcpy(data, stsd_table->esds.mpeg4_header, header_bytes); - data += header_bytes; bytes -= header_bytes; - header_bytes = 0; - } - - if( !quicktime_read_data(file, data, bytes) ) - result = -1; - - AVPacket avpkt; - av_init_packet(&avpkt); - avpkt.data = ffmpeg->work_buffer; - avpkt.size = bytes; - avpkt.flags = AV_PKT_FLAG_KEY; - - while( !result && !got_picture && avpkt.size > 0 ) { - ffmpeg->decoder_context[current_field]->skip_frame = - drop_it ? AVDISCARD_NONREF : AVDISCARD_DEFAULT; - frame_defaults(&ffmpeg->picture[current_field]); - ffmpeg->decoder_context[current_field]->workaround_bugs = FF_BUG_NO_PADDING; - result = avcodec_decode_video2(ffmpeg->decoder_context[current_field], - &ffmpeg->picture[current_field], &got_picture, &avpkt); - if( result < 0 ) break; - avpkt.data += result; - avpkt.size -= result; - } - -#ifdef ARCH_X86 - asm("emms"); -#endif - return !got_picture; -} - -// Get amount chroma planes are downsampled from luma plane. -// Used for copying planes into cache. -static int get_chroma_factor(quicktime_ffmpeg_t *ffmpeg, int current_field) -{ - switch(ffmpeg->decoder_context[current_field]->pix_fmt) - { - case PIX_FMT_YUV420P: return 4; - case PIX_FMT_YUVJ420P: return 4; - case PIX_FMT_YUYV422: return 2; - case PIX_FMT_YUV422P: return 2; - case PIX_FMT_YUV410P: return 9; - default: - fprintf(stderr, "get_chroma_factor: unrecognized color model %d\n", - ffmpeg->decoder_context[current_field]->pix_fmt); - break; - } - return 9; -} - -int quicktime_ffmpeg_decode(quicktime_ffmpeg_t * ffmpeg, - quicktime_t *file, unsigned char **row_pointers, int track) -{ - quicktime_video_map_t *vtrack = &(file->vtracks[track]); - int current_field = vtrack->current_position % ffmpeg->fields; - int input_cmodel = BC_TRANSPARENCY; - int i, seeking_done = 0; - int result = quicktime_get_frame(vtrack->frame_cache, vtrack->current_position, - &ffmpeg->picture[current_field].data[0], - &ffmpeg->picture[current_field].data[1], - &ffmpeg->picture[current_field].data[2]); - - if( !result ) { - if( ffmpeg->last_frame[current_field] == -1 && ffmpeg->ffmpeg_id != CODEC_ID_H264 ) { - int current_frame = vtrack->current_position; - result = decode_wrapper(file, vtrack, ffmpeg, - current_field, current_field, track, 0); - quicktime_set_video_position(file, current_frame, track); - ffmpeg->last_frame[current_field] = current_field; - } - - if( quicktime_has_keyframes(file, track) && - vtrack->current_position != ffmpeg->last_frame[current_field] + ffmpeg->fields && - vtrack->current_position != ffmpeg->last_frame[current_field]) { - int frame1; - int first_frame; - int frame2 = vtrack->current_position; - int current_frame = frame2; - - if( !quicktime_has_frame(vtrack->frame_cache, vtrack->current_position + 1) ) - quicktime_reset_cache(vtrack->frame_cache); - - frame1 = current_frame; - do { - frame1 = quicktime_get_keyframe_before(file, frame1 - 1, track); - } while( frame1 > 0 && (frame1 % ffmpeg->fields) != current_field ); - - if( 0 /* frame1 > 0 && ffmpeg->ffmpeg_id == CODEC_ID_MPEG4 */ ) { - do { - frame1 = quicktime_get_keyframe_before(file, frame1 - 1, track); - } while( frame1 > 0 && (frame1 & ffmpeg->fields) != current_field ); - } - - if( frame1 < ffmpeg->last_frame[current_field] && - frame2 > ffmpeg->last_frame[current_field]) { - frame1 = ffmpeg->last_frame[current_field] + ffmpeg->fields; - } -/* - * printf("quicktime_ffmpeg_decode 2 last_frame=%d frame1=%d frame2=%d\n", - * ffmpeg->last_frame[current_field], frame1, frame2); - */ - first_frame = frame1; - while( frame1 <= frame2 ) { - result = decode_wrapper(file, vtrack, ffmpeg, - frame1, current_field, track, 0 /* (frame1 < frame2) */ ); - if( ffmpeg->picture[current_field].data[0] && frame1 > first_frame ) { - int y_size = ffmpeg->picture[current_field].linesize[0] * ffmpeg->height_i; - int u_size = y_size / get_chroma_factor(ffmpeg, current_field); - int v_size = y_size / get_chroma_factor(ffmpeg, current_field); - quicktime_put_frame(vtrack->frame_cache, frame1, - ffmpeg->picture[current_field].data[0], - ffmpeg->picture[current_field].data[1], - ffmpeg->picture[current_field].data[2], - y_size, u_size, v_size); - } - - frame1 += ffmpeg->fields; - } - - vtrack->current_position = frame2; - seeking_done = 1; - } - - if (!seeking_done && vtrack->current_position != ffmpeg->last_frame[current_field]) { - result = decode_wrapper(file, vtrack, ffmpeg, - vtrack->current_position, current_field, track, 0); - } - - ffmpeg->last_frame[current_field] = vtrack->current_position; - } - - switch (ffmpeg->decoder_context[current_field]->pix_fmt) { - case PIX_FMT_YUV420P: input_cmodel = BC_YUV420P; break; - case PIX_FMT_YUYV422: input_cmodel = BC_YUV422; break; - case PIX_FMT_YUVJ420P: input_cmodel = BC_YUV420P; break; - case PIX_FMT_YUV422P: input_cmodel = BC_YUV422P; break; - case PIX_FMT_YUV410P: input_cmodel = BC_YUV9P; break; - default: - input_cmodel = 0; - if (!ffmpeg->picture[current_field].data[0]) - break; - fprintf(stderr, "quicktime_ffmpeg_decode: unrecognized color model %d\n", - ffmpeg->decoder_context[current_field]->pix_fmt); - break; - } - - if (ffmpeg->picture[current_field].data[0]) { - AVCodecContext *ctx = ffmpeg->decoder_context[current_field]; - int width = ctx->width, height = ctx->height; - AVFrame *picture = &ffmpeg->picture[current_field]; - unsigned char *data = picture->data[0]; - unsigned char **input_rows = malloc(sizeof(unsigned char *) * height); - int line_sz = cmodel_calculate_pixelsize(input_cmodel) * width; - for( i=0; idata[0], picture->data[1], picture->data[2], - file->in_x, file->in_y, file->in_w, file->in_h, - 0, 0, file->out_w, file->out_h, - input_cmodel, file->color_model, - 0, /* BC_RGBA8888 to non-alpha background color */ - ffmpeg->picture[current_field].linesize[0], - ffmpeg->width); /* For planar use the luma rowspan */ - free(input_rows); - } - - return result; -} - - -/* assumes 16-bit, interleaved data */ -/* always moves buffer */ -int quicktime_decode_audio3( - AVCodecContext *avctx, int16_t *samples, - int *frame_size_ptr, AVPacket *avpkt) -{ - int ret, got_frame = 0; - AVFrame *frame = av_frame_alloc(); - if (!frame) return -1; - - ret = avcodec_decode_audio4(avctx, frame, &got_frame, avpkt); - - if( ret >= 0 && got_frame ) { - int plane_size; - int data_size = av_samples_get_buffer_size(&plane_size, avctx->channels, - frame->nb_samples, avctx->sample_fmt, 1); - if( *frame_size_ptr < data_size ) { - printf("quicktime_decode_audio3: output buffer size is too small for " - "the current frame (%d < %d)\n", *frame_size_ptr, data_size); - av_frame_free(&frame); - return -1; - } - memcpy(samples, frame->extended_data[0], plane_size); - *frame_size_ptr = data_size; - } else { - *frame_size_ptr = 0; - } - av_frame_free(&frame); - return ret; -} - diff --git a/cinelerra-5.0/quicktime/qtffmpeg.h b/cinelerra-5.0/quicktime/qtffmpeg.h deleted file mode 100644 index 9ce9a8db..00000000 --- a/cinelerra-5.0/quicktime/qtffmpeg.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef QTFFMPEG_H -#define QTFFMPEG_H - - - -// This must be separate from qtprivate.h to keep everyone from -// depending on avcodec.h -// FFMPEG front end for quicktime. -// Getting ffmpeg to do all the things it needs to do is so labor -// intensive, we have a front end for the ffmpeg front end. - - -// This front end is bastardized to support alternating fields with -// alternating ffmpeg instances. It drastically reduces the bitrate -// required to store interlaced video but nothing can read it but -// Heroine Virtual. - - - -#include "libavformat/avformat.h" -#include "libavcodec/avcodec.h" -#include "qtprivate.h" - -#include - -typedef struct -{ -#define FIELDS 2 -// Encoding - AVCodec *encoder[FIELDS]; - AVCodecContext *encoder_context[FIELDS]; - - -// Decoding - AVCodec *decoder[FIELDS]; - AVCodecContext *decoder_context[FIELDS]; - AVFrame picture[FIELDS]; - -// Last frame decoded - int64_t last_frame[FIELDS]; -// Rounded dimensions - int width_i; - int height_i; -// Original dimensions - int width; - int height; - int fields; - - -// Temporary storage for color conversions - char *temp_frame; -// Storage of compressed data - unsigned char *work_buffer; -// Allocation of work_buffer - int buffer_size; - int ffmpeg_id; -} quicktime_ffmpeg_t; - -extern int ffmpeg_initialized; -extern pthread_mutex_t ffmpeg_lock; - - -quicktime_ffmpeg_t *quicktime_new_ffmpeg(int cpus, - int fields,int ffmpeg_id, int w,int h, - quicktime_stsd_table_t *stsd_table); // FFmpeg needs this for the header -void quicktime_delete_ffmpeg(quicktime_ffmpeg_t *ptr); -int quicktime_ffmpeg_decode(quicktime_ffmpeg_t *ffmpeg, - quicktime_t *file, unsigned char **row_pointers, int track); - -int quicktime_decode_audio3( - AVCodecContext *avctx, int16_t *samples, - int *frame_size_ptr, AVPacket *avpkt); - - -#endif - diff --git a/cinelerra-5.0/quicktime/qth264.c b/cinelerra-5.0/quicktime/qth264.c deleted file mode 100644 index c9a7428e..00000000 --- a/cinelerra-5.0/quicktime/qth264.c +++ /dev/null @@ -1,393 +0,0 @@ -#include "libavcodec/avcodec.h" -#include "colormodels.h" -#include "funcprotos.h" -#include "qtffmpeg.h" -#include "quicktime.h" -#include "workarounds.h" -#include "x264.h" - -#include - -// This generates our own header using fixed parameters -//#define MANUAL_HEADER - - -typedef struct -{ -// Encoder side - x264_t *encoder[FIELDS]; - x264_picture_t *pic[FIELDS]; - x264_param_t param; - - int encode_initialized[FIELDS]; - -// Temporary storage for color conversions - char *temp_frame; -// Storage of compressed data - unsigned char *work_buffer; -// Amount of data in work_buffer - int buffer_size; - int total_fields; -// Set by flush - int flushing; - -// Decoder side - quicktime_ffmpeg_t *decoder; - -} quicktime_h264_codec_t; - -static pthread_mutex_t h264_lock = PTHREAD_MUTEX_INITIALIZER; - - -// Direct copy routines -int quicktime_h264_is_key(unsigned char *data, long size, char *codec_id) -{ - return 0; -} - - -static void delete_codec(quicktime_video_map_t *vtrack) -{ - int i; - quicktime_h264_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv; - - for(i = 0; i < codec->total_fields; i++) { - if( !codec->encode_initialized[i]) continue; - pthread_mutex_lock(&h264_lock); - if(codec->pic[i]) { - x264_picture_clean(codec->pic[i]); - free(codec->pic[i]); - } - if(codec->encoder[i]) { - x264_encoder_close(codec->encoder[i]); - } - pthread_mutex_unlock(&h264_lock); - } - - if(codec->temp_frame) free(codec->temp_frame); - if(codec->work_buffer) free(codec->work_buffer); - if(codec->decoder) quicktime_delete_ffmpeg(codec->decoder); - free(codec); -} - - - -static int encode(quicktime_t *file, unsigned char **row_pointers, int track) -{ -// int64_t offset = quicktime_position(file); - quicktime_video_map_t *vtrack = &(file->vtracks[track]); - quicktime_h264_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv; - quicktime_trak_t *trak = vtrack->track; - int width = quicktime_video_width(file, track); - int height = quicktime_video_height(file, track); - int w_2 = quicktime_quantize2(width); -// ffmpeg interprets the codec height as the presentation height - int h_2 = quicktime_quantize2(height); - int i; - int result = -1; - int is_keyframe = 0; - int frame_number = vtrack->current_position / codec->total_fields; - int current_field = vtrack->current_position % codec->total_fields; - quicktime_atom_t chunk_atom; - unsigned char header[1024]; - int header_size = 0; - int got_pps = 0; - int got_sps = 0; - quicktime_avcc_t *avcc = &trak->mdia.minf.stbl.stsd.table[0].avcc; - - pthread_mutex_lock(&h264_lock); - - if(!codec->encode_initialized[current_field]) - { - codec->encode_initialized[current_field] = 1; - codec->param.i_width = w_2; - codec->param.i_height = h_2; - codec->param.i_fps_num = quicktime_frame_rate_n(file, track); - codec->param.i_fps_den = quicktime_frame_rate_d(file, track); - -// Reset quantizer if fixed bitrate - x264_param_t default_params; - x264_param_default(&default_params); - if(codec->param.rc.i_qp_constant) - { - codec->param.rc.i_qp_constant = default_params.rc.i_qp_constant; - codec->param.rc.i_qp_min = default_params.rc.i_qp_min; - codec->param.rc.i_qp_max = default_params.rc.i_qp_max; - } - - if(file->cpus > 1) - { - codec->param.i_threads = file->cpus; - } - - codec->encoder[current_field] = x264_encoder_open(&codec->param); - codec->pic[current_field] = calloc(1, sizeof(x264_picture_t)); - x264_picture_init(codec->pic[current_field]); -//printf("encode 1 %d %d\n", codec->param.i_width, codec->param.i_height); - x264_picture_alloc(codec->pic[current_field], X264_CSP_I420, - codec->param.i_width, codec->param.i_height); - } - - x264_picture_t *pic = codec->pic[current_field]; - pic->i_type = X264_TYPE_AUTO; - pic->i_qpplus1 = X264_QP_AUTO; - pic->i_pts = frame_number; - - codec->buffer_size = 0; - int allocation = w_2 * h_2 * 3 + 100; - if( !codec->work_buffer ) { - codec->work_buffer = calloc(1, allocation); - } - - x264_picture_t pic_out; - x264_nal_t *nals; - int nnal = 0; - x264_t *h = codec->encoder[current_field]; - - if( !codec->flushing ) { - if( !row_pointers ) { - bzero(pic->img.plane[0], w_2 * h_2); - bzero(pic->img.plane[1], w_2 * h_2 / 4); - bzero(pic->img.plane[2], w_2 * h_2 / 4); - } - else if( file->color_model == BC_YUV420P ) { - memcpy(pic->img.plane[0], row_pointers[0], w_2 * h_2); - memcpy(pic->img.plane[1], row_pointers[1], w_2 * h_2 / 4); - memcpy(pic->img.plane[2], row_pointers[2], w_2 * h_2 / 4); - } - else { -//printf("encode 2 %p %p %p\n", pic->img.plane[0], pic->img.plane[1], pic->img.plane[2]); - cmodel_transfer(0, row_pointers, - pic->img.plane[0], pic->img.plane[1], pic->img.plane[2], - row_pointers[0], row_pointers[1], row_pointers[2], - 0, 0, width, height, 0, 0, width, height, - file->color_model, BC_YUV420P, - 0, width, pic->img.i_stride[0]); - } - - result = x264_encoder_encode(h, &nals, &nnal, pic, &pic_out); - if( result < 0 ) - printf("frame_num %d: nals=%d, ret=%d\n", frame_number, nnal, result); - } - else if( x264_encoder_delayed_frames(h) > 0 ) { - result = x264_encoder_encode(h, &nals, &nnal, 0, &pic_out); - if( result < 0 ) - printf("flushing %d: nals=%d, ret=%d\n", frame_number, nnal, result); - } -//printf("encode %d nnal=%d\n", __LINE__, nnal); - - for( i = 0; i < nnal; ++i ) { - int size = nals[i].i_payload; -//printf("encode %d size=%d\n", __LINE__, size); - if(size + codec->buffer_size > allocation) { - printf("qth264.c %d: overflow size=%d allocation=%d\n", - __LINE__, size, allocation); - break; - } - unsigned char *ptr = codec->work_buffer + codec->buffer_size; - memcpy(ptr, nals[i].p_payload, size); - codec->buffer_size += size; - if( avcc->data_size ) continue; -// Snoop NAL for avc - ptr += 4; size -= 4; -// Synthesize header. -// Hopefully all the parameter set NAL's are present in the first frame. - if( !header_size ) { - header[header_size++] = 0x01; - header[header_size++] = 0x4d; - header[header_size++] = 0x40; - header[header_size++] = 0x1f; - header[header_size++] = 0xff; - header[header_size++] = 0xe1; - } - - int nal_type = (*ptr & 0x1f); -// Picture parameter or sequence parameter set - switch( nal_type ) { - case 0x07: - if( got_sps ) continue; - got_sps = 1; - break; - case 0x08: - if( got_pps ) continue; - got_pps = 1; - header[header_size++] = 0x1; // Number of sps nal's. - break; - default: - continue; - } - - header[header_size++] = size >> 8; - header[header_size++] = size; - memcpy(&header[header_size], ptr, size); - header_size += size; - if( !got_sps || !got_pps ) continue; -// printf("encode %d\n", __LINE__); -// { int j; for(j = 0; j < header_size; j++) printf("%02x ", header[j]); } -// printf("\n"); -// Write header - quicktime_set_avcc_header(avcc, header, header_size); - } - - pthread_mutex_unlock(&h264_lock); - - if( codec->buffer_size > 0 ) { - if(pic_out.i_type == X264_TYPE_IDR || - pic_out.i_type == X264_TYPE_I) { - is_keyframe = 1; - } - - quicktime_write_chunk_header(file, trak, &chunk_atom); - result = !quicktime_write_data(file, - (char*)codec->work_buffer, - codec->buffer_size); - quicktime_write_chunk_footer(file, trak, - vtrack->current_chunk, &chunk_atom, 1); - - if(is_keyframe) { - quicktime_insert_keyframe(file, - vtrack->current_position, - track); - } - - vtrack->current_chunk++; - } - return result >= 0 ? 0 : -1; -} - - - - -static int decode(quicktime_t *file, unsigned char **row_pointers, int track) -{ - quicktime_video_map_t *vtrack = &(file->vtracks[track]); - quicktime_trak_t *trak = vtrack->track; - quicktime_h264_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv; - quicktime_stsd_table_t *stsd_table = &trak->mdia.minf.stbl.stsd.table[0]; - int width = trak->tkhd.track_width; - int height = trak->tkhd.track_height; - - if(!codec->decoder) - codec->decoder = quicktime_new_ffmpeg(file->cpus, - codec->total_fields, CODEC_ID_H264, width, height, stsd_table); - return !codec->decoder ? 1 : - quicktime_ffmpeg_decode(codec->decoder, file, row_pointers, track); -} - -static void flush(quicktime_t *file, int track) -{ - quicktime_video_map_t *vtrack = &(file->vtracks[track]); - quicktime_trak_t *trak = vtrack->track; - quicktime_h264_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv; -// trak->mdia.minf.stbl.stsd.table[0].version = 1; -// trak->mdia.minf.stbl.stsd.table[0].revision = 1; - quicktime_avcc_t *avcc = &trak->mdia.minf.stbl.stsd.table[0].avcc; - if( !avcc->data_size ) - encode(file, 0, track); - codec->flushing = 1; - while( !encode(file, 0, track) ); -} - - - -static int reads_colormodel(quicktime_t *file, - int colormodel, - int track) -{ - return (colormodel == BC_YUV420P); -} - -static int writes_colormodel(quicktime_t *file, - int colormodel, - int track) -{ - return (colormodel == BC_YUV420P); -} - -static int set_parameter(quicktime_t *file, - int track, - char *key, - void *value) -{ - quicktime_video_map_t *vtrack = &(file->vtracks[track]); - char *compressor = quicktime_compressor(vtrack->track); - - if(quicktime_match_32(compressor, QUICKTIME_H264) || - quicktime_match_32(compressor, QUICKTIME_HV64)) - { - quicktime_h264_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv; - if(!strcasecmp(key, "h264_bitrate")) - { - if(quicktime_match_32(compressor, QUICKTIME_H264)) - codec->param.rc.i_bitrate = *(int*)value; - else - codec->param.rc.i_bitrate = *(int*)value / 2; - } - else - if(!strcasecmp(key, "h264_quantizer")) - { - codec->param.rc.i_qp_constant = - codec->param.rc.i_qp_min = - codec->param.rc.i_qp_max = *(int*)value; - } - else - if(!strcasecmp(key, "h264_fix_bitrate")) - { - codec->param.rc.i_qp_constant = (*(int*)value) / 1000; - } - } - return 0; -} - -static quicktime_h264_codec_t* init_common(quicktime_video_map_t *vtrack, - char *compressor, - char *title, - char *description) -{ - quicktime_codec_t *codec_base = (quicktime_codec_t*)vtrack->codec; - quicktime_h264_codec_t *codec; - - codec_base->priv = calloc(1, sizeof(quicktime_h264_codec_t)); - codec_base->delete_vcodec = delete_codec; - codec_base->decode_video = decode; - codec_base->encode_video = encode; - codec_base->flush = flush; - codec_base->reads_colormodel = reads_colormodel; - codec_base->writes_colormodel = writes_colormodel; - codec_base->set_parameter = set_parameter; - codec_base->fourcc = compressor; - codec_base->title = title; - codec_base->desc = description; - - - codec = (quicktime_h264_codec_t*)codec_base->priv; - x264_param_default(&codec->param); - codec->param.rc.i_rc_method = X264_RC_CQP; -// codec->param.i_log_level = 99; - return codec; -} - - -void quicktime_init_codec_h264(quicktime_video_map_t *vtrack) -{ - quicktime_h264_codec_t *result = init_common(vtrack, - QUICKTIME_H264, - "H.264", - "H.264"); - result->total_fields = 1; -} - - -// field based H.264 -void quicktime_init_codec_hv64(quicktime_video_map_t *vtrack) -{ - quicktime_h264_codec_t *result = init_common(vtrack, - QUICKTIME_HV64, - "Dual H.264", - "H.264 with two streams alternating every other frame. (Not standardized)"); - result->total_fields = 2; -} - - - - diff --git a/cinelerra-5.0/quicktime/qth264.h b/cinelerra-5.0/quicktime/qth264.h deleted file mode 100644 index 1cc01190..00000000 --- a/cinelerra-5.0/quicktime/qth264.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef QTH264_H -#define QTH264_H - - - -void quicktime_init_codec_h264(quicktime_video_map_t *vtrack); -void quicktime_init_codec_hv64(quicktime_video_map_t *vtrack); - - - - - -#endif diff --git a/cinelerra-5.0/quicktime/qtinfo.c b/cinelerra-5.0/quicktime/qtinfo.c deleted file mode 100644 index efd02e46..00000000 --- a/cinelerra-5.0/quicktime/qtinfo.c +++ /dev/null @@ -1,64 +0,0 @@ -/* Qtinfo by Elliot Lee */ - -#include "quicktime.h" - -static void file_info(char *filename); - -int main(int argc, char *argv[]) -{ - int i; - - if(argc < 2) { - printf("Usage: %s filename...\n", argv[0]); - return 1; - } - - for(i = 1; i < argc; i++) { - file_info(argv[i]); - } - - return 0; -} - -static void -file_info(char *filename) -{ - quicktime_t* qtfile; - int i, n; - - qtfile = quicktime_open(filename, 1, 0); - - if(!qtfile) { - printf("Couldn't open %s as a QuickTime file.\n", filename); - return; - } - - printf("\nFile %s:\n", filename); - n = quicktime_audio_tracks(qtfile); - printf(" %d audio tracks.\n", n); - for(i = 0; i < n; i++) { - - printf(" %d channels. %d bits. sample rate %ld. length %ld. compressor %s.\n", - quicktime_track_channels(qtfile, i), - quicktime_audio_bits(qtfile, i), - quicktime_sample_rate(qtfile, i), - quicktime_audio_length(qtfile, i), - quicktime_audio_compressor(qtfile, i)); - printf(" %ssupported.\n", - quicktime_supported_audio(qtfile, i)?"":"NOT "); - } - - n = quicktime_video_tracks(qtfile); - printf(" %d video tracks.\n", n); - for(i = 0; i < n; i++) { - printf(" %dx%d rate %f length %ld compressor %s.\n", - quicktime_video_width(qtfile, i), - quicktime_video_height(qtfile, i), - quicktime_frame_rate(qtfile, i), - quicktime_video_length(qtfile, i), - quicktime_video_compressor(qtfile, i)); - printf(" %ssupported.\n", - quicktime_supported_video(qtfile, i)?"":"NOT "); - } -} - diff --git a/cinelerra-5.0/quicktime/qtmp3.c b/cinelerra-5.0/quicktime/qtmp3.c deleted file mode 100644 index 042afa95..00000000 --- a/cinelerra-5.0/quicktime/qtmp3.c +++ /dev/null @@ -1,369 +0,0 @@ -#include "funcprotos.h" -#include "lame.h" -#include "libzmpeg3.h" -#include "quicktime.h" -#include "qtmp3.h" -#include - -#ifndef MAX -#define MAX(a, b) ((a) > (b) ? (a) : (b)) -#endif - -#ifndef MIN -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#endif - -#define CLAMP(x, y, z) ((x) = ((x) < (y) ? (y) : ((x) > (z) ? (z) : (x)))) - -#define OUTPUT_ALLOCATION 0x100000 - -//static FILE *test = 0; - -typedef struct -{ -// mp3 decoder - mpeg3_layer_t *mp3; -// Number of first sample in output relative to file - int64_t output_position; -// Current reading position in file - int64_t chunk; - int decode_initialized; - float **output; - -// mp3 encoder - lame_global_flags *lame_global; -// This calculates the number of samples per chunk - mpeg3_layer_t *encoded_header; - int encode_initialized; - float **input; - int input_size; - int input_allocated; - int bitrate; - unsigned char *encoder_output; - int encoder_output_size; - int encoder_output_allocated; -} quicktime_mp3_codec_t; - -static void delete_codec(quicktime_audio_map_t *atrack) -{ - int i; - quicktime_mp3_codec_t *codec = ((quicktime_codec_t*)atrack->codec)->priv; - - if( codec->mp3 ) mpeg3_delete_layer(codec->mp3); - if( codec->output ) { - for( i=0; ichannels; ++i ) free(codec->output[i]); - free(codec->output); - } - if( codec->lame_global ) - lame_close(codec->lame_global); - if( codec->input ) { - for( i=0; ichannels; ++i ) free(codec->input[i]); - free(codec->input); - } - if( codec->encoder_output ) free(codec->encoder_output); - if( codec->encoded_header ) - mpeg3_delete_layer(codec->encoded_header); - free(codec); -} - -static int decode(quicktime_t *file, - int16_t *output_i, float *output_f, - long samples, int track, int channel) -{ - quicktime_audio_map_t *track_map = &(file->atracks[track]); - quicktime_vbr_t *vbr = &track_map->vbr; - int channels = track_map->channels; - quicktime_mp3_codec_t *codec = ((quicktime_codec_t*)track_map->codec)->priv; - int64_t current_position = track_map->current_position; - int64_t end_position = current_position + samples; - int i, retry = 0, result = 0; - - if(output_i) bzero(output_i, sizeof(int16_t) * samples); - if(output_f) bzero(output_f, sizeof(float) * samples); - - if( quicktime_limit_samples(samples) ) return 1; - -// Initialize and load initial buffer for decoding - if( !codec->decode_initialized ) { - codec->decode_initialized = 1; - quicktime_init_vbr(vbr, channels); - codec->output = malloc(sizeof(float*) * track_map->channels); - for(i = 0; i < track_map->channels; i++) - codec->output[i] = malloc(sizeof(float) * MAXFRAMESAMPLES); - codec->mp3 = mpeg3_new_layer(); - } - - if( quicktime_align_vbr(track_map, current_position) || - codec->output_position != quicktime_vbr_output_end(vbr) ) { - quicktime_seek_vbr(track_map, current_position, 1); - mpeg3_layer_reset(codec->mp3); - codec->output_position = quicktime_vbr_output_end(vbr); - } - - retry = 64; - while( quicktime_vbr_output_end(vbr) < end_position && retry >= 0 ) { -// find a frame header - int bfr_sz = quicktime_vbr_input_size(vbr); - unsigned char *bfr = quicktime_vbr_input(vbr); - int frame_size = 0; - while( bfr_sz >= 4 ) { - frame_size = mpeg3_layer_header(codec->mp3, bfr); - if( frame_size ) break; - ++bfr; --bfr_sz; - } - if( !frame_size ) { - if( quicktime_read_vbr(file, track_map) ) break; - --retry; continue; - } - -// shift out data before frame header - i = bfr - quicktime_vbr_input(vbr); - if( i > 0 ) quicktime_shift_vbr(track_map, i); - -// collect frame data - while( quicktime_vbr_input_size(vbr) < frame_size && retry >= 0 ) { - if( quicktime_read_vbr(file, track_map) ) break; - --retry; - } - if( retry < 0 ) break; - if( quicktime_vbr_input_size(vbr) < frame_size ) break; - -// decode frame - result = mpeg3audio_dolayer3(codec->mp3, - (char *)quicktime_vbr_input(vbr), frame_size, - codec->output, 1); - if( result > 0 ) { - quicktime_store_vbr_floatp(track_map, codec->output, result); - codec->output_position += result; - retry = 64; - } - quicktime_shift_vbr(track_map, frame_size); - } - - if(output_i) - quicktime_copy_vbr_int16(vbr, current_position, - samples, output_i, channel); - if(output_f) - quicktime_copy_vbr_float(vbr, current_position, - samples, output_f, channel); - return 0; -} - - - - -static int allocate_output(quicktime_mp3_codec_t *codec, - int samples) -{ - int new_size = codec->encoder_output_size + samples * 4; - if(codec->encoder_output_allocated < new_size) - { - unsigned char *new_output = calloc(1, new_size); - - if(codec->encoder_output) - { - memcpy(new_output, - codec->encoder_output, - codec->encoder_output_size); - free(codec->encoder_output); - } - codec->encoder_output = new_output; - codec->encoder_output_allocated = new_size; - } - return 0; -} - - - -// Empty the output buffer of frames -static int write_frames(quicktime_t *file, - quicktime_audio_map_t *track_map, - quicktime_trak_t *trak, - quicktime_mp3_codec_t *codec, - int track) -{ - int frame_end = codec->encoder_output_size; - unsigned char *bfr = codec->encoder_output; - int frame_limit = frame_end - 4; - int frame_samples; - int result = 0; - int i = 0; - -// Write to chunks - while( !result && i < frame_limit ) { - char *hdr = (char *)bfr + i; - int frame_size = mpeg3_layer_header(codec->encoded_header, - (unsigned char *)hdr); -// Not the start of a frame. Skip it, try next bfr byte; - if( !frame_size ) { ++i; continue; } -// Frame is finished before end of buffer - if( i+frame_size > frame_end ) break; - i += frame_size; -// Write the chunk - frame_samples = mpeg3audio_dolayer3(codec->encoded_header, - hdr, frame_size, 0, 0); -// Frame is a dud - if( !frame_samples ) continue; - result = quicktime_write_vbr_frame(file, track, - hdr, frame_size, frame_samples); - track_map->current_chunk++; - } - -// move any frame fragment down - if( i > 0 ) { - int j = 0; - codec->encoder_output_size -= i; - while( i < frame_end ) bfr[j++] = bfr[i++]; - } - - return result; -} - - - - - - -static int encode(quicktime_t *file, - int16_t **input_i, float **input_f, int track, long samples) -{ - int result = 0; - quicktime_audio_map_t *track_map = &(file->atracks[track]); - quicktime_trak_t *trak = track_map->track; - quicktime_mp3_codec_t *codec = ((quicktime_codec_t*)track_map->codec)->priv; - int new_size = codec->input_size + samples; - int i, j; - - if(!codec->encode_initialized) - { - codec->encode_initialized = 1; - codec->lame_global = lame_init(); - lame_set_brate(codec->lame_global, codec->bitrate / 1000); - lame_set_quality(codec->lame_global, 0); - lame_set_in_samplerate(codec->lame_global, - trak->mdia.minf.stbl.stsd.table[0].sample_rate); - if((result = lame_init_params(codec->lame_global)) < 0) - printf("encode: lame_init_params returned %d\n", result); - codec->encoded_header = mpeg3_new_layer(); - if(file->use_avi) - trak->mdia.minf.stbl.stsd.table[0].sample_size = 0; - } - - -// Stack input on end of buffer - if(new_size > codec->input_allocated) - { - float *new_input; - - if(!codec->input) - codec->input = calloc(sizeof(float*), track_map->channels); - - for(i = 0; i < track_map->channels; i++) - { - new_input = calloc(sizeof(float), new_size); - if(codec->input[i]) - { - memcpy(new_input, codec->input[i], sizeof(float) * codec->input_size); - free(codec->input[i]); - } - codec->input[i] = new_input; - } - codec->input_allocated = new_size; - } - - -// Transfer to input buffers - if(input_i) - { - for(i = 0; i < track_map->channels; i++) - { - for(j = 0; j < samples; j++) - codec->input[i][j] = input_i[i][j]; - } - } - else - if(input_f) - { - for(i = 0; i < track_map->channels; i++) - { - for(j = 0; j < samples; j++) - codec->input[i][j] = input_f[i][j] * 32767; - } - } - -// Encode - allocate_output(codec, samples); - - result = lame_encode_buffer_float(codec->lame_global, - codec->input[0], - (track_map->channels > 1) ? codec->input[1] : codec->input[0], - samples, - codec->encoder_output + codec->encoder_output_size, - codec->encoder_output_allocated - codec->encoder_output_size); - - codec->encoder_output_size += result; - - result = write_frames(file, track_map, trak, codec, track); - return result; -} - - - -static int set_parameter(quicktime_t *file, - int track, - char *key, - void *value) -{ - quicktime_audio_map_t *atrack = &(file->atracks[track]); - quicktime_mp3_codec_t *codec = ((quicktime_codec_t*)atrack->codec)->priv; - - if(!strcasecmp(key, "mp3_bitrate")) - codec->bitrate = *(int*)value; - - return 0; -} - - - -static void flush(quicktime_t *file, int track) -{ - int result = 0; - quicktime_audio_map_t *track_map = &(file->atracks[track]); - quicktime_trak_t *trak = track_map->track; - quicktime_mp3_codec_t *codec = ((quicktime_codec_t*)track_map->codec)->priv; - - if(codec->encode_initialized) - { - result = lame_encode_flush(codec->lame_global, - codec->encoder_output + codec->encoder_output_size, - codec->encoder_output_allocated - codec->encoder_output_size); - codec->encoder_output_size += result; - result = write_frames(file, track_map, trak, codec, track); - } -} - - -void quicktime_init_codec_mp3(quicktime_audio_map_t *atrack) -{ - quicktime_codec_t *codec_base = (quicktime_codec_t*)atrack->codec; - quicktime_mp3_codec_t *codec; - -/* Init public items */ - codec_base->priv = calloc(1, sizeof(quicktime_mp3_codec_t)); - codec_base->delete_acodec = delete_codec; - codec_base->decode_audio = decode; - codec_base->encode_audio = encode; - codec_base->set_parameter = set_parameter; - codec_base->flush = flush; - codec_base->fourcc = QUICKTIME_MP3; - codec_base->title = "MP3"; - codec_base->desc = "MP3 for video"; - codec_base->wav_id = 0x55; - - codec = codec_base->priv; - codec->bitrate = 256000; -} - - - - diff --git a/cinelerra-5.0/quicktime/qtmp3.h b/cinelerra-5.0/quicktime/qtmp3.h deleted file mode 100644 index 2c7f7034..00000000 --- a/cinelerra-5.0/quicktime/qtmp3.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef QTMP3_H -#define QTMP3_H - - - - - -void quicktime_init_codec_mp3(quicktime_audio_map_t *atrack); - - - - - -#endif diff --git a/cinelerra-5.0/quicktime/qtpng.c b/cinelerra-5.0/quicktime/qtpng.c deleted file mode 100644 index f70cf8b7..00000000 --- a/cinelerra-5.0/quicktime/qtpng.c +++ /dev/null @@ -1,270 +0,0 @@ -#include "colormodels.h" -#include "funcprotos.h" -#include -#include -#include "quicktime.h" -#include "qtpng.h" - -typedef struct -{ - int compression_level; - unsigned char *buffer; -// Read position - long buffer_position; -// Frame size - long buffer_size; -// Buffer allocation - long buffer_allocated; - int quality; - unsigned char *temp_frame; -} quicktime_png_codec_t; - -static void delete_codec(quicktime_video_map_t *vtrack) -{ - quicktime_png_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv; - if(codec->buffer) free(codec->buffer); - if(codec->temp_frame) free(codec->temp_frame); - free(codec); -} - -static int source_cmodel(quicktime_t *file, int track) -{ - int depth = quicktime_video_depth(file, track); - if(depth == 24) - return BC_RGB888; - else - return BC_RGBA8888; -} - -void quicktime_set_png(quicktime_t *file, int compression_level) -{ - int i; - - for(i = 0; i < file->total_vtracks; i++) - { - if(quicktime_match_32(quicktime_video_compressor(file, i), QUICKTIME_PNG)) - { - quicktime_png_codec_t *codec = ((quicktime_codec_t*)file->vtracks[i].codec)->priv; - codec->compression_level = compression_level; - } - } -} - -static void read_function(png_structp png_ptr, png_bytep data, png_uint_32 length) -{ - quicktime_png_codec_t *codec = png_get_io_ptr(png_ptr); - - if(length + codec->buffer_position <= codec->buffer_size) - { - memcpy(data, codec->buffer + codec->buffer_position, length); - codec->buffer_position += length; - } -} - -static void write_function(png_structp png_ptr, png_bytep data, png_uint_32 length) -{ - quicktime_png_codec_t *codec = png_get_io_ptr(png_ptr); - - if(length + codec->buffer_size > codec->buffer_allocated) - { - codec->buffer_allocated += length; - codec->buffer = realloc(codec->buffer, codec->buffer_allocated); - } - memcpy(codec->buffer + codec->buffer_size, data, length); - codec->buffer_size += length; -} - -static void flush_function(png_structp png_ptr) -{ - ; -} - -static int decode(quicktime_t *file, unsigned char **row_pointers, int track) -{ - int result = 0; - int64_t i; - quicktime_video_map_t *vtrack = &(file->vtracks[track]); - quicktime_trak_t *trak = vtrack->track; - png_structp png_ptr; - png_infop info_ptr; - png_infop end_info = 0; - int height = trak->tkhd.track_height; - int width = trak->tkhd.track_width; - quicktime_png_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv; - int cmodel = source_cmodel(file, track); - int use_temp = (cmodel != file->color_model || - file->in_x != 0 || - file->in_y != 0 || - file->in_w != width || - file->in_h != height || - file->out_w != width || - file->out_h != height); - unsigned char **temp_rows = malloc(sizeof(unsigned char*) * height); - - if(use_temp) - { - if(!codec->temp_frame) - { - codec->temp_frame = malloc(cmodel_calculate_datasize(width, - height, - -1, - cmodel)); - } - for(i = 0; i < height; i++) - temp_rows[i] = codec->temp_frame + - cmodel_calculate_pixelsize(cmodel) * width * i; - } - else - { - for(i = 0; i < height; i++) - temp_rows[i] = row_pointers[i]; - } - - quicktime_set_video_position(file, vtrack->current_position, track); - codec->buffer_size = quicktime_frame_size(file, vtrack->current_position, track); - codec->buffer_position = 0; - if(codec->buffer_size > codec->buffer_allocated) - { - codec->buffer_allocated = codec->buffer_size; - codec->buffer = realloc(codec->buffer, codec->buffer_allocated); - } - - result = !quicktime_read_data(file, (char*)codec->buffer, codec->buffer_size); - - if(!result) - { - png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0); - info_ptr = png_create_info_struct(png_ptr); - png_set_read_fn(png_ptr, codec, (png_rw_ptr)read_function); - png_read_info(png_ptr, info_ptr); - -/* read the image */ - png_read_image(png_ptr, temp_rows); - png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); - } - - if(use_temp) - { - cmodel_transfer(row_pointers, - temp_rows, - row_pointers[0], - row_pointers[1], - row_pointers[2], - 0, - 0, - 0, - file->in_x, - file->in_y, - file->in_w, - file->in_h, - 0, - 0, - file->out_w, - file->out_h, - cmodel, - file->color_model, - 0, - width, - file->out_w); - } - - - free(temp_rows); - - return result; -} - - - - -static int encode(quicktime_t *file, unsigned char **row_pointers, int track) -{ - //int64_t offset = quicktime_position(file); - int result = 0; - quicktime_video_map_t *vtrack = &(file->vtracks[track]); - quicktime_trak_t *trak = vtrack->track; - quicktime_png_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv; - int height = trak->tkhd.track_height; - int width = trak->tkhd.track_width; - png_structp png_ptr; - png_infop info_ptr; - int cmodel = source_cmodel(file, track); - quicktime_atom_t chunk_atom; - - codec->buffer_size = 0; - codec->buffer_position = 0; - - png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0); - info_ptr = png_create_info_struct(png_ptr); - png_set_write_fn(png_ptr, - codec, - (png_rw_ptr)write_function, - (png_flush_ptr)flush_function); - png_set_compression_level(png_ptr, codec->compression_level); - png_set_IHDR(png_ptr, - info_ptr, - width, height, - 8, - cmodel == BC_RGB888 ? - PNG_COLOR_TYPE_RGB : - PNG_COLOR_TYPE_RGB_ALPHA, - PNG_INTERLACE_NONE, - PNG_COMPRESSION_TYPE_DEFAULT, - PNG_FILTER_TYPE_DEFAULT); - png_write_info(png_ptr, info_ptr); - png_write_image(png_ptr, row_pointers); - png_write_end(png_ptr, info_ptr); - png_destroy_write_struct(&png_ptr, &info_ptr); - - quicktime_write_chunk_header(file, trak, &chunk_atom); - result = !quicktime_write_data(file, (char*) codec->buffer, codec->buffer_size); - quicktime_write_chunk_footer(file, trak, vtrack->current_chunk, &chunk_atom, 1); - - vtrack->current_chunk++; - return result; -} - -static int set_parameter(quicktime_t *file, - int track, - char *key, - void *value) -{ - quicktime_video_map_t *vtrack = &(file->vtracks[track]); - quicktime_codec_t *codec_base = (quicktime_codec_t*)vtrack->codec; - quicktime_png_codec_t *codec = codec_base->priv; - - if(!strcasecmp(key, "compression_level")) - codec->compression_level = *(int*)value; - return 0; -} - -static int reads_colormodel(quicktime_t *file, - int colormodel, - int track) -{ - return (colormodel == BC_RGB888 || - colormodel == BC_BGR8888); -} - -void quicktime_init_codec_png(quicktime_video_map_t *vtrack) -{ - quicktime_codec_t *codec_base = (quicktime_codec_t*)vtrack->codec; - quicktime_png_codec_t *codec; - -/* Init public items */ - codec_base->priv = calloc(1, sizeof(quicktime_png_codec_t)); - codec_base->delete_vcodec = delete_codec; - codec_base->decode_video = decode; - codec_base->encode_video = encode; - codec_base->decode_audio = 0; - codec_base->encode_audio = 0; - codec_base->reads_colormodel = reads_colormodel; - codec_base->set_parameter = set_parameter; - codec_base->fourcc = QUICKTIME_PNG; - codec_base->title = "PNG"; - codec_base->desc = "Lossless RGB compression"; - -/* Init private items */ - codec = codec_base->priv; - codec->compression_level = 9; -} diff --git a/cinelerra-5.0/quicktime/qtpng.h b/cinelerra-5.0/quicktime/qtpng.h deleted file mode 100644 index d9c45694..00000000 --- a/cinelerra-5.0/quicktime/qtpng.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef QUICKTIME_PNG_H -#define QUICKTIME_PNG_H - - -extern void quicktime_init_codec_png(quicktime_video_map_t *); - -#endif diff --git a/cinelerra-5.0/quicktime/qtprivate.h b/cinelerra-5.0/quicktime/qtprivate.h deleted file mode 100755 index 3a3807ef..00000000 --- a/cinelerra-5.0/quicktime/qtprivate.h +++ /dev/null @@ -1,866 +0,0 @@ -#ifndef PRIVATE_H -#define PRIVATE_H - -/* ================================= structures */ - -/* Version used internally. You need to query it with the C functions */ -#define QUICKTIME_MAJOR 2 -#define QUICKTIME_MINOR 3 -#define QUICKTIME_RELEASE 0 - - -#define HEADER_LENGTH 8 -#define MAXTRACKS 1024 - -/* Crazy Mich R. Soft constants */ -#define AVI_HASINDEX 0x00000010 // Index at end of file? -#define AVI_MUSTUSEINDEX 0x00000020 -#define AVI_ISINTERLEAVED 0x00000100 -#define AVI_TRUSTCKTYPE 0x00000800 // Use CKType to find key frames? -#define AVI_WASCAPTUREFILE 0x00010000 -#define AVI_COPYRIGHTED 0x00020000 -#define AVIF_WASCAPTUREFILE 0x00010000 -#define AVI_KEYFRAME 0x10 -#define AVI_INDEX_OF_CHUNKS 0x01 -#define AVI_INDEX_OF_INDEXES 0x00 - -#define AVI_FRAME_RATE_BASE 10000 -#define MAX_RIFFS 0x100 - -#define QT_TRACE printf("%s: %d\n", __FILE__, __LINE__); - -#include -#include -#include - - - - -#define FTELL ftello64 -#define FSEEK fseeko64 - - -// ffmpeg requires global variable initialization -// These are defined in mpeg4.c -extern int ffmpeg_initialized; -extern pthread_mutex_t ffmpeg_lock; - - - -// Utility functions for vbr audio. This is accessed through quicktime_audio_map_t. -typedef struct -{ -// End of the input/output buffer in the file in samples - int64_t input_end, output_end; -// Number of samples in input/output buffer before end - int input_size, output_size; -// Position in input/output buffer of buffer_end - int inp_ptr, out_ptr; -// Output buffer, linear for each channel. - double **output_buffer; -// Copy of channel count for deletion - int channels; -// Input buffer for temporary compressed data - int input_allocation; - unsigned char *input_buffer; -// Next sample/frame to read - int64_t sample; -} quicktime_vbr_t; - - - - - - - - - -typedef struct -{ -/* for AVI it's the end of the 8 byte header in the file */ -/* for Quicktime it's the start of the 8 byte header in the file */ - int64_t start; - int64_t end; /* byte endpoint in file */ - int64_t size; /* byte size for writing */ - int use_64; /* Use 64 bit header */ - unsigned char type[5]; -} quicktime_atom_t; - -typedef struct -{ - float values[9]; -} quicktime_matrix_t; - - -typedef struct -{ - int version; - long flags; - unsigned long creation_time; - unsigned long modification_time; - int track_id; - long reserved1; - long duration; - char reserved2[8]; - int layer; - int alternate_group; - float volume; - long reserved3; - quicktime_matrix_t matrix; - float track_width; - float track_height; -} quicktime_tkhd_t; - - -typedef struct -{ - long seed; - long flags; - long size; - short int *alpha; - short int *red; - short int *green; - short int *blue; -} quicktime_ctab_t; - - - -/* ===================== sample table ======================== // */ - - - -/* sample description */ - -typedef struct -{ - int motion_jpeg_quantization_table; -} quicktime_mjqt_t; - - -typedef struct -{ - int motion_jpeg_huffman_table; -} quicktime_mjht_t; - - -typedef struct -{ - char *mpeg4_header; - int mpeg4_header_size; -} quicktime_esds_t; - -typedef struct -{ - char *data; - int data_size; -} quicktime_avcc_t; - -typedef struct -{ - char *data; - int data_size; -} quicktime_frma_t; - -typedef struct -{ - char format[4]; - char reserved[6]; - int data_reference; - -/* common to audio and video */ - int version; - int revision; - char vendor[4]; - -/* video description */ - long temporal_quality; - long spatial_quality; - int width; - int height; - float dpi_horizontal; - float dpi_vertical; - int64_t data_size; - int frames_per_sample; - char compressor_name[32]; - int depth; - int ctab_id; - quicktime_ctab_t ctab; - float gamma; -/* 0, 1, or 2 */ - int fields; -/* 0 - unknown 1 - top first 2 - bottom first */ - int field_dominance; - quicktime_mjqt_t mjqt; - quicktime_mjht_t mjht; - -/* audio description */ - int channels; - int sample_size; - int compression_id; - int packet_size; - float sample_rate; - -/* Version 1 of audio description */ - int samples_per_packet; - int bytes_per_packet; - int bytes_per_frame; - int bytes_per_sample; - - quicktime_esds_t esds; - quicktime_avcc_t avcc; - - int extradata_size; - char *extradata; - - quicktime_frma_t frma; -} quicktime_stsd_table_t; - - -typedef struct -{ - int version; - long flags; - long total_entries; - quicktime_stsd_table_t *table; -} quicktime_stsd_t; - - -/* time to sample */ -typedef struct -{ - long sample_count; - long sample_duration; -} quicktime_stts_table_t; - -typedef struct -{ - int version; - long flags; - long total_entries; - int is_vbr; - quicktime_stts_table_t *table; -} quicktime_stts_t; - - -/* sync sample */ -typedef struct -{ - int64_t sample; -} quicktime_stss_table_t; - -typedef struct -{ - int version; - long flags; - long total_entries; - long entries_allocated; - quicktime_stss_table_t *table; -} quicktime_stss_t; - - -/* sample to chunk */ -typedef struct -{ - long chunk; - long samples; - long id; -} quicktime_stsc_table_t; - -typedef struct -{ - int version; - long flags; - long total_entries; - - long entries_allocated; - quicktime_stsc_table_t *table; -} quicktime_stsc_t; - - -/* sample size */ -typedef struct -{ - int64_t size; -} quicktime_stsz_table_t; - -typedef struct -{ - int version; - long flags; - int64_t sample_size; - long total_entries; - - long entries_allocated; /* used by the library for allocating a table */ - quicktime_stsz_table_t *table; -} quicktime_stsz_t; - - -/* chunk offset */ -typedef struct -{ - int64_t offset; -} quicktime_stco_table_t; - -typedef struct -{ - int version; - long flags; - long total_entries; - - long entries_allocated; /* used by the library for allocating a table */ - quicktime_stco_table_t *table; -} quicktime_stco_t; - - -/* sample table */ -typedef struct -{ - int version; - long flags; - quicktime_stsd_t stsd; - quicktime_stts_t stts; - quicktime_stss_t stss; - quicktime_stsc_t stsc; - quicktime_stsz_t stsz; - quicktime_stco_t stco; -} quicktime_stbl_t; - -/* data reference */ - -typedef struct -{ - int64_t size; - char type[4]; - int version; - long flags; - char *data_reference; -} quicktime_dref_table_t; - -typedef struct -{ - int version; - long flags; - long total_entries; - quicktime_dref_table_t *table; -} quicktime_dref_t; - -/* data information */ - -typedef struct -{ - quicktime_dref_t dref; -} quicktime_dinf_t; - -/* video media header */ - -typedef struct -{ - int version; - long flags; - int graphics_mode; - int opcolor[3]; -} quicktime_vmhd_t; - - -/* sound media header */ - -typedef struct -{ - int version; - long flags; - int balance; - int reserved; -} quicktime_smhd_t; - -/* handler reference */ - -typedef struct -{ - int version; - long flags; - char component_type[4]; - char component_subtype[4]; - long component_manufacturer; - long component_flags; - long component_flag_mask; - char component_name[256]; -} quicktime_hdlr_t; - -/* media information */ - -typedef struct -{ - int is_video; - int is_audio; - quicktime_vmhd_t vmhd; - quicktime_smhd_t smhd; - quicktime_stbl_t stbl; - quicktime_hdlr_t hdlr; - quicktime_dinf_t dinf; -} quicktime_minf_t; - - -/* media header */ - -typedef struct -{ - int version; - long flags; - unsigned long creation_time; - unsigned long modification_time; - long time_scale; - long duration; - int language; - int quality; -} quicktime_mdhd_t; - - -/* media */ - -typedef struct -{ - quicktime_mdhd_t mdhd; - quicktime_minf_t minf; - quicktime_hdlr_t hdlr; -} quicktime_mdia_t; - -/* edit list */ -typedef struct -{ - long duration; - long time; - float rate; -} quicktime_elst_table_t; - -typedef struct -{ - int version; - long flags; - long total_entries; - - quicktime_elst_table_t *table; -} quicktime_elst_t; - -typedef struct -{ - quicktime_elst_t elst; -} quicktime_edts_t; - - - - -typedef struct -{ - quicktime_tkhd_t tkhd; - quicktime_mdia_t mdia; - quicktime_edts_t edts; -} quicktime_trak_t; - - -typedef struct -{ - int version; - long flags; - unsigned long creation_time; - unsigned long modification_time; - long time_scale; - long duration; - float preferred_rate; - float preferred_volume; - char reserved[10]; - quicktime_matrix_t matrix; - long preview_time; - long preview_duration; - long poster_time; - long selection_time; - long selection_duration; - long current_time; - long next_track_id; -} quicktime_mvhd_t; - -typedef struct -{ - char *copyright; - int copyright_len; - char *name; - int name_len; - char *info; - int info_len; - char *require; - int require_len; - char *encoder; - int encoder_len; -} quicktime_udta_t; - - -typedef struct -{ - int total_tracks; - - quicktime_mvhd_t mvhd; - quicktime_trak_t *trak[MAXTRACKS]; - quicktime_udta_t udta; - quicktime_ctab_t ctab; -} quicktime_moov_t; - -typedef struct -{ - quicktime_atom_t atom; -} quicktime_mdat_t; - -typedef struct -{ -/* Offset of end of 8 byte chunk header relative to ix->base_offset */ - int relative_offset; -/* size of data without 8 byte header */ - int size; -} quicktime_ixtable_t; - -typedef struct -{ - quicktime_atom_t atom; - quicktime_ixtable_t *table; - int table_size; - int table_allocation; - int longs_per_entry; - int index_type; -/* ixtable relative_offset is relative to this */ - int64_t base_offset; -/* ix atom title */ - char tag[5]; -/* corresponding chunk id */ - char chunk_id[5]; -} quicktime_ix_t; - - -typedef struct -{ - quicktime_atom_t atom; - -/* Partial index */ -/* For writing only, there are multiple movi objects with multiple ix tables. */ -/* This is not used for reading. Instead an ix_t object in indx_t is used. */ - quicktime_ix_t *ix[MAXTRACKS]; -} quicktime_movi_t; - -typedef struct -{ -/* Start of start of corresponding ix## header */ - int64_t index_offset; -/* Size not including 8 byte header */ - int index_size; -/* duration in "ticks" */ - int duration; - -/* Partial index for reading only. */ - quicktime_ix_t *ix; -} quicktime_indxtable_t; - -typedef struct -{ - quicktime_atom_t atom; - int longs_per_entry; - int index_subtype; - int index_type; -/* corresponding chunk id: 00wb, 00dc */ - char chunk_id[5]; - -/* Number of partial indexes here */ - int table_size; - int table_allocation; - quicktime_indxtable_t *table; -} quicktime_indx_t; - -/* AVI equivalent for each trak. Use file->moov.total_tracks */ -/* Need it for super indexes during reading. */ -typedef struct -{ - quicktime_atom_t atom; -/* Super index for reading */ - quicktime_indx_t indx; -/* AVI needs header placeholders before anything else is written */ - int64_t length_offset; -/* Sample count read directly from auds */ - int64_t samples; -/* Bytes per second read directly from auds */ - int bytes_per_second; -/* Bytes totalled up from idx1 */ - int64_t total_bytes; - int64_t samples_per_chunk_offset; - int64_t sample_size_offset; -/* Start of indx header for later writing */ - int64_t indx_offset; -/* Size of JUNK without 8 byte header which is to be replaced by indx */ - int64_t padding_size; -/* Tag for writer with NULL termination: 00wb, 00dc Not available in reader.*/ - char tag[5]; -/* Flags for reader. Not available in writer. */ - int is_audio; - int is_video; -/* Notify reader the super indexes are valid */ - int have_indx; -} quicktime_strl_t; - -typedef struct -{ - quicktime_atom_t atom; - int64_t frames_offset; - int64_t bitrate_offset; -/* Offsets to be written during file closure */ - int64_t total_frames_offset; - -/* AVI equivalent for each trak. Use file->moov.total_tracks */ -/* Need it for super indexes during reading. */ - quicktime_strl_t *strl[MAXTRACKS]; -} quicktime_hdrl_t; - -typedef struct -{ - char tag[5]; - uint32_t flags; -/* Start of 8 byte chunk header relative to start of the 'movi' string */ - int32_t offset; -/* Size of chunk less the 8 byte header */ - int32_t size; -} quicktime_idx1table_t; - -typedef struct -{ - quicktime_atom_t atom; - quicktime_idx1table_t *table; - int table_size; - int table_allocation; -} quicktime_idx1_t; - -typedef struct -{ - quicktime_atom_t atom; - quicktime_movi_t movi; - quicktime_hdrl_t hdrl; - -/* Full index */ - quicktime_idx1_t idx1; -/* Notify reader the idx1 table is valid */ - int have_idx1; - int have_hdrl; -} quicktime_riff_t; - -typedef struct -{ - unsigned char *y, *u, *v; - int y_size; - int u_size; - int v_size; - int64_t frame_number; -} quicktime_cacheframe_t; - -typedef struct -{ - quicktime_cacheframe_t *frames; - int total; - int allocation; - int max; -} quicktime_cache_t; - -/* table of pointers to every track */ -typedef struct -{ - quicktime_trak_t *track; /* real quicktime track corresponding to this table */ - int channels; /* number of audio channels in the track */ - int64_t current_position; /* current sample in output file */ - int64_t current_chunk; /* current chunk in output file */ - quicktime_vbr_t vbr; /* Stores for vbr codecs */ - - void *codec; -} quicktime_audio_map_t; - -typedef struct -{ - quicktime_trak_t *track; - int64_t current_position; /* current frame in output file */ - int64_t current_chunk; /* current chunk in output file */ -// Cache for the current GOP after a seek. - quicktime_cache_t *frame_cache; - - void *codec; -} quicktime_video_map_t; - -/* file descriptor passed to all routines */ -typedef struct -{ - FILE *stream; - int64_t total_length; - quicktime_mdat_t mdat; - quicktime_moov_t moov; - int rd; - int wr; - -/* If the moov atom is compressed */ - int compressed_moov; - unsigned char *moov_data; -/* - * Temporary storage of compressed sizes. If the file length is shorter than the - * uncompressed sizes, it won't work. - */ - int64_t moov_end; - int64_t moov_size; - int64_t old_preload_size; - char *old_preload_buffer; - int64_t old_preload_start; - int64_t old_preload_end; - int64_t old_preload_ptr; - - - - - -/* ASF/WMV section */ - int use_asf; - void *asf; - - - - -/* AVI section */ - int use_avi; -/* AVI tree */ - quicktime_riff_t *riff[MAX_RIFFS]; - int total_riffs; -/* is odml version of AVI */ - int is_odml; - - - - - - - - -/* for begining and ending frame writes where the user wants to write the */ -/* file descriptor directly */ - int64_t offset; - -/* I/O */ -/* Current position of virtual file descriptor */ - int64_t file_position; - -/* Work around a bug in glibc where ftello returns only 32 bits by maintaining */ -/* our own position */ - int64_t ftell_position; - -/* Read ahead buffer */ - int64_t preload_size; /* Enables preload when nonzero. */ - char *preload_buffer; - int64_t preload_start; /* Start of preload_buffer in file */ - int64_t preload_end; /* End of preload buffer in file */ - int64_t preload_ptr; /* Offset of preload_start in preload_buffer */ - -/* Temporary storage until tracks are created */ - int cache_size; - -/* Write ahead buffer */ -/* Amount of data in presave buffer */ - int64_t presave_size; -/* Next presave byte's position in file */ - int64_t presave_position; - char *presave_buffer; -/* Presave doesn't matter a whole lot, so its size is fixed */ -#define QUICKTIME_PRESAVE 0x100000 - int use_presave; - -/* mapping of audio channels to movie tracks */ -/* one audio map entry exists for each channel */ - int total_atracks; - quicktime_audio_map_t *atracks; - -/* mapping of video tracks to movie tracks */ - int total_vtracks; - quicktime_video_map_t *vtracks; - -/* Number of processors at our disposal */ - int cpus; - -/* Parameters for frame currently being decoded */ - int do_scaling; - int in_x, in_y, in_w, in_h, out_w, out_h; - int color_model, row_span; - -/* Adjustable timecode frame number */ - int64_t current_frame; - -} quicktime_t; - - -/* Structure created in track_map to describe the codec */ -typedef struct -{ - void (*delete_vcodec)(quicktime_video_map_t *vtrack); - void (*delete_acodec)(quicktime_audio_map_t *atrack); -/* Decode a single frame */ - int (*decode_video)(quicktime_t *file, - unsigned char **row_pointers, - int track); -/* Encode a single frame */ - int (*encode_video)(quicktime_t *file, - unsigned char **row_pointers, - int track); -/* Decode a certain number of samples */ - int (*decode_audio)(quicktime_t *file, - int16_t *output_i, - float *output_f, - long samples, - int track, - int channel); -/* Encode a chunk of audio */ - int (*encode_audio)(quicktime_t *file, - int16_t **input_i, - float **input_f, - int track, - long samples); - int (*reads_colormodel)(quicktime_t *file, - int colormodel, - int track); - int (*writes_colormodel)(quicktime_t *file, - int colormodel, - int track); - - int (*set_parameter)(quicktime_t *file, - int track, - char *key, - void *value); - void (*flush)(quicktime_t *file, - int track); - -/* AVI codec ID for audio. AVI codec ID's are based on WAV files, by the way. */ - int wav_id; - -/* Pointer to static character code for identifying the codec. */ - char *fourcc; - -/* English title of codec. Optional. */ - char *title; - -/* English description of codec. Optional. */ - char *desc; - -/* Frame cache for seeking only. */ - - -/* Proprietary data for the codec to allocate and delete. */ - void *priv; -} quicktime_codec_t; - - - -/* Structure tabulated in plugin.c to search the codecs */ -typedef struct -{ - int32_t fourcc, id; - void (*init_vcodec)(quicktime_video_map_t *); - void (*init_acodec)(quicktime_audio_map_t *); -} quicktime_codectable_t; - - - - -#endif diff --git a/cinelerra-5.0/quicktime/qtvorbis.h b/cinelerra-5.0/quicktime/qtvorbis.h deleted file mode 100644 index 509aa9d1..00000000 --- a/cinelerra-5.0/quicktime/qtvorbis.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef QUICKTIME_VORBIS_H -#define QUICKTIME_VORBIS_H - -void quicktime_init_codec_vorbis(quicktime_audio_map_t *atrack); - - -#endif diff --git a/cinelerra-5.0/quicktime/quicktime.c b/cinelerra-5.0/quicktime/quicktime.c deleted file mode 100755 index 6b19092b..00000000 --- a/cinelerra-5.0/quicktime/quicktime.c +++ /dev/null @@ -1,1455 +0,0 @@ -#include "colormodels.h" -#include "funcprotos.h" -#include "qtasf_codes.h" -#include "quicktime.h" -#include -#include -#include "workarounds.h" - -int quicktime_make_streamable(char *in_path, char *out_path) -{ - quicktime_t file, *old_file, new_file; - int moov_exists = 0, mdat_exists = 0, result, atoms = 1; - int64_t mdat_start, mdat_size; - quicktime_atom_t leaf_atom; - int64_t moov_start, moov_end; - int ftyp_exists = 0; - int ftyp_size = 0; - unsigned char *ftyp_data = 0; - - quicktime_init(&file); - -/* find the moov atom in the old file */ - - if(!(file.stream = fopen(in_path, "rb"))) - { - perror("quicktime_make_streamable"); - return 1; - } - - file.total_length = quicktime_get_file_length(in_path); - -/* get the locations of moov and mdat atoms */ - do - { - result = quicktime_atom_read_header(&file, &leaf_atom); -//printf("0x%llx %s\n", quicktime_position(&file), leaf_atom.type); - - if(!result) - { - if(quicktime_atom_is(&leaf_atom, "ftyp")) - { - ftyp_exists = 1; - ftyp_data = calloc(1, leaf_atom.size); - ftyp_size = leaf_atom.size; - quicktime_set_position(&file, - quicktime_position(&file) - HEADER_LENGTH); - quicktime_read_data(&file, (char*)ftyp_data, ftyp_size); - } - else - if(quicktime_atom_is(&leaf_atom, "moov")) - { - moov_exists = atoms; - } - else - if(quicktime_atom_is(&leaf_atom, "mdat")) - { - mdat_start = quicktime_position(&file) - HEADER_LENGTH; - mdat_size = leaf_atom.size; - mdat_exists = atoms; - } - - quicktime_atom_skip(&file, &leaf_atom); - - atoms++; - } - }while(!result && quicktime_position(&file) < file.total_length); - - fclose(file.stream); - - if(!moov_exists) - { - printf("quicktime_make_streamable: no moov atom\n"); - if(ftyp_data) free(ftyp_data); - return 1; - } - - if(!mdat_exists) - { - printf("quicktime_make_streamable: no mdat atom\n"); - if(ftyp_data) free(ftyp_data); - return 1; - } - -/* copy the old file to the new file */ - if(moov_exists && mdat_exists) - { -/* moov wasn't the first atom */ - if(moov_exists > 1) - { - char *buffer; - int64_t buf_size = 1000000; - - result = 0; - -/* read the header proper */ - if(!(old_file = quicktime_open(in_path, 1, 0))) - { - if(ftyp_data) free(ftyp_data); - return 1; - } - - -/* open the output file */ - if(!(new_file.stream = fopen(out_path, "wb"))) - { - perror("quicktime_make_streamable"); - result = 1; - } - else - { -/* set up some flags */ - new_file.wr = 1; - new_file.rd = 0; - -/* Write ftyp header */ - if(ftyp_exists) - { - quicktime_write_data(&new_file, (char*)ftyp_data, ftyp_size); - } - - -/* Write moov once to get final size with our substituted headers */ - moov_start = quicktime_position(&new_file); - quicktime_write_moov(&new_file, &(old_file->moov), 0); - moov_end = quicktime_position(&new_file); - -printf("make_streamable 0x%llx 0x%llx\n", (long long)moov_end - moov_start, (long long)mdat_start); - quicktime_shift_offsets(&(old_file->moov), - moov_end - moov_start - mdat_start + ftyp_size); - -/* Write again with shifted offsets */ - quicktime_set_position(&new_file, moov_start); - quicktime_write_moov(&new_file, &(old_file->moov), 0); - quicktime_set_position(old_file, mdat_start); - - if(!(buffer = calloc(1, buf_size))) - { - result = 1; - printf("quicktime_make_streamable: out of memory\n"); - } - else - { - while(quicktime_position(old_file) < mdat_start + mdat_size && !result) - { - if(quicktime_position(old_file) + buf_size > mdat_start + mdat_size) - buf_size = mdat_start + mdat_size - quicktime_position(old_file); - - if(!quicktime_read_data(old_file, buffer, buf_size)) result = 1; - if(!result) - { - if(!quicktime_write_data(&new_file, buffer, buf_size)) result = 1; - } - } - free(buffer); - } - fclose(new_file.stream); - } - quicktime_close(old_file); - } - else - { - printf("quicktime_make_streamable: header already at 0 offset\n"); - if(ftyp_data) free(ftyp_data); - return 0; - } - } - - if(ftyp_data) free(ftyp_data); - return 0; -} - - - -void quicktime_set_copyright(quicktime_t *file, const char *string) -{ - quicktime_set_udta_string(&(file->moov.udta.copyright), - &(file->moov.udta.copyright_len), (char*)string); -} - -void quicktime_set_name(quicktime_t *file, const char *string) -{ - quicktime_set_udta_string(&(file->moov.udta.name), - &(file->moov.udta.name_len), (char*)string); -} - -void quicktime_set_info(quicktime_t *file, const char *string) -{ - quicktime_set_udta_string(&(file->moov.udta.info), - &(file->moov.udta.info_len), (char*)string); -} - -char* quicktime_get_copyright(quicktime_t *file) -{ - return file->moov.udta.copyright; -} - -char* quicktime_get_name(quicktime_t *file) -{ - return file->moov.udta.name; -} - -char* quicktime_get_info(quicktime_t *file) -{ - return file->moov.udta.info; -} - - -int quicktime_video_tracks(quicktime_t *file) -{ - int i, result = 0; - for(i = 0; i < file->moov.total_tracks; i++) - { - if(file->moov.trak[i]->mdia.minf.is_video) result++; - } - return result; -} - -int quicktime_audio_tracks(quicktime_t *file) -{ - int i, result = 0; - quicktime_minf_t *minf; - for(i = 0; i < file->moov.total_tracks; i++) - { - minf = &(file->moov.trak[i]->mdia.minf); - if(minf->is_audio) - result++; - } - return result; -} - -int quicktime_set_audio(quicktime_t *file, - int channels, - long sample_rate, - int bits, - char *compressor) -{ - quicktime_trak_t *trak; - -/* allocate an arbitrary number of tracks */ - if(channels) - { -/* Fake the bits parameter for some formats. */ - if(quicktime_match_32(compressor, QUICKTIME_ULAW)) bits = 8; - else if(quicktime_match_32(compressor, QUICKTIME_IMA4)) bits = 16; - - file->atracks = (quicktime_audio_map_t*)calloc(1, sizeof(quicktime_audio_map_t)); - trak = quicktime_add_track(file); - quicktime_trak_init_audio(file, - trak, - channels, - sample_rate, - bits, - compressor); - quicktime_init_audio_map(&(file->atracks[0]), trak); - file->atracks[file->total_atracks].track = trak; - file->atracks[file->total_atracks].channels = channels; - file->atracks[file->total_atracks].current_position = 0; - file->atracks[file->total_atracks].current_chunk = 1; - file->total_atracks++; - } - return 1; /* Return the number of tracks created */ -} - -int quicktime_set_video(quicktime_t *file, - int tracks, - int frame_w, - int frame_h, - double frame_rate, - char *compressor) -{ - int i; - quicktime_trak_t *trak; - - if(tracks) - { - quicktime_mhvd_init_video(file, &(file->moov.mvhd), frame_rate); - file->total_vtracks = tracks; - file->vtracks = (quicktime_video_map_t*)calloc(1, sizeof(quicktime_video_map_t) * file->total_vtracks); - for(i = 0; i < tracks; i++) - { - trak = quicktime_add_track(file); - quicktime_trak_init_video(file, trak, frame_w, frame_h, frame_rate, compressor); - quicktime_init_video_map(&(file->vtracks[i]), trak); - } - } - - quicktime_set_cache_max(file, file->cache_size); - - return 0; -} - -void quicktime_set_framerate(quicktime_t *file, double framerate) -{ - int i; - int new_time_scale, new_sample_duration; - - if(!file->wr) - { - fprintf(stderr, "quicktime_set_framerate shouldn't be called in read mode.\n"); - return; - } - - new_time_scale = quicktime_get_timescale(framerate); - new_sample_duration = (int)((double)new_time_scale / framerate + 0.5); - - for(i = 0; i < file->total_vtracks; i++) - { - file->vtracks[i].track->mdia.mdhd.time_scale = new_time_scale; - file->vtracks[i].track->mdia.minf.stbl.stts.table[0].sample_duration = new_sample_duration; - } -} - - -// Used by quicktime_set_video when creating a new file -quicktime_trak_t* quicktime_add_track(quicktime_t *file) -{ - quicktime_moov_t *moov = &(file->moov); - quicktime_trak_t *trak; - int i; - - for(i = moov->total_tracks; i > 0; i--) - moov->trak[i] = moov->trak[i - 1]; - - trak = - moov->trak[0] = - calloc(1, sizeof(quicktime_trak_t)); - quicktime_trak_init(trak); - moov->total_tracks++; - - for(i = 0; i < moov->total_tracks; i++) - moov->trak[i]->tkhd.track_id = i + 1; - moov->mvhd.next_track_id++; - return trak; -} - -/* ============================= Initialization functions */ - -int quicktime_init(quicktime_t *file) -{ - bzero(file, sizeof(quicktime_t)); - quicktime_moov_init(&(file->moov)); - file->cpus = 1; - file->color_model = BC_RGB888; - file->current_frame = 0; - file->is_odml = 0; - return 0; -} - -int quicktime_delete(quicktime_t *file) -{ - int i; - if(file->total_atracks) - { - for(i = 0; i < file->total_atracks; i++) - quicktime_delete_audio_map(&(file->atracks[i])); - free(file->atracks); - } - - if(file->total_vtracks) - { - for(i = 0; i < file->total_vtracks; i++) - quicktime_delete_video_map(&(file->vtracks[i])); - free(file->vtracks); - } - - file->total_atracks = 0; - file->total_vtracks = 0; - - if(file->moov_data) - free(file->moov_data); - - if(file->preload_size) - { - free(file->preload_buffer); - file->preload_size = 0; - } - - if(file->presave_buffer) - { - free(file->presave_buffer); - } - - for(i = 0; i < file->total_riffs; i++) - { - quicktime_delete_riff(file, file->riff[i]); - } - - quicktime_moov_delete(&(file->moov)); - quicktime_mdat_delete(&(file->mdat)); - quicktime_delete_asf(file->asf); - return 0; -} - -/* =============================== Optimization functions */ - -int quicktime_set_cpus(quicktime_t *file, int cpus) -{ - if(cpus > 0) file->cpus = cpus; - return 0; -} - -void quicktime_set_preload(quicktime_t *file, int64_t preload) -{ - file->preload_size = preload; - if(file->preload_buffer) free(file->preload_buffer); - file->preload_buffer = 0; - if(preload) - file->preload_buffer = calloc(1, preload); - file->preload_start = 0; - file->preload_end = 0; - file->preload_ptr = 0; -} - - -int quicktime_get_timescale(double frame_rate) -{ - int timescale = 600; -/* Encode the 29.97, 23.976, 59.94 framerates */ - if(frame_rate - (int)frame_rate != 0) - timescale = (int)(frame_rate * 1001 + 0.5); - else - if((600 / frame_rate) - (int)(600 / frame_rate) != 0) - timescale = (int)(frame_rate * 100 + 0.5); -//printf("quicktime_get_timescale %f %d\n", 600 / frame_rate, (int)(600 / frame_rate)); - return timescale; -} - -int quicktime_seek_end(quicktime_t *file) -{ - quicktime_set_position(file, file->mdat.atom.size + file->mdat.atom.start + HEADER_LENGTH * 2); -/*printf("quicktime_seek_end %ld\n", file->mdat.atom.size + file->mdat.atom.start); */ - quicktime_update_positions(file); - return 0; -} - -int quicktime_seek_start(quicktime_t *file) -{ - quicktime_set_position(file, file->mdat.atom.start + HEADER_LENGTH * 2); - quicktime_update_positions(file); - return 0; -} - -long quicktime_audio_length(quicktime_t *file, int track) -{ - if(file->total_atracks > 0) - return quicktime_track_samples(file, file->atracks[track].track); - - return 0; -} - -long quicktime_video_length(quicktime_t *file, int track) -{ -/*printf("quicktime_video_length %d %d\n", quicktime_track_samples(file, file->vtracks[track].track), track); */ - if(file->total_vtracks > 0) - return quicktime_track_samples(file, file->vtracks[track].track); - return 0; -} - -long quicktime_audio_position(quicktime_t *file, int track) -{ - return file->atracks[track].current_position; -} - -long quicktime_video_position(quicktime_t *file, int track) -{ - return file->vtracks[track].current_position; -} - -int quicktime_update_positions(quicktime_t *file) -{ -/* Get the sample position from the file offset */ -/* for routines that change the positions of all tracks, like */ -/* seek_end and seek_start but not for routines that reposition one track, like */ -/* set_audio_position. */ - - int64_t mdat_offset = quicktime_position(file) - file->mdat.atom.start; - int64_t sample, chunk, chunk_offset; - int i; - - if(file->total_atracks) - { - sample = quicktime_offset_to_sample(file->atracks[0].track, mdat_offset); - chunk = quicktime_offset_to_chunk(&chunk_offset, file->atracks[0].track, mdat_offset); - for(i = 0; i < file->total_atracks; i++) - { - file->atracks[i].current_position = sample; - file->atracks[i].current_chunk = chunk; - } - } - - if(file->total_vtracks) - { - sample = quicktime_offset_to_sample(file->vtracks[0].track, mdat_offset); - chunk = quicktime_offset_to_chunk(&chunk_offset, file->vtracks[0].track, mdat_offset); - for(i = 0; i < file->total_vtracks; i++) - { - file->vtracks[i].current_position = sample; - file->vtracks[i].current_chunk = chunk; - } - } - return 0; -} - -int quicktime_set_audio_position(quicktime_t *file, int64_t sample, int track) -{ - int64_t offset, chunk_sample, chunk; - quicktime_trak_t *trak; - - if(track < file->total_atracks) - { - trak = file->atracks[track].track; - file->atracks[track].current_position = sample; - quicktime_chunk_of_sample(&chunk_sample, &chunk, trak, sample); - file->atracks[track].current_chunk = chunk; - offset = quicktime_sample_to_offset(file, trak, sample); - quicktime_set_position(file, offset); - } - else - fprintf(stderr, "quicktime_set_audio_position: track >= file->total_atracks\n"); - - return 0; -} - -int quicktime_set_video_position(quicktime_t *file, int64_t frame, int track) -{ - int64_t offset, chunk_sample, chunk; - quicktime_trak_t *trak; - if(track >= file->total_vtracks) - { - fprintf(stderr, - "quicktime_set_video_position: frame=%lld track=%d >= file->total_vtracks %d\n", - (long long)frame, - track, - file->total_vtracks); - track = file->total_vtracks - 1; - } - - if(track < file->total_vtracks && track >= 0) - { - trak = file->vtracks[track].track; - file->vtracks[track].current_position = frame; - quicktime_chunk_of_sample(&chunk_sample, &chunk, trak, frame); - file->vtracks[track].current_chunk = chunk; - offset = quicktime_sample_to_offset(file, trak, frame); - quicktime_set_position(file, offset); - } - return 0; -} - -int quicktime_has_audio(quicktime_t *file) -{ - if(quicktime_audio_tracks(file)) return 1; - return 0; -} - -long quicktime_sample_rate(quicktime_t *file, int track) -{ - if(file->total_atracks) - { - quicktime_trak_t *trak = file->atracks[track].track; - return trak->mdia.minf.stbl.stsd.table[0].sample_rate; - } - return 0; -} - -int quicktime_audio_bits(quicktime_t *file, int track) -{ - if(file->total_atracks) - return file->atracks[track].track->mdia.minf.stbl.stsd.table[0].sample_size; - - return 0; -} - -char* quicktime_audio_compressor(quicktime_t *file, int track) -{ - return file->atracks[track].track->mdia.minf.stbl.stsd.table[0].format; -} - -int quicktime_track_channels(quicktime_t *file, int track) -{ - if(track < file->total_atracks) - return file->atracks[track].channels; - - return 0; -} - -/* Input is absolute channel number in stream, output is quicktime_track in which the channel resides and quicktime_channel relative to the track */ - -int quicktime_channel_location(quicktime_t *file, int *quicktime_track, int *quicktime_channel, int channel) -{ - int current_channel = 0, current_track = 0; - *quicktime_channel = 0; - *quicktime_track = 0; - for(current_channel = 0, current_track = 0; current_track < file->total_atracks; ) - { - if(channel >= current_channel) - { - *quicktime_channel = channel - current_channel; - *quicktime_track = current_track; - } - - current_channel += file->atracks[current_track].channels; - current_track++; - } - return 0; -} - -int quicktime_has_video(quicktime_t *file) -{ - if(quicktime_video_tracks(file)) return 1; - return 0; -} - -int quicktime_video_width(quicktime_t *file, int track) -{ - if(file->total_vtracks) - return file->vtracks[track].track->tkhd.track_width; - return 0; -} - -int quicktime_video_height(quicktime_t *file, int track) -{ - if(file->total_vtracks) - return file->vtracks[track].track->tkhd.track_height; - return 0; -} - -int quicktime_video_depth(quicktime_t *file, int track) -{ - if(file->total_vtracks) - return file->vtracks[track].track->mdia.minf.stbl.stsd.table[0].depth; - return 0; -} - -void quicktime_set_cmodel(quicktime_t *file, int colormodel) -{ - file->color_model = colormodel; -} - -void quicktime_set_row_span(quicktime_t *file, int row_span) -{ - file->row_span = row_span; -} - -void quicktime_set_window(quicktime_t *file, - int in_x, /* Location of input frame to take picture */ - int in_y, - int in_w, - int in_h, - int out_w, /* Dimensions of output frame */ - int out_h) -{ - if(in_x >= 0 && in_y >= 0 && in_w > 0 && in_h > 0 && out_w > 0 && out_h > 0) - { - file->do_scaling = 1; - file->in_x = in_x; - file->in_y = in_y; - file->in_w = in_w; - file->in_h = in_h; - file->out_w = out_w; - file->out_h = out_h; - } - else - { - file->do_scaling = 0; -/* quicktime_decode_video now sets the window for every frame based on the */ -/* track dimensions */ - } -} - -void quicktime_set_depth(quicktime_t *file, int depth, int track) -{ - int i; - - for(i = 0; i < file->total_vtracks; i++) - { - file->vtracks[i].track->mdia.minf.stbl.stsd.table[0].depth = depth; - } -} - -double quicktime_frame_rate(quicktime_t *file, int track) -{ - if(file->total_vtracks > track) - { - quicktime_trak_t *trak = file->vtracks[track].track; - int time_scale = file->vtracks[track].track->mdia.mdhd.time_scale; - int sample_duration = quicktime_sample_duration(trak); - return (double)time_scale / sample_duration; -// return (float)file->vtracks[track].track->mdia.mdhd.time_scale / -// file->vtracks[track].track->mdia.minf.stbl.stts.table[0].sample_duration; - } - return 0; -} - -int quicktime_frame_rate_n(quicktime_t *file, int track) -{ - if(file->total_vtracks > track) - return file->vtracks[track].track->mdia.mdhd.time_scale; - return 0; -} - -int quicktime_frame_rate_d(quicktime_t *file, int track) -{ - if(file->total_vtracks > track) - return file->vtracks[track].track->mdia.minf.stbl.stts.table[0].sample_duration; - return 0; -} - -char* quicktime_video_compressor(quicktime_t *file, int track) -{ - return file->vtracks[track].track->mdia.minf.stbl.stsd.table[0].format; -} - -int quicktime_write_audio(quicktime_t *file, - char *audio_buffer, - long samples, - int track) -{ - int result; - int64_t bytes; - quicktime_atom_t chunk_atom; - quicktime_audio_map_t *track_map = &file->atracks[track]; - quicktime_trak_t *trak = track_map->track; - -/* write chunk for 1 track */ - bytes = samples * quicktime_audio_bits(file, track) / 8 * file->atracks[track].channels; - quicktime_write_chunk_header(file, trak, &chunk_atom); - result = !quicktime_write_data(file, audio_buffer, bytes); - quicktime_write_chunk_footer(file, - trak, - track_map->current_chunk, - &chunk_atom, - samples); - -/* file->atracks[track].current_position += samples; */ - file->atracks[track].current_chunk++; - return result; -} - -int quicktime_write_frame(quicktime_t *file, - unsigned char *video_buffer, - int64_t bytes, - int track) -{ -// int64_t offset = quicktime_position(file); - int result = 0; - quicktime_atom_t chunk_atom; - quicktime_video_map_t *vtrack = &file->vtracks[track]; - quicktime_trak_t *trak = vtrack->track; - - if(!bytes) return 0; - - quicktime_write_chunk_header(file, trak, &chunk_atom); - result = !quicktime_write_data(file, (char*)video_buffer, bytes); - quicktime_write_chunk_footer(file, - trak, - vtrack->current_chunk, - &chunk_atom, - 1); - file->vtracks[track].current_position++; - file->vtracks[track].current_chunk++; - return result; -} - - -long quicktime_read_audio(quicktime_t *file, - char *audio_buffer, long samples, int track) -{ - quicktime_audio_map_t *track_map = &file->atracks[track]; - quicktime_trak_t *trak = track_map->track; - int64_t position, chunk, chunk_sample; - long ret, bytes, chunk_offset, chunk_len; - int result = 0; - - position = file->atracks[track].current_position; - quicktime_chunk_of_sample(&chunk_sample, &chunk, trak, position); - ret = 0; - - while( samples > 0 ) { - int64_t offset = quicktime_sample_to_offset(file, trak, position); - quicktime_set_position(file, offset); - chunk_offset = position - chunk_sample; - chunk_len = quicktime_chunk_samples(trak, chunk) - chunk_offset; - if( chunk_len > samples ) chunk_len = samples; - else ++chunk; - chunk_sample = (position += chunk_len); - bytes = quicktime_samples_to_bytes(trak, chunk_len); - result = !quicktime_read_data(file, &audio_buffer[ret], bytes); - if( result ) break; - ret += bytes; - samples -= chunk_len; - } -//printf("quicktime_read_audio 5\n"); - - track_map->current_position = position; - track_map->current_chunk = chunk; - return !result ? ret : 0; -} - -int quicktime_read_chunk(quicktime_t *file, char *output, int track, int64_t chunk, int64_t byte_start, int64_t byte_len) -{ - quicktime_set_position(file, - quicktime_chunk_to_offset(file, file->atracks[track].track, chunk) + - byte_start); - if(quicktime_read_data(file, output, byte_len)) return 0; - else - return 1; -} - -long quicktime_frame_size(quicktime_t *file, long frame, int track) -{ - long bytes = 0; - quicktime_trak_t *trak = file->vtracks[track].track; - - if(trak->mdia.minf.stbl.stsz.sample_size) - { - bytes = trak->mdia.minf.stbl.stsz.sample_size; - } - else - { - long total_frames = quicktime_track_samples(file, trak); - if(frame < 0) frame = 0; - else - if(frame > total_frames - 1) frame = total_frames - 1; - bytes = trak->mdia.minf.stbl.stsz.table[frame].size; - } - - - return bytes; -} - - -long quicktime_read_frame(quicktime_t *file, unsigned char *video_buffer, int track) -{ - int result = 0; - int64_t bytes = quicktime_frame_size(file, file->vtracks[track].current_position, track); - quicktime_set_video_position(file, file->vtracks[track].current_position, track); - -/* - * printf("quicktime_read_frame 0x%llx %lld\n", - * quicktime_ftell(file), - * bytes); - */ - result = quicktime_read_data(file, (char*)video_buffer, bytes); - file->vtracks[track].current_position++; - - if(!result) return 0; - return bytes; -} - -int64_t quicktime_get_keyframe_before(quicktime_t *file, int64_t frame, int track) -{ - quicktime_trak_t *trak = file->vtracks[track].track; - quicktime_stss_t *stss = &trak->mdia.minf.stbl.stss; - int i; - - - - - -// Offset 1 - frame++; - - - for(i = stss->total_entries - 1; i >= 0; i--) - { - if(stss->table[i].sample <= frame) return stss->table[i].sample - 1; - } - - return 0; -} - -int64_t quicktime_get_keyframe_after(quicktime_t *file, int64_t frame, int track) -{ - quicktime_trak_t *trak = file->vtracks[track].track; - quicktime_stss_t *stss = &trak->mdia.minf.stbl.stss; - int i; - - - - - -// Offset 1 - frame++; - - - for(i = 0; i < stss->total_entries; i++) - { - if(stss->table[i].sample >= frame) return stss->table[i].sample - 1; - } - - return 0; -} - -void quicktime_insert_keyframe(quicktime_t *file, int64_t frame, int track) -{ - quicktime_trak_t *trak = file->vtracks[track].track; - quicktime_stss_t *stss = &trak->mdia.minf.stbl.stss; - int i; - -// Set keyframe flag in idx1 table. -// Only possible in the first RIFF. After that, there's no keyframe support. - if(file->use_avi && file->total_riffs == 1) - quicktime_set_idx1_keyframe(file, - trak, - frame); - -// Offset 1 - frame++; - - -// Get the keyframe greater or equal to new frame - for(i = 0; i < stss->total_entries; i++) - { - if(stss->table[i].sample >= frame) break; - } - -// Expand table - if(stss->entries_allocated <= stss->total_entries) - { - stss->entries_allocated *= 2; - stss->table = realloc(stss->table, sizeof(quicktime_stss_table_t) * stss->entries_allocated); - } - -// Insert before existing frame - if(i < stss->total_entries) - { - if(stss->table[i].sample > frame) - { - int j, k; - for(j = stss->total_entries, k = stss->total_entries - 1; - k >= i; - j--, k--) - { - stss->table[j] = stss->table[k]; - } - stss->table[i].sample = frame; - } - } - else -// Insert after last frame - stss->table[i].sample = frame; - - stss->total_entries++; -} - - -int quicktime_has_keyframes(quicktime_t *file, int track) -{ - quicktime_trak_t *trak = file->vtracks[track].track; - quicktime_stss_t *stss = &trak->mdia.minf.stbl.stss; - - return stss->total_entries > 0; -} - - - - - -int quicktime_read_frame_init(quicktime_t *file, int track) -{ - quicktime_set_video_position(file, file->vtracks[track].current_position, track); - if(quicktime_ftell(file) != file->file_position) - { - FSEEK(file->stream, file->file_position, SEEK_SET); - file->ftell_position = file->file_position; - } - return 0; -} - -int quicktime_read_frame_end(quicktime_t *file, int track) -{ - file->file_position = quicktime_ftell(file); - file->vtracks[track].current_position++; - return 0; -} - -int quicktime_init_video_map(quicktime_video_map_t *vtrack, quicktime_trak_t *trak) -{ - vtrack->track = trak; - vtrack->current_position = 0; - vtrack->current_chunk = 1; - quicktime_init_vcodec(vtrack); - vtrack->frame_cache = quicktime_new_cache(); - return 0; -} - -int quicktime_delete_video_map(quicktime_video_map_t *vtrack) -{ - quicktime_delete_vcodec(vtrack); - if(vtrack->frame_cache) quicktime_delete_cache(vtrack->frame_cache); - vtrack->frame_cache = 0; - return 0; -} - -int64_t quicktime_memory_usage(quicktime_t *file) -{ - int i; - int64_t result = 0; -//printf("quicktime_memory_usage %d\n", file->total_vtracks); - for(i = 0; i < file->total_vtracks; i++) - { - result += quicktime_cache_usage(file->vtracks[i].frame_cache); - } - return result; -} - -void quicktime_set_cache_max(quicktime_t *file, int bytes) -{ - int i; - file->cache_size = bytes; - - -//printf("quicktime_set_cache_max %d %d %d\n", __LINE__, bytes, file->total_vtracks); - for(i = 0; i < file->total_vtracks; i++) - { - quicktime_cache_max(file->vtracks[i].frame_cache, bytes); - } -} - - - - - -int quicktime_init_audio_map(quicktime_audio_map_t *atrack, quicktime_trak_t *trak) -{ - atrack->track = trak; - atrack->channels = trak->mdia.minf.stbl.stsd.table[0].channels; - atrack->current_position = 0; - atrack->current_chunk = 1; - quicktime_init_acodec(atrack); - return 0; -} - -int quicktime_delete_audio_map(quicktime_audio_map_t *atrack) -{ - quicktime_delete_acodec(atrack); - quicktime_clear_vbr(&atrack->vbr); - return 0; -} - -void quicktime_init_maps(quicktime_t *file) -{ - int i, track; -/* get tables for all the different tracks */ - file->total_atracks = quicktime_audio_tracks(file); - file->atracks = (quicktime_audio_map_t*)calloc(1, sizeof(quicktime_audio_map_t) * file->total_atracks); - - for(i = 0, track = 0; i < file->total_atracks; i++) - { - while(!file->moov.trak[track]->mdia.minf.is_audio) - track++; - quicktime_init_audio_map(&(file->atracks[i]), file->moov.trak[track]); - } - - file->total_vtracks = quicktime_video_tracks(file); - file->vtracks = (quicktime_video_map_t*)calloc(1, sizeof(quicktime_video_map_t) * file->total_vtracks); - - for(track = 0, i = 0; i < file->total_vtracks; i++) - { - while(!file->moov.trak[track]->mdia.minf.is_video) - track++; - - quicktime_init_video_map(&(file->vtracks[i]), file->moov.trak[track]); - } - - quicktime_set_cache_max(file, file->cache_size); -} - -int quicktime_read_info(quicktime_t *file) -{ - int result = 0, got_header = 0; - int64_t start_position = quicktime_position(file); - quicktime_atom_t leaf_atom; - quicktime_guid_t guid; - char avi_avi[4]; - int got_avi = 0; - int got_asf = 0; - file->use_avi = 0; - file->use_asf = 0; - - quicktime_set_position(file, 0LL); - -/* Test for ASF */ - quicktime_read_guid(file, &guid); - quicktime_set_position(file, 0LL); - if(!memcmp(&guid, &asf_header, sizeof(guid))) - { - printf("quicktime_read_info: Got ASF\n"); - got_asf = 1; - got_header = 1; - } - -/* Test file format */ - if(!got_asf) - { - quicktime_set_position(file, 0LL); - do - { - file->use_avi = 1; - result = quicktime_atom_read_header(file, &leaf_atom); - - if(!result && quicktime_atom_is(&leaf_atom, "RIFF")) - { - quicktime_read_data(file, avi_avi, 4); - if(quicktime_match_32(avi_avi, "AVI ")) - { - got_avi = 1; - } - else - { - file->use_avi = 0; - result = 0; - break; - } - } - else - { - file->use_avi = 0; - result = 0; - break; - } - }while(1); - } - - if(got_avi) file->use_avi = 1; - else - if(got_asf) file->use_asf = 1; - - quicktime_set_position(file, 0LL); - - -/* McRoweSoft AVI section */ - if(file->use_avi) - { -/* Import first RIFF */ - do - { - result = quicktime_atom_read_header(file, &leaf_atom); - if(!result) - { - if(quicktime_atom_is(&leaf_atom, "RIFF")) - { - quicktime_read_riff(file, &leaf_atom); -/* Return success */ - got_header = 1; - } - } - }while(!result && - !got_header && - quicktime_position(file) < file->total_length); - -/* Construct indexes. */ - quicktime_import_avi(file); - } -/* Quicktime section */ - else - if(file->use_asf) - { - result = quicktime_read_asf(file); - if(result) got_header = 0; - else - quicktime_dump_asf(file->asf); - } - else - if(!file->use_avi) - { - do - { - result = quicktime_atom_read_header(file, &leaf_atom); - - if(!result) - { - if(quicktime_atom_is(&leaf_atom, "mdat")) - { - quicktime_read_mdat(file, &(file->mdat), &leaf_atom); - } - else - if(quicktime_atom_is(&leaf_atom, "moov")) - { -/* Set preload and preload the moov atom here */ - int64_t start_position = quicktime_position(file); - long temp_size = leaf_atom.end - start_position; - char *temp = malloc(temp_size); - quicktime_set_preload(file, - (temp_size < 0x100000) ? 0x100000 : temp_size); - quicktime_read_data(file, temp, temp_size); - quicktime_set_position(file, start_position); - free(temp); - - if(quicktime_read_moov(file, &(file->moov), &leaf_atom)) - return 1; - got_header = 1; - } - else - quicktime_atom_skip(file, &leaf_atom); - } - }while(!result && quicktime_position(file) < file->total_length); - - - - - - - - - - -/* go back to the original position */ - quicktime_set_position(file, start_position); - - } - -/* Initialize track map objects */ - if(got_header) - { - quicktime_init_maps(file); - } - -/* Shut down preload in case of an obsurdly high temp_size */ - quicktime_set_preload(file, 0); - - return !got_header; -} - - -int quicktime_dump(quicktime_t *file) -{ - printf("quicktime_dump\n"); - printf("movie data\n"); - printf(" size %ld\n", file->mdat.atom.size); - printf(" start %ld\n", file->mdat.atom.start); - quicktime_moov_dump(&(file->moov)); - return 0; -} - - - - - -int quicktime_check_sig(char *path) -{ - quicktime_t file; - quicktime_atom_t leaf_atom; - int result = 0, result1 = 0, result2 = 0; - char avi_test[12]; - - quicktime_init(&file); - result = quicktime_file_open(&file, path, 1, 0); - - if(!result) - { -// Check for Microsoft AVI - quicktime_read_data(&file, avi_test, 12); - quicktime_set_position(&file, 0); - if(quicktime_match_32(avi_test, "RIFF") && - quicktime_match_32(avi_test + 8, "AVI ")) - { - result2 = 1; - } - - - -/* - * if(!result2) - * // Check for Microsoft ASF - * { - * quicktime_guid_t guid; - * quicktime_read_guid(&file, &guid); - * quicktime_set_position(&file, 0); - * if(!memcmp(&guid, &asf_header, sizeof(guid))) - * { - * printf("quicktime_check_sig: Got ASF\n"); - * result2 = 1; - * } - * } - */ - - if(!result2) - { - do - { - result1 = quicktime_atom_read_header(&file, &leaf_atom); - - if(!result1) - { -/* just want the "moov" atom */ - if(quicktime_atom_is(&leaf_atom, "moov")) - { - result2 = 1; - } - else - quicktime_atom_skip(&file, &leaf_atom); - } - }while(!result1 && !result2 && quicktime_position(&file) < file.total_length); - } - } - -//printf(__FUNCTION__ " 2 %d\n", result2); - quicktime_file_close(&file); - quicktime_delete(&file); - return result2; -} - -void quicktime_set_avi(quicktime_t *file, int value) -{ - file->use_avi = value; - quicktime_set_position(file, 0); - -// Write RIFF chunk - quicktime_init_riff(file); -} - -int quicktime_is_avi(quicktime_t *file) -{ - return file->use_avi; -} - - -void quicktime_set_asf(quicktime_t *file, int value) -{ - file->use_asf = value; -} - -void quicktime_set_frame_start(quicktime_t *file, int64_t value) -{ - file->current_frame = value; -} - -quicktime_t* quicktime_open(char *filename, int rd, int wr) -{ - quicktime_t *new_file = calloc(1, sizeof(quicktime_t)); - int result = 0; - -//printf("quicktime_open 1\n"); - quicktime_init(new_file); - new_file->wr = wr; - new_file->rd = rd; - new_file->mdat.atom.start = 0; - - result = quicktime_file_open(new_file, filename, rd, wr); - - if(!result) - { - if(rd) - { - if(quicktime_read_info(new_file)) - { - quicktime_close(new_file); - fprintf(stderr, "quicktime_open: error in header\n"); - new_file = 0; - } - } - -/* start the data atom */ -/* also don't want to do this if making a streamable file */ - if(wr) - { - quicktime_set_presave(new_file, 1); - - - - -// android requires the ftyp header - const unsigned char ftyp_data[] = - { - 0x00, 0x00, 0x00, 0x18, 0x66, 0x74, 0x79, 0x70, - 0x6d, 0x70, 0x34, 0x32, 0x00, 0x00, 0x00, 0x01, - 0x6d, 0x70, 0x34, 0x32, 0x61, 0x76, 0x63, 0x31 - }; - quicktime_write_data(new_file, (char*)ftyp_data, sizeof(ftyp_data)); - - quicktime_atom_write_header64(new_file, - &new_file->mdat.atom, - "mdat"); - quicktime_set_presave(new_file, 0); - } - } - else - { -//printf("quicktime_open 10\n"); - quicktime_close(new_file); -//printf("quicktime_open 100\n"); - new_file = 0; - } - - - return new_file; -} - -int quicktime_close(quicktime_t *file) -{ - int result = 0; - if(file->wr) - { - quicktime_codecs_flush(file); - -// Reenable buffer for quick header writing. - quicktime_set_presave(file, 1); - if(file->use_avi) - { - quicktime_atom_t junk_atom; - int i; - -// Finalize last header - quicktime_finalize_riff(file, file->riff[file->total_riffs - 1]); - - int64_t position = quicktime_position(file); - -// Finalize the odml header - quicktime_finalize_odml(file, &file->riff[0]->hdrl); - -// Finalize super indexes - quicktime_finalize_indx(file); - -// Pad ending - quicktime_set_position(file, position); - quicktime_atom_write_header(file, &junk_atom, "JUNK"); - for(i = 0; i < 0x406; i++) - quicktime_write_int32_le(file, 0); - quicktime_atom_write_footer(file, &junk_atom); - } - else - { -// Atoms are only written here - if(file->stream) - { - quicktime_write_moov(file, &(file->moov), 1); - quicktime_atom_write_footer(file, &file->mdat.atom); - } - } - } - - quicktime_file_close(file); - - quicktime_delete(file); - free(file); - return result; -} - -int quicktime_major() -{ - return QUICKTIME_MAJOR; -} - -int quicktime_minor() -{ - return QUICKTIME_MINOR; -} - -int quicktime_release() -{ - return QUICKTIME_RELEASE; -} - diff --git a/cinelerra-5.0/quicktime/quicktime.h b/cinelerra-5.0/quicktime/quicktime.h deleted file mode 100644 index c9545bb4..00000000 --- a/cinelerra-5.0/quicktime/quicktime.h +++ /dev/null @@ -1,450 +0,0 @@ -#ifndef QUICKTIME_H -#define QUICKTIME_H - -#ifdef __cplusplus -extern "C" { -#endif - - -#include "qtprivate.h" - -/* This is the reference for all your library entry points. */ - - - - - - -/* ===== compression formats for which codecs exist ====== */ - -/* Straight MPEG-4 */ -#define QUICKTIME_DX50 "DX50" -#define QUICKTIME_MPG4 "MPG4" -#define QUICKTIME_MP42 "MP42" -#define QUICKTIME_DIVX "DIVX" -#define QUICKTIME_XVID "XVID" -#define QUICKTIME_DNXHD "AVdn" -#define QUICKTIME_MP4V "mp4v" - -#define QUICKTIME_H264 "avc1" - - -/* Basterdization of MPEG-4 which encodes alternating fields in series */ -/* NOT STANDARD */ -#define QUICKTIME_HV60 "HV60" -/* Basterdization of H264 which encodes alternating fields in series */ -/* NOT STANDARD */ -#define QUICKTIME_HV64 "HV64" - -/* McRoesoft MPEG-4 */ -#define QUICKTIME_DIV3 "DIV3" -#define QUICKTIME_DIV3_LOWER "div3" - -/* Mormon MPEG-4 */ -#define QUICKTIME_SVQ1 "SVQ1" -#define QUICKTIME_SVQ3 "SVQ3" -#define QUICKTIME_H263 "h263" - -/* Dee Vee */ -#define QUICKTIME_DV "dvc " -#define QUICKTIME_DV25 "dv25" -#define QUICKTIME_DVSD "dvsd" -#define QUICKTIME_DVCP "dvcp" // PAL video inside Quicktime - -/* RGB uncompressed. Allows alpha */ -#define QUICKTIME_RAW "raw " -#define QUICKTIME_RLE "rle " - -/* Jpeg Photo */ -#define QUICKTIME_JPEG "jpeg" -#define QUICKTIME_MJPG "MJPG" - -/* Concatenated png images. Allows alpha */ -#define QUICKTIME_PNG "png " - -/* Motion JPEG-A. */ -#define QUICKTIME_MJPA "mjpa" - -/* YUV 4:2:2 */ -#define QUICKTIME_YUV2 "yuv2" - -/* 8 bit Packed YUV (video range) 4:2:2 */ -#define QUICKTIME_2VUY "2vuy" - -/* Crazy YUV 4:2:0 configuration for early tests. NOT STANDARD. */ -#define QUICKTIME_YUV4 "yuv4" - -/* The following don't seem to work in Win but are documented. Only use - for intermediate storage since the documentation may be wrong. */ -/* 8 bit Planar YUV 4:2:0 */ -#define QUICKTIME_YUV420 "yv12" - -/* 8 bit Planar YUV 4:1:1 */ -#define QUICKTIME_YUV411 "y411" - -/* 8 bit Packed YUV 4:2:2 */ -#define QUICKTIME_YUV422 "yuv2" - -/* 8 bit Planar YUV 4:4:4 */ -#define QUICKTIME_YUV444 "v308" - -/* 8 bit Planar YUVA 4:4:4:4 */ -#define QUICKTIME_YUVA4444 "v408" - -/* 10 bit Planar YUV 4:4:4 */ -#define QUICKTIME_YUV444_10bit "v410" - -/* ======== compression for which no codec exists ========== */ -/* These are traditionally converted in hardware or not at all */ -/* ======== Studies in different algorithms =============== */ - -/* YUV9. Too horrible to look at. */ -#define QUICKTIME_YUV9 "YVU9" - -/* RTjpeg, proprietary but fast? */ -/* This is theoretically what nipple video uses. May get integrated later. */ -#define QUICKTIME_RTJ0 "RTJ0" - -/* =================== Audio formats ======================= */ - -/* Unsigned 8 bit but it uses the same fourcc as RGB uncompressed */ -#ifndef QUICKTIME_RAW -#define QUICKTIME_RAW "raw " -#endif - -/* IMA4 */ -#define QUICKTIME_IMA4 "ima4" - -/* Twos compliment 8, 16, 24 */ -#define QUICKTIME_TWOS "twos" -#define QUICKTIME_SOWT "sowt" - -/* ulaw */ -#define QUICKTIME_ULAW "ulaw" - -/* OGG Vorbis. NOT STANDARD */ -#define QUICKTIME_VORBIS "OggS" - -/* MP3 Doesn't play in Win for some reason */ -#define QUICKTIME_MP3 ".mp3" - -#define QUICKTIME_MP4A "mp4a" -#define QUICKTIME_QDM2 "QDM2" - -/* Mike Row Soft */ -/* AVI decode only */ -#define QUICKTIME_WMA "WMA " - -/* Some crazy derivative on ima4. NOT STANDARD */ -#define QUICKTIME_WMX2 "wmx2" - -/* =========================== public interface ========================= */ - -/* Get version information */ -int quicktime_major(void); -int quicktime_minor(void); -int quicktime_release(void); - -/* return 1 if the file is a quicktime file */ -int quicktime_check_sig(char *path); - -/* call this first to open the file and create all the objects */ -quicktime_t* quicktime_open(char *filename, int rd, int wr); - -/* After quicktime_open and quicktime_set for the audio and video call this */ -/* to generate a Microsoft AVI file. */ -/* The allmighty requires the codec information in the beginning of the file */ -/* while the index can either be in the beginning or the end. Thus */ -/* You need to set the audio and video first. */ -void quicktime_set_avi(quicktime_t *file, int value); -int quicktime_is_avi(quicktime_t *file); - -/* Another Microsoft file format */ -void quicktime_set_asf(quicktime_t *file, int value); - - -/* make the quicktime file streamable */ -int quicktime_make_streamable(char *in_path, char *out_path); - -/* Set various options in the file. */ -void quicktime_set_copyright(quicktime_t *file, const char *string); -void quicktime_set_name(quicktime_t *file, const char *string); -void quicktime_set_info(quicktime_t *file, const char *string); -char* quicktime_get_copyright(quicktime_t *file); -char* quicktime_get_name(quicktime_t *file); -char* quicktime_get_info(quicktime_t *file); - -/* Read all the information about the file. */ -/* Requires a MOOV atom be present in the file. */ -/* If no MOOV atom exists return 1 else return 0. */ -int quicktime_read_info(quicktime_t *file); - -/* set up tracks in a new file after opening and before writing */ -/* returns the number of quicktime tracks allocated */ -/* audio is stored two channels per quicktime track */ -int quicktime_set_audio(quicktime_t *file, - int channels, - long sample_rate, - int bits, - char *compressor); -/* Samplerate can be set after file is created */ -void quicktime_set_framerate(quicktime_t *file, double framerate); - -/* Set aspect ratio. Only a few codecs support it. */ -void quicktime_set_aspect(quicktime_t *file, double aspect); - -/* video is stored one layer per quicktime track */ -int quicktime_set_video(quicktime_t *file, - int tracks, - int frame_w, - int frame_h, - double frame_rate, - char *compressor); - -/* routines for setting various video parameters */ -/* should be called after set_video */ -void quicktime_set_jpeg(quicktime_t *file, int quality, int use_float); - -/* Configure codec parameters with this */ -/* It iterates through every track and sets the key in that codec to */ -/* the value. The value can be any data type and the key must be a */ -/* string which the codec understands. */ -void quicktime_set_parameter(quicktime_t *file, const char *key, void *value); - -/* Get the english title of a codec based on its fourcc. */ -/* Used by info boxed. */ -char* quicktime_acodec_title(char *fourcc); -char* quicktime_vcodec_title(char *fourcc); - - -/* Set the depth of the track. */ -void quicktime_set_depth(quicktime_t *file, - int depth, - int track); - - -/* close the file and delete all the objects */ -int quicktime_close(quicktime_t *file); - -/* get length information */ -long quicktime_audio_length(quicktime_t *file, int track); -long quicktime_video_length(quicktime_t *file, int track); - -/* get position information */ -long quicktime_audio_position(quicktime_t *file, int track); -long quicktime_video_position(quicktime_t *file, int track); - -/* get file information */ -int quicktime_video_tracks(quicktime_t *file); -int quicktime_audio_tracks(quicktime_t *file); - -int quicktime_has_audio(quicktime_t *file); - -/* Get the samples per second */ -long quicktime_sample_rate(quicktime_t *file, int track); - -/* Get the number of bits for the twos codec */ -int quicktime_audio_bits(quicktime_t *file, int track); - -/* Get the number of audio channels in an audio track */ -int quicktime_track_channels(quicktime_t *file, int track); -char* quicktime_audio_compressor(quicktime_t *file, int track); - -int quicktime_has_video(quicktime_t *file); -int quicktime_video_width(quicktime_t *file, int track); -int quicktime_video_height(quicktime_t *file, int track); - -/* Number of bytes per pixel for the raw codec */ -int quicktime_video_depth(quicktime_t *file, int track); - -/* Frames per second */ -double quicktime_frame_rate(quicktime_t *file, int track); -/* Frames per second as numerator over denominator*/ -int quicktime_frame_rate_n(quicktime_t *file, int track); -int quicktime_frame_rate_d(quicktime_t *file, int track); - -/* FourCC of the video compressor */ -char* quicktime_video_compressor(quicktime_t *file, int track); - -/* number of bytes of raw data in this frame */ -long quicktime_frame_size(quicktime_t *file, long frame, int track); - -/* get the quicktime track and channel that the audio channel belongs to */ -/* channels and tracks start on 0 */ -int quicktime_channel_location(quicktime_t *file, int *quicktime_track, int *quicktime_channel, int channel); - -/* file positioning */ -int quicktime_seek_end(quicktime_t *file); -int quicktime_seek_start(quicktime_t *file); - -/* set position of file descriptor relative to a track */ -int quicktime_set_audio_position(quicktime_t *file, int64_t sample, int track); -int quicktime_set_video_position(quicktime_t *file, int64_t frame, int track); - -/* ========================== Access to raw data follows. */ -/* write data for one quicktime track */ -/* the user must handle conversion to the channels in this track */ -int quicktime_write_audio(quicktime_t *file, char *audio_buffer, long samples,int track); -int quicktime_write_frame(quicktime_t *file, unsigned char *video_buffer, int64_t bytes, int track); - -/* Read an entire chunk. */ -/* read the number of bytes starting at the byte_start in the specified chunk */ -/* You must provide enough space to store the chunk. */ -int quicktime_read_chunk(quicktime_t *file, char *output, int track, int64_t chunk, int64_t byte_start, int64_t byte_len); - -/* read raw data */ -long quicktime_read_audio(quicktime_t *file, char *audio_buffer, long samples, int track); -long quicktime_read_frame(quicktime_t *file, unsigned char *video_buffer, int track); - -/* for reading frame using a library that needs a file descriptor */ -/* Frame caching doesn't work here. */ -int quicktime_read_frame_init(quicktime_t *file, int track); -int quicktime_read_frame_end(quicktime_t *file, int track); - -/* One keyframe table for each track */ -/* Returns -1 if no keyframe exists. In AVI this always returns -1 */ -/* if the frame offset is over 1 Gig. McRowsoft you know. */ -int64_t quicktime_get_keyframe_before(quicktime_t *file, int64_t frame, int track); -int64_t quicktime_get_keyframe_after(quicktime_t *file, int64_t frame, int track); -void quicktime_insert_keyframe(quicktime_t *file, int64_t frame, int track); - -/* Track has keyframes */ -int quicktime_has_keyframes(quicktime_t *file, int track); - -/* ===================== Access to built in codecs follows. */ - -/* If the codec for this track is supported in the library return 1. */ -int quicktime_supported_video(quicktime_t *file, int track); -int quicktime_supported_audio(quicktime_t *file, int track); - - - -/* The codecs can all support RGB in and out. */ -/* To find out if other color models are supported, use these functions. */ -/* Returns 1 if the codec can generate the color model with no conversion */ -int quicktime_reads_cmodel(quicktime_t *file, - int colormodel, - int track); - -/* Returns 1 if the codec can write the color model with no conversion */ -int quicktime_writes_cmodel(quicktime_t *file, - int colormodel, - int track); - - -/* Utilities for direct copy of MPEG-4 */ -int quicktime_mpeg4_is_key(unsigned char *data, long size, char *codec_id); -int quicktime_mpeg4_write_vol(unsigned char *data_start, - int vol_width, - int vol_height, - int time_increment_resolution, - double frame_rate); -int quicktime_mpeg4_has_vol(unsigned char *data); - -/* Direct copy of H264 */ -int quicktime_h264_is_key(unsigned char *data, long size, char *codec_id); - - - - - - - - -/* These should be called right before a decode or encode function */ -/* Set the colormodel for the encoder and decoder interface */ -void quicktime_set_cmodel(quicktime_t *file, int colormodel); - -/* Set row span in bytes for the encoder and decoder interface */ -void quicktime_set_row_span(quicktime_t *file, int row_span); - -/* Set the decoding window for the decoder interface. If the dimensions are */ -/* all -1, no scaling is used. The default is no scaling. */ -void quicktime_set_window(quicktime_t *file, - int in_x, /* Location of input frame to take picture */ - int in_y, - int in_w, - int in_h, - int out_w, /* Dimensions of output frame */ - int out_h); - -/* Encode the frame into a frame buffer. */ -int quicktime_encode_video(quicktime_t *file, - unsigned char **row_pointers, - int track); - -/* Decode a frame */ -long quicktime_decode_video(quicktime_t *file, - unsigned char **row_pointers, - int track); - -/* Get memory used by video decoders. Only counts frame caches. */ -int64_t quicktime_memory_usage(quicktime_t *file); -void quicktime_set_cache_max(quicktime_t *file, int bytes); - -/* Decode or encode audio for a single channel into the buffer. */ -/* Pass a buffer for the _i or the _f argument if you want int16 or float data. */ -/* Notice that encoding requires an array of pointers to each channel. */ -int quicktime_decode_audio(quicktime_t *file, - int16_t *output_i, - float *output_f, - long samples, - int channel); -int quicktime_encode_audio(quicktime_t *file, - int16_t **input_i, - float **input_f, - long samples); - - - - - - - -/* Dump the file structures for the currently opened file. */ -int quicktime_dump(quicktime_t *file); - -/* Specify the number of cpus to utilize. */ -int quicktime_set_cpus(quicktime_t *file, int cpus); - -/* Specify whether to read contiguously or not. */ -/* preload is the number of bytes to read ahead. */ -/* This is no longer functional to the end user but is used to accelerate */ -/* reading the header internally. */ -void quicktime_set_preload(quicktime_t *file, int64_t preload); - -int64_t quicktime_byte_position(quicktime_t *file); - -/* Set frame offset for programme timecode */ -void quicktime_set_frame_start(quicktime_t *file, int64_t value); - - -quicktime_trak_t *quicktime_add_track(quicktime_t *file); -int quicktime_init(quicktime_t *file); -int quicktime_init_audio_map(quicktime_audio_map_t *atrack, quicktime_trak_t *trak); -int quicktime_delete_audio_map(quicktime_audio_map_t *atrack); -int quicktime_init_video_map(quicktime_video_map_t *vtrack, quicktime_trak_t *trak); -int quicktime_delete_video_map(quicktime_video_map_t *vtrack); -int quicktime_delete(quicktime_t *file); -int quicktime_get_timescale(double frame_rate); -int quicktime_update_positions(quicktime_t *file); - -int quicktime_codec_to_id(char *codec); -quicktime_codec_t *quicktime_new_codec(void); -void quicktime_del_codec(quicktime_codec_t *codec); -int new_vcodec(quicktime_video_map_t *vtrack); -int new_acodec(quicktime_audio_map_t *atrack); -int quicktime_init_vcodec(quicktime_video_map_t *vtrack); -int quicktime_init_acodec(quicktime_audio_map_t *atrack); -int quicktime_delete_vcodec(quicktime_video_map_t *vtrack); -int quicktime_delete_acodec(quicktime_audio_map_t *atrack); -int quicktime_flush_acodec(quicktime_t *file,int track); -void quicktime_flush_vcodec(quicktime_t *file,int track); -int64_t quicktime_samples_to_bytes(quicktime_trak_t *track,long samples); -int quicktime_codecs_flush(quicktime_t *file); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/cinelerra-5.0/quicktime/raw.c b/cinelerra-5.0/quicktime/raw.c deleted file mode 100644 index f1c2a134..00000000 --- a/cinelerra-5.0/quicktime/raw.c +++ /dev/null @@ -1,229 +0,0 @@ -#include "colormodels.h" -#include "funcprotos.h" -#include "quicktime.h" -#include "graphics.h" - -typedef struct -{ - unsigned char *temp_frame; /* For changing color models and scaling */ - unsigned char **temp_rows; -} quicktime_raw_codec_t; - - -static void quicktime_delete_codec_raw(quicktime_video_map_t *vtrack) -{ - quicktime_raw_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv; - if(codec->temp_frame) - { - free(codec->temp_frame); - free(codec->temp_rows); - } - free(codec); -} - -static int source_cmodel(quicktime_t *file, int track) -{ - int depth = quicktime_video_depth(file, track); - if(depth == 24) - return BC_RGB888; - else - return BC_ARGB8888; -} - -static int decode(quicktime_t *file, unsigned char **row_pointers, int track) -{ - int result = 0; - quicktime_trak_t *trak = file->vtracks[track].track; - int height = trak->tkhd.track_height; - int width = trak->tkhd.track_width; - long bytes; - int i; - quicktime_raw_codec_t *codec = ((quicktime_codec_t*)file->vtracks[track].codec)->priv; - int cmodel = source_cmodel(file, track); - int use_temp = (cmodel != file->color_model || - file->in_x != 0 || - file->in_y != 0 || - file->in_w != width || - file->in_h != height || - file->out_w != width || - file->out_h != height); - unsigned char *temp_data; - unsigned char **temp_rows = malloc(sizeof(unsigned char*) * height); - - if(use_temp) - { - if(!codec->temp_frame) - { - codec->temp_frame = malloc(cmodel_calculate_datasize(width, - height, - -1, - cmodel)); - } - for(i = 0; i < height; i++) - temp_rows[i] = codec->temp_frame + - cmodel_calculate_pixelsize(cmodel) * width * i; - temp_data = codec->temp_frame; - } - else - { - temp_data = row_pointers[0]; - for(i = 0; i < height; i++) - temp_rows[i] = row_pointers[i]; - } - - -/* Read data */ - quicktime_set_video_position(file, file->vtracks[track].current_position, track); - bytes = quicktime_frame_size(file, file->vtracks[track].current_position, track); - result = !quicktime_read_data(file, (char*)temp_data, bytes); - -/* Convert colormodel */ - if(use_temp) - { - cmodel_transfer(row_pointers, - temp_rows, - row_pointers[0], - row_pointers[1], - row_pointers[2], - 0, - 0, - 0, - file->in_x, - file->in_y, - file->in_w, - file->in_h, - 0, - 0, - file->out_w, - file->out_h, - cmodel, - file->color_model, - 0, - width, - file->out_w); - } - - free(temp_rows); - - return result; -} - -static int encode(quicktime_t *file, - unsigned char **row_pointers, - int track) -{ -// int64_t offset = quicktime_position(file); - quicktime_video_map_t *vtrack = &(file->vtracks[track]); - quicktime_raw_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv; - quicktime_trak_t *trak = vtrack->track; - int i, result; - int height = trak->tkhd.track_height; - int width = trak->tkhd.track_width; - int depth = quicktime_video_depth(file, track); - int dest_cmodel; - quicktime_atom_t chunk_atom; - -//printf("quicktime_encode_raw %llx %llx\n", file->file_position, file->ftell_position); - if(depth == 32) - { - dest_cmodel = BC_ARGB8888; - - } - else - { - dest_cmodel = BC_RGB888; - } - - - - - if(file->color_model != dest_cmodel) - { - if(!codec->temp_frame) - { - int size = cmodel_calculate_datasize(width, height, -1, dest_cmodel); - int row_size = cmodel_calculate_pixelsize(dest_cmodel) * width; - codec->temp_frame = malloc(size); - codec->temp_rows = malloc(sizeof(unsigned char*) * height); - for(i = 0; i < height; i++) - codec->temp_rows[i] = codec->temp_frame + i*row_size; - } - - - - cmodel_transfer(codec->temp_rows, /* Leave NULL if non existent */ - row_pointers, - 0, /* Leave NULL if non existent */ - 0, - 0, - row_pointers[0], /* Leave NULL if non existent */ - row_pointers[1], - row_pointers[2], - 0, /* Dimensions to capture from input frame */ - 0, - width, - height, - 0, /* Dimensions to project on output frame */ - 0, - width, - height, - file->color_model, - dest_cmodel, - 0, /* When transfering BC_RGBA8888 to non-alpha this is the background color in 0xRRGGBB hex */ - width, /* For planar use the luma rowspan */ - width); /* For planar use the luma rowspan */ - - quicktime_write_chunk_header(file, trak, &chunk_atom); - result = !quicktime_write_data(file, (char*)codec->temp_frame, - cmodel_calculate_datasize(width, height, -1, dest_cmodel)); - quicktime_write_chunk_footer(file, trak, - vtrack->current_chunk, &chunk_atom, 1); - } - else - { - quicktime_write_chunk_header(file, trak, &chunk_atom); - result = !quicktime_write_data(file, (char*)row_pointers[0], - cmodel_calculate_datasize(width, height, -1, file->color_model)); - quicktime_write_chunk_footer(file, trak, - vtrack->current_chunk, &chunk_atom, 1); - } - - - vtrack->current_chunk++; - return result; -} - -int quicktime_raw_rows_consecutive(unsigned char **row_pointers, int w, int h, int depth) -{ - int i, result; -/* see if row_pointers are consecutive */ - for(i = 1, result = 1; i < h; i++) - { - if(row_pointers[i] - row_pointers[i - 1] != w * depth) result = 0; - } - return result; -} - -static int reads_colormodel(quicktime_t *file, - int colormodel, - int track) -{ - return (colormodel == BC_RGB888 || - colormodel == BC_BGR8888); -} - -void quicktime_init_codec_raw(quicktime_video_map_t *vtrack) -{ - quicktime_codec_t *codec_base = (quicktime_codec_t*)vtrack->codec; - - codec_base->priv = calloc(1, sizeof(quicktime_raw_codec_t)); - codec_base->delete_vcodec = quicktime_delete_codec_raw; - codec_base->decode_video = decode; - codec_base->encode_video = encode; - codec_base->decode_audio = 0; - codec_base->encode_audio = 0; - codec_base->reads_colormodel = reads_colormodel; - codec_base->fourcc = QUICKTIME_RAW; - codec_base->title = "RGB uncompressed"; - codec_base->desc = "RGB uncompressed"; -} diff --git a/cinelerra-5.0/quicktime/raw.h b/cinelerra-5.0/quicktime/raw.h deleted file mode 100644 index cf914857..00000000 --- a/cinelerra-5.0/quicktime/raw.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef QUICKTIME_RAW_H -#define QUICKTIME_RAW_H - -extern void quicktime_init_codec_raw(quicktime_video_map_t *); - -#endif diff --git a/cinelerra-5.0/quicktime/rawaudio.c b/cinelerra-5.0/quicktime/rawaudio.c deleted file mode 100644 index cff49812..00000000 --- a/cinelerra-5.0/quicktime/rawaudio.c +++ /dev/null @@ -1,215 +0,0 @@ -#include "quicktime.h" -#include "rawaudio.h" -#include - -typedef struct -{ - char *work_buffer; - long buffer_size; -} quicktime_rawaudio_codec_t; - -/* =================================== private for rawaudio */ - -static int is_little_endian(void) -{ - int16_t test = 0x0001; - return *((unsigned char *)&test); -} - -static int get_work_buffer(quicktime_t *file, int track, long bytes) -{ - quicktime_rawaudio_codec_t *codec = ((quicktime_codec_t*)file->atracks[track].codec)->priv; - - if(codec->work_buffer && codec->buffer_size != bytes) { - free(codec->work_buffer); - codec->work_buffer = 0; - } - - if(!codec->work_buffer) { - codec->buffer_size = bytes; - if(!(codec->work_buffer = malloc(bytes))) return 1; - } - return 0; -} - -/* =================================== public for rawaudio */ - -static void quicktime_delete_codec_rawaudio(quicktime_audio_map_t *atrack) -{ - quicktime_rawaudio_codec_t *codec = ((quicktime_codec_t*)atrack->codec)->priv; - - if(codec->work_buffer) free(codec->work_buffer); - codec->work_buffer = 0; - codec->buffer_size = 0; - free(codec); -} - -static int fclip(float f, int mx) -{ - f *= mx; f += f >= 0 ? 0.5f : -0.5f; - return f >= mx ? mx+mx-1 : f < -mx ? 0 : (int)f + mx; -} -static int fclip8 (float f) { return fclip(f,0x80); } -static int fclip16(float f) { return fclip(f,0x8000); } -static int fclip24(float f) { return fclip(f,0x800000); } - -static int rd8be_s16 (uint8_t *bp) { return (bp[0]<<8) - 0x8000; } -static int rd8le_s16 (uint8_t *bp) { return (bp[0]<<8) - 0x8000; } -static int rd16be_s16(uint8_t *bp) { return ((bp[0]<<8) | bp[1]) - 0x8000; } -static int rd16le_s16(uint8_t *bp) { return (bp[0] | (bp[1]<<8)) - 0x8000; } -static int rd24be_s16(uint8_t *bp) { return ((bp[0]<<8) | bp[1]) - 0x8000; } -static int rd24le_s16(uint8_t *bp) { return (bp[1] | (bp[2]<<8)) - 0x8000; } -static float rd8be_flt (uint8_t *bp) { return (float)(bp[0]-0x80)/0x80; } -static float rd8le_flt (uint8_t *bp) { return (float)(bp[0]-0x80)/0x80; } -static float rd16be_flt(uint8_t *bp) { return (float)(((bp[0]<<8) | bp[1])-0x8000)/0x8000; } -static float rd16le_flt(uint8_t *bp) { return (float)((bp[0] | (bp[1]<<8))-0x8000)/0x8000; } -static float rd24be_flt(uint8_t *bp) { return (float)(((bp[0]<<16) | (bp[1]<<8) | bp[2])-0x800000)/0x800000; } -static float rd24le_flt(uint8_t *bp) { return (float)((bp[0] | (bp[1]<<8) | (bp[2]<<16))-0x800000)/0x800000; } - -static void wr8be_s16 (uint8_t *bp, int v) { v+=0x8000; bp[0] = v>>8; } -static void wr8le_s16 (uint8_t *bp, int v) { v+=0x8000; bp[0] = v>>8; } -static void wr16be_s16(uint8_t *bp, int v) { v+=0x8000; bp[0] = v>>8; bp[1] = v; } -static void wr16le_s16(uint8_t *bp, int v) { v+=0x8000; bp[0] = v; bp[1] = v>>8; } -static void wr24be_s16(uint8_t *bp, int v) { v+=0x8000; bp[0] = v>>8; bp[1] = v; bp[2] = 0; } -static void wr24le_s16(uint8_t *bp, int v) { v+=0x8000; bp[0] = 0; bp[1] = v; bp[2] = v>>8; } -static void wr8be_flt (uint8_t *bp, float f) { int v = fclip8(f); bp[0] = v; } -static void wr8le_flt (uint8_t *bp, float f) { int v = fclip8(f); bp[0] = v; } -static void wr16be_flt(uint8_t *bp, float f) { int v = fclip16(f); bp[0] = v>>8; bp[1] = v; } -static void wr16le_flt(uint8_t *bp, float f) { int v = fclip16(f); bp[0] = v; bp[1] = v>>8; } -static void wr24be_flt(uint8_t *bp, float f) { int v = fclip24(f); bp[0] = v>>16; bp[1] = v>>8; bp[2] = v; } -static void wr24le_flt(uint8_t *bp, float f) { int v = fclip24(f); bp[0] = v; bp[1] = v>>8; bp[2] = v>>16; } - -#define rd_samples(typ, fn, out, step) { \ - uint8_t *bp = (uint8_t *)codec->work_buffer + channel*byts; \ - for( i=0; iwork_buffer + j*byts; \ - for( i=0; iatracks[track]); - quicktime_rawaudio_codec_t *codec = ((quicktime_codec_t*)track_map->codec)->priv; - int bits = quicktime_audio_bits(file, track); - int byts = bits/8, channels = file->atracks[track].channels; - int size = channels * byts; - get_work_buffer(file, track, samples * size); - result = !quicktime_read_audio(file, codec->work_buffer, samples, track); - if( result ) return result; -// Undo increment since this is done in codecs.c - track_map->current_position -= samples; - if( !little_endian ) { - if( output_i ) { - switch( byts ) { - case 1: rd_samples(int16_t,rd8be_s16,output_i,size); break; - case 2: rd_samples(int16_t,rd16be_s16,output_i,size); break; - case 3: rd_samples(int16_t,rd24be_s16,output_i,size); break; - } - } - else if( output_f ) { - switch( byts ) { - case 1: rd_samples(float,rd8be_flt,output_f,size); break; - case 2: rd_samples(float,rd16be_flt,output_f,size); break; - case 3: rd_samples(float,rd24be_flt,output_f,size); break; - } - } - } - else { -// Undo increment since this is done in codecs.c - track_map->current_position -= samples; - if( output_i ) { - switch( byts ) { - case 1: rd_samples(int16_t,rd8le_s16,output_i,size); break; - case 2: rd_samples(int16_t,rd16le_s16,output_i,size); break; - case 3: rd_samples(int16_t,rd24le_s16,output_i,size); break; - } - } - else if( output_f ) { - switch( byts ) { - case 1: rd_samples(float,rd8le_flt,output_f,size); break; - case 2: rd_samples(float,rd16le_flt,output_f,size); break; - case 3: rd_samples(float,rd24le_flt,output_f,size); break; - } - } - } -/*printf("quicktime_decode_rawaudio 2\n"); */ - return 0; -} - -static int quicktime_encode_rawaudio(quicktime_t *file, - int16_t **input_i, float **input_f, int track, long samples) -{ - int i, j, result; - int little_endian = is_little_endian(); - quicktime_audio_map_t *track_map = &(file->atracks[track]); - quicktime_rawaudio_codec_t *codec = ((quicktime_codec_t*)track_map->codec)->priv; - int bits = quicktime_audio_bits(file, track); - int byts = bits/8, channels = file->atracks[track].channels; - int size = channels * byts; - get_work_buffer(file, track, samples * size); - - if( !little_endian ) { - if( input_i ) { - switch( byts ) { - case 1: wr_samples(int16_t,wr8be_s16,input_i,size); break; - case 2: wr_samples(int16_t,wr16be_s16,input_i,size); break; - case 3: wr_samples(int16_t,wr24be_s16,input_i,size); break; - } - } - else if( input_f ) { - switch( byts ) { - case 1: wr_samples(float,wr8be_flt,input_f,size); break; - case 2: wr_samples(float,wr16be_flt,input_f,size); break; - case 3: wr_samples(float,wr24be_flt,input_f,size); break; - } - } - } - else { - if( input_i ) { - switch( byts ) { - case 1: wr_samples(int16_t,wr8le_s16,input_i,size); break; - case 2: wr_samples(int16_t,wr16le_s16,input_i,size); break; - case 3: wr_samples(int16_t,wr24le_s16,input_i,size); break; - } - } - else if( input_f ) { - switch( byts ) { - case 1: wr_samples(float,wr8le_flt,input_f,size); break; - case 2: wr_samples(float,wr16le_flt,input_f,size); break; - case 3: wr_samples(float,wr24le_flt,input_f,size); break; - } - } - } - - result = quicktime_write_audio(file, (char *)codec->work_buffer, samples, track); - return result; -} - - -void quicktime_init_codec_rawaudio(quicktime_audio_map_t *atrack) -{ - quicktime_codec_t *codec_base = (quicktime_codec_t*)atrack->codec; -// quicktime_rawaudio_codec_t *codec = codec_base->priv; - -/* Init public items */ - codec_base->priv = calloc(1, sizeof(quicktime_rawaudio_codec_t)); - codec_base->delete_acodec = quicktime_delete_codec_rawaudio; - codec_base->decode_video = 0; - codec_base->encode_video = 0; - codec_base->decode_audio = quicktime_decode_rawaudio; - codec_base->encode_audio = quicktime_encode_rawaudio; - codec_base->fourcc = QUICKTIME_RAW; - codec_base->title = "8 bit unsigned"; - codec_base->desc = "8 bit unsigned for audio"; - codec_base->wav_id = 0x01; -/* Init private items */ -} diff --git a/cinelerra-5.0/quicktime/rawaudio.h b/cinelerra-5.0/quicktime/rawaudio.h deleted file mode 100644 index 43d60b75..00000000 --- a/cinelerra-5.0/quicktime/rawaudio.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef QUICKTIME_RAWAUDIO_H -#define QUICKTIME_RAWAUDIO_H - - -extern void quicktime_init_codec_rawaudio(quicktime_audio_map_t *); - -#endif diff --git a/cinelerra-5.0/quicktime/rechunk.c b/cinelerra-5.0/quicktime/rechunk.c deleted file mode 100644 index 8894e6e4..00000000 --- a/cinelerra-5.0/quicktime/rechunk.c +++ /dev/null @@ -1,125 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" -#include - - -int usage(void) -{ - printf("usage: rechunk [-f framerate] [-w width] [-h height] [-c fourcc] \n"); - printf(" Concatenate input frames into a Quicktime movie.\n"); - exit(1); - return 0; -} - -int main(int argc, char *argv[]) -{ - quicktime_t *file; - FILE *input; - int result = 0; - int i, j; - int64_t length; - char string[1024], *output = 0; - char *data = 0; - int bytes = 0, old_bytes = 0; - float output_rate = 0; - float input_rate; - int64_t input_frame; - int64_t new_length; - int rgb_to_ppm = 0; - char **input_frames = 0; - int total_input_frames = 0; - int width = 720, height = 480; - char compressor[5] = "yv12"; - - if(argc < 3) - { - usage(); - } - - for(i = 1, j = 0; i < argc; i++) - { - if(!strcmp(argv[i], "-f")) - { - if(i + 1 < argc) - { - output_rate = atof(argv[++i]); - } - else - usage(); - } - else - if(!strcmp(argv[i], "-w")) - { - if(i + 1 < argc) - width = atol(argv[++i]); - else - usage(); - } - else - if(!strcmp(argv[i], "-h")) - { - if(i + 1 < argc) - height = atol(argv[++i]); - else - usage(); - } - else - if(!strcmp(argv[i], "-c")) - { - if(i + 1 < argc) - { - strncpy(compressor, argv[++i], 4); - } - else - usage(); - } - if(i == argc - 1) - { - output = argv[i]; - } - else - { - total_input_frames++; - input_frames = realloc(input_frames, sizeof(char*) * total_input_frames); - input_frames[total_input_frames - 1] = argv[i]; - } - } - - if(!input) usage(); - - if(input = fopen(output, "rb")) - { - printf("Output file already exists.\n"); - exit(1); - } - - if(!(file = quicktime_open(output, 0, 1))) - { - printf("Open failed\n"); - exit(1); - } - - quicktime_set_video(file, 1, width, height, output_rate, compressor); - - for(i = 0; i < total_input_frames; i++) - { -/* Get output file */ - if(!(input = fopen(input_frames[i], "rb"))) - { - perror("Open failed"); - continue; - } - -/* Get input frame */ - fseek(input, 0, SEEK_END); - bytes = ftell(input); - fseek(input, 0, SEEK_SET); - data = realloc(data, bytes); - - fread(data, bytes, 1, input); - quicktime_write_frame(file, data, bytes, 0); - fclose(input); - } - - quicktime_close(file); -} diff --git a/cinelerra-5.0/quicktime/recover.c b/cinelerra-5.0/quicktime/recover.c deleted file mode 100644 index 57f54630..00000000 --- a/cinelerra-5.0/quicktime/recover.c +++ /dev/null @@ -1,755 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" - -#include -#include -#include -#include -#include -#include - - - - - - - - - -#define FSEEK fseeko64 - - -//#define WIDTH 720 -//#define HEIGHT 480 -#define WIDTH 960 -#define HEIGHT 540 -#define FRAMERATE (double)30000/1001 -//#define FRAMERATE (double)30 -#define STARTING_OFFSET 0x28 - -#define CHANNELS 1 -#define SAMPLERATE 48000 -#define AUDIO_CHUNK 2048 -#define BITS 24 -#define TEMP_FILE "/tmp/temp.mov" - -// Output files -#define AUDIO_FILE "/tmp/audio.pcm" -#define VIDEO_FILE "/tmp/video.mov" -//#define VCODEC QUICKTIME_MJPA -//#define VCODEC QUICKTIME_JPEG - - -// Only 1 variation of this, recorded by 1 camcorder -#define VCODEC QUICKTIME_H264 -// H264 rendered by Cinelerra -#define USE_X264 - -#define ACODEC QUICKTIME_MP4A - -//#define READ_ONLY - - -#define SEARCH_FRAGMENT (int64_t)0x100000 -//#define SEARCH_PAD 8 -#define SEARCH_PAD 16 - - -#define GOT_NOTHING 0 -#define IN_FIELD1 1 -#define GOT_FIELD1 2 -#define IN_FIELD2 3 -#define GOT_FIELD2 4 -#define GOT_AUDIO 5 -#define GOT_IMAGE_START 6 -#define GOT_IMAGE_END 7 - - - -#ifdef USE_X264 -unsigned char h264_desc[] = -{ - - 0x01, 0x4d, 0x40, 0x1f, 0xff, 0xe1, 0x00, 0x16, 0x67, 0x4d, 0x40, 0x33, 0x9a, - 0x74, 0x07, 0x80, 0x8b, 0xf7, 0x08, 0x00, 0x00, 0x1f, 0x48, 0x00, 0x07, 0x53, 0x04, - 0x78, 0xc1, 0x95, 0x01, 0x00, 0x04, 0x68, 0xee, 0x1f, 0x20 - -}; - -#else - -// H264 description for cheap camcorder format -unsigned char h264_desc[] = -{ - 0x01, 0x4d, 0x00, 0x28, 0xff, 0xe1, 0x00, 0x30, 0x27, 0x4d, 0x00, 0x28, - 0x9a, 0x62, 0x80, 0xa0, 0x0b, 0x76, 0x02, 0x20, 0x00, 0x00, 0x7d, 0x20, - 0x00, 0x1d, 0x4c, 0x1d, 0x0c, 0x00, 0x26, 0x26, 0x00, 0x02, 0xae, 0xa9, - 0x77, 0x97, 0x1a, 0x18, 0x00, 0x4c, 0x4c, 0x00, 0x05, 0x5d, 0x52, 0xef, - 0x2e, 0x1f, 0x08, 0x84, 0x51, 0xe0, 0x00, 0x00, 0x01, 0x00, 0x04, 0x28, - 0xee, 0x3c, 0x80 -}; - -#endif - -// Table utilities -#define NEW_TABLE(ptr, size, allocation) \ -{ \ - (ptr) = 0; \ - (size) = 0; \ - (allocation) = 0; \ -} - -#define APPEND_TABLE(ptr, size, allocation, value) \ -{ \ - if((allocation) <= (size)) \ - { \ - if(!(allocation)) \ - (allocation) = 1024; \ - else \ - (allocation) *= 2; \ - int64_t *new_table = calloc(1, sizeof(int64_t) * (allocation)); \ - memcpy(new_table, (ptr), sizeof(int64_t) * (size)); \ - free((ptr)); \ - (ptr) = new_table; \ - } \ - (ptr)[(size)] = (value); \ - (size)++; \ -} - -int get_h264_size(unsigned char *frame_buffer, int frame_size) -{ - int result = frame_size; - int offset = 0; - -// walk NAL codes - while(offset < frame_size) - { - int nal_size = ((frame_buffer[offset + 0] << 24) | - (frame_buffer[offset + 1] << 16) | - (frame_buffer[offset + 2] << 8) | - (frame_buffer[offset + 3])) + 4; -//printf("get_h264_size %d %d %d\n", __LINE__, offset, nal_size); - if(nal_size <= 0 || nal_size + offset >= frame_size) - { - return offset; - } - - offset += nal_size; - } - - return result; -} - - -int main(int argc, char *argv[]) -{ - FILE *in = 0; - FILE *temp = 0; - FILE *audio_out = 0; -// quicktime_t *out; - quicktime_t *video_out; - int64_t current_byte, ftell_byte; - int64_t jpeg_end; - int64_t audio_start = 0, audio_end = 0; - unsigned char *search_buffer = calloc(1, SEARCH_FRAGMENT); - unsigned char *frame_buffer = calloc(1, SEARCH_FRAGMENT); - unsigned char *copy_buffer = 0; - int i; - int64_t file_size; - struct stat status; - unsigned char data[8]; - struct stat ostat; - int fields = 1; - int is_h264 = 0; - int is_keyframe = 0; - int next_is_keyframe = 0; - time_t current_time = time(0); - time_t prev_time = 0; - int jpeg_header_offset; - int64_t field1_offset = 0; - int64_t field2_offset = 0; - int64_t image_start = STARTING_OFFSET; - int64_t image_end = STARTING_OFFSET; - int update_time = 0; - int state = GOT_NOTHING; - char *in_path; - int audio_frame; - int total_samples; - int field; - -// Value taken from Cinelerra preferences - int audio_chunk = AUDIO_CHUNK; - - - int64_t *start_table; - int start_size; - int start_allocation; - int64_t *end_table; - int end_size; - int end_allocation; - int64_t *field_table; - int64_t field_size; - int64_t field_allocation; - -// Dump codec settings - printf("Codec settings:\n" - " WIDTH=%d HEIGHT=%d\n" - " FRAMERATE=%.2f\n" - " CHANNELS=%d\n" - " SAMPLERATE=%d\n" - " BITS=%d\n" - " AUDIO CHUNK=%d\n" - " VCODEC=\"%s\"\n" - " ACODEC=\"%s\"\n", - WIDTH, - HEIGHT, - FRAMERATE, - CHANNELS, - SAMPLERATE, - BITS, - audio_chunk, - VCODEC, - ACODEC); -#ifdef READ_ONLY - printf(" READ ONLY\n"); -#endif - - if(argc < 2) - { - printf("Recover JPEG and PCM audio in a corrupted movie.\n" - "Usage: recover [options] \n" - "Options:\n" - " -b samples number of samples in an audio chunk (%d)\n" - "\n", - audio_chunk); - exit(1); - } - - for(i = 1; i < argc; i++) - { - if(!strcmp(argv[i], "-b")) - { - if(i + 1 < argc) - { - audio_chunk = atol(argv[i + 1]); - i++; - if(audio_chunk <= 0) - { - printf("Sample count for -b is out of range.\n"); - exit(1); - } - } - else - { - printf("-b needs a sample count.\n"); - exit(1); - } - } - else - { - in_path = argv[i]; - } - } - - -// Get the field count - if(!memcmp(VCODEC, QUICKTIME_MJPA, 4)) - { - fields = 2; - } - else - { - fields = 1; - } - - if(!memcmp(VCODEC, QUICKTIME_H264, 4)) - { - -#ifdef USE_X264 - printf(" X264\n"); -#endif - is_h264 = 1; - } - - - - in = fopen(in_path, "rb+"); - if(!in) - { - perror("open input"); - exit(1); - } - - fseek(in, STARTING_OFFSET, SEEK_SET); - - - -#ifndef READ_ONLY -// out = quicktime_open(TEMP_FILE, 0, 1); -// if(!out) -// { -// perror("open temp"); -// exit(1); -// } - -// quicktime_set_audio(out, -// CHANNELS, -// SAMPLERATE, -// BITS, -// QUICKTIME_TWOS); -// quicktime_set_video(out, -// 1, -// WIDTH, -// HEIGHT, -// FRAMERATE, -// VCODEC); - - audio_out = fopen(AUDIO_FILE, "w"); - if(!audio_out) - { - perror("open audio output"); - exit(1); - } - - video_out = quicktime_open(VIDEO_FILE, 0, 1); - - if(!video_out) - { - perror("open video out"); - exit(1); - } - - quicktime_set_video(video_out, - 1, - WIDTH, - HEIGHT, - FRAMERATE, - VCODEC); - quicktime_set_audio(video_out, - CHANNELS, - SAMPLERATE, - BITS, - ACODEC); - - - if(is_h264) - { - quicktime_video_map_t *vtrack = &(video_out->vtracks[0]); - quicktime_trak_t *trak = vtrack->track; - quicktime_avcc_t *avcc = &trak->mdia.minf.stbl.stsd.table[0].avcc; - quicktime_set_avcc_header(avcc, - h264_desc, - sizeof(h264_desc)); - } - -#endif - - audio_start = (int64_t)0x10; - ftell_byte = STARTING_OFFSET; - - if(fstat(fileno(in), &status)) - perror("get_file_length fstat:"); - file_size = status.st_size; - - - NEW_TABLE(start_table, start_size, start_allocation) - NEW_TABLE(end_table, end_size, end_allocation) - NEW_TABLE(field_table, field_size, field_allocation) - - - - audio_frame = BITS * CHANNELS / 8; - -// Tabulate the start and end of all the JPEG images. -// This search is intended to be as simple as possible, reserving more -// complicated operations for a table pass. -//printf("Pass 1 video only.\n"); - while(ftell_byte < file_size) - { - current_byte = ftell_byte; - fread(search_buffer, SEARCH_FRAGMENT, 1, in); - ftell_byte = current_byte + SEARCH_FRAGMENT - SEARCH_PAD; - FSEEK(in, ftell_byte, SEEK_SET); - - for(i = 0; i < SEARCH_FRAGMENT - SEARCH_PAD; i++) - { -// Search for image start - if(state == GOT_NOTHING) - { - if(is_h264) - { -#ifdef USE_X264 - if(search_buffer[i] == 0x00 && - search_buffer[i + 1] == 0x00 && - search_buffer[i + 4] == 0x06 && - search_buffer[i + 5] == 0x05) - { -//printf("main %d\n", __LINE__); - state = GOT_IMAGE_START; - image_end = current_byte + i; - is_keyframe = next_is_keyframe; - next_is_keyframe = 1; - } - else - if(search_buffer[i] == 0x00 && - search_buffer[i + 1] == 0x00 && - search_buffer[i + 4] == 0x41 && - search_buffer[i + 5] == 0x9a) - { -//printf("main %d\n", __LINE__); - state = GOT_IMAGE_START; - image_end = current_byte + i; - is_keyframe = next_is_keyframe; - next_is_keyframe = 0; - } - - if(state == GOT_IMAGE_START) - { -// end of previous frame - if(start_size > 0) - { - APPEND_TABLE(end_table, end_size, end_allocation, image_end) -// Copy frame - int frame_size = image_end - image_start; - FSEEK(in, image_start, SEEK_SET); - fread(frame_buffer, frame_size, 1, in); - FSEEK(in, ftell_byte, SEEK_SET); - quicktime_write_frame(video_out, - frame_buffer, - frame_size, - 0); - if(is_keyframe) - { - quicktime_video_map_t *vtrack = &(video_out->vtracks[0]); - quicktime_insert_keyframe(video_out, - vtrack->current_position - 1, - 0); - } - image_start = image_end; - } -// start of next frame - APPEND_TABLE(start_table, start_size, start_allocation, image_start) - state = GOT_NOTHING; - - - } - -#else // USE_X264 - if(search_buffer[i] == 0x00 && - search_buffer[i + 1] == 0x00 && - search_buffer[i + 2] == 0x00 && - search_buffer[i + 3] == 0x02 && - search_buffer[i + 4] == 0x09) - { - state = GOT_IMAGE_START; - image_start = current_byte + i; - if(search_buffer[i + 5] == 0x10) - is_keyframe = 1; - else - is_keyframe = 0; - } -#endif // !USE_X264 - } - else - if(search_buffer[i] == 0xff && - search_buffer[i + 1] == 0xd8 && - search_buffer[i + 2] == 0xff && - search_buffer[i + 3] == 0xe1 && - search_buffer[i + 10] == 'm' && - search_buffer[i + 11] == 'j' && - search_buffer[i + 12] == 'p' && - search_buffer[i + 13] == 'g') - { - state = GOT_IMAGE_START; - image_start = current_byte + i; - -// Determine the field - if(fields == 2) - { -// Next field offset is nonzero in first field - if(search_buffer[i + 22] != 0 || - search_buffer[i + 23] != 0 || - search_buffer[i + 24] != 0 || - search_buffer[i + 25] != 0) - { - field = 0; - } - else - { - field = 1; - } - APPEND_TABLE(field_table, field_size, field_allocation, field) - } - } - else - if(search_buffer[i] == 0xff && - search_buffer[i + 1] == 0xd8 && - search_buffer[i + 2] == 0xff && - search_buffer[i + 3] == 0xe0 && - search_buffer[i + 6] == 'J' && - search_buffer[i + 7] == 'F' && - search_buffer[i + 8] == 'I' && - search_buffer[i + 9] == 'F') - { - state = GOT_IMAGE_START; - image_start = current_byte + i; - } - } - else -// Search for image end - if(state == GOT_IMAGE_START) - { - if(is_h264) - { -// got next frame & end of previous frame or previous audio -// search 1 byte ahead so the loop doesn't skip the next frame - if(search_buffer[i + 1] == 0x00 && - search_buffer[i + 2] == 0x00 && - search_buffer[i + 3] == 0x00 && - search_buffer[i + 4] == 0x02 && - search_buffer[i + 5] == 0x09) - { - state = GOT_NOTHING; - image_end = current_byte + i + 1; - -// Read entire frame & get length from NAL codes - if(image_end - image_start <= SEARCH_FRAGMENT) - { - int frame_size = image_end - image_start; - FSEEK(in, image_start, SEEK_SET); - fread(frame_buffer, frame_size, 1, in); - FSEEK(in, ftell_byte, SEEK_SET); - - int new_frame_size = get_h264_size(frame_buffer, frame_size); -/* - * printf("%d: image_start=%lx image_end=%lx new_frame_size=%x\n", - * __LINE__, - * image_start, - * image_end, - * new_frame_size); - */ - - image_end = image_start + new_frame_size; - -//printf("%d: image_start=0x%lx image_size=0x%x\n", __LINE__, image_start, new_frame_size); - } - else - { - printf("%d: Possibly lost image between %llx and %llx\n", - __LINE__, - image_start, - image_end); - } - - - APPEND_TABLE(start_table, start_size, start_allocation, image_start) - APPEND_TABLE(end_table, end_size, end_allocation, image_end) - -#ifndef READ_ONLY -// Write frame - quicktime_write_frame(video_out, - frame_buffer, - image_end - image_start, - 0); - if(is_keyframe) - { - quicktime_video_map_t *vtrack = &(video_out->vtracks[0]); - quicktime_insert_keyframe(video_out, - vtrack->current_position - 1, - 0); - } - -// Write audio - if(start_size > 1) - { - int64_t next_frame_start = start_table[start_size - 1]; - int64_t prev_frame_end = end_table[start_size - 2]; - int audio_size = next_frame_start - prev_frame_end; - if(audio_size > SEARCH_FRAGMENT) - audio_size = SEARCH_FRAGMENT; - FSEEK(in, prev_frame_end, SEEK_SET); - fread(frame_buffer, audio_size, 1, in); - FSEEK(in, ftell_byte, SEEK_SET); -// fwrite(frame_buffer, audio_size, 1, audio_out); - - quicktime_write_vbr_frame(video_out, - 0, - frame_buffer, - audio_size, - audio_chunk); - } -#endif - } - } - else - if(search_buffer[i] == 0xff && - search_buffer[i + 1] == 0xd9) - { -// ffd9 sometimes occurs inside the mjpg tag - if(current_byte + i - image_start > 0x2a) - { - state = GOT_NOTHING; -// Put it in the table - image_end = current_byte + i + 2; - -// An image may have been lost due to encoding errors but we can't do anything -// because the audio may by misaligned. Use the extract utility to get the audio. - if(image_end - image_start > audio_chunk * audio_frame) - { - printf("%d: Possibly lost image between %llx and %llx\n", - __LINE__, - image_start, - image_end); -// Put in fake image -/* - * APPEND_TABLE(start_table, start_size, start_allocation, image_start) - * APPEND_TABLE(end_table, end_size, end_allocation, image_start + 1024) - * APPEND_TABLE(start_table, start_size, start_allocation, image_end - 1024) - * APPEND_TABLE(end_table, end_size, end_allocation, image_end) - */ - } - - APPEND_TABLE(start_table, start_size, start_allocation, image_start) - APPEND_TABLE(end_table, end_size, end_allocation, image_end) - - int frame_size = image_end - image_start; - FSEEK(in, image_start, SEEK_SET); - fread(frame_buffer, frame_size, 1, in); - FSEEK(in, ftell_byte, SEEK_SET); - quicktime_write_frame(video_out, - frame_buffer, - image_end - image_start, - 0); - - -//printf("%d %llx - %llx\n", start_size, image_start, image_end - image_start); - -if(!(start_size % 100)) -{ -printf("Got %d frames. %d%%\r", -start_size, -current_byte * (int64_t)100 / file_size); -fflush(stdout); -} - } - } - } - } - } - - - - -// With the image table complete, -// write chunk table from the gaps in the image table -// printf("Pass 2 audio table.\n"); -// total_samples = 0; -// for(i = 1; i < start_size; i++) -// { -// int64_t next_image_start = start_table[i]; -// int64_t prev_image_end = end_table[i - 1]; -// -// // Got a chunk -// if(next_image_start - prev_image_end >= audio_chunk * audio_frame) -// { -// long samples = (next_image_start - prev_image_end) / audio_frame; -// quicktime_atom_t chunk_atom; -// -// quicktime_set_position(out, prev_image_end); -// quicktime_write_chunk_header(out, -// out->atracks[0].track, -// &chunk_atom); -// quicktime_set_position(out, next_image_start); -// quicktime_write_chunk_footer(out, -// out->atracks[0].track, -// out->atracks[0].current_chunk, -// &chunk_atom, -// samples); -// out->atracks[0].current_position += samples; -// out->atracks[0].current_chunk++; -// total_samples += samples; -// } -// } -// -// -// -// -// -// // Put image table in movie -// printf("Got %d frames %d samples total.\n", start_size, total_samples); -// for(i = 0; i < start_size - fields; i += fields) -// { -// // Got a field out of order. Skip just 1 image instead of 2. -// if(fields == 2 && field_table[i] != 0) -// { -// printf("Got field out of order at 0x%llx\n", start_table[i]); -// i--; -// } -// else -// { -// quicktime_atom_t chunk_atom; -// quicktime_set_position(out, start_table[i]); -// quicktime_write_chunk_header(out, -// out->vtracks[0].track, -// &chunk_atom); -// quicktime_set_position(out, end_table[i + fields - 1]); -// quicktime_write_chunk_footer(out, -// out->vtracks[0].track, -// out->vtracks[0].current_chunk, -// &chunk_atom, -// 1); -// out->vtracks[0].current_position++; -// out->vtracks[0].current_chunk++; -// } -// } -// -// -// -// -// -// -// -// // Force header out at beginning of temp file -// quicktime_set_position(out, 0x10); -// quicktime_close(out); -// -// // Transfer header -// FSEEK(in, 0x8, SEEK_SET); -// -// data[0] = (ftell_byte & 0xff00000000000000LL) >> 56; -// data[1] = (ftell_byte & 0xff000000000000LL) >> 48; -// data[2] = (ftell_byte & 0xff0000000000LL) >> 40; -// data[3] = (ftell_byte & 0xff00000000LL) >> 32; -// data[4] = (ftell_byte & 0xff000000LL) >> 24; -// data[5] = (ftell_byte & 0xff0000LL) >> 16; -// data[6] = (ftell_byte & 0xff00LL) >> 8; -// data[7] = ftell_byte & 0xff; -// fwrite(data, 8, 1, in); -// -// FSEEK(in, ftell_byte, SEEK_SET); -// stat(TEMP_FILE, &ostat); -// -// temp = fopen(TEMP_FILE, "rb"); -// FSEEK(temp, 0x10, SEEK_SET); -// -// copy_buffer = calloc(1, ostat.st_size); -// fread(copy_buffer, ostat.st_size, 1, temp); -// fclose(temp); -// -// // Enable to alter the original file -// printf("%d: writing header to file\n", __LINE__); -// fwrite(copy_buffer, ostat.st_size, 1, in); - - - fclose(in); - -#ifndef READ_ONLY - quicktime_close(video_out); - fclose(audio_out); -#endif - -} - - - - diff --git a/cinelerra-5.0/quicktime/rle.c b/cinelerra-5.0/quicktime/rle.c deleted file mode 100644 index 5c564125..00000000 --- a/cinelerra-5.0/quicktime/rle.c +++ /dev/null @@ -1,231 +0,0 @@ -/* RLE codec */ - -#include "colormodels.h" -#include "funcprotos.h" -#include "quicktime.h" - - -typedef struct -{ - unsigned char *work_buffer; - int buffer_size; - unsigned char *output_temp; -} quicktime_rle_codec_t; - - -static void delete_codec(quicktime_video_map_t *vtrack) -{ - quicktime_rle_codec_t *codec; - codec = ((quicktime_codec_t*)vtrack->codec)->priv; - if(codec->work_buffer) free(codec->work_buffer); - if(codec->output_temp) free(codec->output_temp); - free(codec); -} - -static int reads_colormodel(quicktime_t *file, - int colormodel, - int track) -{ - return (colormodel == BC_RGB888); -} - -static int source_cmodel(quicktime_t *file, int track) -{ - int depth = quicktime_video_depth(file, track); - if(depth == 24) - return BC_RGB888; - else - return BC_ARGB8888; -} - - - -static int decode(quicktime_t *file, unsigned char **row_pointers, int track) -{ - quicktime_video_map_t *vtrack = &(file->vtracks[track]); - quicktime_trak_t *trak = vtrack->track; - quicktime_rle_codec_t *codec = ((quicktime_codec_t*)vtrack->codec)->priv; - int depth = quicktime_video_depth(file, track); - int width = trak->tkhd.track_width; - int height = trak->tkhd.track_height; - int size; - unsigned char *ptr; - int start_line; - int total_lines; - int header; - int row_bytes; - int pixel_size; - unsigned char *row_ptr; - unsigned char *pixel; - unsigned char *buffer_end; - int code; - int r, g, b, i; - int need_temp; - unsigned char **temp_rows = malloc(sizeof(unsigned char*) * height); - int cmodel = source_cmodel(file, track); - int skip; - - quicktime_set_video_position(file, vtrack->current_position, track); - size = quicktime_frame_size(file, vtrack->current_position, track); - row_bytes = depth / 8 * width; - pixel_size = depth / 8; - - if(size <= 8) return 0; - if(codec->buffer_size < size && codec->work_buffer) - { - free(codec->work_buffer); - codec->work_buffer = 0; - } - if(!codec->work_buffer) - { - codec->work_buffer = malloc(size); - codec->buffer_size = size; - } - - quicktime_read_data(file, (char*)codec->work_buffer, size); - ptr = codec->work_buffer; - buffer_end = ptr + size; - -// Chunk size - ptr += 4; - -// Header - header = (ptr[0] << 8) | ptr[1]; - ptr += 2; - -// Incremental change - if(header & 0x0008) - { - start_line = (ptr[0] << 8) | ptr[1]; - ptr += 4; - total_lines = (ptr[0] << 8) | ptr[1]; - ptr += 4; - } - else -// Keyframe - { - start_line = 0; - total_lines = height; - } - - - if(cmodel != file->color_model || - file->in_x != 0 || - file->in_y != 0 || - file->in_w != width || - file->in_h != height || - file->out_w != width || - file->out_h != height) - need_temp = 1; - - if(need_temp) - { - if(!codec->output_temp) - codec->output_temp = calloc(1, height * row_bytes); - row_ptr = codec->output_temp + start_line * row_bytes; - for(i = 0; i < height; i++) - temp_rows[i] = codec->output_temp + i * row_bytes; - } - else - { - row_ptr = row_pointers[start_line]; - for(i = 0; i < height; i++) - temp_rows[i] = row_pointers[i]; - } - - switch(depth) - { - case 24: - while(total_lines--) - { - skip = *ptr++; - pixel = row_ptr + (skip - 1) * pixel_size; - - while(ptr < buffer_end && - (code = (char)*ptr++) != -1) - { - if(code == 0) - { -// Skip code - pixel += (*ptr++ - 1) * pixel_size; - } - else -// Run length encoded - if(code < 0) - { - code *= -1; - r = *ptr++; - g = *ptr++; - b = *ptr++; - while(code--) - { - *pixel++ = r; - *pixel++ = g; - *pixel++ = b; - } - } - else -// Uncompressed - { - while(code--) - { - *pixel++ = *ptr++; - *pixel++ = *ptr++; - *pixel++ = *ptr++; - } - } - } - - - row_ptr += row_bytes; - } - break; - } - - - if(need_temp) - { - cmodel_transfer(row_pointers, - temp_rows, - row_pointers[0], - row_pointers[1], - row_pointers[2], - 0, - 0, - 0, - file->in_x, - file->in_y, - file->in_w, - file->in_h, - 0, - 0, - file->out_w, - file->out_h, - cmodel, - file->color_model, - 0, - width, - file->out_w); - } - - free(temp_rows); - - return 0; -} - - - -void quicktime_init_codec_rle(quicktime_video_map_t *vtrack) -{ - quicktime_codec_t *codec_base = (quicktime_codec_t*)vtrack->codec; -// quicktime_rle_codec_t *codec = (quicktime_rle_codec_t*)codec_base->priv; - codec_base->priv = calloc(1, sizeof(quicktime_rle_codec_t)); - codec_base->delete_vcodec = delete_codec; - codec_base->decode_video = decode; - codec_base->reads_colormodel = reads_colormodel; - codec_base->fourcc = QUICKTIME_RLE; - codec_base->title = "RLE"; - codec_base->desc = "Run length encoding"; - -} - diff --git a/cinelerra-5.0/quicktime/rle.h b/cinelerra-5.0/quicktime/rle.h deleted file mode 100644 index 0aade6f7..00000000 --- a/cinelerra-5.0/quicktime/rle.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef QUICKTIME_RLE_H -#define QUICKTIME_RLE_H - - - -extern void quicktime_init_codec_rle(quicktime_video_map_t *); - - - -#endif diff --git a/cinelerra-5.0/quicktime/smhd.c b/cinelerra-5.0/quicktime/smhd.c deleted file mode 100644 index 14e0b54f..00000000 --- a/cinelerra-5.0/quicktime/smhd.c +++ /dev/null @@ -1,47 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" - - - - -void quicktime_smhd_init(quicktime_smhd_t *smhd) -{ - smhd->version = 0; - smhd->flags = 0; - smhd->balance = 0; - smhd->reserved = 0; -} - -void quicktime_smhd_delete(quicktime_smhd_t *smhd) -{ -} - -void quicktime_smhd_dump(quicktime_smhd_t *smhd) -{ - printf(" sound media header\n"); - printf(" version %d\n", smhd->version); - printf(" flags %ld\n", smhd->flags); - printf(" balance %d\n", smhd->balance); - printf(" reserved %d\n", smhd->reserved); -} - -void quicktime_read_smhd(quicktime_t *file, quicktime_smhd_t *smhd) -{ - smhd->version = quicktime_read_char(file); - smhd->flags = quicktime_read_int24(file); - smhd->balance = quicktime_read_int16(file); - smhd->reserved = quicktime_read_int16(file); -} - -void quicktime_write_smhd(quicktime_t *file, quicktime_smhd_t *smhd) -{ - quicktime_atom_t atom; - quicktime_atom_write_header(file, &atom, "smhd"); - - quicktime_write_char(file, smhd->version); - quicktime_write_int24(file, smhd->flags); - quicktime_write_int16(file, smhd->balance); - quicktime_write_int16(file, smhd->reserved); - - quicktime_atom_write_footer(file, &atom); -} diff --git a/cinelerra-5.0/quicktime/stbl.c b/cinelerra-5.0/quicktime/stbl.c deleted file mode 100644 index a89e8166..00000000 --- a/cinelerra-5.0/quicktime/stbl.c +++ /dev/null @@ -1,142 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" - -void quicktime_stbl_init(quicktime_stbl_t *stbl) -{ - stbl->version = 0; - stbl->flags = 0; - quicktime_stsd_init(&(stbl->stsd)); - quicktime_stts_init(&(stbl->stts)); - quicktime_stss_init(&(stbl->stss)); - quicktime_stsc_init(&(stbl->stsc)); - quicktime_stsz_init(&(stbl->stsz)); - quicktime_stco_init(&(stbl->stco)); -} - -void quicktime_stbl_init_video(quicktime_t *file, - quicktime_stbl_t *stbl, - int frame_w, - int frame_h, - int time_scale, - float frame_rate, - char *compressor) -{ -//printf("quicktime_stbl_init_video 1\n"); - quicktime_stsd_init_video(file, &(stbl->stsd), frame_w, frame_h, frame_rate, compressor); -//printf("quicktime_stbl_init_video 1 %d %f\n", time_scale, frame_rate); - quicktime_stts_init_video(file, &(stbl->stts), time_scale, frame_rate); -//printf("quicktime_stbl_init_video 1\n"); - quicktime_stsc_init_video(file, &(stbl->stsc)); -//printf("quicktime_stbl_init_video 1\n"); - quicktime_stsz_init_video(file, &(stbl->stsz)); -//printf("quicktime_stbl_init_video 1\n"); - quicktime_stco_init_common(file, &(stbl->stco)); -//printf("quicktime_stbl_init_video 2\n"); -} - - -void quicktime_stbl_init_audio(quicktime_t *file, - quicktime_stbl_t *stbl, - int channels, - int sample_rate, - int bits, - char *compressor) -{ - quicktime_stsd_init_audio(file, &(stbl->stsd), - channels, - sample_rate, - bits, - compressor); - quicktime_stts_init_audio(file, &(stbl->stts), sample_rate); - quicktime_stsc_init_audio(file, &(stbl->stsc), sample_rate); - quicktime_stsz_init_audio(file, &(stbl->stsz), channels, bits, compressor); - quicktime_stco_init_common(file, &(stbl->stco)); -} - -void quicktime_stbl_delete(quicktime_stbl_t *stbl) -{ - quicktime_stsd_delete(&(stbl->stsd)); - quicktime_stts_delete(&(stbl->stts)); - quicktime_stss_delete(&(stbl->stss)); - quicktime_stsc_delete(&(stbl->stsc)); - quicktime_stsz_delete(&(stbl->stsz)); - quicktime_stco_delete(&(stbl->stco)); -} - -void quicktime_stbl_dump(void *minf_ptr, quicktime_stbl_t *stbl) -{ - printf(" sample table\n"); - quicktime_stsd_dump(minf_ptr, &(stbl->stsd)); - quicktime_stts_dump(&(stbl->stts)); - quicktime_stss_dump(&(stbl->stss)); - quicktime_stsc_dump(&(stbl->stsc)); - quicktime_stsz_dump(&(stbl->stsz)); - quicktime_stco_dump(&(stbl->stco)); -} - -int quicktime_read_stbl(quicktime_t *file, quicktime_minf_t *minf, quicktime_stbl_t *stbl, quicktime_atom_t *parent_atom) -{ - quicktime_atom_t leaf_atom; - - do - { - quicktime_atom_read_header(file, &leaf_atom); - -//printf("quicktime_read_stbl 1\n"); -/* mandatory */ - if(quicktime_atom_is(&leaf_atom, "stsd")) - { - quicktime_read_stsd(file, minf, &(stbl->stsd)); -/* Some codecs store extra information at the end of this */ - quicktime_atom_skip(file, &leaf_atom); - } - else - if(quicktime_atom_is(&leaf_atom, "stts")) - { quicktime_read_stts(file, &(stbl->stts)); } - else - if(quicktime_atom_is(&leaf_atom, "stss")) - { quicktime_read_stss(file, &(stbl->stss)); } - else - if(quicktime_atom_is(&leaf_atom, "stsc")) - { - quicktime_read_stsc(file, &(stbl->stsc)); -/* - * Minolta DimageZ3 pads stsc with zeroes - * so we need to jump to next atom explicitly - */ - quicktime_atom_skip(file, &leaf_atom); - } - else - if(quicktime_atom_is(&leaf_atom, "stsz")) - { quicktime_read_stsz(file, &(stbl->stsz)); } - else - if(quicktime_atom_is(&leaf_atom, "co64")) - { quicktime_read_stco64(file, &(stbl->stco)); } - else - if(quicktime_atom_is(&leaf_atom, "stco")) - { quicktime_read_stco(file, &(stbl->stco)); } - else - { - quicktime_atom_skip(file, &leaf_atom); - } - }while(quicktime_position(file) < parent_atom->end); - - return 0; -} - -void quicktime_write_stbl(quicktime_t *file, quicktime_minf_t *minf, quicktime_stbl_t *stbl) -{ - quicktime_atom_t atom; - quicktime_atom_write_header(file, &atom, "stbl"); - - quicktime_write_stsd(file, minf, &(stbl->stsd)); - quicktime_write_stts(file, &(stbl->stts)); - quicktime_write_stss(file, &(stbl->stss)); - quicktime_write_stsc(file, &(stbl->stsc)); - quicktime_write_stsz(file, &(stbl->stsz)); - quicktime_write_stco(file, &(stbl->stco)); - - quicktime_atom_write_footer(file, &atom); -} - - diff --git a/cinelerra-5.0/quicktime/stco.c b/cinelerra-5.0/quicktime/stco.c deleted file mode 100644 index e6cee9bf..00000000 --- a/cinelerra-5.0/quicktime/stco.c +++ /dev/null @@ -1,109 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" - - - -void quicktime_stco_init(quicktime_stco_t *stco) -{ - stco->version = 0; - stco->flags = 0; - stco->total_entries = 0; - stco->entries_allocated = 0; -} - -void quicktime_stco_delete(quicktime_stco_t *stco) -{ - if(stco->total_entries) free(stco->table); - stco->total_entries = 0; - stco->entries_allocated = 0; -} - -void quicktime_stco_init_common(quicktime_t *file, quicktime_stco_t *stco) -{ - if(!stco->entries_allocated) - { - stco->entries_allocated = 2048; - stco->total_entries = 0; - stco->table = (quicktime_stco_table_t*)malloc(sizeof(quicktime_stco_table_t) * stco->entries_allocated); -/*printf("quicktime_stco_init_common %x\n", stco->table); */ - } -} - -void quicktime_stco_dump(quicktime_stco_t *stco) -{ - int i; - printf(" chunk offset\n"); - printf(" version %d\n", stco->version); - printf(" flags %ld\n", stco->flags); - printf(" total_entries %ld\n", stco->total_entries); - for(i = 0; i < stco->total_entries; i++) - { - printf(" offset %d 0x%jx\n", i, stco->table[i].offset); - } -} - -void quicktime_read_stco(quicktime_t *file, quicktime_stco_t *stco) -{ - int i; - stco->version = quicktime_read_char(file); - stco->flags = quicktime_read_int24(file); - stco->total_entries = quicktime_read_int32(file); - stco->entries_allocated = stco->total_entries; - stco->table = (quicktime_stco_table_t*)calloc(1, sizeof(quicktime_stco_table_t) * stco->entries_allocated); - for(i = 0; i < stco->total_entries; i++) - { - stco->table[i].offset = quicktime_read_uint32(file); - } -} - -void quicktime_read_stco64(quicktime_t *file, quicktime_stco_t *stco) -{ - int i; - stco->version = quicktime_read_char(file); - stco->flags = quicktime_read_int24(file); - stco->total_entries = quicktime_read_int32(file); - stco->entries_allocated = stco->total_entries; - stco->table = (quicktime_stco_table_t*)calloc(1, sizeof(quicktime_stco_table_t) * stco->entries_allocated); - for(i = 0; i < stco->total_entries; i++) - { - stco->table[i].offset = quicktime_read_int64(file); - } -} - -void quicktime_write_stco(quicktime_t *file, quicktime_stco_t *stco) -{ - int i; - quicktime_atom_t atom; -// quicktime_atom_write_header(file, &atom, "stco"); - quicktime_atom_write_header(file, &atom, "co64"); - - quicktime_write_char(file, stco->version); - quicktime_write_int24(file, stco->flags); - quicktime_write_int32(file, stco->total_entries); - for(i = 0; i < stco->total_entries; i++) - { - quicktime_write_int64(file, stco->table[i].offset); - } - - quicktime_atom_write_footer(file, &atom); -} - -// Chunk starts at 1 -void quicktime_update_stco(quicktime_stco_t *stco, long chunk, int64_t offset) -{ - if(chunk <= 0) - printf("quicktime_update_stco chunk must start at 1. chunk=%ld\n", chunk); - - if(chunk > stco->entries_allocated) - { - stco->entries_allocated = chunk * 2; -//printf("quicktime_update_stco 1\n"); - stco->table = (quicktime_stco_table_t*)realloc(stco->table, - sizeof(quicktime_stco_table_t) * stco->entries_allocated); -//printf("quicktime_update_stco 2\n"); - } - - stco->table[chunk - 1].offset = offset; - if(chunk > stco->total_entries) stco->total_entries = chunk; -} - diff --git a/cinelerra-5.0/quicktime/stsc.c b/cinelerra-5.0/quicktime/stsc.c deleted file mode 100644 index a7466a57..00000000 --- a/cinelerra-5.0/quicktime/stsc.c +++ /dev/null @@ -1,142 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" - - - -void quicktime_stsc_init(quicktime_stsc_t *stsc) -{ - stsc->version = 0; - stsc->flags = 0; - stsc->total_entries = 0; - stsc->entries_allocated = 0; -} - -void quicktime_stsc_init_table(quicktime_t *file, quicktime_stsc_t *stsc) -{ - if(!stsc->entries_allocated) - { - stsc->total_entries = 0; - stsc->entries_allocated = 2048; - stsc->table = (quicktime_stsc_table_t*)calloc(1, sizeof(quicktime_stsc_table_t) * stsc->entries_allocated); - } -} - -void quicktime_stsc_init_video(quicktime_t *file, quicktime_stsc_t *stsc) -{ -//printf("quicktime_stsc_init_video 1\n"); - quicktime_stsc_table_t *table; - quicktime_stsc_init_table(file, stsc); - table = &(stsc->table[0]); - table->chunk = 1; - table->samples = 1; - table->id = 1; -} - -void quicktime_stsc_init_audio(quicktime_t *file, quicktime_stsc_t *stsc, int sample_rate) -{ - quicktime_stsc_table_t *table; - quicktime_stsc_init_table(file, stsc); - table = &(stsc->table[0]); - table->chunk = 1; - table->samples = 0; /* set this after completion or after every audio chunk is written */ - table->id = 1; -} - -void quicktime_stsc_delete(quicktime_stsc_t *stsc) -{ - if(stsc->total_entries) free(stsc->table); - stsc->total_entries = 0; -} - -void quicktime_stsc_dump(quicktime_stsc_t *stsc) -{ - int i; - printf(" sample to chunk\n"); - printf(" version %d\n", stsc->version); - printf(" flags %ld\n", stsc->flags); - printf(" total_entries %jd\n", stsc->total_entries); - for(i = 0; i < stsc->total_entries; i++) - { - printf(" chunk %ld samples 0x%lx id %ld\n", - stsc->table[i].chunk, stsc->table[i].samples, stsc->table[i].id); - } -} - -void quicktime_read_stsc(quicktime_t *file, quicktime_stsc_t *stsc) -{ - int i; - stsc->version = quicktime_read_char(file); - stsc->flags = quicktime_read_int24(file); - stsc->total_entries = quicktime_read_int32(file); - - stsc->entries_allocated = stsc->total_entries; - stsc->table = (quicktime_stsc_table_t*)malloc(sizeof(quicktime_stsc_table_t) * stsc->total_entries); - for(i = 0; i < stsc->total_entries; i++) - { - stsc->table[i].chunk = quicktime_read_int32(file); - stsc->table[i].samples = quicktime_read_int32(file); - stsc->table[i].id = quicktime_read_int32(file); - } -} - - -void quicktime_write_stsc(quicktime_t *file, quicktime_stsc_t *stsc) -{ - int i, last_same; - quicktime_atom_t atom; - quicktime_atom_write_header(file, &atom, "stsc"); - - for(i = 1, last_same = 0; i < stsc->total_entries; i++) - { - if(stsc->table[i].samples != stsc->table[last_same].samples) - { -/* An entry has a different sample count. */ - last_same++; - if(last_same < i) - { -/* Move it up the list. */ - stsc->table[last_same] = stsc->table[i]; - } - } - } - last_same++; - stsc->total_entries = last_same; - - - quicktime_write_char(file, stsc->version); - quicktime_write_int24(file, stsc->flags); - quicktime_write_int32(file, stsc->total_entries); - for(i = 0; i < stsc->total_entries; i++) - { - quicktime_write_int32(file, stsc->table[i].chunk); - quicktime_write_int32(file, stsc->table[i].samples); - quicktime_write_int32(file, stsc->table[i].id); - } - - quicktime_atom_write_footer(file, &atom); -} - -// Chunk starts at 1 -int quicktime_update_stsc(quicktime_stsc_t *stsc, long chunk, long samples) -{ - if(chunk > stsc->entries_allocated) - { - stsc->entries_allocated = (chunk + 1) * 2; - stsc->table =(quicktime_stsc_table_t*)realloc(stsc->table, sizeof(quicktime_stsc_table_t) * stsc->entries_allocated); - } - - stsc->table[chunk - 1].samples = samples; - stsc->table[chunk - 1].chunk = chunk; - stsc->table[chunk - 1].id = 1; - if(chunk > stsc->total_entries) stsc->total_entries = chunk; - return 0; -} - -/* Optimizing while writing doesn't allow seeks during recording so */ -/* entries are created for every chunk and only optimized during */ -/* writeout. Unfortunately there's no way to keep audio synchronized */ -/* after overwriting a recording as the fractional audio chunk in the */ -/* middle always overwrites the previous location of a larger chunk. On */ -/* writing, the table must be optimized. RealProducer requires an */ -/* optimized table. */ - diff --git a/cinelerra-5.0/quicktime/stsd.c b/cinelerra-5.0/quicktime/stsd.c deleted file mode 100644 index 810fd5eb..00000000 --- a/cinelerra-5.0/quicktime/stsd.c +++ /dev/null @@ -1,127 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" - - -void quicktime_stsd_init(quicktime_stsd_t *stsd) -{ - stsd->version = 0; - stsd->flags = 0; - stsd->total_entries = 0; -} - -void quicktime_stsd_init_table(quicktime_stsd_t *stsd) -{ - if(!stsd->total_entries) - { - stsd->total_entries = 1; - stsd->table = (quicktime_stsd_table_t*)calloc(1, sizeof(quicktime_stsd_table_t) * stsd->total_entries); - quicktime_stsd_table_init(&(stsd->table[0])); - } -} - -void quicktime_stsd_init_video(quicktime_t *file, - quicktime_stsd_t *stsd, - int frame_w, - int frame_h, - float frame_rate, - char *compression) -{ - quicktime_stsd_table_t *table; - quicktime_stsd_init_table(stsd); -//printf("quicktime_stsd_init_video 1\n"); - table = &(stsd->table[0]); -//printf("quicktime_stsd_init_video 1\n"); - - quicktime_copy_char32(table->format, compression); -//printf("quicktime_stsd_init_video 1\n"); - table->width = frame_w; -//printf("quicktime_stsd_init_video 1\n"); - table->height = frame_h; -//printf("quicktime_stsd_init_video 1\n"); - table->frames_per_sample = 1; -//printf("quicktime_stsd_init_video 1\n"); - table->depth = 24; -//printf("quicktime_stsd_init_video 1\n"); - table->ctab_id = 65535; -//printf("quicktime_stsd_init_video 2\n"); -} - -void quicktime_stsd_init_audio(quicktime_t *file, - quicktime_stsd_t *stsd, - int channels, - int sample_rate, - int bits, - char *compressor) -{ - quicktime_stsd_table_t *table; - quicktime_stsd_init_table(stsd); - table = &(stsd->table[0]); - - quicktime_copy_char32(table->format, compressor); - table->channels = channels; - table->sample_size = bits; - table->sample_rate = sample_rate; -} - -void quicktime_stsd_delete(quicktime_stsd_t *stsd) -{ - int i; - if(stsd->total_entries) - { - for(i = 0; i < stsd->total_entries; i++) - quicktime_stsd_table_delete(&(stsd->table[i])); - free(stsd->table); - } - - stsd->total_entries = 0; -} - -void quicktime_stsd_dump(void *minf_ptr, quicktime_stsd_t *stsd) -{ - int i; - printf(" sample description\n"); - printf(" version %d\n", stsd->version); - printf(" flags %ld\n", stsd->flags); - printf(" total_entries %ld\n", stsd->total_entries); - - for(i = 0; i < stsd->total_entries; i++) - { - quicktime_stsd_table_dump(minf_ptr, &(stsd->table[i])); - } -} - -void quicktime_read_stsd(quicktime_t *file, quicktime_minf_t *minf, quicktime_stsd_t *stsd) -{ - int i; - - stsd->version = quicktime_read_char(file); - stsd->flags = quicktime_read_int24(file); - stsd->total_entries = quicktime_read_int32(file); - stsd->table = (quicktime_stsd_table_t*)calloc(1, sizeof(quicktime_stsd_table_t) * stsd->total_entries); - for(i = 0; i < stsd->total_entries; i++) - { - quicktime_stsd_table_init(&(stsd->table[i])); -// quicktime_read_stsd_table(file, minf, &(stsd->table[i])); - quicktime_read_stsd_table(file, minf, &(stsd->table[0])); - } -} - -void quicktime_write_stsd(quicktime_t *file, quicktime_minf_t *minf, quicktime_stsd_t *stsd) -{ - quicktime_atom_t atom; - int i; - quicktime_atom_write_header(file, &atom, "stsd"); - - quicktime_write_char(file, stsd->version); - quicktime_write_int24(file, stsd->flags); - quicktime_write_int32(file, stsd->total_entries); - for(i = 0; i < stsd->total_entries; i++) - { - quicktime_write_stsd_table(file, minf, stsd->table); - } - - quicktime_atom_write_footer(file, &atom); -} - - - diff --git a/cinelerra-5.0/quicktime/stsdtable.c b/cinelerra-5.0/quicktime/stsdtable.c deleted file mode 100644 index 17dda2c3..00000000 --- a/cinelerra-5.0/quicktime/stsdtable.c +++ /dev/null @@ -1,489 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" -#include - - -void quicktime_mjqt_init(quicktime_mjqt_t *mjqt) -{ -} - -void quicktime_mjqt_delete(quicktime_mjqt_t *mjqt) -{ -} - -void quicktime_mjqt_dump(quicktime_mjqt_t *mjqt) -{ -} - - -void quicktime_mjht_init(quicktime_mjht_t *mjht) -{ -} - -void quicktime_mjht_delete(quicktime_mjht_t *mjht) -{ -} - -void quicktime_mjht_dump(quicktime_mjht_t *mjht) -{ -} - -// Set esds header to a copy of the argument -void quicktime_set_mpeg4_header(quicktime_stsd_table_t *table, - unsigned char *data, - int size) -{ - if(table->esds.mpeg4_header) - { - free(table->esds.mpeg4_header); - } - - table->esds.mpeg4_header = calloc(1, size); - memcpy(table->esds.mpeg4_header, data, size); - table->esds.mpeg4_header_size = size; -} - -static void read_wave(quicktime_t *file, - quicktime_stsd_table_t *table, - quicktime_atom_t *parent_atom) -{ - quicktime_atom_t leaf_atom; -//printf("read_wave 1 start=0x%llx\n", quicktime_position(file)); - while(quicktime_position(file) < parent_atom->end) - { - quicktime_atom_read_header(file, &leaf_atom); - if(quicktime_atom_is(&leaf_atom, "esds")) - { - quicktime_read_esds(file, &leaf_atom, &table->esds); - } - else - if(quicktime_atom_is(&leaf_atom, "frma")) - { -// Extra data for QDM2 - quicktime_read_frma(file, parent_atom, &leaf_atom, &table->frma); - } - else - quicktime_atom_skip(file, &leaf_atom); - } -} - -void quicktime_read_stsd_audio(quicktime_t *file, - quicktime_stsd_table_t *table, - quicktime_atom_t *parent_atom) -{ - quicktime_atom_t leaf_atom; - - table->version = quicktime_read_int16(file); - table->revision = quicktime_read_int16(file); - quicktime_read_data(file, table->vendor, 4); - table->channels = quicktime_read_int16(file); - table->sample_size = quicktime_read_int16(file); - table->compression_id = quicktime_read_int16(file); - table->packet_size = quicktime_read_int16(file); - table->sample_rate = quicktime_read_fixed32(file); - -// Kluge for fixed32 limitation -if(table->sample_rate + 65536 == 96000 || - table->sample_rate + 65536 == 88200) table->sample_rate += 65536; - - -// Version 1 fields - if(table->version > 0) - { - table->samples_per_packet = quicktime_read_int32(file); - table->bytes_per_packet = quicktime_read_int32(file); - table->bytes_per_frame = quicktime_read_int32(file); - table->bytes_per_sample = quicktime_read_int32(file); - -// Skip another 20 bytes - if(table->version == 2) - { - quicktime_set_position(file, quicktime_position(file) + 0x14); - } - } - - while(quicktime_position(file) < parent_atom->end) { - quicktime_atom_read_header(file, &leaf_atom); - if( quicktime_atom_is(&leaf_atom, "wave") ) - read_wave(file, table, &leaf_atom); - else if( quicktime_atom_is(&leaf_atom, "esds") ) - quicktime_read_esds(file, &leaf_atom, &table->esds); - else - quicktime_atom_skip(file, &leaf_atom); - } - -// FFMPEG says the esds sometimes contains a sample rate that overrides -// the sample table. - quicktime_esds_samplerate(table, &table->esds); -} - -void quicktime_write_stsd_audio(quicktime_t *file, quicktime_stsd_table_t *table) -{ - quicktime_write_int16(file, table->version); - quicktime_write_int16(file, table->revision); - quicktime_write_data(file, table->vendor, 4); - quicktime_write_int16(file, table->channels); - quicktime_write_int16(file, table->sample_size); - - quicktime_write_int16(file, table->compression_id); - quicktime_write_int16(file, table->packet_size); - quicktime_write_fixed32(file, table->sample_rate); - -// Write header for mp4a - if(table->esds.mpeg4_header_size && table->esds.mpeg4_header) - { -// Android requires leaving out the WAVE header - if( table->version > 0 ) { -// newer version info - int padding = table->version == 1 ? - 0x10/sizeof(int32_t) : 0x24/sizeof(int32_t); - while( --padding >= 0 ) quicktime_write_int32(file, 0); - - quicktime_atom_t wave_atom; - quicktime_atom_t frma_atom; - quicktime_atom_t mp4a_atom; - quicktime_atom_write_header(file, &wave_atom, "wave"); - - quicktime_atom_write_header(file, &frma_atom, "frma"); - quicktime_write_data(file, "mp4a", 4); - quicktime_atom_write_footer(file, &frma_atom); - - quicktime_atom_write_header(file, &mp4a_atom, "mp4a"); - quicktime_write_int32(file, 0x0); - quicktime_atom_write_footer(file, &mp4a_atom); - quicktime_write_esds(file, &table->esds, 0, 1); - quicktime_atom_write_footer(file, &wave_atom); - } - else - quicktime_write_esds(file, &table->esds, 0, 1); - } -} - -// Lifted from mplayer and changed a bit -struct __attribute__((__packed__)) ImageDescription { -// int32_t idSize; /* total size of ImageDescription including extra data ( CLUTs and other per sequence data ) */ - char cType[4]; /* what kind of codec compressed this data */ - int32_t resvd1; /* reserved for Apple use */ - int16_t resvd2; /* reserved for Apple use */ - int16_t dataRefIndex; /* set to zero */ - int16_t version; /* which version is this data */ - int16_t revisionLevel; /* what version of that codec did this */ - char vendor[4]; /* whose codec compressed this data */ - uint32_t temporalQuality; /* what was the temporal quality factor */ - uint32_t spatialQuality; /* what was the spatial quality factor */ - int16_t width; /* how many pixels wide is this data */ - int16_t height; /* how many pixels high is this data */ - int32_t hRes; /* horizontal resolution */ - int32_t vRes; /* vertical resolution */ - int32_t dataSize; /* if known, the size of data for this image descriptor */ - int16_t frameCount; /* number of frames this description applies to */ - char name[32]; /* name of codec ( in case not installed ) */ - int16_t depth; /* what depth is this data (1-32) or ( 33-40 grayscale ) */ - int16_t clutID; /* clut id or if 0 clut follows or -1 if no clut */ -}; - - -void quicktime_read_stsd_video(quicktime_t *file, - quicktime_stsd_table_t *table, - quicktime_atom_t *parent_atom) -{ - quicktime_atom_t leaf_atom; - int len; - - table->version = quicktime_read_int16(file); - table->revision = quicktime_read_int16(file); - quicktime_read_data(file, table->vendor, 4); - table->temporal_quality = quicktime_read_int32(file); - table->spatial_quality = quicktime_read_int32(file); - table->width = quicktime_read_int16(file); - table->height = quicktime_read_int16(file); - table->dpi_horizontal = quicktime_read_fixed32(file); - table->dpi_vertical = quicktime_read_fixed32(file); - table->data_size = quicktime_read_int32(file); - table->frames_per_sample = quicktime_read_int16(file); - len = quicktime_read_char(file); - quicktime_read_data(file, table->compressor_name, 31); - table->depth = quicktime_read_int16(file); - table->ctab_id = quicktime_read_int16(file); - - -/* The data needed for SVQ3 codec and maybe some others ? */ - struct ImageDescription *id; - int stsd_size = parent_atom->end - parent_atom->start; - table->extradata_size = stsd_size - 4; - id = (struct ImageDescription *) malloc(table->extradata_size); // we do not include size - table->extradata = (char *) id; - - memcpy(id->cType, table->format, 4); // Fourcc - id->version = table->version; - id->revisionLevel = table->revision; - memcpy(id->vendor, table->vendor, 4); // I think mplayer screws up on this one, it turns bytes around! :) - id->temporalQuality = table->temporal_quality; - id->spatialQuality = table->spatial_quality; - id->width = table->width; - id->height = table->height; - id->hRes = table->dpi_horizontal; - id->vRes = table->dpi_vertical; - id->dataSize = table->data_size; - id->frameCount = table->frames_per_sample; - id->name[0] = len; - memcpy(&(id->name[1]), table->compressor_name, 31); - id->depth = table->depth; - id->clutID = table->ctab_id; - if (quicktime_position(file) < parent_atom->end) - { - int position = quicktime_position(file); // remember position - int datalen = parent_atom->end - position; - quicktime_read_data(file, ((char*)&id->clutID)+2, datalen); - quicktime_set_position(file, position); // return to previous position so parsing can go on - } - - while(quicktime_position(file) < parent_atom->end) - { - quicktime_atom_read_header(file, &leaf_atom); -/* - * printf("quicktime_read_stsd_video 1 %llx %llx %llx %s\n", - * leaf_atom.start, leaf_atom.end, quicktime_position(file), - * leaf_atom.type); - */ - - - if(quicktime_atom_is(&leaf_atom, "esds")) - { - quicktime_read_esds(file, &leaf_atom, &table->esds); - } - else - if(quicktime_atom_is(&leaf_atom, "avcC")) - { - quicktime_read_avcc(file, &leaf_atom, &table->avcc); - } - else - if(quicktime_atom_is(&leaf_atom, "ctab")) - { - quicktime_read_ctab(file, &(table->ctab)); - } - else - if(quicktime_atom_is(&leaf_atom, "gama")) - { - table->gamma = quicktime_read_fixed32(file); - } - else - if(quicktime_atom_is(&leaf_atom, "fiel")) - { - table->fields = quicktime_read_char(file); - table->field_dominance = quicktime_read_char(file); - } - else - quicktime_atom_skip(file, &leaf_atom); - - -/* if(quicktime_atom_is(&leaf_atom, "mjqt")) */ -/* { */ -/* quicktime_read_mjqt(file, &(table->mjqt)); */ -/* } */ -/* else */ -/* if(quicktime_atom_is(&leaf_atom, "mjht")) */ -/* { */ -/* quicktime_read_mjht(file, &(table->mjht)); */ -/* } */ -/* else */ - } -//printf("quicktime_read_stsd_video 2\n"); -} - -void quicktime_write_stsd_video(quicktime_t *file, quicktime_stsd_table_t *table) -{ - quicktime_write_int16(file, table->version); - quicktime_write_int16(file, table->revision); - quicktime_write_data(file, table->vendor, 4); - quicktime_write_int32(file, table->temporal_quality); - quicktime_write_int32(file, table->spatial_quality); - quicktime_write_int16(file, table->width); - quicktime_write_int16(file, table->height); - quicktime_write_fixed32(file, table->dpi_horizontal); - quicktime_write_fixed32(file, table->dpi_vertical); - quicktime_write_int32(file, table->data_size); - quicktime_write_int16(file, table->frames_per_sample); - quicktime_write_char(file, strlen(table->compressor_name)); - quicktime_write_data(file, table->compressor_name, 31); - quicktime_write_int16(file, table->depth); - quicktime_write_int16(file, table->ctab_id); - - -// Write field order for mjpa - if(table->fields) - { - quicktime_atom_t atom; - - quicktime_atom_write_header(file, &atom, "fiel"); - quicktime_write_char(file, table->fields); - quicktime_write_char(file, table->field_dominance); - quicktime_atom_write_footer(file, &atom); - } - -// Write header for mp4v - if(table->esds.mpeg4_header_size && table->esds.mpeg4_header) - { - quicktime_write_esds(file, &table->esds, 1, 0); - } - - if(table->avcc.data_size) - { - quicktime_write_avcc(file, &table->avcc); - } - -// Write another 32 bits - if(table->version == 1) - quicktime_write_int32(file, 0x0); -} - -void quicktime_read_stsd_table(quicktime_t *file, quicktime_minf_t *minf, quicktime_stsd_table_t *table) -{ - quicktime_atom_t leaf_atom; - - quicktime_atom_read_header(file, &leaf_atom); - - table->format[0] = leaf_atom.type[0]; - table->format[1] = leaf_atom.type[1]; - table->format[2] = leaf_atom.type[2]; - table->format[3] = leaf_atom.type[3]; - quicktime_read_data(file, table->reserved, 6); - table->data_reference = quicktime_read_int16(file); - - if(minf->is_audio) quicktime_read_stsd_audio(file, table, &leaf_atom); - if(minf->is_video) quicktime_read_stsd_video(file, table, &leaf_atom); -} - -void quicktime_stsd_table_init(quicktime_stsd_table_t *table) -{ - int i; - table->format[0] = 'y'; - table->format[1] = 'u'; - table->format[2] = 'v'; - table->format[3] = '2'; - for(i = 0; i < 6; i++) table->reserved[i] = 0; - table->data_reference = 1; - - table->version = 0; - table->revision = 0; - table->vendor[0] = 'l'; - table->vendor[1] = 'n'; - table->vendor[2] = 'u'; - table->vendor[3] = 'x'; - - table->temporal_quality = 100; - table->spatial_quality = 258; - table->width = 0; - table->height = 0; - table->dpi_horizontal = 72; - table->dpi_vertical = 72; - table->data_size = 0; - table->frames_per_sample = 1; - for(i = 0; i < 32; i++) table->compressor_name[i] = 0; - sprintf(table->compressor_name, "Quicktime for Linux"); - table->depth = 24; - table->ctab_id = 65535; - quicktime_ctab_init(&(table->ctab)); - table->gamma = 0; - table->fields = 0; - table->field_dominance = 1; - quicktime_mjqt_init(&(table->mjqt)); - quicktime_mjht_init(&(table->mjht)); - - table->channels = 0; - table->sample_size = 0; - table->compression_id = 0; - table->packet_size = 0; - table->sample_rate = 0; - - table->extradata = 0; - table->extradata_size = 0; -} - -void quicktime_stsd_table_delete(quicktime_stsd_table_t *table) -{ - quicktime_ctab_delete(&(table->ctab)); - quicktime_mjqt_delete(&(table->mjqt)); - quicktime_mjht_delete(&(table->mjht)); - quicktime_delete_avcc(&(table->avcc)); - quicktime_delete_esds(&(table->esds)); - quicktime_delete_frma(&(table->frma)); - -} - -void quicktime_stsd_video_dump(quicktime_stsd_table_t *table) -{ - printf(" version %d\n", table->version); - printf(" revision %d\n", table->revision); - printf(" vendor %c%c%c%c\n", table->vendor[0], table->vendor[1], table->vendor[2], table->vendor[3]); - printf(" temporal_quality %ld\n", table->temporal_quality); - printf(" spatial_quality %ld\n", table->spatial_quality); - printf(" width %d\n", table->width); - printf(" height %d\n", table->height); - printf(" dpi_horizontal %f\n", table->dpi_horizontal); - printf(" dpi_vertical %f\n", table->dpi_vertical); - printf(" data_size %ld\n", table->data_size); - printf(" frames_per_sample %d\n", table->frames_per_sample); - printf(" compressor_name %s\n", table->compressor_name); - printf(" depth %d\n", table->depth); - printf(" ctab_id %d\n", table->ctab_id); - printf(" gamma %f\n", table->gamma); - if(table->fields) - { - printf(" fields %d\n", table->fields); - printf(" field dominance %d\n", table->field_dominance); - } - if(!table->ctab_id) quicktime_ctab_dump(&(table->ctab)); - quicktime_mjqt_dump(&(table->mjqt)); - quicktime_mjht_dump(&(table->mjht)); - quicktime_esds_dump(&table->esds); - quicktime_avcc_dump(&table->avcc); - quicktime_frma_dump(&table->frma); -} - -void quicktime_stsd_audio_dump(quicktime_stsd_table_t *table) -{ - printf(" version %d\n", table->version); - printf(" revision %d\n", table->revision); - printf(" vendor %c%c%c%c\n", table->vendor[0], table->vendor[1], table->vendor[2], table->vendor[3]); - printf(" channels %d\n", table->channels); - printf(" sample_size %d\n", table->sample_size); - printf(" compression_id 0x%x\n", table->compression_id); - printf(" packet_size %d\n", table->packet_size); - printf(" sample_rate %f\n", table->sample_rate); - if(table->version > 0) - { - printf(" samples_per_packet %d\n", table->samples_per_packet); - printf(" bytes_per_packet %d\n", table->bytes_per_packet); - printf(" bytes_per_frame %d\n", table->bytes_per_frame); - printf(" bytes_per_sample %d\n", table->bytes_per_sample); - } - quicktime_esds_dump(&table->esds); - quicktime_avcc_dump(&table->avcc); - quicktime_frma_dump(&table->frma); -} - -void quicktime_stsd_table_dump(void *minf_ptr, quicktime_stsd_table_t *table) -{ - quicktime_minf_t *minf = minf_ptr; - printf(" format %c%c%c%c\n", table->format[0], table->format[1], table->format[2], table->format[3]); - quicktime_print_chars(" reserved ", table->reserved, 6); - printf(" data_reference %d\n", table->data_reference); - - if(minf->is_audio) quicktime_stsd_audio_dump(table); - if(minf->is_video) quicktime_stsd_video_dump(table); -} - -void quicktime_write_stsd_table(quicktime_t *file, quicktime_minf_t *minf, quicktime_stsd_table_t *table) -{ - quicktime_atom_t atom; - quicktime_atom_write_header(file, &atom, table->format); -/*printf("quicktime_write_stsd_table %c%c%c%c\n", table->format[0], table->format[1], table->format[2], table->format[3]); */ - quicktime_write_data(file, table->reserved, 6); - quicktime_write_int16(file, table->data_reference); - - if(minf->is_audio) quicktime_write_stsd_audio(file, table); - if(minf->is_video) quicktime_write_stsd_video(file, table); - - quicktime_atom_write_footer(file, &atom); -} diff --git a/cinelerra-5.0/quicktime/stss.c b/cinelerra-5.0/quicktime/stss.c deleted file mode 100644 index fc8374f3..00000000 --- a/cinelerra-5.0/quicktime/stss.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" - - - -void quicktime_stss_init(quicktime_stss_t *stss) -{ - stss->version = 0; - stss->flags = 0; - stss->total_entries = 0; - stss->entries_allocated = 2; - stss->table = (quicktime_stss_table_t*)calloc(1, sizeof(quicktime_stss_table_t) * stss->entries_allocated); -} - -void quicktime_stss_delete(quicktime_stss_t *stss) -{ - if(stss->entries_allocated) free(stss->table); - stss->total_entries = 0; - stss->entries_allocated = 0; - stss->table = 0; -} - -void quicktime_stss_dump(quicktime_stss_t *stss) -{ - int i; - printf(" sync sample\n"); - printf(" version %d\n", stss->version); - printf(" flags %ld\n", stss->flags); - printf(" total_entries %ld\n", stss->total_entries); - for(i = 0; i < stss->total_entries; i++) - { - printf(" sample 0x%lx\n", stss->table[i].sample); - } -} - -void quicktime_read_stss(quicktime_t *file, quicktime_stss_t *stss) -{ - int i; - stss->version = quicktime_read_char(file); - stss->flags = quicktime_read_int24(file); - stss->total_entries = quicktime_read_int32(file); - - if(stss->entries_allocated < stss->total_entries) - { - stss->entries_allocated = stss->total_entries; - stss->table = (quicktime_stss_table_t*)realloc(stss->table, sizeof(quicktime_stss_table_t) * stss->entries_allocated); - } - - for(i = 0; i < stss->total_entries; i++) - { - stss->table[i].sample = quicktime_read_int32(file); - } -} - - -void quicktime_write_stss(quicktime_t *file, quicktime_stss_t *stss) -{ - int i; - quicktime_atom_t atom; - - if(stss->total_entries) - { - quicktime_atom_write_header(file, &atom, "stss"); - - quicktime_write_char(file, stss->version); - quicktime_write_int24(file, stss->flags); - quicktime_write_int32(file, stss->total_entries); - for(i = 0; i < stss->total_entries; i++) - { - quicktime_write_int32(file, stss->table[i].sample); - } - - quicktime_atom_write_footer(file, &atom); - } -} diff --git a/cinelerra-5.0/quicktime/stsz.c b/cinelerra-5.0/quicktime/stsz.c deleted file mode 100644 index a9bac3f5..00000000 --- a/cinelerra-5.0/quicktime/stsz.c +++ /dev/null @@ -1,165 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" - - - -void quicktime_stsz_init(quicktime_stsz_t *stsz) -{ - stsz->version = 0; - stsz->flags = 0; - stsz->sample_size = 0; - stsz->total_entries = 0; - stsz->entries_allocated = 0; - stsz->table = 0; -} - -void quicktime_stsz_init_video(quicktime_t *file, quicktime_stsz_t *stsz) -{ - stsz->sample_size = 0; - if(!stsz->entries_allocated) - { - stsz->entries_allocated = 2048; - stsz->total_entries = 0; - stsz->table = (quicktime_stsz_table_t*)calloc(sizeof(quicktime_stsz_table_t), - stsz->entries_allocated); -//printf("quicktime_stsz_init_video 1 %p\n", stsz->table); - } -} - -void quicktime_stsz_init_audio(quicktime_t *file, - quicktime_stsz_t *stsz, - int channels, - int bits, - char *compressor) -{ - /*stsz->sample_size = channels * bits / 8; */ - - stsz->table = 0; - stsz->sample_size = 0; - -//printf("quicktime_stsz_init_audio 1 %d\n", stsz->sample_size); - stsz->total_entries = 0; /* set this when closing */ - stsz->entries_allocated = 0; -} - -void quicktime_stsz_delete(quicktime_stsz_t *stsz) -{ - if(!stsz->sample_size && stsz->total_entries) free(stsz->table); - stsz->table = 0; - stsz->total_entries = 0; - stsz->entries_allocated = 0; -} - -void quicktime_stsz_dump(quicktime_stsz_t *stsz) -{ - int i; - printf(" sample size\n"); - printf(" version %d\n", stsz->version); - printf(" flags %ld\n", stsz->flags); - printf(" sample_size %ld\n", stsz->sample_size); - printf(" total_entries %ld\n", stsz->total_entries); - - if(!stsz->sample_size) - { - for(i = 0; i < stsz->total_entries; i++) - { - printf(" sample_size 0x%lx\n", stsz->table[i].size); - } - } -} - -void quicktime_read_stsz(quicktime_t *file, quicktime_stsz_t *stsz) -{ - int i; - stsz->version = quicktime_read_char(file); - stsz->flags = quicktime_read_int24(file); - stsz->sample_size = quicktime_read_int32(file); - stsz->total_entries = quicktime_read_int32(file); - stsz->entries_allocated = stsz->total_entries; -//printf("quicktime_read_stsz 1 %d\n", stsz->sample_size); - if(!stsz->sample_size) - { - stsz->table = (quicktime_stsz_table_t*)malloc(sizeof(quicktime_stsz_table_t) * stsz->entries_allocated); - for(i = 0; i < stsz->total_entries; i++) - { - stsz->table[i].size = quicktime_read_int32(file); - } - } -} - -void quicktime_write_stsz(quicktime_t *file, quicktime_stsz_t *stsz) -{ - int i; - quicktime_atom_t atom; - quicktime_atom_write_header(file, &atom, "stsz"); - -/* optimize if possible */ -/* Xanim requires an unoptimized table for video. */ -/* if(!stsz->sample_size) */ -/* { */ -/* for(i = 0, result = 0; i < stsz->total_entries && !result; i++) */ -/* { */ -/* if(stsz->table[i].size != stsz->table[0].size) result = 1; */ -/* } */ -/* */ -/* if(!result) */ -/* { */ -/* stsz->sample_size = stsz->table[0].size; */ -/* stsz->total_entries = 0; */ -/* free(stsz->table); */ -/* } */ -/* } */ - - quicktime_write_char(file, stsz->version); - quicktime_write_int24(file, stsz->flags); - -// Force idiosynchratic handling of fixed bitrate audio. -// Since audio has millions of samples it's not practical to declare a size -// of each sample. Instead Quicktime stores a 1 for every sample's size and -// relies on the samples per chunk table to determine the chunk size. - quicktime_write_int32(file, stsz->sample_size); - quicktime_write_int32(file, stsz->total_entries); - - if(!stsz->sample_size) - { - for(i = 0; i < stsz->total_entries; i++) - { - quicktime_write_int32(file, stsz->table[i].size); - } - } - - quicktime_atom_write_footer(file, &atom); -} - -// Sample starts on 0 -void quicktime_update_stsz(quicktime_stsz_t *stsz, - long sample, - long sample_size) -{ - if(!stsz->sample_size) - { - if(sample >= stsz->entries_allocated) - { - stsz->entries_allocated = (sample + 1) * 2; -//printf("quicktime_update_stsz 1 %d %d\n", sample, sample_size); - stsz->table = (quicktime_stsz_table_t *)realloc(stsz->table, - sizeof(quicktime_stsz_table_t) * stsz->entries_allocated); -//printf("quicktime_update_stsz 2 %d %d\n", sample, sample_size); - } - - stsz->table[sample].size = sample_size; - if(sample >= stsz->total_entries) stsz->total_entries = sample + 1; - } - -//printf("quicktime_update_stsz 5 %d %d\n", sample, sample_size); -} - - -int quicktime_sample_size(quicktime_trak_t *trak, int sample) -{ - quicktime_stsz_t *stsz = &trak->mdia.minf.stbl.stsz; - if( stsz->sample_size ) return stsz->sample_size; - if( sample < stsz->total_entries && sample >= 0 ) - return stsz->table[sample].size; - return 0; -} diff --git a/cinelerra-5.0/quicktime/stts.c b/cinelerra-5.0/quicktime/stts.c deleted file mode 100644 index 0186f297..00000000 --- a/cinelerra-5.0/quicktime/stts.c +++ /dev/null @@ -1,196 +0,0 @@ -#include "funcprotos.h" -#include "quicktime.h" - - - -void quicktime_stts_init(quicktime_stts_t *stts) -{ - stts->version = 0; - stts->flags = 0; - stts->total_entries = 0; -} - -void quicktime_stts_init_table(quicktime_stts_t *stts) -{ - if(!stts->total_entries) - { - stts->total_entries = 1; - stts->table = (quicktime_stts_table_t*)malloc(sizeof(quicktime_stts_table_t) * stts->total_entries); - } -} - -void quicktime_stts_init_video(quicktime_t *file, quicktime_stts_t *stts, int time_scale, float frame_rate) -{ - quicktime_stts_table_t *table; - quicktime_stts_init_table(stts); - table = &(stts->table[0]); - - table->sample_count = 0; /* need to set this when closing */ - table->sample_duration = time_scale / frame_rate; -//printf("quicktime_stts_init_video %d %f\n", time_scale, frame_rate); -} - -void quicktime_stts_init_audio(quicktime_t *file, quicktime_stts_t *stts, int sample_rate) -{ - quicktime_stts_table_t *table; - quicktime_stts_init_table(stts); - table = &(stts->table[0]); - - table->sample_count = 0; /* need to set this when closing */ - table->sample_duration = 1; -} - -void quicktime_stts_append_audio(quicktime_t *file, - quicktime_stts_t *stts, - int sample_duration) -{ - quicktime_stts_table_t *table; - if(stts->total_entries) - table = &(stts->table[stts->total_entries - 1]); - else - table = 0; - - stts->is_vbr = 1; - -// Expand existing entry - if(table && table->sample_count) - { - if(table->sample_duration == sample_duration) - { - table->sample_count++; - return; - } - } - else -// Override existing entry - if(table && table->sample_count == 0) - { - table->sample_duration = sample_duration; - table->sample_count = 1; - return; - } - -// Append new entry - stts->total_entries++; - stts->table = realloc(stts->table, - sizeof(quicktime_stts_table_t) * stts->total_entries); - table = &(stts->table[stts->total_entries - 1]); - table->sample_duration = sample_duration; - table->sample_count = 1; -} - - -int64_t quicktime_stts_total_samples(quicktime_t *file, - quicktime_stts_t *stts) -{ - int i; - int64_t result = 0; - for(i = 0; i < stts->total_entries; i++) - { - result += stts->table[i].sample_count; - } - return result; -} - - -void quicktime_stts_delete(quicktime_stts_t *stts) -{ - if(stts->total_entries) free(stts->table); - stts->total_entries = 0; -} - -void quicktime_stts_dump(quicktime_stts_t *stts) -{ - int i; - printf(" time to sample\n"); - printf(" version %d\n", stts->version); - printf(" flags %ld\n", stts->flags); - printf(" total_entries %ld\n", stts->total_entries); - for(i = 0; i < stts->total_entries; i++) - { - printf(" count %ld duration %ld\n", - stts->table[i].sample_count, stts->table[i].sample_duration); - } -} - -void quicktime_read_stts(quicktime_t *file, quicktime_stts_t *stts) -{ - int i; - stts->version = quicktime_read_char(file); - stts->flags = quicktime_read_int24(file); - stts->total_entries = quicktime_read_int32(file); - - stts->table = (quicktime_stts_table_t*)malloc(sizeof(quicktime_stts_table_t) * stts->total_entries); - for(i = 0; i < stts->total_entries; i++) - { - stts->table[i].sample_count = quicktime_read_int32(file); - stts->table[i].sample_duration = quicktime_read_int32(file); - } -} - -void quicktime_write_stts(quicktime_t *file, quicktime_stts_t *stts) -{ - int i; - quicktime_atom_t atom; - quicktime_atom_write_header(file, &atom, "stts"); - - quicktime_write_char(file, stts->version); - quicktime_write_int24(file, stts->flags); - quicktime_write_int32(file, stts->total_entries); - for(i = 0; i < stts->total_entries; i++) - { - quicktime_write_int32(file, stts->table[i].sample_count); - quicktime_write_int32(file, stts->table[i].sample_duration); - } - - quicktime_atom_write_footer(file, &atom); -} - -// Return the sample which contains the start_time argument. -// Stores the actual starting time of the sample in the start_time argument. -int quicktime_time_to_sample(quicktime_stts_t *stts, int64_t *start_time) -{ - int64_t cur_time = 0, stime = *start_time; - int i = 0, entries = stts->total_entries, result = 0; - quicktime_stts_table_t *stts_table = &stts->table[0]; - - while( i < entries ) { - int64_t count = stts_table->sample_count; - int64_t end_time = cur_time + count * stts_table->sample_duration; - if( end_time > stime ) break; - cur_time = end_time; - result += count; - ++stts_table; - ++i; - } - - if( i >= entries ) - return entries-1; - - stime = (stime - cur_time) / stts_table->sample_duration; - result += stime; - *start_time = cur_time + stime * stts_table->sample_duration; - return result; -} - -int64_t quicktime_chunk_to_samples(quicktime_stts_t *stts, long chunk) -{ - int64_t cur_time = 0; long chunks = 0; - int i = 0, entries = stts->total_entries; - quicktime_stts_table_t *stts_table = &stts->table[0]; - - while( i < entries ) { - int64_t count = stts_table->sample_count; - int64_t end_time = cur_time + count * stts_table->sample_duration; - long end_chunk = chunks + count; - if( end_chunk > chunk ) break; - chunks = end_chunk; - cur_time = end_time; - ++stts_table; ++i; - } - - if( i >= entries ) return cur_time; - - return cur_time + (chunk - chunks) * stts_table->sample_duration; -} - diff --git a/cinelerra-5.0/quicktime/test.mp4 b/cinelerra-5.0/quicktime/test.mp4 deleted file mode 100644 index 903b0b92a7ba7cd79205c5271312a084a9a074ff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 24260391 zcmV(6S{004GDKmZO-9T=Pk#|$Z800DPtXzD|Alyr6w;xSQD2#myYW{65UI|y+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