From: Kostya Shishkov Date: Fri, 4 Nov 2022 17:44:01 +0000 (+0100) Subject: give 'str' variables more appropriate names X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=817e487223b28379176a533f09485c27a68443f8;p=nihav.git give 'str' variables more appropriate names --- diff --git a/nihav-codec-support/src/codecs/h263/code.rs b/nihav-codec-support/src/codecs/h263/code.rs index cbeb120..6ff4247 100644 --- a/nihav-codec-support/src/codecs/h263/code.rs +++ b/nihav-codec-support/src/codecs/h263/code.rs @@ -523,10 +523,10 @@ pub fn h263_filter_row(buf: &mut NAVideoBuffer, mb_y: usize, mb_w: usize, cb let coded0 = cbpi.is_coded(mb_x, 0); let coded1 = cbpi.is_coded(mb_x, 1); let q = cbpi.get_q(mb_w + mb_x); - let str = if q < 32 { FILTER_STRENGTH[q as usize] } else { 0 }; + let strength = if q < 32 { FILTER_STRENGTH[q as usize] } else { 0 }; if mb_y != 0 { - if coded0 && cbpi.is_coded_top(mb_x, 0) { deblock_hor(buf, 0, str, coff); } - if coded1 && cbpi.is_coded_top(mb_x, 1) { deblock_hor(buf, 0, str, coff + 8); } + if coded0 && cbpi.is_coded_top(mb_x, 0) { deblock_hor(buf, 0, strength, coff); } + if coded1 && cbpi.is_coded_top(mb_x, 1) { deblock_hor(buf, 0, strength, coff + 8); } } let coff = off + 8 * stride; if cbpi.is_coded(mb_x, 2) && coded0 { deblock_hor(buf, 0, q, coff); } @@ -542,7 +542,7 @@ pub fn h263_filter_row(buf: &mut NAVideoBuffer, mb_y: usize, mb_w: usize, cb let ccur0 = cbpi.is_coded(mb_x, 0); let ccur1 = cbpi.is_coded(mb_x, 1); let q = cbpi.get_q(mb_w + mb_x); - let str = if q < 32 { FILTER_STRENGTH[q as usize] } else { 0 }; + let strength = if q < 32 { FILTER_STRENGTH[q as usize] } else { 0 }; if mb_y != 0 { let coff = off - 8 * stride; let qtop = cbpi.get_q(mb_x); @@ -550,8 +550,8 @@ pub fn h263_filter_row(buf: &mut NAVideoBuffer, mb_y: usize, mb_w: usize, cb if leftt && ctop0 { deblock_ver(buf, 0, strtop, coff); } if ctop0 && ctop1 { deblock_ver(buf, 0, strtop, coff + 8); } } - if leftc && ccur0 { deblock_ver(buf, 0, str, off); } - if ccur0 && ccur1 { deblock_ver(buf, 0, str, off + 8); } + if leftc && ccur0 { deblock_ver(buf, 0, strength, off); } + if ccur0 && ccur1 { deblock_ver(buf, 0, strength, off + 8); } leftt = ctop1; leftc = ccur1; off += 16; @@ -567,9 +567,9 @@ pub fn h263_filter_row(buf: &mut NAVideoBuffer, mb_y: usize, mb_w: usize, cb let ctv = cbpi.is_coded_top(mb_x, 5); let ccv = cbpi.is_coded(mb_x, 5); let q = cbpi.get_q(mb_w + mb_x); - let str = if q < 32 { FILTER_STRENGTH[q as usize] } else { 0 }; - if ctu && ccu { deblock_hor(buf, 1, str, offu + mb_x * 8); } - if ctv && ccv { deblock_hor(buf, 2, str, offv + mb_x * 8); } + let strength = if q < 32 { FILTER_STRENGTH[q as usize] } else { 0 }; + if ctu && ccu { deblock_hor(buf, 1, strength, offu + mb_x * 8); } + if ctv && ccv { deblock_hor(buf, 2, strength, offv + mb_x * 8); } } let mut leftu = false; let mut leftv = false; diff --git a/nihav-commonfmt/src/demuxers/avi.rs b/nihav-commonfmt/src/demuxers/avi.rs index cd33c51..1e7a10f 100644 --- a/nihav-commonfmt/src/demuxers/avi.rs +++ b/nihav-commonfmt/src/demuxers/avi.rs @@ -167,13 +167,13 @@ impl<'a> DemuxCore<'a> for AVIDemuxer<'a> { } continue; } - let str = strmgr.get_stream(stream_no as usize); - if str.is_none() { + let stream = strmgr.get_stream(stream_no as usize); + if stream.is_none() { self.src.read_skip(size)?; self.movi_size -= size + 8; continue; } - let stream = str.unwrap(); + let stream = stream.unwrap(); if size == 0 { self.movi_size -= 8; if self.movi_size == 0 { diff --git a/nihav-commonfmt/src/demuxers/mov.rs b/nihav-commonfmt/src/demuxers/mov.rs index ce2b0bf..59b4cdd 100644 --- a/nihav-commonfmt/src/demuxers/mov.rs +++ b/nihav-commonfmt/src/demuxers/mov.rs @@ -1550,9 +1550,9 @@ fn process_packet(src: &mut ByteReader, strmgr: &StreamManager, track: &mut Trac } else { track.cur_ts = None; } - let str = strmgr.get_stream(track.track_str_id); - if str.is_none() { return Err(DemuxerError::InvalidData); } - let stream = str.unwrap(); + let stream = strmgr.get_stream(track.track_str_id); + if stream.is_none() { return Err(DemuxerError::InvalidData); } + let stream = stream.unwrap(); src.seek(SeekFrom::Start(offset))?; let mut pkt = src.read_packet(stream, pts, false, size)?; if let Some(ref pal) = track.pal { @@ -1568,9 +1568,9 @@ impl<'a> DemuxCore<'a> for MOVDemuxer<'a> { validate!(self.mdat_pos > 0); validate!(!self.tracks.is_empty()); for track in self.tracks.iter_mut() { - let mut str = None; - std::mem::swap(&mut track.stream, &mut str); - if let Some(stream) = str { + let mut strm = None; + std::mem::swap(&mut track.stream, &mut strm); + if let Some(stream) = strm { let str_id = strmgr.add_stream(stream).unwrap(); track.track_str_id = str_id; } diff --git a/nihav-commonfmt/src/demuxers/wav.rs b/nihav-commonfmt/src/demuxers/wav.rs index 1e685de..1a2ead7 100644 --- a/nihav-commonfmt/src/demuxers/wav.rs +++ b/nihav-commonfmt/src/demuxers/wav.rs @@ -75,9 +75,9 @@ impl<'a> DemuxCore<'a> for WAVDemuxer<'a> { if self.src.tell() >= self.data_end { return Err(DemuxerError::EOF); } - let str = strmgr.get_stream(0); - if str.is_none() { return Err(InvalidData); } - let stream = str.unwrap(); + let strm = strmgr.get_stream(0); + if strm.is_none() { return Err(InvalidData); } + let stream = strm.unwrap(); let pts = if self.avg_bytes != 0 { let pos = self.src.tell() - self.data_pos; Some(pos * u64::from(self.srate) / u64::from(self.avg_bytes)) diff --git a/nihav-commonfmt/src/muxers/avi.rs b/nihav-commonfmt/src/muxers/avi.rs index ac09974..5e98ed9 100644 --- a/nihav-commonfmt/src/muxers/avi.rs +++ b/nihav-commonfmt/src/muxers/avi.rs @@ -238,8 +238,8 @@ impl<'a> MuxCore<'a> for AVIMuxer<'a> { if self.data_pos == 0 { return Err(MuxerError::NotCreated); } - let str = pkt.get_stream(); - let str_num = str.get_num(); + let stream = pkt.get_stream(); + let str_num = stream.get_num(); if str_num > 99 || str_num >= self.stream_info.len() { return Err(MuxerError::UnsupportedFormat); } @@ -282,11 +282,11 @@ impl<'a> MuxCore<'a> for AVIMuxer<'a> { self.stream_info[str_num].max_size = self.stream_info[str_num].max_size.max(chunk_len); self.index.push(IdxEntry { stream: str_num as u32, - stype: str.get_media_type(), + stype: stream.get_media_type(), key: pkt.keyframe, pos: self.bw.tell() as u32, len: chunk_len }); - write_chunk_hdr(self.bw, str.get_media_type(), str_num as u32)?; + write_chunk_hdr(self.bw, stream.get_media_type(), str_num as u32)?; self.bw.write_u32le(chunk_len)?; self.bw.write_buf(pkt.get_buffer().as_slice())?; if (self.bw.tell() & 1) != 0 { diff --git a/nihav-core/src/demuxers/mod.rs b/nihav-core/src/demuxers/mod.rs index 46e0617..23f27fb 100644 --- a/nihav-core/src/demuxers/mod.rs +++ b/nihav-core/src/demuxers/mod.rs @@ -90,9 +90,9 @@ impl StreamManager { /// Adds a new stream. pub fn add_stream(&mut self, stream: NAStream) -> Option { let stream_num = self.streams.len(); - let mut str = stream; - str.set_num(stream_num); - self.streams.push(str.into_ref()); + let mut stream = stream; + stream.set_num(stream_num); + self.streams.push(stream.into_ref()); self.ignored.push(false); Some(stream_num) } @@ -309,9 +309,9 @@ impl SeekIndex { } /// Returns stream reference for provided stream ID. pub fn get_stream_index(&mut self, id: u32) -> Option<&mut StreamSeekInfo> { - for str in self.seek_info.iter_mut() { - if str.id == id { - return Some(str); + for stream in self.seek_info.iter_mut() { + if stream.id == id { + return Some(stream); } } None @@ -328,16 +328,16 @@ impl SeekIndex { /// Searches for a seek position before requested time. pub fn find_pos(&self, time: NATimePoint) -> Option { let mut cand = None; - for str in self.seek_info.iter() { - if !str.filled { continue; } - let res = str.find_pos(time); + for stream in self.seek_info.iter() { + if !stream.filled { continue; } + let res = stream.find_pos(time); if res.is_none() { continue; } let res = res.unwrap(); if cand.is_none() { - cand = Some(SeekIndexResult { pts: res.pts, pos: res.pos, str_id: str.id }); + cand = Some(SeekIndexResult { pts: res.pts, pos: res.pos, str_id: stream.id }); } else if let Some(entry) = cand { if res.pos < entry.pos { - cand = Some(SeekIndexResult { pts: res.pts, pos: res.pos, str_id: str.id }); + cand = Some(SeekIndexResult { pts: res.pts, pos: res.pos, str_id: stream.id }); } } } @@ -465,10 +465,10 @@ pub trait DemuxerCreator { /// Creates demuxer for a provided bytestream. pub fn create_demuxer<'a>(dmxcr: &dyn DemuxerCreator, br: &'a mut ByteReader<'a>) -> DemuxerResult> { let mut dmx = dmxcr.new_demuxer(br); - let mut str = StreamManager::new(); + let mut strmgr = StreamManager::new(); let mut seek_idx = SeekIndex::new(); - dmx.open(&mut str, &mut seek_idx)?; - Ok(Demuxer::new(dmx, str, seek_idx)) + dmx.open(&mut strmgr, &mut seek_idx)?; + Ok(Demuxer::new(dmx, strmgr, seek_idx)) } /// List of registered demuxers. @@ -631,10 +631,10 @@ pub trait RawDemuxerCreator { /// Creates raw data demuxer for a provided bytestream. pub fn create_raw_demuxer<'a>(dmxcr: &dyn RawDemuxerCreator, br: &'a mut ByteReader<'a>) -> DemuxerResult> { let mut dmx = dmxcr.new_demuxer(br); - let mut str = StreamManager::new(); + let mut strmgr = StreamManager::new(); let mut seek_idx = SeekIndex::new(); - dmx.open(&mut str, &mut seek_idx)?; - Ok(RawDemuxer::new(dmx, str, seek_idx)) + dmx.open(&mut strmgr, &mut seek_idx)?; + Ok(RawDemuxer::new(dmx, strmgr, seek_idx)) } /// List of registered demuxers. diff --git a/nihav-core/src/formats.rs b/nihav-core/src/formats.rs index c0027ec..810fff2 100644 --- a/nihav-core/src/formats.rs +++ b/nihav-core/src/formats.rs @@ -820,13 +820,13 @@ impl fmt::Display for NAPixelFormaton { let end = if self.be { "BE" } else { "LE" }; let palstr = if self.palette { "palette " } else { "" }; let astr = if self.alpha { "alpha " } else { "" }; - let mut str = format!("Formaton for {} ({}{}elem {} size {}): ", self.model, palstr, astr,end, self.elem_size); + let mut string = format!("Formaton for {} ({}{}elem {} size {}): ", self.model, palstr, astr,end, self.elem_size); for i in 0..self.comp_info.len() { if let Some(chr) = self.comp_info[i] { - str = format!("{} {}", str, chr); + string = format!("{} {}", string, chr); } } - write!(f, "[{}]", str) + write!(f, "[{}]", string) } } diff --git a/nihav-core/src/options.rs b/nihav-core/src/options.rs index 4e4c7aa..b09bf05 100644 --- a/nihav-core/src/options.rs +++ b/nihav-core/src/options.rs @@ -184,8 +184,8 @@ impl NAOptionDefinition { }, NAValue::String(ref cur_str) => { if let NAOptionDefinitionType::String(Some(strings)) = self.opt_type { - for str in strings.iter() { - if cur_str == str { + for string in strings.iter() { + if cur_str == string { return Ok(()); } } diff --git a/nihav-duck/src/codecs/truemotion2.rs b/nihav-duck/src/codecs/truemotion2.rs index dfbbf9b..4020e73 100644 --- a/nihav-duck/src/codecs/truemotion2.rs +++ b/nihav-duck/src/codecs/truemotion2.rs @@ -561,8 +561,8 @@ impl NADecoder for TM2Decoder { let magic = br.read_u32be()?; validate!(magic == 0x100 || magic == 0x101); br.read_skip(36)?; - for str in self.streams.iter_mut() { - str.read_header(&src, &mut br)?; + for stream in self.streams.iter_mut() { + stream.read_header(&src, &mut br)?; } let myinfo = NAVideoInfo::new(self.width, self.height, false, RGB24_FORMAT); diff --git a/nihav-game/src/demuxers/bmv.rs b/nihav-game/src/demuxers/bmv.rs index 700c8d0..66f1df9 100644 --- a/nihav-game/src/demuxers/bmv.rs +++ b/nihav-game/src/demuxers/bmv.rs @@ -47,9 +47,9 @@ impl<'a> DemuxCore<'a> for BMVDemuxer<'a> { let nblocks = self.src.peek_byte()?; asize = (nblocks as usize) * 65 + 1; validate!(asize < size); - let str = strmgr.get_stream(self.aud_id).unwrap(); - let ts = str.make_ts(Some(self.apos), None, None); - let apkt = self.src.read_packet(str, ts, false, asize)?; + let stream = strmgr.get_stream(self.aud_id).unwrap(); + let ts = stream.make_ts(Some(self.apos), None, None); + let apkt = self.src.read_packet(stream, ts, false, asize)?; self.apos += u64::from(nblocks) * 32; self.pkt_buf.push(apkt); } else { @@ -59,9 +59,9 @@ impl<'a> DemuxCore<'a> for BMVDemuxer<'a> { buf[0] = ctype; self.src.read_buf(&mut buf[1..])?; - let str = strmgr.get_stream(self.vid_id).unwrap(); - let ts = str.make_ts(Some(self.vpos), None, None); - let pkt = NAPacket::new(str, ts, (ctype & 3) == 3, buf); + let stream = strmgr.get_stream(self.vid_id).unwrap(); + let ts = stream.make_ts(Some(self.vpos), None, None); + let pkt = NAPacket::new(stream, ts, (ctype & 3) == 3, buf); self.vpos += 1; return Ok(pkt); @@ -186,9 +186,9 @@ impl<'a> DemuxCore<'a> for BMV3Demuxer<'a> { buf[0] = (self.src.tell() & 1) as u8; self.src.read_buf(&mut buf[1..])?; - let str = strmgr.get_stream(self.aud_id).unwrap(); - let ts = str.make_ts(Some(self.apos), None, None); - let apkt = NAPacket::new(str, ts, false, buf); + let stream = strmgr.get_stream(self.aud_id).unwrap(); + let ts = stream.make_ts(Some(self.apos), None, None); + let apkt = NAPacket::new(stream, ts, false, buf); self.apos += (asize as u64) / 41 * 32; self.pkt_buf.push(apkt); @@ -206,9 +206,9 @@ impl<'a> DemuxCore<'a> for BMV3Demuxer<'a> { buf[0] = ctype; self.src.read_buf(&mut buf[1..])?; - let str = strmgr.get_stream(self.vid_id).unwrap(); - let ts = str.make_ts(Some(self.vpos), None, None); - let pkt = NAPacket::new(str, ts, (ctype & 3) == 3, buf); + let stream = strmgr.get_stream(self.vid_id).unwrap(); + let ts = stream.make_ts(Some(self.vpos), None, None); + let pkt = NAPacket::new(stream, ts, (ctype & 3) == 3, buf); self.vpos += 1; return Ok(pkt); diff --git a/nihav-game/src/demuxers/fst.rs b/nihav-game/src/demuxers/fst.rs index 68f9537..f71601e 100644 --- a/nihav-game/src/demuxers/fst.rs +++ b/nihav-game/src/demuxers/fst.rs @@ -72,9 +72,9 @@ impl<'a> DemuxCore<'a> for FutureVisionVideoDemuxer<'a> { self.cur_frame += 1; } - let str = strmgr.get_stream(id).unwrap(); - let ts = str.make_ts(Some(pts), None, None); - self.src.read_packet(str, ts, true, size) + let stream = strmgr.get_stream(id).unwrap(); + let ts = stream.make_ts(Some(pts), None, None); + self.src.read_packet(stream, ts, true, size) } fn seek(&mut self, _time: NATimePoint, _seek_index: &SeekIndex) -> DemuxerResult<()> { @@ -146,9 +146,9 @@ impl<'a> DemuxCore<'a> for FutureVisionAudioDemuxer<'a> { let size = (self.end - self.src.tell()).min(0x2000) as usize; let pts = (self.src.tell() - 14) * 2; - let str = strmgr.get_stream(self.a_id).unwrap(); - let ts = str.make_ts(Some(pts), None, None); - self.src.read_packet(str, ts, true, size) + let stream = strmgr.get_stream(self.a_id).unwrap(); + let ts = stream.make_ts(Some(pts), None, None); + self.src.read_packet(stream, ts, true, size) } fn seek(&mut self, _time: NATimePoint, _seek_index: &SeekIndex) -> DemuxerResult<()> { diff --git a/nihav-game/src/demuxers/gdv.rs b/nihav-game/src/demuxers/gdv.rs index 876f3c1..8ae27c6 100644 --- a/nihav-game/src/demuxers/gdv.rs +++ b/nihav-game/src/demuxers/gdv.rs @@ -142,13 +142,13 @@ pktdta: Vec::new(), fn read_achunk(&mut self, strmgr: &mut StreamManager) -> DemuxerResult { self.state = GDVState::AudioRead; - let str = strmgr.get_stream(self.a_id.unwrap()).unwrap(); - let ts = str.make_ts(Some(u64::from(self.cur_frame)), None, None); - self.src.read_packet(str, ts, true, self.asize) + let stream = strmgr.get_stream(self.a_id.unwrap()).unwrap(); + let ts = stream.make_ts(Some(u64::from(self.cur_frame)), None, None); + self.src.read_packet(stream, ts, true, self.asize) } fn read_vchunk(&mut self, strmgr: &mut StreamManager) -> DemuxerResult { - let str = strmgr.get_stream(self.v_id.unwrap()).unwrap(); + let stream = strmgr.get_stream(self.v_id.unwrap()).unwrap(); let src = &mut self.src; let magic = src.read_u16be()?; if magic != 0x0513 { return Err(DemuxerError::InvalidData); } @@ -157,8 +157,8 @@ pktdta: Vec::new(), let flags = (tmp & 0xFF) as usize; self.state = GDVState::NewFrame; self.cur_frame += 1; - let ts = str.make_ts(Some(u64::from(self.cur_frame - 1)), None, None); - src.read_packet(str, ts, (flags & 64) != 0, size) + let ts = stream.make_ts(Some(u64::from(self.cur_frame - 1)), None, None); + src.read_packet(stream, ts, (flags & 64) != 0, size) } } diff --git a/nihav-game/src/demuxers/imax.rs b/nihav-game/src/demuxers/imax.rs index 2cd9f70..999ea1a 100644 --- a/nihav-game/src/demuxers/imax.rs +++ b/nihav-game/src/demuxers/imax.rs @@ -48,10 +48,10 @@ impl<'a> DemuxCore<'a> for IMAXDemuxer<'a> { match ftype { 0xAA97 => { - let str = strmgr.get_stream(self.v_id).unwrap(); - let ts = str.make_ts(Some(self.cur_frame), None, None); + let stream = strmgr.get_stream(self.v_id).unwrap(); + let ts = stream.make_ts(Some(self.cur_frame), None, None); self.cur_frame += 1; - let mut pkt = self.src.read_packet(str, ts, true, fsize)?; + let mut pkt = self.src.read_packet(stream, ts, true, fsize)?; pkt.add_side_data(NASideData::Palette(self.pal_change, self.pal.clone())); self.pal_change = false; return Ok(pkt); @@ -71,10 +71,10 @@ impl<'a> DemuxCore<'a> for IMAXDemuxer<'a> { self.pal_change = true; }, 0xAA99 => { - let str = strmgr.get_stream(self.a_id).unwrap(); - let ts = str.make_ts(Some(self.apos), None, None); + let stream = strmgr.get_stream(self.a_id).unwrap(); + let ts = stream.make_ts(Some(self.apos), None, None); self.apos += fsize as u64; - return self.src.read_packet(str, ts, true, fsize); + return self.src.read_packet(stream, ts, true, fsize); }, 0xAAFF => return Err(DemuxerError::EOF), _ => return Err(DemuxerError::InvalidData), diff --git a/nihav-game/src/demuxers/q.rs b/nihav-game/src/demuxers/q.rs index 3735bfa..071f00f 100644 --- a/nihav-game/src/demuxers/q.rs +++ b/nihav-game/src/demuxers/q.rs @@ -81,10 +81,10 @@ impl<'a> DemuxCore<'a> for QDemuxer<'a> { 0xFFFF => return Err(DemuxerError::EOF), 0 => { if let Some(a_id) = self.a_id { - let str = strmgr.get_stream(a_id).unwrap(); - let ts = str.make_ts(Some(self.apts), None, None); + let stream = strmgr.get_stream(a_id).unwrap(); + let ts = stream.make_ts(Some(self.apts), None, None); self.apts += (size / self.bps) as u64; - return self.src.read_packet(str, ts, true, size); + return self.src.read_packet(stream, ts, true, size); } else { self.src.read_skip(size)?; } @@ -99,8 +99,8 @@ impl<'a> DemuxCore<'a> for QDemuxer<'a> { }, 2 | 3 | 4 | 11 => { validate!(self.v_id.is_some()); - let str = strmgr.get_stream(self.v_id.unwrap_or(0)).unwrap(); - let ts = str.make_ts(Some(self.vpts), None, None); + let stream = strmgr.get_stream(self.v_id.unwrap_or(0)).unwrap(); + let ts = stream.make_ts(Some(self.vpts), None, None); self.vpts += 1; let cur_len = self.side_data.len(); @@ -114,7 +114,7 @@ impl<'a> DemuxCore<'a> for QDemuxer<'a> { } let mut buf = Vec::new(); std::mem::swap(&mut buf, &mut self.side_data); - return Ok(NAPacket::new(str, ts, self.vpts == 1, buf)); + return Ok(NAPacket::new(stream, ts, self.vpts == 1, buf)); }, 5 => { validate!(size <= 256); diff --git a/nihav-game/src/demuxers/vmd.rs b/nihav-game/src/demuxers/vmd.rs index c1ef0be..3341fd1 100644 --- a/nihav-game/src/demuxers/vmd.rs +++ b/nihav-game/src/demuxers/vmd.rs @@ -172,9 +172,9 @@ impl<'a> DemuxCore<'a> for VMDDemuxer<'a> { self.fno += 1; let str_id = if is_video { self.vid_id } else { self.aud_id }; - let str = strmgr.get_stream(str_id).unwrap(); - let ts = str.make_ts(Some(u64::from(cur_frame.ts)), None, None); - let pkt = NAPacket::new(str, ts, false, buf); + let stream = strmgr.get_stream(str_id).unwrap(); + let ts = stream.make_ts(Some(u64::from(cur_frame.ts)), None, None); + let pkt = NAPacket::new(stream, ts, false, buf); Ok(pkt) } diff --git a/nihav-indeo/src/codecs/intel263.rs b/nihav-indeo/src/codecs/intel263.rs index da1c10b..62762bc 100644 --- a/nihav-indeo/src/codecs/intel263.rs +++ b/nihav-indeo/src/codecs/intel263.rs @@ -263,10 +263,10 @@ impl BlockDSP for I263BlockDSP { let coded0 = cbpi.is_coded(mb_x, 0); let coded1 = cbpi.is_coded(mb_x, 1); let q = cbpi.get_q(mb_w + mb_x); - let str = if q < 32 { FILTER_STRENGTH[q as usize] } else { 0 }; + let strength = if q < 32 { FILTER_STRENGTH[q as usize] } else { 0 }; if mb_y != 0 { - if coded0 && cbpi.is_coded_top(mb_x, 0) { deblock_hor(buf, 0, str, coff); } - if coded1 && cbpi.is_coded_top(mb_x, 1) { deblock_hor(buf, 0, str, coff + 8); } + if coded0 && cbpi.is_coded_top(mb_x, 0) { deblock_hor(buf, 0, strength, coff); } + if coded1 && cbpi.is_coded_top(mb_x, 1) { deblock_hor(buf, 0, strength, coff + 8); } } let coff = off + 8 * stride; if cbpi.is_coded(mb_x, 2) && coded0 { deblock_hor(buf, 0, q, coff); } @@ -282,7 +282,7 @@ impl BlockDSP for I263BlockDSP { let ccur0 = cbpi.is_coded(mb_x, 0); let ccur1 = cbpi.is_coded(mb_x, 1); let q = cbpi.get_q(mb_w + mb_x); - let str = if q < 32 { FILTER_STRENGTH[q as usize] } else { 0 }; + let strength = if q < 32 { FILTER_STRENGTH[q as usize] } else { 0 }; if mb_y != 0 { let coff = off - 8 * stride; let qtop = cbpi.get_q(mb_x); @@ -290,8 +290,8 @@ impl BlockDSP for I263BlockDSP { if leftt && ctop0 { deblock_ver(buf, 0, strtop, coff); } if ctop0 && ctop1 { deblock_ver(buf, 0, strtop, coff + 8); } } - if leftc && ccur0 { deblock_ver(buf, 0, str, off); } - if ccur0 && ccur1 { deblock_ver(buf, 0, str, off + 8); } + if leftc && ccur0 { deblock_ver(buf, 0, strength, off); } + if ccur0 && ccur1 { deblock_ver(buf, 0, strength, off + 8); } leftt = ctop1; leftc = ccur1; off += 16; @@ -307,9 +307,9 @@ impl BlockDSP for I263BlockDSP { let ctv = cbpi.is_coded_top(mb_x, 5); let ccv = cbpi.is_coded(mb_x, 5); let q = cbpi.get_q(mb_w + mb_x); - let str = if q < 32 { FILTER_STRENGTH[q as usize] } else { 0 }; - if ctu && ccu { deblock_hor(buf, 1, str, offu + mb_x * 8); } - if ctv && ccv { deblock_hor(buf, 2, str, offv + mb_x * 8); } + let strength = if q < 32 { FILTER_STRENGTH[q as usize] } else { 0 }; + if ctu && ccu { deblock_hor(buf, 1, strength, offu + mb_x * 8); } + if ctv && ccv { deblock_hor(buf, 2, strength, offv + mb_x * 8); } } let mut leftu = false; let mut leftv = false; diff --git a/nihav-realmedia/src/codecs/rv40dsp.rs b/nihav-realmedia/src/codecs/rv40dsp.rs index a883b0b..2300941 100644 --- a/nihav-realmedia/src/codecs/rv40dsp.rs +++ b/nihav-realmedia/src/codecs/rv40dsp.rs @@ -285,14 +285,14 @@ fn rv40_weak_loop_filter4(pix: &mut [u8], mut off: usize, step: usize, stride: u let q1 = el!(pix, off + step); let q2 = el!(pix, off + 2*step); - let str; + let strength; if filter_p1 && filter_q1 { - str = (t << 2) + (p1 - q1); + strength = (t << 2) + (p1 - q1); } else { - str = t << 2; + strength = t << 2; } - let diff = clip_symm((str + 4) >> 3, lim_p0q0); + let diff = clip_symm((strength + 4) >> 3, lim_p0q0); pix[off - step] = clip8(p0 + diff); pix[off ] = clip8(q0 - diff); @@ -340,14 +340,14 @@ fn rv40_weak_loop_filter4_v(pix: &mut [u8], off: usize, stride: usize, let q1 = el!(ch, 3 + 1); let q2 = el!(ch, 3 + 2); - let str; + let strength; if filter_p1 && filter_q1 { - str = (t << 2) + (p1 - q1); + strength = (t << 2) + (p1 - q1); } else { - str = t << 2; + strength = t << 2; } - let diff = clip_symm((str + 4) >> 3, lim_p0q0); + let diff = clip_symm((strength + 4) >> 3, lim_p0q0); ch[3 - 1] = clip8(p0 + diff); ch[3 ] = clip8(q0 - diff); diff --git a/nihav-realmedia/src/demuxers/realmedia.rs b/nihav-realmedia/src/demuxers/realmedia.rs index cfcccb8..322fdc0 100644 --- a/nihav-realmedia/src/demuxers/realmedia.rs +++ b/nihav-realmedia/src/demuxers/realmedia.rs @@ -1186,8 +1186,7 @@ fn read_string_size(src: &mut ByteReader, size: usize) -> DemuxerResult let c = src.read_byte()?; vec.push(c); } - let str = String::from_utf8(vec); - if let Ok(res) = str { + if let Ok(res) = String::from_utf8(vec) { Ok(res) } else { Ok(String::new()) @@ -1307,7 +1306,7 @@ impl<'a> RealAudioDemuxer<'a> { enum IVRRecord { Invalid(u8), StreamProperties(usize), - Packet { ts: u32, str: u32, flags: u32, len: usize, checksum: u32 }, + Packet { ts: u32, strm: u32, flags: u32, len: usize, checksum: u32 }, IntValue(Vec, u32), BinaryData(Vec, Vec), StringData(Vec, Vec), @@ -1333,12 +1332,12 @@ impl IVRRecord { }, 2 => { let ts = src.read_u32be()?; - let str = src.read_u16be()? as u32; + let strm = src.read_u16be()? as u32; let flags = src.read_u32be()?; let len = src.read_u32be()? as usize; let chk = src.read_u32be()?; validate!((len > 0) && (len < (1 << 24))); - Ok(IVRRecord::Packet { ts, str, flags, len, checksum: chk }) + Ok(IVRRecord::Packet { ts, strm, flags, len, checksum: chk }) }, 3 => { let name = Self::read_string(src)?; @@ -1382,8 +1381,8 @@ impl fmt::Display for IVRRecord { IVRRecord::Invalid(typ) => write!(f, "Invalid({:02X})", typ), IVRRecord::StreamProperties(num) => write!(f, "({} stream properties)", num), - IVRRecord::Packet { ts, str, flags, len, checksum } => - write!(f, "paket({}, {}, {:X}, {}, {})", ts, str, flags, len, checksum), + IVRRecord::Packet { ts, strm, flags, len, checksum } => + write!(f, "paket({}, {}, {:X}, {}, {})", ts, strm, flags, len, checksum), IVRRecord::IntValue(ref name, val) => write!(f, "({} = {})", String::from_utf8_lossy(name), val), IVRRecord::BinaryData(ref name, ref val) => @@ -1503,9 +1502,9 @@ impl RecordDemuxer { loop { let rec = IVRRecord::read(src)?; match rec { - IVRRecord::Packet { ts, str, flags, len, .. } => { + IVRRecord::Packet { ts, strm, flags, len, .. } => { let payload_size = len; - let sr = self.remap_ids.iter().position(|x| *x == str); + let sr = self.remap_ids.iter().position(|x| *x == strm); validate!(sr.is_some()); let str_no = self.start_str + (sr.unwrap() as u32); let pkt_grp = ((flags >> 8) & 0xFF) as u16;