Class: JXL::Headers::BitDepth
- Inherits:
-
Data
- Object
- Data
- JXL::Headers::BitDepth
- Defined in:
- lib/jxl/headers/bit_depth.rb
Instance Attribute Summary collapse
-
#bits_per_sample ⇒ Object
readonly
Returns the value of attribute bits_per_sample.
-
#exponent_bits ⇒ Object
readonly
Returns the value of attribute exponent_bits.
-
#floating_point ⇒ Object
readonly
Returns the value of attribute floating_point.
Class Method Summary collapse
Instance Attribute Details
#bits_per_sample ⇒ Object (readonly)
Returns the value of attribute bits_per_sample
5 6 7 |
# File 'lib/jxl/headers/bit_depth.rb', line 5 def bits_per_sample @bits_per_sample end |
#exponent_bits ⇒ Object (readonly)
Returns the value of attribute exponent_bits
5 6 7 |
# File 'lib/jxl/headers/bit_depth.rb', line 5 def exponent_bits @exponent_bits end |
#floating_point ⇒ Object (readonly)
Returns the value of attribute floating_point
5 6 7 |
# File 'lib/jxl/headers/bit_depth.rb', line 5 def floating_point @floating_point end |
Class Method Details
.read(reader) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/jxl/headers/bit_depth.rb', line 6 def self.read(reader) floating_point = Bit::Field.read_bool(reader) bits_per_sample = if floating_point Bit::Field.u32(reader, Bit::Field.val(32), Bit::Field.val(16), Bit::Field.val(24), Bit::Field.bits_offset(6, 1)) else Bit::Field.u32(reader, Bit::Field.val(8), Bit::Field.val(10), Bit::Field.val(12), Bit::Field.bits_offset(6, 1)) end exponent_bits = floating_point ? reader.read(4) + 1 : 0 validate!(floating_point, bits_per_sample, exponent_bits) new(floating_point:, bits_per_sample:, exponent_bits:) end |