}
}
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(AACDecoder::new())
}
}
}
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(Atrac3Decoder::new())
}
}
}
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(ClearVideoDecoder::new(false))
}
-pub fn get_decoder_rm() -> Box<dyn NADecoder> {
+pub fn get_decoder_rm() -> Box<dyn NADecoder + Send> {
Box::new(ClearVideoDecoder::new(true))
}
}
}
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(PCMDecoder::new())
}
}
}
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(SiproDecoder::new())
}
}
}
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(AudioDecoder::new())
}
#[derive(Clone,Copy)]
pub struct DecoderInfo {
pub name: &'static str,
- pub get_decoder: fn () -> Box<dyn NADecoder>,
+ pub get_decoder: fn () -> Box<dyn NADecoder + Send>,
}
#[cfg(any(feature="blockdsp"))]
pub fn add_decoder(&mut self, dec: DecoderInfo) {
self.decs.push(dec);
}
- pub fn find_decoder(&self, name: &str) -> Option<fn () -> Box<dyn NADecoder>> {
+ pub fn find_decoder(&self, name: &str) -> Option<fn () -> Box<dyn NADecoder + Send>> {
for &dec in self.decs.iter() {
if dec.name == name {
return Some(dec.get_decoder);
}
}
-pub fn get_decoder_dk3() -> Box<dyn NADecoder> {
+pub fn get_decoder_dk3() -> Box<dyn NADecoder + Send> {
Box::new(DuckADPCMDecoder::new(true))
}
-pub fn get_decoder_dk4() -> Box<dyn NADecoder> {
+pub fn get_decoder_dk4() -> Box<dyn NADecoder + Send> {
Box::new(DuckADPCMDecoder::new(false))
}
}
}
-pub fn get_decoder_500() -> Box<dyn NADecoder> {
+pub fn get_decoder_500() -> Box<dyn NADecoder + Send> {
Box::new(AVCDecoder::new(500))
}
-pub fn get_decoder_501() -> Box<dyn NADecoder> {
+pub fn get_decoder_501() -> Box<dyn NADecoder + Send> {
Box::new(AVCDecoder::new(501))
}
}
}
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(TM1Decoder::new())
}
}
}
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(TM2Decoder::new())
}
}
}
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(TM2XDecoder::new())
}
}
}
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(TMRTDecoder::new())
}
}
}
-pub fn get_decoder_vp3() -> Box<NADecoder> {
+pub fn get_decoder_vp3() -> Box<NADecoder + Send> {
Box::new(VP34Decoder::new(3))
}
-pub fn get_decoder_vp4() -> Box<NADecoder> {
+pub fn get_decoder_vp4() -> Box<NADecoder + Send> {
Box::new(VP34Decoder::new(4))
}
}
}
-pub fn get_decoder() -> Box<NADecoder> {
+pub fn get_decoder() -> Box<NADecoder + Send> {
Box::new(VP5Decoder::new())
}
}
}
-pub fn get_decoder_vp6() -> Box<NADecoder> {
+pub fn get_decoder_vp6() -> Box<NADecoder + Send> {
Box::new(VP6Decoder::new(false))
}
-pub fn get_decoder_vp6_alpha() -> Box<NADecoder> {
+pub fn get_decoder_vp6_alpha() -> Box<NADecoder + Send> {
Box::new(VP6Decoder::new(true))
}
}
}
-pub fn get_decoder() -> Box<NADecoder> {
+pub fn get_decoder() -> Box<NADecoder + Send> {
Box::new(VP7Decoder::new())
}
}
-pub fn get_decoder_video() -> Box<dyn NADecoder> {
+pub fn get_decoder_video() -> Box<dyn NADecoder + Send> {
Box::new(BMVVideoDecoder::new())
}
}
}
-pub fn get_decoder_audio() -> Box<dyn NADecoder> {
+pub fn get_decoder_audio() -> Box<dyn NADecoder + Send> {
Box::new(BMVAudioDecoder::new())
}
}
-pub fn get_decoder_video() -> Box<dyn NADecoder> {
+pub fn get_decoder_video() -> Box<dyn NADecoder + Send> {
Box::new(BMV3VideoDecoder::new())
}
}
}
-pub fn get_decoder_audio() -> Box<dyn NADecoder> {
+pub fn get_decoder_audio() -> Box<dyn NADecoder + Send> {
Box::new(BMV3AudioDecoder::new())
}
}
}
-pub fn get_decoder_video() -> Box<dyn NADecoder> {
+pub fn get_decoder_video() -> Box<dyn NADecoder + Send> {
Box::new(GremlinVideoDecoder::new())
}
}
}
-pub fn get_decoder_audio() -> Box<dyn NADecoder> {
+pub fn get_decoder_audio() -> Box<dyn NADecoder + Send> {
Box::new(GremlinAudioDecoder::new())
}
}
-pub fn get_decoder_video() -> Box<dyn NADecoder> {
+pub fn get_decoder_video() -> Box<dyn NADecoder + Send> {
Box::new(MidividDecoder::new())
}
}
-pub fn get_decoder_video() -> Box<dyn NADecoder> {
+pub fn get_decoder_video() -> Box<dyn NADecoder + Send> {
Box::new(VMDVideoDecoder::new())
}
}
}
-pub fn get_decoder_audio() -> Box<dyn NADecoder> {
+pub fn get_decoder_audio() -> Box<dyn NADecoder + Send> {
Box::new(VMDAudioDecoder::new())
}
}
}
-pub fn get_decoder_imc() -> Box<dyn NADecoder> {
+pub fn get_decoder_imc() -> Box<dyn NADecoder + Send> {
Box::new(IMCDecoder::new(true))
}
-pub fn get_decoder_iac() -> Box<dyn NADecoder> {
+pub fn get_decoder_iac() -> Box<dyn NADecoder + Send> {
Box::new(IMCDecoder::new(false))
}
}
}
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(Indeo2Decoder::new())
}
}
}
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(Indeo3Decoder::new())
}
Ok(BandHeader::new(plane_no, band_no, mb_size, blk_size, mv_mode == 1, inherit_mv, false, inherit_qd, quant, rvmap_idx, num_corr, corr_map, blk_cb, tr, txtype))
}
- fn decode_mb_info(&mut self, br: &mut BitReader, pic_hdr: &PictureHeader, band: &BandHeader, tile: &mut IVITile, ref_tile: Option<Ref<IVITile>>, mv_scale: u8) -> DecoderResult<()> {
+ fn decode_mb_info(&mut self, br: &mut BitReader, pic_hdr: &PictureHeader, band: &BandHeader, tile: &mut IVITile, ref_tile: Option<&IVITile>, mv_scale: u8) -> DecoderResult<()> {
let mut mv_x = 0;
let mut mv_y = 0;
let mut mb_idx = 0;
&INDEO4_QUANT4X4_INTER[3], &INDEO4_QUANT4X4_INTER[4]
];
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(Indeo4Decoder::new())
}
Ok(BandHeader::new(plane_no, band_no, self.mb_size[band_id], self.blk_size[band_id], self.is_hpel[band_id], inherit_mv, has_qdelta, inherit_qd, band_q, rvmap_idx, num_corr, corr_map, blk_cb, tr, txtype))
}
- fn decode_mb_info(&mut self, br: &mut BitReader, pic_hdr: &PictureHeader, band: &BandHeader, tile: &mut IVITile, ref_tile: Option<Ref<IVITile>>, mv_scale: u8) -> DecoderResult<()> {
+ fn decode_mb_info(&mut self, br: &mut BitReader, pic_hdr: &PictureHeader, band: &BandHeader, tile: &mut IVITile, ref_tile: Option<&IVITile>, mv_scale: u8) -> DecoderResult<()> {
let mut mv_x = 0;
let mut mv_y = 0;
let band_id = if pic_hdr.luma_bands == 4 { band.band_no + 1 } else { 0 };
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23
];
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(Indeo5Decoder::new())
}
}
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(Intel263Decoder::new())
}
use std::mem;
-use std::rc::Rc;
-pub use std::cell::{Ref,RefCell};
use nihav_core::io::bitreader::*;
//use io::intcode::*;
use nihav_core::codecs::*;
+use nihav_core::frame::NABufferRef;
use super::ivi::*;
use super::ividsp::*;
}
impl FrameData {
- fn new() -> Rc<RefCell<Self>> {
- Rc::new(RefCell::new(FrameData {
+ fn new() -> NABufferRef<Self> {
+ NABufferRef::new(FrameData {
plane_buf: [Vec::new(), Vec::new(), Vec::new(), Vec::new()],
plane_stride: [0, 0, 0, 0],
pic_hdr: PictureHeader::new_null(IVIFrameType::Intra),
- }))
+ })
}
fn realloc(&mut self, pic_hdr: &PictureHeader) -> DecoderResult<()> {
let width = align(pic_hdr.width, 6);
pub trait IndeoXParser {
fn decode_picture_header(&mut self, br: &mut BitReader) -> DecoderResult<PictureHeader>;
fn decode_band_header(&mut self, br: &mut BitReader, pic_hdr: &PictureHeader, plane: usize, band: usize) -> DecoderResult<BandHeader>;
- fn decode_mb_info(&mut self, br: &mut BitReader, pic_hdr: &PictureHeader, band_hdr: &BandHeader, tile: &mut IVITile, ref_tile: Option<Ref<IVITile>>, mv_scale: u8) -> DecoderResult<()>;
+ fn decode_mb_info(&mut self, br: &mut BitReader, pic_hdr: &PictureHeader, band_hdr: &BandHeader, tile: &mut IVITile, ref_tile: Option<&IVITile>, mv_scale: u8) -> DecoderResult<()>;
fn recombine_plane(&mut self, src: &[i16], sstride: usize, dst: &mut [u8], dstride: usize, w: usize, h: usize);
}
pub struct IVIDecoder {
ftype: IVIFrameType,
- frames: [Rc<RefCell<FrameData>>; 4],
+ frames: [NABufferRef<FrameData>; 4],
cur_frame: usize,
prev_frame: usize,
next_frame: usize,
bref: Option<NABufferType>,
bands: Vec<BandHeader>,
- tiles: Vec<Rc<RefCell<IVITile>>>,
+ tiles: Vec<NABufferRef<IVITile>>,
num_tiles: [[usize; 4]; 4],
tile_start: [[usize; 4]; 4],
}
while x < band_w {
let cur_w = if x + tile_w <= band_w { tile_w } else { band_w - x };
let tile = IVITile::new(band_xoff + x, band_yoff + y, cur_w, cur_h);
- self.tiles.push(Rc::new(RefCell::new(tile)));
+ self.tiles.push(NABufferRef::new(tile));
self.num_tiles[plane][band] += 1;
tstart += 1;
x += tile_w;
};
for tile_no in tstart..tend {
{
- let mut tile = self.tiles[tile_no].borrow_mut();
+ let mut tile = self.tiles[tile_no].clone();
let mb_w = (tile.w + mb_size - 1) / mb_size;
let mb_h = (tile.h + mb_size - 1) / mb_size;
tile.mb_w = mb_w;
validate!(tile_end > br.tell());
validate!(tile_end <= br.tell() + (br.left() as usize));
{
- let mut tile = self.tiles[tile_no].borrow_mut();
- let ref_tile: Option<Ref<IVITile>>;
+ let mut tile = self.tiles[tile_no].clone();
+ let ref_tile: Option<&IVITile>;
let mv_scale;
if (plane_no == 0) && (band_no == 0) {
mv_scale = 0;
mv_scale = (((self.bands[0].mb_size >> 3) as i8) - ((band.mb_size >> 3) as i8)) as u8;
}
if plane_no != 0 || band_no != 0 {
- let rtile = self.tiles[0].borrow();
+ let rtile = &self.tiles[0];
if (tile.mb_w != rtile.mb_w) || (tile.mb_h != rtile.mb_h) {
ref_tile = None;
} else {
br.skip(skip_part as u32)?;
} else {
{
- let mut tile = self.tiles[tile_no].borrow_mut();
- let ref_tile: Option<Ref<IVITile>>;
+ let mut tile = self.tiles[tile_no].clone();
+ let ref_tile: Option<&IVITile>;
let mv_scale;
if (plane_no == 0) && (band_no == 0) {
mv_scale = 0;
mv_scale = (((self.bands[0].mb_size >> 3) as i8) - ((band.mb_size >> 3) as i8)) as u8;
}
if plane_no != 0 || band_no != 0 {
- let rtile = self.tiles[0].borrow();
+ let rtile = &self.tiles[0];
if (tile.mb_w != rtile.mb_w) || (tile.mb_h != rtile.mb_h) {
ref_tile = None;
} else {
fn decode_tile(&mut self, br: &mut BitReader, band: &BandHeader, tile_no: usize, tr: &TrFunc, transform_dc: &TrFuncDC) -> DecoderResult<()> {
let mut mb_idx = 0;
let mut prev_dc: i32 = 0;
- let mut tile = self.tiles[tile_no].borrow_mut();
- let mut frame = self.frames[self.cur_frame].borrow_mut();
+ let mut tile = self.tiles[tile_no].clone();
+ let mut frame = self.frames[self.cur_frame].clone();
let stride = frame.plane_stride[band.plane_no];
let mut dstidx = tile.pos_x + tile.pos_y * stride;
} else {
idx = self.next_frame;
}
- let pf = self.frames[idx].borrow();
+ let pf = &self.frames[idx];
do_mc(&mut dst[dstidx + boff..], stride,
&pf.plane_buf[band.plane_no], pf.plane_stride[band.plane_no],
pos_x + mb_x * band.mb_size + (blk_no & 1) * band.blk_size,
pos_x, pos_x + tile_w, pos_y, pos_y + tile_h,
mb.mv_x, mb.mv_y, band.halfpel, band.blk_size);
} else {
- let pf = self.frames[self.prev_frame].borrow();
- let nf = self.frames[self.next_frame].borrow();
+ let pf = &self.frames[self.prev_frame];
+ let nf = &self.frames[self.next_frame];
do_mc_b(&mut dst[dstidx + boff..], stride,
&pf.plane_buf[band.plane_no], pf.plane_stride[band.plane_no],
&nf.plane_buf[band.plane_no], nf.plane_stride[band.plane_no],
} else {
idx = self.next_frame;
}
- let pf = self.frames[idx].borrow();
+ let pf = &self.frames[idx];
do_mc(&mut dst[dstidx + mb_x * band.blk_size..], stride,
&pf.plane_buf[band.plane_no], pf.plane_stride[band.plane_no],
pos_x + mb_x * band.mb_size,
pos_x, pos_x + tile_w, pos_y, pos_y + tile_h,
mb.mv_x, mb.mv_y, band.halfpel, band.blk_size);
} else {
- let pf = self.frames[self.prev_frame].borrow();
- let nf = self.frames[self.next_frame].borrow();
+ let pf = &self.frames[self.prev_frame];
+ let nf = &self.frames[self.next_frame];
do_mc_b(&mut dst[dstidx + mb_x * band.blk_size..], stride,
&pf.plane_buf[band.plane_no], pf.plane_stride[band.plane_no],
&nf.plane_buf[band.plane_no], nf.plane_stride[band.plane_no],
vinfo.set_height(pic_hdr.height);
let mut buftype = alloc_video_buffer(vinfo, 0)?;
self.realloc(&pic_hdr)?;
- self.frames[self.cur_frame].borrow_mut().realloc(&pic_hdr)?;
+ self.frames[self.cur_frame].realloc(&pic_hdr)?;
for plane in 0..3 {
let num_bands = if plane == 0 { pic_hdr.luma_bands } else { pic_hdr.chroma_bands };
self.decode_band(&pic_hdr, dec, br, plane, band)?;
}
if let NABufferType::Video(ref mut vb) = buftype {
- let mut frame = self.frames[self.cur_frame].borrow_mut();
+ let mut frame = self.frames[self.cur_frame].clone();
if num_bands == 1 {
frame.fill_plane(vb, plane);
} else {
}
}
if pic_hdr.transparent {
- let mut frame = self.frames[self.cur_frame].borrow_mut();
+ let mut frame = self.frames[self.cur_frame].clone();
let stride = frame.plane_stride[3];
read_trans_band_header(br, pic_hdr.width, pic_hdr.height, &mut frame.plane_buf[3], stride)?;
if let NABufferType::Video(ref mut vb) = buftype {
}
}
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(Bink2Decoder::new())
}
}
}
-pub fn get_decoder_dct() -> Box<dyn NADecoder> {
+pub fn get_decoder_dct() -> Box<dyn NADecoder + Send> {
Box::new(BinkAudioDecoder::new(true))
}
-pub fn get_decoder_rdft() -> Box<dyn NADecoder> {
+pub fn get_decoder_rdft() -> Box<dyn NADecoder + Send> {
Box::new(BinkAudioDecoder::new(false))
}
}
}
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(BinkDecoder::new())
}
}
}
-pub fn get_decoder_video() -> Box<dyn NADecoder> {
+pub fn get_decoder_video() -> Box<dyn NADecoder + Send> {
Box::new(SmackerVideoDecoder::new())
}
}
}
-pub fn get_decoder_audio() -> Box<dyn NADecoder> {
+pub fn get_decoder_audio() -> Box<dyn NADecoder + Send> {
Box::new(SmackerAudioDecoder::new())
}
}
}
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(CookDecoder::new())
}
}
}
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(RA144Decoder::new())
}
}
}
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(RA288Decoder::new())
}
}
}
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(RALFDecoder::new())
}
}
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(RealVideo10Decoder::new())
}
MBB{ blocks: 65536, bits: 14 },
];
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(RealVideo20Decoder::new())
}
}
}
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(RealVideo30Decoder::new())
}
Ok(MV{ x, y })
}
-fn do_mc_16x16(dsp: &Box<dyn RV34DSP>, buf: &mut NAVideoBuffer<u8>, prevbuf: &NAVideoBuffer<u8>, mb_x: usize, mb_y: usize, mv: MV, avg: bool) {
+fn do_mc_16x16(dsp: &Box<dyn RV34DSP + Send>, buf: &mut NAVideoBuffer<u8>, prevbuf: &NAVideoBuffer<u8>, mb_x: usize, mb_y: usize, mv: MV, avg: bool) {
dsp.do_luma_mc (buf, prevbuf, mb_x * 16, mb_y * 16, mv, true, avg);
dsp.do_chroma_mc(buf, prevbuf, mb_x * 8, mb_y * 8, 1, mv, true, avg);
dsp.do_chroma_mc(buf, prevbuf, mb_x * 8, mb_y * 8, 2, mv, true, avg);
}
-fn do_mc_8x8(dsp: &Box<dyn RV34DSP>, buf: &mut NAVideoBuffer<u8>, prevbuf: &NAVideoBuffer<u8>, mb_x: usize, xoff: usize, mb_y: usize, yoff: usize, mv: MV, avg: bool) {
+fn do_mc_8x8(dsp: &Box<dyn RV34DSP + Send>, buf: &mut NAVideoBuffer<u8>, prevbuf: &NAVideoBuffer<u8>, mb_x: usize, xoff: usize, mb_y: usize, yoff: usize, mv: MV, avg: bool) {
dsp.do_luma_mc (buf, prevbuf, mb_x * 16 + xoff * 8, mb_y * 16 + yoff * 8, mv, false, avg);
dsp.do_chroma_mc(buf, prevbuf, mb_x * 8 + xoff * 4, mb_y * 8 + yoff * 4, 1, mv, false, avg);
dsp.do_chroma_mc(buf, prevbuf, mb_x * 8 + xoff * 4, mb_y * 8 + yoff * 4, 2, mv, false, avg);
pub struct RV34Decoder {
is_rv30: bool,
coderead: RV34Codes,
- dsp: Box<dyn RV34DSP>,
+ dsp: Box<dyn RV34DSP + Send>,
cdsp: RV34CommonDSP,
width: usize,
height: usize,
}
impl RV34Decoder {
- pub fn new(is_rv30: bool, dsp: Box<dyn RV34DSP>) -> Self {
+ pub fn new(is_rv30: bool, dsp: Box<dyn RV34DSP + Send>) -> Self {
let tmp_vinfo = NAVideoInfo::new(16, 16, false, YUV420_FORMAT);
let vt = alloc_video_buffer(tmp_vinfo, 4).unwrap();
let vb = vt.get_vbuf();
}
}
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(RealVideo40Decoder::new())
}
}
}
-pub fn get_decoder() -> Box<dyn NADecoder> {
+pub fn get_decoder() -> Box<dyn NADecoder + Send> {
Box::new(RealVideo60Decoder::new())
}