## 3 Cross-Layer Design  
The stringent requirements of visual sensor networks have led to the design of cross-layer architectures. In order to attain high efficiency, reducing energy consumption and achieving lower communication delay, the protocols and algorithms of the MAC, network, transport and applications layers can operate in a cooperative way that disrupts the conventional data flow and the understanding of protocol layers. In such context, visual codecs play a crucial role prioritizing packets, splitting the source media in multiple streams and generating redundant information that are exploited by protocols and algorithms of different conceptual layers. An interesting example of multimedia-based cross-layer design is just congestion mitigation by transport layer. If the classical layer organization is respected, a typical transport protocol will reduce the current transmission rate to resolve congestion issues, potentially impacting the quality of the received media by the sink (loss of video frames, higher delay, _etc._). However, a cross-layer design may benefit from a multimedia coding technique that prioritizes the transmitted packets. In such case, the transport protocol would only reduce the transmission rate of the less-relevant packets, satisfactorily addressing congestion and potentially resulting in better end-to-end quality of the application. Many researchers advocate that cross-layer design is the best option for visual sensor networks [3, 6]. Multimedia-based cross-layer optimization solutions aim to achieve at least one of the following efficiency issues in wireless sensor networks:  
* _Transmission rate adjustment_: Multimedia coding techniques may prioritize the encoded data according to the relevance for the decoding process. If necessary (e.g., congestion, low bandwidth available, low energy of intermediate nodes), source nodes may avoid transmitting packets containing less relevant encoded data, decreasing the current transmission rate and saving energy throughout the path toward the sink. * _Energy preservation_: If the current energy level of intermediate nodes is lower than a given threshold, packets carrying low-relevance encoded data may be discarded to save energy. Source nodes may also avoid transmission of low-priority packets, reducing local energy consumption and indirectly preserving energy of intermediate nodes. * _Congestion control_: When intermediate nodes in an active path get congested, the queue algorithm can discard less relevant packets, reducing the negative impact in the perceptual quality of the received media at the sink. Also, source nodes can react to the congestion avoiding the transmission of less relevant packets. * _Multipath routing_: The available paths in wireless sensor networks may have different characteristics in end-to-end delay and residual energy of the intermediate nodes. Prioritized packets can be routed through the \"better\" paths or the multipath routing facility may be used to transmit redundant packets to protect from errors during transmission. * _Differentiated MAC transmission_: Based on the relevance of visual data after encoding, MAC protocols may provide a differentiated treatment in terms of reliability and channel access. For multimedia streaming applications, lower delays may be achieved when the link layer exploits the packets' priorities. * _Redundancy-based error recovery_: Multiple copies of higher priority packets may be transmitted to increase the probability of successful reception. A higher level of error-resilience is achieved when redundant packets exploit multipath routing or when intermediate nodes process/produce such packets. * _Error recovery by correction codes_: Bit errors may corrupt data during transmission over wireless links. In such a context, a correction code like UEP (Unequal Error Protection) can be employed to protect the most relevant parts of the encoded media, where information from transport, network or MAC layers may be considered when defining the level of protection that have to be applied.