Skip to content

Commit 7f8dedb

Browse files
eskerrosetta-jpn
authored andcommitted
Fix rustfmt in jpeg code
Test: cargo fmt --check --all
1 parent b087a91 commit 7f8dedb

File tree

4 files changed

+95
-62
lines changed

4 files changed

+95
-62
lines changed

lib/src/buffer.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,9 @@ impl BufferType {
401401

402402
BufferType::EncMiscParameter(_) => bindings::VABufferType::VAEncMiscParameterBufferType,
403403

404-
BufferType::ProcPipelineParameter(_) => bindings::VABufferType::VAProcPipelineParameterBufferType,
404+
BufferType::ProcPipelineParameter(_) => {
405+
bindings::VABufferType::VAProcPipelineParameterBufferType
406+
}
405407
BufferType::QMatrix(_) => bindings::VABufferType::VAQMatrixBufferType,
406408
}
407409
}

lib/src/buffer/enc_jpeg.rs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,20 @@ impl PicFlags {
1717
interleaved: u32,
1818
differential: u32,
1919
) -> Self {
20-
let _bitfield_1 = bindings::_VAEncPictureParameterBufferJPEG__bindgen_ty_1__bindgen_ty_1::new_bitfield_1(
21-
profile,
22-
progressive,
23-
huffman,
24-
interleaved,
25-
differential,
26-
);
20+
let _bitfield_1 =
21+
bindings::_VAEncPictureParameterBufferJPEG__bindgen_ty_1__bindgen_ty_1::new_bitfield_1(
22+
profile,
23+
progressive,
24+
huffman,
25+
interleaved,
26+
differential,
27+
);
2728
Self(bindings::_VAEncPictureParameterBufferJPEG__bindgen_ty_1 {
2829
bits: bindings::_VAEncPictureParameterBufferJPEG__bindgen_ty_1__bindgen_ty_1 {
2930
_bitfield_align_1: Default::default(),
3031
_bitfield_1,
3132
__bindgen_padding_0: Default::default(),
32-
}
33+
},
3334
})
3435
}
3536
}
@@ -56,7 +57,7 @@ impl EncPictureParameterBufferJPEG {
5657
reconstructed_picture,
5758
picture_width,
5859
picture_height,
59-
coded_buf ,
60+
coded_buf,
6061
pic_flags: pic_flags.0,
6162
sample_bit_depth,
6263
num_scan,
@@ -79,15 +80,13 @@ impl EncPictureParameterBufferJPEG {
7980
}
8081

8182
/// Wrapper over the `components` bindgen field in `VAEncSliceParameterBufferJPEG`.
82-
pub struct EncSliceParameterBufferJPEGComponent(bindings::_VAEncSliceParameterBufferJPEG__bindgen_ty_1);
83+
pub struct EncSliceParameterBufferJPEGComponent(
84+
bindings::_VAEncSliceParameterBufferJPEG__bindgen_ty_1,
85+
);
8386

8487
impl EncSliceParameterBufferJPEGComponent {
8588
/// Creates the bindgen field.
86-
pub fn new(
87-
component_selector: u8,
88-
dc_table_selector: u8,
89-
ac_table_selector: u8,
90-
) -> Self {
89+
pub fn new(component_selector: u8, dc_table_selector: u8, ac_table_selector: u8) -> Self {
9190
Self(bindings::_VAEncSliceParameterBufferJPEG__bindgen_ty_1 {
9291
component_selector,
9392
dc_table_selector,

lib/src/buffer/jpeg_baseline.rs

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
use crate::bindings;
88

99
/// Wrapper over the `components` bindgen field in `VAPictureParameterBufferJPEGBaseline`.
10-
pub struct PictureParameterBufferJPEGBaselineComponent(bindings::_VAPictureParameterBufferJPEGBaseline__bindgen_ty_1);
10+
pub struct PictureParameterBufferJPEGBaselineComponent(
11+
bindings::_VAPictureParameterBufferJPEGBaseline__bindgen_ty_1,
12+
);
1113

1214
impl PictureParameterBufferJPEGBaselineComponent {
1315
/// Creates the bindgen field.
@@ -18,12 +20,14 @@ impl PictureParameterBufferJPEGBaselineComponent {
1820
v_sampling_factor: u8,
1921
quantiser_table_selector: u8,
2022
) -> Self {
21-
Self(bindings::_VAPictureParameterBufferJPEGBaseline__bindgen_ty_1 {
22-
component_id,
23-
h_sampling_factor,
24-
v_sampling_factor,
25-
quantiser_table_selector,
26-
})
23+
Self(
24+
bindings::_VAPictureParameterBufferJPEGBaseline__bindgen_ty_1 {
25+
component_id,
26+
h_sampling_factor,
27+
v_sampling_factor,
28+
quantiser_table_selector,
29+
},
30+
)
2731
}
2832

2933
/// Returns the inner FFI type. Useful for testing purposes.
@@ -69,21 +73,21 @@ impl PictureParameterBufferJPEGBaseline {
6973
}
7074

7175
/// Wrapper over the `components` bindgen field in `VASliceParameterBufferJPEGBaseline`.
72-
pub struct VASliceParameterBufferJPEGBaselineComponent(bindings::_VASliceParameterBufferJPEGBaseline__bindgen_ty_1);
76+
pub struct VASliceParameterBufferJPEGBaselineComponent(
77+
bindings::_VASliceParameterBufferJPEGBaseline__bindgen_ty_1,
78+
);
7379

7480
impl VASliceParameterBufferJPEGBaselineComponent {
7581
/// Creates the bindgen field.
7682
#[allow(clippy::too_many_arguments)]
77-
pub fn new(
78-
component_selector: u8,
79-
dc_table_selector: u8,
80-
ac_table_selector: u8,
81-
) -> Self {
82-
Self(bindings::_VASliceParameterBufferJPEGBaseline__bindgen_ty_1 {
83-
component_selector,
84-
dc_table_selector,
85-
ac_table_selector,
86-
})
83+
pub fn new(component_selector: u8, dc_table_selector: u8, ac_table_selector: u8) -> Self {
84+
Self(
85+
bindings::_VASliceParameterBufferJPEGBaseline__bindgen_ty_1 {
86+
component_selector,
87+
dc_table_selector,
88+
ac_table_selector,
89+
},
90+
)
8791
}
8892

8993
/// Returns the inner FFI type. Useful for testing purposes.
@@ -160,7 +164,9 @@ impl IQMatrixBufferJPEGBaseline {
160164
}
161165

162166
/// Wrapper over the `huffman_table` bindgen field in `VAHuffmanTableBufferJPEGBaseline`.
163-
pub struct HuffmanTableBufferJPEGBaselineHuffmanTable(bindings::_VAHuffmanTableBufferJPEGBaseline__bindgen_ty_1);
167+
pub struct HuffmanTableBufferJPEGBaselineHuffmanTable(
168+
bindings::_VAHuffmanTableBufferJPEGBaseline__bindgen_ty_1,
169+
);
164170

165171
impl HuffmanTableBufferJPEGBaselineHuffmanTable {
166172
/// Creates the bindgen field.

lib/src/buffer/proc_pipeline.rs

Lines changed: 53 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,8 @@ pub struct BlendState(bindings::VABlendState);
1212

1313
impl BlendState {
1414
/// Creates the bindgen field
15-
pub fn new(
16-
flags: u32,
17-
global_alpha: f32,
18-
min_luma: f32,
19-
max_luma: f32,
20-
) -> Self {
21-
Self(bindings::VABlendState{
15+
pub fn new(flags: u32, global_alpha: f32, min_luma: f32, max_luma: f32) -> Self {
16+
Self(bindings::VABlendState {
2217
flags,
2318
global_alpha,
2419
min_luma,
@@ -39,7 +34,7 @@ impl ProcColorProperties {
3934
transfer_characteristics: u8,
4035
matrix_coefficients: u8,
4136
) -> Self {
42-
Self(bindings::VAProcColorProperties{
37+
Self(bindings::VAProcColorProperties {
4338
chroma_sample_location,
4439
color_range,
4540
colour_primaries,
@@ -61,14 +56,10 @@ pub struct HdrMetaData(bindings::VAHdrMetaData);
6156

6257
impl<'a> HdrMetaData {
6358
/// Creates the bindgen field
64-
pub fn new(
65-
metadata_type: u32,
66-
metadata: Option<&'a [u8]>,
67-
metadata_size: u32,
68-
) -> Self {
69-
Self(bindings::VAHdrMetaData{
59+
pub fn new(metadata_type: u32, metadata: Option<&'a [u8]>, metadata_size: u32) -> Self {
60+
Self(bindings::VAHdrMetaData {
7061
metadata_type: metadata_type as _,
71-
metadata: metadata.map_or(ptr::null_mut(), |f| f.as_ptr() as *mut _),
62+
metadata: metadata.map_or(ptr::null_mut(), |f| f.as_ptr() as *mut _),
7263
metadata_size,
7364
reserved: Default::default(),
7465
})
@@ -131,30 +122,65 @@ impl ProcPipelineParameterBuffer {
131122

132123
slf.c_params = Box::new(bindings::VAProcPipelineParameterBuffer {
133124
surface,
134-
surface_region: slf.surface_region.as_deref().map_or(ptr::null_mut(), |r| r as *const _ as *mut _),
125+
surface_region: slf
126+
.surface_region
127+
.as_deref()
128+
.map_or(ptr::null_mut(), |r| r as *const _ as *mut _),
135129
surface_color_standard: surface_color_standard as _,
136-
output_region: slf.output_region.as_deref().map_or(ptr::null_mut(), |r| r as *const _ as *mut _),
130+
output_region: slf
131+
.output_region
132+
.as_deref()
133+
.map_or(ptr::null_mut(), |r| r as *const _ as *mut _),
137134
output_background_color,
138135
output_color_standard: output_color_standard as _,
139136
pipeline_flags,
140137
filter_flags,
141-
filters: slf.filters.as_deref().map_or(ptr::null_mut(), |f| f.as_ptr() as *mut _),
138+
filters: slf
139+
.filters
140+
.as_deref()
141+
.map_or(ptr::null_mut(), |f| f.as_ptr() as *mut _),
142142
num_filters: slf.filters.as_ref().map_or(0, |f| f.len() as u32),
143-
forward_references: slf.forward_references.as_deref().map_or(ptr::null_mut(), |r| r.as_ptr() as *mut _),
144-
num_forward_references: slf.forward_references.as_ref().map_or(0, |f| f.len() as u32),
145-
backward_references: slf.backward_references.as_deref().map_or(ptr::null_mut(), |r| r.as_ptr() as *mut _),
146-
num_backward_references: slf.backward_references.as_ref().map_or(0, |b| b.len() as u32),
143+
forward_references: slf
144+
.forward_references
145+
.as_deref()
146+
.map_or(ptr::null_mut(), |r| r.as_ptr() as *mut _),
147+
num_forward_references: slf
148+
.forward_references
149+
.as_ref()
150+
.map_or(0, |f| f.len() as u32),
151+
backward_references: slf
152+
.backward_references
153+
.as_deref()
154+
.map_or(ptr::null_mut(), |r| r.as_ptr() as *mut _),
155+
num_backward_references: slf
156+
.backward_references
157+
.as_ref()
158+
.map_or(0, |b| b.len() as u32),
147159
rotation_state,
148-
blend_state: slf.blend_state.as_deref().map_or(ptr::null(), |b| b.as_ptr() as *const bindings::VABlendState),
160+
blend_state: slf
161+
.blend_state
162+
.as_deref()
163+
.map_or(ptr::null(), |b| b.as_ptr() as *const bindings::VABlendState),
149164
mirror_state,
150-
additional_outputs: slf.additional_outputs.as_deref().map_or(ptr::null_mut(), |a| a.as_ptr() as *mut _),
151-
num_additional_outputs: slf.additional_outputs.as_ref().map_or(0, |a| a.len() as u32),
165+
additional_outputs: slf
166+
.additional_outputs
167+
.as_deref()
168+
.map_or(ptr::null_mut(), |a| a.as_ptr() as *mut _),
169+
num_additional_outputs: slf
170+
.additional_outputs
171+
.as_ref()
172+
.map_or(0, |a| a.len() as u32),
152173
input_surface_flag,
153174
output_surface_flag,
154175
input_color_properties: input_color_properties.0,
155176
output_color_properties: output_color_properties.0,
156177
processing_mode,
157-
output_hdr_metadata: slf.output_hdr_metadata.as_deref().map_or(ptr::null_mut(), |o| o.as_ptr() as *mut bindings::VAHdrMetaData),
178+
output_hdr_metadata: slf
179+
.output_hdr_metadata
180+
.as_deref()
181+
.map_or(ptr::null_mut(), |o| {
182+
o.as_ptr() as *mut bindings::VAHdrMetaData
183+
}),
158184
va_reserved: Default::default(),
159185
});
160186

@@ -169,4 +195,4 @@ impl ProcPipelineParameterBuffer {
169195
pub fn inner(&self) -> &bindings::VAProcPipelineParameterBuffer {
170196
self.c_params.as_ref()
171197
}
172-
}
198+
}

0 commit comments

Comments
 (0)