// decodeScalefactors3 decodes the scalefactors of a Layer III frame. It also
// computes part2_length.
779734
func (d *Decoder) decodeScalefactors3(gr, ch int) error {
	var err error
	s1 := slen1[d.scalefacCompress[gr][ch]]
	s2 := slen2[d.scalefacCompress[gr][ch]]

	if d.blockType[gr][ch] == 2 {
		shortLow := 0
		if d.mixedBlockFlag[gr][ch] == 1 {
			d.part2Length[gr][ch] = 17*s1 + 18*s2
			for sfb := 0; sfb < 8; sfb++ {
				d.scalefacL[gr][ch][sfb], err = d.reservoir.readBits(s1)
				if err != nil {
					return err
				}
			}
			shortLow = 3
		} else {
			d.part2Length[gr][ch] = 18*s1 + 18*s2
		}

		for sfb := shortLow; sfb < 12; sfb++ {
			s := s1
			if sfb >= 6 {
				s = s2
			}
			for w := 0; w < 3; w++ {
				d.scalefacS[gr][ch][sfb][w], err = d.reservoir.readBits(s)
				if err != nil {
					return err
				}
			}
		}
	} else {
		d.part2Length[gr][ch] = 11*s1 + 10*s2
		for scfsiBand := 0; scfsiBand < 4; scfsiBand++ {
			low, high := scfsiBands[scfsiBand], scfsiBands[scfsiBand+1]
			s := s1
			if scfsiBand >= 2 {
				s = s2
			}
			for sfb := low; sfb < high; sfb++ {
				if gr == 0 || d.scfsi3[ch][scfsiBand] == 0 {
					d.scalefacL[gr][ch][sfb], err = d.reservoir.readBits(s)
					if err != nil {
						return err
					}
				} else {
					d.scalefacL[1][ch][sfb] = d.scalefacL[0][ch][sfb]
					d.part2Length[gr][ch] -= s
				}
			}
		}
	}

	return nil
}
105063
func Mat2x3FromRows(row0, row1 Vec3) Mat2x3 {
	return Mat2x3{row0[0], row1[0], row0[1], row1[1], row0[2], row1[2]}
}
665935
func (d *Decoder) dequantize3() {
	for gr := 0; gr < 2; gr++ {
		for ch := 0; ch < d.nChannels; ch++ {
			longLow, longHigh := 0, 22
			shortLow, shortHigh := 0, 13
			if d.blockType[gr][ch] == 2 {
				if d.mixedBlockFlag[gr][ch] == 1 {
					longHigh = 8
					shortLow = 3
				} else {
					longLow = 22
				}
			} else {
				shortLow = 13
			}

			for sfb := longLow; sfb < longHigh; sfb++ {
				exp := 326 - 210 + d.globalGain[gr][ch]
				if sfb < 21 {
					k := d.scalefacL[gr][ch][sfb]
					k += d.preflag[gr][ch] * pretab[sfb]
					k <<= uint(d.scalefacScale[gr][ch] + 1)
					exp -= k
				}
				q := exp2[exp]
				low := scfBandsL[d.samplingFreq][sfb]
				high := scfBandsL[d.samplingFreq][sfb+1]
				for n := low; n < high; n++ {
					d.huffmanData[gr][ch][n] *= q
				}
			}

			for sfb := shortLow; sfb < shortHigh; sfb++ {
				low := scfBandsS[d.samplingFreq][sfb]
				length := scfBandsS[d.samplingFreq][sfb+1] - low
				for window := 0; window < 3; window++ {
					exp := 326 - 210 + d.globalGain[gr][ch]
					exp -= 8 * d.subblockGain[gr][ch][window]
					if sfb < 12 {
						k := d.scalefacS[gr][ch][sfb][window]
						k <<= uint(d.scalefacScale[gr][ch] + 1)
						exp -= k
					}
					q := exp2[exp]
					winLow := 3*low + window*length
					winHigh := winLow + length
					for n := winLow; n < winHigh; n++ {
						d.huffmanData[gr][ch][n] *= q
					}
				}
			}
		}
	}
}
1154054
func (m *MediaType) Decoder(body io.Reader) (Decoder, error) {
	if decfunc, ok := decoders[m.Format]; ok {
		return decfunc(body), nil
	}
	return nil, fmt.Errorf("No decoder found for format %s (%s)", m.Format, m.String())
}
547156
func (c *parameterCodec) DecodeParameters(parameters url.Values, from unversioned.GroupVersion, into Object) error {
	if len(parameters) == 0 {
		return nil
	}
	targetGVK, _, err := c.typer.ObjectKind(into)
	if err != nil {
		return err
	}
	if targetGVK.GroupVersion() == from {
		return c.convertor.Convert(&parameters, into)
	}
	input, err := c.creator.New(from.WithKind(targetGVK.Kind))
	if err != nil {
		return err
	}
	if err := c.convertor.Convert(&parameters, input); err != nil {
		return err
	}
	return c.convertor.Convert(input, into)
}
863749
func (d *ulReqDecoder) decodeCaps() stateFn {
	d.line = bytes.TrimPrefix(d.line, sp)
	if err := d.data.Capabilities.Decode(d.line); err != nil {
		d.error("invalid capabilities: %s", err)
	}

	return d.decodeOtherWants
}
1195812
func Mat4x3FromCols(col0, col1, col2 Vec4) Mat4x3 {
	return Mat4x3{col0[0], col0[1], col0[2], col0[3], col1[0], col1[1], col1[2], col1[3], col2[0], col2[1], col2[2], col2[3]}
}
731563
func (f genHelperDecoder) DecArrayCannotExpand(sliceLen, streamLen int) {
	f.d.arrayCannotExpand(sliceLen, streamLen)
}
855332
func (m *RcChannelsScaled) Decode(buf []byte) {
	data := bytes.NewBuffer(buf)
	binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS)
	binary.Read(data, binary.LittleEndian, &m.CHAN1_SCALED)
	binary.Read(data, binary.LittleEndian, &m.CHAN2_SCALED)
	binary.Read(data, binary.LittleEndian, &m.CHAN3_SCALED)
	binary.Read(data, binary.LittleEndian, &m.CHAN4_SCALED)
	binary.Read(data, binary.LittleEndian, &m.CHAN5_SCALED)
	binary.Read(data, binary.LittleEndian, &m.CHAN6_SCALED)
	binary.Read(data, binary.LittleEndian, &m.CHAN7_SCALED)
	binary.Read(data, binary.LittleEndian, &m.CHAN8_SCALED)
	binary.Read(data, binary.LittleEndian, &m.PORT)
	binary.Read(data, binary.LittleEndian, &m.RSSI)
}
1351998
func (i *InverseBloomFilter) decodeToArray(stream io.Reader) ([][]byte, uint64, uint64, error) {
	var capacity, size uint64

	err := binary.Read(stream, binary.BigEndian, &capacity)
	if err != nil {
		return nil, 0, 0, err
	}

	err = binary.Read(stream, binary.BigEndian, &size)
	if err != nil {
		return nil, 0, 0, err
	}

	// Read the encoded slice and decode into [][]byte
	encoded := make([]byte, size)
	stream.Read(encoded)
	buf := bytes.NewBuffer(encoded)
	dec := gob.NewDecoder(buf)
	decoded := make([][]byte, capacity)
	dec.Decode(&decoded)

	return decoded, capacity, size, nil
}
4006
func decodeStructObjectMethods(mrb *Mrb, v *MrbValue) decodeStructGetter {
	return func(key string) (*MrbValue, error) {
		return v.Call(key)
	}
}
55162
func (mat *T) ScaleVec3(s *vec3.T) *T {
	mat[0][0] *= s[0]
	mat[1][1] *= s[1]
	mat[2][2] *= s[2]
	return mat
}
44368
func (co *Context) ScaleTensor(yDesc *TensorDescriptor, y Memory, alpha float64) error {
	var alphaC unsafe.Pointer
	switch yDesc.dataType {
	case Float, Half:
		var alphaF C.float
		alphaF = C.float(float32(alpha))
		alphaC = unsafe.Pointer(&alphaF)
	case Double:
		var alphaF C.double
		alphaF = C.double(alpha)
		alphaC = unsafe.Pointer(&alphaF)
	default:
		return errors.Errorf("Unsupported data type: %v", yDesc.dataType)
	}
	// call cudnnScaleTensor
	return result(C.cudnnScaleTensor(co.internal, yDesc.internal, y.Pointer(), alphaC))
}
365899
func (d *ulReqDecoder) decodeOtherWants() stateFn {
	if ok := d.nextLine(); !ok {
		return nil
	}

	if bytes.HasPrefix(d.line, shallow) {
		return d.decodeShallow
	}

	if bytes.HasPrefix(d.line, deepen) {
		return d.decodeDeepen
	}

	if len(d.line) == 0 {
		return nil
	}

	if !bytes.HasPrefix(d.line, want) {
		d.error("unexpected payload while expecting a want: %q", d.line)
		return nil
	}
	d.line = bytes.TrimPrefix(d.line, want)

	hash, ok := d.readHash()
	if !ok {
		return nil
	}
	d.data.Wants = append(d.data.Wants, hash)

	return d.decodeOtherWants
}
738009
func (d *Decoder) decodeScalefactorSelectionInformation2() error {
	for sb := 0; sb < 32; sb++ {
		for ch := 0; ch < d.nChannels; ch++ {
			if d.allocation[ch][sb] != 0 {
				scfsi, err := d.stream.readBits(2)
				if err != nil {
					return err
				}
				d.scfsi2[ch][sb] = scfsi
			}
		}
	}

	return nil
}
1215901
func (m *Matrix) ScaleComponent() (x, y float32) {
	return m.Val[m00], m.Val[m11]
}
1294025
func calcFactors(width, height uint, oldWidth, oldHeight float64) (scaleX, scaleY float64) {
	if width == 0 {
		if height == 0 {
			scaleX = 1.0
			scaleY = 1.0
		} else {
			scaleY = oldHeight / float64(height)
			scaleX = scaleY
		}
	} else {
		scaleX = oldWidth / float64(width)
		if height == 0 {
			scaleY = scaleX
		} else {
			scaleY = oldHeight / float64(height)
		}
	}
	return
}