mirror of
https://github.com/storytold/deckcraft.git
synced 2026-10-24 18:46:57 -06:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c632bfdd6b | ||
|
|
e181444b86 | ||
|
|
da1733e0a1 |
@@ -7,7 +7,10 @@ use deckcraft_model::{
|
||||
AnimClass, AnimStart, Animation, ColorRef, CustomShow, Presentation, Rgba, Shape, ShapeId, Slide, SlideId, TextBody, Transition, Xfrm,
|
||||
};
|
||||
|
||||
use crate::*;
|
||||
use crate::{
|
||||
AnimState, Layer, LinkJump, MotionPath, ShowAction, ShowState, Source, Timeline, TriggerPlay, default_path, ease, morph_crop, morph_frame,
|
||||
morph_pairs, morph_xfrm, show_order, transition_frame, transition_layers,
|
||||
};
|
||||
|
||||
const W: f64 = 960.0;
|
||||
const H: f64 = 540.0;
|
||||
|
||||
@@ -6,7 +6,7 @@ use std::sync::Arc;
|
||||
use deckcraft_model::text::Action;
|
||||
use deckcraft_model::{AnimClass, AnimStart, Animation, Presentation, Shape, ShapeId, Slide, SlideId, Transition, Xfrm};
|
||||
|
||||
use crate::*;
|
||||
use crate::{Click, HitShape, LinkJump, ShowAction, ShowState, Target, Timeline};
|
||||
|
||||
fn shape(id: u32) -> Shape {
|
||||
Shape { id: ShapeId(id), name: format!("S{id}"), xfrm: Some(Xfrm::new(100.0, 100.0, 200.0, 100.0)), ..Default::default() }
|
||||
|
||||
@@ -5,7 +5,7 @@ use std::sync::Arc;
|
||||
use deckcraft_model::anim::{ANIMATIONS, AnimClass, AnimStart, Animation, TextBuild, animation_info};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{CommandSpec, bad, bool_or, bool_param, id_param, ok, str_param, targets, usize_param};
|
||||
use crate::{Result, Session};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -4,7 +4,7 @@ use deckcraft_geom::{Point, Rect, Xfrm};
|
||||
use deckcraft_model::{Shape, ShapeId, ShapeKind};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{CommandSpec, NO_ID_SPACE, bad, bool_or, edit_geometry, id_param, ok, str_param, targets, usize_param, with_param, xfrm_of};
|
||||
use crate::{Result, Session};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -9,7 +9,7 @@ use deckcraft_model::{MediaId, ShapeId, ShapeKind};
|
||||
use image::{GrayImage, Rgba, RgbaImage};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{CommandSpec, NO_ID_SPACE, bad, str_param, targets};
|
||||
use crate::{Result, Session};
|
||||
|
||||
/// The effects offered: `a14` element name and label.
|
||||
|
||||
@@ -8,7 +8,7 @@ use std::collections::VecDeque;
|
||||
use deckcraft_model::{ShapeId, ShapeKind};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{CommandSpec, NO_ID_SPACE, bad, base64_encode, f64_or, targets};
|
||||
use crate::{Result, Session};
|
||||
|
||||
/// Larger pictures are refused rather than matted slowly (16 megapixels).
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use crate::*;
|
||||
use crate::Session;
|
||||
|
||||
fn deck() -> Session {
|
||||
let mut s = Session::with_new();
|
||||
|
||||
@@ -8,7 +8,7 @@ use deckcraft_model::style::PictureFill;
|
||||
use deckcraft_model::{MediaId, Shape, ShapeId, ShapeKind};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{CommandSpec, NO_ID_SPACE, bad, bool_or, f64_param, targets};
|
||||
use crate::{Result, Session};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -10,7 +10,9 @@ use deckcraft_model::theme::{builtin_color_schemes, builtin_font_schemes, builti
|
||||
use deckcraft_model::{Background, Fill, PhType, Presentation, Shape, ShapeId, defaults};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{
|
||||
CommandSpec, NO_ID_SPACE, bad, bool_or, bool_param, cmd, color_param, f64_param, ok, rect_param, shape, str_param, text, usize_param, with_param,
|
||||
};
|
||||
use crate::{Result, Session, Target};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -7,7 +7,7 @@ use deckcraft_model::text::TextBody;
|
||||
use deckcraft_model::{MediaId, Shape, ShapeId, Slide, SlideId};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{CommandSpec, NO_ID_SPACE, bad, base64_encode, bool_or, id_param, ids_param, ok, richclip, str_param, targets, text, xfrm_of};
|
||||
use crate::{HistoryEntry, Result, Session};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -7,7 +7,7 @@ use deckcraft_media::MediaInfo;
|
||||
use deckcraft_model::{MediaId, MediaItem, Presentation, Shape, ShapeKind, defaults};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{CommandSpec, bad, base64_encode, bool_or, f64_or, ok, str_param, usize_param};
|
||||
use crate::{DocState, EngineError, Result, Session};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -6,7 +6,7 @@ use deckcraft_model::text::RunKind;
|
||||
use deckcraft_model::{Paragraph, Shape, ShapeKind, Slide, TextBody};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{CommandSpec, bad, bool_or, str_param, text};
|
||||
use crate::{Result, Session};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -8,7 +8,7 @@ use deckcraft_model::{ColorRef, ColorTransform, Effects, Fill, Line, SchemeSlot,
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::text::{format_body, format_para, format_run};
|
||||
use super::*;
|
||||
use super::{CommandSpec, bad, bool_or, bool_param, color_param, edit_shapes, f64_or, f64_param, ids_param, ok, str_param};
|
||||
use crate::{Result, Session};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -7,7 +7,7 @@ use deckcraft_geom::Xfrm;
|
||||
use deckcraft_model::{Fill, Presentation, Rgba, Shape, ShapeKind};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{CommandSpec, bad, str_param, text, usize_param, xfrm_of};
|
||||
use crate::{Result, Selection, Session};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -8,7 +8,10 @@ use deckcraft_model::text::{AutoFit, RunKind, TextBody};
|
||||
use deckcraft_model::{Chart, ColorRef, Fill, Geom, Line, MediaClip, Shape, ShapeId, ShapeKind, ShapeStyle, Table};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{
|
||||
CommandSpec, NO_ID_SPACE, bad, base64_decode, base64_encode, bool_or, bool_param, edit_shapes, format, ok, rect_param, str_param, text,
|
||||
usize_param, xfrm_of,
|
||||
};
|
||||
use crate::{EngineError, Result, Session};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -4,7 +4,7 @@ use deckcraft_model::resolve::{self, Ctx};
|
||||
use deckcraft_model::{Shape, ShapeKind};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{CommandSpec, bad, id_param, str_param, usize_param, xfrm_of};
|
||||
use crate::{Result, Session};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
use deckcraft_model::{MediaClip, ShapeId, ShapeKind};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{CommandSpec, NO_ID_SPACE, bad, base64_encode, bool_param, edit_shapes, targets};
|
||||
use crate::{EngineError, MediaStatus, Result, Session, UiRequest};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -9,7 +9,7 @@ use i_overlay::core::overlay_rule::OverlayRule;
|
||||
use i_overlay::float::single::SingleFloatOverlay;
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{CommandSpec, NO_ID_SPACE, bad, base64_encode, str_param, targets, text, xfrm_of};
|
||||
use crate::{Result, Session};
|
||||
|
||||
/// Closed polygons (slide points) describing a filled area (non-zero winding).
|
||||
|
||||
@@ -6,7 +6,7 @@ use deckcraft_model::style::{Effects, Reflection, Shadow};
|
||||
use deckcraft_model::{ColorRef, Geom, Line, Shape};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{CommandSpec, bad, edit_shapes, str_param};
|
||||
use crate::{Result, Session};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -10,7 +10,7 @@ use deckcraft_geom::{PathEl, Point, Xfrm};
|
||||
use deckcraft_model::{CustomPath, Geom, Shape, ShapeId, ShapeKind};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{CommandSpec, bad, f64_param, id_param, ok, str_param, xfrm_of};
|
||||
use crate::{Result, Session};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -6,7 +6,7 @@ use deckcraft_model::style::{PictureAdjust, PictureMode};
|
||||
use deckcraft_model::{ColorRef, Shape, ShapeId, ShapeKind};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{CommandSpec, bad, bool_or, current_shapes, edit_shapes, str_param, targets, text, xfrm_of};
|
||||
use crate::{Result, Session};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -13,7 +13,7 @@ use deckcraft_model::text::{Action, Hyperlink, RunProps, TextBody};
|
||||
use deckcraft_model::{LayoutId, MasterId, MediaId, Presentation, ShapeId, ShapeKind, Slide, SlideId};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{CommandSpec, NO_ID_SPACE, bad, bool_or, cmd, slide, text, usize_param};
|
||||
use crate::{Result, Session, media_refs};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -5,7 +5,7 @@ use std::sync::Arc;
|
||||
use deckcraft_model::Comment;
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{CommandSpec, bad, base64_decode, bool_or, bool_param, f64_or, id_param, ok, str_param, text, usize_param};
|
||||
use crate::{Result, Session, Target, UiRequest};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
use deckcraft_model::{Shape, ShapeId};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{CommandSpec, bad, bool_or, id_param, ids_param, ok};
|
||||
use crate::{Result, Session};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use crate::Session;
|
||||
use crate::tools::{Mods, PointerEvent, PointerKind};
|
||||
use crate::*;
|
||||
|
||||
/// A blank slide with A, B, C (back to front) and G = group [D, H = group [E, F]] in front.
|
||||
fn deck() -> (Session, Vec<u32>) {
|
||||
|
||||
@@ -8,7 +8,10 @@ use deckcraft_model::style::{Dash, Glow, Gradient, GradientShape, GradientStop,
|
||||
use deckcraft_model::{ColorRef, Effects, Fill, Geom, Line, ShapeStyle};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{
|
||||
CommandSpec, NO_ID_SPACE, bad, bool_or, bool_param, color_param, color_value, edit_geometry, edit_shapes, f64_param, format, id_param, ok,
|
||||
str_param, targets, text, three_d, usize_param, with_param, xfrm_of,
|
||||
};
|
||||
use crate::{Result, Session};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -6,7 +6,7 @@ use deckcraft_model::text::TextBody;
|
||||
use deckcraft_model::{LayoutId, LayoutType, Presentation, Section, SlideId, defaults};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{CommandSpec, NO_ID_SPACE, bad, bool_or, bool_param, ok, opt_usize_param, str_param, text, usize_param};
|
||||
use crate::{Result, Session, Target};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -14,7 +14,7 @@ use deckcraft_model::{
|
||||
};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{CommandSpec, NO_ID_SPACE, bad, bool_or, current_shapes, shape_of, str_param, targets, text, xfrm_of};
|
||||
use crate::{EngineError, Result, Session};
|
||||
|
||||
/// Deepest outline level the Text Pane allows.
|
||||
|
||||
@@ -4,7 +4,10 @@ use deckcraft_geom::{Affine, Point, Rect};
|
||||
use deckcraft_model::{Shape, ShapeKind, Table};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{
|
||||
CommandSpec, bad, bool_or, bool_param, color_param, edit_shapes, f64_param, id_param, ok, str_param, table_drawn_heights, targets, usize_param,
|
||||
xfrm_of,
|
||||
};
|
||||
use crate::{DocState, Result, Session};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -9,7 +9,9 @@ use deckcraft_model::text::{Align, AutoFit, Hyperlink, Paragraph, Run, RunKind,
|
||||
use deckcraft_model::{Presentation, Shape, ShapeId, ShapeKind};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{
|
||||
CommandSpec, NO_TEXT_POINT, SELECT_TEXT_OR_SHAPE, bad, bool_or, cmd, edit_shapes, format, id_param, ok, shape_of, str_param, text, xfrm_of,
|
||||
};
|
||||
use crate::{DocState, Result, Selection, Session, Target, TextSel};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -6,7 +6,7 @@ use deckcraft_model::Transition;
|
||||
use deckcraft_model::anim::TRANSITIONS;
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{CommandSpec, NO_ID_SPACE, bad, bool_param, ok, str_param, usize_param};
|
||||
use crate::{Result, Session};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -13,7 +13,7 @@ use deckcraft_model::text::{Action, Hyperlink, TextBody};
|
||||
use deckcraft_model::{LayoutType, Shape, ShapeId, ShapeKind, SlideId, defaults};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use super::{CommandSpec, NO_ID_SPACE, bad, bool_or, str_param};
|
||||
use crate::{Result, Session};
|
||||
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
|
||||
@@ -9,7 +9,7 @@ use std::collections::VecDeque;
|
||||
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use crate::*;
|
||||
use crate::{EngineError, Session, command_specs, sample};
|
||||
|
||||
/// Commands that touch the file system, other windows or real time; the soak drives the rest.
|
||||
fn skipped(id: &str) -> bool {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
use serde_json::json;
|
||||
|
||||
use crate::*;
|
||||
use crate::{
|
||||
DocState, History, Presentation, Session, Target, TextSel, ToolKind, Value, cmd, command_specs, connect, find_command, model, sample, tools,
|
||||
};
|
||||
|
||||
fn session() -> Session {
|
||||
Session::with_new()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use super::*;
|
||||
use super::Presentation;
|
||||
use deckcraft_model::chart::{Chart, ChartPart, ChartRel, ChartType};
|
||||
use deckcraft_model::{Master, Shape, ShapeId};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
//! ribbons, gears, tabs and chart markers. Like the rest of `preset`, every outline is our own
|
||||
//! construction, fitted to how the shapes look and to what their adjust values mean.
|
||||
|
||||
use super::*;
|
||||
use super::{
|
||||
Corner, Dir, FillMode, Geometry, Handle, Pb, Point, Rect, Vec2, corner_rect, fill, fill_eo, fill_only, mid_sites, orient, shade, simple,
|
||||
stroke_only, vis,
|
||||
};
|
||||
|
||||
/// Builds the presets this module knows; `None` for any other name.
|
||||
pub(super) fn build(name: &str, w: f64, h: f64, a: &dyn Fn(usize) -> f64) -> Option<Geometry> {
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
use super::*;
|
||||
use super::{
|
||||
Band, BezPath, CATALOG, Guide, Point, Rect, WarpLine, adjust_count, adjust_defaults, band_of_line, handles, is_follow, is_supported, warp,
|
||||
};
|
||||
|
||||
const W: f64 = 420.0;
|
||||
const H: f64 = 200.0;
|
||||
|
||||
+117
-137
@@ -397,37 +397,6 @@ impl<'a> SliceDecoder<'a> {
|
||||
d.decode_data()
|
||||
}
|
||||
|
||||
/// Context initialisation / synchronisation at the start of a CTB (9.3.1, 9.3.2.1).
|
||||
fn init_ctb_contexts(&mut self, layout: &Layout, ts: u32, rs: u32, wctb: u32, first: bool) -> Result<()> {
|
||||
let ctb = 1i32 << self.sps.log2_ctb;
|
||||
let first_in_tile = ts == 0 || layout.tile_id[ts as usize] != layout.tile_id[ts as usize - 1];
|
||||
let wpp_row_start = self.pps.entropy_coding_sync
|
||||
&& (rs.is_multiple_of(wctb) || layout.tile_id[ts as usize] != layout.tile_id[layout.rs_to_ts[rs as usize - 1] as usize]);
|
||||
if first_in_tile {
|
||||
if !first {
|
||||
init_contexts(&mut self.c.ctx, self.slice_qp, self.init_type);
|
||||
}
|
||||
self.last_qp = self.slice_qp;
|
||||
} else if wpp_row_start {
|
||||
let (x0, y0) = (self.ctb_x, self.ctb_y);
|
||||
let avail = self.pic.zavail(x0, y0, x0 + ctb, y0 - ctb, self.slice_addr);
|
||||
match (&self.pic.wpp_ctx, avail) {
|
||||
(Some(saved), true) => self.c.ctx = **saved,
|
||||
_ => init_contexts(&mut self.c.ctx, self.slice_qp, self.init_type),
|
||||
}
|
||||
self.last_qp = self.slice_qp;
|
||||
} else if first && self.sh.dependent {
|
||||
match &self.pic.ds_ctx {
|
||||
Some((saved, qp)) => {
|
||||
self.c.ctx = **saved;
|
||||
self.last_qp = *qp;
|
||||
}
|
||||
None => return invalid("dependent slice segment without stored contexts"),
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn decode_data(&mut self) -> Result<()> {
|
||||
let layout = self.pic.layout.clone();
|
||||
let wctb = self.pic.wctb as u32;
|
||||
@@ -443,7 +412,32 @@ impl<'a> SliceDecoder<'a> {
|
||||
self.ctb_y = ry * ctb;
|
||||
self.pic.ctb_slice[rs as usize] = self.slice_idx;
|
||||
self.pic.ctb_addr[rs as usize] = self.slice_addr;
|
||||
self.init_ctb_contexts(&layout, ts, rs, wctb, first)?;
|
||||
// context initialisation / synchronisation (9.3.1, 9.3.2.1)
|
||||
let first_in_tile = ts == 0 || layout.tile_id[ts as usize] != layout.tile_id[ts as usize - 1];
|
||||
let wpp_row_start = self.pps.entropy_coding_sync
|
||||
&& (rs.is_multiple_of(wctb) || layout.tile_id[ts as usize] != layout.tile_id[layout.rs_to_ts[rs as usize - 1] as usize]);
|
||||
if first_in_tile {
|
||||
if !first {
|
||||
init_contexts(&mut self.c.ctx, self.slice_qp, self.init_type);
|
||||
}
|
||||
self.last_qp = self.slice_qp;
|
||||
} else if wpp_row_start {
|
||||
let (x0, y0) = (self.ctb_x, self.ctb_y);
|
||||
let avail = self.pic.zavail(x0, y0, x0 + ctb, y0 - ctb, self.slice_addr);
|
||||
match (&self.pic.wpp_ctx, avail) {
|
||||
(Some(saved), true) => self.c.ctx = **saved,
|
||||
_ => init_contexts(&mut self.c.ctx, self.slice_qp, self.init_type),
|
||||
}
|
||||
self.last_qp = self.slice_qp;
|
||||
} else if first && self.sh.dependent {
|
||||
match &self.pic.ds_ctx {
|
||||
Some((saved, qp)) => {
|
||||
self.c.ctx = **saved;
|
||||
self.last_qp = *qp;
|
||||
}
|
||||
None => return invalid("dependent slice segment without stored contexts"),
|
||||
}
|
||||
}
|
||||
first = false;
|
||||
if self.sh.sao_luma || self.sh.sao_chroma {
|
||||
self.parse_sao(rx, ry, rs)?;
|
||||
@@ -512,60 +506,56 @@ impl<'a> SliceDecoder<'a> {
|
||||
let mut p = SaoParams::default();
|
||||
for c in 0..3 {
|
||||
let enabled = if c == 0 { self.sh.sao_luma } else { self.sh.sao_chroma };
|
||||
if enabled {
|
||||
self.parse_sao_component(&mut p, c);
|
||||
if !enabled {
|
||||
continue;
|
||||
}
|
||||
if c == 2 {
|
||||
p.type_idx[2] = p.type_idx[1];
|
||||
p.eo_class[2] = p.eo_class[1];
|
||||
} else {
|
||||
p.type_idx[c] = if self.dd(SAO_TYPE) == 0 {
|
||||
0
|
||||
} else if self.bypass() == 0 {
|
||||
1
|
||||
} else {
|
||||
2
|
||||
};
|
||||
}
|
||||
if p.type_idx[c] == 0 {
|
||||
continue;
|
||||
}
|
||||
let bd = if c == 0 { self.pic.bd_y } else { self.pic.bd_c };
|
||||
let cmax = (1u32 << (bd.min(10) - 5)) - 1;
|
||||
let mut abs = [0i16; 4];
|
||||
for a in abs.iter_mut() {
|
||||
let mut v = 0;
|
||||
while v < cmax && self.bypass() == 1 {
|
||||
v += 1;
|
||||
}
|
||||
*a = v as i16;
|
||||
}
|
||||
if p.type_idx[c] == 1 {
|
||||
for a in abs.iter_mut() {
|
||||
if *a != 0 && self.bypass() == 1 {
|
||||
*a = -*a;
|
||||
}
|
||||
}
|
||||
p.band_pos[c] = self.bypass_bits(5) as u8;
|
||||
p.offsets[c] = abs;
|
||||
} else {
|
||||
p.offsets[c] = [abs[0], abs[1], -abs[2], -abs[3]];
|
||||
if c == 0 {
|
||||
p.eo_class[0] = self.bypass_bits(2) as u8;
|
||||
}
|
||||
if c == 1 {
|
||||
p.eo_class[1] = self.bypass_bits(2) as u8;
|
||||
}
|
||||
}
|
||||
}
|
||||
self.pic.sao[rs as usize] = p;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// SAO syntax of one enabled colour component `c` (7.3.8.3).
|
||||
fn parse_sao_component(&mut self, p: &mut SaoParams, c: usize) {
|
||||
if c == 2 {
|
||||
p.type_idx[2] = p.type_idx[1];
|
||||
p.eo_class[2] = p.eo_class[1];
|
||||
} else {
|
||||
p.type_idx[c] = if self.dd(SAO_TYPE) == 0 {
|
||||
0
|
||||
} else if self.bypass() == 0 {
|
||||
1
|
||||
} else {
|
||||
2
|
||||
};
|
||||
}
|
||||
if p.type_idx[c] == 0 {
|
||||
return;
|
||||
}
|
||||
let bd = if c == 0 { self.pic.bd_y } else { self.pic.bd_c };
|
||||
let cmax = (1u32 << (bd.min(10) - 5)) - 1;
|
||||
let mut abs = [0i16; 4];
|
||||
for a in abs.iter_mut() {
|
||||
let mut v = 0;
|
||||
while v < cmax && self.bypass() == 1 {
|
||||
v += 1;
|
||||
}
|
||||
*a = v as i16;
|
||||
}
|
||||
if p.type_idx[c] == 1 {
|
||||
for a in abs.iter_mut() {
|
||||
if *a != 0 && self.bypass() == 1 {
|
||||
*a = -*a;
|
||||
}
|
||||
}
|
||||
p.band_pos[c] = self.bypass_bits(5) as u8;
|
||||
p.offsets[c] = abs;
|
||||
} else {
|
||||
p.offsets[c] = [abs[0], abs[1], -abs[2], -abs[3]];
|
||||
if c == 0 {
|
||||
p.eo_class[0] = self.bypass_bits(2) as u8;
|
||||
}
|
||||
if c == 1 {
|
||||
p.eo_class[1] = self.bypass_bits(2) as u8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn coding_quadtree(&mut self, x0: i32, y0: i32, log2: u32, depth: u32) -> Result<()> {
|
||||
let size = 1i32 << log2;
|
||||
let (w, h) = (self.pic.width as i32, self.pic.height as i32);
|
||||
@@ -836,34 +826,6 @@ impl<'a> SliceDecoder<'a> {
|
||||
self.c.init_engine()
|
||||
}
|
||||
|
||||
/// Most probable luma intra modes of the block at (xp, yp) (8.4.2).
|
||||
fn mpm_list(&self, xp: i32, yp: i32) -> [u32; 3] {
|
||||
let cand_a = if self.pic.zavail(xp, yp, xp - 1, yp, self.slice_addr) {
|
||||
let b = self.pic.blk_at(xp - 1, yp);
|
||||
if b.flags & F_INTRA != 0 { b.ipm as u32 } else { 1 }
|
||||
} else {
|
||||
1
|
||||
};
|
||||
let cand_b = if self.pic.zavail(xp, yp, xp, yp - 1, self.slice_addr) && yp > ((yp >> self.sps.log2_ctb) << self.sps.log2_ctb) {
|
||||
let b = self.pic.blk_at(xp, yp - 1);
|
||||
if b.flags & F_INTRA != 0 { b.ipm as u32 } else { 1 }
|
||||
} else {
|
||||
1
|
||||
};
|
||||
if cand_a == cand_b {
|
||||
if cand_a < 2 { [0, 1, 26] } else { [cand_a, 2 + ((cand_a + 29) % 32), 2 + ((cand_a - 2 + 1) % 32)] }
|
||||
} else {
|
||||
let c = if cand_a != 0 && cand_b != 0 {
|
||||
0
|
||||
} else if cand_a != 1 && cand_b != 1 {
|
||||
1
|
||||
} else {
|
||||
26
|
||||
};
|
||||
[cand_a, cand_b, c]
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_intra_modes(&mut self, x0: i32, y0: i32, n: i32, part: PartMode) -> Result<()> {
|
||||
let nb = if part == PartMode::PNxN { 2 } else { 1 };
|
||||
let pb = n / nb;
|
||||
@@ -876,7 +838,31 @@ impl<'a> SliceDecoder<'a> {
|
||||
for i in 0..nb {
|
||||
let k = (j * nb + i) as usize;
|
||||
let (xp, yp) = (x0 + i * pb, y0 + j * pb);
|
||||
let mut list = self.mpm_list(xp, yp);
|
||||
// candidate modes (8.4.2)
|
||||
let cand_a = if self.pic.zavail(xp, yp, xp - 1, yp, self.slice_addr) {
|
||||
let b = self.pic.blk_at(xp - 1, yp);
|
||||
if b.flags & F_INTRA != 0 { b.ipm as u32 } else { 1 }
|
||||
} else {
|
||||
1
|
||||
};
|
||||
let cand_b = if self.pic.zavail(xp, yp, xp, yp - 1, self.slice_addr) && yp > ((yp >> self.sps.log2_ctb) << self.sps.log2_ctb) {
|
||||
let b = self.pic.blk_at(xp, yp - 1);
|
||||
if b.flags & F_INTRA != 0 { b.ipm as u32 } else { 1 }
|
||||
} else {
|
||||
1
|
||||
};
|
||||
let mut list = if cand_a == cand_b {
|
||||
if cand_a < 2 { [0, 1, 26] } else { [cand_a, 2 + ((cand_a + 29) % 32), 2 + ((cand_a - 2 + 1) % 32)] }
|
||||
} else {
|
||||
let c = if cand_a != 0 && cand_b != 0 {
|
||||
0
|
||||
} else if cand_a != 1 && cand_b != 1 {
|
||||
1
|
||||
} else {
|
||||
26
|
||||
};
|
||||
[cand_a, cand_b, c]
|
||||
};
|
||||
let mode = if prev[k] {
|
||||
let idx = if self.bypass() == 0 {
|
||||
0
|
||||
@@ -952,39 +938,33 @@ impl<'a> SliceDecoder<'a> {
|
||||
self.transform_unit(x0, y0, xb, yb, log2, blk_idx, cbf_luma, cbf_c)
|
||||
}
|
||||
|
||||
/// cu_qp_delta_abs / sign and QP update (7.3.8.14).
|
||||
fn parse_cu_qp_delta(&mut self) -> Result<()> {
|
||||
// cu_qp_delta_abs: prefix TU(5) with ctx 0,1,1,1,1, suffix EG0
|
||||
let mut v = 0;
|
||||
while v < 5 && self.dd(CU_QP_DELTA_ABS + if v == 0 { 0 } else { 1 }) == 1 {
|
||||
v += 1;
|
||||
}
|
||||
if v == 5 {
|
||||
let mut k = 0;
|
||||
while self.bypass() == 1 {
|
||||
v += 1 << k;
|
||||
k += 1;
|
||||
ensure!(k < 32, "invalid cu_qp_delta_abs");
|
||||
}
|
||||
v += self.bypass_bits(k) as i32;
|
||||
}
|
||||
if v != 0 && self.bypass() == 1 {
|
||||
v = -v;
|
||||
}
|
||||
let off = 6 * (self.pic.bd_y as i32 - 8);
|
||||
ensure!(v >= -(26 + off / 2) && v <= 25 + off / 2, "CuQpDeltaVal out of range");
|
||||
self.is_cu_qp_delta_coded = true;
|
||||
self.cu_qp_delta = v;
|
||||
self.update_qp();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn transform_unit(&mut self, x0: i32, y0: i32, xb: i32, yb: i32, log2: u32, blk_idx: u32, cbf_luma: bool, cbf_c: [bool; 2]) -> Result<()> {
|
||||
let n = 1i32 << log2;
|
||||
let chroma_here = log2 > 2 || blk_idx == 3;
|
||||
let cbf_chroma = cbf_c[0] || cbf_c[1];
|
||||
if (cbf_luma || cbf_chroma) && self.pps.cu_qp_delta_enabled && !self.is_cu_qp_delta_coded {
|
||||
self.parse_cu_qp_delta()?;
|
||||
// cu_qp_delta_abs: prefix TU(5) with ctx 0,1,1,1,1, suffix EG0
|
||||
let mut v = 0;
|
||||
while v < 5 && self.dd(CU_QP_DELTA_ABS + if v == 0 { 0 } else { 1 }) == 1 {
|
||||
v += 1;
|
||||
}
|
||||
if v == 5 {
|
||||
let mut k = 0;
|
||||
while self.bypass() == 1 {
|
||||
v += 1 << k;
|
||||
k += 1;
|
||||
ensure!(k < 32, "invalid cu_qp_delta_abs");
|
||||
}
|
||||
v += self.bypass_bits(k) as i32;
|
||||
}
|
||||
if v != 0 && self.bypass() == 1 {
|
||||
v = -v;
|
||||
}
|
||||
let off = 6 * (self.pic.bd_y as i32 - 8);
|
||||
ensure!(v >= -(26 + off / 2) && v <= 25 + off / 2, "CuQpDeltaVal out of range");
|
||||
self.is_cu_qp_delta_coded = true;
|
||||
self.cu_qp_delta = v;
|
||||
self.update_qp();
|
||||
}
|
||||
// luma
|
||||
if self.cu_intra {
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
use super::*;
|
||||
use super::{
|
||||
Cell, Fill, LayoutType, PhType, Presentation, Run, SchemeSlot, Shape, ShapeKind, ShapeStyle, Slide, TextBody, Theme, Xfrm, defaults, resolve,
|
||||
style, text, theme, walk,
|
||||
};
|
||||
use crate::resolve::Ctx;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Synthetic Ogg streams: a small page writer (RFC 3533) and Opus-like packets.
|
||||
|
||||
use super::*;
|
||||
use super::{Codec, Error, OpusTiming, Packet, Stream, crc32, open, opus_packet_samples, sniff};
|
||||
|
||||
/// Write one page holding `segments` (lacing already computed by `lace`).
|
||||
fn page(out: &mut Vec<u8>, flags: u8, granule: i64, serial: u32, seq: u32, lacing: &[u8], body: &[u8]) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::*;
|
||||
use super::{Font, PageLayout, PdfError, PdfOptions, Presentation, export, handout_boxes, raster_scale};
|
||||
use deckcraft_model::text::TextBody;
|
||||
|
||||
fn deck(n: usize) -> Presentation {
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
use super::*;
|
||||
use super::{
|
||||
Ctx, Fill, Image, Opts, PathMorph, Point, Rect, RenderOpts, Renderer, SlideFields, TextMorph, crop_dest, dpi_for_scale, gif_frame, image_dpi,
|
||||
images, morph_path, morph_text, parse_path, place_slide, render_blend, render_shapes, render_slide, text_transform,
|
||||
};
|
||||
use deckcraft_model::chart::{ChartType, Trendline, TrendlineType};
|
||||
use deckcraft_model::style::ColorRef;
|
||||
use deckcraft_model::text::TextBody;
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
//! Render tests for shape, line, fill and effect cases checked against PowerPoint's own exports
|
||||
//! of synthetic "wild" slides (observed black-box; see `plan/powerpoint/tools/gen_wild.py`).
|
||||
|
||||
use super::*;
|
||||
use super::{
|
||||
BezPath, Fill, Image, Line, MAX_DASHES, PathEl, Point, Rect, RenderOpts, ShapeKind, dash_with_caps, head_size, images, limit_dash_count, paint,
|
||||
preset, render_slide, trim_ends,
|
||||
};
|
||||
use deckcraft_color::Rgba;
|
||||
use deckcraft_model::style::ColorRef;
|
||||
use deckcraft_model::{CustomPath, Geom, Presentation, Shape, ShapeId, Xfrm};
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
use super::*;
|
||||
use super::{
|
||||
Affinity, Align, Anchor, Arc, AutoFit, BodyProps, Bullet, Caps, Cell, Ctx, Dash, Deco, DecoLine, FontDb, FontFace, GlyphRun, LINE_PITCH,
|
||||
MoveMode, NoFields, Opts, ParaProps, Point, Pos, Rect, Rgba, SUB_SUPER, Shape, Spacing, Strike, TextBody, TextLayout, autonum,
|
||||
break_opportunities, caps_char, chinese_num, covers_symbol, is_symbol_font, is_upright, layout, layout_scaled, map_symbol_bullet, measure_str,
|
||||
resolve, shaping_features, symbol_char, symbol_font_char, symbol_font_draw, symbol_unicode, symbol_unicode_alts,
|
||||
};
|
||||
use deckcraft_model::Fill;
|
||||
use deckcraft_model::defaults;
|
||||
use deckcraft_model::text::{Paragraph, Run};
|
||||
|
||||
@@ -12,7 +12,7 @@ use egui_kittest::Harness;
|
||||
use egui_kittest::kittest::Queryable;
|
||||
use serde_json::json;
|
||||
|
||||
use super::*;
|
||||
use super::theme;
|
||||
use crate::{Services, SlideApp};
|
||||
|
||||
fn harness(app: SlideApp) -> Harness<'static, SlideApp> {
|
||||
|
||||
Reference in New Issue
Block a user